text
stringlengths
4
6.14k
// // LTPasswordKeyboard.h // testAPP // // Created by huanyu.li on 2017/9/11. // Copyright © 2017年 huanyu.li. All rights reserved. // #import "LTBaseKeyboard.h" @interface LTPasswordKeyboard : LTBaseKeyboard @end
#define DDCL_CORE #include "ddclstorage.h" #include <stdlib.h> #include <stdio.h> #include <memory.h> typedef struct tag_Block{ char used; ddcl_Handle h; struct tag_Block * next; struct tag_Block * last; }Block; typedef struct tag_Slot { char * buf; dduint32 size; struct tag_Slot * next; }Slot; struct tag_ddcl_Storage{ ddcl_Handle h_index; dduint32 size; dduint32 ele_sz; Slot * slot; Slot * slot_end; Block * block; Block * block_end; Block * block_cur; }; #define MAX_EXPEND_SIZE 10000 static Slot * _new_slot(dduint32 ele_sz, dduint32 size) { if(size > MAX_EXPEND_SIZE){ size = MAX_EXPEND_SIZE; } Slot * s = malloc(sizeof(Slot)); s->buf = malloc((sizeof(Block) + ele_sz) * size); memset(s->buf, 0, (sizeof(Block) + ele_sz) * size); s->size = size; s->next = NULL; return s; } static void _free_slot(Slot * s) { Slot * tmp; while (s) { tmp = s; free(s->buf); free(tmp); s = s->next; } } static char * _register_in_slot(ddcl_Storage * hs, ddcl_Handle h) { Block * block; ddcl_Handle hash; Slot * s = hs->slot; while (s) { hash = h % s->size; block = &(s->buf[hash * (sizeof(Block) + hs->ele_sz)]); if (!block->used) { block->used = 1; block->h = h; if(!hs->block){ hs->block = block; hs->block_end = block; }else{ hs->block_end->next = block; block->last = hs->block_end; hs->block_end = block; } return ((char *)block) + sizeof(Block); } s = s->next; } return NULL; } static Block * _find_in_slot(ddcl_Storage * hs, ddcl_Handle h) { Block * block; ddcl_Handle hash; Slot * s = hs->slot; while (s) { hash = h % s->size; block = &(s->buf[hash * (sizeof(Block) + hs->ele_sz)]); if(block->used && block->h == h){ return block; } s = s->next; } return NULL; } DDCLAPI ddcl_Storage * ddcl_new_storage (unsigned ele_sz, unsigned initSize){ if (initSize < 1) initSize = 1; ddcl_Storage * hs = malloc(sizeof(ddcl_Storage)); memset(hs, 0, sizeof(ddcl_Storage)); hs->h_index = 0; hs->size = initSize; hs->ele_sz = ele_sz; hs->slot = _new_slot(ele_sz, initSize); hs->slot_end = hs->slot; return hs; } DDCLAPI void ddcl_free_storage (ddcl_Storage * hs){ _free_slot(hs->slot); free(hs); } DDCLAPI ddcl_Handle ddcl_register_in_storage (ddcl_Storage * hs, void ** p){ ddcl_Handle handle; char * buf; dduint32 h_index = hs->h_index; for(;;){ for(dduint32 i = 0; i < hs->size; i ++){ handle = ++h_index; if (handle == 0) handle = ++h_index; buf = _register_in_slot(hs, handle); if(buf){ *p = buf; hs->h_index = h_index; return handle; } } ddcl_expand_storage(hs, hs->slot_end->size * 2); } } DDCLAPI void * ddcl_find_in_storage (ddcl_Storage * hs, ddcl_Handle h){ Block * block = _find_in_slot(hs, h); if (block) { return ((char *)block) + sizeof(Block); } return NULL; } DDCLAPI int ddcl_del_in_storage (ddcl_Storage * hs, ddcl_Handle h){ Block * block = _find_in_slot(hs, h); if (block) { if(hs->block == block){ hs->block = block->next; } if(hs->block_end == block){ hs->block_end = block->last; } if(hs->block_cur == block){ hs->block_cur = block->next; } if(block->last){ block->last->next = block->next; } if(block->next){ block->next->last = block->last; } memset(block, 0, sizeof(Block)+ hs->ele_sz); return 0; } return 1; } DDCLAPI void ddcl_expand_storage (ddcl_Storage * hs, dduint32 size){ Slot * s = _new_slot(hs->ele_sz, size); hs->slot_end->next = s; hs->slot_end = s; hs->size += size; } DDCLAPI void ddcl_begin_storage(ddcl_Storage * hs){ hs->block_cur = hs->block; } DDCLAPI int ddcl_next_storage(ddcl_Storage * hs, ddcl_Handle * h, void ** p){ Block * cur = hs->block_cur; if(!cur){ return 0; } *h = cur->h; *p = ((char *)cur) + sizeof(Block); hs->block_cur = cur->next; return 1; }
/*========================================================================= Program: Visualization Toolkit Module: vtkPStructuredGridConnectivity.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 vtkPUnstructuredGridGhostDataGenerator -- Builds ghost zones for a // distributed unstructured grid dataset. // // .SECTION Description // This filter uses internally the vtkPUnstructuredGridConnectivity helper // class to construct ghost zones for a distributed unstructured grid. // // .SECTION Caveats // <ul> // <li> The code currently assumes one grid per rank. </li> // <li> GlobalID information must be provided as a PointData array // with the name, "GlobalID" </li> // <li> The grid must be globally conforming, i.e., no hanging nodes. </li> // <li> Only topologically face-adjacent ghost cells are considered. </li> // <li> PointData and CellData must match across partitions/processes. </li> // </ul> // // .SECTION See Also // vtkPUnstructuredGridConnectivity #ifndef VTKPUNSTRUCTUREDGRIDGHOSTDATAGENERATOR_H_ #define VTKPUNSTRUCTUREDGRIDGHOSTDATAGENERATOR_H_ #include "vtkFiltersParallelGeometryModule.h" // For export macro #include "vtkUnstructuredGridAlgorithm.h" // Forward Declarations class vtkIndent; class vtkInformation; class vtkInformationVector; class vtkPUnstructuredGridConnectivity; class vtkUnstructuredGrid; class vtkMultiProcessController; class VTKFILTERSPARALLELGEOMETRY_EXPORT vtkPUnstructuredGridGhostDataGenerator: public vtkUnstructuredGridAlgorithm { public: static vtkPUnstructuredGridGhostDataGenerator* New(); vtkTypeMacro(vtkPUnstructuredGridGhostDataGenerator,vtkUnstructuredGridAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); protected: vtkPUnstructuredGridGhostDataGenerator(); virtual ~vtkPUnstructuredGridGhostDataGenerator(); // Standard VTK pipeline routines virtual int FillInputPortInformation(int port,vtkInformation *info); virtual int FillOutputPortInformation(int port, vtkInformation *info); virtual int RequestData( vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector* outputVector ); vtkPUnstructuredGridConnectivity* GhostZoneBuilder; vtkMultiProcessController* Controller; private: vtkPUnstructuredGridGhostDataGenerator(const vtkPUnstructuredGridGhostDataGenerator&); // Not implemented void operator=(const vtkPUnstructuredGridGhostDataGenerator&); // Not implemented }; #endif /* VTKPUNSTRUCTUREDGRIDGHOSTDATAGENERATOR_H_ */
#import "MOBProjection.h" @interface MOBProjectionEPSG5117 : MOBProjection @end
// // ViewController.h // SMTKeyboardManager // // Created by Steffi Tan on 30/03/2016. // Copyright © 2016 Steffi Tan. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
#include "unity.h" #include "unity_fixture.h" TEST_GROUP_RUNNER(Camera) { RUN_TEST_CASE(Camera, testCamera_Abrir_Invalido); RUN_TEST_CASE(Camera, testCamera_Abrir_Valido); RUN_TEST_CASE(Camera, testImagem_Obter_Frame); }
// // XScrollDataSourceAccess.h // XScrollExample // // Created by Agus Soedibjo on 07/10/2014. // Copyright (c) 2014 Agus Soedibjo. 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 <Foundation/Foundation.h> #import "XScrollDataSourceMapping.h" // Simple JSON Data Parsing @interface XScrollDataSourceAccess : NSObject + (NSArray *)retrieveObjectsFromPath:(NSString *)resourceName ofType:(NSString *)resourceType atRootKeyPath:(NSString *)keyPath forDataSourceMapping:(XScrollDataSourceMapping *)dataSourceMapping; @end
#ifndef INC_NMEA_GPRMC_H #define INC_NMEA_GPRMC_H #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <time.h> #include <nmea.h> typedef struct { nmea_s base; struct tm date_time; nmea_position longitude; nmea_position latitude; double gndspd_knots; double track_deg; double magvar_deg; nmea_cardinal_t magvar_cardinal; //The direction of the magnetic variation determines whether or not it //is additive - Easterly means subtract magvar_deg from track_deg and //westerly means add magvar_deg to track_deg for the correct course. bool valid; } nmea_gprmc_s; /* Value indexes */ #define NMEA_GPRMC_TIME 0 #define NMEA_GPRMC_STATUS 1 #define NMEA_GPRMC_LATITUDE 2 #define NMEA_GPRMC_LATITUDE_CARDINAL 3 #define NMEA_GPRMC_LONGITUDE 4 #define NMEA_GPRMC_LONGITUDE_CARDINAL 5 #define NMEA_GPRMC_GNDSPD_KNOTS 6 #define NMEA_GPRMC_TRUECOURSE_DEG 7 #define NMEA_GPRMC_DATE 8 #define NMEA_GPRMC_MAGVAR_DEG 9 #define NMEA_GPRMC_MAGVAR_CARDINAL 10 #endif /* INC_NMEA_GPRMC_H */
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @interface PULayoutSectioning : NSObject { _Bool _invalidatingSampling; _Bool _invalidatingSections; PULayoutSectioning *_baseSectioning; id <PULayoutSectioningDelegate> _delegate; } @property(retain, nonatomic) PULayoutSectioning *baseSectioning; // @synthesize baseSectioning=_baseSectioning; @property(nonatomic) id <PULayoutSectioningDelegate> delegate; // @synthesize delegate=_delegate; - (void).cxx_destruct; - (_Bool)writeToURL:(id)arg1 error:(id *)arg2; - (id)sectioningHash; - (id)sectioningHashHasIncorrectSampling:(_Bool *)arg1 hasInvisibleItemsInBaseSectioning:(_Bool *)arg2; - (id)sectioningDescription; - (id)_sectioningDescriptionShowInvisibleItemsInBaseSectioning:(_Bool)arg1 hasIncorrectSampling:(_Bool *)arg2 hasInvisibleItemsInBaseSectioning:(_Bool *)arg3; - (long long)__debugUnsampledIndexForRealIndexPath:(struct PUSimpleIndexPath)arg1; - (id)description; - (id)visibleUnsampledIndexesForCombinedRealSections:(id)arg1; - (void)enumerateRealMainItemIndexPathsForVisualSection:(long long)arg1 inVisualItemRange:(struct _NSRange)arg2 usingBlock:(id)arg3; - (void)enumerateRealSectionsForVisualSection:(long long)arg1 usingBlock:(id)arg2; - (long long)visualSectionForRealSection:(long long)arg1; - (long long)mainRealSectionForVisualSection:(long long)arg1; - (struct PUSimpleIndexPath)visualIndexPathForRealIndexPath:(struct PUSimpleIndexPath)arg1 isMainItem:(_Bool *)arg2; - (struct PUSimpleIndexPath)mainRealItemIndexPathForVisualIndexPath:(struct PUSimpleIndexPath)arg1; - (long long)numberOfRealItemsInVisualSection:(long long)arg1; - (long long)numberOfVisualItemsInVisualSection:(long long)arg1; - (void)invalidateSections; - (void)_baseSectioningDidInvalidateSections:(id)arg1; - (_Bool)hasSomeSampling; - (void)invalidateSampling; - (void)_baseSectioningDidInvalidateSampling:(id)arg1; - (void)dealloc; @end
/* * cli.h (header file for the Command line handler) * * AUTHOR: Muthucumaru Maheswaran * DATE: December 25, 2004 * * The CLI is used as a configuration file parser * as well. Right now the CLI module is only capable * of parsing a very simple format and limited command set... * Future development should make the CLI more IOS like?? */ #ifndef __CLI_H__ #define __CLI_H__ #include <string.h> #include <stdio.h> #include <slack/std.h> #include <slack/map.h> #include "message.h" #include "grouter.h" #define PROGRAM 10 #define JOIN 11 #define COMMENT 12 #define COMMENT_CHAR '#' #define CONTINUE_CHAR '\\' #define CARRIAGE_RETURN '\r' #define LINE_FEED '\n' #define MAX_BUF_LEN 4096 #define MAX_LINE_LEN 1024 #define MAX_KEY_LEN 64 typedef struct _cli_entry_t { char keystr[MAX_KEY_LEN]; char long_helpstr[MAX_BUF_LEN]; char short_helpstr[MAX_BUF_LEN]; char usagestr[MAX_BUF_LEN]; void (*handler)(); } cli_entry_t; // function prototypes... void dummyFunction(); void parseACLICmd(char *str); void CLIProcessCmds(FILE *fp, int online); void CLIPrintHelpPreamble(); void *CLIProcessCmdsInteractive(void *arg); void registerCLI(char *key, void (*handler)(), char *shelp, char *usage, char *lhelp); void CLIDestroy(); void helpCmd(); void versionCmd(); void setCmd(); void getCmd(); void sourceCmd(); void ifconfigCmd(); void routeCmd(); void arpCmd(); void pingCmd(); void consoleCmd(); void haltCmd(); void exitCmd(); void queueCmd(); void qdiscCmd(); void spolicyCmd(); void classCmd(); void filterCmd(); #endif
// // HaidoraServices.h // Pods // // Created by Dailingchi on 15/4/6. // // #ifndef Pods_HaidoraServices_h #define Pods_HaidoraServices_h #import "HDService.h" #import "HDServiceProvider.h" #endif
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus # error This header can only be compiled as C++. #endif #ifndef __INCLUDED_PROTOCOL_H__ #define __INCLUDED_PROTOCOL_H__ #include "serialize.h" #include "netbase.h" #include <string> #include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { return testnet ? 33813 : 47716; } extern unsigned char pchMessageStart[4]; /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); ) // TODO: make private (improves encapsulation) public: enum { MESSAGE_START_SIZE=sizeof(::pchMessageStart), COMMAND_SIZE=12, MESSAGE_SIZE_SIZE=sizeof(int), CHECKSUM_SIZE=sizeof(int), MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE, CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE, HEADER_SIZE=MESSAGE_START_SIZE+COMMAND_SIZE+MESSAGE_SIZE_SIZE+CHECKSUM_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), NODE_BLOOM = (1 << 1), }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK); void Init(); IMPLEMENT_SERIALIZE ( CAddress* pthis = const_cast<CAddress*>(this); CService* pip = (CService*)pthis; if (fRead) pthis->Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*pip); ) void print() const; // TODO: make private (improves encapsulation) public: uint64 nServices; // disk and network only unsigned int nTime; // memory only int64 nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); IMPLEMENT_SERIALIZE ( READWRITE(type); READWRITE(hash); ) friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; void print() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; enum { MSG_TX = 1, MSG_BLOCK, // Nodes may always request a MSG_FILTERED_BLOCK in a getdata, however, // MSG_FILTERED_BLOCK should not appear in any invs except as a part of getdata. MSG_FILTERED_BLOCK, }; #endif // __INCLUDED_PROTOCOL_H__
#ifndef __REC_UTIL_THREAD_CALLBACK0__ #define __REC_UTIL_THREAD_CALLBACK0__ #include "rec/util/thread/Callback.h" namespace rec { namespace util { namespace thread { namespace callback { template <typename Type, typename Method> class Callback0 : public Callback { public: Callback0(Type* o, Method m) : object_(o), method_(m) {} virtual bool operator()() { (object_->*method_)(); return true; } private: Type* object_; Method method_; DISALLOW_COPY_ASSIGN_EMPTY_AND_LEAKS(Callback0); }; } // namespace callback } // namespace thread } // namespace util } // namespace rec #endif // __REC_UTIL_THREAD_CALLBACK0__
/*** * Inferno Engine v4 2015-2017 * Written by Tomasz "Rex Dex" Jonarski * * [# filter: driver\transient #] ***/ #pragma once #include "base/containers/include/inplaceArray.h" #include "rendering/driver/include/renderingTransientBuffer.h" #include "rendering/driver/include/renderingImageView.h" #include "rendering/driver/include/renderingConstantsView.h" #include "glObjectResolver.h" #include "glTransientBufferAllocator.h" #include "glImage.h" namespace plugin { namespace gl4 { class Image; class TransientAllocator; class TransientFrame; class TransientFrameBuilder; ///-- /// a frame with all allocated transient objects class TransientFrame : public base::NoCopy { public: ~TransientFrame(); //--- // resolve a view of the constant buffer ResolvedBufferView resolveConstants(const rendering::ConstantsView& constantsView) const; /// resolve a view to the buffer /// NOTE: buffer must have been previously reported to the builder ResolvedBufferView resolveUntypedBufferView(const rendering::BufferView& view, const rendering::BufferType bufferType) const; /// resolve a typed view to the buffer /// NOTE: buffer must have been previously reported to the builder ResolvedFormatedView resolveTypedBufferView(const rendering::BufferView& view, const rendering::BufferType bufferType, const rendering::ImageFormat format) const; /// resolve the staging area ResolvedBufferView resolveStagingArea(const Uint32 stagingOffset, const Uint32 size) const; private: TransientFrame(); //-- // the transient buffers TransientBuffer* m_constantsBuffer; TransientBuffer* m_stagingBuffer; // we hold on to it until we are done TransientBuffer* m_vertexBuffer; TransientBuffer* m_indexBuffer; TransientBuffer* m_storageBuffer; struct BufferView { ResolvedBufferView m_untypedView; TransientBuffer* m_bufferPtr; FORCEINLINE BufferView() : m_bufferPtr(nullptr) {} }; // placed transient buffers typedef base::THashMap<Uint64, BufferView> TBufferMap; TBufferMap m_resolvedTransientBuffers; friend class TransientAllocator; friend class TransientFrameBuilder; }; //--- ///--- /// builder of the transient frame class TransientFrameBuilder : public base::NoCopy { public: TransientFrameBuilder(); /// report a constants block of data void reportConstantsBlockSize(const Uint32 size); /// write data void reportConstData(const Uint32 offset, const Uint32 size, const void* dataPtr, Uint32& outOffsetInBigBuffer); /// report a buffer, with or without data void reportBuffer(const rendering::TransientBuffer& buffer, const void* initalData, const Uint32 initialUploadSize); /// report a buffer update, returns the source offset in the staging buffer void reportBufferUpdate(const void* updateData, const Uint32 updateSize, Uint32& outStagingOffset); //-- private: Uint32 m_requiredConstantsBuffer; Uint32 m_requiredStagingBuffer; Uint32 m_requiredVertexBuffer; Uint32 m_requiredIndexBuffer; Uint32 m_requiredStorageBuffer; Uint32 m_constantsDataOffsetInStaging; struct Write { Uint32 m_offset; Uint32 m_size; const void* m_data; }; struct Copy { rendering::BufferType m_targetType; Uint32 m_sourceOffset; Uint32 m_targetOffset; Uint32 m_size; }; struct Mapping { rendering::ObjectID m_id; rendering::BufferType m_type; Uint32 m_offset; Uint32 m_size; }; base::InplaceArray<Write, 1024> m_writes; base::InplaceArray<Copy, 1024> m_copies; base::InplaceArray<Mapping, 1024> m_mapping; Uint32 allocStagingData(const Uint32 size); friend class TransientAllocator; }; //--- /// allocator of transient objects /// can free all related transient objects once the frame was submitted class TransientAllocator : public base::NoCopy { public: TransientAllocator(Driver* drv); ~TransientAllocator(); // frees all allocated objects // allocate a frame TransientFrame* buildFrame(const TransientFrameBuilder& info); private: Driver* m_driver; // pools for different types of buffers TransientBufferAllocator* m_constantBufferPool; TransientBufferAllocator* m_stagingBufferPool; TransientBufferAllocator* m_vertexBufferPool; TransientBufferAllocator* m_indexBufferPool; TransientBufferAllocator* m_storageBufferPool; }; } // gl4 } // driver
// Copyright (c) 2011-2015 The KoreCore developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SENDCOINSENTRY_H #define BITCOIN_QT_SENDCOINSENTRY_H #include "walletmodel.h" #include <QStackedWidget> class WalletModel; class PlatformStyle; namespace Ui { class SendCoinsEntry; } /** * A single entry in the dialog for sending kores. * Stacked widget, with different UIs for payment requests * with a strong payee identity. */ class SendCoinsEntry : public QStackedWidget { Q_OBJECT public: explicit SendCoinsEntry(const PlatformStyle *platformStyle, QWidget *parent = 0); ~SendCoinsEntry(); void setModel(WalletModel *model); bool validate(); SendCoinsRecipient getValue(); /** Return whether the entry is still empty and unedited */ bool isClear(); void setValue(const SendCoinsRecipient &value); void setAddress(const QString &address); /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases * (issue https://bugreports.qt-project.org/browse/QTBUG-10907). */ QWidget *setupTabChain(QWidget *prev); void setFocus(); public Q_SLOTS: void clear(); Q_SIGNALS: void removeEntry(SendCoinsEntry *entry); void payAmountChanged(); void subtractFeeFromAmountChanged(); private Q_SLOTS: void deleteClicked(); void on_payTo_textChanged(const QString &address); void on_addressBookButton_clicked(); void on_pasteButton_clicked(); void updateDisplayUnit(); void payAmountChange(); private: SendCoinsRecipient recipient; Ui::SendCoinsEntry *ui; WalletModel *model; const PlatformStyle *platformStyle; bool updateLabel(const QString &address); }; #endif // BITCOIN_QT_SENDCOINSENTRY_H
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2011-2012 Litecoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_INIT_H #define BITCOIN_INIT_H #include "wallet.h" extern CWallet* pwalletMain; void StartShutdown(); void* Shutdown(void* parg); bool AppInit2(); std::string HelpMessage(); #endif
/************************************************************************/ /* CLASS : BossFirst Author : ±è¿¬¿ì ¿ªÇÒ : ù¹øÂ° º¸½º class ÃÖÁ¾ ¼öÁ¤ÀÏÀÚ : 2014-12-19 ÃÖÁ¾ ¼öÁ¤ÀÚ : ÃÖÁ¾ ¼öÁ¤»çÀ¯ : Comment : ºù±Ûºù±Û µ¹¾Æ°¡¸ç ÃãÀ»Ãä½Ã´Ù. */ /************************************************************************/ #pragma once #include "BaseComponent.h" #include "Util.h" #define RAIL_RADIUS 360 #define ROTATE_ANGLE 10.f #define ROTATE_DURATION 0.25f #define MAX_ROTATE_NUM 20 #define MIN_ROTATE_NUM 5 class BossHead; class SpriteComponent; class BossFirst : public BaseComponent { public: virtual bool init(); virtual void update(float dTime); virtual void enter(); virtual void exit(); virtual void dead(); void enterMove(); void exitMove(cocos2d::Node* ref); CREATE_FUNC(BossFirst); private: SpriteComponent* m_Rail = nullptr; int m_RotateNum = -1; cocos2d::RotateBy* m_RotateModule = nullptr; BossHead* m_Head = nullptr; bool m_IsEntranceBGMEnd = false; };
// // JHDanmakuProtocol.h // Pods // // Created by JimHuang on 2020/2/3. // #import "JHDanmakuDefinition.h" #ifndef JHDanmakuProtocol_h #define JHDanmakuProtocol_h @class JHDanmakuEngine, JHDanmakuContainer, JHDanmakuContext; @protocol JHDanmakuProtocol <NSObject> typedef NS_ENUM(NSUInteger, JHDanmakuEffectStyle) { JHDanmakuEffectStyleUndefine = 0, //啥也没有 JHDanmakuEffectStyleNone = 100, //描边 JHDanmakuEffectStyleStroke, //投影 JHDanmakuEffectStyleShadow, //模糊阴影 JHDanmakuEffectStyleGlow, }; @property (assign, nonatomic) NSTimeInterval appearTime; @property (assign, nonatomic) NSTimeInterval disappearTime; @property (strong, nonatomic) NSAttributedString *attributedString; //当前所在轨道 @property (assign, nonatomic) NSInteger currentChannel; /// 是否处于激活状态 /// @param time 当前时间 /// @param context 附加信息 - (BOOL)isActiveWithTime:(NSTimeInterval)time context:(JHDanmakuContext *)context; /// 计算初始位置 /// @param context 附加信息 - (CGPoint)originalPositonWithContext:(JHDanmakuContext *)context; @end #endif /* JHDanmakuProtocol_h */
#pragma once #include <functional> #include <map> #include <queue> namespace MX { #ifdef _DEBUG template <class T, typename T2, typename T3> class reservable_priority_queue : public std::priority_queue<T, T2, T3> { public: typedef typename std::priority_queue<T>::size_type size_type; reservable_priority_queue(size_type capacity = 0) { reserve(capacity); }; void reserve(size_type capacity) { this->c.reserve(capacity); } size_type capacity() const { return this->c.capacity(); } void clear() { this->c.clear(); } }; #endif template <typename NodeType> class DijkstraPathFinding { public: using DistanceType = float; using NeighborCallback = std::function<void(const NodeType& node, DistanceType distance)>; //using GetNeighborsFunc = std::function<void(const NodeType& node, const NeighborCallback& callback)>; //using SetDistanceIfLowerFunc = std::function<bool(const NodeType& node, DistanceType distance)>; using QueuePair = std::pair<DistanceType, NodeType>; #ifdef _DEBUG using PriorityQueue = reservable_priority_queue<QueuePair, std::vector<QueuePair>, std::greater<QueuePair>>; #else using PriorityQueue = std::priority_queue<QueuePair, std::vector<QueuePair>, std::greater<QueuePair>>; #endif template <typename GetNeighborsType, typename SetDistanceIfLowerType> DijkstraPathFinding(const std::vector<NodeType>& startNodes, GetNeighborsType&& getNeighbors, SetDistanceIfLowerType&& setDistanceIfLower) { PriorityQueue queue; #ifdef _DEBUG queue.clear(); queue.reserve(100); #endif DistanceType startDistance = 0.0f; for (auto& start : startNodes) { queue.push(std::make_pair(startDistance, start)); setDistanceIfLower(start, startDistance); } PathFind(queue, getNeighbors, setDistanceIfLower); } template <typename GetNeighborsType, typename SetDistanceIfLowerType> DijkstraPathFinding(const NodeType& start, GetNeighborsType&& getNeighbors, SetDistanceIfLowerType&& setDistanceIfLower) { PriorityQueue queue; #ifdef _DEBUG queue.clear(); queue.reserve(100); #endif DistanceType startDistance = 0.0f; queue.push(std::make_pair(startDistance, start)); setDistanceIfLower(start, startDistance); PathFind(queue, getNeighbors, setDistanceIfLower); } DijkstraPathFinding(DijkstraPathFinding&& other) = default; protected: template <typename GetNeighborsType, typename SetDistanceIfLowerType> void PathFind(PriorityQueue& queue, GetNeighborsType&& getNeighbors, SetDistanceIfLowerType&& setDistanceIfLower) { while (!queue.empty()) { auto p = queue.top(); queue.pop(); DistanceType current = p.first; auto forN = [&](const NodeType& node, DistanceType distance) { auto newDistance = current + distance; if (!setDistanceIfLower(node, newDistance)) return; queue.push(std::make_pair(newDistance, node)); }; getNeighbors(current, p.second, forN); } } }; template <typename NodeType> class DefaultDijkstraPathFinding { public: using DijkstraPath = DijkstraPathFinding<NodeType>; using DistanceType = typename DijkstraPath::DistanceType; //using NeighborCallback = typename DijkstraPath::NeighborCallback; using MapType = std::map<NodeType, DistanceType>; template <typename GetNeighborsFunc> DefaultDijkstraPathFinding(const NodeType& start, GetNeighborsFunc&& getNeighbors) { auto setDistanceIfLower = CreateCallback(); DijkstraPath Dijkstra(start, getNeighbors, setDistanceIfLower); } template <typename GetNeighborsFunc> DefaultDijkstraPathFinding(const std::vector<NodeType>& start, GetNeighborsFunc&& getNeighbors) { auto setDistanceIfLower = CreateCallback(); DijkstraPath Dijkstra(start, getNeighbors, setDistanceIfLower); } const auto& distances() const { return _distances; } protected: auto CreateCallback() { return [&](const NodeType& node, DistanceType distance) -> bool { auto r = _distances.insert(std::make_pair(node, distance)); if (r.second) return true; auto& old_pair = *(r.first); if (old_pair.second <= distance) return false; old_pair.second = distance; return true; }; } MapType _distances; }; }
#include <errno.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <stdio.h> typedef struct Node * pNode; typedef struct Queue * pQueue; typedef struct ElementType { int num; }ElementType; typedef struct Node { ElementType element; pNode next; }Node; typedef struct Queue { pNode front; pNode rear; }Queue; int queueCreate ( pQueue pQue ); int queueIsEmpty ( pQueue pQue ); int queueEnter ( pQueue pQue,ElementType newElement ); int queueDelete ( pQueue pQue,ElementType * delElement ); int queueGetLen ( pQueue pQue ); int queueClear ( pQueue pQue ); pNode getHead ( pQueue pQue ); int queueWalk ( pQueue pQue,int (*walkWay)(ElementType ele) ); int printElement ( ElementType ele ); int main() { return 0; } int queueCreate ( pQueue pQue ) { pQue->front=pQue->rear=(pNode)malloc(sizeof(Node)); pQue->rear->next=NULL; return 0; } /* ----- end of function queueCreate ----- */ int queueClear ( pQueue pQue ) { ElementType tmpCell; while(pQue->front!=pQue->rear) { queueDelete(pQue,&tmpCell); } return 0; } /* ----- end of function queueClear ----- */ int queueIsEmpty ( pQueue pQue ) { return pQue->front==pQue->rear; } /* ----- end of function queueIsEmpty ----- */ int queueGetLen ( pQueue pQue ) { int n=0; pNode start=pQue->front->next; while(start!=NULL) { n++; start=start->next; } return n; } /* ----- end of function queueLength ----- */ pNode getHead ( pQueue pQue ) { return pQue->front; } /* ----- end of function getHead ----- */ int queueEnter ( pQueue pQue,ElementType newElement ) { pNode pTmpCell; pTmpCell=(pNode)malloc(sizeof(Node)); pTmpCell->element=newElement; pTmpCell->next=NULL; pQue->rear->next=pTmpCell; pQue->rear=pTmpCell; return 0; } /* ----- end of function queueAdd ----- */ int queueDelete ( pQueue pQue,ElementType * delElement ) { if(queueIsEmpty(pQue)) { return 1; } pNode pTmpCell; pTmpCell=pQue->front->next; pQue->front->next=pTmpCell->next; if(pQue->rear==pTmpCell) { pQue->rear=pQue->front; } *delElement=pTmpCell->element; free(pTmpCell); return 0; } /* ----- end of function queueDelete ----- */ int queueWalk ( pQueue pQue,int (*walkWay)(ElementType ele) ) { if(queueIsEmpty(pQue)) { return 1; } pNode start=pQue->front->next; while(start!=NULL) { (*walkWay)(start->element); start=start->next; } return 0; } /* ----- end of function queueWalk ----- */ int printElement ( ElementType ele ) { printf("%d\n",ele.num); return 0; } /* ----- end of function printElement ----- */
// // main.c // MasteringAlgorithms // Illustrates using a heap (see Chapter 10). // // Created by YourtionGuo on 05/05/2017. // Copyright © 2017 Yourtion. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include "heap.h" static void print_heap(Heap *heap) { int i; /// 打印堆结构 fprintf(stdout, "-> Heap size is %d\n", heap_size(heap)); for (i = 0; i < heap_size(heap); i++) { fprintf(stdout, "--> Node=%03d\n", *(int *)heap->tree[i]); } return; } static int compare_int(const void *int1, const void *int2) { /// 比较两个整数 if (*(const int *)int1 > *(const int *)int2) return 1; if (*(const int *)int1 < *(const int *)int2) return -1; return 0; } int main(int argc, char **argv) { Heap heap; void *data; int intval[30], i; /// 初始化堆 heap_init(&heap, compare_int, NULL); /// 执行堆操作 i = 0; intval[i] = 5; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 10; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 20; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 1; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 25; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 22; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; intval[i] = 9; fprintf(stdout, "Inserting %03d\n", intval[i]); if (heap_insert(&heap, &intval[i]) != 0) return 1; print_heap(&heap); i++; while (heap_size(&heap) > 0) { if (heap_extract(&heap, (void **)&data) != 0) return 1; fprintf(stdout, "Extracting %03d\n", *(int *)data); print_heap(&heap); } /// 销毁堆 fprintf(stdout, "Destroying the heap\n"); heap_destroy(&heap); return 0; }
// // AppDelegate.h // RACDemo // // Created by Eli on 15/12/21. // Copyright © 2015年 Ely. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_console_execlp_52b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-52b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * Sink: execlp * BadSink : execute command with wexeclp * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"ls" #define COMMAND_ARG2 L"-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <process.h> #define EXECLP _wexeclp #else /* NOT _WIN32 */ #define EXECLP execlp #endif /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__wchar_t_console_execlp_52c_badSink(wchar_t * data); void CWE78_OS_Command_Injection__wchar_t_console_execlp_52b_badSink(wchar_t * data) { CWE78_OS_Command_Injection__wchar_t_console_execlp_52c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE78_OS_Command_Injection__wchar_t_console_execlp_52c_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__wchar_t_console_execlp_52b_goodG2BSink(wchar_t * data) { CWE78_OS_Command_Injection__wchar_t_console_execlp_52c_goodG2BSink(data); } #endif /* OMITGOOD */
// // CDSyncRecord.h // TO-DO // // Created by Siegrain on 16/6/4. // Copyright © 2016年 com.siegrain. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @class CDUser; @class LCSyncRecord; NS_ASSUME_NONNULL_BEGIN @interface CDSyncRecord : NSManagedObject /** * 将LCSyncRecord实体转换为CDSyncRecord实体 */ + (instancetype)syncRecordFromLCSyncRecord:(LCSyncRecord*)lcSyncRecord inContext:(NSManagedObjectContext*)context; @end NS_ASSUME_NONNULL_END #import "CDSyncRecord+CoreDataProperties.h"
#include "ray.h" /** getint **/ int getint(FILE *fp, int *result) { char buf[256]; int code; while ((code=fscanf(fp, "%d", result)) != 1) { if (fgets(buf, sizeof(buf), fp) == NULL) { return(-1); } if (buf[0] != '#') { fprintf(stderr, "getint[%d]: Error in input: \"%s\"\n", code, buf); return(0); } } return(1); } /** getdouble **/ int getdouble(FILE *fp, double *result) { char buf[256]; int code; while ((code=fscanf(fp, "%lf", result)) != 1) { if (fgets(buf, sizeof(buf), fp) == NULL) { return(-1); } if (buf[0] != '#') { fprintf(stderr, "getdouble[%d]: Error in input: \"%s\"\n", code, buf); return(0); } } return(1); } /**tl_gettriple3 **/ /* Gets a triple from a specified file */ int gettriple(FILE *fp, triple_t *triple) { int x = 0; assert(x = getdouble(fp, &triple->x)==1); assert(x = getdouble(fp, &triple->y)==1); assert(x = getdouble(fp, &triple->z)==1); return x; }
// // QFPushTool.h // runtime基础 // // Created by 赵大红 on 16/5/8. // Copyright © 2016年 赵大红. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface QFPushTool : NSObject + (void)push:(NSDictionary *)dic; @end
// // HBSRootNavigationController.h // FetchedTableViewController // // Created by Anokhov Pavel on 28.02.16. // Copyright © 2016 Pavel Anokhov. All rights reserved. // #import <UIKit/UIKit.h> #import "HBSDataController.h" @interface HBSRootNavigationController : UINavigationController <HBSDataControllerUser> - (void)setDataController:(HBSDataController *)dataController; @end
// // NSDictionary+VZUtil.h // VZKit // // Created by VonZen on 2017/8/4. // #import <Foundation/Foundation.h> @interface NSDictionary (VZUtil) + (instancetype)dictionaryInURL:(NSString *)url; + (instancetype)dictionaryFromJsonString:(NSString *)JSONString; @end
// // PubNubTesting.h // Pods // // Created by Jordan Zucker on 5/16/16. // // #ifndef PubNubTesting_h #define PubNubTesting_h // Constants #import "PNTTestConstants.h" // Utilities #import "XCTestCase+PNTAdditions.h" #import "NSString+PNTAdditions.h" // Matchers #import "PNTDeviceIndependentMatcher.h" // Test Representations #import "PNTTestResult.h" #import "PNTTestStatus.h" #import "PNTTestErrorStatus.h" #import "PNTTestAcknowledgmentStatus.h" #import "PNTTestChannelGroupChannelsResult.h" #import "PNTTestChannelGroupsResult.h" #import "PNTTestHistoryResult.h" #import "PNTTestPublishStatus.h" #import "PNTTestTimeResult.h" #import "PNTTestSubscribeStatus.h" #import "PNTTestSubscriberResults.h" // Categories #import "XCTestCase+PNTChannelGroup.h" #import "XCTestCase+PNTClientState.h" #import "XCTestCase+PNTHistory.h" #import "XCTestCase+PNTPublish.h" #import "XCTestCase+PNTSizeOfMessage.h" #import "XCTestCase+PNTSubscription.h" // TestCase Subclasses #import "PNTClientTestCase.h" #import "PNTSubscribeLoopTestCase.h" #endif /* PubNubTesting_h */
// // FLMotivatorVideo.h // Fuel // // Created by Timothy Chong on 2/9/14. // Copyright (c) 2014 Fuel. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import "FLMotivator.h" @interface FLMotivatorVideo : FLMotivator @property (nonatomic, retain) NSString * path; @end
/******************************************************************************\ * gloperate * * Copyright (C) 2014 Computer Graphics Systems Group at the * Hasso-Plattner-Institut (HPI), Potsdam, Germany. \******************************************************************************/ // Restore warnings #ifdef __GNUC__ #pragma GCC diagnostic pop #endif
#include <windows.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> /* This file creates the local getbuildinfo.c file, by invoking subwcrev.exe (if found). This replaces tokens int the file with information about the build. If this isn't a subversion checkout, or subwcrev isn't found, it copies ..\\Modules\\getbuildinfo.c instead. Currently, subwcrev.exe is found from the registry entries of TortoiseSVN. make_buildinfo.exe is called as a pre-build step for pythoncore. */ int make_buildinfo2() { struct _stat st; HKEY hTortoise; char command[500]; DWORD type, size; if (_stat("..\\.svn", &st) < 0) return 0; /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */ if (_stat("no_subwcrev", &st) == 0) return 0; if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS && RegOpenKey(HKEY_CURRENT_USER, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS) /* Tortoise not installed */ return 0; command[0] = '"'; /* quote the path to the executable */ size = sizeof(command) - 1; if (RegQueryValueEx(hTortoise, "Directory", 0, &type, command+1, &size) != ERROR_SUCCESS || type != REG_SZ) /* Registry corrupted */ return 0; strcat_s(command, sizeof(command), "bin\\subwcrev.exe"); if (_stat(command+1, &st) < 0) /* subwcrev.exe not part of the release */ return 0; strcat_s(command, sizeof(command), "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo.c"); puts(command); fflush(stdout); if (system(command) < 0) return 0; return 1; } int main(int argc, char*argv[]) { char command[500] = ""; int svn; /* Get getbuildinfo.c from svn as getbuildinfo2.c */ svn = make_buildinfo2(); if (svn) { puts("subcwrev succeeded, generated getbuildinfo.c"); } else { puts("Couldn't run subwcrev.exe on getbuildinfo.c. Copying it"); strcat_s(command, sizeof(command), "copy /Y ..\\Modules\\getbuildinfo.c getbuildinfo.c"); puts(command); fflush(stdout); if (system(command) < 0) return EXIT_FAILURE; } return 0; }
// // AFBNewAddressModel.h // LoveFreshBeeSuper // // Created by drfgh on 16/11/24. // Copyright © 2016年 gao2015. All rights reserved. // #import <Foundation/Foundation.h> @interface AFBNewAddressModel : NSObject //联系人 @property (nonatomic,copy) NSString *name; //手机号码 @property (nonatomic,copy) NSString *phone; //所在城市 @property (nonatomic,copy) NSString *city; //所在地区 @property (nonatomic,copy) NSString *area; //详细地址 @property (nonatomic,copy) NSString *address; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "WXPBGeneratedMessage.h" @interface SKBuiltinUint16_t : WXPBGeneratedMessage { } + (void)initialize; // Remaining properties @property(nonatomic) unsigned int uiVal; // @dynamic uiVal; @end
/* The MIT License Copyright (c) 2008 jacob berkman <jacob@ilovegom.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GOM_DOM_H #define GOM_DOM_H #include <glib/gmacros.h> G_BEGIN_DECLS typedef struct _GomDOM GomDOM; typedef struct _GomDOMClass GomDOMClass; G_END_DECLS #include <glib-object.h> G_BEGIN_DECLS #define GOM_TYPE_DOM (gom_dom_get_type ()) #define GOM_DOM(i) (G_TYPE_CHECK_INSTANCE_CAST ((i), GOM_TYPE_DOM, GomDOM)) #define GOM_DOM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOM_TYPE_DOM, GomDOMClass)) #define GOM_IS_DOM(i) (G_TYPE_CHECK_INSTANCE_TYPE ((i), GOM_TYPE_DOM)) #define GOM_IS_DOM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOM_TYPE_DOM)) #define GOM_DOM_GET_CLASS(i) (G_TYPE_INSTANCE_GET_CLASS ((i), GOM_TYPE_DOM, GomDOMClass)) struct _GomDOM { GObject parent; }; struct _GomDOMClass { GObjectClass parent_class; }; GType gom_dom_get_type (void); G_END_DECLS #endif /* GOM_DOM_H */
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double Pods_ThoughtlessVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_ThoughtlessVersionString[];
// // GroupInstancesModel.h // ARIS // // Created by Phil Dougherty on 2/13/13. // // #import <Foundation/Foundation.h> #import "ARISModel.h" #import "Item.h" #import "Instance.h" @interface GroupInstancesModel : ARISModel { long currentWeight; } @property(nonatomic, assign) long currentWeight; - (void) touchGroupInstances; - (NSArray *) groupOwnedInstances; - (long) takeItemFromGroup:(long)item_id qtyToRemove:(long)qty; - (long) giveItemToGroup:(long)item_id qtyToAdd:(long)qty; - (long) setItemsForGroup:(long)item_id qtyToSet:(long)qty; - (long) qtyOwnedForItem:(long)item_id; - (long) qtyOwnedForTag:(long)tag_id; - (long) qtyAllowedToGiveForItem:(long)item_id; @end
// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s // Check that, just because we emitted a function from a different file doesn't // mean we insert a file-change inside the next function. // CHECK: ret void, !dbg [[F1_LINE:![0-9]*]] // CHECK: ret void, !dbg [[F2_LINE:![0-9]*]] // CHECK: [[F1:![0-9]*]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [f1] // CHECK: [[F2:![0-9]*]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [f2] // CHECK: [[F1_LINE]] = !MDLocation({{.*}}, scope: [[F1]]) // CHECK: [[F2_LINE]] = !MDLocation({{.*}}, scope: [[F2]]) void f1() { } # 2 "foo.c" void f2() { }
/* brushlib - The MyPaint Brush Library (demonstration project) * Copyright (C) 2013 POINTCARRE SARL / Sebastien Leon email: sleon at pointcarre.com * * Permission to use, copy, modify, and/or 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. */ #ifndef TILE_H #define TILE_H #include <QGraphicsItem> #include <QImage> #include <QPainter> #include <stdint.h> //------------------------------------------------------------------------- // This basic class store a tile info & display it. the ushort table is the // real info modified by libMyPaint. Before any screen refresh, we transfer // it to a QImage acting as a cache. this QImage is only necessary to paint. // NOTE that the uint16_t data (premul RGB 15 bits) is transfered in premul // format. This is only useful if you plan to have several layers. // if it is not the case, you could simply convert to RGBA (not premul) #define CONV_16_8(x) ((x*255)/(1<<15)) #define CONV_8_16(x) ((x*(1<<15))/255) class MPTile : public QGraphicsItem { public: MPTile (QGraphicsItem * parent = NULL); ~MPTile(); enum { k_tile_dim = 64 }; enum { k_red = 0, k_green = 1, k_blue = 2, k_alpha =3 }; // Index to access RGBA values in myPaint QImage image(); virtual QRectF boundingRect () const; // virtual bool contains (const QPointF & point) const; virtual QPainterPath shape () const; virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); uint16_t* Bits (bool readOnly); void drawPoint ( uint x, uint y, uint16_t r, uint16_t g, uint16_t b, uint16_t a ); void updateCache(); void clear(); void setImage(const QImage &image); private: uint16_t t_pixels [k_tile_dim][k_tile_dim][4]; QImage m_cache_img; bool m_cache_valid; }; #endif // TILE_H
#include "rust.h" int main () { // as you can see we can call this function as // if it was a C function rust_print("hehe"); return 0; }
// // TBScrollDirectionDetector.h // iOSToolbelt // // Created by Ben Ford on 6/6/14. // Copyright (c) 2014 Ben Ford. 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 <UIKit/UIKit.h> typedef NS_ENUM(NSUInteger, TBScrollDirection) { TBScrollDirectionNone = 0, TBScrollDirectionUp = 1 << 0, TBScrollDirectionDown = 1 << 1, TBScrollDirectionLeft = 1 << 2, TBScrollDirectionRight = 1 << 3, }; @class TBScrollDirectionDetector; @protocol TBScrollDirectionDetectorDelegate <NSObject> - (void)detector:(TBScrollDirectionDetector *)detector didScrollInDirections:(NSUInteger)directions; @end @interface TBScrollDirectionDetector : NSObject @property (nonatomic, weak) id<TBScrollDirectionDetectorDelegate> delegate; @property (nonatomic, assign) CGFloat sensitivityDistance; @property (nonatomic, assign) CGPoint minimumDetectOffset; /** Be sure to hook these two methods to the scrollview delegate */ - (void)scrollViewDidScroll:(UIScrollView *)scrollView; - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; /** Resets partially detected scroll-distance. Has no effect if sensitivity is zero. */ - (void)reset; + (BOOL)matchScrollDirection:(TBScrollDirection)direction inMask:(NSUInteger)mask; @end
/* Copyright (c) 2013-2014, The Linux Foundation. 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 Linux Foundation 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, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT 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. */ #include <debug.h> #include <reg.h> #include <platform/iomap.h> #include <qgic.h> #include <qtimer.h> #include <platform/clock.h> #include <mmu.h> #include <arch/arm/mmu.h> #include <smem.h> #include <board.h> #define MB (1024*1024) #define MSM_IOMAP_SIZE ((MSM_IOMAP_END - MSM_IOMAP_BASE)/MB) /* LK memory - cacheable, write through */ #define LK_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \ MMU_MEMORY_AP_READ_WRITE) /* Peripherals - non-shared device */ #define IOMAP_MEMORY (MMU_MEMORY_TYPE_DEVICE_SHARED | \ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN) /* IMEM memory - cacheable, write through */ #define IMEM_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN) static mmu_section_t mmu_section_table[] = { /* Physical addr, Virtual addr, Size (in MB), Flags */ { MEMBASE, MEMBASE, (MEMSIZE / MB), LK_MEMORY}, { MSM_IOMAP_BASE, MSM_IOMAP_BASE, MSM_IOMAP_SIZE, IOMAP_MEMORY}, { SYSTEM_IMEM_BASE, SYSTEM_IMEM_BASE, 1, IMEM_MEMORY}, }; void platform_early_init(void) { board_init(); platform_clock_init(); qgic_init(); qtimer_init(); } void platform_init(void) { dprintf(INFO, "platform_init()\n"); #if ENABLE_XPU_VIOLATION scm_xpu_err_fatal_init(); #endif } void platform_uninit(void) { #if DISPLAY_SPLASH_SCREEN display_shutdown(); #endif qtimer_uninit(); } int platform_use_identity_mmu_mappings(void) { /* Use only the mappings specified in this file. */ return 0; } /* Setup memory for this platform */ void platform_init_mmu_mappings(void) { uint32_t i; uint32_t sections; ram_partition ptn_entry; uint32_t table_size = ARRAY_SIZE(mmu_section_table); uint32_t len = 0; ASSERT(smem_ram_ptable_init_v1()); len = smem_get_ram_ptable_len(); /* Configure the MMU page entries for SDRAM and IMEM memory read from the smem ram table*/ for(i = 0; i < len; i++) { smem_get_ram_ptable_entry(&ptn_entry, i); if(ptn_entry.type == SYS_MEMORY) { if((ptn_entry.category == SDRAM) || (ptn_entry.category == IMEM)) { /* Check to ensure that start address is 1MB aligned */ ASSERT((ptn_entry.start & (MB-1)) == 0); sections = (ptn_entry.size) / MB; while(sections--) { arm_mmu_map_section(ptn_entry.start + sections * MB, ptn_entry.start + sections * MB, (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)); } } } } /* Configure the MMU page entries for memory read from the mmu_section_table */ for (i = 0; i < table_size; i++) { sections = mmu_section_table[i].num_of_sections; while (sections--) { arm_mmu_map_section(mmu_section_table[i].paddress + sections * MB, mmu_section_table[i].vaddress + sections * MB, mmu_section_table[i].flags); } } } addr_t platform_get_virt_to_phys_mapping(addr_t virt_addr) { /* Using 1-1 mapping on this platform. */ return virt_addr; } addr_t platform_get_phys_to_virt_mapping(addr_t phys_addr) { /* Using 1-1 mapping on this platform. */ return phys_addr; } uint32_t platform_get_sclk_count(void) { return readl(MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL); } addr_t get_bs_info_addr() { return ((addr_t)BS_INFO_ADDR); }
// Copyright (c) 2016 Intel Corporation. All rights reserved. // Use of this source code is governed by a MIT-style license that can be // found in the LICENSE file. #ifndef _OCCUPANCY_TILE_H_ #define _OCCUPANCY_TILE_H_ #include <node.h> #include <v8.h> #include <string> #include "gen/array_helper.h" #include "gen/generator_helper.h" class OccupancyTile { public: OccupancyTile(); OccupancyTile(const OccupancyTile& rhs); ~OccupancyTile(); OccupancyTile& operator = (const OccupancyTile& rhs); public: int32_t get_x() const { return this->x_; } int32_t get_y() const { return this->y_; } int32_t get_occupancy() const { return this->occupancy_; } void SetJavaScriptThis(v8::Local<v8::Object> obj) { // Ignore this if you don't need it // Typical usage: emit an event on `obj` } private: int32_t x_; int32_t y_; int32_t occupancy_; }; #endif // _OCCUPANCY_TILE_H_
#include <netinet/in.h> #include <stdio.h> #include <string.h> #include <poll.h> #include <unistd.h> #include <arpa/inet.h> #define MAXLINE 1024 #define IPADDRESS "127.0.0.1" #define SERV_PORT 8787 static void handle_connection(int sockfd); int main(int argc, char *argv[]) { int sockfd; struct sockaddr_in servaddr; sockfd = socket(AF_INET, SOCK_STREAM, 0); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(SERV_PORT); inet_pton(AF_INET, IPADDRESS, &servaddr.sin_addr); connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); //处理连接描述符 handle_connection(sockfd); return 0; } static void handle_connection(int sockfd) { char sendline[MAXLINE], recvline[MAXLINE]; struct pollfd pfds[2]; int n; //添加连接描述符 pfds[0].fd = sockfd; pfds[0].events = POLLIN; //添加标准输入描述符 pfds[1].fd = STDIN_FILENO; pfds[1].events = POLLIN; for (;;) { poll(pfds, 2, -1); if (pfds[0].revents & POLLIN) { n = read(sockfd, recvline, MAXLINE); if (n == 0) { fprintf(stderr, "client: server is closed.\n"); close(sockfd); } write(STDOUT_FILENO, recvline, n); } //测试标准输入是否准备好 if (pfds[1].revents & POLLIN) { n = read(STDIN_FILENO, sendline, MAXLINE); if (n == 0) { shutdown(sockfd, SHUT_WR); continue; } write(sockfd, sendline, n); } } }
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double BXProgressHUDVersionNumber; FOUNDATION_EXPORT const unsigned char BXProgressHUDVersionString[];
// Copyright 2010 Google Inc. All Rights Reserved. // Author: rays@google.com (Ray Smith) /////////////////////////////////////////////////////////////////////// // File: intfeaturespace.h // Description: Indexed feature space based on INT_FEATURE_STRUCT. // Created: Wed Mar 24 10:55:30 PDT 2010 // // 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 TESSERACT_CLASSIFY_INTFEATURESPACE_H__ #define TESSERACT_CLASSIFY_INTFEATURESPACE_H__ #include BOSS_TESSERACT_U_genericvector_h //original-code:"genericvector.h" #include BOSS_TESSERACT_U_intproto_h //original-code:"intproto.h" // Extent of x,y,theta in the input feature space. [0,255]. const int kIntFeatureExtent = 256; // Extent of x,y,theta dimensions in the quantized feature space. const int kBoostXYBuckets = 16; const int kBoostDirBuckets = 16; namespace tesseract { class IndexMap; // Down-sampling quantization of the INT_FEATURE_STRUCT feature space and // conversion to a single scalar index value, used as a binary feature space. class TESS_API IntFeatureSpace { public: IntFeatureSpace(); // Default copy constructors and assignment OK! // Setup the feature space with the given dimensions. void Init(uinT8 xbuckets, uinT8 ybuckets, uinT8 thetabuckets); // Serializes the feature space definition to the given file. // Returns false on error. bool Serialize(FILE* fp) const; // DeSerializes the feature space definition from the given file. // If swap is true, the data is big/little-endian swapped. // Returns false on error. bool DeSerialize(bool swap, FILE* fp); // Returns the total size of the feature space. int Size() const { return static_cast<int>(x_buckets_) * y_buckets_ * theta_buckets_; } // Returns an INT_FEATURE_STRUCT corresponding to the given index. // This is the inverse of the Index member. INT_FEATURE_STRUCT PositionFromIndex(int index) const; // Returns a 1-dimensional index corresponding to the given feature value. // Range is [0, Size()-1]. Inverse of PositionFromIndex member. int Index(const INT_FEATURE_STRUCT& f) const { return (XBucket(f.X) * y_buckets_ + YBucket(f.Y)) * theta_buckets_ + ThetaBucket(f.Theta); } // Bulk calls to Index. Maps the given array of features to a vector of // inT32 indices in the same order as the input. void IndexFeatures(const INT_FEATURE_STRUCT* features, int num_features, GenericVector<int>* mapped_features) const; // Bulk calls to Index. Maps the given array of features to a vector of // sorted inT32 indices. void IndexAndSortFeatures(const INT_FEATURE_STRUCT* features, int num_features, GenericVector<int>* sorted_features) const; // Returns a feature space index for the given x,y position in a display // window, or -1 if the feature is a miss. int XYToFeatureIndex(int x, int y) const; protected: // Converters to generate indices for individual feature dimensions. int XBucket(int x) const { int bucket = x * x_buckets_ / kIntFeatureExtent; return ClipToRange(bucket, 0, static_cast<int>(x_buckets_) - 1); } int YBucket(int y) const { int bucket = y * y_buckets_ / kIntFeatureExtent; return ClipToRange(bucket, 0, static_cast<int>(y_buckets_) - 1); } // Use DivRounded for theta so that exactly vertical and horizontal are in // the middle of a bucket. The Modulo takes care of the wrap-around. int ThetaBucket(int theta) const { int bucket = DivRounded(theta * theta_buckets_, kIntFeatureExtent); return Modulo(bucket, theta_buckets_); } // Returns an INT_FEATURE_STRUCT corresponding to the given buckets. INT_FEATURE_STRUCT PositionFromBuckets(int x, int y, int theta) const; // Feature space definition - serialized. uinT8 x_buckets_; uinT8 y_buckets_; uinT8 theta_buckets_; }; } // namespace tesseract. #endif // TESSERACT_CLASSIFY_INTFEATURESPACE_H__
// // CJATabBarController.h // CJADataSource // // Created by Bogdan Iusco on 7/1/14. // Copyright (c) 2014 Carl Jahn. All rights reserved. // @import UIKit; @interface CJATabBarController : UITabBarController @end
#include "socket.h" #include <string.h> int muggle_socket_lib_init() { #if MUGGLE_PLATFORM_WINDOWS WSADATA wsaData; return WSAStartup(MAKEWORD(2, 2), &wsaData); #else return 0; #endif } muggle_socket_t muggle_socket_create(int family, int type, int protocol) { return socket(family, type, protocol); } int muggle_socket_close(muggle_socket_t fd) { #if MUGGLE_PLATFORM_WINDOWS return closesocket(fd); #else return close(fd); #endif } int muggle_socket_shutdown(muggle_socket_t fd, int how) { return shutdown(fd, how); } int muggle_socket_strerror(int errnum, char *buf, size_t bufsize) { #if MUGGLE_PLATFORM_WINDOWS DWORD ret = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, errnum, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), buf, (DWORD)bufsize, 0); return ret > 0 ? 0 : -1; #else return strerror_r(errnum, buf, bufsize); #endif } int muggle_socket_set_nonblock(muggle_socket_t socket, int on) { #if MUGGLE_PLATFORM_WINDOWS u_long iMode = (u_long)on; // If iMode = 0, blocking is enabled; // If iMode != 0, non-blocking mode is enabled. return ioctlsocket(socket, FIONBIO, &iMode); #else int flags = 0; flags = fcntl(socket, F_GETFL, 0); if (on) { flags |= O_NONBLOCK; } else { flags &= ~O_NONBLOCK; } return fcntl(socket, F_SETFL, flags); #endif }
#pragma once /* ·Î±×¿¡ ´ëÇØ È­¸é°ú ÆÄÀÏÀúÀå ÆÄÀÏ´ç ¿ë·®Àº ÃÖ´ë 10MB -> ³Ñ¾î°¡¸é ÆÄÀÏ¸í¿¡ %N% Áõ°¡ log Æú´õ¿¡ ÃÖ´ë ¿ë·®Àº 100MB -> ³Ñ¾î°¡¸é LRU·Î »èÁ¦ */ #include <boost/log/trivial.hpp> class LogSetting { public: LogSetting() : max_storage_size_(1024 * 1024 * 100) // 100MB , max_file_size_(1024 * 1024 * 10) // 10MB , file_ordering_window_sec_(1) , is_print_screen_(true) , is_save_text_file_(true) { } // ÇØ´ç Æú´õ ÃÖ´ë ÀúÀå Å©±â int max_storage_size_; // ·Î±× ÆÄÀϺ° ÃÖ´ë Å©±â int max_file_size_; // È­¸é Ãâ·Â ¿©ºÎ bool is_print_screen_; // ÆÄÀÏ ÀúÀå ¿©ºÎ bool is_save_text_file_; // ¸ÖƼ½º·¹µå ±â¹Ý ÆÄÀÏ ÀúÀå½Ã ¼ø¼­ º¸Á¤À» À§ÇÑ À©µµ¿ì Å©±â(ÃÊ´ÜÀ§) int file_ordering_window_sec_; }; class CLog { public: CLog(LogSetting& setting); ~CLog(void); private: void global_attribute(); void add_console_sink(); void add_vs_debug_output_sink(); void add_text_file_sink(); // ¼ø¼­ ¹Ìº¸Àå CPU »ç¿ë·ü ³·À½ void add_text_file_sink_unorder(); private: LogSetting setting_; };
#import <Foundation/Foundation.h> #import "BBValidator.h" @interface BBValidatorComposite : BBValidator { @private NSMutableArray *_validators; } @property (strong, nonatomic) NSMutableArray *validators; - (id)initWithValidators:(NSArray *)validators; - (void)addValidator:(id<BBValidatorProtocol>)validator; - (void)addValidatorsFromArray:(NSArray *)validators; @end
/** * Copyright (c) 2021 Darius Rückert * Licensed under the MIT License. * See LICENSE file for more information. */ #pragma once #include "saiga/opengl/assets/asset.h" #include "saiga/opengl/texture/Texture.h" namespace Saiga { class SAIGA_OPENGL_API ColoredAsset : public BasicAsset< MVPColorShader> { public: static constexpr const char* shaderStr = "asset/ColoredAsset.glsl"; void loadDefaultShaders(); ColoredAsset() { loadDefaultShaders(); } ColoredAsset(const UnifiedModel& model); ColoredAsset(const UnifiedMesh& model); virtual ~ColoredAsset() {} }; class SAIGA_OPENGL_API LineVertexColoredAsset : public BasicAsset<MVPColorShader> { public: enum RenderFlags { NONE = 0, CULL_WITH_NORMAL = 1 << 1 }; // Default shaders // If you want to use your own load them and override the shader memebers in BasicAsset. static constexpr const char* shaderStr = "asset/LineVertexColoredAsset.glsl"; void loadDefaultShaders(); void SetShaderColor(const vec4& color); void SetRenderFlags(RenderFlags flags = NONE); LineVertexColoredAsset() { loadDefaultShaders(); } LineVertexColoredAsset(const UnifiedMesh& model); virtual ~LineVertexColoredAsset() {} }; class SAIGA_OPENGL_API TexturedAsset : public BasicAsset< MVPTextureShader> { public: // Default shaders // If you want to use your own load them and override the shader memebers in BasicAsset. static constexpr const char* shaderStr = "asset/texturedAsset.glsl"; void loadDefaultShaders() override; std::vector<UnifiedMaterial> materials; std::vector<std::shared_ptr<Texture>> textures; std::map<std::string, int> texture_name_to_id; TexturedAsset() { loadDefaultShaders(); } TexturedAsset(const UnifiedModel& model); virtual ~TexturedAsset() {} virtual void render(Camera* cam, const mat4& model) override; virtual void renderForward(Camera* cam, const mat4& model) override; virtual void renderDepth(Camera* cam, const mat4& model) override; void RenderNoShaderBind(MVPTextureShader* shader); protected: void renderGroups(std::shared_ptr<MVPTextureShader> shader, Camera* cam, const mat4& model); }; } // namespace Saiga
// Copyright (c) 2009 DotNetAnywhere // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "libIGraph.h" #include "DrawLines.h" #include "Pixels.h" static void DrawLine_All(tGraphics *pGraphics, tPen *pPen, I32 x1, I32 y1, I32 x2, I32 y2) { I32 dx = x2-x1; I32 dy = y2-y1; I32 overflow, absDx = ABS(dx), absDy = ABS(dy); I32 x, y, inc; U32 col = pPen->col; if (pPen->width <= 1.0f) { // If pen size is 1 (or less) then use the fast algorithm for line drawing. // Note that this still supports colour transparency. if (absDx > absDy) { // Scan along x-axis if (dx < 0) { SWAP_I32(x1, x2); SWAP_I32(y1, y2); } y = y1; inc = (y2>y1)?1:-1; overflow = absDx >> 1; for (x=x1; x<=x2; x++) { mSetPixel(pGraphics, x, y, col); overflow += absDy; if (overflow >= absDx) { overflow -= absDx; y += inc; } } } else { // Scan along y-axis if (dy < 0) { SWAP_I32(x1, x2); SWAP_I32(y1, y2); } x = x1; inc = (x2>x1)?1:-1; overflow = absDy >> 1; for (y=y1; y<=y2; y++) { mSetPixel(pGraphics, x, y, col); overflow += absDx; if (overflow >= absDy) { overflow -= absDy; x += inc; } } } } else { // Use the 'fill-the-poly' algorithm for line drawing of thick lines. } } tDrawLine mDrawLine_[FMT_NUM] = { DrawLine_All, DrawLine_All };
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "CDStructures.h" #import <IDEKit/IDEViewController.h> @class NSPopUpButton; @interface IDEGeneralPrefsPaneController : IDEViewController { NSPopUpButton *_issueNavigatorDetailPopUpButton; NSPopUpButton *_searchNavigatorDetailPopUpButton; } @property(retain) NSPopUpButton *searchNavigatorDetailPopUpButton; // @synthesize searchNavigatorDetailPopUpButton=_searchNavigatorDetailPopUpButton; @property(retain) NSPopUpButton *issueNavigatorDetailPopUpButton; // @synthesize issueNavigatorDetailPopUpButton=_issueNavigatorDetailPopUpButton; - (void)resetDialogWarnings:(id)arg1; - (id)dialogWarningsExtensionPoint; - (void)setShouldActivateNewTabsAndWindows:(BOOL)arg1; - (BOOL)shouldActivateNewTabsAndWindows; - (void)setIssueNavigatorDetailPopUpLevel:(unsigned long long)arg1; - (unsigned long long)issueNavigatorDetailPopUpLevel; - (void)setSearchNavigatorDetailPopUpLevel:(unsigned long long)arg1; - (unsigned long long)searchNavigatorDetailPopUpLevel; - (void)loadView; - (id)_itemWithTitle:(id)arg1 tag:(long long)arg2; - (id)_menuForNavigatorDetailLevel; @end
// Rashmi Sehgal June 2016 // gfunc.h // gfunc header file // outlines black box gui functions #ifndef GFUNC_H #define GFUNC_H #include <assert.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <set> #include "qattr.h" // returnable project root extern qaTree* proj_root; // find_attr // input: project root, category name, attribute ID // output: node associated with attribute of choice qaNode* find_attr(qaTree* proj, string cat, string attr); // isEmpty // input: project or category name // output: whether it is empty or not bool isEmpty(qaTree* root); // create_proj // input: string representing project title // output: returns now usable project root qaTree* create_proj(string s); // add (distinction between categories must be incorporated) // adds a new attribute to the category of choice // input: project root, category name, attribute info // output: void; node added to correct branch of tree // edit: output string to attain ID post-addition string add_attr(qaTree* proj, string cat, string src, string stim, string env, string afct, string rsp, string rspm); // rem_attr // input: project root, string representing desired // category, string representing ID of desired attribute // output: void; removes designated attribute from the project tree void rem_attr(qaTree* proj, string categ, string attr_ID); //rem_cat //input: project root, string representing desired category //output: void; removes specified category from the project tree void rem_cat(qaTree* proj, string categ); // dump_project // input: desired file, project root // output: file containing full printed project details // file created according to designated specifications from // FILE* void dump_project(FILE* outfile, qaTree* proj); // rem_project // input: project root // output: void; removes all attributes, categories from // project tree. sets project root to null. void rem_project(qaTree* root); #endif //gfunc.h
/*************************************************************************/ /* joints_2d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* 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 JOINTS_2D_H #define JOINTS_2D_H #include "node_2d.h" class Joint2D : public Node2D { OBJ_TYPE(Joint2D, Node2D); RID joint; NodePath a; NodePath b; real_t bias; bool exclude_from_collision; protected: void _update_joint(); void _notification(int p_what); virtual RID _configure_joint() = 0; static void _bind_methods(); public: void set_node_a(const NodePath &p_node_a); NodePath get_node_a() const; void set_node_b(const NodePath &p_node_b); NodePath get_node_b() const; void set_bias(real_t p_bias); real_t get_bias() const; void set_exclude_nodes_from_collision(bool p_enable); bool get_exclude_nodes_from_collision() const; RID get_joint() const { return joint; } Joint2D(); }; class PinJoint2D : public Joint2D { OBJ_TYPE(PinJoint2D, Joint2D); real_t softness; protected: void _notification(int p_what); virtual RID _configure_joint(); static void _bind_methods(); public: void set_softness(real_t p_stiffness); real_t get_softness() const; PinJoint2D(); }; class GrooveJoint2D : public Joint2D { OBJ_TYPE(GrooveJoint2D, Joint2D); real_t length; real_t initial_offset; protected: void _notification(int p_what); virtual RID _configure_joint(); static void _bind_methods(); public: void set_length(real_t p_length); real_t get_length() const; void set_initial_offset(real_t p_initial_offset); real_t get_initial_offset() const; GrooveJoint2D(); }; class DampedSpringJoint2D : public Joint2D { OBJ_TYPE(DampedSpringJoint2D, Joint2D); real_t stiffness; real_t damping; real_t rest_length; real_t length; protected: void _notification(int p_what); virtual RID _configure_joint(); static void _bind_methods(); public: void set_length(real_t p_length); real_t get_length() const; void set_rest_length(real_t p_rest_length); real_t get_rest_length() const; void set_damping(real_t p_damping); real_t get_damping() const; void set_stiffness(real_t p_stiffness); real_t get_stiffness() const; DampedSpringJoint2D(); }; #endif // JOINTS_2D_H
/* * sys-clock.c * * Copyright(c) 2007-2022 Jianjun Jiang <8192542@qq.com> * Official site: http://xboot.org * Mobile phone: +86-18665388956 * QQ: 8192542 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #include <xboot.h> #include <f1c500s/reg-ccu.h> static inline void sdelay(int loops) { __asm__ __volatile__ ("1:\n" "subs %0, %1, #1\n" "bne 1b":"=r" (loops):"0"(loops)); } static void wait_pll_stable(u32_t base) { u32_t rval = 0; u32_t time = 0xfff; do { rval = read32(base); time--; } while(time && !(rval & (1 << 28))); } static void clock_set_pll_cpu(u32_t clk) { u32_t n, k, m, p; u32_t rval = 0; u32_t div = 0; if(clk > 720000000) clk = 720000000; if((clk % 24000000) == 0) { div = clk / 24000000; n = div - 1; k = 0; m = 0; p = 0; } else if((clk % 12000000) == 0) { m = 1; div = clk / 12000000; if((div % 3) == 0) k = 2; else if((div % 4) == 0) k = 3; else k = 1; n = (div / (k + 1)) - 1; p = 0; } else { div = clk / 24000000; n = div - 1; k = 0; m = 0; p = 0; } rval = read32(F1C500S_CCU_BASE + CCU_PLL_CPU_CTRL); rval &= ~((0x3 << 16) | (0x1f << 8) | (0x3 << 4) | (0x3 << 0)); rval |= (1U << 31) | (p << 16) | (n << 8) | (k << 4) | m; write32(F1C500S_CCU_BASE + CCU_PLL_CPU_CTRL, rval); wait_pll_stable(F1C500S_CCU_BASE + CCU_PLL_CPU_CTRL); } void sys_clock_init(void) { u32_t val; write32(F1C500S_CCU_BASE + CCU_PLL_STABLE_TIME0, 0x1ff); write32(F1C500S_CCU_BASE + CCU_PLL_STABLE_TIME1, 0x1ff); val = read32(F1C500S_CCU_BASE + CCU_CPU_CFG); val &= ~(0x3 << 16); val |= (0x1 << 16); write32(F1C500S_CCU_BASE + CCU_CPU_CFG, val); sdelay(100); write32(F1C500S_CCU_BASE + CCU_PLL_VIDEO_CTRL, 0x81003e03); sdelay(100); write32(F1C500S_CCU_BASE + CCU_PLL_PERIPH_CTRL, 0x80041800); sdelay(100); write32(F1C500S_CCU_BASE + CCU_AHB_APB_CFG, 0x00003180); sdelay(100); val = read32(F1C500S_CCU_BASE + CCU_DRAM_CLK_GATE); val |= (0x1 << 26) | (0x1 << 24) | (0x1 << 3) | (0x1 << 2) | (0x1 << 1) | (0x1 << 0); write32(F1C500S_CCU_BASE + CCU_DRAM_CLK_GATE, val); sdelay(100); clock_set_pll_cpu(408000000); val = read32(F1C500S_CCU_BASE + CCU_CPU_CFG); val &= ~(0x3 << 16); val |= (0x2 << 16); write32(F1C500S_CCU_BASE + CCU_CPU_CFG, val); sdelay(100); }
#pragma once #include "serializabledataunit.h" namespace Engine { namespace Serialize { #define SERIALIZABLEUNIT_MEMBERS() \ READONLY_PROPERTY(Synced, isSynced) struct META_EXPORT SerializableUnitBase : SerializableDataUnit { protected: SerializableUnitBase(); SerializableUnitBase(const SerializableUnitBase &other); SerializableUnitBase(SerializableUnitBase &&other) noexcept; ~SerializableUnitBase(); SerializableUnitBase &operator=(const SerializableUnitBase &other); SerializableUnitBase &operator=(SerializableUnitBase &&other); public: bool isSynced() const; protected: friend struct SyncableBase; friend struct SerializableUnitPtr; friend struct SerializableUnitConstPtr; friend struct TopLevelUnitBase; friend struct SerializeTable; template <typename> friend struct Serializable; friend struct SyncableUnitBase; friend struct SyncManager; private: const TopLevelUnitBase *mTopLevel = nullptr; uint8_t mActiveIndex = 0; bool mSynced = false; }; } // namespace Serialize } // namespace Core
#pragma once class AActor; class UParticleSystem; class UParticleSystemComponent; class TempActorManager { public: static void Initialise(); static void Tick(float DeltaTime); static void Shutdown(); static void AddActor(AActor* Actor, float Duration); static UParticleSystemComponent* AddParticle(AActor* Actor, UParticleSystem* Particles, FVector Position, FRotator Orientation, float Duration); protected: struct ActorData { ActorData(AActor* actor, float duration) : Actor(actor), Duration(duration) {} bool operator== (const ActorData& RHS) const { return Actor == RHS.Actor; } AActor* Actor; float Duration; }; static TArray< ActorData > ActorDataArray; };
#include <map> #include <stack> #include <set> #include <vector> #include <algorithm> #include <string> #include <stdlib.h> #include <fstream> using namespace std; struct Node { /* Node struct for our k-NN Graph */ int index; int rank; Node * parent; set <Node * > children; Node(int idx) { index = idx; rank = 0; parent = NULL; children.clear(); } }; struct Graph { /* k-NN graph struct. Allows us to build the graph one node at a time */ vector <Node *> nodes; map <int, Node * > M; set <Node * > intersecting_sets; Graph() { M.clear(); intersecting_sets.clear(); nodes.clear(); } Node * get_root(Node * node) { if (node->parent != NULL) { node->parent->children.erase(node); node->parent = get_root(node->parent); node->parent->children.insert(node); return node->parent; } else { return node; } } void add_node(int idx) { nodes.push_back(new Node(idx)); M[idx] = nodes[nodes.size() - 1]; } void add_edge(int n1, int n2) { Node * r1 = get_root(M[n1]); Node * r2 = get_root(M[n2]); if (r1 != r2) { if (r1->rank > r2->rank) { r2->parent = r1; r1->children.insert(r2); if (intersecting_sets.count(r2)) { intersecting_sets.erase(r2); intersecting_sets.insert(r1); } } else { r1->parent = r2; r2->children.insert(r1); if (intersecting_sets.count(r1)) { intersecting_sets.erase(r1); intersecting_sets.insert(r2); } if (r1->rank == r2->rank) { r2->rank++; } } } } vector <int> get_connected_component(int n) { Node * r = get_root(M[n]); vector <int> L; stack <Node * > s; s.push(r); while (!s.empty()) { Node * top = s.top(); s.pop(); L.push_back(top->index); for (set<Node * >::iterator it = top->children.begin(); it != top->children.end(); ++it) { s.push(*it); } } return L; } bool component_seen(int n) { Node * r = get_root(M[n]); if (intersecting_sets.count(r)) { return true; } intersecting_sets.insert(r); return false; } int GET_ROOT(int idx) { Node * r = get_root(M[idx]); return r->index; } vector <int> GET_CHILDREN(int idx) { Node * r = M[idx]; vector <int> to_ret; for (set<Node *>::iterator it = r->children.begin(); it != r->children.end(); ++it) { to_ret.push_back((*it)->index); } return to_ret; } }; void compute_mutual_knn(int n, int k, double * densities, int * neighbors, double beta, double epsilon, int * result) { /* Given the kNN density and neighbors We build the k-NN graph / cluster tree and return the estimated modes. Note that here, we don't require the dimension of the dataset Returns array of estimated mode membership, where each index cosrresponds the respective index in the density array. Points without membership are assigned -1 */ vector<pair <double, int> > knn_densities(n); vector <set <int> > knn_neighbors(n); /*freopen("debug_notes", "w", stdout); printf("Neighbors"); for (int i = 0; i < n; i++) { for (int j = 0; j < k; ++j) { printf("%d ", neighbors[i * k + j]); } printf("\n"); } printf("densities"); for (int i = 0; i < n; i++) { printf("%f\n", densities[i]); } fclose(stdout);*/ for (int i = 0; i < n; ++i) { knn_densities[i].first = densities[i]; knn_densities[i].second = i; for (int j = 0; j < k; ++j) { knn_neighbors[i].insert(neighbors[i * k + j]); } } int m_hat[n]; int cluster_membership[n]; int n_chosen_points = 0; int n_chosen_clusters = 0; sort(knn_densities.begin(), knn_densities.end()); reverse(knn_densities.begin(), knn_densities.end()); Graph G = Graph(); int last_considered = 0; int last_pruned = 0; for (int i = 0; i < n; ++i) { while (last_pruned < n && knn_densities[last_pruned].first > knn_densities[i].first / (1. + epsilon)) { G.add_node(knn_densities[last_pruned].second); for (set <int>::iterator it = knn_neighbors[knn_densities[last_pruned].second].begin(); it != knn_neighbors[knn_densities[last_pruned].second].end(); ++it) { if (G.M.count(*it)) { if (knn_neighbors[*it].count(knn_densities[last_pruned].second)) { G.add_edge(knn_densities[last_pruned].second, *it); } } } last_pruned++; } while (knn_densities[last_considered].first - knn_densities[i].first > beta * knn_densities[last_considered].first) { if (!G.component_seen(knn_densities[last_considered].second)) { vector <int> res = G.get_connected_component(knn_densities[last_considered].second); for (int j = 0; j < res.size(); j++) { if (densities[res[j]] >= knn_densities[i].first) { cluster_membership[n_chosen_points] = n_chosen_clusters; m_hat[n_chosen_points++] = res[j]; } } n_chosen_clusters++; } last_considered++; } } for (int i = 0; i < n; ++i) { result[i] = -1; } for (int i = 0; i < n_chosen_points; ++i) { result[m_hat[i]] = cluster_membership[i]; } }
#ifndef PITCH_ROLL_LIMITER_H #define PITCH_ROLL_LIMITER_H // Must install GLPK before this will work #include <glpk.h> // Needed to get the number of iterations #include "GLPK_Headers/prob.h" class PitchRollLimiter { protected: // Optimization Problem object glp_prob *lp; // Keeps track of whether or not it's in standard form bool is_std_form; // Coefficient values double Bp; double Kp; double Lq; // Simplex solver values bool useSimplex; glp_smcp parm_sim; // simplex settings int max_result_sim; // holds result of simplex optimization int min_result_sim; // Interior Point solver values bool useIntPnt; glp_iptcp parm_int; // interior point settings int max_result_int; // holds results of int. pnt. optimization int min_result_int; // Results values double yawMax; double yawMin; bool validMax; bool validMin; int maxIters; int minIters; public: PitchRollLimiter(); ~PitchRollLimiter(); void makeModel(double Bp, double Kp, double Lq); void makeModelStd(double Bp, double Kp, double Lq); // mostly just used for testing purposes void inputUpdate(double Uq[]); void useSimplexPrimal(); // works the fastest void useSimplexDual(); void useIntPntNatural(); void useIntPntQuotient(); void useIntPntApprox(); void useIntPntSYMAMD(); void findMax(); void findMin(); bool isValidMax(); bool isValidMin(); double getMax(); double getMin(); int getMaxIters(); int getMinIters(); int getMaxStatus(); int getMinStatus(); }; #endif
/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ #pragma once #include <mutex> class SipStack; namespace doubango_rt { namespace BackEnd { ref class rtSipCallback; interface class rtISipCallback; ref class rtDDebugCallback; interface class rtIDDebugCallback; enum class rt_tdav_codec_id_t; public ref class rtDnsResult sealed { internal: rtDnsResult(uint16 port, Platform::String^ address):_port(port), _address(address){} public: property uint16 Port{ uint16 get() { return _port; }; } property Platform::String^ Address{ Platform::String^ get() { return _address; }; } private: uint16 _port; Platform::String^ _address; }; public ref class rtSipStack sealed { public: virtual ~rtSipStack(); internal: rtSipStack(rtISipCallback^ callback, Platform::String^ realmUri, Platform::String^ impiString, Platform::String^ impuUri); const SipStack* getWrappedStack() { return m_pSipStack; } public: bool start(); bool setDebugCallback(rtIDDebugCallback^ pCallback); bool setDisplayName(Platform::String^ display_name); bool setRealm(Platform::String^ realm_uri); bool setIMPI(Platform::String^ impi); bool setIMPU(Platform::String^ impu_uri); bool setPassword(Platform::String^ password); bool setAMF(Platform::String^ amf); bool setOperatorId(Platform::String^ opid); bool setProxyCSCF(Platform::String^ fqdn, unsigned short port, Platform::String^ transport, Platform::String^ ipversion); bool setLocalIP(Platform::String^ ip, Platform::String^ transport); bool setLocalIP(Platform::String^ ip); bool setLocalPort(unsigned short port, Platform::String^ transport); bool setLocalPort(unsigned short port); bool setEarlyIMS(bool enabled); bool addHeader(Platform::String^ name, Platform::String^ value); bool removeHeader(Platform::String^ name); bool addDnsServer(Platform::String^ ip); bool setDnsDiscovery(bool enabled); bool setAoR(Platform::String^ ip, int port); bool setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict); bool addSigCompCompartment(Platform::String^ compId); bool removeSigCompCompartment(Platform::String^ compId); bool setSTUNServer(Platform::String^ ip, unsigned short port); bool setSTUNCred(Platform::String^ login, Platform::String^ password); bool setTLSSecAgree(bool enabled); bool setSSLCertificates(Platform::String^ privKey, Platform::String^ pubKey, Platform::String^ caKey, bool verify); bool setSSLCertificates(Platform::String^ privKey, Platform::String^ pubKey, Platform::String^ caKey); bool setIPSecSecAgree(bool enabled); bool setIPSecParameters(Platform::String^ algo, Platform::String^ ealgo, Platform::String^ mode, Platform::String^ proto); Platform::String^ dnsENUM(Platform::String^ service, Platform::String^ e164num, Platform::String^ domain); #if COM_VISIBLE rtDnsResult^ dnsNaptrSrv(Platform::String^ domain, Platform::String^ service); rtDnsResult^ dnsSrv(Platform::String^ service); Platform::String^ getLocalIP(Platform::String^ protocol); uint16 getLocalPort(Platform::String^ protocol); #else Platform::String^ dnsNaptrSrv(Platform::String^ domain, Platform::String^ service, Platform::IntPtr port); Platform::String^ dnsSrv(Platform::String^ service, Platform::IntPtr port); Platform::String^ getLocalIPnPort(Platform::String^ protocol, Platform::IntPtr port); #endif Platform::String^ getPreferredIdentity(); bool isValid(); bool stop(); static bool initialize(); static bool deInitialize(); static void setCodecs(enum class rt_tdav_codec_id_t codecs); static bool setCodecPriority(enum class rt_tdav_codec_id_t codec_id, int priority); static bool isCodecSupported(enum class rt_tdav_codec_id_t codec_id); private: SipStack* m_pSipStack; rtSipCallback^ m_pSipCallback; rtDDebugCallback^ m_pDebugCallback; std::recursive_mutex mLock; }; } }
// // DisplayScreen.h // ColorAtom // // Created by 杨萧玉 on 14-4-19. // Copyright (c) 2014年 杨萧玉. All rights reserved. // #import <SpriteKit/SpriteKit.h> @interface DisplayScreen : SKSpriteNode @property (nonatomic, assign) NSInteger atomCount; @property (nonatomic, assign) NSInteger score; @property (nonatomic, assign) NSInteger rank; @property (nonatomic, assign) NSInteger sharp; @property (nonatomic, strong) SKLabelNode *atomCountLabel; @property (nonatomic, strong) SKLabelNode *scoreLabel; @property (nonatomic, strong) SKLabelNode *rankLabel; @property (nonatomic, strong) SKSpriteNode *atomIcon; @property (nonatomic, strong) SKLabelNode *pauseLabel; - (void)AtomMinusKilled; - (void)AtomPlusUsed:(NSInteger) num; - (void)setPosition; - (void)AtomMinusAttacked; - (instancetype)initWithAtomCount:(NSInteger)count; - (void)pause; - (void)resume; @end
/* * rtmodel.h: * * Code generation for model "rtwdemo_slcustcode". * * Model version : 1.243 * Simulink Coder version : 8.12 (R2017a) 16-Feb-2017 * C source code generated on : Mon Jul 10 18:52:43 2017 * * Target selection: grt.tlc * Note: GRT includes extra infrastructure and instrumentation for prototyping * Embedded hardware selection: Specified * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef RTW_HEADER_rtmodel_h_ #define RTW_HEADER_rtmodel_h_ /* * Includes the appropriate headers when we are using rtModel */ #include "rtwdemo_slcustcode.h" #define GRTINTERFACE 0 /* Macros generated for backwards compatibility */ #ifndef rtmGetStopRequested # define rtmGetStopRequested(rtm) ((void*) 0) #endif #endif /* RTW_HEADER_rtmodel_h_ */
/* * File: CCoef4d.h * Author: lixun * * Created on 2015年3月16日, 上午12:21 */ #ifndef CCOEF4D_H #define CCOEF4D_H #include "CCoef4.h" class CCoef4d : public CCoef4 { public: CCoef4d(); CCoef4d(int Length); virtual ~CCoef4d(); void CoefComp(void); void CoefCompI(void); const double * GetCoefComp(int Quadrant) const; const double * GetCoefCompI(int Quadrant) const; private: double * CoWnHeap1; double * CoWnHeap2; double * CoWnHeap3; double * CoWnHeap1I; double * CoWnHeap2I; double * CoWnHeap3I; CCoef4d(const CCoef4d& orig); void CoefGenHeap(double * CoWnHeap, const long double * Wn); }; #endif /* CCOEF4D_H */
// Copyright (c) 2011-2013 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONRECORD_H #define BITCOIN_QT_TRANSACTIONRECORD_H #include "amount.h" #include "uint256.h" #include "wallet/wallet.h" #include <QList> #include <QString> class CWallet; class CWalletTx; // Addresses need to preserve their txout order for accurate display so implemented as list (instead of map) typedef std::pair<std::string, CScript> Address; typedef std::list<Address> AddressList; /** UI model for transaction status. The transaction status is the part of a transaction that will change over time. */ class TransactionStatus { public: TransactionStatus() : countsForBalance(false), sortKey(""), matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1) { } enum Status { Confirmed, /**< Have 6 or more confirmations (normal tx) or fully mature (mined tx) **/ /// Normal (sent/received) transactions OpenUntilDate, /**< Transaction not yet final, waiting for date */ OpenUntilBlock, /**< Transaction not yet final, waiting for block */ Offline, /**< Not sent to any other nodes **/ Unconfirmed, /**< Not yet mined into a block **/ Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/ Conflicted, /**< Conflicts with other transaction or mempool **/ /// Generated (mined) transactions Immature, /**< Mined but waiting for maturity */ MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */ NotAccepted /**< Mined but not accepted */ }; /// Transaction counts towards available balance bool countsForBalance; /// Sorting key based on status std::string sortKey; /** @name Generated (mined) transactions @{*/ int matures_in; /**@}*/ /** @name Reported status @{*/ Status status; qint64 depth; qint64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined before finalization */ /**@}*/ /** Current number of blocks (to know whether cached status is still valid) */ int cur_num_blocks; }; /** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has multiple outputs. */ class TransactionRecord { public: enum Type { Other, Generated, SendToAddress, SendToOther, RecvWithAddress, RecvFromOther, SendToSelf, PublicLabel }; /** Number of confirmation recommended for accepting a transaction */ static const int RecommendedNumConfirmations = 6; TransactionRecord() : hash(), time(0), type(Other), addresses(), debit(0), credit(0), idx(0) {} TransactionRecord(uint256 _hash, qint64 _time) : hash(_hash), time(_time), type(Other), addresses(), debit(0), credit(0), idx(0) { } TransactionRecord(uint256 _hash, qint64 _time, Type _type, const AddressList &_addresses, const CAmount &_debit, const CAmount &_credit) : hash(_hash), time(_time), type(_type), addresses(_addresses), debit(_debit), credit(_credit), idx(0) { } /** Decompose CWallet transaction to model transaction records. */ static bool showTransaction(const CWalletTx &wtx); static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx); /** @name Immutable transaction attributes @{*/ uint256 hash; qint64 time; Type type; AddressList addresses; CAmount debit; CAmount credit; /**@}*/ /** Subtransaction index, for sort key */ int idx; /** Status: can change with block chain update */ TransactionStatus status; /** Whether the transaction was sent/received with a watch-only address */ bool involvesWatchAddress; /** Return the unique identifier for this transaction (part) */ QString getTxID() const; /** Return the output index of the subtransaction */ int getOutputIndex() const; /** Update status from core wallet tx. */ void updateStatus(const CWalletTx &wtx); /** Return whether a status update is needed. */ bool statusUpdateNeeded(); }; #endif // BITCOIN_QT_TRANSACTIONRECORD_H
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QGraphicsScene> #include <QLabel> #include <QLineEdit> #include <QMainWindow> #include <QPushButton> #include <QSlider> #include <QToolButton> #include "iRoomba.h" #include "mapQGraphicsView.h" #include "uiUtils.h" class FleetManager; class QVBoxLayout; class QTabWidget; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void setCurrentFile(const QString &fileName); // Added asking of saving changes made to map before closing void closeEvent(QCloseEvent *event); // Tracks mouse movements and adds coordinates on map to statusbar bool eventFilter(QObject *object, QEvent *event); // Adds new tab for tabwidget_ for new roomba void addRoombaTab(Croi::IRoomba *roomba); public slots: // Signal indicates that wall or point of interest is added to the map void mapModified(); // Changes the tab corresponding to roomba void setSelectedRoombaTab(); private slots: void setRoombaStatusData(); void pushButton_Connection_clicked(); void pushButton_Clean_clicked(); void pushButton_allMotors_clicked(); void pushButton_playSong_clicked(); void pushButton_tracesDisable_clicked(); void pushButton_resetAngle_clicked(); void toolButton_correctLeft_clicked(); void toolButton_correctRight_clicked(); void toolButton_correctUp_clicked(); void toolButton_correctDown_clicked(); void pushButton_correctCw_clicked(); void pushButton_correctCcw_clicked(); void toolButton_driveForward_clicked(); void toolButton_driveBackward_clicked(); void pushButton_turnCw_clicked(); void pushButton_turnCcw_clicked(); void velocity_horizontalSlider_sliderMoved(int position); void mapScale_horizontalSlider_sliderMoved(int position); void pushButton_Go2POIs_clicked(); void pushButton_fleetManagementEnable_clicked(); void action_Cursor_toggled(bool toggleStatus); void action_Wall_toggled(bool toggleStatus); void action_ATC_toggled(bool toggleStatus); void action_Poi_toggled(bool toggleStatus); void action_Start_toggled(bool toggleStatus); void action_StartVirtual_toggled(bool toggleStatus); void actionSave_triggered(); void actionSaveAs_triggered(); void actionOpen_triggered(); void tabChanged_triggered(int index); void action_About_triggered(); void action_AboutQt_triggered(); void connectionEstablished(); void connectionFailed(); signals: protected: void keyPressEvent(QKeyEvent *event); private: void init(); void saveToFile(QString &fileName); void openFile(const QString &fileName); Ui::MainWindow *ui; FleetManager* fleetManager_; QTimer *updateSensorData_; MapQGraphicsView* map_; void createMenuBar(); void createFleetManagementTab(); void createRoombaDashBoardTab(QString name); void createToolbar(); // Disables or enables UI elements on state change, state is true if changing to connected state void handleUIElementsConnectionStateChange(bool state); // Disables or enables UI elements on state change, state is true if changing to Fleet Management state void handleUIElementsControlModeStateChange(bool state); // Unchecks all manual driving buttons of selectedRoomba_ void handleUIElementsDrivingStateChange(); // Disables or enables UI elements on state change, state is true if changing to connecting state void handleUIElementsChangeAllTabsState(bool state); void stopAllManuallyControlledRoombas(); void resetRoombaStatusInfo(); QVBoxLayout *connect_layout_; QLabel *velocityValue_label_; QLabel *mapScaleValue_label_; QSlider *velocity_horizontalSlider_; QSlider *mapScale_horizontalSlider_; QWidget *connection_Widget_; QWidget *fleetManagement_Widget_; QString currentFile_; bool saveUnsavedChanges(); Croi::IRoomba * selectedRoomba_; QPushButton *fleetManagementEnable_pushButton_; QPushButton *Go2POIs_pushButton_; QPushButton *clean_pushButton_; QTimer *updateRoombaStatusData_; // Toolbar Actions QAction *cursor_action_; QAction *wall_action_; QAction *start_action_; QAction *startVirtual_action_; QTabWidget *tabWidget_; // Includes all tabs QVector<QWidget*> roomba_Widgets_; // Roomba tab contents QMap<int,Croi::IRoomba*> roombaTabs_; // tab index, roomba pointer QMap<Croi::IRoomba*, QLineEdit *>ip1LineEdits_; QMap<Croi::IRoomba*, QLineEdit *>ip2LineEdits_; QMap<Croi::IRoomba*, QLineEdit *>ip3LineEdits_; QMap<Croi::IRoomba*, QLineEdit *>ip4LineEdits_; QMap<Croi::IRoomba*, QPushButton *>connection_pushButtons_; QMap<Croi::IRoomba*, QPushButton *>allMotors_pushButtons_; QMap<Croi::IRoomba*, QPushButton *>playSong_pushButtons_; QMap<Croi::IRoomba*, QToolButton *>driveForward_toolButtons_; QMap<Croi::IRoomba*, QToolButton *>driveBackward_toolButtons_; QMap<Croi::IRoomba*, QPushButton *>turnCw_pushButtons_; QMap<Croi::IRoomba*, QPushButton *>turnCcw_pushButtons_; QMap<Croi::IRoomba*, QPushButton *>resetAngle_pushButtons_; QMap<Croi::IRoomba*, QToolButton *>correctLeft_toolButtons_; QMap<Croi::IRoomba*, QToolButton *>correctRight_toolButtons_; QMap<Croi::IRoomba*, QToolButton *>correctUp_toolButtons_; QMap<Croi::IRoomba*, QToolButton *>correctDown_toolButtons_; QMap<Croi::IRoomba*, QPushButton *>correctCw_pushButtons_; QMap<Croi::IRoomba*, QPushButton *>correctCcw_pushButtons_; QMap<Croi::IRoomba*, QLabel *>rmbPosition_labels_; QMap<Croi::IRoomba*, QLineEdit *>roombaNameLineEdits_; QMap<Croi::IRoomba*, QObject *>roombaStatuses_; }; #endif // MAINWINDOW_H
#ifndef NODETYPE_H #define NODETYPE_H typedef enum __NodeType { UsecaseType = 0x55, ActorType, SubFlowType, AltFlowType, SecFlowType, GeomSquareType = 0x344, GeomRectangleType, GeomCircleType, GeomTriangleType } NodeType; #endif // NODETYPE_H
#include "math2.h" /** * Calculates the base 2 log of \a n. * @param n Number who's base 2 logarithm is calculated. * @return Base 2 logarithm. */ double log2( double n ) { return log( n ) / log( 2 ); } size_t math_bits_in_n( size_t n ) { size_t num_bits = 0; while( ( n >> num_bits ) > 0 ) num_bits += 1; return num_bits; }
// // DirectXPage.xaml.h // Declaration of the DirectXPage class. // #pragma once #include "DirectXPage.g.h" #include "Common\DeviceResources.h" #include "AngleAppMain.h" namespace ReymentaController { /// <summary> /// A page that hosts a DirectX SwapChainPanel. /// </summary> public ref class DirectXPage sealed { public: DirectXPage(); virtual ~DirectXPage(); void SaveInternalState(Windows::Foundation::Collections::IPropertySet^ state); void LoadInternalState(Windows::Foundation::Collections::IPropertySet^ state); private: // XAML low-level rendering event handler. void OnRendering(Platform::Object^ sender, Platform::Object^ args); // Window event handlers. void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); // DisplayInformation event handlers. void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); // Other event handlers. void AppBarButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnCompositionScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel^ sender, Object^ args); void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); // Track our independent input on a background worker thread. Windows::Foundation::IAsyncAction^ m_inputLoopWorker; Windows::UI::Core::CoreIndependentInputSource^ m_coreInput; // Independent input handling functions. void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnKeyPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ e); void OnKeyReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ e); // Resources used to render the DirectX content in the XAML page background. std::shared_ptr<AngleApp::DeviceResources> m_deviceResources; std::unique_ptr<AngleApp::AngleAppMain> m_main; bool m_windowVisible; }; }
#include "Python.h" #define GET_WEAKREFS_LISTPTR(o) \ ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) /*[clinic input] module _weakref [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=ffec73b85846596d]*/ #include "clinic/_weakref.c.h" /*[clinic input] _weakref.getweakrefcount -> Py_ssize_t object: object / Return the number of weak references to 'object'. [clinic start generated code]*/ static Py_ssize_t _weakref_getweakrefcount_impl(PyObject *module, PyObject *object) /*[clinic end generated code: output=301806d59558ff3e input=cedb69711b6a2507]*/ { PyWeakReference **list; if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) return 0; list = GET_WEAKREFS_LISTPTR(object); return _PyWeakref_GetWeakrefCount(*list); } PyDoc_STRVAR(weakref_getweakrefs__doc__, "getweakrefs(object) -- return a list of all weak reference objects\n" "that point to 'object'."); static PyObject * weakref_getweakrefs(PyObject *self, PyObject *object) { PyObject *result = NULL; if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) { PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list); result = PyList_New(count); if (result != NULL) { PyWeakReference *current = *list; Py_ssize_t i; for (i = 0; i < count; ++i) { PyList_SET_ITEM(result, i, (PyObject *) current); Py_INCREF(current); current = current->wr_next; } } } else { result = PyList_New(0); } return result; } PyDoc_STRVAR(weakref_proxy__doc__, "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" "reference to the proxy when 'object' is about to be finalized."); static PyObject * weakref_proxy(PyObject *self, PyObject *args) { PyObject *object; PyObject *callback = NULL; PyObject *result = NULL; if (PyArg_UnpackTuple(args, "proxy", 1, 2, &object, &callback)) { result = PyWeakref_NewProxy(object, callback); } return result; } static PyMethodDef weakref_functions[] = { _WEAKREF_GETWEAKREFCOUNT_METHODDEF {"getweakrefs", weakref_getweakrefs, METH_O, weakref_getweakrefs__doc__}, {"proxy", weakref_proxy, METH_VARARGS, weakref_proxy__doc__}, {NULL, NULL, 0, NULL} }; static struct PyModuleDef weakrefmodule = { PyModuleDef_HEAD_INIT, "_weakref", "Weak-reference support module.", -1, weakref_functions, NULL, NULL, NULL, NULL }; PyMODINIT_FUNC PyInit__weakref(void) { PyObject *m; m = PyModule_Create(&weakrefmodule); if (m != NULL) { Py_INCREF(&_PyWeakref_RefType); PyModule_AddObject(m, "ref", (PyObject *) &_PyWeakref_RefType); Py_INCREF(&_PyWeakref_RefType); PyModule_AddObject(m, "ReferenceType", (PyObject *) &_PyWeakref_RefType); Py_INCREF(&_PyWeakref_ProxyType); PyModule_AddObject(m, "ProxyType", (PyObject *) &_PyWeakref_ProxyType); Py_INCREF(&_PyWeakref_CallableProxyType); PyModule_AddObject(m, "CallableProxyType", (PyObject *) &_PyWeakref_CallableProxyType); } return m; }
#ifndef CREATE_CMD_HANDLERS_H #define CREATE_CMD_HANDLERS_H #include "icmdhandler.h" #include <QString> #include <QMap> void create_cmd_handlers(QMap<QString, ICmdHandler *> &pHandlers); #endif // CREATE_CMD_HANDLERS_H
#include <ruby.h> #include "../compat/ruby.h" #include "extconf.h" #include "crc16_dnp.h" VALUE Digest_CRC16DNP_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_dnp_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_dnp_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16DNP = rb_const_get(mDigest, rb_intern("CRC16DNP")); rb_undef_method(cCRC16DNP, "update"); rb_define_method(cCRC16DNP, "update", Digest_CRC16DNP_update, 1); }
/* 函数: 声明: [返回值类型(默认int)] 函数名([类型名/形式参数],...); // 旧时声明为: [返回值类型(默认int)] 函数名() 定义: [返回值类型(默认int)] 函数名(形式参数,...){ 函数体(语句); } 使用: [变量 =] 函数名(实参...); 类型名语法: 类型名: 说明符限定符表 抽象声明符 opt 抽象声明符: 指针 指针opt 直接抽象声明符 直接抽象声明符: (抽象声明符) 直接抽象声明符opt [ 常量表达式opt ] 直接抽象声明符opt [ 形式参数类型表opt ] e.g: int int * int *[3] int (*)[] int *() int (*[])(void) # ,... 变长参数列表,基于 <stdarg.h>中的宏定义,在第一版C中禁用(这些表示法起源于 C++) # C语言对非指针类型传参默认为传值(相对于传地址) e.g: int *comp(void *, ,,,); // 声明函数comp,接受 通用类型指针,返回 int 指针 参考: <stdarg.h> <setjmp.h> */ // 无名可变参数 #define va_list // 声明变量依次引用各参数 #define va_start(v,l) // 初始化 va_list 的变量指向第一个无名参数 #define va_arg(v,l) // 返回一个参数,并后移指针 #define va_end(v) // 清理 va_list 资源 #define setjmp(jmp_buf env) //将状态信息保存到env void longjmp (jmp_buf, int); //恢复状态
// Copyright (c) 2013 The Polcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef Polcoin_NOUI_H #define Polcoin_NOUI_H extern void noui_connect(); #endif // Polcoin_NOUI_H
/* RawSpeed - RAW file decoder. Copyright (C) 2009-2014 Klaus Post Copyright (C) 2014 Pedro Côrte-Real This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once #include "common/Common.h" // for uint32 #include "common/RawImage.h" // for RawImage #include "decoders/RawDecoder.h" // for RawDecoder #include "io/Buffer.h" // for Buffer #include "tiff/TiffIFD.h" // for TiffRootIFDOwner #include <cmath> // for NAN namespace rawspeed { class CameraMetaData; class MrwDecoder final : public RawDecoder { TiffRootIFDOwner rootIFD; uint32 raw_width = 0; uint32 raw_height = 0; Buffer imageData; uint32 bpp = 0; uint32 packed = 0; float wb_coeffs[4] = {NAN, NAN, NAN, NAN}; public: explicit MrwDecoder(const Buffer* file); RawImage decodeRawInternal() override; void checkSupportInternal(const CameraMetaData* meta) override; void decodeMetaDataInternal(const CameraMetaData* meta) override; static int isMRW(const Buffer* input); protected: int getDecoderVersion() const override { return 0; } void parseHeader(); }; } // namespace rawspeed
// // JTSettingsEditorDelegate.h // JTSettingsKit // // Created by Joris Timmerman on 25/06/14. // Copyright (c) 2014 Joris Timmerman. All rights reserved. // @protocol JTSettingsEditorDelegate<NSObject> @required - (void)settingsEditorViewController:(UIViewController *)viewController selectedValueChangedToValue:(id)value; @end
#pragma once #include "game.h" #include <wchar.h> void OS_Init(); long long OS_GetMsTime(); char* OS_GetFontPath(char* fontName,char* backupFontName); BOOL OS_PathExist(char* path); BOOL OS_UTF8ToANSI_DO(char* utf8Text,wchar_t* destAnsiText,size_t maxLength);
/*** * Inferno Engine v4 2015-2017 * Written by Tomasz "Rex Dex" Jonarski * * [# filter: launcher #] ***/ #pragma once // NOTE: this header must NOT leak into public namespace #ifdef PLATFORM_WINDOWS #include <Windows.h> #endif #ifdef PLATFORM_WINDOWS #ifdef CONSOLE #define LAUNCHER_MAIN() int wmain(int argc, wchar_t **argv) #define LAUNCHER_APP_HANDLE() GetModuleHandle(NULL) #define LAUNCHER_PARSE_CMDLINE() cmdline.parse(GetCommandLineW(), true) #else #define LAUNCHER_MAIN() int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) #define LAUNCHER_APP_HANDLE() hInstance #define LAUNCHER_PARSE_CMDLINE() cmdline.parse(lpCmdLine, false) #endif #else #define LAUNCHER_MAIN() int main(int argc, char **argv) #define LAUNCHER_APP_HANDLE() nullptr #define LAUNCHER_PARSE_CMDLINE() cmdline.parse(argc, argv) #endif
/* RFC - KCommonDialogBox.h Copyright (C) 2013-2019 CrownSoft This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _RFC_KCOMMONDIALOGBOX_H_ #define _RFC_KCOMMONDIALOGBOX_H_ #include "KWindow.h" #include "../text/KString.h" class KCommonDialogBox { public: /** Filter string might be like this "Text Files (*.txt)\0*.txt\0" You cannot use String object for filter, because filter string contains multiple null characters. "dialogGuid" is valid only if "saveLastLocation" is true. */ static bool ShowOpenFileDialog(KWindow *window, const KString& title, const wchar_t* filter, KString *fileName, bool saveLastLocation = false, const wchar_t* dialogGuid = 0); /** Filter string might be like this "Text Files (*.txt)\0*.txt\0" You cannot use String object for filter, because filter string contains multiple null characters. "dialogGuid" is valid only if "saveLastLocation" is true. */ static bool ShowSaveFileDialog(KWindow *window, const KString& title, const wchar_t* filter, KString *fileName, bool saveLastLocation = false, const wchar_t* dialogGuid = 0); }; #endif
// SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2019-2022 Authors of Cilium */ // // @ArthurChiao 202201123: borrowed some code from the Cilium Project #include <linux/bpf.h> // struct __sk_buff #include <linux/pkt_cls.h> // TC_ACT_* #include <linux/ip.h> // struct iphdr #include <linux/tcp.h> // struct tcphdr #include <arpa/inet.h> // ntohs/ntohl, IPPROTO_TCP #ifndef __section # define __section(NAME) \ __attribute__((section(NAME), used)) #endif #ifndef BPF_FUNC #define BPF_FUNC(NAME, ...) \ (*NAME)(__VA_ARGS__) = (void *) BPF_FUNC_##NAME #endif static void BPF_FUNC(trace_printk, const char *fmt, int fmt_size, ...); #ifndef printk # define printk(fmt, ...) \ ({ \ char ____fmt[] = fmt; \ trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ }) #endif #define ETH_HLEN 14 const int l3_off = ETH_HLEN; // IP header offset in raw packet data const int l4_off = l3_off + 20; // TCP header offset: l3_off + IP header const int l7_off = l4_off + 20; // Payload offset: l4_off + TCP header #define DB_POD_IP 0x020011AC // 172.17.0.2 in network order #define FRONTEND_POD_IP 0x030011AC // 172.17.0.3 in network order #define BACKEND_POD1_IP 0x040011AC // 172.17.0.4 in network order #define BACKEND_POD2_IP 0x050011AC // 172.17.0.5 in network order struct policy { // Ingress/inbound policy representation: int src_identity; // traffic from a service with 'identity == src_identity' __u8 proto; // are allowed to access the 'proto:dst_port' of __u8 pad1; // the destination pod. __be16 dst_port; }; struct policy db_ingress_policy_cache[4] = { // Per-pod policy cache, { 10003, IPPROTO_TCP, 0, 6379 }, // We just hardcode one policy here {}, }; static __always_inline int policy_lookup(int src_identity, __u8 proto, __be16 dst_port) { printk("policy_lookup: %d %d %d\n", src_identity, proto, dst_port); struct policy *c = db_ingress_policy_cache; for (int i=0; i<4; i++) { if (c[i].src_identity == src_identity && c[i].proto == proto && c[i].dst_port == dst_port) { return 1; } } return 0; // not found } static __always_inline int ipcache_lookup(__be32 ip) { switch (ip) { case DB_POD_IP: return 10001; case FRONTEND_POD_IP: return 10002; case BACKEND_POD1_IP: return 10003; case BACKEND_POD2_IP: return 10003; default: return -1; } } static __always_inline int __policy_can_access(struct __sk_buff *skb, int src_identity, __u8 proto) { void *data = (void *)(long)skb->data; void *data_end = (void *)(long)skb->data_end; if (proto == IPPROTO_TCP) { if (data_end < data + l7_off) { printk("Invalid TCP packet, drop it, data length: %d\n", data_end - data); return 0; } struct tcphdr *tcp = (struct tcphdr *)(data + l4_off); return policy_lookup(src_identity, proto, ntohs(tcp->dest))? 1 : 0; } return 0; } __section("egress") int tc_egress(struct __sk_buff *skb) { // 1. Basic validation void *data = (void *)(long)skb->data; void *data_end = (void *)(long)skb->data_end; if (data_end < data + l4_off) { // May be system packet, for simplicity just let it go printk("Toy-enforcer: PASS, as not an IP packet, data length: %d\n", data_end - data); return TC_ACT_OK; } // 2. Extract header and map src_ip -> src_identity struct iphdr *ip4 = (struct iphdr *)(data + l3_off); int src_identity = ipcache_lookup(ip4->saddr); if (src_identity < 0) { // packet from a service with unknown identity, just drop it printk("Toy-enforcer: DROP, as src_identity not found from ipcache: %x\n", ip4->saddr); return TC_ACT_SHOT; } // 3. Determine if traffic with src_identity could access this pod if (__policy_can_access(skb, src_identity, ip4->protocol)) { printk("Toy-enforcer: PASS, as policy found\n"); return TC_ACT_OK; } printk("Toy-enforcer: DROP, as policy not found\n"); return TC_ACT_SHOT; } char __license[] __section("license") = "GPL";
/* * License: MIT * * Copyright (c) 2012-2018 James Bensley. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * File: Etherate Test Functions * */ // Calculate the one-way delay from Tx to Rx void delay_test(struct etherate *eth); // Run an MTU sweep test from Tx to Rx void mtu_sweep_test(struct etherate *eth); // Run some quality measurements from Tx to Rx void latency_test(struct etherate *eth); // Tx a custom frame loaded from file void send_custom_frame(struct etherate *eth);
#ifndef SNAKE_SRC_FOOD_H_ #define SNAKE_SRC_FOOD_H_ struct Point; struct Food *food_init(); void food_delete(struct Food *food); void food_set_pos(struct Food *food, struct Point pos); const struct Point *food_get_pos(const struct Food *food); void food_paint(const struct Food *food); #endif // SNAKE_SRC_FOOD_H_
// // JCAppDelegate.h // JCToolKit // // Created by 贾淼 on 12/14/2016. // Copyright (c) 2016 贾淼. All rights reserved. // @import UIKit; @interface JCAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // TDTestScaffold.h // TDTemplateEngineTests // // Created by Todd Ditchendorf on 3/28/14. // Copyright (c) 2014 Todd Ditchendorf. All rights reserved. // #import <Foundation/Foundation.h> #import <XCTest/XCTest.h> #import <PEGKit/PEGKit.h> //#import <OCMock/OCMock.h> #import <TDTemplateEngine/TDTemplateEngine.h> #import <TDTemplateEngine/TDTemplateContext.h> #import "TDTemplateEngine+ExpressionSupport.h" #define TDTrue(e) XCTAssertTrue((e), @"") #define TDFalse(e) XCTAssertFalse((e), @"") #define TDNil(e) XCTAssertNil((e), @"") #define TDNotNil(e) XCTAssertNotNil((e), @"") #define TDEquals(e1, e2) XCTAssertEqual((e1), (e2), @"") #define TDEqualObjects(e1, e2) XCTAssertEqualObjects((e1), (e2), @"") //#define VERIFY() @try { [_mock verify]; } @catch (NSException *ex) { NSString *msg = [ex reason]; XCTAssertTrue(0, @"%@", msg); }
#ifndef MONOTIDE_FONTLIST_H #define MONOTIDE_FONTLIST_H #include <tchar.h> #include <windows.h> #define WC_FONTLIST _T("dejbug.de/FontList") #define WS_FONTLIST_DOUBLEBUFFER (0x0001) #define WM_FONTLIST_BASE (WM_USER+2) extern "C" { void WINAPI RegisterFontList(void); void WINAPI UnregisterFontList(void); } // extern "C" #endif // !MONOTIDE_FONTLIST_H
// // UUChart.h // Version 0.1 // UUChart // // Created by shake on 14-7-24. // Copyright (c) 2014年 uyiuyao. All rights reserved. // #import <UIKit/UIKit.h> #import "UUChart.h" #import "UUColor.h" #import "UULineChart.h" #import "UUBarChart.h" //类型 typedef enum { UUChartLineStyle, UUChartBarStyle } UUChartStyle; @class UUChart; @protocol UUChartDataSource <NSObject> @required //横坐标标题数组 - (NSArray *)UUChart_xLableArray:(UUChart *)chart; //数值多重数组 - (NSArray *)UUChart_yValueArray:(UUChart *)chart; @optional //颜色数组 - (NSArray *)UUChart_ColorArray:(UUChart *)chart; //显示数值范围 - (CGRange)UUChartChooseRangeInLineChart:(UUChart *)chart; #pragma mark 折线图专享功能 //标记数值区域 - (CGRange)UUChartMarkRangeInLineChart:(UUChart *)chart; //判断显示横线条 - (BOOL)UUChart:(UUChart *)chart ShowHorizonLineAtIndex:(NSInteger)index; //判断显示最大最小值 - (BOOL)UUChart:(UUChart *)chart ShowMaxMinAtIndex:(NSInteger)index; @end @interface UUChart : UIView //是否自动显示范围 @property (nonatomic, assign) BOOL showRange; @property (assign) UUChartStyle chartStyle; -(id)initwithUUChartDataFrame:(CGRect)rect withSource:(id<UUChartDataSource>)dataSource withStyle:(UUChartStyle)style; - (void)showInView:(UIView *)view; -(void)strokeChart; -(void)removeAll; @end
#pragma once #include <windows.h> #include <concrt.h> #include "Statement.h" namespace SQLiteWinRT { using Windows::Foundation::Uri; using Windows::Foundation::IAsyncOperation; using Windows::Foundation::IAsyncAction; using Platform::String; using namespace Windows::Storage; public enum class SqliteOpenMode { Default = 0, // interpreted as OpenOrCreateReadWrite OpenRead = SQLITE_OPEN_READONLY, OpenReadWrite = SQLITE_OPEN_READWRITE, OpenOrCreateReadWrite = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE }; public ref class Database sealed { public: static IAsyncOperation<Database^>^ FromApplicationUriAsync(Uri^ path); static SqliteReturnCode GetSqliteErrorCode(int hr) { return SqliteReturnCode(HRESULT_CODE(hr)); } Database(StorageFile^ file); Database(StorageFolder^ folder, String^ name); virtual ~Database(); property String^ Path { String^ get() { return m_path; } } IAsyncAction^ OpenAsync(); IAsyncAction^ OpenAsync(SqliteOpenMode openMode); IAsyncOperation<Statement^>^ PrepareStatementAsync(String^ cmd); IAsyncAction^ ExecuteStatementAsync(String^ cmd); int64 GetLastInsertedRowId(); internal: property sqlite3* RawDatabasePtr { sqlite3* get() const { return m_database; } } private: sqlite3* m_database; LONG volatile m_opened; String^ m_path; String^ m_filename; }; }
// // ELGEditAlarmViewController.h // GeoAlert // // Created by Nikolay Evstigneev on 29.10.15. // Copyright © 2015 iOSTechnopark. All rights reserved. // #import <UIKit/UIKit.h> #import "ELGAlarm.h" #import "ELGBaseTableViewController.h" @class ELGEditAlarmViewController; @protocol ELGEditAlarmViewControllerDelegate <NSObject> - (void)editAlarmViewController:(ELGEditAlarmViewController *)vc alarmChanged:(ELGAlarm *)alarm atIndex:(NSInteger)index; @end @interface ELGEditAlarmViewController : ELGBaseTableViewController @property (weak, nonatomic) id <ELGEditAlarmViewControllerDelegate> delegate; @property (strong, nonatomic) ELGAlarm *alarm; @property (assign, nonatomic) NSInteger alarmIndex; - (IBAction)actionSave:(id)sender; @end
// Copyright & License details are available under JXCORE_LICENSE file #ifndef SRC_JX_JXP_COMPRESS_H_ #define SRC_JX_JXP_COMPRESS_H_ #include "node_buffer.h" namespace jxcore { typedef unsigned char mz_uint8; node::Buffer* CompressString(node::commons* com, const char* str, const long len); bool RaiseCache(unsigned long cache_size); void RemoveCache(); node::Buffer* UncompressString(node::commons* com, JS_HANDLE_OBJECT obj, const unsigned long ub64_len); mz_uint8* UncompressNative(const char* str, const unsigned long ub64_len); } // namespace jxcore #endif // SRC_JX_JXP_COMPRESS_H_
// SENSOR TEMPERATURE #ifndef LM75A_H #define LM75A_H #include "../../../common/sensor/temperature/temperature.h" #include "../../../common/i2c/i2cCommon.h" #define LM75A_READ_SENSOR_REGISTER 0x00 #define LM75A_CONFIGURATION_SENSOR_REGISTER 0x01 #define LM75A_HYSTERESIS_SENSOR_REGISTER 0x02 #define LM75A_OVER_TEMPERATURE_SENSOR_REGISTER 0x03 // Overtemp Shutdown output // 0 OS active LOW // 1 OS active HIGH #define OS_POLARITY_LOW 0x00 #define OS_POLARITY_HIGH 0x04 /** * Initializes a temperature structure for a LM75A sensor. * @param temperature a pointer on the temperature object (POO simulation) * @param i2cBusConnection a pointer on the i2cBusConnection */ void initTemperatureLM75A(Temperature* temperature, I2cBusConnection* i2cBusConnection); #endif
// // RBValidatingTextField.h // Pods // // Created by Aaron Signorelli on 07/02/2014. // // #import <UIKit/UIKit.h> @protocol RBValidatingTextFieldDelegate <NSObject> -(void) textField:(UITextField *) textField validationStateDidChange:(BOOL) isValid; @optional /* Called when the user has finished editing and the field is valid. */ -(void) clearUIValidationStateForTextField:(UITextField *) textField; @end //--- @interface RBValidatingTextField : UITextField @property(nonatomic, retain) id<RBValidatingTextFieldDelegate> validationDelegate; @property(nonatomic, assign) BOOL isValid; @property(nonatomic, readonly) BOOL pristine; @property(nonatomic, assign) BOOL required; @property(nonatomic, assign) NSInteger minLength; @property(nonatomic, assign) NSInteger maxLength; @property(nonatomic, retain) NSString *validationRegex; @property(nonatomic, retain) NSString *validationRule; // email_address, alpha, numeric, alphanumeric /* Set this for complex custom validation rules (like validating phone numbers across regions) Return true if the text is valid, false if the text is incorrect. */ @property(nonatomic, copy) BOOL (^validationBlock)(NSString *); /* Set a delegate globally to handle showing and hiding validation states on the UI */ +(void) setDefaultUIValidationDelegate:(id<RBValidatingTextFieldDelegate>) aDefaultDelegate; /* Manually force a validation check to run. Returns true if the text field is valid */ -(BOOL) validate; -(void) initialise; /* * Requests that the validation delegate removes the the UI notifications and resets the text field back to its pristine state. */ -(void) resetValidation; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE476_NULL_Pointer_Dereference__long_06.c Label Definition File: CWE476_NULL_Pointer_Dereference.label.xml Template File: sources-sinks-06.tmpl.c */ /* * @description * CWE: 476 NULL Pointer Dereference * BadSource: Set data to NULL * GoodSource: Initialize data * Sinks: * GoodSink: Check for NULL before attempting to print data * BadSink : Print data * Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5) * * */ #include "std_testcase.h" #include <wchar.h> /* The variable below is declared "const", so a tool should be able to identify that reads of this will always give its initialized value. */ static const int STATIC_CONST_FIVE = 5; #ifndef OMITBAD void CWE476_NULL_Pointer_Dereference__long_06_bad() { long * data; if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printLongLine(*data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G1() - use badsource and goodsink by changing the second STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */ static void goodB2G1() { long * data; if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(STATIC_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Check for NULL before attempting to print data */ if (data != NULL) { printLongLine(*data); } else { printLine("data is NULL"); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */ static void goodB2G2() { long * data; if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(STATIC_CONST_FIVE==5) { /* FIX: Check for NULL before attempting to print data */ if (data != NULL) { printLongLine(*data); } else { printLine("data is NULL"); } } } /* goodG2B1() - use goodsource and badsink by changing the first STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */ static void goodG2B1() { long * data; if(STATIC_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data */ { long tmpData = 5L; data = &tmpData; } } if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printLongLine(*data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */ static void goodG2B2() { long * data; if(STATIC_CONST_FIVE==5) { /* FIX: Initialize data */ { long tmpData = 5L; data = &tmpData; } } if(STATIC_CONST_FIVE==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printLongLine(*data); } } void CWE476_NULL_Pointer_Dereference__long_06_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE476_NULL_Pointer_Dereference__long_06_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE476_NULL_Pointer_Dereference__long_06_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// // RWTSearchResultsItemViewModel.h // RWTFlickrSearch // // Created by Hanguang on 11/9/15. // Copyright © 2015 Colin Eberhardt. All rights reserved. // #import <Foundation/Foundation.h> #import "RWTFlickrPhoto.h" #import "RWTViewModelServices.h" @interface RWTSearchResultsItemViewModel : NSObject @property (nonatomic) BOOL isVisible; @property (nonatomic, strong) NSString *title; @property (nonatomic, strong) NSURL *url; @property (nonatomic, strong) NSNumber *favorites; @property (nonatomic, strong) NSNumber *comments; - (instancetype)initWithPhoto:(RWTFlickrPhoto *)photo services:(id <RWTViewModelServices>)services; @end
// // GLTopCell.h // PublicSharing // // Created by 龚磊 on 2017/3/23. // Copyright © 2017年 三君科技有限公司. All rights reserved. // #import <UIKit/UIKit.h> @protocol GLTopCellDelegate <NSObject> - (void)kindOfButtonClick:(NSInteger )index; @end @interface GLTopCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIButton *liveBtn; @property (weak, nonatomic) IBOutlet UIButton *walkBtn; @property (weak, nonatomic) IBOutlet UIButton *foodBtn; @property (weak, nonatomic) IBOutlet UIButton *clothBtn; @property (nonatomic, assign)id<GLTopCellDelegate> delegate; @end
// // KYMasterVc.h // KuaiYiSuper // // Created by WZZ on 16/4/24. // Copyright © 2016年 WZZ. All rights reserved. // #import <UIKit/UIKit.h> @interface KYMasterVc : UIViewController @end
#ifndef BITOPS_H #define BITOPS_H static inline unsigned long __ffs(unsigned long word) { int num = 0; if ((word & 0xffff) == 0) { num += 16; word >>= 16; } if ((word & 0xff) == 0) { num += 8; word >>= 8; } if ((word & 0xf) == 0) { num += 4; word >>= 4; } if ((word & 0x3) == 0) { num += 2; word >>= 2; } if ((word & 0x1) == 0) num += 1; return num; } #define ffz(x) __ffs(~(x)) static inline int ffs(int x) { int r = 1; if (!x) return 0; if (!(x & 0xffff)) { x >>= 16; r += 16; } if (!(x & 0xff)) { x >>= 8; r += 8; } if (!(x & 0xf)) { x >>= 4; r += 4; } if (!(x & 3)) { x >>= 2; r += 2; } if (!(x & 1)) { x >>= 1; r += 1; } return r; } #endif /* BITOPS_H */
// working.c // author: madoodia@gmail.com #include <stdio.h> #define ONE 1 const int iOne = 1; int main(int argc, char **argv) { int *ip = &iOne; printf("The constant is %d\n", ONE); printf("The constant is %d\n", iOne); printf("The constant is %d\n", *ip); return 0; }
#ifndef Relay_h #define Relay_h class Relay { private: bool run; // remember if we're running or not int pin; // what pin is the heater relay on unsigned long last_changed; void on(); // private, use setOnWithPattern() instead void off(); // private, use clearPattern() instead unsigned char patternCharAtIndex(const unsigned char * progmem_addr, unsigned int index); public: Relay( int ); bool running(); // indicates whether the relay is on or off. void loop(); unsigned char * pattern_current; unsigned int pattern_length; unsigned long pattern_time_start; void setOnWithPattern(const unsigned char * pattern); void clearPattern(); }; #endif
#ifndef STRSORT_H_ #define STRSORT_H_ 1 char * str_sort(char[]); #endif /** ! STRSORT_H_ */
// // RegistViewController.h // RongChatRoomDemo // // Created by 弘鼎 on 2017/9/1. // Copyright © 2017年 rongcloud. All rights reserved. // #import <UIKit/UIKit.h> #import "UIButton+Countdown.h" @interface RegistViewController : UIViewController @property (weak, nonatomic) IBOutlet UIButton *backBtn; @property (weak, nonatomic) IBOutlet UILabel *titleLB; @property (nonatomic,strong) NSString *titlestr; @property (nonatomic,strong) NSString *loginBtntitle; @property (nonatomic,strong) NSString *urlstr; @end