text
stringlengths
4
6.14k
/* * Copyright (C) 2015 Orange * * This software is distributed under the terms and conditions of the 'Apache-2.0' * license which can be found in the file 'LICENSE.txt' in this package distribution * or at 'http://www.apache.org/licenses/LICENSE-2.0'. */ /* Message Type for SimpleBee Protocol * * Version: 0.1.0 * Created: 2015-02-18 by Franck Roudet */ #ifndef __SBMESSAGE_H_ #define __SBMESSAGE_H_ #include <sbdevicecom.h> #include <string.h> // Size of module address #define ADR_TYPE_SIZEOF 4 #define SBTResponseType(SBMsgReq) (SBMsgReq | 0x20) /** * Forward declaration */ class SBDevice; class SBSensor; class SBSwitch; class SBBinaryStateSensor; class SBBinaryStateActuator; /* * Calc checksum and store in dest. * dest size is 2 */ extern void SBCheckSum(const char * start, int length, char * dest); const char SBEndOfMessage='\r'; const char MODULE_TYPE_SIZEOF=3; /** * Base class for requests */ class SBMessage { public: const char type; SBMessage(const char type):type(type) {} }; /** * Request Message for identification. * Les modules neuf ont une adresse ‘0000’ et restent muets à la mise sous tension. * Lorsqu’on appuie sur le petit bouton en bas à gauche, le module envoie un message de demande d’adresse une seule fois à chaque appuie. Si pas de réponse, il se rendort. * Si la réponse est correcte, il fonctionne normalement et commence à envoyer des données. L’adresse est conservée dans le module et celui-ci fonctionnera normalement à une prochaine mise sous tension. * */ class SBMessageIdentificationReq : public SBMessage { public: char deviceType =SBDeviceType::sensor; char moduleType[MODULE_TYPE_SIZEOF]; /** * Contructors */ SBMessageIdentificationReq(const char *moduleType):SBMessage(SBMsgReqType::identification) { memcpy(this->moduleType, moduleType, MODULE_TYPE_SIZEOF); }; SBMessageIdentificationReq(const SBDevice * const device); }; class SBMessageIdentificationResponse : public SBMessage { public: char address[ADR_TYPE_SIZEOF]; /** * Constructors */ SBMessageIdentificationResponse(const char *moduleType):SBMessage(SBTResponseType(SBMsgReqType::identification)) {}; }; /** * Request Message for Binary State Actuator (LED...). * Message request : * Les actionneurs envoient toutes les 500 ms une requête, ils attendent pendant 100 ms une réponse. * */ class SBBinaryStateMessageRequestReq : public SBMessage { public: char sbaddress[ADR_TYPE_SIZEOF]; char value; const char batDelimit='B'; char batterylevel; // Must be '0' empty to '9' full char deviceType =SBDeviceType::actuator; char moduleType[MODULE_TYPE_SIZEOF]; /** * Contructors */ SBBinaryStateMessageRequestReq(const char *sbaddress):SBMessage(SBMsgReqType::request) { memcpy(this->sbaddress, sbaddress, ADR_TYPE_SIZEOF); }; SBBinaryStateMessageRequestReq(const char *sbaddress, char value): SBBinaryStateMessageRequestReq(sbaddress) { this->value= '0' + (value % 2); }; SBBinaryStateMessageRequestReq(const char *sbaddress, char value, char batterylevel): SBBinaryStateMessageRequestReq(sbaddress,value) { this->batterylevel= '0' + (batterylevel % 10); }; SBBinaryStateMessageRequestReq(const SBBinaryStateActuator * const device); }; /** * Request Response Message for Binary State Actuator (LED...). */ class SBMessageRequestResponse : public SBMessage { public: char sbaddress[ADR_TYPE_SIZEOF]; char value; /** * Contructors */ SBMessageRequestResponse(const char *sbaddress):SBMessage(SBTResponseType(SBMsgReqType::request)) { memcpy(this->sbaddress, sbaddress, ADR_TYPE_SIZEOF); }; SBMessageRequestResponse(const char *sbaddress, char value): SBMessageRequestResponse(sbaddress) { this->value= '0' + (value % 2); }; }; /** * Base MessageRequest for binary state sensor (switch...) * 2 states devices */ class SBBinaryStateBaseMessageReq : public SBMessage { public: char sbaddress[ADR_TYPE_SIZEOF]; char value; const char batDelimit='B'; char batterylevel; // Must be '0' empty to '9' full char deviceType =SBDeviceType::sensor; char moduleType[MODULE_TYPE_SIZEOF]; /** * Contructors */ SBBinaryStateBaseMessageReq(const char messageType, const SBBinaryStateSensor * const device); }; /** * Watchdog Message for binary state Sensor. * Message request : * Les capteurs se signalent par un message toutes les minutes, si pas de réponse, ils recommencent toutes les 2 secondes jusqu’à réponse correcte. */ class SBBinaryStateMessageWatchdogReq : public SBBinaryStateBaseMessageReq { public: /** * Contructors */ SBBinaryStateMessageWatchdogReq(const SBBinaryStateSensor * const device); }; /** * Watchdog Response Message for binary state sensor. */ class SBBinaryStateMessageWatchdogResponse : public SBMessage { public: char sbaddress[ADR_TYPE_SIZEOF]; char value; char deviceType =SBDeviceType::sensor; char moduleType[MODULE_TYPE_SIZEOF]; /** * Contructors */ SBBinaryStateMessageWatchdogResponse(const char *sbaddress):SBMessage(SBTResponseType(SBMsgReqType::watchdog)) { memcpy(this->sbaddress, sbaddress, ADR_TYPE_SIZEOF); }; SBBinaryStateMessageWatchdogResponse(const char *sbaddress, char value): SBBinaryStateMessageWatchdogResponse(sbaddress) { this->value= '0' + (value % 2); }; }; /** * Data Message for binary state sensor. * Les capteurs envoient leur valeurs si changement d’état. Ils essayent pendant 2 seconde jusqu’à obtenir un acquittement, sinon attendent le prochain changement d’état */ class SBBinaryStateMessageDataReq : public SBBinaryStateBaseMessageReq { public: /** * Contructors */ SBBinaryStateMessageDataReq(const SBBinaryStateSensor * const device); }; #endif // __SBMESSAGE_H_
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/auditmanager/AuditManager_EXPORTS.h> #include <aws/auditmanager/AuditManagerRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace AuditManager { namespace Model { /** */ class AWS_AUDITMANAGER_API GetAssessmentFrameworkRequest : public AuditManagerRequest { public: GetAssessmentFrameworkRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "GetAssessmentFramework"; } Aws::String SerializePayload() const override; /** * <p> The identifier for the framework. </p> */ inline const Aws::String& GetFrameworkId() const{ return m_frameworkId; } /** * <p> The identifier for the framework. </p> */ inline bool FrameworkIdHasBeenSet() const { return m_frameworkIdHasBeenSet; } /** * <p> The identifier for the framework. </p> */ inline void SetFrameworkId(const Aws::String& value) { m_frameworkIdHasBeenSet = true; m_frameworkId = value; } /** * <p> The identifier for the framework. </p> */ inline void SetFrameworkId(Aws::String&& value) { m_frameworkIdHasBeenSet = true; m_frameworkId = std::move(value); } /** * <p> The identifier for the framework. </p> */ inline void SetFrameworkId(const char* value) { m_frameworkIdHasBeenSet = true; m_frameworkId.assign(value); } /** * <p> The identifier for the framework. </p> */ inline GetAssessmentFrameworkRequest& WithFrameworkId(const Aws::String& value) { SetFrameworkId(value); return *this;} /** * <p> The identifier for the framework. </p> */ inline GetAssessmentFrameworkRequest& WithFrameworkId(Aws::String&& value) { SetFrameworkId(std::move(value)); return *this;} /** * <p> The identifier for the framework. </p> */ inline GetAssessmentFrameworkRequest& WithFrameworkId(const char* value) { SetFrameworkId(value); return *this;} private: Aws::String m_frameworkId; bool m_frameworkIdHasBeenSet; }; } // namespace Model } // namespace AuditManager } // namespace Aws
// // ViewController.h // AFNetworking+Pod // // Created by shenba on 16/4/14. // Copyright © 2016年 xiaowen. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
// // CCCameraWriterProtocol.h // CustomCamera // // Created by Adriano Braga Alencar on 17/03/15. // Copyright (c) 2015 YattaTech. All rights reserved. // @protocol CCCameraWriterProtocol <NSObject> @required @property (nonatomic) AVCaptureSession *session; @property (nonatomic) dispatch_queue_t sessionQueue; @property (nonatomic, getter = isRecording) BOOL recording; @optional - (void) configure: (DidConfigFinish) finish; - (void) startRunning; - (void) stopRunning; - (void) saveVideo: (DidVideoSave) completion; - (void) recordVideo; @end
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Fluent Bit * ========== * Copyright (C) 2015-2017 Treasure Data Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <fluent-bit/flb_info.h> #ifdef FLB_HAVE_BUFFERING #include <monkey/mk_core.h> #include <fluent-bit/flb_buffer.h> #include <fluent-bit/flb_task.h> #ifndef FLB_BUFFER_CHUNK_H #define FLB_BUFFER_CHUNK_H #define FLB_BUFFER_CHUNK_INCOMING 0 #define FLB_BUFFER_CHUNK_OUTGOING 1 #define FLB_BUFFER_CHUNK_DEFERRED 3 /* Return values */ #define FLB_BUFFER_OK 0 #define FLB_BUFFER_ERROR -1 #define FLB_BUFFER_NOTFOUND -404 struct flb_buffer_chunk { void *data; size_t size; uint64_t routes; /* bitmask routes */ uint8_t tmp_len; int buf_worker; char tmp[128]; /* temporal ref: Tag/output_instance */ char hash_hex[42]; }; int flb_buffer_chunk_add(struct flb_buffer_worker *worker, struct mk_event *event, char **filename); int flb_buffer_chunk_delete(struct flb_buffer_worker *worker, struct mk_event *event); int flb_buffer_chunk_delete_ref(struct flb_buffer_worker *worker, struct mk_event *event); int flb_buffer_chunk_push(struct flb_buffer *ctx, void *data, size_t size, char *tag, uint64_t routes, char *hash_hex); int flb_buffer_chunk_pop(struct flb_buffer *ctx, int thread_id, struct flb_task *task); int flb_buffer_chunk_mov(int type, char *name, uint64_t routes, struct flb_buffer_worker *worker); int flb_buffer_chunk_real_move(struct flb_buffer_worker *worker, struct mk_event *event); int flb_buffer_chunk_scan(struct flb_buffer *ctx); #endif #endif /* !FLB_HAVE_BUFFERING */
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkScalarChanAndVeseDenseLevelSetImageFilter_h #define itkScalarChanAndVeseDenseLevelSetImageFilter_h #include "itkMultiphaseDenseFiniteDifferenceImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkScalarChanAndVeseLevelSetFunction.h" namespace itk { /** \class ScalarChanAndVeseDenseLevelSetImageFilter * \brief Dense implementation of the Chan and Vese multiphase level set image filter. * * This code was adapted from the paper: * * "An active contour model without edges" * T. Chan and L. Vese. * In Scale-Space Theories in Computer Vision, pages 141-151, 1999. * * \author Mosaliganti K., Smith B., Gelas A., Gouaillard A., Megason S. * * This code was taken from the Insight Journal paper: * * "Cell Tracking using Coupled Active Surfaces for Nuclei and Membranes" * http://www.insight-journal.org/browse/publication/642 * https://hdl.handle.net/10380/3055 * * That is based on the papers: * * "Level Set Segmentation: Active Contours without edge" * http://www.insight-journal.org/browse/publication/322 * https://hdl.handle.net/1926/1532 * * and * * "Level set segmentation using coupled active surfaces" * http://www.insight-journal.org/browse/publication/323 * https://hdl.handle.net/1926/1533 * * \ingroup ITKReview * * \wiki * \wikiexample{Segmentation/SinglephaseChanAndVeseDenseFieldLevelSetSegmentation,Single-phase Chan And Vese Dense Field Level Set Segmentation} * \endwiki */ template< typename TInputImage, typename TFeatureImage, typename TOutputImage, typename TFunction = ScalarChanAndVeseLevelSetFunction< TInputImage, TFeatureImage >, class TSharedData = typename TFunction::SharedDataType > class ScalarChanAndVeseDenseLevelSetImageFilter: public MultiphaseDenseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFunction > { public: typedef ScalarChanAndVeseDenseLevelSetImageFilter Self; typedef MultiphaseDenseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFunction > Superclass; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(ScalarChanAndVeseDenseLevelSetImageFilter, MultiphaseDenseFiniteDifferenceImageFilter); itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); /** Inherited typedef from the superclass. */ typedef typename Superclass::InputImageType InputImageType; typedef typename Superclass::InputImagePointer InputImagePointer; typedef typename Superclass::InputPointType InputPointType; typedef typename Superclass::ValueType ValueType; typedef typename InputImageType::SpacingType InputSpacingType; typedef TFeatureImage FeatureImageType; typedef typename FeatureImageType::Pointer FeatureImagePointer; typedef typename FeatureImageType::PixelType FeaturePixelType; typedef typename FeatureImageType::IndexType FeatureIndexType; typedef typename FeatureIndexType::IndexValueType FeatureIndexValueType; typedef typename FeatureImageType::RegionType FeatureRegionType; /** Output image type typedefs */ typedef TOutputImage OutputImageType; typedef typename OutputImageType::IndexType IndexType; typedef typename OutputImageType::PixelType OutputPixelType; typedef typename Superclass::TimeStepType TimeStepType; typedef typename Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType; typedef TFunction FunctionType; typedef typename FunctionType::Pointer FunctionPointer; typedef TSharedData SharedDataType; typedef typename SharedDataType::Pointer SharedDataPointer; typedef RegionOfInterestImageFilter< FeatureImageType, FeatureImageType > ROIFilterType; typedef typename ROIFilterType::Pointer ROIFilterPointer; #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking itkConceptMacro( OutputHasNumericTraitsCheck, ( Concept::HasNumericTraits< OutputPixelType > ) ); // End concept checking #endif /** Set/Get the feature image to be used for speed function of the level set * equation. Equivalent to calling Set/GetInput(1, ..) */ virtual void SetFeatureImage(const FeatureImagePointer f) { this->SetInput(f); } protected: ScalarChanAndVeseDenseLevelSetImageFilter() { this->m_SharedData = SharedDataType::New(); } ~ScalarChanAndVeseDenseLevelSetImageFilter(){} SharedDataPointer m_SharedData; virtual void Initialize() ITK_OVERRIDE; virtual void InitializeIteration() ITK_OVERRIDE; private: ITK_DISALLOW_COPY_AND_ASSIGN(ScalarChanAndVeseDenseLevelSetImageFilter); }; } //end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkScalarChanAndVeseDenseLevelSetImageFilter.hxx" #endif #endif
/* SpiralLoadingView.h Buddycloud Created by Adnan U - [Deminem] on 12/12/10. Copyright 2010 buddycloud. All rights reserved. */ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> // Activity Bezel & Transparent View Tag #define ACTIVITY_LABEL_TAG 1111 #define ACTIVITY_TRANSPARENT_SHEET_TAG 2222 #define ACTIVITY_TRANSPARENT_SHEET_TAG_FB 3333 @interface SpiralLoadingView : NSObject { } - (void)showActivityLabelInCenter:(TTActivityLabelStyle)style withText:(NSString *)sMsg; - (void)showActivityLabelInCenter:(TTActivityLabelStyle)style withTransparentSheet:(BOOL)transparentSheet withText:(NSString *)sMsg; - (void)showActivityLabelWithStyle:(TTActivityLabelStyle)style withText:(NSString *)sMsg withActivityFrame:(CGRect)activityFrame; - (void)showActivityLabelWithStyle:(TTActivityLabelStyle)style withText:(NSString *)sMsg withTransparentSheet:(BOOL)transparentSheet withActivityFrame:(CGRect)activityFrame; - (void)stopActivity; @end
static int f(int x) { int y; if (x > 0) { y = 1; } else { y = f(-x); } return y; } int main() { printf("%d", f(1)); return 0; }
/************************************** File name : JsbPboc.h Function : ½­ËÕÒøÐÐPboc¿¨½Ó¿Ú Author : Yu Jun First edition : Apr 15th, 2014 Modified : **************************************/ /******************************************************************************* ½Ó¿Ú˵Ã÷: . ¹«¹²²ÎÊý ÿ¸öº¯ÊýµÄǰ4¸ö²ÎÊýΪ¹«¹²²ÎÊý, ËüÃÇÊÇchar *pszComNo, int nTermType, char cBpNo, int nIcFlag, ÔÚÕâÀïͳһÃèÊö, ÒÔºóÿ¸ö¾ßÌ庯Êý²»ÔÙÃèÊö. pszComNo: ͨѶ²ÎÊý, »ªÐŽӿڲ»ÐèÒª nTermType: ÖÕ¶ËÀàÐÍ, »ªÐŽӿڲ»ÐèÒª cBpNo: BPºÐµÄת¿Ú, »ªÐŽӿڲ»ÐèÒª nIcFlag: ¿¨ÀàÐÍ, 1:½Ó´¥IC¿¨ 2:·Ç½Ó´¥IC¿¨ 3:×Ô¶¯ÅÐ¶Ï Ö»Óк¯ÊýICC_GetIcInfo()ºÍICC_GetTranDetail()ÐèÒª ÆäËüº¯Êý»áÑØÓõ÷ÓÃICC_GetIcInfo()º¯Êýʱȷ¶¨µÄ¿¨ÀàÐÍ *******************************************************************************/ #ifndef _JSBPBOC_H #define _JSBPBOC_H #ifdef __cplusplus extern "C" { #endif #define JSBPBOC_OK 0 // OK #define JSBPBOC_CORE_INIT -1 // ºËÐijõʼ»¯´íÎó #define JSBPBOC_CARD_TYPE -2 // ²»Ö§³ÖµÄ¿¨Æ¬ÀàÐÍ #define JSBPBOC_TRANS_INIT -3 // ½»Ò׳õʼ»¯´íÎó #define JSBPBOC_NO_APP -4 // ÎÞÖ§³ÖµÄÓ¦Óà #define JSBPBOC_CARD_IO -5 // ¿¨²Ù×÷´í #define JSBPBOC_TAG_UNKNOWN -6 // ²»Ê¶±ðµÄ±êÇ© #define JSBPBOC_DATA_LOSS -7 // ±Ø±¸Êý¾Ý²»´æÔÚ #define JSBPBOC_PARAM -8 // ²ÎÊý´íÎó #define JSBPBOC_APP_DATA -9 // ´«ÈëµÄÓ¦ÓÃÊý¾ÝÓë´«³öµÄÓ¦ÓÃÊý¾Ý²»·û #define JSBPBOC_GEN_ARQC -10 // ¿¨Æ¬Î´Éú³ÉARQC #define JSBPBOC_LOG_FORMAT -11 // ÈÕÖ¾¸ñʽ²»Ö§³Ö #define JSBPBOC_UNKNOWN -99 // δ֪´íÎó // ³õʼ»¯º¯Êý int ICC_InitEnv(int (*pfiTestCard)(void), int (*pfiResetCard)(unsigned char *psAtr), int (*pfiDoApdu)(int iApduInLen, unsigned char *psApduIn, int *piApduOutLen, unsigned char *psApduOut), int (*pfiCloseCard)(void)); // ¶Á¿¨ÐÅÏ¢ // In : pszTagList : ±íʾÐèÒª·µ»ØµÄÓû§Êý¾ÝµÄ±êÇ©Áбí // Out : pnUsrInfoLen : ·µ»ØµÄÓû§Êý¾Ý³¤¶È // pszUserInfo : ·µ»ØµÄÓû§Êý¾Ý, »º³åÇøÖÁÉÙ±£Áô1024×Ö½Ú // pszAppData : IC¿¨Êý¾Ý, °üÀ¨Tag8C¡¢Tag8DµÈ, ÓÃÓÚÉú³É55Óò, »º³åÇøÖÁÉÙ±£Áô4096×Ö½Ú // pnIcType : Éϵç³É¹¦µÄ¿¨ÀàÐÍ, 1:½Ó´¥¿¨ 2:·Ç½Ó¿¨ // ÓÃÓÚº¯ÊýICC_GenARQC()ºÍICC_CtlScriptData()´«Èë // Ret : 0 : ³É¹¦ // <0 : ʧ°Ü int ICC_GetIcInfo(char *pszComNo, int nTermType, char cBpNo, int nIcFlag, char *pszTaglist, int *pnUsrInfoLen, char *pszUserInfo, char *pszAppData, int *pnIcType); // »ñÈ¡PbocÓ¦Óð汾, ±ØÐëÔÚICC_GetIcInfoÖ®ºóÖ´ÐÐ // Out : pszPbocVer : ·µ»ØµÄPBOC°æ±¾ºÅ£¬"0002"±êʶPBOC2.0£¬"0003"±êʶPBOC3.0 // Ret : 0 : ³É¹¦ // <0 : ʧ°Ü int ICC_GetIcPbocVersion(char *pszPbocVer); // Éú³ÉARQC // In : pszTxData : ½»Ò×Êý¾Ý, ±êÇ©¼Ó³¤¶ÈÄÚÈݸñʽ // pszAppData : ICC_GetIcInfoº¯Êý·µ»ØµÄÓ¦ÓÃÊý¾Ý, ±ØÐë±£³ÖÓëÔ­Êý¾ÝÏàͬ // Out : pnARQCLen : ·µ»ØµÄARQC³¤¶È // pszARQC : ·µ»ØµÄARQC, TLV¸ñʽ, ת»»Îª16½øÖƿɶÁÐÎʽ // Ret : 0 : ³É¹¦ // <0 : ʧ°Ü int ICC_GenARQC(char *pszComNo, int nTermType, char cBpNo, int nIcFlag, char *pszTxData, char *pszAppData, int *pnARQCLen, char *pszARQC); // ½»Ò×½áÊø´¦Àí // In : pszTxData : ½»Ò×Êý¾Ý, ±êÇ©¼Ó³¤¶ÈÄÚÈݸñʽ // pszAppData : ICC_GetIcInfoº¯Êý·µ»ØµÄÓ¦ÓÃÊý¾Ý, ±ØÐë±£³ÖÓëÔ­Êý¾ÝÏàͬ // pszARPC : ·¢¿¨ÐÐÊý¾Ý, TLV¸ñʽ, ת»»Îª16½øÖƿɶÁÐÎʽ // Out : pnTCLen : ·µ»ØµÄTC³¤¶È // pszTC : ·µ»ØµÄTC, TLV¸ñʽ, ת»»Îª16½øÖƿɶÁÐÎʽ // Ret : 0 : ³É¹¦ // <0 : ʧ°Ü int ICC_CtlScriptData(char *pszComNo, int nTermType, char cBpNo, int nIcFlag, char *pszTxData, char *pszAppData, char *pszARPC, int *pnTCLen, char *pszTC, char *pszScriptResult); // ¶ÁÈ¡½»Ò×Ã÷ϸ // Out : pnTxDetailLen: ½»Ò×Ã÷ϸ³¤¶È // TxDetail : ½»Ò×Ã÷ϸ, ¸ñʽΪ // Ã÷ϸÌõÊý(2×Ö½ÚÊ®½øÖÆ)+ÿÌõÃ÷ϸµÄ³¤¶È(3×Ö½ÚÊ®½øÖÆ) + Ã÷ϸ1+Ã÷ϸ2+... // Ret : 0 : ³É¹¦ // <0 : ʧ°Ü // Note: ×î¶à10Ìõ¼Ç¼ int ICC_GetTranDetail(char *pszComNo, int nTermType, char BpNo, int nIcFlag, int *pnTxDetailLen, char *TxDetail); #ifdef __cplusplus } #endif #endif
#ifndef _CLIENT_SESSION_H_ #define _CLIENT_SESSION_H_ #include <string> #include "protocol_def.h" namespace FDXSLib { /////////////////////////////////////////////////////////////////////////////// class client { public: client(); virtual ~client(); virtual bool connect( const char* ip, std::size_t port, std::size_t timeout ); virtual void disconnect(); virtual bool send_message( const protocol_message* message, std::size_t timeout ); virtual bool recv_message( protocol_message* message, std::size_t timeout ); private: client( const client& ); client& operator= ( const client& ); client* implement_; }; /////////////////////////////////////////////////////////////////////////////// } #endif // _CLIENT_SESSION_H_
/* * Copyright (c) 2015 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_ #define ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_ #include <device.h> #include <kernel.h> #include <sys/atomic.h> #ifdef __cplusplus extern "C" { #endif /** * @brief Runtime Power Management API * * @defgroup runtime_power_management_api Runtime Power Management API * @ingroup power_management_api * @{ */ #ifdef CONFIG_PM_DEVICE_RUNTIME /** * @brief Enable device runtime PM * * Called by a device driver to enable device runtime power management. * The device might be asynchronously suspended if runtime PM is enabled * when the device is not use. * * @funcprops \pre_kernel_ok * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. */ void pm_device_enable(const struct device *dev); /** * @brief Disable device runtime PM * * Called by a device driver to disable device runtime power management. * The device might be asynchronously resumed if runtime PM is disabled * * @funcprops \pre_kernel_ok * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. */ void pm_device_disable(const struct device *dev); /** * @brief Call device resume asynchronously based on usage count * * Called by a device driver to mark the device as being used. * This API will asynchronously bring the device to resume state * if it not already in active state. * * @funcprops \isr_ok, \pre_kernel_ok * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. * @retval 0 If successfully queued the Async request. If queued, * the caller need to wait on the poll event linked to device * pm signal mechanism to know the completion of resume operation. * @retval Errno Negative errno code if failure. */ int pm_device_get_async(const struct device *dev); /** * @brief Call device resume synchronously based on usage count * * Called by a device driver to mark the device as being used. It * will bring up or resume the device if it is in suspended state * based on the device usage count. This call is blocked until the * device PM state is changed to resume. * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. * @retval 0 If successful. * @retval Errno Negative errno code if failure. */ int pm_device_get(const struct device *dev); /** * @brief Call device suspend asynchronously based on usage count * * Called by a device driver to mark the device as being released. * This API asynchronously put the device to suspend state if * it not already in suspended state. * * @funcprops \isr_ok, \pre_kernel_ok * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. * @retval 0 If successfully queued the Async request. If queued, * the caller need to wait on the poll event linked to device pm * signal mechanism to know the completion of suspend operation. * @retval Errno Negative errno code if failure. */ int pm_device_put_async(const struct device *dev); /** * @brief Call device suspend synchronously based on usage count * * Called by a device driver to mark the device as being released. It * will put the device to suspended state if is is in active state * based on the device usage count. This call is blocked until the * device PM state is changed to resume. * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. * @retval 0 If successful. * @retval Errno Negative errno code if failure. */ int pm_device_put(const struct device *dev); /** * @brief Wait on a device to finish an operation. * * The calling thread blocks until the device finishes a * @ref pm_device_put_async or @ref pm_device_get_async operation. If there is * no operation in progress this function will return immediately. * * @param dev Pointer to device structure of the specific device driver * the caller is interested in. * @param timeout The timeout passed to k_condvar_wait. If a timeout happens * this function will return immediately. * @retval 0 If successful. * @retval Errno Negative errno code if failure. */ int pm_device_wait(const struct device *dev, k_timeout_t timeout); #else static inline void pm_device_enable(const struct device *dev) { } static inline void pm_device_disable(const struct device *dev) { } static inline int pm_device_get(const struct device *dev) { return -ENOSYS; } static inline int pm_device_get_async(const struct device *dev) { return -ENOSYS; } static inline int pm_device_put(const struct device *dev) { return -ENOSYS; } static inline int pm_device_put_async(const struct device *dev) { return -ENOSYS; } static inline int pm_device_wait(const struct device *dev, k_timeout_t timeout) { return -ENOSYS; } #endif /** @} */ #endif /* ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_ */
/* * Copyright 2018 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #if THRUST_CPP_DIALECT >= 2017 #if __has_include(<version>) # include <version> #endif #endif #include <thrust/detail/config.h> #include <type_traits> namespace thrust { #if defined(__cpp_lib_remove_cvref) && (__cpp_lib_remove_cvref >= 201711L) using std::remove_cvref; using std::remove_cvref_t; #else // Older than C++20. template <typename T> struct remove_cvref { using type = typename std::remove_cv< typename std::remove_reference<T>::type >::type; }; #if THRUST_CPP_DIALECT >= 2011 template <typename T> using remove_cvref_t = typename remove_cvref<T>::type; #endif #endif // THRUST_CPP_DIALECT >= 2020 } // end namespace thrust
/* * Copyright 2009-2011 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _SCHEDULEROBJECT_H #define _SCHEDULEROBJECT_H #include <qpid/management/Manageable.h> #include <qpid/management/ManagementObject.h> #include <qpid/agent/ManagementAgent.h> #include <qpid/types/Variant.h> #include "Scheduler.h" #include "condor_classad.h" namespace com { namespace redhat { namespace grid { using namespace qpid::management; using namespace qpid::types; class SchedulerObject : public qpid::management::Manageable { public: SchedulerObject(qpid::management::ManagementAgent *agent, const char* _name); ~SchedulerObject(); qpid::management::ManagementObject *GetManagementObject(void) const; void update(const ClassAd &ad); status_t ManagementMethod(uint32_t methodId, Args &args, std::string &text); bool AuthorizeMethod(uint32_t methodId, Args& args, const std::string& userId); private: qmf::com::redhat::grid::Scheduler *mgmtObject; status_t Submit(Variant::Map &ad, std::string &id, std::string &text); status_t GetJobs(std::string submission, Variant::Map &jobs, std::string &text); status_t SetAttribute(std::string id, std::string name, std::string value, std::string &text); status_t Hold(std::string id, std::string &reason, std::string &text); status_t Release(std::string id, std::string &reason, std::string &text); status_t Remove(std::string id, std::string &reason, std::string &text); }; }}} /* com::redhat::grid */ #endif /* _SCHEDULEROBJECT_H */
// // these are dynamic defines used by the fb JS compiler // // when compiling in a real project these are dynamically generated // these defined here mainly for when running inside xcode // // MODULES #define USE_TI_STREAM #define USE_TI_CODEC #define USE_TI_UTILS #define USE_TI_XML #define USE_TI_ACCELEROMETER #define USE_TI_API #define USE_TI_APP #define USE_TI_CONTACTS #define USE_TI_DATABASE #define USE_TI_FACEBOOK #define USE_TI_FILESYSTEM #define USE_TI_GEOLOCATION #define USE_TI_GESTURE #define USE_TI_MAP #define USE_TI_MEDIA #define USE_TI_NETWORK #define USE_TI_NETWORKSOCKET #define USE_TI_PLATFORM #define USE_TI_YAHOO #define USE_TI_UI #define USE_TI_UITAB #define USE_TI_UILABEL #define USE_TI_UIBUTTON #define USE_TI_UIPROGRESSBAR #define USE_TI_UISEARCHBAR #define USE_TI_UIACTIVITYINDICATOR #define USE_TI_UISLIDER #define USE_TI_UISWITCH #define USE_TI_UIPICKER #define USE_TI_UITOOLBAR //DEPRECATED #define USE_TI_UITEXTAREA #define USE_TI_UITEXTFIELD #define USE_TI_UIIMAGEVIEW #define USE_TI_UIMASKEDIMAGE #define USE_TI_UIWEBVIEW #define USE_TI_UIWINDOW #define USE_TI_UIVIEW #define USE_TI_UIOPTIONDIALOG #define USE_TI_UIEMAILDIALOG #define USE_TI_UIDASHBOARDVIEW #define USE_TI_UISCROLLVIEW #define USE_TI_UISCROLLABLEVIEW #define USE_TI_UITABLEVIEW #define USE_TI_UI2DMATRIX #define USE_TI_UI3DMATRIX #define USE_TI_UIANIMATION #define USE_TI_UICOVERFLOWVIEW //DEPRECATED #define USE_TI_UITABBEDBAR //DEPRECATED #define USE_TI_UIIPHONE #define USE_TI_UIIPHONEROWANIMATIONSTYLE #define USE_TI_UIIPHONESTATUSBAR #define USE_TI_UIIPHONESYSTEMICON #define USE_TI_UIIPHONESYSTEMBUTTONSTYLE #define USE_TI_UIIPHONESYSTEMBUTTON #define USE_TI_UIIPHONEACTIVITYINDICATORSTYLE #define USE_TI_UIIPHONEANIMATIONSTYLE #define USE_TI_UIIPHONEPROGRESSBARSTYLE #define USE_TI_UIIPHONESCROLLINDICATORSTYLE #define USE_TI_UIIPHONETABLEVIEWSTYLE #define USE_TI_UIIPHONETABLEVIEWSEPARATORSTYLE #define USE_TI_UIIPHONETABLEVIEWSCROLLPOSITION #define USE_TI_UIIPHONETABLEVIEWCELLSELECTIONSTYLE #define USE_TI_UIIPHONENAVIGATIONGROUP #define USE_TI_UIIPHONEALERTDIALOGSTYLE #define USE_TI_UICLIPBOARD #define USE_TI_UIIPAD #define USE_TI_UIIPADPOPOVER #define USE_TI_UIIPADSPLITWINDOW #define USE_TI_UIIPADDOCUMENTVIEWER #define USE_TI_UIIPADSPLITWINDOWBUTTON #define USE_TI_UIIOS #define USE_TI_UIIOSADVIEW #define USE_TI_UIIOS3DMATRIX #define USE_TI_UIIOSCOVERFLOWVIEW #define USE_TI_UIIOSTOOLBAR #define USE_TI_UIIOSTABBEDBAR #define USE_TI_UIIOSDOCUMENTVIEWER #define USE_TI_APPIOS
/* Package: dyncall Library: dyncallback File: dyncallback/dyncall_callback_arm32_arm.c Description: Callback - Implementation for ARM32 (ARM mode) License: Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "dyncall_callback_arm32_arm.h" #include "dyncall_args_arm32_arm.h" #include "dyncall_alloc_wx.h" #include "dyncall_signature.h" extern void dcCallbackThunkEntry(); void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata) { pcb->handler = handler; pcb->userdata = userdata; } DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) { int err; DCCallback* pcb; err = dcAllocWX(sizeof(DCCallback), (void**)&pcb); if(err || !pcb) return 0; dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); dcbInitCallback(pcb, signature, handler, userdata); return pcb; } void dcbFreeCallback(DCCallback* pcb) { dcFreeWX(pcb, sizeof(DCCallback)); }
/* * grass.h * * Created on: 2017年1月6日 * Author: zhuqian */ #ifndef SRC_MATERIALS_GLASS_H_ #define SRC_MATERIALS_GLASS_H_ #include "raiden.h" #include "material.h" #include "memory.h" #include "interaction.h" #include "reflection.h" #include "texture.h" #include "microfacet.h" class GlassMaterial : public Material { private: std::shared_ptr<Texture<Spectrum>> _kr; std::shared_ptr<Texture<Spectrum>> _kt; std::shared_ptr<Texture<Float>> _eta; std::shared_ptr<Texture<Float>> _roughness; public: GlassMaterial(const std::shared_ptr<Texture<Spectrum>>& kr, const std::shared_ptr<Texture<Spectrum>>& kt, const std::shared_ptr<Texture<Float>>& eta,const std::shared_ptr<Texture<Float>>& roughness):_kr(kr),_kt(kt),_eta(eta),_roughness(roughness){ } virtual void ComputeScatteringFunctions(SurfaceInteraction *si, MemoryArena &arena, TransportMode mode, bool allowMultipleLobes) const override { //1.先为SurfaceInteraction分配bsdf Spectrum R = _kr->Evaluate(*si); Spectrum T = _kt->Evaluate(*si); Float eta = _eta->Evaluate(*si); si->bsdf = ARENA_ALLOC(arena, BSDF)(*si,eta); if(R.IsBlack()&&T.IsBlack()){ return; } //2.判断是否是镜面反射或者折射 Float r = _roughness->Evaluate(*si); bool isSpecular=(r==0); //3.判断是否需要微平面分布 IsotropyGGXDistribution *ggx=(isSpecular==true)?nullptr:ARENA_ALLOC(arena, IsotropyGGXDistribution)(GGXRoughnessToAlpha(r)); FresnelDielectric * fresnel=ARENA_ALLOC(arena, FresnelDielectric)(1.0,eta); if (isSpecular&&allowMultipleLobes) { si->bsdf->Add(ARENA_ALLOC(arena,FresnelSpecular)(R,T,1,eta,mode)); } else { if (!R.IsBlack()) { if(isSpecular){ si->bsdf->Add(ARENA_ALLOC(arena, SpecularReflection)(R,fresnel)); } else{ si->bsdf->Add(ARENA_ALLOC(arena,MicrofacetReflection)(R,ggx,fresnel)); } } if (!T.IsBlack()) { if(isSpecular){ si->bsdf->Add(ARENA_ALLOC(arena, SpecularTransmission)(T,1.0,eta,mode)); } else{ si->bsdf->Add(ARENA_ALLOC(arena,MicrofacetTransmission)(T,ggx,fresnel,1.0,eta,mode)); } } } } virtual ~GlassMaterial() {}; }; GlassMaterial* CreateGlassMaterial(const TextureParams&mp); #endif /* SRC_MATERIALS_GLASS_H_ */
/* Copyright (c) 2012-2021 Carsten Burstedde, Donna Calhoun All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FCLAW2D_FORESTCLAW_H #define FCLAW2D_FORESTCLAW_H #include <fclaw2d_defs.h> #ifdef __cplusplus extern "C" { #endif const int SpaceDim = FCLAW2D_SPACEDIM; const int NumFaces = FCLAW2D_NUMFACES; const int NumCorners = FCLAW2D_NUMCORNERS; const int NumSiblings = FCLAW2D_NUMSIBLINGS; const int RefineFactor = FCLAW2D_REFINEFACTOR; #ifdef __cplusplus } #endif #endif
#ifndef COMPAT_HOOKS_H #define COMPAT_HOOKS_H /** * apkenv * Copyright (c) 2012, Thomas Perl <m@thp.io> * Based on code from libhybris: Copyright (c) 2012 Carsten Munk * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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. **/ struct _hook { const char *name; void *func; }; void *get_hooked_symbol(const char *sym); void *get_hooked_symbol_dlfcn(void *handle, const char *sym); void *get_builtin_lib_handle(const char *libname); int is_builtin_lib_handle(void *handle); int register_hooks(const struct _hook *hooks, size_t count); int is_lib_optional(const char *name); void hooks_init(void); #define SIZEOF_SF 0x54 // taken from NDK extern char my___sF[SIZEOF_SF * 3]; #endif /* COMPAT_HOOKS_H */
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++ // NOTE: Do not modify the contents of this file. If this class is regenerated by // Microsoft Visual C++, your modifications will be overwritten. ///////////////////////////////////////////////////////////////////////////// // CProjectModules wrapper class class CProjectModules : public CWnd { protected: DECLARE_DYNCREATE(CProjectModules) public: CLSID const& GetClsid() { static CLSID const clsid = { 0x5743ffdd, 0xa20, 0x11d2, { 0xae, 0xe7, 0x0, 0xa0, 0xc9, 0xb7, 0x1d, 0xc4 } }; return clsid; } virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, pPersist, bStorage, bstrLicKey); } // Attributes public: LPDISPATCH GetDataSource(); void SetDataSource(LPDISPATCH); CString GetProject(); void SetProject(LPCTSTR); // Operations public: void AboutBox(); };
/* * POK header * * The following file is a part of the POK project. Any modification should * made according to the POK licence. You CANNOT use this file or a part of * this file is this part of a file for your own project * * For more information on the POK licence, please see our LICENCE FILE * * Please follow the coding guidelines described in doc/CODING_GUIDELINES * * Copyright (c) 2007-2009 POK team * * Created by julien on Fri Jan 30 14:41:34 2009 */ /* @(#)s_finite.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * finite(x) returns 1 is x is finite, else 0; * no branching! */ #ifdef POK_NEEDS_LIBMATH #include <libm.h> #include "math_private.h" int finite(double x) { int32_t hx; GET_HIGH_WORD(hx,x); return (int)((uint32_t)((hx&0x7fffffff)-0x7ff00000)>>31); } #endif
// // Copyright (c) 2009, Andre Gaschler // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <memory> #include <QAction> #include <QDockWidget> #include <QDoubleSpinBox> #include <QLineEdit> #include <QMainWindow> #include <QPushButton> #include <QTableView> #include <QTabWidget> #include <QTimer> #include <vector> #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> #include <rl/mdl/Dynamic.h> #include <rl/sg/Model.h> #include <rl/sg/so/Scene.h> class ConfigurationDelegate; class ConfigurationModel; class PositionDelegate; class PositionModel; class VelocityDelegate; class VelocityModel; class AccelerationDelegate; class AccelerationModel; class TorqueModel; class TorqueDelegate; class OperationalDelegate; class OperationalModel; class Server; class SoGradientBackground; class MainWindow : public QMainWindow { Q_OBJECT public: virtual ~MainWindow(); static MainWindow* instance(); AccelerationModel* accelerationModel; std::shared_ptr<rl::mdl::Dynamic> dynamicModel; rl::math::Vector externalTorque; rl::sg::Model* geometryModels; OperationalModel* operationalModel; PositionModel* positionModel; std::shared_ptr<rl::sg::so::Scene> scene; TorqueModel* torqueModel; VelocityModel* velocityModel; public slots: void changeSimulationGravity(double value); void changeSimulationDampingFactor(double value); void clickSimulationPause(); void clickSimulationReset(); void clickSimulationStart(); void saveImage(); void saveScene(); protected: MainWindow(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); void timerEvent(QTimerEvent *event); private: void init(); AccelerationDelegate* accelerationDelegate; QDockWidget* accelerationDockWidget; QTableView* accelerationView; SoGradientBackground* gradientBackground; OperationalDelegate* operationalDelegate; QDockWidget* operationalDockWidget; QTableView* operationalViews; PositionDelegate* positionDelegate; QDockWidget* positionDockWidget; QTableView* positionView; QAction* saveImageAction; QAction* saveSceneAction; Server* server; QDoubleSpinBox* simulationDampingFactor; rl::math::Real simulationDampingValue; QDockWidget* simulationDockWidget; QDoubleSpinBox* simulationGravity; rl::math::Real simulationGravityValue; bool simulationIsRunning; QPushButton* simulationPause; QPushButton* simulationReset; QLineEdit* simulationResultsEnergy; QLineEdit* simulationResultsTime; rl::math::Vector simulationResetQ; rl::math::Vector simulationResetQd; rl::math::Vector simulationResetQdd; QPushButton* simulationStart; int simulationStepsPerFrame; QLineEdit* simulationTime; rl::math::Real simulationTimeElapsed; rl::math::Real simulationTimeStep; static MainWindow* singleton; QBasicTimer timer; TorqueDelegate* torqueDelegate; QDockWidget* torqueDockWidget; QTableView* torqueView; VelocityDelegate* velocityDelegate; QDockWidget* velocityDockWidget; QTableView* velocityView; SoQtExaminerViewer* viewer; }; #endif // MAINWINDOW_H
/* * Copyright 2010-2012 Branimir Karadzic. All rights reserved. * License: http://www.opensource.org/licenses/BSD-2-Clause */ #ifndef __BX_COMMANDLINE_H__ #define __BX_COMMANDLINE_H__ #include "bx.h" #include "string.h" namespace bx { class CommandLine { public: CommandLine(int _argc, char const* const* _argv) : m_argc(_argc) , m_argv(_argv) { } const char* findOption(const char* _long, const char* _default) const { const char* result = find('\0', _long, 1); return result == NULL ? _default : result; } const char* findOption(const char _short, const char* _long, const char* _default) const { const char* result = find(_short, _long, 1); return result == NULL ? _default : result; } const char* findOption(const char* _long, int _numParams = 1) const { const char* result = find('\0', _long, _numParams); return result; } const char* findOption(const char _short, const char* _long = NULL, int _numParams = 1) const { const char* result = find(_short, _long, _numParams); return result; } bool hasArg(const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 0); return NULL != arg; } bool hasArg(const char* _long) const { const char* arg = findOption('\0', _long, 0); return NULL != arg; } bool hasArg(const char*& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); _value = arg; return NULL != arg; } bool hasArg(int& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); if (NULL != arg) { _value = atoi(arg); return true; } return false; } bool hasArg(unsigned int& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); if (NULL != arg) { _value = atoi(arg); return true; } return false; } bool hasArg(bool& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); if (NULL != arg) { if ('0' == *arg || stricmp(arg, "false") ) { _value = false; } else if ('0' != *arg || stricmp(arg, "true") ) { _value = true; } return true; } return false; } private: const char* find(const char _short, const char* _long, int _numParams) const { for (int ii = 0; ii < m_argc; ++ii) { const char* arg = m_argv[ii]; if ('-' == *arg) { ++arg; if (_short == *arg) { if (1 == strlen(arg) ) { if (0 == _numParams) { return ""; } else if (ii+_numParams < m_argc && '-' != *m_argv[ii+1] ) { return m_argv[ii+1]; } return NULL; } } else if (NULL != _long && '-' == *arg && 0 == stricmp(arg+1, _long) ) { if (0 == _numParams) { return ""; } else if (ii+_numParams < m_argc && '-' != *m_argv[ii+1] ) { return m_argv[ii+1]; } return NULL; } } } return NULL; } int m_argc; char const* const* m_argv; }; } // namespace bx #endif /// __BX_COMMANDLINE_H__
// // PongAppDelegate.h // Pong // // Created by Wolfgang Schreurs on 1/8/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> #import "OGLView.h" @interface PongAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; OGLView *glView; } @property (nonatomic, retain) IBOutlet UIWindow *window; @end
/** * @file mem_barriers.c * @brief Memory barriers or data cache invalidation/flushing for ARM processors * * @description Memory barriers or data cache invalidation/flushing may be * required around mailbox accesses, details on this needs to be added to this * page (or the page for the particular mailbox/channel that requires it) by * someone who knows the details. * * The following instructions are taken from * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0360f/I1014942.html. Any * unneeded register can be used in the following example instead of r3. * * mov r3, #0 # The read register Should Be Zero before the call * mcr p15, 0, r3, c7, c6, 0 # Invalidate Entire Data Cache * mcr p15, 0, r3, c7, c10, 0 # Clean Entire Data Cache * mcr p15, 0, r3, c7, c14, 0 # Clean and Invalidate Entire Data Cache * mcr p15, 0, r3, c7, c10, 4 # Data Synchronization Barrier * mcr p15, 0, r3, c7, c10, 5 # Data Memory Barrier * * @author Michele Di Giorgio * @date 23.11.2015 */ #ifndef __ASSEMBLER__ /** * This instruction ensures all data memory accesses are completed before the * next instruction. */ static inline void data_mem_barrier(void) { __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); } #ifndef __ARCH_ARM__ static inline void isb(void) { __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory"); } #else #if __ARCH_ARM__ >= 7 #define isb(option) __asm__ __volatile__ ("isb " #option : : : "memory") #else static inline void isb(void) { __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory"); } #endif #endif #endif /* __ASSEMBLER__ */
#define JDK_HAS_NAMESPACES 1 #define JDK_HAS_STD_STRING 1 #define JDK_FAKE_THREAD 0 #undef JDK_HAS_THREADS #define JDK_HAS_THREADS 1 #define JDK_HAS_FORK 1 #define JDK_HAS_EXPLICIT 1 #ifndef JDK_IS_MACOSX_TIGER #define JDK_IS_MACOSX_TIGER 1 #endif
/* * Copyright (c) Citrix Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <string.h> #include "xen_internal.h" #include <xen/api/xen_vm_operations.h> #include "xen_vm_operations_internal.h" /* * Maintain this in the same order as the enum declaration! */ static const char *lookup_table[] = { "snapshot", "clone", "copy", "create_template", "revert", "checkpoint", "snapshot_with_quiesce", "provision", "start", "start_on", "pause", "unpause", "clean_shutdown", "clean_reboot", "hard_shutdown", "power_state_reset", "hard_reboot", "suspend", "csvm", "resume", "resume_on", "pool_migrate", "migrate_send", "get_boot_record", "send_sysrq", "send_trigger", "query_services", "changing_memory_live", "awaiting_memory_live", "changing_dynamic_range", "changing_static_range", "changing_memory_limits", "changing_shadow_memory", "changing_shadow_memory_live", "changing_VCPUs", "changing_VCPUs_live", "assert_operation_valid", "data_source_op", "update_allowed_operations", "make_into_template", "import", "export", "metadata_export", "reverting", "destroy", "undefined" }; extern xen_vm_operations_set * xen_vm_operations_set_alloc(size_t size) { return calloc(1, sizeof(xen_vm_operations_set) + size * sizeof(enum xen_vm_operations)); } extern void xen_vm_operations_set_free(xen_vm_operations_set *set) { free(set); } const char * xen_vm_operations_to_string(enum xen_vm_operations val) { return lookup_table[val]; } extern enum xen_vm_operations xen_vm_operations_from_string(xen_session *session, const char *str) { (void)session; return ENUM_LOOKUP(str, lookup_table); } const abstract_type xen_vm_operations_abstract_type_ = { .typename = ENUM, .enum_marshaller = (const char *(*)(int))&xen_vm_operations_to_string, .enum_demarshaller = (int (*)(xen_session *, const char *))&xen_vm_operations_from_string }; const abstract_type xen_vm_operations_set_abstract_type_ = { .typename = SET, .child = &xen_vm_operations_abstract_type_ };
/** * @file net.c Networking code. * * Copyright (C) 2010 Creytiv.com */ #define _BSD_SOURCE 1 #define _DEFAULT_SOURCE 1 #include <stdlib.h> #include <string.h> #if !defined(WIN32) && !defined(CYGWIN) #define __USE_BSD 1 /**< Use BSD code */ #include <unistd.h> #include <netdb.h> #endif #include <re_types.h> #include <re_fmt.h> #include <re_mbuf.h> #include <re_sa.h> #include <re_net.h> #define DEBUG_MODULE "net" #define DEBUG_LEVEL 5 #include <re_dbg.h> /** * Get the IP address of the host * * @param af Address Family * @param ip Returned IP address * * @return 0 if success, otherwise errorcode */ int net_hostaddr(int af, struct sa *ip) { char hostname[256]; struct in_addr in; struct hostent *he; if (-1 == gethostname(hostname, sizeof(hostname))) return errno; he = gethostbyname(hostname); if (!he) return ENOENT; if (af != he->h_addrtype) return EAFNOSUPPORT; /* Get the first entry */ memcpy(&in, he->h_addr_list[0], sizeof(in)); sa_set_in(ip, ntohl(in.s_addr), 0); return 0; } /** * Get the default source IP address * * @param af Address Family * @param ip Returned IP address * * @return 0 if success, otherwise errorcode */ int net_default_source_addr_get(int af, struct sa *ip) { #if defined(WIN32) || defined(CYGWIN) return net_hostaddr(af, ip); #else char ifname[64] = ""; #ifdef HAVE_ROUTE_LIST /* Get interface with default route */ (void)net_rt_default_get(af, ifname, sizeof(ifname)); #endif /* First try with default interface */ if (0 == net_if_getaddr(ifname, af, ip)) return 0; /* Then try first real IP */ if (0 == net_if_getaddr(NULL, af, ip)) return 0; return net_if_getaddr4(ifname, af, ip); #endif } /** * Get a list of all network interfaces including name and IP address. * Both IPv4 and IPv6 are supported * * @param ifh Interface handler, called once per network interface * @param arg Handler argument * * @return 0 if success, otherwise errorcode */ int net_if_apply(net_ifaddr_h *ifh, void *arg) { #ifdef HAVE_GETIFADDRS return net_getifaddrs(ifh, arg); #else return net_if_list(ifh, arg); #endif } static bool net_rt_handler(const char *ifname, const struct sa *dst, int dstlen, const struct sa *gw, void *arg) { void **argv = arg; struct sa *ip = argv[1]; (void)dst; (void)dstlen; if (0 == str_cmp(ifname, argv[0])) { *ip = *gw; return true; } return false; } /** * Get the IP-address of the default gateway * * @param af Address Family * @param gw Returned Gateway address * * @return 0 if success, otherwise errorcode */ int net_default_gateway_get(int af, struct sa *gw) { char ifname[64]; void *argv[2]; int err; if (!af || !gw) return EINVAL; err = net_rt_default_get(af, ifname, sizeof(ifname)); if (err) return err; argv[0] = ifname; argv[1] = gw; err = net_rt_list(net_rt_handler, argv); if (err) return err; return 0; }
/* vim:set ts=2 sw=2 et cindent: */ /* * Copyright (c) 2011 William Lima <wlima@primate.com.br> * All rights reserved. */ #ifndef CONFIG_H_ #define CONFIG_H_ #pragma once #include <map> #include <string> class Config { public: static Config& instance(); static void destroy(); bool read(const char* filename); std::string get(const std::string& name); int getint(const std::string& name); std::string operator[](const std::string& name); private: Config(); ~Config(); static Config* instance_; std::map<std::string, std::string> map_; }; #endif // CONFIG_H_
#ifndef GENERALNAMES_H_ #define GENERALNAMES_H_ #include <string> #include <vector> #include <openssl/x509v3.h> #include <libcryptosec/ByteArray.h> #include "GeneralName.h" #include "ObjectIdentifier.h" #include "RDNSequence.h" class GeneralNames { public: GeneralNames(); GeneralNames(GENERAL_NAMES *generalNames); // GeneralNames(const GeneralNames& gns); virtual ~GeneralNames(); std::string getXmlEncoded(); std::string getXmlEncoded(std::string tab); void addGeneralName(GeneralName &generalName); std::vector<GeneralName> getGeneralNames() const; int getNumberOfEntries() const; GENERAL_NAMES* getInternalGeneralNames(); GeneralNames& operator=(const GeneralNames& value); protected: std::vector<GeneralName> generalNames; static std::string data2IpAddress(unsigned char *data); }; #endif /*GENERALNAMES_H_*/
// // AddSubscriptionViewController.h // SplatStages // // Created by mac on 2016-02-14. // Copyright © 2016 OatmealDome. All rights reserved. // #import <UIKit/UIKit.h> @interface AddSubscriptionViewController : UITableViewController @property (weak, nonatomic) IBOutlet UISegmentedControl *typeControl; @property (weak, nonatomic) IBOutlet UISegmentedControl *rotationControl; @property (weak, nonatomic) IBOutlet UILabel *rotationInfoLabel; @property (weak, nonatomic) IBOutlet UILabel *gamemodeInfoLabel; @property (weak, nonatomic) IBOutlet UILabel *stageInfoLabel; @property (weak, nonatomic) IBOutlet UILabel *gamemodeLabel; @property (weak, nonatomic) IBOutlet UILabel *stageLabel; @property (strong, atomic) NSArray* gamemodes; @property (strong, atomic) NSArray* stages; @property (atomic) NSInteger selectedGamemode; @property (atomic) NSInteger selectedStage; @end
/** * This file is part of the CNC-C implementation and * distributed under the Modified BSD License. * See LICENSE for details. * * DataDriven.c * * The purpose of this library is to provide a non-blocking implementation of the item collections in C for CnC * * Created on: Feb 17, 2010 * Authors: zoran, alina */ #include "cnc.h" #include "DataDriven.h" #include <stdlib.h> #include <string.h> /* This is the pseudo-code for data-driven implementation of item gets and puts to enable the CnC implementation */ /* * Test if two tags are equal. Right now, we are only doing string comparisons since we only allow strings for tags */ static int equals(unsigned char * tag1, unsigned char * tag2, int length) { return memcmp(tag1, tag2, length) == 0; } /* Hash function implementation. Fast and pretty good */ static unsigned long hash_function(unsigned char *str, int length) { unsigned long hash = 5381; int c; while (length-- > 0) { c = *str++; hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ } return hash; } /* get an entry from the item collection, or create and insert one * (atomically) if it doesn't exist * The creator parameter CNC_PUT_ENTRY/CNC_GET_ENTRY ensures that multiple * puts are not allowed */ static ItemCollectionEntry * allocateEntryIfAbsent( ItemCollectionEntry * volatile * hashmap, unsigned char * tag, int length, char creator, bool isSingleAssignment) { int index = (hash_function(tag, length)) % TABLE_SIZE; ItemCollectionEntry * volatile current = hashmap[index]; /* ACHTUNG: pointer arithmetic! This SHOULD give the address of the i'th element of the hashmap array, but maybe there is a more elegant way to do that */ ItemCollectionEntry * volatile * currentLocation = &hashmap[index]; ItemCollectionEntry * volatile head = current; ItemCollectionEntry * volatile tail = NULL; ItemCollectionEntry * entry = NULL; while (1) { /* traverse the buckets in the table to get to the last one */ while (current != tail) { if (equals(current->tag, tag, length)) { /* deallocate the entry we eagerly allocated in a previous iteration of the outer while(1) loop */ if (entry != NULL){ ocrEventDestroy(entry->event); cnc_free(entry); } // XXX - PutIfAbsent is kind of broken here if creator is GET // but using IDEM events still gives the correct behavior if ((current->creator == CNC_PUT_ENTRY) && (creator == CNC_PUT_ENTRY)) { if (isSingleAssignment) CNC_ASSERT(0, "Single assignment rule violated in item collection put"); else return NULL; } return current; /* just return the table entry if it already has the tag */ } current = current->nxt; } // XXX Why is this commented out? /* current has to be NULL now */ /* CNC_ASSERT(current == tail, "Current pointer is not NULL in the allocateEntryIfAbstent function\n"); */ /* allocate a new entry if this is the first time we are going to try and insert a new entry to the end of the bucket list */ if (entry == NULL) { entry = (ItemCollectionEntry *) cnc_malloc(sizeof(ItemCollectionEntry)+length); entry->creator = creator; memcpy(entry->tag, tag, length); ocrEventCreate(&(entry->event), OCR_EVENT_IDEM_T, true); } entry->nxt=head; /* try to insert the new entry into the _first_ position in a bucket of the table */ if (__sync_bool_compare_and_swap(currentLocation, head, entry)) { return entry; } /* CAS failed, which means that someone else inserted the new entry into the table while we were trying to do so, we need to try again */ current = hashmap[index]; //do not update tail anymore if deletes are inserted. tail = head; head = current; } CNC_ASSERT(0, "Arrived at the end of allocateEntryIfAbsent in DataDriven.c"); /* we should never get here */ return NULL; } /* Putting an item into the hashmap */ int __cncPut(ocrGuid_t item, char *tag, int tagLength, ItemCollectionEntry ** hashmap, bool isSingleAssignment) { CNC_ASSERT(tag != NULL, "Put - ERROR================%p\n"); /* allocateEntryIfAbsent checks for multiple puts using the "CNC_PUT_ENTRY" parameter */ ItemCollectionEntry * entry = allocateEntryIfAbsent(hashmap, tag, tagLength, CNC_PUT_ENTRY, isSingleAssignment); /* the returned placeholder can be NULL only when isSingleAssignment is false. in which case, the item was Put previously, so the current Put returns */ if(entry == NULL && !isSingleAssignment) return PUT_FAIL; /* Now, we have the correct placeholder (either inserted by us or by a Get function) */ /* Inserting the item now boils down to just satisfying the event with a data block of the item. */ ocrEventSatisfy(entry->event, item); return PUT_SUCCESS; } /* Register a step as a consumer of the item in the hasmap */ void __cncRegisterConsumer(char * tag, int tagLength, ItemCollectionEntry * volatile * hashmap, ocrGuid_t stepToRegister, u32 slot) { ItemCollectionEntry * entry = allocateEntryIfAbsent(hashmap, tag, tagLength, CNC_GET_ENTRY, SINGLE_ASSIGNMENT_ENFORCED); ocrAddDependence(entry->event, stepToRegister, slot, DB_DEFAULT_MODE); }
#pragma once #include "Physics/CollisionShapeComponent.h" #include <Reflection/Reflection.h> namespace DAVA { class ConvexHullShapeComponent : public CollisionShapeComponent { public: Component* Clone(Entity* toEntity) override; protected: #if defined(__DAVAENGINE_DEBUG__) void CheckShapeType() const override; #endif void UpdateLocalProperties() override; private: DAVA_VIRTUAL_REFLECTION(ConvexHullShapeComponent, CollisionShapeComponent); }; } // namespace DAVA
#ifndef _INC_WAITPID_TEST_ #define _INC_WAITPID_TEST_ int waitpidTestCommand(int argc, char **argv); #endif
#ifndef IMAGEMAPMODULETEST_H #define IMAGEMAPMODULETEST_H #include "WindowEventListener.h" #include "RegressionTest.h" #include "Map/MapEventListener.h" #include "AppEventListener.h" #include <vector> class ImageMapModule; class MapProjection; class BufferRequester; class AppWindow; class MapOperationHandler; class NullDrawingInterface; class MapManipulator; class MapLibKeyHandler; class MapParamFactory; class ImageMapControl; namespace WFAPI { class MapLibNetworkContext; } class ImageMapModuleTest : public RegressionTest, public AppEventListener { public: ImageMapModuleTest(Nav2Session& session, const char* name); virtual ~ImageMapModuleTest(); virtual void startTest(); virtual void onExitRequest(int code); private: AppWindow* m_window; WFAPI::MapLibNetworkContext* m_netContext; ImageMapControl* m_control; }; #endif /* IMAGEMAPMODULETEST_H */
/* Copyright (c) 2013, NVIDIA 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 the <organization> 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once namespace trove { enum { WARP_SIZE = 32, WARP_MASK = 0x1f, WARP_CONVERGED = 0xFFFFFFFF, LOG_WARP_SIZE = 5 }; __device__ inline bool warp_converged() { #if defined(CUDART_VERSION) && CUDART_VERSION >= 9000 return (__activemask() == WARP_CONVERGED); #else return (__ballot(true) == WARP_CONVERGED); #endif } }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_ #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_ #include "base/strings/string16.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" #include "url/gurl.h" class CommandUpdater; class ToolbarModel; namespace content { class WebContents; } namespace gfx { class Image; } // I am in hack-and-slash mode right now. // http://code.google.com/p/chromium/issues/detail?id=6772 // Embedders of an AutocompleteEdit widget must implement this class. class OmniboxEditController { public: void OnAutocompleteAccept(const GURL& destination_url, WindowOpenDisposition disposition, ui::PageTransition transition); // Updates the controller, and, if |contents| is non-NULL, restores saved // state that the tab holds. virtual void Update(const content::WebContents* contents) = 0; // Called when anything has changed that might affect the layout or contents // of the views around the edit, including the text of the edit and the // status of any keyword- or hint-related state. virtual void OnChanged() = 0; // Called whenever the autocomplete edit gets focused. virtual void OnSetFocus() = 0; // Shows the URL. virtual void ShowURL() = 0; // Returns the WebContents of the currently active tab. virtual content::WebContents* GetWebContents() = 0; virtual ToolbarModel* GetToolbarModel() = 0; virtual const ToolbarModel* GetToolbarModel() const = 0; protected: explicit OmniboxEditController(CommandUpdater* command_updater); virtual ~OmniboxEditController(); CommandUpdater* command_updater() { return command_updater_; } GURL destination_url() const { return destination_url_; } WindowOpenDisposition disposition() const { return disposition_; } ui::PageTransition transition() const { return transition_; } private: CommandUpdater* command_updater_; // The details necessary to open the user's desired omnibox match. GURL destination_url_; WindowOpenDisposition disposition_; ui::PageTransition transition_; DISALLOW_COPY_AND_ASSIGN(OmniboxEditController); }; #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_
/* * Auto generated Run-Time-Environment Component Configuration File * *** Do not modify ! *** * * Project: 'Ping-Pong-L0' * Target: 'Ping-Pong-L0' */ #ifndef RTE_COMPONENTS_H #define RTE_COMPONENTS_H #endif /* RTE_COMPONENTS_H */
/* * Copyright (C) 2016, British Broadcasting Corporation * All Rights Reserved. * * Author: Philip de Nier * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the British Broadcasting 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. */ #ifndef MXFPP_AUDIOCHANNELLABELSUBDESCRIPTOR_BASE_H_ #define MXFPP_AUDIOCHANNELLABELSUBDESCRIPTOR_BASE_H_ #include <libMXF++/metadata/MCALabelSubDescriptor.h> namespace mxfpp { class AudioChannelLabelSubDescriptorBase : public MCALabelSubDescriptor { public: friend class MetadataSetFactory<AudioChannelLabelSubDescriptorBase>; static const mxfKey setKey; public: AudioChannelLabelSubDescriptorBase(HeaderMetadata *headerMetadata); virtual ~AudioChannelLabelSubDescriptorBase(); // getters bool haveSoundfieldGroupLinkID() const; mxfUUID getSoundfieldGroupLinkID() const; // setters void setSoundfieldGroupLinkID(mxfUUID value); protected: AudioChannelLabelSubDescriptorBase(HeaderMetadata *headerMetadata, ::MXFMetadataSet *cMetadataSet); }; }; #endif
#import <UIKit/UIKit.h> @interface QIOSApplicationDelegate : UIResponder <UIApplicationDelegate> @end @interface QIOSApplicationDelegate (QtDatasyncAppDelegate) @end
/* inih -- simple .INI file parser inih is released under the New BSD license (see LICENSE.txt). Go to the project home page for more info: https://github.com/benhoyt/inih */ #ifndef __INI_H__ #define __INI_H__ /* Make this header file easier to include in C++ code */ #ifdef __cplusplus extern "C" { #endif #include <stdio.h> /* Typedef for prototype of handler function. */ typedef int (*ini_handler)(void* user, const char* section, const char* name, const char* value); /* Typedef for prototype of fgets-style reader function. */ typedef char* (*ini_reader)(char* str, int num, void* stream); /* Parse given INI-style file. May have [section]s, name=value pairs (whitespace stripped), and comments starting with ';' (semicolon). Section is "" if name=value pair parsed before any section heading. name:value pairs are also supported as a concession to Python's ConfigParser. For each name=value pair parsed, call handler function with given user pointer as well as section, name, and value (data only valid for duration of handler call). Handler should return nonzero on success, zero on error. Returns 0 on success, line number of first error on parse error (doesn't stop on first error), -1 on file open error, or -2 on memory allocation error (only when INI_USE_STACK is zero). */ int ini_parse(const char* filename, ini_handler handler, void* user); /* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't close the file when it's finished -- the caller must do that. */ int ini_parse_file(FILE* file, ini_handler handler, void* user); /* Same as ini_parse(), but takes an ini_reader function pointer instead of filename. Used for implementing custom or string-based I/O. */ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, void* user); /* Nonzero to allow multi-line value parsing, in the style of Python's ConfigParser. If allowed, ini_parse() will call the handler with the same name for each subsequent line parsed. */ #ifndef INI_ALLOW_MULTILINE #define INI_ALLOW_MULTILINE 0 #endif /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of the file. See http://code.google.com/p/inih/issues/detail?id=21 */ #ifndef INI_ALLOW_BOM #define INI_ALLOW_BOM 1 #endif /* Nonzero to use stack, zero to use heap (malloc/free). */ #ifndef INI_USE_STACK #define INI_USE_STACK 1 #endif /* Stop parsing on first error (default is to keep parsing). */ #ifndef INI_STOP_ON_FIRST_ERROR #define INI_STOP_ON_FIRST_ERROR 0 #endif /* Maximum line length for any line in INI file. */ #ifndef INI_MAX_LINE #define INI_MAX_LINE 200 #endif #ifdef __cplusplus } #endif #endif /* __INI_H__ */
/*********************************************************************** * $Id$ * Copyright (c) 1998 by Fort Gunnison, Inc. * * InfoChestApp.h: InfoChest用のアプリケーションクラス * * Author: Shin'ya Koga (koga@ftgun.co.jp) * Created: Jan. 24, 1998 * Last update: May. 01, 1998 ************************************************************************ */ #ifndef _INFO_CHEST_APP_H_ #define _INFO_CHEST_APP_H_ /* ######################################################### */ /* # I N C L U D E F I L E S # */ /* ######################################################### */ #include <app/Application.h> /* ######################################################### */ /* # T Y P E D E F I N E S # */ /* ######################################################### */ /* 関連クラス・構造体 */ class DocumentsWin; class BAlert; class BVolumeRoster; /* ######################################################### */ /* # P U B L I C F U N C T I O N S # */ /* ######################################################### */ /* * InfoChestAppクラスの定義 */ class InfoChestApp : public BApplication { // メソッド public: // 初期化と解放 InfoChestApp(void); ~InfoChestApp(void); private: // 起動と終了 void ReadyToRun(void); void Quit(void); // メッセージ処理 void MessageReceived(BMessage* message); void AboutRequested(void); void ShowDocumentsOf(BMessage* message); void ShowSearchPanel(void); void ShowMainWindow(void); void DocWinClosed(BMessage* message); void CategoryRemoved(BMessage* message); void VolumeChanged(BMessage* message); // ビュー部品の管理 DocumentsWin* FindDocumentsWindow(const char* inCategory); // データメンバ private: BAlert* fAboutBox; /* アバウトダイアログ */ BList* fDocWindows; /* カテゴリウィンドウのリスト */ BWindow* fSearchWindow; /* 検索ウィンドウ */ BWindow* fMainWindow; /* カテゴリ管理ウィンドウ */ BVolumeRoster* fVolRoster; /* ボリューム監視オブジェクト */ }; #endif /* _INFO_CHEST_APP_H_ */ /* * End of File */
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ #include "config.h" #include <stdlib.h> #include <string.h> #include <memcached/engine.h> #include "suite_stubs.h" int expiry = 3600; bool hasError = false; struct test_harness testHarness; static const char *key = "key"; bool test_setup(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { (void)h; (void)h1; delay(2); return true; } bool teardown(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { (void)h; (void)h1; return true; } void delay(int amt) { testHarness.time_travel(amt); hasError = false; } static void storeItem(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, ENGINE_STORE_OPERATION op) { item *it = NULL; uint64_t cas = 0; char *value = "0"; const int flags = 0; const void *cookie = NULL; size_t vlen; ENGINE_ERROR_CODE rv; item_info info; if (op == OPERATION_APPEND) { value = "-suffix"; } else if (op == OPERATION_PREPEND) { value = "prefix-"; } vlen = strlen(value); rv = h1->allocate(h, cookie, &it, key, strlen(key), vlen, flags, expiry, PROTOCOL_BINARY_RAW_BYTES); cb_assert(rv == ENGINE_SUCCESS); info.nvalue = 1; if (!h1->get_item_info(h, cookie, it, &info)) { abort(); } memcpy(info.value[0].iov_base, value, vlen); h1->item_set_cas(h, cookie, it, 0); rv = h1->store(h, cookie, it, &cas, op, 0); hasError = rv != ENGINE_SUCCESS; } void add(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_ADD); } void append(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_APPEND); } void decr(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { item* result_item = NULL; uint64_t result; hasError = h1->arithmetic(h, NULL, key, (int)strlen(key), false, false, 1, 0, expiry, &result_item, PROTOCOL_BINARY_RAW_BYTES, &result, 0) != ENGINE_SUCCESS; if (!hasError) { h1->release(h, NULL, result_item); } } void decrWithDefault(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { item* result_item = NULL; uint64_t result; hasError = h1->arithmetic(h, NULL, key, (int)strlen(key), false, true, 1, 0, expiry, &result_item, PROTOCOL_BINARY_RAW_BYTES, &result, 0) != ENGINE_SUCCESS; if (!hasError) { h1->release(h, NULL, result_item); } } void prepend(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_PREPEND); } void flush(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { hasError = h1->flush(h, NULL, 0); } void del(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { uint64_t cas = 0; mutation_descr_t mut_info; hasError = h1->remove(h, NULL, key, strlen(key), &cas, 0, &mut_info) != ENGINE_SUCCESS; } void set(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_SET); } void incr(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { item* result_item = NULL; uint64_t result; hasError = h1->arithmetic(h, NULL, key, (int)strlen(key), true, false, 1, 0, expiry, &result_item, PROTOCOL_BINARY_RAW_BYTES, &result, 0) != ENGINE_SUCCESS; if (!hasError) { h1->release(h, NULL, result_item); } } void incrWithDefault(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { item* result_item = NULL; uint64_t result; hasError = h1->arithmetic(h, NULL, key, (int)strlen(key), true, true, 1, 0, expiry, &result_item, PROTOCOL_BINARY_RAW_BYTES, &result, 0) != ENGINE_SUCCESS; if (!hasError) { h1->release(h, NULL, result_item); } } void checkValue(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, const char* exp) { item_info info; item *i = NULL; char *buf; ENGINE_ERROR_CODE rv = h1->get(h, NULL, &i, key, (int)strlen(key), 0); cb_assert(rv == ENGINE_SUCCESS); info.nvalue = 1; h1->get_item_info(h, NULL, i, &info); buf = malloc(info.value[0].iov_len + 1); memcpy(buf, info.value[0].iov_base, info.value[0].iov_len); buf[info.value[0].iov_len] = 0x00; cb_assert(info.nvalue == 1); if (strlen(exp) > info.value[0].iov_len) { fprintf(stderr, "Expected at least %d bytes for ``%s'', got %d as ``%s''\n", (int)strlen(exp), exp, (int)info.value[0].iov_len, buf); abort(); } if (memcmp(info.value[0].iov_base, exp, strlen(exp)) != 0) { fprintf(stderr, "Expected ``%s'', got ``%s''\n", exp, buf); abort(); } free(buf); } void assertNotExists(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { item *i; ENGINE_ERROR_CODE rv = h1->get(h, NULL, &i, key, (int)strlen(key), 0); cb_assert(rv == ENGINE_KEY_ENOENT); } MEMCACHED_PUBLIC_API bool setup_suite(struct test_harness *th) { testHarness = *th; return true; } #define NSEGS 10
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ #include <algorithm> // For |std::swap()|. #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/lib/filter_chain.h" #include "mojo/public/cpp/bindings/lib/message_header_validator.h" #include "mojo/public/cpp/bindings/lib/router.h" #include "mojo/public/cpp/environment/logging.h" struct MojoAsyncWaiter; namespace mojo { namespace internal { template <typename Interface> class InterfacePtrState { public: InterfacePtrState() : proxy_(nullptr), router_(nullptr), waiter_(nullptr), version_(0u) {} ~InterfacePtrState() { // Destruction order matters here. We delete |proxy_| first, even though // |router_| may have a reference to it, so that destructors for any request // callbacks still pending can interact with the InterfacePtr. delete proxy_; delete router_; } Interface* instance() { ConfigureProxyIfNecessary(); // This will be null if the object is not bound. return proxy_; } uint32_t version() const { return version_; } void Swap(InterfacePtrState* other) { using std::swap; swap(other->proxy_, proxy_); swap(other->router_, router_); handle_.swap(other->handle_); swap(other->waiter_, waiter_); swap(other->version_, version_); } void Bind(InterfacePtrInfo<Interface> info, const MojoAsyncWaiter* waiter) { MOJO_DCHECK(!proxy_); MOJO_DCHECK(!router_); MOJO_DCHECK(!handle_.is_valid()); MOJO_DCHECK(!waiter_); MOJO_DCHECK(version_ == 0u); MOJO_DCHECK(info.is_valid()); handle_ = info.PassHandle(); waiter_ = waiter; version_ = info.version(); } bool WaitForIncomingMethodCall() { ConfigureProxyIfNecessary(); MOJO_DCHECK(router_); return router_->WaitForIncomingMessage(MOJO_DEADLINE_INDEFINITE); } // After this method is called, the object is in an invalid state and // shouldn't be reused. InterfacePtrInfo<Interface> PassInterface() { return InterfacePtrInfo<Interface>( router_ ? router_->PassMessagePipe() : handle_.Pass(), version_); } bool is_bound() const { return handle_.is_valid() || router_; } bool encountered_error() const { return router_ ? router_->encountered_error() : false; } void set_error_handler(ErrorHandler* error_handler) { ConfigureProxyIfNecessary(); MOJO_DCHECK(router_); router_->set_error_handler(error_handler); } Router* router_for_testing() { ConfigureProxyIfNecessary(); return router_; } private: using Proxy = typename Interface::Proxy_; void ConfigureProxyIfNecessary() { // The proxy has been configured. if (proxy_) { MOJO_DCHECK(router_); return; } // The object hasn't been bound. if (!waiter_) { MOJO_DCHECK(!handle_.is_valid()); return; } FilterChain filters; filters.Append<MessageHeaderValidator>(); filters.Append<typename Interface::ResponseValidator_>(); router_ = new Router(handle_.Pass(), filters.Pass(), waiter_); waiter_ = nullptr; proxy_ = new Proxy(router_); } Proxy* proxy_; Router* router_; // |proxy_| and |router_| are not initialized until read/write with the // message pipe handle is needed. |handle_| and |waiter_| are valid between // the Bind() call and the initialization of |proxy_| and |router_|. ScopedMessagePipeHandle handle_; const MojoAsyncWaiter* waiter_; uint32_t version_; MOJO_DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); }; } // namespace internal } // namespace mojo #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
//=========================================== // Lumina-DE source code // Copyright (c) 2014, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== // This class governs all the stylesheet usage and interactions // for the Lumina utilities to provide a consistant theme for the system //=========================================== #ifndef _LUMINA_LIBRARY_THEMES_H #define _LUMINA_LIBRARY_THEMES_H #include <QApplication> #include <QObject> #include <QFileSystemWatcher> #include <QString> #include <QFile> #include <QDir> #include <QTimer> class LTHEME{ public: //Read the Themes/Colors/Icons that are available on the system static QStringList availableSystemThemes();//returns: [name::::path] for each item static QStringList availableLocalThemes(); //returns: [name::::path] for each item static QStringList availableSystemColors(); //returns: [name::::path] for each item static QStringList availableLocalColors(); //returns: [name::::path] for each item static QStringList availableSystemIcons(); //returns: [name] for each item //Save a new theme/color file static bool saveLocalTheme(QString name, QStringList contents); static bool saveLocalColors(QString name, QStringList contents); //Return the currently selected Theme/Colors/Icons static QStringList currentSettings(); //returns [theme path, colorspath, iconsname, font, fontsize] //Change the current Theme/Colors/Icons static bool setCurrentSettings(QString themepath, QString colorpath, QString iconname, QString font, QString fontsize); //Return the complete stylesheet for a given theme/colors static QString assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize); }; //Simple class to setup a utility to use the Lumina theme //-----Example usage in "main.cpp" ------------------------------- // QApplication a(argc,argv); // LuminaThemeEngine themes(&a) //------------------------------------------------------------------------------------ // Note: If you also use LuminaXDG::findIcons() in the application and you want // to dynamically update those icons - connect to the updateIcons() signal //------------------------------------------------------------------------------------- // QMainWindow w; //(or whatever the main app window is) // QObject::connect(themes,SIGNAL(updateIcons()), &w, SLOT(updateIcons()) ); //------------------------------------------------------------------------------------ class LuminaThemeEngine : public QObject{ Q_OBJECT public: LuminaThemeEngine(QApplication *app); ~LuminaThemeEngine(); private: QApplication *application; QFileSystemWatcher *watcher; QString theme,colors,icons, font, fontsize; //current settings QTimer *syncTimer; private slots: void watcherChange(); void reloadFiles(); signals: void updateIcons(); }; #endif
/* * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SVGFEDisplacementMapElement_h #define SVGFEDisplacementMapElement_h #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" #include "platform/graphics/filters/FEDisplacementMap.h" #include "platform/heap/Handle.h" namespace blink { template<> const SVGEnumerationStringEntries& getStaticStringEntries<ChannelSelectorType>(); class SVGFEDisplacementMapElement final : public SVGFilterPrimitiveStandardAttributes { DEFINE_WRAPPERTYPEINFO(); public: DECLARE_NODE_FACTORY(SVGFEDisplacementMapElement); static ChannelSelectorType stringToChannel(const String&); SVGAnimatedNumber* scale() { return m_scale.get(); } SVGAnimatedString* in1() { return m_in1.get(); } SVGAnimatedString* in2() { return m_in2.get(); } SVGAnimatedEnumeration<ChannelSelectorType>* xChannelSelector() { return m_xChannelSelector.get(); } SVGAnimatedEnumeration<ChannelSelectorType>* yChannelSelector() { return m_yChannelSelector.get(); } DECLARE_VIRTUAL_TRACE(); private: explicit SVGFEDisplacementMapElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; virtual void svgAttributeChanged(const QualifiedName&) override; virtual PassRefPtrWillBeRawPtr<FilterEffect> build(SVGFilterBuilder*, Filter*) override; RefPtrWillBeMember<SVGAnimatedNumber> m_scale; RefPtrWillBeMember<SVGAnimatedString> m_in1; RefPtrWillBeMember<SVGAnimatedString> m_in2; RefPtrWillBeMember<SVGAnimatedEnumeration<ChannelSelectorType>> m_xChannelSelector; RefPtrWillBeMember<SVGAnimatedEnumeration<ChannelSelectorType>> m_yChannelSelector; }; } // namespace blink #endif // SVGFEDisplacementMapElement_h
/*========================================================================= Program: Visualization Toolkit Module: vtkPointSet.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkPointSet - abstract class for specifying dataset behavior // .SECTION Description // vtkPointSet is an abstract class that specifies the interface for // datasets that explicitly use "point" arrays to represent geometry. // For example, vtkPolyData and vtkUnstructuredGrid require point arrays // to specify point position, while vtkStructuredPoints generates point // positions implicitly. // .SECTION See Also // vtkPolyData vtkStructuredGrid vtkUnstructuredGrid #ifndef __vtkPointSet_h #define __vtkPointSet_h #include "vtkDataSet.h" #include "vtkPoints.h" // Needed for inline methods class vtkPointLocator; class VTK_FILTERING_EXPORT vtkPointSet : public vtkDataSet { public: vtkTypeRevisionMacro(vtkPointSet,vtkDataSet); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Reset to an empty state and free any memory. void Initialize(); // Description: // Copy the geometric structure of an input point set object. void CopyStructure(vtkDataSet *pd); // Description: // See vtkDataSet for additional information. vtkIdType GetNumberOfPoints(); double *GetPoint(vtkIdType ptId) {return this->Points->GetPoint(ptId);}; void GetPoint(vtkIdType ptId, double x[3]) {this->Points->GetPoint(ptId,x);}; vtkIdType FindPoint(double x[3]); vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);}; vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int& subId, double pcoords[3], double *weights); vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int& subId, double pcoords[3], double *weights); // Description: // Get MTime which also considers its vtkPoints MTime. unsigned long GetMTime(); // Description: // Compute the (X, Y, Z) bounds of the data. void ComputeBounds(); // Description: // Reclaim any unused memory. void Squeeze(); // Description: // Specify point array to define point coordinates. virtual void SetPoints(vtkPoints*); vtkGetObjectMacro(Points,vtkPoints); // Description: // Return the actual size of the data in kilobytes. This number // is valid only after the pipeline has updated. The memory size // returned is guaranteed to be greater than or equal to the // memory required to represent the data (e.g., extra space in // arrays, etc. are not included in the return value). THIS METHOD // IS THREAD SAFE. unsigned long GetActualMemorySize(); // Description: // Shallow and Deep copy. void ShallowCopy(vtkDataObject *src); void DeepCopy(vtkDataObject *src); //BTX // Description: // Retrieve an instance of this class from an information object. static vtkPointSet* GetData(vtkInformation* info); static vtkPointSet* GetData(vtkInformationVector* v, int i=0); //ETX protected: vtkPointSet(); ~vtkPointSet(); vtkPoints *Points; vtkPointLocator *Locator; virtual void ReportReferences(vtkGarbageCollector*); private: vtkPointSet(const vtkPointSet&); // Not implemented. void operator=(const vtkPointSet&); // Not implemented. }; inline vtkIdType vtkPointSet::GetNumberOfPoints() { if (this->Points) { return this->Points->GetNumberOfPoints(); } else { return 0; } } #endif
version https://git-lfs.github.com/spec/v1 oid sha256:0041dc1c108adf358dda13c4ed1fa822786e99ce2aaf807aeefa8d1ad9b83b7c size 3809
#ifndef NODE_MCNET_PARSER_H #define NODE_MCNET_PARSER_H #include <node.h> #include <mcnet.h> using namespace v8; namespace mcnet { typedef class Parser : public node::ObjectWrap { public: static void Init(Handle<Object> target); private: Parser(); ~Parser(); mcnet_parser_t parser; mcnet_parser_settings_t settings; static Handle<Value> New(const Arguments& args); static Handle<Value> Execute(const Arguments& args); static void on_packet(mcnet_parser_t* parser, mcnet_packet_t* packet); static void on_error(mcnet_parser_t* parser, int err); static void on_metadata_entry(mcnet_metadata_parser_t* parser, mcnet_metadata_entry_t* entry); static void on_slot(mcnet_slot_parser_t* parser, mcnet_slot_t* slot); } Parser_t; } #endif
/* (C)Copyright IBM Corp. 2007, 2008 */ /** * \file src/coll/alltoall/alltoall_algorithms.c * \brief ??? */ #include "mpido_coll.h" #ifdef USE_CCMI_COLL /** * ************************************************************************** * \brief "Done" callback for collective alltoall message. * ************************************************************************** */ static void alltoall_cb_done(void * clientdata, DCMF_Error_t *err) { volatile unsigned * work_left = (unsigned *) clientdata; * work_left = 0; MPID_Progress_signal(); } int MPIDO_Alltoall_torus(void * sendbuf, int sendcount, MPI_Datatype sendtype, void * recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm * comm) { int rc; DCMF_CollectiveRequest_t request; volatile unsigned active = 1; DCMF_Geometry_t * geometry = &(comm->dcmf.geometry); DCMF_Callback_t callback = { alltoall_cb_done, (void *) &active }; unsigned * sndlen = comm->dcmf.sndlen; unsigned * sdispls = comm->dcmf.sdispls; unsigned * rcvlen = comm->dcmf.rcvlen; unsigned * rdispls = comm->dcmf.rdispls; unsigned * sndcounters = comm->dcmf.sndcounters; unsigned * rcvcounters = comm->dcmf.rcvcounters; /* uses the alltoallv protocol */ rc = DCMF_Alltoallv(&MPIDI_CollectiveProtocols.torus_alltoallv, &request, callback, DCMF_MATCH_CONSISTENCY, geometry, sendbuf, sndlen, sdispls, recvbuf, rcvlen, rdispls, sndcounters, rcvcounters); MPID_PROGRESS_WAIT_WHILE(active); return rc; } #endif /* USE_CCMI_COLL */ int MPIDO_Alltoall_simple(void * send_buff, int send_count, MPI_Datatype send_type, void * recv_buff, int recv_count, MPI_Datatype recv_type, MPID_Comm * comm) { int mpi_errno = MPI_SUCCESS; int i, rank, np, nreqs, partner; char * send_ptr; char * recv_ptr; MPI_Aint sndinc; MPI_Aint rcvinc; MPI_Request * req, * req_ptr; rank = comm->rank; np = comm->local_size; MPIR_Type_extent_impl(send_type, &sndinc); MPIR_Type_extent_impl(recv_type, &rcvinc); sndinc *= send_count; rcvinc *= recv_count; /* Allocate arrays of requests. */ nreqs = 2 * (np - 1); req = (MPI_Request *) MPIU_Malloc(nreqs * sizeof(MPI_Request)); req_ptr = req; if (!req) { if (rank == 0) printf("cannot allocate memory\n"); PMPI_Abort(comm->handle, 0); } /* simple optimization */ send_ptr = ((char *) send_buff) + (rank * sndinc); recv_ptr = ((char *) recv_buff) + (rank * rcvinc); memcpy(recv_ptr, send_ptr, sndinc); recv_ptr = (char *) recv_buff; send_ptr = (char *) send_buff; for (i = 0; i < np; i++) { partner = (rank + i) % np; if (partner == rank) continue; mpi_errno = MPIC_Irecv(recv_ptr + (partner * rcvinc), recv_count, recv_type, partner, MPIR_ALLTOALL_TAG, comm->handle, req_ptr++); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPIC_Isend(send_ptr + (partner * sndinc), send_count, send_type, partner, MPIR_ALLTOALL_TAG, comm->handle, req_ptr++); if (mpi_errno) MPIU_ERR_POP(mpi_errno); } mpi_errno = MPIR_Waitall_impl(nreqs, req, MPI_STATUSES_IGNORE); if (mpi_errno) MPIU_ERR_POP(mpi_errno); if (req) MPIU_Free(req); fn_exit: return MPI_SUCCESS; fn_fail: goto fn_exit; }
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef GTK_MAPLIB_KROKOFANT_H #define GTK_MAPLIB_KROKOFANT_H #include "MapLib.h" class FileHandler; /** * Symbian specific MapLib. */ class GtkMapLib : public MapLib { public: /// Lazy constructor used by MapDrawing area. GtkMapLib( TileMapHandler* handler ); /** * Creates a SymbianFileHandler. * @see MapLib. */ FileHandler* createFileHandler( const char* filename, bool readOnly, bool createFile, bool initNow ); /** * */ const char* getPathSeparator() const { return "/"; } }; #endif
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #pragma once #include "Stdafx.h" #include "CefWrapper.h" namespace CefSharp { namespace Internals { public ref class CefRequestCallbackWrapper : public IRequestCallback, public CefWrapper { private: MCefRefPtr<CefRequestCallback> _callback; IFrame^ _frame; IRequest^ _request; internal: CefRequestCallbackWrapper(CefRefPtr<CefRequestCallback> &callback) : _callback(callback), _frame(nullptr), _request(nullptr) { } CefRequestCallbackWrapper( CefRefPtr<CefRequestCallback> &callback, IFrame^ frame, IRequest^ request) : _callback(callback), _frame(frame), _request(request) { } !CefRequestCallbackWrapper() { _callback = NULL; } ~CefRequestCallbackWrapper() { this->!CefRequestCallbackWrapper(); delete _request; _request = nullptr; delete _frame; _frame = nullptr; _disposed = true; } public: virtual void Continue(bool allow) { ThrowIfDisposed(); _callback->Continue(allow); delete this; } virtual void Cancel() { ThrowIfDisposed(); _callback->Cancel(); delete this; } }; } }
/* * Copyright (c) 2004-2006 Rincon Research Corporation. * All rights reserved. * * Rincon Research will permit distribution and use by others subject to * the restrictions of a licensing agreement which contains (among other things) * the following restrictions: * * 1. No credit will be taken for the Work of others. * 2. It will not be resold for a price in excess of reproduction and * distribution costs. * 3. Others are not restricted from copying it or using it except as * set forward in the licensing agreement. * 4. Commented source code of any modifications or additions will be * made available to Rincon Research on the same terms. * 5. This notice will remain intact and displayed prominently. * * Copies of the complete licensing agreement may be obtained by contacting * Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711. * * There is no warranty with this product, either expressed or implied. * Use at your own risk. Rincon Research is not liable or responsible for * damage or loss incurred or resulting from the use or misuse of this software. */ #include "AM.h" enum { FLASH_VIEWER = unique("BlockStorage"), }; /** * This will assume a maximum 28 byte payload */ typedef struct ViewerMsg { uint32_t addr; uint16_t len; uint8_t cmd; uint8_t id; uint8_t data[20]; } ViewerMsg; enum { AM_VIEWERMSG = 0xA1, }; enum { CMD_READ = 0, CMD_WRITE = 1, CMD_ERASE = 2, CMD_MOUNT = 3, CMD_COMMIT = 4, CMD_PING = 5, REPLY_READ = 10, REPLY_WRITE = 11, REPLY_ERASE = 12, REPLY_MOUNT = 13, REPLY_COMMIT = 14, REPLY_PING = 15, REPLY_READ_CALL_FAILED = 20, REPLY_WRITE_CALL_FAILED = 21, REPLY_ERASE_CALL_FAILED = 22, REPLY_MOUNT_CALL_FAILED = 23, REPLY_COMMIT_CALL_FAILED = 24, REPLY_READ_FAILED = 30, REPLY_WRITE_FAILED = 31, REPLY_ERASE_FAILED = 32, REPLY_MOUNT_FAILED = 33, REPLY_COMMIT_FAILED = 34, };
/**************************************************************************** * Copyright (c) 2014, Christopher Karle * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of the author nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, AUTHOR OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef QUEUE_TEST_H #define QUEUE_TEST_H /**************************************************************************** * ****************************************************************************/ void queueTestCmd(int argc, char* argv[]); /**************************************************************************** * ****************************************************************************/ void queueTest(); #endif
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ #include "common_tools.h" #include "opengl.h" typedef void (APIENTRY *glWindowRectanglesEXTPROC) (jint, jint, intptr_t); EXTERN_C_ENTER JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTWindowRectangles_nglWindowRectanglesEXT__IIJ(JNIEnv *__env, jclass clazz, jint mode, jint count, jlong boxAddress) { glWindowRectanglesEXTPROC glWindowRectanglesEXT = (glWindowRectanglesEXTPROC)tlsGetFunction(1884); intptr_t box = (intptr_t)boxAddress; UNUSED_PARAM(clazz) glWindowRectanglesEXT(mode, count, box); } EXTERN_C_EXIT
/* * Copyright (c) 2014, Stavros Filargyropoulos * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __B64_H__ #define __B64_H__ #include <stddef.h> #include <string.h> #include "buffer.h" #include "ssr.h" static inline size_t b64encsize (size_t n) { size_t r; r = ((n + 2) / 3) * 4; /* * +1 for the null-terminating char of the string */ return (r + 1); } static inline size_t b64decsize_ssr (const ssr_t *ssr) { size_t r; r = ((ssr->size + 3) / 4) * 3; if (ssr->data[ssr->size - 1] == '=') { r--; } if (ssr->data[ssr->size - 2] == '=') { r--; } return (r); } static inline size_t b64decsize_str (const char *s) { size_t len; size_t r; len = strlen(s); r = ((len + 3) / 4) * 3; if (s[len - 1] == '=') { r--; } if (s[len - 2] == '=') { r--; } return (r); } static inline int b64_validc (char c) { if (!((c >= '0') && (c <= '9')) && !((c >= 'A') && (c <= 'Z')) && !((c >= 'a') && (c <= 'z')) && !(c == '+') && !(c == '/') && !(c == '=')) { return (0); } return (1); } /* * inb: binary * out: string */ void b64enc(const void *inb, char *out, size_t len); void b64enc_to_buffer(const void *inb, buffer_t *buffer, size_t len); /* * in: string * outb: binary */ int b64dec(const char *in, void *outb); /* * in: ssr * outb: binary */ int b64dec_ssr(const ssr_t *in, void *outb); #endif /* __B64_H__ */
// -*- tab-width:4 ; indent-tabs-mode:nil -*- #if defined(__APPLE__) #include <sys/sysctl.h> #include <sys/types.h> #endif #include <hre/config.h> #include <dlfcn.h> #include <errno.h> #include <inttypes.h> #include <limits.h> #ifdef __linux__ # include <sched.h> // for sched_getaffinity #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <hre/feedback.h> #include <hre/runtime.h> #include <hre/user.h> typedef void(*plugin_init_t)(); void* RTdlopen(const char *name){ void *dlHandle; char abs_filename[PATH_MAX]; char *ret_filename = realpath(name, abs_filename); if (ret_filename) { dlHandle = dlopen(abs_filename, RTLD_LAZY); if (dlHandle == NULL) { Abort("%s, Library \"%s\" is not reachable", dlerror(), name); } } else { Abort("Library \"%s\" is not found", name); } plugin_init_t init=RTtrydlsym(dlHandle,"hre_init"); if (init!=NULL){ init(); } else { Warning(info,"library has no initializer"); } return dlHandle; } void * RTdlsym (const char *libname, void *handle, const char *symbol) { void *ret = dlsym (handle, symbol); if (ret == NULL) { const char *dlerr = dlerror (); Abort("dynamically loading from `%s': %s", libname, dlerr != NULL ? dlerr : "unknown error"); } return ret; } void * RTtrydlsym(void *handle, const char *symbol) { return dlsym (handle, symbol); } int linear_search(si_map_entry map[],const char*key){ while(map[0].key){ if(!strcmp(map[0].key,key)) return map[0].val; map++; } return -1; } char *key_search(si_map_entry map[],const int val){ while(map[0].key){ if(map[0].val == val) return map[0].key; map++; } return "not found"; } #if defined(__APPLE__) size_t RTmemSize(){ const char *memsize = getenv("LTSMIN_MEM_SIZE"); if (memsize) { return strtoimax(memsize, NULL, 10); } else { int mib[4]; int64_t physical_memory; size_t len = sizeof(int64_t); mib[0] = CTL_HW; mib[1] = HW_MEMSIZE; len = sizeof(int64_t); sysctl(mib, 2, &physical_memory, &len, NULL, 0); return physical_memory; } } int RTcacheLineSize(){ int mib[4]; int line_size; size_t len = sizeof(int); mib[0] = CTL_HW; mib[1] = HW_CACHELINE; len = sizeof(int); sysctl(mib, 2, &line_size, &len, NULL, 0); return line_size; } #else static int mem_size_warned = 0; size_t RTmemSize(){ const char *memsize = getenv("LTSMIN_MEM_SIZE"); if (memsize) { return strtoimax(memsize, NULL, 10); } else { const long res=sysconf(_SC_PHYS_PAGES); const long pagesz=sysconf(_SC_PAGESIZE); size_t limit = pagesz*((size_t)res); /* Now try to determine whether this program runs in a cgroup. * If this is the case, we will pick the minimum of the previously * computed limit. */ const char *file = "/sys/fs/cgroup/memory/memory.limit_in_bytes"; FILE *fp = fopen(file, "r"); if (fp != NULL) { size_t cgroup_limit = 0; /* If there is no limit then the value scanned for will be larger * than SIZE_T_MAX, and thus fscanf will not return 1. */ int ret = fscanf(fp, "%zu", &cgroup_limit); if (ret == 1 && cgroup_limit > 0) { if (cgroup_limit < limit) { limit = cgroup_limit; if (!mem_size_warned) { Warning(infoLong, "Using cgroup limit of %zu bytes", limit); } } } else if (!mem_size_warned) { Warning(error, "Unable to get cgroup memory limit " "in file %s: %s", file, errno != 0 ? strerror(errno) : "unknown error"); } fclose(fp); } else if (!mem_size_warned) { Warning(error, "Unable to open cgroup memory limit file %s: %s", file, strerror(errno)); } mem_size_warned = 1; return limit; } } #if defined(__linux__) int RTcacheLineSize(){ long res=sysconf(_SC_LEVEL1_DCACHE_LINESIZE); return (int)res; } #else int RTcacheLineSize(){ Abort("generic implementation for RTcacheLineSize needed"); } #endif #endif int RTnumCPUs(){ const char *numCPUs = getenv("LTSMIN_NUM_CPUS"); if (numCPUs) { return strtoimax(numCPUs, NULL, 10); } else { int cpu_count = sysconf(_SC_NPROCESSORS_ONLN); #ifdef __linux__ cpu_set_t cpus; cpu_set_t* cpus_p = &cpus; size_t cpus_size = sizeof(cpu_set_t); int configured_cpus = sysconf(_SC_NPROCESSORS_CONF); if (configured_cpus >= CPU_SETSIZE) { cpus_p = CPU_ALLOC(configured_cpus); if (cpus_p) { cpus_size = CPU_ALLOC_SIZE(configured_cpus); CPU_ZERO_S(cpus_size, cpus_p); } else { Warning(error, "CPU_ALLOC failed: %s", errno != 0 ? strerror(errno) : "unknown error"); return cpu_count; } } if (!sched_getaffinity(0, cpus_size, cpus_p)) { if (cpus_p != &cpus) cpu_count = CPU_COUNT_S(cpus_size, cpus_p); else cpu_count = CPU_COUNT(cpus_p); } else { Warning(error, "Unable to get CPU set affinity: %s", errno != 0 ? strerror(errno) : "unknown error"); } if (cpus_p != &cpus) CPU_FREE(cpus_p); #endif return cpu_count; } }
/* * Copyright (c) 2016, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "openthread-core-config.h" #include "platform-posix.h" #include <assert.h> #include <stdarg.h> #include <syslog.h> #include <openthread/platform/logging.h> #if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...) { OT_UNUSED_VARIABLE(aLogRegion); va_list args; switch (aLogLevel) { case OT_LOG_LEVEL_NONE: aLogLevel = LOG_ALERT; break; case OT_LOG_LEVEL_CRIT: aLogLevel = LOG_CRIT; break; case OT_LOG_LEVEL_WARN: aLogLevel = LOG_WARNING; break; case OT_LOG_LEVEL_NOTE: aLogLevel = LOG_NOTICE; break; case OT_LOG_LEVEL_INFO: aLogLevel = LOG_INFO; break; case OT_LOG_LEVEL_DEBG: aLogLevel = LOG_DEBUG; break; default: assert(false); aLogLevel = LOG_DEBUG; break; } va_start(args, aFormat); vsyslog(aLogLevel, aFormat, args); va_end(args); } #endif // OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ #define NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ #include "net/url_request/url_request_job.h" class GURL; // A URLRequestJob that will redirect the request to the specified // URL. This is useful to restart a request at a different URL based // on the result of another job. class URLRequestRedirectJob : public URLRequestJob { public: // Constructs a job that redirects to the specified URL. URLRequestRedirectJob(URLRequest* request, GURL redirect_destination); virtual void Start(); bool IsRedirectResponse(GURL* location, int* http_status_code); private: ~URLRequestRedirectJob() {} void StartAsync(); GURL redirect_destination_; }; #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2022, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See: https://www.mrpt.org/License | +------------------------------------------------------------------------+ */ #pragma once #include <mrpt/math/TPoseOrPoint.h> namespace mrpt::math { /** 3D twist: 3D velocity vector (vx,vy,vz) + angular velocity (wx,wy,wz) * \sa mrpt::math::TTwist2D, mrpt::math::TPose3D * \ingroup geometry_grp */ struct TTwist3D : public internal::ProvideStaticResize<TTwist3D> { enum { static_size = 6 }; /** Velocity components: X,Y (m/s) */ double vx{.0}, vy{.0}, vz{.0}; /** Angular velocity (rad/s) */ double wx{.0}, wy{.0}, wz{.0}; /** Constructor from components */ constexpr TTwist3D( double vx_, double vy_, double vz_, double wx_, double wy_, double wz_) : vx(vx_), vy(vy_), vz(vz_), wx(wx_), wy(wy_), wz(wz_) { } /** Default fast constructor. Initializes to zeros */ TTwist3D() = default; /** Builds from the first 6 elements of a vector-like object: [vx vy vz wx * wy wz] * * \tparam Vector It can be std::vector<double>, Eigen::VectorXd, etc. */ template <typename Vector> static TTwist3D FromVector(const Vector& v) { TTwist3D o; for (int i = 0; i < 6; i++) o[i] = v[i]; return o; } /** Coordinate access using operator[]. Order: vx,vy,vz, wx, wy, wz */ double& operator[](size_t i) { switch (i) { case 0: return vx; case 1: return vy; case 2: return vz; case 3: return wx; case 4: return wy; case 5: return wz; default: throw std::out_of_range("index out of range"); } } /// \overload constexpr double operator[](size_t i) const { switch (i) { case 0: return vx; case 1: return vy; case 2: return vz; case 3: return wx; case 4: return wy; case 5: return wz; default: throw std::out_of_range("index out of range"); } } /** (i,0) access operator (provided for API compatibility with matrices). * \sa operator[] */ double& operator()(int row, int col) { ASSERT_EQUAL_(col, 0); return (*this)[row]; } /// \overload constexpr double operator()(int row, int col) const { ASSERT_EQUAL_(col, 0); return (*this)[row]; } /** Scale factor */ void operator*=(const double k) { vx *= k; vy *= k; vz *= k; wx *= k; wy *= k; wz *= k; } /** Transformation into vector [vx vy vz wx wy wz]. * \tparam Vector It can be std::vector<double>, Eigen::VectorXd, etc. */ template <typename Vector> void asVector(Vector& v) const { v.resize(6); for (int i = 0; i < 6; i++) v[i] = (*this)[i]; } /// \overload template <typename Vector> Vector asVector() const { Vector v; asVector(v); return v; } /** Sets from a vector [vx vy vz wx wy wz] */ template <typename VECTORLIKE> void fromVector(const VECTORLIKE& v) { ASSERT_EQUAL_(v.size(), 6); for (int i = 0; i < 6; i++) (*this)[i] = v[i]; } bool operator==(const TTwist3D& o) const; bool operator!=(const TTwist3D& o) const; /** Returns a human-readable textual representation of the object (eg: "[vx * vy vz wx wy wz]", omegas in deg/s) * \sa fromString */ void asString(std::string& s) const; std::string asString() const { std::string s; asString(s); return s; } /** Transform all 6 components for a change of reference frame from "A" to * another frame "B" whose rotation with respect to "A" is given by `rot`. * The translational part of the pose is ignored */ void rotate(const mrpt::math::TPose3D& rot); /** Like rotate(), but returning a copy of the rotated twist. * \note New in MRPT 2.3.2 */ [[nodiscard]] TTwist3D rotated(const mrpt::math::TPose3D& rot) const { TTwist3D r = *this; r.rotate(rot); return r; } /** Set the current object value from a string generated by 'asString' (eg: * "[vx vy vz wx wy wz]" ) * \sa asString * \exception std::exception On invalid format */ void fromString(const std::string& s); static TTwist3D FromString(const std::string& s) { TTwist3D o; o.fromString(s); return o; } }; mrpt::serialization::CArchive& operator>>( mrpt::serialization::CArchive& in, mrpt::math::TTwist3D& o); mrpt::serialization::CArchive& operator<<( mrpt::serialization::CArchive& out, const mrpt::math::TTwist3D& o); } // namespace mrpt::math namespace mrpt::typemeta { // Specialization must occur in the same namespace MRPT_DECLARE_TTYPENAME_NO_NAMESPACE(TTwist3D, mrpt::math) } // namespace mrpt::typemeta
// SDLReadDIDResponse.h // // Copyright (c) 2014 Ford Motor Company. All rights reserved. #import <Foundation/Foundation.h> #import <SmartDeviceLink/SDLRPCResponse.h> @interface SDLReadDIDResponse : SDLRPCResponse {} -(id) init; -(id) initWithDictionary:(NSMutableDictionary*) dict; @property(strong) NSMutableArray* didResult; @end
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ #define NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ #include <stdint.h> #include <vector> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/strings/string_piece.h" #include "net/ssl/ssl_private_key.h" namespace base { class TaskRunner; } namespace net { // An SSLPrivateKey implementation which offloads key operations to a background // task runner. class ThreadedSSLPrivateKey : public SSLPrivateKey { public: // Interface for consumers to implement to perform the actual signing // operation. class Delegate { public: Delegate() {} virtual ~Delegate() {} // These methods behave as those of the same name on SSLPrivateKey. They // must be callable on any thread. virtual Type GetType() = 0; virtual std::vector<SSLPrivateKey::Hash> GetDigestPreferences() = 0; virtual size_t GetMaxSignatureLengthInBytes() = 0; // Signs |input| as a digest of type |hash|. On success it returns OK and // sets |signature| to the resulting signature. Otherwise it returns a net // error code. It will only be called on the task runner passed to the // owning ThreadedSSLPrivateKey. virtual Error SignDigest(Hash hash, const base::StringPiece& input, std::vector<uint8_t>* signature) = 0; private: DISALLOW_COPY_AND_ASSIGN(Delegate); }; ThreadedSSLPrivateKey(scoped_ptr<Delegate> delegate, scoped_refptr<base::TaskRunner> task_runner); // SSLPrivateKey implementation. Type GetType() override; std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override; size_t GetMaxSignatureLengthInBytes() override; void SignDigest(Hash hash, const base::StringPiece& input, const SignCallback& callback) override; private: ~ThreadedSSLPrivateKey() override; class Core; scoped_refptr<Core> core_; scoped_refptr<base::TaskRunner> task_runner_; base::WeakPtrFactory<ThreadedSSLPrivateKey> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ThreadedSSLPrivateKey); }; } // namespace net #endif // NET_SSL_THREADED_SSL_PRIVATE_KEY_H_
#pragma once #include "boss/eigen_boss_plugin.h" #include <Eigen/Core> #include <Eigen/Geometry> #include <Eigen/Cholesky> #include <Eigen/StdVector> #include <iostream> #include <unistd.h> #include "opencv2/opencv.hpp" /** * @file defs.h * @Author Giorgio Grisetti * @date December 2014 * @brief This file contains some useful defines about * Eigen types, common Mat opencv specializations, and transforms mappings */ //!a vector of Vector3f with alignment typedef std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > Vector3fVector; //!a vector of Vector2f with alignment typedef std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > Vector2fVector; //!a vector of Matrix3f with alignment typedef std::vector<Eigen::Matrix3f, Eigen::aligned_allocator<Eigen::Matrix3f> > Matrix3fVector; //!a vector of Matrix2f with alignment typedef std::vector<Eigen::Matrix2f, Eigen::aligned_allocator<Eigen::Matrix2f> > Matrix2fVector; //!a 4x6 float matrix typedef Eigen::Matrix<float, 4, 6> Matrix4_6f; //!a 2x6 float matrix typedef Eigen::Matrix<float, 2, 6> Matrix2_6f; //!a 3x6 float matrix typedef Eigen::Matrix<float, 3, 6> Matrix3_6f; //!a 6x6 float matrix typedef Eigen::Matrix<float, 6, 6> Matrix6f; //!a 6 float vector typedef Eigen::Matrix<float, 6, 1> Vector6f; //!a 9x6 float matrix typedef Eigen::Matrix<float, 9, 6> Matrix9_6f; //!a 9x9 float matrix typedef Eigen::Matrix<float, 9, 9> Matrix9f; //!a 9 float vector typedef Eigen::Matrix<float, 9, 1> Vector9f; //!a 6x3 float matrix typedef Eigen::Matrix<float, 6, 3> Matrix6_3f; //!check if an Eigen type contains a nan element //!@returns true if at least one element of //!the argument is null template <class T> bool isNan(const T& m){ for (int i=0; i< m.rows(); i++) { for (int j=0; j< m.cols(); j++) { float v = m(i,j); if ( isnan( v ) ) return true; } } return false; } //!converts from 6 vector to isometry //!@param t: a vector (tx, ty, tz, qx, qy, qz) reptesenting the transform. //!(qx, qy, qz) are the imaginary part of a normalized queternion, with qw>0. //!@returns the isometry corresponding to the transform described by t inline Eigen::Isometry3f v2t(const Vector6f& t){ Eigen::Isometry3f T; T.setIdentity(); T.translation()=t.head<3>(); float w=t.block<3,1>(3,0).squaredNorm(); if (w<1) { w=sqrt(1-w); T.linear()=Eigen::Quaternionf(w, t(3), t(4), t(5)).toRotationMatrix(); } else { Eigen::Vector3f q=t.block<3,1>(3,0); q.normalize(); T.linear()=Eigen::Quaternionf(0, q(0), q(1), q(2)).toRotationMatrix(); } return T; } //!converts from isometry to 6 vector //!@param t: an isometry //!@returns a vector (tx, ty, tz, qx, qy, qz) reptesenting the transform. //!(qx, qy, qz) are the imaginary part of a normalized queternion, with qw>0. inline Vector6f t2v(const Eigen::Isometry3f& t){ Vector6f v; v.head<3>()=t.translation(); Eigen::Quaternionf q(t.linear()); v(3) = q.x(); v(4) = q.y(); v(5) = q.z(); if (q.w()<0) v.block<3,1>(3,0) *= -1.0f; return v; } //!computes the cross product matrix of the vector argument //!@param p: the vector //!@returns a 3x3 matrix inline Eigen::Matrix3f skew(const Eigen::Vector3f& p){ Eigen::Matrix3f s; s << 0, -p.z(), p.y(), p.z(), 0, -p.x(), -p.y(), p.x(), 0; return s; } /** \typedef UnsignedCharImage * \brief An unsigned char cv::Mat. */ typedef cv::Mat_<unsigned char> UnsignedCharImage; /** \typedef CharImage * \brief A char cv::Mat. */ typedef cv::Mat_<char> CharImage; /** \typedef UnsignedShortImage * \brief An unsigned short cv::Mat. */ typedef cv::Mat_<unsigned short> UnsignedShortImage; /** \typedef UnsignedIntImage * \brief An unsigned int cv::Mat. */ typedef cv::Mat_<unsigned int> UnsignedIntImage; /** \typedef IntImage * \brief An int cv::Mat. */ typedef cv::Mat_<int> IntImage; /** \typedef FloatImage * \brief A float cv::Mat. */ typedef cv::Mat_<float> FloatImage; /** \typedef Float3Image * \brief A float cv::Mat. */ typedef cv::Mat_<cv::Vec3f> Float3Image; /** \typedef DoubleImage * \brief A double cv::Mat. */ typedef cv::Mat_<double> DoubleImage; /** \typedef RawDepthImage * \brief An unsigned char cv::Mat used to for depth images with depth values expressed in millimeters. */ typedef UnsignedShortImage RawDepthImage; /** \typedef IndexImage * \brief An int cv::Mat used to save the indeces of the points of a depth image inside a vector of points. */ typedef IntImage IndexImage; /** \typedef DepthImage * \brief A float cv::Mat used to for depth images with depth values expressed in meters. */ typedef cv::Mat_< cv::Vec3b > RGBImage; /** used to represent rgb values */ typedef std::vector< cv::Vec3b > RGBVector;
/* * FreeRTOS Kernel V10.1.1 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ /*----------------------------------------------------------- * Simple IO routines to control the LEDs. * This file is called ParTest.c for historic reasons. Originally it stood for * PARallel port TEST. *-----------------------------------------------------------*/ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" /* Demo includes. */ #include "partest.h" /* Library includes. */ #include "misc/led.h" #include "peripherals/pio.h" #include "board.h" /*-----------------------------------------------------------*/ void vParTestInitialise( void ) { led_configure( 0 ); led_configure( 1 ); led_configure( 2 ); } /*-----------------------------------------------------------*/ void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue ) { if( xValue == pdTRUE ) { led_set( uxLED ); } else { led_clear( uxLED ); } } /*-----------------------------------------------------------*/ void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) { led_toggle( uxLED ); }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE415_Double_Free__malloc_free_int_32.c Label Definition File: CWE415_Double_Free__malloc_free.label.xml Template File: sources-sinks-32.tmpl.c */ /* * @description * CWE: 415 Double Free * BadSource: Allocate data using malloc() and Deallocate data using free() * GoodSource: Allocate data using malloc() * Sinks: * GoodSink: do nothing * BadSink : Deallocate data using free() * Flow Variant: 32 Data flow using two pointers to the same value within the same function * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE415_Double_Free__malloc_free_int_32_bad() { int * data; int * *dataPtr1 = &data; int * *dataPtr2 = &data; /* Initialize data */ data = NULL; { int * data = *dataPtr1; data = (int *)malloc(100*sizeof(int)); if (data == NULL) {exit(-1);} /* POTENTIAL FLAW: Free data in the source - the bad sink frees data as well */ free(data); *dataPtr1 = data; } { int * data = *dataPtr2; /* POTENTIAL FLAW: Possibly freeing memory twice */ free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { int * data; int * *dataPtr1 = &data; int * *dataPtr2 = &data; /* Initialize data */ data = NULL; { int * data = *dataPtr1; data = (int *)malloc(100*sizeof(int)); if (data == NULL) {exit(-1);} /* FIX: Do NOT free data in the source - the bad sink frees data */ *dataPtr1 = data; } { int * data = *dataPtr2; /* POTENTIAL FLAW: Possibly freeing memory twice */ free(data); } } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2G() { int * data; int * *dataPtr1 = &data; int * *dataPtr2 = &data; /* Initialize data */ data = NULL; { int * data = *dataPtr1; data = (int *)malloc(100*sizeof(int)); if (data == NULL) {exit(-1);} /* POTENTIAL FLAW: Free data in the source - the bad sink frees data as well */ free(data); *dataPtr1 = data; } { int * data = *dataPtr2; /* do nothing */ /* FIX: Don't attempt to free the memory */ ; /* empty statement needed for some flow variants */ } } void CWE415_Double_Free__malloc_free_int_32_good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE415_Double_Free__malloc_free_int_32_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE415_Double_Free__malloc_free_int_32_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <time.h> #include <math.h> int (*cgemm_gpu) (const char * transa,const char * transb,const int *m,const int *n,const int *k,const float *alpha,const float * __restrict__ a,const int *lda,const float *b,const int *ldb,const float *beta,float * c,const int *ldc ); int cgemm_gpu_impl (const char * transa,const char * transb,const int *m,const int *n,const int *k,const float *alpha,const float * __restrict__ a,const int *lda,const float *b,const int *ldb,const float *beta,float * c,const int *ldc ); extern void cgemm_ (const char * transa,const char * transb,const int *m,const int *n,const int *k,const float *alpha,const float * __restrict__ a,const int *lda,const float *b,const int *ldb,const float *beta,float * c,const int *ldc ); void * blas_gpu_info(int level, char *st, int *m, int *n, int *k); int main (int argc, char *argv[]) { struct timeval tv; double start,end,timec,timeg; int lda,ldb; int m=8189; int n=8189; int k=8189; char transa='N'; char transb='C'; if ( transa == 'N' ) lda = m; else lda = k; if ( (transb == 'T') || (transb == 'C') ) ldb = n; else ldb = k; int ldc = m; unsigned long i,j; float alpha[2] = { 0.2, 0.1 }; float beta[2] = { 0.3, 2.0 } ; float error; void *a1,*b1,*c1,*c2; float *a,*b,*cg,*cc; a1=malloc((size_t) 32768*8192*4); b1=malloc((size_t) 32768*8192*4); c1=malloc((size_t) 32768*32768*4); c2=malloc((size_t) 32768*32768*4); a=(float *) a1; b=(float *) b1; cg=(float *) c1; cc=(float *) c2; // memset(a,0,2*4096*4096*4); for( i = 0; i<m; i++) { for ( j = 0; j< k; j++) { *a = (((float) rand() / (float) RAND_MAX) - 0.5) * 1e-1 ; // *a = (float) (10*i+k+1) ; // *a = (float) 1.0; a++; *a = (((float) rand() / (float) RAND_MAX) - 0.5) * 1e-1 ; // *a = (float) 1.0; a++; } } // memset(b,0,2*4096*4096*4); for( i = 0; i<k; i++) { for( j=0; j<n; j++) { *b = (((float) rand() / (float) RAND_MAX) - 0.5) * 1e-1; // *b = (float) 1.0 ; // *b = (float) (i+k+1) ; b++; *b = (((float) rand() / (float) RAND_MAX) - 0.5) * 1e-1; // *b = (float) 1.0 ; b++; } } // #pragma omp parallel for // memset(cc,0,2*4096*4096*4); // memset(cg,0,2*4096*4096*4); for( i = 0; i<n; i++) { for(j=0; j<m; j++) { *cc = (float) 1.0; *cg = (float) 1.0; cc++; cg++; *cc = (float) 2.0; *cg = (float) 2.0; cc++; cg++; } } a=(float *) a1; b=(float *) b1; cg=(float *) c1; cc=(float *) c2; gettimeofday(&tv,NULL); start=(double) tv.tv_sec+(double)tv.tv_usec*1.e-6; int ret=0; int (*cgemm_gpu)(); cgemm_gpu = blas_gpu_info(3, "cgemm", NULL, NULL, NULL); if ( cgemm_gpu ) { ret = cgemm_gpu(&transa,&transb,&m,&n,&k,alpha,a,&lda,b,&ldb,beta,cg,&ldc); } else { printf("GPU error\n"); return(1); } if ( ret != 0) { printf("GPU error\n"); return(1); } gettimeofday(&tv,NULL); end=(double) tv.tv_sec+(double)tv.tv_usec*1.e-6; timeg=end-start; gettimeofday(&tv,NULL); start=(double) tv.tv_sec+(double)tv.tv_usec*1.e-6; cgemm_(&transa, &transb, &m, &n,&k ,alpha, a, &lda, b, &ldb, beta, cc, &ldc); gettimeofday(&tv,NULL); end=(double) tv.tv_sec+(double)tv.tv_usec*1.e-6; timec=end-start; for(i=0; i<m*n*2; i++) { error = fabs((cc[i] - cg[i])); if ( error > 0.1e-4 ) printf("ERROR: %ld:%.16f %.16f %.16f\n",i,error, cg[i],cc[i]); } double fp =(8.0 * (double) m*n*k ) * (double) 1.0e-9; double gflops=fp / timeg ; printf("GPU: %dx%dx%d size\t%10.8f sec\t%10.6f GFlop\t%10.8f GFlops\n",m,n,k,timeg,fp,gflops); gflops=fp / timec ; printf("CPU: %dx%dx%d size\t%10.8f sec\t%10.6f GFlop\t%10.8f GFlops\n",m,n,k,timec,fp,gflops); return(0); }
#ifndef R_EXASOL_ASYNC_EXECUTOR_SESSION_INFO_H #define R_EXASOL_ASYNC_EXECUTOR_SESSION_INFO_H #include <memory> namespace exa { class AsyncExecutor; /** * Abstract interface to the asynchrnous remote session info. The concrete class might contain detailed information * about the ODBC handle/queries etc. It provides instantiation of a @class AsyncExecutor. */ struct AsyncExecutorSessionInfo { virtual ~AsyncExecutorSessionInfo() = default; virtual std::unique_ptr<AsyncExecutor> createAsyncExecutor() const = 0; }; } #endif //R_EXASOL_ASYNC_EXECUTOR_SESSION_INFO_H
/* Copyright (c) 2013 Anton Titov. * Copyright (c) 2013 pCloud Ltd. * 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 pCloud Ltd 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 pCloud Ltd BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _PSYNC_DIFF_H #define _PSYNC_DIFF_H #include "papi.h" void psync_diff_init(); void psync_diff_lock(); void psync_diff_unlock(); void psync_diff_create_file(const binresult *meta); void psync_diff_update_file(const binresult *meta); void psync_diff_delete_file(const binresult *meta); void psync_diff_update_folder(const binresult *meta); void psync_diff_delete_folder(const binresult *meta); #endif
/////////////////////////////////////////////////////////////////////////////// // /// \file signals.c /// \brief Handling signals to abort operation // // Author: Lasse Collin // // This file has been put into the public domain. // You can do whatever you want with this file. // /////////////////////////////////////////////////////////////////////////////// #include "private.h" volatile sig_atomic_t user_abort = false; #if !(defined(_WIN32) && !defined(__CYGWIN__)) /// If we were interrupted by a signal, we store the signal number so that /// we can raise that signal to kill the program when all cleanups have /// been done. static volatile sig_atomic_t exit_signal = 0; /// Mask of signals for which have have established a signal handler to set /// user_abort to true. static sigset_t hooked_signals; /// True once signals_init() has finished. This is used to skip blocking /// signals (with uninitialized hooked_signals) if signals_block() and /// signals_unblock() are called before signals_init() has been called. static bool signals_are_initialized = false; /// signals_block() and signals_unblock() can be called recursively. static size_t signals_block_count = 0; static void signal_handler(int sig) { exit_signal = sig; user_abort = true; return; } extern void signals_init(void) { // List of signals for which we establish the signal handler. static const int sigs[] = { SIGINT, SIGTERM, #ifdef SIGHUP SIGHUP, #endif #ifdef SIGPIPE SIGPIPE, #endif #ifdef SIGXCPU SIGXCPU, #endif #ifdef SIGXFSZ SIGXFSZ, #endif }; // Mask of the signals for which we have established a signal handler. sigemptyset(&hooked_signals); for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) sigaddset(&hooked_signals, sigs[i]); #ifdef SIGALRM // Add also the signals from message.c to hooked_signals. for (size_t i = 0; message_progress_sigs[i] != 0; ++i) sigaddset(&hooked_signals, message_progress_sigs[i]); #endif // Using "my_sa" because "sa" may conflict with a sockaddr variable // from system headers on Solaris. struct sigaction my_sa; // All the signals that we handle we also blocked while the signal // handler runs. my_sa.sa_mask = hooked_signals; // Don't set SA_RESTART, because we want EINTR so that we can check // for user_abort and cleanup before exiting. We block the signals // for which we have established a handler when we don't want EINTR. my_sa.sa_flags = 0; my_sa.sa_handler = &signal_handler; for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) { // If the parent process has left some signals ignored, // we don't unignore them. struct sigaction old; if (sigaction(sigs[i], NULL, &old) == 0 && old.sa_handler == SIG_IGN) continue; // Establish the signal handler. if (sigaction(sigs[i], &my_sa, NULL)) message_signal_handler(); } signals_are_initialized = true; return; } #ifndef __VMS extern void signals_block(void) { if (signals_are_initialized) { if (signals_block_count++ == 0) { const int saved_errno = errno; mythread_sigmask(SIG_BLOCK, &hooked_signals, NULL); errno = saved_errno; } } return; } extern void signals_unblock(void) { if (signals_are_initialized) { assert(signals_block_count > 0); if (--signals_block_count == 0) { const int saved_errno = errno; mythread_sigmask(SIG_UNBLOCK, &hooked_signals, NULL); errno = saved_errno; } } return; } #endif extern void signals_exit(void) { const int sig = exit_signal; if (sig != 0) { #if defined(TUKLIB_DOSLIKE) || defined(__VMS) // Don't raise(), set only exit status. This avoids // printing unwanted message about SIGINT when the user // presses C-c. set_exit_status(E_ERROR); #else struct sigaction sa; sa.sa_handler = SIG_DFL; sigfillset(&sa.sa_mask); sa.sa_flags = 0; sigaction(sig, &sa, NULL); raise(exit_signal); #endif } return; } #else // While Windows has some very basic signal handling functions as required // by C89, they are not really used, and e.g. SIGINT doesn't work exactly // the way it does on POSIX (Windows creates a new thread for the signal // handler). Instead, we use SetConsoleCtrlHandler() to catch user // pressing C-c, because that seems to be the recommended way to do it. // // NOTE: This doesn't work under MSYS. Trying with SIGINT doesn't work // either even if it appeared to work at first. So test using Windows // console window. static BOOL WINAPI signal_handler(DWORD type lzma_attribute((__unused__))) { // Since we don't get a signal number which we could raise() at // signals_exit() like on POSIX, just set the exit status to // indicate an error, so that we cannot return with zero exit status. set_exit_status(E_ERROR); user_abort = true; return TRUE; } extern void signals_init(void) { if (!SetConsoleCtrlHandler(&signal_handler, TRUE)) message_signal_handler(); return; } #endif
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef QUICHE_HTTP2_HPACK_HPACK_STRING_H_ #define QUICHE_HTTP2_HPACK_HPACK_STRING_H_ // HpackString is currently a very simple container for a string, but allows us // to relatively easily experiment with alternate string storage mechanisms for // handling strings to be encoded with HPACK, or decoded from HPACK, such as // a ref-counted string. #include <iosfwd> #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" #include "starboard/types.h" namespace http2 { class HTTP2_EXPORT_PRIVATE HpackString { public: explicit HpackString(const char* data); explicit HpackString(Http2StringPiece str); explicit HpackString(Http2String str); HpackString(const HpackString& other); // Not sure yet whether this move ctor is required/sensible. HpackString(HpackString&& other) = default; ~HpackString(); size_t size() const { return str_.size(); } const Http2String& ToString() const { return str_; } Http2StringPiece ToStringPiece() const; bool operator==(const HpackString& other) const; bool operator==(Http2StringPiece str) const; private: Http2String str_; }; HTTP2_EXPORT_PRIVATE bool operator==(Http2StringPiece a, const HpackString& b); HTTP2_EXPORT_PRIVATE bool operator!=(Http2StringPiece a, const HpackString& b); HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, const HpackString& b); HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, Http2StringPiece b); HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, const HpackString& v); struct HTTP2_EXPORT_PRIVATE HpackStringPair { HpackStringPair(const HpackString& name, const HpackString& value); HpackStringPair(Http2StringPiece name, Http2StringPiece value); ~HpackStringPair(); // Returns the size of a header entry with this name and value, per the RFC: // http://httpwg.org/specs/rfc7541.html#calculating.table.size size_t size() const { return 32 + name.size() + value.size(); } Http2String DebugString() const; const HpackString name; const HpackString value; }; HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const HpackStringPair& p); } // namespace http2 #endif // QUICHE_HTTP2_HPACK_HPACK_STRING_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_STUB_H_ #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_STUB_H_ #include "ash/public/cpp/multi_user_window_manager.h" #include "base/macros.h" // Stub implementation of ash::MultiUserWindowManager. This is used for single // user mode. class MultiUserWindowManagerStub : public ash::MultiUserWindowManager { public: MultiUserWindowManagerStub(); MultiUserWindowManagerStub(const MultiUserWindowManagerStub&) = delete; MultiUserWindowManagerStub& operator=(const MultiUserWindowManagerStub&) = delete; ~MultiUserWindowManagerStub() override; // MultiUserWindowManager overrides: void SetWindowOwner(aura::Window* window, const AccountId& account_id) override; const AccountId& GetWindowOwner(const aura::Window* window) const override; void ShowWindowForUser(aura::Window* window, const AccountId& account_id) override; bool AreWindowsSharedAmongUsers() const override; std::set<AccountId> GetOwnersOfVisibleWindows() const override; const AccountId& GetUserPresentingWindow( const aura::Window* window) const override; void AddObserver(ash::MultiUserWindowManagerObserver* observer) override; void RemoveObserver(ash::MultiUserWindowManagerObserver* observer) override; const AccountId& CurrentAccountId() const override; }; #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_STUB_H_
/*! \ingroup PkgSphericalKernel3AlgebraicConcepts \cgalConcept \sa `AlgebraicKernelForSpheres::XCriticalPoints` \sa `AlgebraicKernelForSpheres::ZCriticalPoints` */ class AlgebraicKernelForSpheres::YCriticalPoints { public: /// \name Operations /// A model of this concept must provide: /// @{ /*! Copies in the output iterator the `y`-critical points of polynomial `p`, as objects of type `AlgebraicKernelForSpheres::Root_for_spheres_2_3`. */ template < class OutputIterator > OutputIterator operator()(const AlgebraicKernelForSpheres::Polynomial_for_spheres_2_3 &p, OutputIterator res); /*! Computes the `i`th `y`-critical point of polynomial `p`. */ template < class OutputIterator > AlgebraicKernelForSpheres::Root_for_spheres_2_3 operator()(const AlgebraicKernelForSpheres::Polynomial_for_spheres_2_3 &p, bool i); /// @} }; /* end AlgebraicKernelForSpheres::YCriticalPoints */
/* This file is a part of NNTL project (https://github.com/Arech/nntl) Copyright (c) 2015-2021, Arech (aradvert@gmail.com; https://github.com/Arech) 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 NNTL nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "_i_activation.h" namespace nntl { namespace activation { //activation types should not be templated (probably besides real_t), because they are intended to be used //as means to recognize activation function type struct type_sigm {}; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //sigmoid template<typename RealT = d_interfaces::real_t , typename WeightsInitScheme = weights_init::Martens_SI_sigm<>> class sigm : public _i_activation<RealT, WeightsInitScheme, false> , public type_sigm { public: //apply f to each srcdest matrix element to compute activation values. The biases (if any) must be left untouched! template <typename iMath> static void f(realmtx_t& srcdest, iMath& m) noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); m.sigm(srcdest); }; template <typename iMath> static void df(realmtx_t& f_df, iMath& m) noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); NNTL_ASSERT(!f_df.emulatesBiases()); m.dsigm(f_df); } }; template<typename RealT, typename WeightsInitScheme = weights_init::Martens_SI_sigm<>, bool bNumericStable = false> class sigm_quad_loss : public sigm<RealT, WeightsInitScheme>, public _i_quadratic_loss<RealT> { public: template <typename iMath> static void dLdZ(const realmtx_t& data_y, realmtx_t& act_dLdZ, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); m.dSigmQuadLoss_dZ(data_y, act_dLdZ); } template <typename iMath, bool bNS = bNumericStable> static ::std::enable_if_t<!bNS, real_t> loss(const realmtx_t& activations, const realmtx_t& data_y, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); return m.loss_quadratic(activations, data_y); } template <typename iMath, bool bNS = bNumericStable> static ::std::enable_if_t<bNS, real_t> loss(const realmtx_t& activations, const realmtx_t& data_y, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); return m.loss_quadratic_ns(activations, data_y); } }; template<typename RealT, typename WeightsInitScheme = weights_init::Martens_SI_sigm<>, bool bNumericStable = false> class sigm_xentropy_loss : public sigm<RealT, WeightsInitScheme>, public _i_xentropy_loss<RealT> { public: template <typename iMath> static void dLdZ(const realmtx_t& data_y, realmtx_t& act_dLdZ, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); // L = -y*log(a)-(1-y)log(1-a) (dL/dZ = dL/dA * dA/dZ = (a-y)/(a*(1-a)) * dA/dZ ) // dA/dZ = a(1-a) //dL/dz = dL/dA * dA/dZ = (a-y) NNTL_ASSERT(!act_dLdZ.emulatesBiases() && !data_y.emulatesBiases()); m.evSub_ip(act_dLdZ, data_y); } template <typename iMath, bool bNS = bNumericStable> static ::std::enable_if_t<!bNS, real_t> loss(const realmtx_t& activations, const realmtx_t& data_y, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); return m.loss_xentropy(activations, data_y); } template <typename iMath, bool bNS = bNumericStable> static ::std::enable_if_t<bNS, real_t> loss(const realmtx_t& activations, const realmtx_t& data_y, iMath& m)noexcept { static_assert(::std::is_base_of<math::_i_math<real_t>, iMath>::value, "iMath should implement math::_i_math"); return m.loss_xentropy_ns(activations, data_y); } }; } }
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_ #define CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "components/crash/app/crash_reporter_client.h" namespace chrome { class ChromeCrashReporterClient : public crash_reporter::CrashReporterClient { public: ChromeCrashReporterClient(); ~ChromeCrashReporterClient() override; // crash_reporter::CrashReporterClient implementation. void SetCrashReporterClientIdFromGUID( const std::string& client_guid) override; #if defined(OS_WIN) virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir) override; virtual void GetProductNameAndVersion(const base::FilePath& exe_path, base::string16* product_name, base::string16* version, base::string16* special_build, base::string16* channel_name) override; virtual bool ShouldShowRestartDialog(base::string16* title, base::string16* message, bool* is_rtl_locale) override; virtual bool AboutToRestart() override; virtual bool GetDeferredUploadsSupported(bool is_per_user_install) override; virtual bool GetIsPerUserInstall(const base::FilePath& exe_path) override; virtual bool GetShouldDumpLargerDumps(bool is_per_user_install) override; virtual int GetResultCodeRespawnFailed() override; virtual void InitBrowserCrashDumpsRegKey() override; virtual void RecordCrashDumpAttempt(bool is_real_crash) override; #endif #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) void GetProductNameAndVersion(const char** product_name, const char** version) override; base::FilePath GetReporterLogFilename() override; #endif bool GetCrashDumpLocation(base::FilePath* crash_dir) override; size_t RegisterCrashKeys() override; bool IsRunningUnattended() override; bool GetCollectStatsConsent() override; #if defined(OS_WIN) || defined(OS_MACOSX) bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) override; #endif #if defined(OS_ANDROID) int GetAndroidMinidumpDescriptor() override; #endif bool EnableBreakpadForProcess(const std::string& process_type) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeCrashReporterClient); }; } // namespace chrome #endif // CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_
/* Classname: ReferencedCalculation * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ #if !defined(EA_5636AF95_4798_4b34_A84A_646382B3D517__INCLUDED_) #define EA_5636AF95_4798_4b34_A84A_646382B3D517__INCLUDED_ #include <string> #include <vector> namespace aim_lib { class AIMLIB_API ReferencedCalculation { public: ReferencedCalculation(); ReferencedCalculation(const ReferencedCalculation& referencedCalculation); ReferencedCalculation& operator=(const ReferencedCalculation& referencedCalculation); virtual ~ReferencedCalculation(); const std::string& GetUniqueIdentifier() const; // Referenced calculation's unique identifier void SetUniqueIdentifier(const std::string& newVal); private: int _cagridId; std::string _uniqueIdentifier; }; typedef std::vector<ReferencedCalculation> ReferencedCalcVector; } #endif // !defined(EA_5636AF95_4798_4b34_A84A_646382B3D517__INCLUDED_)
#pragma once #include "IActivationFunction.h" namespace neuro { class ThresholdFunction : public IActivationFunction { public: virtual double Function(double x); virtual double Derivative(double x); virtual double Derivative2(double x); }; }
/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef __INC_MCOMP_H #define __INC_MCOMP_H #include "block.h" #include "variance.h" #ifdef ENTROPY_STATS extern void init_mv_ref_counts(); extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]); #endif #define MAX_MVSEARCH_STEPS 8 // The maximum number of steps in a step search given the largest allowed initial step #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) // Max full pel mv specified in 1 pel units #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) // Maximum size of the first step in full pel units extern void print_mode_context(void); extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight); extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride); extern void vp8_init3smotion_compensation(MACROBLOCK *x, int stride); extern int vp8_hex_search ( MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int_mv *best_mv, int search_param, int error_per_bit, const vp8_variance_fn_ptr_t *vf, int *mvsadcost[2], int *mvcost[2], int_mv *center_mv ); typedef int (fractional_mv_step_fp) (MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2], int *distortion, unsigned int *sse); extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively; extern fractional_mv_step_fp vp8_find_best_sub_pixel_step; extern fractional_mv_step_fp vp8_find_best_half_pixel_step; extern fractional_mv_step_fp vp8_skip_fractional_mv_step; typedef int (*vp8_full_search_fn_t) ( MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int sad_per_bit, int distance, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int_mv *center_mv ); typedef int (*vp8_refining_search_fn_t) ( MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int sad_per_bit, int distance, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int_mv *center_mv ); typedef int (*vp8_diamond_search_fn_t) ( MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int_mv *best_mv, int search_param, int sad_per_bit, int *num00, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int_mv *center_mv ); #endif
// Copyright 2020 The Cobalt Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef STARBOARD_ANDROID_SHARED_CONFIGURATION_H_ #define STARBOARD_ANDROID_SHARED_CONFIGURATION_H_ namespace starboard { namespace android { namespace shared { const void* GetConfigurationApi(); } // namespace shared } // namespace android } // namespace starboard #endif // STARBOARD_ANDROID_SHARED_CONFIGURATION_H_
/* zgehd2.f -- translated by f2c (version 20061008). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static integer c__1 = 1; /* Subroutine */ int zgehd2_(integer *n, integer *ilo, integer *ihi, doublecomplex *a, integer *lda, doublecomplex *tau, doublecomplex * work, integer *info) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2, i__3; doublecomplex z__1; /* Local variables */ integer i__; doublecomplex alpha; /* -- LAPACK routine (version 3.2) -- */ /* November 2006 */ /* Purpose */ /* ======= */ /* ZGEHD2 reduces a complex general matrix A to upper Hessenberg form H */ /* by a unitary similarity transformation: Q' * A * Q = H . */ /* Arguments */ /* ========= */ /* N (input) INTEGER */ /* The order of the matrix A. N >= 0. */ /* ILO (input) INTEGER */ /* IHI (input) INTEGER */ /* It is assumed that A is already upper triangular in rows */ /* and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally */ /* set by a previous call to ZGEBAL; otherwise they should be */ /* set to 1 and N respectively. See Further Details. */ /* 1 <= ILO <= IHI <= max(1,N). */ /* A (input/output) COMPLEX*16 array, dimension (LDA,N) */ /* On entry, the n by n general matrix to be reduced. */ /* On exit, the upper triangle and the first subdiagonal of A */ /* are overwritten with the upper Hessenberg matrix H, and the */ /* elements below the first subdiagonal, with the array TAU, */ /* represent the unitary matrix Q as a product of elementary */ /* reflectors. See Further Details. */ /* LDA (input) INTEGER */ /* The leading dimension of the array A. LDA >= max(1,N). */ /* TAU (output) COMPLEX*16 array, dimension (N-1) */ /* The scalar factors of the elementary reflectors (see Further */ /* Details). */ /* WORK (workspace) COMPLEX*16 array, dimension (N) */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument had an illegal value. */ /* Further Details */ /* =============== */ /* The matrix Q is represented as a product of (ihi-ilo) elementary */ /* reflectors */ /* Q = H(ilo) H(ilo+1) . . . H(ihi-1). */ /* Each H(i) has the form */ /* H(i) = I - tau * v * v' */ /* where tau is a complex scalar, and v is a complex vector with */ /* v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on */ /* exit in A(i+2:ihi,i), and tau in TAU(i). */ /* The contents of A are illustrated by the following example, with */ /* n = 7, ilo = 2 and ihi = 6: */ /* on entry, on exit, */ /* ( a a a a a a a ) ( a a h h h h a ) */ /* ( a a a a a a ) ( a h h h h a ) */ /* ( a a a a a a ) ( h h h h h h ) */ /* ( a a a a a a ) ( v2 h h h h h ) */ /* ( a a a a a a ) ( v2 v3 h h h h ) */ /* ( a a a a a a ) ( v2 v3 v4 h h h ) */ /* ( a ) ( a ) */ /* where a denotes an element of the original matrix A, h denotes a */ /* modified element of the upper Hessenberg matrix H, and vi denotes an */ /* element of the vector defining H(i). */ /* ===================================================================== */ /* Test the input parameters */ /* Parameter adjustments */ a_dim1 = *lda; a_offset = 1 + a_dim1; a -= a_offset; --tau; --work; /* Function Body */ *info = 0; if (*n < 0) { *info = -1; } else if (*ilo < 1 || *ilo > max(1,*n)) { *info = -2; } else if (*ihi < min(*ilo,*n) || *ihi > *n) { *info = -3; } else if (*lda < max(1,*n)) { *info = -5; } if (*info != 0) { i__1 = -(*info); xerbla_("ZGEHD2", &i__1); return 0; } i__1 = *ihi - 1; for (i__ = *ilo; i__ <= i__1; ++i__) { /* Compute elementary reflector H(i) to annihilate A(i+2:ihi,i) */ i__2 = i__ + 1 + i__ * a_dim1; alpha.r = a[i__2].r, alpha.i = a[i__2].i; i__2 = *ihi - i__; /* Computing MIN */ i__3 = i__ + 2; zlarfg_(&i__2, &alpha, &a[min(i__3, *n)+ i__ * a_dim1], &c__1, &tau[ i__]); i__2 = i__ + 1 + i__ * a_dim1; a[i__2].r = 1., a[i__2].i = 0.; /* Apply H(i) to A(1:ihi,i+1:ihi) from the right */ i__2 = *ihi - i__; zlarf_("Right", ihi, &i__2, &a[i__ + 1 + i__ * a_dim1], &c__1, &tau[ i__], &a[(i__ + 1) * a_dim1 + 1], lda, &work[1]); /* Apply H(i)' to A(i+1:ihi,i+1:n) from the left */ i__2 = *ihi - i__; i__3 = *n - i__; d_cnjg(&z__1, &tau[i__]); zlarf_("Left", &i__2, &i__3, &a[i__ + 1 + i__ * a_dim1], &c__1, &z__1, &a[i__ + 1 + (i__ + 1) * a_dim1], lda, &work[1]); i__2 = i__ + 1 + i__ * a_dim1; a[i__2].r = alpha.r, a[i__2].i = alpha.i; } return 0; /* End of ZGEHD2 */ } /* zgehd2_ */
/* * Copyright (c) 2016 CartoDB. All rights reserved. * Copying and using this code is allowed only according * to license terms, as given in https://cartodb.com/terms/ */ #ifndef _CARTO_BITMAPUTILS_H_ #define _CARTO_BITMAPUTILS_H_ #include <memory> #include <string> #include <jni.h> namespace carto { class Bitmap; /** * A helper class for loading bitmaps and converting Bitmaps to Android Bitmaps an vice versa. */ class BitmapUtils { public: /** * Loads the specified bitmap asset bundled with the application. * @param assetPath The asset path to the image to be loaded. * @return The loaded bitmap. */ static std::shared_ptr<Bitmap> LoadBitmapFromAssets(const std::string& assetPath); /** * Loads bitmap from specified file. * @param filePath The path to the image to be loaded. * @return The loaded bitmap. */ static std::shared_ptr<Bitmap> LoadBitmapFromFile(const std::string& filePath); /** * Creates a new Bitmap object from an existing Android Bitmap. * @param androidBitmap The reference Android bitmap. * @return The created bitmap. */ static std::shared_ptr<Bitmap> CreateBitmapFromAndroidBitmap(jobject androidBitmap); /** * Creates a new Android Bitmap from an existing Bitmap. * @param bitmap The existing bitmap. * @return The android Bitmap. */ static jobject CreateAndroidBitmapFromBitmap(const std::shared_ptr<Bitmap>& bitmap); protected: BitmapUtils(); }; } #endif
/****************************************************************************** * Copyright (C) 2016-2019, Cris Cecka. All rights reserved. * Copyright (C) 2016-2019, NVIDIA 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 the NVIDIA 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 NVIDIA CORPORATION BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ #pragma once #include <blam/system/cblas/config.h> #include <blam/system/cblas/execution_policy.h> namespace blam { namespace cblas { // snrm2 inline void nrm2(int n, const float* x, int incX, float& norm) { BLAM_DEBUG_OUT("cblas_snrm2"); norm = cblas_snrm2(n, x, incX); } // dnrm2 inline void nrm2(int n, const double* x, int incX, double& norm) { BLAM_DEBUG_OUT("cblas_dnrm2"); norm = cblas_dnrm2(n, x, incX); } // scnrm2 inline void nrm2(int n, const ComplexFloat* x, int incX, float& norm) { BLAM_DEBUG_OUT("cblas_scnrm2"); norm = cblas_scnrm2(n, reinterpret_cast<const float*>(x), incX); } // dznrm2 inline void nrm2(int n, const ComplexDouble* x, int incX, double& norm) { BLAM_DEBUG_OUT("cblas_dznrm2"); norm = cblas_dznrm2(n, reinterpret_cast<const double*>(x), incX); } // blam -> cblas template <typename DerivedPolicy, typename VX, typename R> inline auto nrm2(const execution_policy<DerivedPolicy>& /*exec*/, int n, const VX* x, int incX, R& result) -> decltype(nrm2(n, x, incX, result)) { return nrm2(n, x, incX, result); } } // end namespace cblas } // end namespace blam
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "ShapeOps.h" #include "SkBitmap.h" #include "SkStream.h" #include <pthread.h> struct State4; //extern int comparePaths(const SkPath& one, const SkPath& two); extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap); extern void comparePathsTiny(const SkPath& one, const SkPath& two); extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths); extern void showPath(const SkPath& path, const char* str = NULL); extern bool testSimplify(const SkPath& path, bool fill, SkPath& out, SkBitmap& bitmap); extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, State4& state, const char* pathStr); extern bool testSimplifyx(const SkPath& path); struct State4 { State4(); static pthread_mutex_t addQueue; static pthread_cond_t checkQueue; pthread_cond_t initialized; static State4* queue; pthread_t threadID; int index; bool done; bool last; int a; int b; int c; int d; // sometimes 1 if abc_is_a_triangle int testsRun; char filename[256]; SkBitmap bitmap; }; void createThread(State4* statePtr, void* (*test)(void* )); int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d); void initializeTests(const char* testName, size_t testNameSize); void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ); void outputToStream(const State4& state, const char* pathStr, SkPath::FillType, SkWStream& outFile); bool runNextTestSet(State4& state); int waitForCompletion();
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This defines an enumeration of IDs that can uniquely identify a view within // the scope of a container view. #ifndef CHROME_BROWSER_UI_VIEW_IDS_H_ #define CHROME_BROWSER_UI_VIEW_IDS_H_ enum ViewID { VIEW_ID_NONE = 0, // BROWSER WINDOW VIEWS // ------------------------------------------------------ // Tabs within a window/tab strip, counting from the left. VIEW_ID_TAB_0, VIEW_ID_TAB_1, VIEW_ID_TAB_2, VIEW_ID_TAB_3, VIEW_ID_TAB_4, VIEW_ID_TAB_5, VIEW_ID_TAB_6, VIEW_ID_TAB_7, VIEW_ID_TAB_8, VIEW_ID_TAB_9, VIEW_ID_TAB_LAST, // ID for any tab. Currently only used on views. VIEW_ID_TAB, VIEW_ID_TAB_STRIP, // Toolbar & toolbar elements. VIEW_ID_TOOLBAR = 1000, VIEW_ID_BACK_BUTTON, VIEW_ID_FORWARD_BUTTON, VIEW_ID_RELOAD_BUTTON, VIEW_ID_HOME_BUTTON, VIEW_ID_STAR_BUTTON, VIEW_ID_LOCATION_BAR, VIEW_ID_APP_MENU, VIEW_ID_AUTOCOMPLETE, VIEW_ID_BROWSER_ACTION_TOOLBAR, VIEW_ID_FEEDBACK_BUTTON, VIEW_ID_OMNIBOX, VIEW_ID_CHROME_TO_MOBILE_BUTTON, // The Bookmark Bar. VIEW_ID_BOOKMARK_BAR, VIEW_ID_OTHER_BOOKMARKS, // Used for bookmarks/folders on the bookmark bar. VIEW_ID_BOOKMARK_BAR_ELEMENT, // Find in page. VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, VIEW_ID_FIND_IN_PAGE, // Tab Container window. VIEW_ID_TAB_CONTAINER, // Docked dev tools. VIEW_ID_DEV_TOOLS_DOCKED, // The contents split. VIEW_ID_CONTENTS_SPLIT, // The Infobar container. VIEW_ID_INFO_BAR_CONTAINER, // The Download shelf. VIEW_ID_DOWNLOAD_SHELF, // Used in chrome/browser/ui/gtk/view_id_util_browsertests.cc // If you add new ids, make sure the above test passes. VIEW_ID_PREDEFINED_COUNT, // Plus button on location bar. VIEW_ID_ACTION_BOX_BUTTON }; #endif // CHROME_BROWSER_UI_VIEW_IDS_H_
// // CDataScanner_Extensions.h // TouchCode // // Created by Jonathan Wight on 12/08/2005. // Copyright 2005 toxicsoftware.com. All rights reserved. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // #import "CDataScannerSKZ.h" @interface CDataScannerSKZ (CDataScanner_Extensions) - (BOOL)scanCStyleComment:(NSString **)outComment; - (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment; - (NSUInteger)lineOfScanLocation; - (NSDictionary *)userInfoForScanLocation; @end
///////////////// // // Práctica de Compilación I (Curso 2010-2011) // // FICHERO: util.h // OBJETIVO: Utilidades compartidas. // LICENCIA: Mira el fichero LICENSE en el directorio raíz. // AUTORES: El equipo del JAG. // #ifndef UTIL_H #define UTIL_H #define NUMELEMS(x) (sizeof(x)/sizeof(x[0])) #define LITERAL(x) #x #endif /* UTIL_H */
/* $OpenBSD: mktemp.c,v 1.13 2003/06/17 21:56:25 millert Exp $ */ /* * Copyright (c) 1996, 1997, 2001, 2004, 2008, 2010 * Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include <stdio.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif /* HAVE_STDLIB_H */ #ifdef HAVE_STRING_H # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) # include <memory.h> # endif # include <string.h> #else # ifdef HAVE_STRINGS_H # include <strings.h> # endif /* HAVE_STRINGS_H */ #endif /* HAVE_STRING_H */ #if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) #include <malloc.h> #endif /* HAVE_MALLOC_H && !STDC_HEADERS */ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif /* HAVE_UNISTD_H */ #ifdef HAVE_PATHS_H #include <paths.h> #endif /* HAVE_PATHS_H */ #ifdef HAVE_GETOPT_LONG #include <getopt.h> #endif /* HAVE_GETOPT_LONG */ #include <errno.h> #include <extern.h> #ifndef _PATH_TMP #define _PATH_TMP "/tmp" #endif #ifdef HAVE_PROGNAME extern char *__progname; #else char *__progname; #endif void usage __P((void)) __attribute__((__noreturn__)); #ifdef HAVE_GETOPT_LONG static struct option const longopts[] = { {"directory", no_argument, NULL, 'd'}, {"help", no_argument, NULL, 'h'}, {"quiet", no_argument, NULL, 'q'}, {"tmpdir", optional_argument, NULL, 'T'}, {"dry-run", no_argument, NULL, 'u'}, {"version", no_argument, NULL, 'V'}, {NULL, 0, NULL, 0} }; #endif int main(argc, argv) int argc; char **argv; { int ch, fd, uflag = 0, quiet = 0, tflag = 0, Tflag = 0, makedir = 0; char *cp, *template, *tempfile, *prefix = _PATH_TMP; size_t plen; extern char *optarg; extern int optind; #ifndef HAVE_PROGNAME __progname = argv[0]; #endif #ifdef HAVE_GETOPT_LONG while ((ch = getopt_long(argc, argv, "dp:qtuV", longopts, NULL)) != -1) #else while ((ch = getopt(argc, argv, "dp:qtuV")) != -1) #endif switch (ch) { case 'd': makedir = 1; break; case 'p': prefix = optarg; tflag = 1; break; case 'q': quiet = 1; break; case 'T': if (optarg) { Tflag = 1; prefix = optarg; } /* FALLTHROUGH */ case 't': tflag = 1; break; case 'u': uflag = 1; break; case 'V': printf("%s version %s\n", __progname, PACKAGE_VERSION); exit(0); default: usage(); } /* If no template specified use a default one (implies -t mode) */ switch (argc - optind) { case 1: template = argv[optind]; break; case 0: template = "tmp.XXXXXXXXXX"; tflag = 1; break; default: usage(); } if (tflag) { if (strchr(template, '/')) { if (!quiet) (void)fprintf(stderr, "%s: template must not contain directory separators in -t mode\n", __progname); exit(1); } if (!Tflag) { cp = getenv("TMPDIR"); if (cp != NULL && *cp != '\0') prefix = cp; } plen = strlen(prefix); while (plen != 0 && prefix[plen - 1] == '/') plen--; tempfile = (char *)malloc(plen + 1 + strlen(template) + 1); if (tempfile == NULL) { if (!quiet) (void)fprintf(stderr, "%s: cannot allocate memory\n", __progname); exit(1); } (void)memcpy(tempfile, prefix, plen); tempfile[plen] = '/'; (void)strcpy(tempfile + plen + 1, template); /* SAFE */ } else { if ((tempfile = strdup(template)) == NULL) { if (!quiet) (void)fprintf(stderr, "%s: cannot allocate memory\n", __progname); exit(1); } } if (makedir) { if (MKDTEMP(tempfile) == NULL) { if (!quiet) { (void)fprintf(stderr, "%s: cannot make temp dir %s: %s\n", __progname, tempfile, strerror(errno)); } exit(1); } if (uflag) (void)rmdir(tempfile); } else { if ((fd = MKSTEMP(tempfile)) < 0) { if (!quiet) { (void)fprintf(stderr, "%s: cannot create temp file %s: %s\n", __progname, tempfile, strerror(errno)); } exit(1); } (void)close(fd); if (uflag) (void)unlink(tempfile); } (void)puts(tempfile); free(tempfile); exit(0); } void usage() { (void)fprintf(stderr, "Usage: %s [-V] | [-dqtu] [-p prefix] [template]\n", __progname); exit(1); }
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "fft.h" #include "common.h" #include "common_rand.h" complex* random_complex_vector(int n){ complex *x = malloc(sizeof(complex)*n); int i; for(i=0;i<n; ++i){ x[i].re = common_randJS()*2 - 1; x[i].im = common_randJS()*2 - 1; } return x; } void print_complex_array(complex *x, int n){ int i; for(i = 0; i < n; ++i) fprintf(stderr, "%.6f + %.6fi\n", x[i].re, x[i].im); } void print_complex_matrix(complex **x, int n){ int i; for(i=0; i < n; ++i) { print_complex_array(x[i], n); fprintf(stderr, "\n"); } fprintf(stderr, "\n"); } int main(int argc, char** argv){ complex *x, **m; int n = 1024; int i; stopwatch sw; int c; int two_exp = 10; if (argc > 1) { two_exp = atoi(argv[1]); n = 1 << two_exp; if (two_exp < 0 || two_exp > 30) { fprintf(stderr, "ERROR: invalid exponent of '%d' for input size\n", n); exit(1); } } // Test 1D arrays /* x = random_complex_vector(n); stopwatch_start(&sw); complex *results = FFT_simple(x,n); stopwatch_stop(&sw); fprintf(stderr, "The total 1D FFT time for %d size was %lf seconds!\n", n, get_interval_by_sec(&sw)); */ // Test 2D arrays m = malloc(sizeof(complex*)*n); for(i=0; i<n; ++i) m[i] = random_complex_vector(n); stopwatch_start(&sw); complex **results2D = FFT_2D(m,n); stopwatch_stop(&sw); printf("{ \"status\": %d, \"options\": \"%d\", \"time\": %f }\n", 1, two_exp, get_interval_by_sec(&sw)); // fprintf(stderr, "1D Input Array: \n"); // print_complex_array(x, n); // fprintf(stderr, "2D Input Array \n"); // print_complex_matrix(m,n); // fprintf(stderr, "1D Output Array: \n"); // print_complex_array(results, n); // fprintf(stderr, "2D Output Array: \n"); // print_complex_matrix(results2D, n); //free(x); for(i=0; i<n; ++i) free(m[i]); free(m); }
#ifndef Py_PYTHON_H #define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ #include "patchlevel.h" #include "pyconfig.h" #include "pymacconfig.h" #include <limits.h> #ifndef UCHAR_MAX #error "Something's broken. UCHAR_MAX should be defined in limits.h." #endif #if UCHAR_MAX != 255 #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif #include <stdio.h> #ifndef NULL # error "Python.h requires that stdio.h define NULL." #endif #include <string.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif /* For size_t? */ #ifdef HAVE_STDDEF_H #include <stddef.h> #endif /* CAUTION: Build setups should ensure that NDEBUG is defined on the * compiler command line when building Python in release mode; else * assert() calls won't be removed. */ #include <assert.h> #include "pyport.h" #include "pymacro.h" #include "pyatomic.h" /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. * PYMALLOC_DEBUG is in error if pymalloc is not in use. */ #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) #define PYMALLOC_DEBUG #endif #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" #endif #include "pymath.h" #include "pytime.h" #include "pymem.h" #include "object.h" #include "objimpl.h" #include "typeslots.h" #include "pyhash.h" #include "pydebug.h" #include "bytearrayobject.h" #include "bytesobject.h" #include "unicodeobject.h" #include "longobject.h" #include "longintrepr.h" #include "boolobject.h" #include "floatobject.h" #include "complexobject.h" #include "rangeobject.h" #include "memoryobject.h" #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" #include "enumobject.h" #include "setobject.h" #include "methodobject.h" #include "moduleobject.h" #include "funcobject.h" #include "classobject.h" #include "fileobject.h" #include "pycapsule.h" #include "traceback.h" #include "sliceobject.h" #include "cellobject.h" #include "iterobject.h" #include "genobject.h" #include "descrobject.h" #include "warnings.h" #include "weakrefobject.h" #include "structseq.h" #include "namespaceobject.h" #include "codecs.h" #include "pyerrors.h" #include "pystate.h" #include "pyarena.h" #include "modsupport.h" #include "pythonrun.h" #include "ceval.h" #include "sysmodule.h" #include "intrcheck.h" #include "import.h" #include "abstract.h" #include "bltinmodule.h" #include "compile.h" #include "eval.h" #include "pyctype.h" #include "pystrtod.h" #include "pystrcmp.h" #include "dtoa.h" #include "fileutils.h" #include "pyfpe.h" #endif /* !Py_PYTHON_H */
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdint.h> #include <string.h> #include <errno.h> #include <time.h> #include <stdarg.h> #include <syslog.h> #define LOG_MESSAGE_SIZE 256 static int _syslog = 0; static char *levels[] = { "EMERG", "ALERT", "CRIT", "ERR", "WARNING", "NOTICE", "INFO", "DEBUG" }; static char *colors[] = { "\e[01;31m", "\e[01;31m", "\e[01;31m", "\e[01;31m", "\e[01;33m", "\e[01;33m", "\e[01;32m", "\e[01;36m" }; void logger_log(uint32_t level, const char *msg, ...) { char timestr[20]; time_t curtime = time(NULL); struct tm *loctime = localtime(&curtime); char tmp[LOG_MESSAGE_SIZE]; va_list ap; va_start(ap, msg); vsnprintf(tmp, LOG_MESSAGE_SIZE, msg, ap); va_end(ap); if (_syslog) { syslog(level, "[%s] %s", levels[level], tmp); } else { strftime(timestr, 20, "%Y/%m/%d %H:%M:%S", loctime); fprintf(stderr, "%s%s [%s]\e[0m: %s\n", colors[level], timestr, levels[level], tmp); } } void logger_stderr(const char *msg, ...) { char timestr[20]; time_t curtime = time(NULL); struct tm *loctime = localtime(&curtime); char tmp[LOG_MESSAGE_SIZE]; va_list ap; va_start(ap, msg); vsnprintf(tmp, LOG_MESSAGE_SIZE, msg, ap); va_end(ap); strftime(timestr, 20, "%Y/%m/%d %H:%M:%S", loctime); fprintf(stderr, "\e[01;31m%s [%s]\e[0m: %s\n", timestr, levels[LOG_ERR], tmp); } int logger_init(int syslog) { _syslog = syslog; return 0; }
// // PINRemoteImage.h // Pods // // Created by Garrett Moon on 8/17/14. // // #ifndef Pods_PINRemoteImage_h #define Pods_PINRemoteImage_h #import "PINRemoteImageMacros.h" #import "PINRemoteImageManager.h" #import "PINRemoteImageCategoryManager.h" #import "PINRemoteImageManagerResult.h" #import "PINRemoteImageCaching.h" #import "PINProgressiveImage.h" #import "PINURLSessionManager.h" #endif
// // RZCollectionTableView.h // // Created by Nick Donaldson on 9/13/13. // Copyright (c) 2013 RaizLabs. // /** * Is it a collection view or is it a table view?? * The world may never know. * * RZCollectionTableView is a collection view with an accompanying layout * designed to look and feel like a UITableView, in terms of visual appearance, * touch interaction, and programming infterface. There are a few additional * useful capabilities thrown in for good measure, such as per-section insets * and row spacing, and collection view attributes which indicate row position * (solo, top middle, bottom) for easier styling. * * Requires iOS 6.0+ * */ #import <Foundation/Foundation.h> #import "RZCollectionTableViewCell.h" //! A UICollection view subclass designed to look and feel like a UITableView /*! RZCollectionTableView enables editing features similar to a UITableView. RZCollectionTableViewLayout can be used with a normal UICollectionView (and vice-versa), but swipe-to-delete and other future cell editing interactions won't work unless both are used together. */ NS_CLASS_AVAILABLE_IOS(6_0) @interface RZCollectionTableView : UICollectionView @end // ---------------- // These are the supplementary view types that will be requested for header/footer views. OBJC_EXTERN NSString * const RZCollectionTableViewLayoutHeaderView; OBJC_EXTERN NSString * const RZCollectionTableViewLayoutFooterView; @protocol RZCollectionTableViewLayoutDelegate; // The layout can be used with a normal UICollectionView, but editing states will not work correctly. NS_CLASS_AVAILABLE_IOS(6_0) @interface RZCollectionTableViewLayout : UICollectionViewLayout // Insets around each section. Defaults to UIEdgeInsetsZero. // Can be overridden per-section by delegate. @property (nonatomic, assign) UIEdgeInsets sectionInsets; // Spacing between rows. Defaults to zero. Can be overriden per-section by delegate. // But wait, can this be negative?? You bet your sweet tookus it can. @property (nonatomic, assign) CGFloat rowSpacing; // Row height. Defaults to 44. Can be overridden per-section by delegate. @property (nonatomic, assign) CGFloat rowHeight; // Defaults to zero. Can be overridden per-section by delegate. // If zero, no header will be requested. @property (nonatomic, assign) CGFloat headerHeight; // Defaults to zero. Can be overridden per-section by delegate. // If zero, no header will be requested. @property (nonatomic, assign) CGFloat footerHeight; - (CGRect)rectForSection:(NSInteger)section; - (CGRect)rectForHeaderInSection:(NSInteger)section; - (CGRect)rectForFooterInSection:(NSInteger)section; - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath; @end // ------------------ NS_CLASS_AVAILABLE_IOS(6_0) @protocol RZCollectionTableViewLayoutDelegate <UICollectionViewDelegate> @optional - (CGFloat)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout heightForRowAtIndexPath:(NSIndexPath*)indexPath; - (CGFloat)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout rowSpacingForSection:(NSInteger)section; // implement this to speed up load times - (CGFloat)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout estimatedHeightForRowAtIndexPath:(NSIndexPath*)indexPath; - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout insetForSectionAtIndex:(NSInteger)section; // same signature as UICollectionViewDelegateFlowLayout // If either of these return zero, no header will be requested for that section. - (CGFloat)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout heightForHeaderInSection:(NSInteger)section; - (CGFloat)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout heightForFooterInSection:(NSInteger)section; - (BOOL)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout editingEnabledForRowAtIndexPath:(NSIndexPath*)indexPath; - (void)collectionView:(UICollectionView *)collectionView rzTableLayout:(RZCollectionTableViewLayout *)layout editingButtonPressedForIndex:(NSUInteger)buttonIndex forRowAtIndexPath:(NSIndexPath*)indexPath; @end // ------------------ typedef NS_ENUM(NSUInteger, RZCollectionTableViewCellRowPosition) { RZCollectionTableViewCellRowPositionSolo, RZCollectionTableViewCellRowPositionTop, RZCollectionTableViewCellRowPositionMiddle, RZCollectionTableViewCellRowPositionBottom }; NS_CLASS_AVAILABLE_IOS(6_0) @interface RZCollectionTableViewCellAttributes : UICollectionViewLayoutAttributes @property (nonatomic, assign) RZCollectionTableViewCellRowPosition rowPosition; @property (nonatomic, assign) BOOL rzEditingEnabled; @end
// // UIScrollView+EKExtension.h // Copyright (c) 2014-2016 Moch Xiao (http://mochxiao.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. // #import <UIKit/UIKit.h> @interface UIScrollView (EKExtension) @property (nonatomic, assign) CGFloat ek_insetTop; @property (nonatomic, assign) CGFloat ek_insetLeft; @property (nonatomic, assign) CGFloat ek_insetBottom; @property (nonatomic, assign) CGFloat ek_insetRight; @property (nonatomic, assign) CGFloat ek_scrollIndicatorInsetTop; @property (nonatomic, assign) CGFloat ek_scrollIndicatorInsetLeft; @property (nonatomic, assign) CGFloat ek_scrollIndicatorInsetBottom; @property (nonatomic, assign) CGFloat ek_scrollIndicatorInsetRight; @property (nonatomic, assign) CGFloat ek_contentOffsetX; @property (nonatomic, assign) CGFloat ek_contentOffsetY; @property (nonatomic, assign) CGFloat ek_contentSizeWidth; @property (nonatomic, assign) CGFloat ek_contentSizeHeight; #pragma mark - - (void)ek_addRefreshControlWithActionHandler:(void (^_Nonnull)(UIScrollView *_Nonnull sender))handler; @property (nonatomic, assign) BOOL ek_refreshControlEnabled; @property (nonatomic, assign, readonly) BOOL ek_refreshing; - (void)ek_beginRefreshing; - (void)ek_endRefreshing; - (void)ek_removeRefreshControl; #pragma mark - NoDelaysContentTouches /// Default value is `YES`, the same as `delaysContentTouches`. @property (nonatomic, assign) BOOL ek_delaysContentTouches; @end
// // LUNTutorialWireframesDataSource.h // LUNTutorialDemo // // Created by Vladimir Sharavara on 3/7/16. // Copyright © 2016 lunapps. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @protocol LUNTutorialWireframesDataSource <NSObject> @optional - (__kindof UIView *)wireframeViewForIndex:(NSInteger)index; @end
/* * Swamp - cooperative multitasking operating system * Copyright (c) 2016 rksdna * * 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 DBGMCU_H #define DBGMCU_H #include <types.h> struct dbgmcu { volatile u32_t IDCODE; volatile u32_t CR; volatile u32_t APB1FZ; volatile u32_t APB2FZ; }; #define DBGMCU ((struct dbgmcu *)0x40015800) #define DBGMCU_CR_DBG_STOP ((u32_t)0x00000002) #define DBGMCU_CR_DBG_STANDBY ((u32_t)0x00000004) #define DBGMCU_IDCODE_DEV_ID ((u32_t)0x00000FFF) #define DBGMCU_IDCODE_REV_ID ((u32_t)0xFFFF0000) #define DBGMCU_APB1_FZ_DBG_TIM3_STOP ((u32_t)0x00000002) #define DBGMCU_APB1_FZ_DBG_TIM14_STOP ((u32_t)0x00000100) #define DBGMCU_APB1_FZ_DBG_RTC_STOP ((u32_t)0x00000400) #define DBGMCU_APB1_FZ_DBG_WWDG_STOP ((u32_t)0x00000800) #define DBGMCU_APB1_FZ_DBG_IWDG_STOP ((u32_t)0x00001000) #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT ((u32_t)0x00200000) #define DBGMCU_APB1_FZ_DBG_TIM6_STOP ((u32_t)0x00000010) #define DBGMCU_APB1_FZ_DBG_TIM7_STOP ((u32_t)0x00000020) #define DBGMCU_APB1_FZ_DBG_TIM2_STOP ((u32_t)0x00000001) #define DBGMCU_APB1_FZ_DBG_CAN_STOP ((u32_t)0x02000000) #define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((u32_t)0x00000800) #define DBGMCU_APB2_FZ_DBG_TIM16_STOP ((u32_t)0x00020000) #define DBGMCU_APB2_FZ_DBG_TIM17_STOP ((u32_t)0x00040000) #define DBGMCU_APB2_FZ_DBG_TIM15_STOP ((u32_t)0x00010000) #endif
// // OCMBorderFilter.h // OpenCam // // Created by Jason Hsu on 2013/12/18. // Copyright (c) 2013年 Jason Hsu. All rights reserved. // #import <GPUImage/GPUImage.h> @interface OCMBorderFilter : GPUImageTwoInputFilter { GPUImagePicture *framePicture; } @property (nonatomic, readwrite) UIImage *borderImage; @end
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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 _NSTEXTCHECKINGRESULT_H_ #define _NSTEXTCHECKINGRESULT_H_ #import <Foundation/NSObject.h> #import <Foundation/NSRange.h> #import <Foundation/NSDate.h> @class NSDictionary, NSURL, NSOrthography; SB_EXPORT NSString* const NSTextCheckingNameKey; SB_EXPORT NSString* const NSTextCheckingJobTitleKey; SB_EXPORT NSString* const NSTextCheckingOrganizationKey; SB_EXPORT NSString* const NSTextCheckingStreetKey; SB_EXPORT NSString* const NSTextCheckingCityKey; SB_EXPORT NSString* const NSTextCheckingStateKey; SB_EXPORT NSString* const NSTextCheckingZIPKey; SB_EXPORT NSString* const NSTextCheckingCountryKey; SB_EXPORT NSString* const NSTextCheckingPhoneKey; enum { NSTextCheckingTypeOrthography = 1ULL << 0, NSTextCheckingTypeSpelling = 1ULL << 1, NSTextCheckingTypeGrammar = 1ULL << 2, NSTextCheckingTypeDate = 1ULL << 3, NSTextCheckingTypeAddress = 1ULL << 4, NSTextCheckingTypeLink = 1ULL << 5, NSTextCheckingTypeQuote = 1ULL << 6, NSTextCheckingTypeDash = 1ULL << 7, NSTextCheckingTypeReplacement = 1ULL << 8, NSTextCheckingTypeCorrection = 1ULL << 9, NSTextCheckingTypeRegularExpression = 1ULL << 10, NSTextCheckingTypePhoneNumber = 1ULL << 11, NSTextCheckingTypeTransitInformation = 1ULL << 12 }; typedef uint32_t NSTextCheckingType; enum : uint64_t { NSTextCheckingAllSystemTypes = 0xffffffffULL, NSTextCheckingAllCustomTypes = 0xffffffffULL << 32, NSTextCheckingAllTypes = (NSTextCheckingAllSystemTypes | NSTextCheckingAllCustomTypes), }; typedef uint64_t NSTextCheckingTypes; @interface NSTextCheckingResult : NSObject + (NSTextCheckingResult*)addressCheckingResultWithRange:(NSRange)range components:(NSDictionary*)components; + (NSTextCheckingResult*)correctionCheckingResultWithRange:(NSRange)range replacementString:(NSString*)replacement; + (NSTextCheckingResult*)dashCheckingResultWithRange:(NSRange)range replacementString:(NSString*)replacement; + (NSTextCheckingResult*)dateCheckingResultWithRange:(NSRange)range date:(NSDate*)date; + (NSTextCheckingResult*)dateCheckingResultWithRange:(NSRange)range date:(NSDate*)date timeZone:(NSTimeZone*)timeZone duration:(NSTimeInterval)duration; + (NSTextCheckingResult*)grammarCheckingResultWithRange:(NSRange)range details:(NSArray*)details; + (NSTextCheckingResult*)linkCheckingResultWithRange:(NSRange)range URL:(NSURL*)url; + (NSTextCheckingResult*)orthographyCheckingResultWithRange:(NSRange)range orthography:(NSOrthography*)orthography; + (NSTextCheckingResult*)quoteCheckingResultWithRange:(NSRange)range replacementString:(NSString*)replacement; + (NSTextCheckingResult*)replacementCheckingResultWithRange:(NSRange)range replacementString:(NSString*)replacement; + (NSTextCheckingResult*)spellCheckingResultWithRange:(NSRange)range; + (NSTextCheckingResult*)phoneNumberCheckingResultWithRange:(NSRange)range phoneNumber:(NSString*)phoneNumber; - (NSRange)rangeAtIndex:(NSUInteger)idx; @property (readonly) NSDictionary* addressComponents; @property (readonly) NSDate* date; @property (readonly) NSTimeInterval duration; @property (readonly) NSArray* grammarDetails; @property (readonly) NSOrthography* orthography; @property (readonly) NSRange range; @property (readonly) NSString* replacementString; @property (readonly) NSTextCheckingType resultType; @property (readonly) NSTimeZone* timeZone; @property (readonly) NSURL* URL; @property (readonly) NSString* phoneNumber; @property (readonly) NSUInteger numberOfRanges; @end #endif /* _NSTEXTCHECKINGRESULT_H_ */
#ifndef _FAKIO_CONTEXTS_H_ #define _FAKIO_CONTEXTS_H_ #include "fakio.h" #define MASK_NONE 0 #define MASK_CLIENT 1 #define MASK_REMOTE 2 struct context { int client_fd; int remote_fd; fbuffer_t *req; /* Request buffer */ fbuffer_t *res; /* Response Buffer */ struct fserver *server; struct event_loop *loop; struct context_pool_node *node; struct context_pool *pool; fuser_t *user; fcrypt_ctx_t *crypto; }; struct context_pool_node { int mask; context_t *c; struct context_pool_node *next; }; struct context_pool { int max_size; int inited_size; int free_size; struct context_pool_node *contexts, *free_context; }; static inline void context_set_mask(context_t *c, int mask) { c->node->mask = mask; } static inline int context_get_mask(context_t *c) { return c->node->mask; } context_pool_t *context_pool_create(int maxsize); void context_pool_destroy(context_pool_t *pool); context_t *context_pool_get(context_pool_t *pool, int mask); void context_pool_release(context_pool_t *pool, context_t *c, int mask); #endif
// Created by John Åkerblom 2013 #include "hooked_functions.h" #include <windows.h> BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: hooked_functions_init(); break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; }
// // WXSVGPolyline.h // WeexSVGPlugin // // Created by yangshengtao on 2017/3/24. // Copyright © 2017年 Taobao. All rights reserved. // #import "WXSVGRenderable.h" @interface WXSVGPolyline : WXSVGRenderable @property (nonatomic, strong) NSArray* points; @end
#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" #include "log.h" static void switch_layout(struct wlr_keyboard *kbd, xkb_layout_index_t idx) { xkb_layout_index_t num_layouts = xkb_keymap_num_layouts(kbd->keymap); if (idx >= num_layouts) { return; } wlr_keyboard_notify_modifiers(kbd, kbd->modifiers.depressed, kbd->modifiers.latched, kbd->modifiers.locked, idx); } struct cmd_results *input_cmd_xkb_switch_layout(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "xkb_switch_layout", EXPECTED_EQUAL_TO, 1))) { return error; } struct input_config *ic = config->handler_context.input_config; if (!ic) { return cmd_results_new(CMD_FAILURE, "No input device defined."); } if (config->reading || !config->active) { return cmd_results_new(CMD_DEFER, NULL); } const char *layout_str = argv[0]; char *end; int layout = strtol(layout_str, &end, 10); if (layout_str[0] == '\0' || end[0] != '\0' || layout < 0) { return cmd_results_new(CMD_FAILURE, "Invalid layout index."); } struct sway_input_device *dev; wl_list_for_each(dev, &server.input->devices, link) { if (strcmp(ic->identifier, "*") != 0 && strcmp(ic->identifier, "type:keyboard") != 0 && strcmp(ic->identifier, dev->identifier) != 0) { continue; } if (dev->wlr_device->type != WLR_INPUT_DEVICE_KEYBOARD) { continue; } switch_layout(dev->wlr_device->keyboard, layout); } return cmd_results_new(CMD_SUCCESS, NULL); }
/* Open Asset Import Library (assimp) ---------------------------------------------------------------------- Copyright (c) 2006-2018, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the assimp team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the assimp team. 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. ---------------------------------------------------------------------- */ /** @file FBXCompileConfig.h * @brief FBX importer compile-time switches */ #ifndef INCLUDED_AI_FBX_COMPILECONFIG_H #define INCLUDED_AI_FBX_COMPILECONFIG_H #include <map> // #if _MSC_VER > 1500 || (defined __GNUC___) # define ASSIMP_FBX_USE_UNORDERED_MULTIMAP # else # define fbx_unordered_map map # define fbx_unordered_multimap multimap #endif #ifdef ASSIMP_FBX_USE_UNORDERED_MULTIMAP # include <unordered_map> # if _MSC_VER > 1600 # define fbx_unordered_map unordered_map # define fbx_unordered_multimap unordered_multimap # else # define fbx_unordered_map tr1::unordered_map # define fbx_unordered_multimap tr1::unordered_multimap # endif #endif #endif // INCLUDED_AI_FBX_COMPILECONFIG_H