text
stringlengths
4
6.14k
// Copyright (c) 2015 The BTX developers // Copyright (c) 2009-2012 The Darkcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef SPORK_H #define SPORK_H #include "bignum.h" #include "sync.h" #include "net.h" #include "key.h" #include "util.h" #include "script.h" #include "base58.h" #include "main.h" using namespace std; using namespace boost; // Don't ever reuse these IDs for other sporks #define SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT 10000 #define SPORK_2_MAX_VALUE 10002 #define SPORK_3_REPLAY_BLOCKS 10003 #define SPORK_4_NOTUSED 10004 #define SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT_DEFAULT 2428537599 //2015-4-8 23:59:59 GMT #define SPORK_2_MAX_VALUE_DEFAULT 500 //500 BTX #define SPORK_3_REPLAY_BLOCKS_DEFAULT 0 #define SPORK_4_RECONVERGE_DEFAULT 1420070400 //2047-1-1 class CSporkMessage; class CSporkManager; #include "bignum.h" #include "net.h" #include "key.h" #include "util.h" #include "protocol.h" #include "darksend.h" #include <boost/lexical_cast.hpp> using namespace std; using namespace boost; extern std::map<uint256, CSporkMessage> mapSporks; extern std::map<int, CSporkMessage> mapSporksActive; extern CSporkManager sporkManager; void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv); int GetSporkValue(int nSporkID); bool IsSporkActive(int nSporkID); void ExecuteSpork(int nSporkID, int nValue); // // Spork Class // Keeps track of all of the network spork settings // class CSporkMessage { public: std::vector<unsigned char> vchSig; int nSporkID; int64_t nValue; int64_t nTimeSigned; uint256 GetHash(){ uint256 n = Hash(BEGIN(nSporkID), END(nTimeSigned)); return n; } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { unsigned int nSerSize = 0; READWRITE(nSporkID); READWRITE(nValue); READWRITE(nTimeSigned); READWRITE(vchSig); } }; class CSporkManager { private: std::vector<unsigned char> vchSig; std::string strMasterPrivKey; std::string strTestPubKey; std::string strMainPubKey; public: CSporkManager() { strMainPubKey = "04f77ef629d4c59f689203c30e531e9eaf47b48f51ba18bb6b9a8e03096175f896fb49348e41132120b36b89bdc2b3dc710b693ea86b0fbb2f6fc09e13973571b2"; strTestPubKey = "04049a1c8be12fb148eaf77c99cf124c37efdece485d2ed6172aa034fe0dd2dc98d9d3306dd9116681d6edbeb5bf9f120a8d58828b9f53293f7d2be8f6e1729fd7"; } std::string GetSporkNameByID(int id); int GetSporkIDByName(std::string strName); bool UpdateSpork(int nSporkID, int64_t nValue); bool SetPrivKey(std::string strPrivKey); bool CheckSignature(CSporkMessage& spork); bool Sign(CSporkMessage& spork); void Relay(CSporkMessage& msg); }; #endif
#include "../src/vm.h" int main(void) { word code[] = { 0x01000009, /* SET A 4 */ 0x01001007, /* SET B 2 */ 0x02000001, /* ADD A B */ 0x01002006, /* SET C 1 */ 0x03000002, /* SUB A C */ 0x04001000 /* MULT B A */ }; /* Expected output: A = 5, B = A, C = 1, D = 0, E = 0 */ /* Create a new virtual machine */ vm_state *state = vm_new(); vm_load(state, code, 6); /* Load the code into memory */ vm_run(state); /* Run all code in memory */ vm_close(state); /* Free up the VM and close */ return EXIT_SUCCESS; }
#pragma comment(lib, "user32.lib") #include "C:\Factory\Common\all.h" int main(int argc, char **argv) { ClipCursor(NULL); if(argIs("/P")) { sint x = atoi(nextArg()); sint y = atoi(nextArg()); SetCursorPos(x, y); return; } error(); // •s–¾‚ȃRƒ}ƒ“ƒhˆø” }
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import "NSObject.h" @interface NSObject (MainThreadMessaging) + (void)mf_performBlockOnMainThread:(id)arg1 waitUntilDone:(void)arg2; + (void)_mf_mainThreadPerform:(id)arg1; @end
#ifndef _SHA_1_UTILS_H_ #define _SHA_1_UTILS_H_ #include <unistd.h> #include <stdint.h> #define SWAP_ENDIAN (1) /* * A simple array printing in the following form : /xde/xad/xbe/xef. * Set swap_endianess to SWAP_ENDIAN in order to reverse the byte order. */ void md4_utils_print_array(uint8_t* array, size_t array_len, unsigned int swap_endianess); /* * Print the hexadecimal array representing the hash */ void md4_utils_printHash(uint8_t* hash); /* * Compute the following hash : h(key || msg). * The hash parameter must be a 20 char array. */ void md4_utils_keyed_mac(uint8_t hash[], const uint8_t* key, size_t keylen, const uint8_t* msg, size_t msglen); /* * Compute the padding done to an arbitrary message before being hashed. * The padding follow this scheme : \x80\x00\x00....\x00\x$(msglen in bits). */ void md4_utils_md_pad(uint8_t *padded, size_t *paddedlen, const uint8_t* msg, size_t msglen); /* * Concatenate two string into a third one : out = str1 || str2. */ void md4_utils_concat(uint8_t *output, const uint8_t* str1, size_t str1len, const uint8_t* str2, size_t str2len); /* * SHA-1 padding mechanism unit test. */ void md4_utils_test_pad(); #endif /* _SHA_1_UTILS_H_ */
#pragma once #include <config.h> #include <iostream> #include <math.matrix/MatrixOperations.h> namespace nspace { // Matrix is a base class for all matrices. it has a very slim interface template<typename T, typename IndexType=int, typename SizeType = int> class Matrix { public: typedef IndexType Index; typedef SizeType Size; public: //default constructor Matrix(); virtual ~Matrix(){} // converts this matrix to a matrix of MatrixType template<typename MatrixType> operator MatrixType()const; // prints this matrix virtual void toStream(std::ostream & s)const; // resizes this matrix (returns false if matrix could not be resized to the requested dimension) virtual bool resize(Index r, Index c); // returns the number of elements of this matrix virtual inline Size size()const; // returns the number of rows virtual Size rows () const = 0; // returns the number of columns virtual Size cols () const = 0; // returns a reference to the element at i,j virtual T& operator () (Index i,Index j) = 0; // returns a const reference to the element at i,j virtual const T& operator () (Index i, Index j) const = 0; }; template<typename T, typename IndexType, typename SizeType> Matrix<T,IndexType,SizeType>::Matrix(){} template<typename T, typename IndexType, typename SizeType> template<typename MatrixType> Matrix<T,IndexType,SizeType>::operator MatrixType()const{ MatrixType result; assignMatrix(result,*this); return result; } template<typename T, typename IndexType, typename SizeType> void Matrix<T,IndexType,SizeType>::toStream(std::ostream & s)const{ for(Index i=0; i < rows(); i++){ for(Index j=0; j < cols(); j++){ s << (*this)(i,j) << ", "; } s << std::endl; } } template<typename T, typename IndexType, typename SizeType> bool Matrix<T,IndexType,SizeType>::resize(Index r, Index c){ if(r==rows()&&c==cols())return true; return false; } template<typename T, typename IndexType, typename SizeType> SizeType Matrix<T,IndexType,SizeType>::size()const{ return rows()*cols(); } template<typename T, typename IndexType, typename SizeType> class MatrixCoefficientType<Matrix<T,IndexType,SizeType> >{public: typedef T Type;}; template<typename T, typename IndexType, typename SizeType> class MatrixIndexType<Matrix<T,IndexType,SizeType> >{public: typedef IndexType Type;}; }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSString; @interface MMSafeModeInfo : NSObject { int m_version; NSString *m_path; _Bool _shouldNotUpdateConfig; _Bool _isCrashBySpecialCharacter; _Bool _isBootTimeNotEnough; int _appContinuousCrashCount; int _appLastCrashSignalNumber; int _appLastCrashSignalCode; int _appTimeoutCount; int _appTimeoutSceneCount; long long _appLastBootTime; } + (id)shareInstance; @property(nonatomic) _Bool isBootTimeNotEnough; // @synthesize isBootTimeNotEnough=_isBootTimeNotEnough; @property(nonatomic) _Bool isCrashBySpecialCharacter; // @synthesize isCrashBySpecialCharacter=_isCrashBySpecialCharacter; @property(nonatomic) _Bool shouldNotUpdateConfig; // @synthesize shouldNotUpdateConfig=_shouldNotUpdateConfig; @property(nonatomic) int appTimeoutSceneCount; // @synthesize appTimeoutSceneCount=_appTimeoutSceneCount; @property(nonatomic) long long appLastBootTime; // @synthesize appLastBootTime=_appLastBootTime; @property(nonatomic) int appTimeoutCount; // @synthesize appTimeoutCount=_appTimeoutCount; @property(nonatomic) int appLastCrashSignalCode; // @synthesize appLastCrashSignalCode=_appLastCrashSignalCode; @property(nonatomic) int appLastCrashSignalNumber; // @synthesize appLastCrashSignalNumber=_appLastCrashSignalNumber; @property(nonatomic) int appContinuousCrashCount; // @synthesize appContinuousCrashCount=_appContinuousCrashCount; - (void).cxx_destruct; - (id)infoPath; - (void)clearAll; - (void)saveInfo; - (_Bool)loadInfo; - (id)init; @end
#ifndef MONITOR_H #define MONITOR_H #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <sys/mman.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <stdlib.h> #include <signal.h> #include <semaphore.h> #define SHM_PATH "/shmpath" #define SEM_PATH "/sempath" sem_t *sem_id; int cont = 1; typedef struct shared_data { long double last_sum[10]; int pos; } shared_mem; #ifdef __cplusplus } #endif #endif /* MONITOR_H */
// Copyright (c) 2013 Eryllium Developers #ifndef PBKDF2_H #define PBKDF2_H #include <openssl/sha.h> #include <stdint.h> typedef struct HMAC_SHA256Context { SHA256_CTX ictx; SHA256_CTX octx; } HMAC_SHA256_CTX; void HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen); void HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void *in, size_t len); void HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX * ctx); void PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt, size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen); #endif // PBKDF2_H
// OVCManagedStore.h // // Copyright (c) 2014 Guillermo Gonzalez // // 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 <CoreData/CoreData.h> #import <Overcoat/OVCUtilities.h> NS_ASSUME_NONNULL_BEGIN /** Manages a Core Data stack. */ @interface OVCManagedStore : NSObject /** The persistent store coordinator. */ @property (strong, nonatomic, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; /** The managed object model. */ @property (strong, nonatomic, readonly, OVC_NULLABLE) NSManagedObjectModel *managedObjectModel; /** Creates and returns a `OVCManagedStore` that will persist its data in memory. */ + (instancetype)managedStoreWithModel:(OVC_NULLABLE NSManagedObjectModel *)managedObjectModel; /** Creates and returns a `OVCManagedStore` that will persist its data in a temporary file. */ + (instancetype)temporaryManagedStore; /** Creates and returns a `OVCManagedStore` that will persist its data in the application caches directory. @param cacheName The file name. */ + (instancetype)managedStoreWithCacheName:(NSString *)cacheName; /** Initializes the receiver with the specified path and managed object model. This is the designated initializer. @param path The persistent store path. If `nil` the persistent store will be created in memory. @param managedObjectModel The managed object model. If `nil` all models in the current bundle will be used. */ - (instancetype)initWithPath:(OVC_NULLABLE NSString *)path managedObjectModel:(OVC_NULLABLE NSManagedObjectModel *)managedObjectModel NS_DESIGNATED_INITIALIZER; @end NS_ASSUME_NONNULL_END
// // BGNanoWebDataStore.h // BGLibrary // // Created by Lawrence Lomax on 06/11/2012. // Copyright (c) 2012 Bell George. All rights reserved. // #import <Foundation/Foundation.h> #import "BGWebDataStore.h" #import "BGNanoDataStore.h" @interface BGNanoWebDataStore : BGNanoDataStore<BGWebDataStore> @end
// // SWMViewController.h // Orgo // // Created by Spencer MacKinnon on 12/23/12. // Copyright (c) 2012 Spencer MacKinnon. All rights reserved. // #import <UIKit/UIKit.h> #import <GLKit/GLKit.h> #import "SWMAtom.h" #import "SWMAtomFactory.h" #import "SWMModelGraph.h" #import "SWMMaterialCollection.h" @interface SWMViewController : GLKViewController { GLKMatrix4 _projectionMatrix; CGFloat _lastScale,_lastTransX, _lastTransY; float _aspect; SWMModelGraph *_modelGraph; SWMAtomFactory *_atomFactory; } @end
// // SavedNumbersTableViewController.h // Mega Winner // // Created by Joshua Alvarado on 3/5/14. // Copyright (c) 2014 Joshua Alvarado. All rights reserved. // #import <UIKit/UIKit.h> @interface SavedNumbersTableViewController : UITableViewController @end
// // Scenario.h // Athena // // Created by Scott McClaugherty on 1/26/11. // Copyright 2011 Scott McClaugherty. All rights reserved. // #import <Foundation/Foundation.h> #import "LuaCoding.h" #import "ResCoding.h" #import "IndexedObject.h" @class IndexedObject; @class XSPoint, XSText; @class ScenarioPar; @class Race; @interface Scenario : IndexedObject <LuaCoding, ResCoding, ResIndexOverriding> { NSString *name; NSUInteger netRaceFlags; NSInteger playerNum;//Number of players NSMutableArray *players; NSMutableArray *scoreStrings; NSMutableArray *initialObjects; NSMutableArray *conditions; NSMutableArray *briefings; XSPoint *starmap; ScenarioPar *par; NSInteger angle; NSInteger startTime; BOOL isTraining; XSText *prologue; XSText *epilogue; XSText *noShipsText; NSInteger songId; NSString *movie; } @property (readwrite, retain) NSString *name; @property (readonly) NSString *singleLineName; @property (readwrite, assign) NSUInteger netRaceFlags; @property (readwrite, assign) NSInteger playerNum; @property (readwrite, retain) NSMutableArray *players; @property (readwrite, retain) NSMutableArray *scoreStrings; @property (readwrite, retain) NSMutableArray *initialObjects; @property (readwrite, retain) NSMutableArray *conditions; @property (readwrite, retain) NSMutableArray *briefings; @property (readwrite, retain) XSPoint *starmap; @property (readwrite, retain) ScenarioPar *par; @property (readwrite, assign) NSInteger angle; @property (readwrite, assign) NSInteger startTime; @property (readwrite, assign) BOOL isTraining; @property (readwrite, retain) XSText *prologue; @property (readwrite, retain) XSText *epilogue; @property (readwrite, retain) XSText *noShipsText; @property (readwrite, assign) NSInteger songId; @property (readwrite, retain) NSString *movie; @end typedef enum { PlayerTypeSingle, PlayerTypeNet, PlayerTypeCpu, PlayerTypeNull = -1 } PlayerType; @interface ScenarioPlayer : NSObject <LuaCoding, ResCoding> { PlayerType type; Race *race; NSInteger raceId;//used as a temporary variable NSString *name; float earningPower; NSUInteger netRaceFlags; } @property (readwrite, assign) PlayerType type; @property (readwrite, retain) Race *race; @property (readwrite, retain) NSString *name; @property (readwrite, assign) float earningPower; @property (readwrite, assign) NSUInteger netRaceFlags; - (id) initAsSinglePlayer; @end @interface ScenarioPar : NSObject <LuaCoding> { NSInteger time; NSInteger kills; float ratio; NSInteger losses; } @property (readwrite, assign) NSInteger time; @property (readwrite, assign) NSInteger kills; @property (readwrite, assign) float ratio; @property (readwrite, assign) NSInteger losses; @end
// // OCTEvent+Persistence.h // Scarecrow // // Created by duanhongjin on 8/4/16. // Copyright © 2016 duanhongjin. All rights reserved. // #import <OctoKit/OctoKit.h> @interface OCTEvent (Persistence) + (BOOL)ad_saveUserReceivedEvents:(NSArray *)eventArray; + (BOOL)ad_saveUserPerformedEvents:(NSArray *)eventArray; + (NSArray *)ad_fetchUserReceivedEvents; + (NSArray *)ad_fetchUserPerformedEvents; @end @interface OCTEvent (NSURL) - (NSURL *)ad_link; @end
#pragma once #ifndef MAIN_H #define MAIN_H class wxCommandEvent; class wxMenuBar; class wxWindow; class wxFrame; class wxNotebook; class windowDeleter { public: void operator()(wxWindow* window){window->Destroy();} }; class mainApp : public wxApp { public: bool OnInit(); private: std::unique_ptr<wxFrame, windowDeleter> topWindow; }; class mainWindow : public wxFrame { public: mainWindow(); void onQuit(wxCommandEvent&); void openPreferences(wxCommandEvent&); private: wxMenuBar * menuBar; wxNotebook * tabManager; }; #endif
#ifndef HANDLEBARS_HELPERS_H #define HANDLEBARS_HELPERS_H #include <functional> #include <QHash> #include <QList> #include <QVariant> namespace Handlebars { using escape_fn = std::function< QString (const QString&) >; class RenderingContext; class Node; using helper_params = QVariantList; using helper_options = QVariantHash; using helper_fn = std::function< QVariant ( const RenderingContext & context, const helper_params & params, const helper_options & options )>; using block_helper_fn = std::function< void ( RenderingContext & context, const helper_params & params, const helper_options & options, const QList<Node*> & first, const QList<Node*> & last )>; using helpers = QHash< QString, helper_fn >; using block_helpers = QHash< QString, block_helper_fn >; }// namespace Handlebars #endif // HANDLEBARS_HELPERS_H
#ifndef SELECTION_SORT_H #define SELECTION_SORT_H #include <stddef.h> void selection_sort(int array[], size_t length); #endif // SELECTION_SORT_H
#ifndef __H_VECTOR__ #define __H_VECTOR__ struct Vector3D { float x, y, z; }; #endif /* __H_VECTOR__ */
#ifndef GUARD_Kinematics_h #define GUARD_Kinematics_h // class Kinematics double pAbs (double,double,double,double); double pt (double,double,double,double); double calculatetheta (double,double,double,double); double phi (double,double,double,double); double invariantmass (double,double,double,double); double lambda (double,double,double); double TriangleFunc(double m1, double m2, double m3); double TriangleFunc2(double m1, double m2, double m3); //Turns a beta=speed/c into gamma double beta_gamma(double beta); double boost_calc(double mass, double Enegry); //Calculates the angle between vectors 1 and 2. double Angle_Spread(double x1, double y1, double z1, double x2, double y2, double z2); namespace one_to_two_decay{ double two_body_momentum(double m0, double m1, double m2); } namespace elastic_scattering{ double Theta_from_E2f(double E2f, double E1i, double m1, double m2); double E2f_from_Theta(double theta2, double E1i, double m1, double m2); double E2fMax(double E1i, double m1, double m2); double E2fMin(double E1i, double m1, double m2); } namespace annihilation_to_pair{ //lab frame 1+2->3+4 where m3=m4, but m1!=m2. double shat(double E1, double m1, double m2); double p1cm(double E1, double m1, double m2); double p3cm(double E1, double m1, double m2, double m3); double t0(double E1, double m1, double m2, double m3); double t1(double E1, double m1, double m2, double m3); double E4_from_t(double m2, double m4, double t); double E3_from_t(double E1, double m1, double m2, double m3, double t); double E3Min(double E1, double m1, double m2, double m3); double E3Max(double E1, double m1, double m2, double m3); double Theta_from_E3(double E1,double m1,double m2,double E3,double m3); } namespace two_to_two_scattering{ //1+2->3+4. //2 is stationary in lab frame. double s_lab(double E1lab, double m1, double m2); //t=(p2-p4)^2 double t_lab(double E4, double m2, double m4); //E1 is E1lab. This is equation 47.37 double p1cm(double E1, double m1, double m2); double E3cm(double E1, double m1, double m2, double m3, double m4); double p3cm(double E1, double m1, double m2, double m3, double m4); double t0(double E1lab, double m1, double m2, double m3, double m4); double t1(double E1lab, double m1, double m2, double m3, double m4); double E4_from_t(double m2, double m4, double t); //E1 is in lab frame double E3_from_t(double E1, double m1, double m2, double m3, double m4, double t); //E1 is in lab frame double Theta_from_E4(double E1, double E4, double m1, double m2 , double m3, double m4); //Need to check that these are correct, might need to swap t0 and t1. t1 gives E3min, so that should be E4max. double E4min(double E1lab, double m1, double m2, double m3, double m4); double E4max(double E1lab, double m1, double m2, double m3, double m4); } /* namespace annihilation{ double E3_from_Theta(double E1, double m1, double theta, double m3); double p1cm(double E1, double m1); double p3cm(double E1, double m1, double m3); double t0(double E1, double m1, double m3); double t1(double E1, double m1, double m3); double E3_from_t(double E1, double m1, double m3, double t); double E3Min(double E1, double m1, double m3); double E3Max(double E1, double m1, double m3); } */ #endif
/********************************************************************************************************************* Microsft HLS SDK for Windows Copyright (c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ***********************************************************************************************************************/ #pragma once #include <memory> #include <map> #include <vector> #include "Timestamp.h" #include "PESPacket.h" #include "PATSection.h" #include "PMTSection.h" #include "AdaptationField.h" #include "SampleData.h" #include "TransportStreamParser.h" #include "BitOp.h" #include "TSConstants.h" namespace Microsoft { namespace HLSClient { namespace Private { class TransportStreamParser; class AdaptationField; class PATSection; class PMTSection; class PESPacket; class Timestamp; class SampleData; class TransportPacket { public: bool IsPATSection; bool IsPMTSection; bool HasPayload; bool HasAdaptationField; BYTE PayloadUnitStartIndicator; USHORT PID; BYTE ContinuityCounter; unsigned int PayloadLength; ContentType MediaType; std::shared_ptr<AdaptationField> spAdaptationField; std::shared_ptr<PATSection> spPATSection; std::shared_ptr<PMTSection> spPMTSection; std::shared_ptr<PESPacket> spPESPacket; TransportStreamParser *pParentParser; TransportPacket(TransportStreamParser *parent); ~TransportPacket(); static bool IsTransportPacket(const BYTE* tsPacket); static const shared_ptr<TransportPacket> Parse(const BYTE* tsPacket, TransportStreamParser *parent, std::map<unsigned short, std::deque<std::shared_ptr<SampleData>>>& UnreadQueues, std::map<ContentType, unsigned short>& MediaTypePIDMap, std::map<ContentType, unsigned short> PIDFilter, std::vector<unsigned short>& MetadataStreams, std::vector<std::shared_ptr<Timestamp>>& Timeline, std::vector<shared_ptr<SampleData>>& CCSamples , bool ParsingOutOfOrder = false); }; } } }
// // Calculator.h // EX-RAC-DEMO // // Created by weiying on 2016/12/5. // Copyright © 2016年 amoby. All rights reserved. // #import <Foundation/Foundation.h> typedef int (^valueBlock)(int value); typedef BOOL (^boolBlock)(int value); @interface Calculator : NSObject @property (nonatomic, assign) int result; @property (nonatomic, assign) BOOL isEqual; - (Calculator *)calculator:(valueBlock)block; - (Calculator *)equal:(boolBlock)block; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "CDStructures.h" #import "IDEKeyDrivenNavigableItemRepresentedObject-Protocol.h" @class DVTDocumentLocation, DVTFileDataType, IDEFileReference, NSImage, NSMutableDictionary, NSString; @interface Xcode3LocalizationGroup : NSObject <IDEKeyDrivenNavigableItemRepresentedObject> { NSMutableDictionary *_children; Xcode3LocalizationGroup *_parent; NSString *_name; } @property(retain) NSString *name; // @synthesize name=_name; @property __weak Xcode3LocalizationGroup *parent; // @synthesize parent=_parent; - (id)childWithName:(id)arg1; - (void)removeChildForName:(id)arg1; - (void)addChild:(id)arg1 forName:(id)arg2; - (id)children; @property(readonly) BOOL navigableItem_isLeaf; @property(readonly) NSImage *navigableItem_image; @property(readonly) NSString *navigableItem_name; - (id)initWithName:(id)arg1 parent:(id)arg2; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) DVTDocumentLocation *navigableItem_contentDocumentLocation; @property(readonly) DVTFileDataType *navigableItem_documentType; @property(readonly) IDEFileReference *navigableItem_fileReference; @property(readonly) NSString *navigableItem_groupIdentifier; @property(readonly) BOOL navigableItem_isMajorGroup; @property(readonly) NSString *navigableItem_toolTip; @property(readonly) Class superclass; @end
// // CRZoomScrollView.h // CRMotionViewDemo // // Created by Tanguy Aladenise on 2014-11-06. // Copyright (c) 2014 Tanguy Aladenise. All rights reserved. // @protocol CRZoomScrollViewDelegate; #import <UIKit/UIKit.h> @interface CRZoomScrollView : UIScrollView @property (nonatomic, assign) id <CRZoomScrollViewDelegate> zoomDelegate; /** * image * * The image zoomable */ @property (nonatomic) UIImage *image; /** * startOffset * * The offset position from where to start and dismiss the zoom view for seamless transition */ @property CGPoint startOffset; /** * Custom init method to work with the motion view or any scrollView * * @param scrollView The reference scrollView for transition animation * @param image The image to display * * @return An instance of CRZoomScrollView */ - (id)initFromScrollView:(UIScrollView *)scrollView withImage:(UIImage *)image; - (void)pinch:(UIPinchGestureRecognizer *)gesture; @end @protocol CRZoomScrollViewDelegate <NSObject> @optional /** * Delegate method to handle when view will be dismissed * * @param zoomScrollView An instance of CRZoomScrollView - Optional */ - (void)zoomScrollViewWillDismiss:(CRZoomScrollView *)zoomScrollView; /** * Delegate method to handle when view has been dismissed * * @param zoomScrollView An instance of CRZoomScrollView - Optional */ - (void)zoomScrollViewDidDismiss:(CRZoomScrollView *)zoomScrollView; @end
#include <numeric> namespace rtHMM { using namespace std; template<typename FDT, typename SDT, typename... DT> mixture_distribution<FDT, SDT, DT...>::mixture_distribution(array<double, num_dists> w, const FDT& first_dist, const SDT& second_dist, const DT& ... dists) : distributions(first_dist, second_dist, dists...), weights(w) { double weight_sum = accumulate(begin(weights), end(weights), 0.0); for (auto& weight : weights) { weight /= weight_sum; } } namespace internal { template<typename mixed_dist_type, size_t i> struct mixed_prob_comp { static_assert(i < mixed_dist_type::num_dists, "Index i must be smaller than the number of distributions in the mixture"); static double compute(const mixed_dist_type& mixed_dist, const typename mixed_dist_type::value_type& val) { return get<i>(mixed_dist.weights) * get<i>(mixed_dist.distributions).probability(val) + mixed_prob_comp<mixed_dist_type, i - 1>::compute(mixed_dist, val); } }; template<typename mixed_dist_type> struct mixed_prob_comp<mixed_dist_type, 0> { static double compute(const mixed_dist_type& mixed_dist, const typename mixed_dist_type::value_type& val) { return get<0>(mixed_dist.weights) * get<0>(mixed_dist.distributions).probability(val); } }; } // namespace rtHMM::internal template<typename FDT, typename SDT, typename... DT> double mixture_distribution<FDT, SDT, DT...>::compute_probability(const typename FDT::value_type& value) const { return internal::mixed_prob_comp<mixture_distribution<FDT, SDT, DT...>, num_dists - 1>::compute(*this, value); } } // namespace rtHMM
// // FLPrintf.h // FishLampFrameworks // // Created by Mike Fullerton on 8/22/12. // Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.. // The FishLamp Framework is released under the MIT License: http://fishlamp.com/license // #import "FLCoreRequired.h" extern void FLPrintFormatWithIndent(NSUInteger indent, NSString* format, ...); extern void FLPrintFormat(NSString* format, ...); extern void FLPrintString(NSString* format); extern void FLPrintStringWithIndent(NSUInteger indent, NSString* string); extern void FLIndentString(void (^block)());
/* * misc-private.h: Miscellaneous internal support functions * * Author: * Dick Porter (dick@ximian.com) * * (C) 2002 Ximian, Inc. */ #ifndef _WAPI_MISC_PRIVATE_H_ #define _WAPI_MISC_PRIVATE_H_ #include <glib.h> #include <sys/time.h> #include <time.h> extern void _wapi_calc_timeout(struct timespec *timeout, guint32 ms); #endif /* _WAPI_MISC_PRIVATE_H_ */
//******************************************************************************* // COPYRIGHT NOTES // --------------- // This is a part of the BCGControlBar Library // Copyright (C) 1998-2000 BCGSoft Ltd. // All rights reserved. // // This source code can be used, distributed or modified // only under terms and conditions // of the accompanying license agreement. //******************************************************************************* // BCGVisualManagerXP.h: interface for the CBCGVisualManagerXP class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_BCGVISUALMANAGERXP_H__062013FA_7440_4CEC_AA78_67893D195FFA__INCLUDED_) #define AFX_BCGVISUALMANAGERXP_H__062013FA_7440_4CEC_AA78_67893D195FFA__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "bcgcontrolbar.h" #include "BCGVisualManager.h" class BCGCONTROLBARDLLEXPORT CBCGVisualManagerXP : public CBCGVisualManager { DECLARE_DYNCREATE(CBCGVisualManagerXP) protected: CBCGVisualManagerXP(BOOL bIsTemporary = FALSE); public: virtual ~CBCGVisualManagerXP(); protected: virtual void OnUpdateSystemColors (); virtual void OnDrawBarGripper (CDC* pDC, CRect rectGripper, BOOL bHorz, CControlBar* pBar); virtual void OnFillBarBackground (CDC* pDC, CControlBar* pBar, CRect rectClient, CRect rectClip, BOOL bNCArea); virtual void OnDrawBarBorder (CDC* pDC, CControlBar* pBar, CRect& rect); virtual void OnDrawMenuBorder (CDC* pDC, CBCGPopupMenu* pMenu, CRect rect); virtual void OnDrawSeparator (CDC* pDC, CControlBar* pBar, CRect rect, BOOL bIsHoriz); virtual void OnFillButtonInterior (CDC* pDC, CBCGToolbarButton* pButton, CRect rect, CBCGVisualManager::BCGBUTTON_STATE state); virtual void OnDrawButtonBorder (CDC* pDC, CBCGToolbarButton* pButton, CRect rect, CBCGVisualManager::BCGBUTTON_STATE state); virtual void OnHighlightMenuItem (CDC*pDC, CBCGToolbarMenuButton* pButton, CRect rect, COLORREF& clrText); virtual void OnHighlightRarelyUsedMenuItems (CDC* pDC, CRect rectRarelyUsed); virtual void OnEraseTabsArea (CDC* pDC, CRect rect, const CBCGTabWnd* pTabWnd); virtual void OnDrawTab (CDC* pDC, CRect rectTab, int iTab, BOOL bIsActive, const CBCGTabWnd* pTabWnd); virtual void OnDrawCaptionButton (CDC* pDC, CBCGSCBButton* pButton, BOOL bHorz, BOOL bMaximized, BOOL bDisabled); virtual void OnDrawTearOffCaption (CDC* pDC, CRect rect, BOOL bIsActive); virtual COLORREF OnFillCommandsListBackground (CDC* pDC, CRect rect, BOOL bIsSelected = FALSE); virtual void OnDrawMenuSystemButton (CDC* pDC, CRect rect, UINT uiSystemCommand, UINT nStyle, BOOL bHighlight); virtual void OnDrawStatusBarPaneBorder (CDC* pDC, CBCGStatusBar* pBar, CRect rectPane, UINT uiID, UINT nStyle); virtual void OnDrawComboDropButton (CDC* pDC, CRect rect, BOOL bDisabled, BOOL bIsDropped, BOOL bIsHighlighted, CBCGToolbarComboBoxButton* pButton); virtual void OnDrawComboBorder (CDC* pDC, CRect rect, BOOL bDisabled, BOOL bIsDropped, BOOL bIsHighlighted, CBCGToolbarComboBoxButton* pButton); virtual COLORREF GetToolbarButtonTextColor (CBCGToolbarButton* pButton, CBCGVisualManager::BCGBUTTON_STATE state); virtual int GetMenuImageMargin () const { return 3; } BOOL IsLook2000Allowed () const { return FALSE; } CBrush m_brGripperHorz; CBrush m_brGripperVert; COLORREF m_clrBarBkgnd; // Control bar background color (expect menu bar) CBrush m_brBarBkgnd; COLORREF m_clrMenuLight; // Color of the light menu area CBrush m_brMenuLight; COLORREF m_clrHighlight; // Highlighted toolbar/menu item color CBrush m_brHighlight; COLORREF m_clrHighlightDn; // Highlighted and pressed toolbar item color CBrush m_brHighlightDn; COLORREF m_clrHighlightChecked; CBrush m_brHighlightChecked; CBrush m_brTabBack; CPen m_penSeparator; COLORREF m_clrPaneBorder; // Status bar pane border COLORREF m_clrMenuBorder; // Menu border COLORREF m_clrMenuItemBorder; // Highlighted menu item border virtual void CreateGripperBrush (); virtual void ExtendMenuButton (CBCGToolbarMenuButton* pMenuButton, CRect& rect); }; #endif // !defined(AFX_BCGVISUALMANAGERXP_H__062013FA_7440_4CEC_AA78_67893D195FFA__INCLUDED_)
/* * ssd1306_i2c.c * * Created: 5/9/2017 6:25:16 PM * Author: pvallone */ #include <asf.h> #include "ssd1306_i2c.h" void configure_i2c(void) { #if BOARD == SAMD21_XPLAINED_PRO /* Initialize config structure and software module */ struct i2c_master_config config_i2c_master; i2c_master_get_config_defaults(&config_i2c_master); /* Change buffer timeout to something longer */ config_i2c_master.buffer_timeout = 65535; config_i2c_master.transfer_speed = I2C_MASTER_SPEED_HIGH_SPEED; /* Initialize and enable device with config */ while(i2c_master_init(&i2c_master_instance, CONF_I2C_MASTER_MODULE, &config_i2c_master) != STATUS_OK); i2c_master_enable(&i2c_master_instance); #elif BOARD == SAM4S_XPLAINED_PRO gpio_configure_pin(TWI0_DATA_GPIO, TWI0_DATA_FLAGS); gpio_configure_pin(TWI0_CLK_GPIO, TWI0_CLK_FLAGS); uint32_t status; pmc_enable_periph_clk(ID_TWI0); //set options twi_master_options_t opt; opt.speed = TWI_SPEED; opt.chip = (ADDRESS >> 1); opt.master_clk = sysclk_get_cpu_hz(); // Init TWI Master status = twi_master_setup(TWI_CHANNEL, &opt); if (status != TWI_SUCCESS) { while(1); // wait to finish } twi_master_enable(TWI_CHANNEL); #endif } void write_command(uint8_t cmd){ uint8_t buff[2]; buff[0] = I2C_WRITE; buff[1] = cmd; #if BOARD == SAMD21_XPLAINED_PRO wr_packet.address = ADDRESS; wr_packet.data_length = 2; wr_packet.data = buff; i2c_master_write_packet_wait(&i2c_master_instance, &wr_packet); #elif BOARD == SAM4S_XPLAINED_PRO packet.buffer = &buff; /* Data length */ packet.length = 2; /* Slave chip address */ packet.chip = (ADDRESS >> 1); twi_master_write(TWI_CHANNEL, &packet); #endif }
// // GKWYMusicFindViewController.h // GKNavigationBarViewControllerDemo // // Created by QuintGao on 2017/7/10. // Copyright © 2017年 QuintGao. All rights reserved. // #import <UIKit/UIKit.h> #import "GKBaseViewController.h" @interface GKWYMusicFindViewController : GKBaseViewController @end
// // HuiJinMessageView.h // HuiJing // // Created by Peter on 6/22/16. // Copyright © 2016 Peter. All rights reserved. // #import <UIKit/UIKit.h> @interface HuiJinMessageView : UIView @end
#pragma once #include "../common/InnoType.h" #include "GLRenderPassComponent.h" #include "GLShaderProgramComponent.h" class GLShadowRenderPassComponent { public: ~GLShadowRenderPassComponent() {}; static GLShadowRenderPassComponent& get() { static GLShadowRenderPassComponent instance; return instance; } ObjectStatus m_objectStatus = ObjectStatus::SHUTDOWN; EntityID m_parentEntity; GLRenderPassComponent* m_DirLight_GLRPC; GLRenderPassComponent* m_PointLight_GLRPC; GLShaderProgramComponent* m_SPC; ShaderFilePaths m_shaderFilePaths = { "GL4.0//shadowPassVertex.sf" , "", "GL4.0//shadowPassFragment.sf" }; GLuint m_shadowPass_uni_p; GLuint m_shadowPass_uni_v; GLuint m_shadowPass_uni_m; private: GLShadowRenderPassComponent() {}; };
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Aureus Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef AUREUS_UINT256_H #define AUREUS_UINT256_H #include <assert.h> #include <cstring> #include <stdexcept> #include <stdint.h> #include <string> #include <vector> #include "crypto/common.h" /** Template base class for fixed-sized opaque blobs. */ template<unsigned int BITS> class base_blob { protected: enum { WIDTH=BITS/8 }; uint8_t data[WIDTH]; public: base_blob() { memset(data, 0, sizeof(data)); } explicit base_blob(const std::vector<unsigned char>& vch); bool IsNull() const { for (int i = 0; i < WIDTH; i++) if (data[i] != 0) return false; return true; } void SetNull() { memset(data, 0, sizeof(data)); } friend inline bool operator==(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) == 0; } friend inline bool operator!=(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) != 0; } friend inline bool operator<(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) < 0; } std::string GetHex() const; void SetHex(const char* psz); void SetHex(const std::string& str); std::string ToString() const; unsigned char* begin() { return &data[0]; } unsigned char* end() { return &data[WIDTH]; } const unsigned char* begin() const { return &data[0]; } const unsigned char* end() const { return &data[WIDTH]; } unsigned int size() const { return sizeof(data); } unsigned int GetSerializeSize(int nType, int nVersion) const { return sizeof(data); } template<typename Stream> void Serialize(Stream& s, int nType, int nVersion) const { s.write((char*)data, sizeof(data)); } template<typename Stream> void Unserialize(Stream& s, int nType, int nVersion) { s.read((char*)data, sizeof(data)); } }; /** 160-bit opaque blob. * @note This type is called uint160 for historical reasons only. It is an opaque * blob of 160 bits and has no integer operations. */ class uint160 : public base_blob<160> { public: uint160() {} uint160(const base_blob<160>& b) : base_blob<160>(b) {} explicit uint160(const std::vector<unsigned char>& vch) : base_blob<160>(vch) {} }; /** 256-bit opaque blob. * @note This type is called uint256 for historical reasons only. It is an * opaque blob of 256 bits and has no integer operations. Use arith_uint256 if * those are required. */ class uint256 : public base_blob<256> { public: uint256() {} uint256(const base_blob<256>& b) : base_blob<256>(b) {} explicit uint256(const std::vector<unsigned char>& vch) : base_blob<256>(vch) {} /** A cheap hash function that just returns 64 bits from the result, it can be * used when the contents are considered uniformly random. It is not appropriate * when the value can easily be influenced from outside as e.g. a network adversary could * provide values to trigger worst-case behavior. */ uint64_t GetCheapHash() const { return ReadLE64(data); } /** A more secure, salted hash function. * @note This hash is not stable between little and big endian. */ uint64_t GetHash(const uint256& salt) const; }; /* uint256 from const char *. * This is a separate function because the constructor uint256(const char*) can result * in dangerously catching uint256(0). */ inline uint256 uint256S(const char *str) { uint256 rv; rv.SetHex(str); return rv; } /* uint256 from std::string. * This is a separate function because the constructor uint256(const std::string &str) can result * in dangerously catching uint256(0) via std::string(const char*). */ inline uint256 uint256S(const std::string& str) { uint256 rv; rv.SetHex(str); return rv; } #endif // AUREUS_UINT256_H
// // CMAutoCompletTableViewCell.h // I_NScreen // // Created by 조백근 on 2015. 10. 1.. // Copyright © 2015년 STVN. All rights reserved. // #import <UIKit/UIKit.h> typedef void(^AutoCompletCloseEvent)(NSIndexPath* indexPath); @interface CMAutoCompletTableViewCell : UITableViewCell @property (nonatomic, strong) NSIndexPath* indexPath; @property (nonatomic, copy) AutoCompletCloseEvent autoCompletCloseEvent; - (void)setTitle:(NSString*)title; @end
// // CDDTopScrollView.h // BaseProject // // Created by 曹冬冬 on 2017/4/6. // Copyright © 2017年 曹冬冬. All rights reserved. // #import <UIKit/UIKit.h> @class CDDTopScrollView; @protocol CDDTopScrollViewDelegate <NSObject> - (void)topScrollView:(CDDTopScrollView *)topScrollView didSelectTitleAtIndex:(NSInteger)index; @end @interface CDDTopScrollView : UIScrollView /** Delegate */ @property (nonatomic, weak) id<CDDTopScrollViewDelegate> delegate_TS; /** * 对象方法创建 * * @param frame frame * @param delegate delegate * @param childVcTitle 子控制器标题数组 * @param isScaleText 是否开启文字缩放功能;默认不开启 */ - (instancetype)initWithFrame:(CGRect)frame delegate:(id<CDDTopScrollViewDelegate>)delegate childVcTitle:(NSArray *)childVcTitle isScaleText:(BOOL)isScaleText; /** * 类方法创建 * * @param frame frame * @param delegate delegate * @param childVcTitle 子控制器标题数组 * @param isScaleText 是否开启文字缩放功能;默认不开启 */ + (instancetype)segmentedControlWithFrame:(CGRect)frame delegate:(id<CDDTopScrollViewDelegate>)delegate childVcTitle:(NSArray *)childVcTitle isScaleText:(BOOL)isScaleText; - (void)changeThePositionOfTheSelectedBtnWithScrollView:(UIScrollView *)scrollView; @end
//NOT_CREATE_META_DATA #ifndef __SOC_NORMAL_MAPPING_H__ #define __SOC_NORMAL_MAPPING_H__ float3 UnpackNormal(float3 normalMapXYZ, float3 normal, float3 tangent) { float3 binormal = normalize( cross(normal, tangent) ); float3x3 TBN = float3x3(normalize(tangent), normalize(binormal), normalize(normal)); float3 tangentNormal = normalize(normalMapXYZ * 2.0f - 1.0f); return mul(TBN, tangentNormal); } #endif
/* This example reads from the default PCM device and writes to standard output for 5 seconds of data. To compile: gcc recorder.c -o recorder -lasound */ /* Use the newer ALSA API */ #define ALSA_PCM_NEW_HW_PARAMS_API #include <alsa/asoundlib.h> int main() { long loops; int rc; int size; snd_pcm_t *handle; snd_pcm_hw_params_t *params; unsigned int val; int dir; snd_pcm_uframes_t frames; char *buffer; /* Open PCM device for recording (capture). */ rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_CAPTURE, 0); if (rc < 0) { fprintf(stderr, "unable to open pcm device: %s\n", snd_strerror(rc)); exit(1); } /* Allocate a hardware parameters object. */ snd_pcm_hw_params_alloca(&params); /* Fill it in with default values. */ snd_pcm_hw_params_any(handle, params); /* Set the desired hardware parameters. */ /* Interleaved mode */ snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED); /* Signed 16-bit little-endian format */ snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE); /* Two channels (stereo) */ snd_pcm_hw_params_set_channels(handle, params, 2); /* 44100 bits/second sampling rate (CD quality) */ val = 44100; snd_pcm_hw_params_set_rate_near(handle, params, &val, &dir); /* Set period size to 32 frames. */ frames = 32; snd_pcm_hw_params_set_period_size_near(handle, params, &frames, &dir); /* Write the parameters to the driver */ rc = snd_pcm_hw_params(handle, params); if (rc < 0) { fprintf(stderr, "unable to set hw parameters: %s\n", snd_strerror(rc)); exit(1); } /* Use a buffer large enough to hold one period */ snd_pcm_hw_params_get_period_size(params, &frames, &dir); size = frames * 4; /* 2 bytes/sample, 2 channels */ buffer = (char *) malloc(size); /* We want to loop for 5 seconds */ snd_pcm_hw_params_get_period_time(params, &val, &dir); loops = 5000000 / val; while (loops > 0) { loops--; rc = snd_pcm_readi(handle, buffer, frames); if (rc == -EPIPE) { /* EPIPE means overrun */ fprintf(stderr, "overrun occurred\n"); snd_pcm_prepare(handle); } else if (rc < 0) { fprintf(stderr, "error from read: %s\n", snd_strerror(rc)); } else if (rc != (int)frames) { fprintf(stderr, "short read, read %d frames\n", rc); } rc = write(1, buffer, size); if (rc != size) fprintf(stderr, "short write: wrote %d bytes\n", rc); } snd_pcm_drain(handle); snd_pcm_close(handle); free(buffer); return 0; }
// // ConvertingAnImageToGrayscale.h // XFCrystalKitExample // // Created by 付星 on 16/8/19. // Copyright © 2016年 yizzuide. All rights reserved. // #import <UIKit/UIKit.h> @interface ConvertingAnImageToGrayscale : UIView @end
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12). // // Copyright (C) 1997-2019 Steve Nygard. // #import <IDEKit/IDEInspectorAbstractActionProperty.h> @class IDEInspectorKeyPath, NSButton, NSString; @interface IDEInspectorActionButtonProperty : IDEInspectorAbstractActionProperty { IDEInspectorKeyPath *_targetKeyPath; IDEInspectorKeyPath *_titleKeyPath; NSString *_title; SEL _action; NSButton *_button; } - (void).cxx_destruct; @property(retain, nonatomic) NSButton *button; // @synthesize button=_button; - (void)setupRefreshTriggersAndConfigure; - (void)refresh; - (void)broadcastAction:(id)arg1; - (void)refreshTitle:(id)arg1; - (double)baseline; @end
#ifndef NWJS_CONTENT_HOOKS_H #define NWJS_CONTENT_HOOKS_H #include "nw_package.h" #include "third_party/WebKit/public/web/WebNavigationPolicy.h" namespace base { class DictionaryValue; } namespace blink { class WebFrame; class WebLocalFrame; class WebURLRequest; class WebString; } namespace content { class RenderProcessHost; class NotificationDetails; class RenderView; class WebContents; } namespace extensions { class Extension; class ScriptContext; class Dispatcher; class AppWindow; } namespace nw { int MainPartsPreCreateThreadsHook(); void MainPartsPostDestroyThreadsHook(); void ContextCreationHook(blink::WebLocalFrame* frame, extensions::ScriptContext* context); void LoadNWAppAsExtensionHook(base::DictionaryValue* manifest, std::string* error); void DocumentElementHook(blink::WebFrame* frame, const extensions::Extension* extension, const GURL& effective_document_url); void DocumentFinishHook(blink::WebFrame* frame, const extensions::Extension* extension, const GURL& effective_document_url); void RendererProcessTerminatedHook(content::RenderProcessHost* process, const content::NotificationDetails& details); void OnRenderProcessShutdownHook(extensions::ScriptContext* context); void willHandleNavigationPolicy(content::RenderView* rv, blink::WebFrame* frame, const blink::WebURLRequest& request, blink::WebNavigationPolicy* policy, blink::WebString* manifest, bool new_win); void ExtensionDispatcherCreated(extensions::Dispatcher* dispatcher); void CalcNewWinParams(content::WebContents* new_contents, void* params, std::string* nw_inject_js_doc_start, std::string* nw_inject_js_doc_end); } #endif
// vim:ts=4:sw=4:expandtab #pragma once #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <string.h> #include <err.h> #include <xcb/xcb.h> #include <xcb/xcb_atom.h> #include <xcb/xcb_aux.h> #include <xcb/randr.h> #include <xcb/dpms.h> #include <pango/pangocairo.h> #include <cairo/cairo-xcb.h> #include <ev.h>
// AMD AMDUtils code // // Copyright(c) 2017 Advanced Micro Devices, Inc.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. #pragma once #include "ring.h" #include "devicevk.h" // Simulates DX11 style static buffers. For dynamic buffers please see 'DynamicBufferRingDX12.h' // // This class allows suballocating small chuncks of memory from a huge buffer that is allocated on creation // This class is specialized in constant buffers. // class StaticConstantBufferPoolVK { DeviceVK* m_pDevice; RingWithTabs m_mem; VkBuffer m_buffer; VkDeviceMemory m_deviceMemory; std::uint32_t m_totalMemSize; std::uint32_t m_memOffset; char *m_pData; bool m_bUseVidMem; public: void OnCreate(DeviceVK* pDevice, std::uint32_t totalMemSize); void OnDestroy(); bool AllocConstantBuffer(std::uint32_t size, void **pData, VkDescriptorBufferInfo *pOut); void UploadData(VkCommandBuffer cmd_buf); void FreeUploadHeap(); };
#ifndef EDGE_H #define EDGE_H class Vertex; class Edge { public: Edge(Vertex* to, Vertex* from, int weight) : from(from), to(to), weight(weight) {} Vertex* from; Vertex* to; int weight; bool deleted = false; bool bridge = false; bool oriented = true; bool weighted = true; /// Returns the other side of the edge in an undirected graph, /// otherwise nullptr. Edge* reverseEdge(); }; #endif /* EDGE_H */
#ifndef CURRENT_SENSOR_DEVICE_INTERFACE_H #define CURRENT_SENSOR_DEVICE_INTERFACE_H #include "../../../device/deviceInterface.h" #include "../../../device/deviceConstants.h" // List of CURRENT SENSOR COMMAND HEADER /** * Defines the header to read the temperature sensor */ #define COMMAND_READ_CURRENT_SENSOR 'r' /** * Defines the header to set the temperature sensor Alert */ #define COMMAND_SET_CURRENT_SENSOR_ALERT 'w' /** * Interface for Device. */ DeviceInterface* getCurrentSensorDeviceInterface(void); #endif
// Copyright (c) 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 VIRTAUNIQUECOIN_LIMITEDMAP_H #define VIRTAUNIQUECOIN_LIMITEDMAP_H #include <map> #include <deque> /** STL-like map container that only keeps the N elements with the highest value. */ template <typename K, typename V> class limitedmap { public: typedef K key_type; typedef V mapped_type; typedef std::pair<const key_type, mapped_type> value_type; typedef typename std::map<K, V>::const_iterator const_iterator; typedef typename std::map<K, V>::size_type size_type; protected: std::map<K, V> map; typedef typename std::map<K, V>::iterator iterator; std::multimap<V, iterator> rmap; typedef typename std::multimap<V, iterator>::iterator rmap_iterator; size_type nMaxSize; public: limitedmap(size_type nMaxSizeIn = 0) { nMaxSize = nMaxSizeIn; } const_iterator begin() const { return map.begin(); } const_iterator end() const { return map.end(); } size_type size() const { return map.size(); } bool empty() const { return map.empty(); } const_iterator find(const key_type& k) const { return map.find(k); } size_type count(const key_type& k) const { return map.count(k); } void insert(const value_type& x) { std::pair<iterator, bool> ret = map.insert(x); if (ret.second) { if (nMaxSize && map.size() == nMaxSize) { map.erase(rmap.begin()->second); rmap.erase(rmap.begin()); } rmap.insert(make_pair(x.second, ret.first)); } return; } void erase(const key_type& k) { iterator itTarget = map.find(k); if (itTarget == map.end()) return; std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second); for (rmap_iterator it = itPair.first; it != itPair.second; ++it) if (it->second == itTarget) { rmap.erase(it); map.erase(itTarget); return; } // Shouldn't ever get here assert(0); //TODO remove me map.erase(itTarget); } void update(const_iterator itIn, const mapped_type& v) { //TODO: When we switch to C++11, use map.erase(itIn, itIn) to get the non-const iterator iterator itTarget = map.find(itIn->first); if (itTarget == map.end()) return; std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second); for (rmap_iterator it = itPair.first; it != itPair.second; ++it) if (it->second == itTarget) { rmap.erase(it); itTarget->second = v; rmap.insert(make_pair(v, itTarget)); return; } // Shouldn't ever get here assert(0); //TODO remove me itTarget->second = v; rmap.insert(make_pair(v, itTarget)); } size_type max_size() const { return nMaxSize; } size_type max_size(size_type s) { if (s) while (map.size() > s) { map.erase(rmap.begin()->second); rmap.erase(rmap.begin()); } nMaxSize = s; return nMaxSize; } }; #endif
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu), Xiuming Zhang // This file is part of POLARLDA-C. // POLARLDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your // option) any later version. // POLARLDA-C is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA #include "polarlda-inference.h" /* * variational inference * */ double polarlda_inference(document* doc, polarlda_model* model, double* var_gamma, double** phi) { double converged = 1; double phisum = 0, likelihood = 0; double likelihood_old = 0, oldphi[model->num_topics]; int k, n, var_iter; double digamma_gam[model->num_topics]; for (k = 0; k < model->num_topics; k++) { var_gamma[k] = model->alpha + (doc->total/((double) model->num_topics)); digamma_gam[k] = digamma(var_gamma[k]); for (n = 0; n < doc->length; n++) phi[n][k] = 1.0/model->num_topics; } var_iter = 0; while ((converged > VAR_CONVERGED) && ((var_iter < VAR_MAX_ITER) || (VAR_MAX_ITER == -1))) { var_iter++; for (n = 0; n < doc->length; n++) { phisum = 0; // compute variational multinomial for (k = 0; k < model->num_topics; k++) { oldphi[k] = phi[n][k]; if (doc->polarities[n]) { phi[n][k] = digamma_gam[k] + model->log_prob_w[k][doc->words[n]] + model->log_prob_pos[k][doc->words[n]]; } else { phi[n][k] = digamma_gam[k] + model->log_prob_w[k][doc->words[n]] + log(1 - exp(model->log_prob_pos[k][doc->words[n]])); } if (k > 0) phisum = log_sum(phisum, phi[n][k]); else phisum = phi[n][k]; // note, phi is in log space } // compute variational dirichlet for (k = 0; k < model->num_topics; k++) { phi[n][k] = exp(phi[n][k] - phisum); // normalize phi // intialization of var_gamma and this update rule gaurantee the update eqn in paper var_gamma[k] += doc->counts[n] * (phi[n][k] - oldphi[k]); assert(var_gamma[k] > 0); // Dirichlet parameters > 0 // !!! a lot of extra digamma's here because of how we're computing it // !!! but its more automatically updated too. digamma_gam[k] = digamma(var_gamma[k]); } } likelihood = compute_likelihood(doc, model, phi, var_gamma); assert(!isnan(likelihood)); converged = (likelihood_old - likelihood) / likelihood_old; likelihood_old = likelihood; // printf("[LDA INF] %8.5f %1.3e\n", likelihood, converged); } return(likelihood); } /* * compute likelihood bound * */ double compute_likelihood(document* doc, polarlda_model* model, double** phi, double* var_gamma) { double likelihood = 0, digsum = 0, var_gamma_sum = 0, dig[model->num_topics]; int k, n; for (k = 0; k < model->num_topics; k++) { dig[k] = digamma(var_gamma[k]); var_gamma_sum += var_gamma[k]; } digsum = digamma(var_gamma_sum); likelihood = lgamma(model->alpha * model->num_topics) - model->num_topics * lgamma(model->alpha) - lgamma(var_gamma_sum); assert(!isnan(likelihood)); for (k = 0; k < model->num_topics; k++) { likelihood += (model->alpha - 1) * (dig[k] - digsum) + lgamma(var_gamma[k]) - (var_gamma[k] - 1) * (dig[k] - digsum); assert(!isnan(likelihood)); for (n = 0; n < doc->length; n++) { if (phi[n][k] > 0) { likelihood += doc->counts[n] * phi[n][k] * ((dig[k] - digsum) - log(phi[n][k]) + model->log_prob_w[k][doc->words[n]]); assert(!isnan(likelihood)); // assert(exp(model->log_prob_pos[k][doc->words[n]]) > 0 && exp(model->log_prob_pos[k][doc->words[n]]) < 1); // polarity's contributions to likelihood if (doc->polarities[n]) { likelihood += doc->counts[n] * phi[n][k] * model->log_prob_pos[k][doc->words[n]]; } else { likelihood += doc->counts[n] * phi[n][k] * log(1 - exp(model->log_prob_pos[k][doc->words[n]])); } assert(!isnan(likelihood)); } } } return(likelihood); }
#ifndef __CORPUS_H #define __CORPUS_H #include <fstream> #include <sstream> #include <string> #include <vector> #include <unordered_map> #include "types.h" using std::vector; using std::string; using std::unordered_map; class Corpus { public: Corpus(const char *vocabPath, const char *dataPath); Corpus(const Corpus &from, int start, int end); // this is wdn, store words in each document vector<vector<TWord>> dw; vector<string> vocab; unordered_map<string, TWord> word2id; TDoc D; TWord W; TSize T; }; #endif
/********************************************************************* ** Copyright (C) 2003 Terabit Pty Ltd. All rights reserved. ** ** This file is part of the POSIX-Proactor module. ** ** ** ** ** ** ** ** **********************************************************************/ // ============================================================================ // // // = AUTHOR // Alexander Libman <libman@terabit.com.au> // // ============================================================================ #ifndef ACE_TESTS_U_TEST_H #define ACE_TESTS_U_TEST_H #include "ProactorTask.h" #include "Asynch_RW.h" #include "ace/INET_Addr.h" #include "ace/SString.h" class DOwner; // ************************************************************* // Datagram session // ************************************************************* class DSession : public ACE_Service_Handler { friend class DOwner; public: DSession (DOwner & owner, int index, const ACE_TCHAR * name); ~DSession (void); virtual int on_open (const ACE_INET_Addr & local, const ACE_INET_Addr & remote) =0; virtual int on_data_received (ACE_Message_Block & mb, const ACE_INET_Addr & addr) = 0; virtual int on_data_sent (ACE_Message_Block & mb, const ACE_INET_Addr & addr) = 0; const ACE_TCHAR * get_name (void) const { return name_.c_str(); } size_t get_total_snd (void) { return this->total_snd_; } size_t get_total_rcv (void) { return this->total_rcv_; } long get_total_w (void) { return this->total_w_; } long get_total_r (void) { return this->total_r_; } int get_pending_r_ (void) { return this->io_count_r_; } int get_pending_w_ (void) { return this->io_count_w_; } int index (void) { return this->index_;} void print_address (const ACE_Addr& address); int open (const ACE_INET_Addr & local, const ACE_INET_Addr & remote); protected: /// This is called when asynchronous <read> operation from the /// socket completes. virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result); /// This is called when an asynchronous <write> to the socket /// completes. virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result); /// This is called when an asynchronous <write> to the socket /// completes. virtual void handle_user_operation(const ACE_Asynch_User_Result& result); void cancel (); void close (); int initiate_read (void); int initiate_write(ACE_Message_Block &mb, const ACE_INET_Addr & addr); int post_message (void); ACE_TString name_; DOwner & owner_; int index_; Asynch_RW_Dgram stream_; ACE_SYNCH_MUTEX lock_; int io_count_r_; // Number of currently outstanding I/O reads int io_count_w_; // Number of currently outstanding I/O writes int post_count_; // Number of currently posted messages size_t total_snd_; // Number of bytes successfully sent size_t total_rcv_; // Number of bytes successfully received long total_w_; // Number of write operations long total_r_; // Number of read operations }; // ************************************************************* // Receiver // ************************************************************* class Receiver : public DSession { //friend class Bridge; public: Receiver (DOwner & owner, int index); ~Receiver (void); virtual int on_open (const ACE_INET_Addr & local, const ACE_INET_Addr & remote); virtual int on_data_received (ACE_Message_Block & mb, const ACE_INET_Addr & addr); virtual int on_data_sent (ACE_Message_Block & mb, const ACE_INET_Addr & addr); }; // ************************************************************* // Sender // ************************************************************* class Sender : public DSession { //friend class Connector; public: Sender (DOwner & owner, int index); ~Sender (void); virtual int on_open (const ACE_INET_Addr & local, const ACE_INET_Addr & remote); virtual int on_data_received (ACE_Message_Block & mb, const ACE_INET_Addr & addr); virtual int on_data_sent (ACE_Message_Block & mb, const ACE_INET_Addr & addr); }; // ************************************************************* // Datagram sessions owner // ************************************************************* class DOwner { friend class DSession; public: int get_number_connections (void) const { return this->connections_; } size_t get_total_snd (void) const { return this->total_snd_; } size_t get_total_rcv (void) const { return this->total_rcv_; } long get_total_w (void) const { return this->total_w_; } long get_total_r (void) const { return this->total_r_; } ProactorTask & task (void) const { return task_;} DOwner (ProactorTask &task); virtual ~DOwner (void); int start_sender(const ACE_INET_Addr & remote); int start_receiver(const ACE_INET_Addr & local); void stop (void); void cancel_all (void); void post_all (void); void on_new_session (DSession & session); void on_delete_session (DSession & session); private: ProactorTask & task_; ACE_SYNCH_RECURSIVE_MUTEX lock_; u_int connections_; DSession * list_connections_[MAX_CONNECTIONS]; size_t total_snd_; size_t total_rcv_; long total_w_; long total_r_; int flg_cancel_; }; #endif // ACE_TESTS_U_TEST_H
// // MDBaseRequest.h // MadeInChinaDemo // // Created by mac on 16/1/13. // Copyright © 2016年 Onego. All rights reserved. // #import <MadeInChina/MadeInChina.h> #import <MICHttpRequestForThirdnet.h> @interface MDBaseRequest : MICHttpRequestForThirdnet /** * 服务地址 */ + (NSString *)getServiceAddress; - (NSString *)getServiceAddress; /** * 应用授权码 */ + (NSString *)getApplicationKey; - (NSString *)getApplicationKey; @end
/** * Interface GameController * @author Patricio Ferreira <3dimentionar@gmail.com> * Copyright (c) 2017 nahuelio. All rights reserved. **/ #ifndef GAME_GAMECONTROLLER_H #define GAME_GAMECONTROLLER_H #include "Controller.h" #include "../game/headers/ShaderController.h" namespace game_controller { class GameController : public Controller { static GameController *_instance; public: GameController(); ShaderController *shaderController; virtual GameController *initialize(); virtual GameController *bindings(); virtual GameController *loadShaders(); virtual GameController *start(); virtual Controller *run(); static GameController *instance(); }; } #endif //GAME_GAMECONTROLLER_H
#include <SDL2/SDL_keyboard.h> #include <SDL2/SDL_scancode.h> #include <SDL2/SDL_stdinc.h> #include <mruby.h> #include <mruby/class.h> #include <mrgss/mrgss.h> #include <mrgss/mrgss_keyboard.h> /* Maximun amount of keys in the */ #define MAX_KEYS 512 /** * buffers */ static char press[MAX_KEYS]; static char trigger[MAX_KEYS]; static char release[MAX_KEYS]; static char repeat[MAX_KEYS]; static mrb_int time[MAX_KEYS]; /* * Update */ static mrb_value input_update(mrb_state *mrb, mrb_int capa) { int i = 0; const Uint8* currentKeyStates; int max_states = MAX_KEYS; /* used to prevent overflows */ currentKeyStates = SDL_GetKeyboardState(&max_states); for (i; i < MAX_KEYS && i < max_states; ++i) { trigger[i] = !press[i] && currentKeyStates[i]; release[i] = press[i] && !currentKeyStates[i]; press[i] = currentKeyStates[i]; time[i] = press[i] ? time[i] + 1 : 0; repeat[i] = time[i] % 2 == 0; } return mrb_nil_value(); } /* * trigger */ static mrb_value input_trigger (mrb_state *mrb, mrb_int capa) { mrb_int key; mrb_get_args (mrb, "i", &key); if (key < 0 || key >= MAX_KEYS) { return mrb_nil_value(); } return trigger[key] == TRUE ? mrb_true_value () : mrb_false_value (); } /* * press */ static mrb_value input_press (mrb_state *mrb, mrb_int capa) { mrb_int key; mrb_get_args (mrb, "i", &key); if (key < 0 || key >= MAX_KEYS) { return mrb_nil_value(); } return press[key] == TRUE ? mrb_true_value () : mrb_false_value (); } /* * release */ static mrb_value input_release (mrb_state *mrb, mrb_int capa) { mrb_int key; mrb_get_args (mrb, "i", &key); if (key < 0 || key >= MAX_KEYS) { return mrb_nil_value(); } return release[key] == TRUE ? mrb_true_value () : mrb_false_value (); } /* * repeat */ static mrb_value input_repeat (mrb_state *mrb, mrb_int capa) { mrb_int key; mrb_get_args (mrb, "i", &key); if (key < 0 || key >= MAX_KEYS) { return mrb_nil_value(); } return repeat[key] == TRUE ? mrb_true_value () : mrb_false_value (); } /* * time */ static mrb_value input_time (mrb_state *mrb, mrb_int capa) { mrb_int key; mrb_get_args (mrb, "i", &key); if (key < 0 || key >= MAX_KEYS) { return mrb_nil_value(); } return mrb_fixnum_value (time[key]); } /** * Initialize mruby class */ void mrgss_keyboard_init(mrb_state *mrb) { struct RClass *hw = mrb_define_module_under(mrb, mrgss_module(),"Keyboard"); mrb_define_class_method(mrb, hw, "update", (mrb_func_t) input_update, MRB_ARGS_NONE()); mrb_define_class_method(mrb, hw, "trigger?", (mrb_func_t) input_trigger, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, hw, "press?", (mrb_func_t) input_press, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, hw, "release?", (mrb_func_t) input_release, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, hw, "repeat?", (mrb_func_t) input_repeat, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, hw, "press_time", (mrb_func_t) input_time, MRB_ARGS_REQ(1)); }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" #import "NSCopying-Protocol.h" @class NSMutableArray, NSString; @interface PBXFindOptionsSet : NSObject <NSCopying> { NSString *_name; struct { unsigned int searchOpenFiles:1; unsigned int searchOpenProjects:1; unsigned int whichProjectFiles:2; unsigned int projectFilesOrFrameworks:2; unsigned int fileFilterType:2; unsigned int searchFilesAndFolders:1; unsigned int searchIncludedFiles:1; unsigned int _RESERVED:22; } _fosFlags; NSMutableArray *_positiveNamePatternsArray; NSMutableArray *_negativeNamePatternsArray; NSMutableArray *_searchFilesArray; } + (id)regularExpressionForPattern:(id)arg1; + (void)removeNamePattern:(id)arg1; + (void)addNamePattern:(id)arg1; + (void)replaceNamePatternAtIndex:(unsigned long long)arg1 withNamePattern:(id)arg2; + (id)namePatterns; + (void)_readNamePatterns; + (void)_writeNamePatterns; + (long long)indexOfOptionsSet:(id)arg1; + (void)removeGlobalFindOptionsSet:(id)arg1; + (void)addGlobalFindOptionSet:(id)arg1; + (id)globalFindOptionsSetWithName:(id)arg1; + (id)globalFindOptionsSets; + (void)_readGlobalSets; + (void)_writeGlobalSets; - (id)searchFiles; - (void)replaceSearchFileAtIndex:(long long)arg1 WithSearchFile:(id)arg2; - (void)removeSearchFiles:(id)arg1; - (void)addSearchFiles:(id)arg1; - (void)removeNegativeNamePattern:(id)arg1; - (void)addNegativeNamePattern:(id)arg1; - (id)negativeNamePatterns; - (void)removePositiveNamePattern:(id)arg1; - (void)addPositiveNamePattern:(id)arg1; - (id)positiveNamePatterns; - (void)setFileFilterType:(int)arg1; - (int)fileFilterType; - (void)setProjectFindCandidates:(int)arg1; - (int)projectFindCandidates; - (void)setProjectFindScope:(int)arg1; - (int)projectFindScope; - (void)setFindInOpenProjects:(BOOL)arg1; - (BOOL)findInOpenProjects; - (void)setFindInFilesAndFolders:(BOOL)arg1; - (BOOL)findInFilesAndFolders; - (void)setFindInOpenFiles:(BOOL)arg1; - (BOOL)findInOpenFiles; - (void)setFindInIncludedFiles:(BOOL)arg1; - (BOOL)findInIncludedFiles; - (void)setName:(id)arg1; - (id)name; - (void)didChange; - (long long)compare:(id)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)mutableCopyWithZone:(struct _NSZone *)arg1; - (void)dealloc; - (id)init; - (void)readPropertyListRepresentation:(id)arg1; - (id)propertyListRepresentation; @end
/* This file is part of the MicroPython project, http://micropython.org/ * MIT License; Copyright (c) 2021 Damien P. George */ // STM32F407VET6 Mini by VCC-GND Studio // http://vcc-gnd.com/ // https://item.taobao.com/item.htm?ft=t&id=523361737493 // https://www.aliexpress.com/wholesale?SearchText=STM32F407VET6+Mini // DFU mode can be accessed by switching BOOT0 DIP ON (towards USB) #define MICROPY_HW_BOARD_NAME "VCC-GND STM32F407VE" #define MICROPY_HW_MCU_NAME "STM32F407VE" #define MICROPY_HW_FLASH_FS_LABEL "VCCGNDF407VE" // 1 = use internal flash (512 KByte) // 0 = use external SPI flash #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1) #define MICROPY_HW_HAS_FLASH (1) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_DAC (1) #define MICROPY_HW_ENABLE_USB (1) #define MICROPY_HW_ENABLE_SDCARD (1) // HSE is 25MHz #define MICROPY_HW_CLK_PLLM (25) // divide external clock by this to get 1MHz #define MICROPY_HW_CLK_PLLN (336) // PLL clock in MHz #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2) // divide PLL clock by this to get core clock #define MICROPY_HW_CLK_PLLQ (7) // divide core clock by this to get 48MHz // The board has a 32kHz crystal for the RTC #define MICROPY_HW_RTC_USE_LSE (1) #define MICROPY_HW_RTC_USE_US (0) // #define MICROPY_HW_RTC_USE_CALOUT (1) // turn on/off PC13 512Hz output // USART1 #define MICROPY_HW_UART1_TX (pin_A9) // PA9,PB6 #define MICROPY_HW_UART1_RX (pin_A10) // PA10,PB7 // USART2 #define MICROPY_HW_UART2_TX (pin_A2) // PA2,PD5 #define MICROPY_HW_UART2_RX (pin_A3) // PA3,PD6 #define MICROPY_HW_UART2_RTS (pin_A1) // PA1,PD4 #define MICROPY_HW_UART2_CTS (pin_A0) // PA0,PD3 // USART3 #define MICROPY_HW_UART3_TX (pin_D8) // PB10,PC10,PD8 #define MICROPY_HW_UART3_RX (pin_D9) // PB11,PC11,PD9 #define MICROPY_HW_UART3_RTS (pin_D12) // PB14,PD12 #define MICROPY_HW_UART3_CTS (pin_D11) // PB13,PD11 // UART4 #define MICROPY_HW_UART4_TX (pin_A0) // PA0,PC10 #define MICROPY_HW_UART4_RX (pin_A1) // PA1,PC11 // UART5 #define MICROPY_HW_UART5_TX (pin_C12) // PC12 #define MICROPY_HW_UART5_RX (pin_D2) // PD2 // USART6 #define MICROPY_HW_UART6_TX (pin_C6) // PC6,PG14 #define MICROPY_HW_UART6_RX (pin_C7) // PC7,PG9 // I2C buses #define MICROPY_HW_I2C1_SCL (pin_B6) // PB8,PB6 #define MICROPY_HW_I2C1_SDA (pin_B7) // PB9,PB7 #define MICROPY_HW_I2C2_SCL (pin_B10) // PB10 #define MICROPY_HW_I2C2_SDA (pin_B11) // PB11 #define MICROPY_HW_I2C3_SCL (pin_A8) // PA8 #define MICROPY_HW_I2C3_SDA (pin_C9) // PC9 // AT24C08 EEPROM on I2C1 0x50-0x53 // I2S buses // I2S2_CK PB13 // I2S2_MCK PC6 // I2S2_SD PB15 // I2S2_WS PB12 // I2S3_CK PB3 // I2S3_MCK PC7 // I2S3_SD PB5 // I2S3_WS PA15 // SPI buses #define MICROPY_HW_SPI1_NSS (pin_A4) // PA4 #define MICROPY_HW_SPI1_SCK (pin_A5) // PA5,PB3 #define MICROPY_HW_SPI1_MISO (pin_A6) // PA6,PB4 #define MICROPY_HW_SPI1_MOSI (pin_A7) // PA7,PB5 #define MICROPY_HW_SPI2_NSS (pin_B12) // PB12 #define MICROPY_HW_SPI2_SCK (pin_B13) // PB13 #define MICROPY_HW_SPI2_MISO (pin_B14) // PB14 #define MICROPY_HW_SPI2_MOSI (pin_B15) // PB15 #define MICROPY_HW_SPI3_NSS (pin_A15) // PA15 #define MICROPY_HW_SPI3_SCK (pin_B3) // PB3 #define MICROPY_HW_SPI3_MISO (pin_B4) // PB4 #define MICROPY_HW_SPI3_MOSI (pin_B5) // PB5 // CAN buses #define MICROPY_HW_CAN1_TX (pin_B9) // PB9,PD1,PA12 #define MICROPY_HW_CAN1_RX (pin_B8) // PB8,PD0,PA11 #define MICROPY_HW_CAN2_TX (pin_B13) // PB13 #define MICROPY_HW_CAN2_RX (pin_B12) // PB12 // DAC // DAC_OUT1 PA4 // DAC_OUT2 PA5 // LEDs #define MICROPY_HW_LED1 (pin_B9) // blue #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin)) #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin)) // If using external SPI flash #if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE // The board does not have onboard SPI flash. You need to add an external one. #define MICROPY_HW_SPIFLASH_SIZE_BITS (4 * 1024 * 1024) // W25X40 - 4 Mbit (512 KByte) // #define MICROPY_HW_SPIFLASH_SIZE_BITS (32 * 1024 * 1024) // W25Q32 - 32 Mbit (4 MByte) // #define MICROPY_HW_SPIFLASH_SIZE_BITS (64 * 1024 * 1024) // W25Q64 - 64 Mbit (8 MByte) // #define MICROPY_HW_SPIFLASH_SIZE_BITS (128 * 1024 * 1024) // W25Q128 - 128 Mbit (16 MByte) #define MICROPY_HW_SPIFLASH_CS (pin_A4) // also in board_init.c #define MICROPY_HW_SPIFLASH_SCK (pin_A5) #define MICROPY_HW_SPIFLASH_MISO (pin_A6) #define MICROPY_HW_SPIFLASH_MOSI (pin_A7) #define MICROPY_BOARD_EARLY_INIT VCC_GND_F407VE_board_early_init void VCC_GND_F407VE_board_early_init(void); extern const struct _mp_spiflash_config_t spiflash_config; extern struct _spi_bdev_t spi_bdev; #define MICROPY_HW_BDEV_IOCTL(op, arg) ( \ (op) == BDEV_IOCTL_NUM_BLOCKS ? (MICROPY_HW_SPIFLASH_SIZE_BITS / 8 / FLASH_BLOCK_SIZE) : \ (op) == BDEV_IOCTL_INIT ? spi_bdev_ioctl(&spi_bdev, (op), (uint32_t)&spiflash_config) : \ spi_bdev_ioctl(&spi_bdev, (op), (arg)) \ ) #define MICROPY_HW_BDEV_READBLOCKS(dest, bl, n) spi_bdev_readblocks(&spi_bdev, (dest), (bl), (n)) #define MICROPY_HW_BDEV_WRITEBLOCKS(src, bl, n) spi_bdev_writeblocks(&spi_bdev, (src), (bl), (n)) #endif // SD card detect switch #define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8) #define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP) #define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET) // 1 - PC10 - DAT2/RES // 2 - PC11 - CD/DAT3/CS // 3 - PD2 - CMD/DI // 4 - VCC - VDD // 5 - PC12 - CLK/SCLK // 6 - GND - VSS // 7 - PC8 - DAT0/D0 // 8 - PC9 - DAT1/RES // 9 SW2 - GND // 10 SW1 - PA8 // USB config #define MICROPY_HW_USB_FS (1) // #define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9) // #define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
// // gd-proto // Copyright (c) 2015 Borislav Stanimirov // // Distributed under the MIT Software License // See accompanying file LICENSE.txt or copy at // http://opensource.org/licenses/MIT // // Main profiling macros #pragma once #define GDPROTO_PERF_PROFILING_ON 1 #if GDPROTO_PERF_PROFILING_ON #include "PerfProfilerSection.h" // profiles a function // use this macro at the beginning of a function # define GDPROTO_PROFILE_FUNC() ::gdproto::PerfProfilerSection __gdprotoProfilerSection(__FUNCTION__) # define GDPROTO_PROFILE_FUNC_FOR(ProfilerId) ::gdproto::PerfProfilerSection __gdprotoProfilerSection(__FUNCTION__, ProfilerId) // profiles a scope with a label # define GDPROTO_PROFILE_SCOPE(Label) ::gdproto::PerfProfilerSection __gdprotoProfilerSection ## __LINE__(Label) # define GDPROTO_PROFILE_SCOPE_FOR(Label, ProfilerId) ::gdproto::PerfProfilerSection __gdprotoProfilerSection ## __LINE__(Label, ProfilerId) #else # #endif
// // QueueDestroyer.h // // Created by Craig Fortune on 04/08/2012. // #import <Foundation/Foundation.h> #import "box2d.h" // Base that that provides singleton management // and simple queue management @interface CFQueueDestroyer : NSObject // There isn't an NSQueue class, but an NSMutableArray // serves our needs just fine @property (retain) NSMutableArray* destroyQueueArr; // Singleton creation and destruction + (CFQueueDestroyer*) singleton; + (void) destroy; // Simple default interface for adding and emptying // the queue - (BOOL) addToQueue:(id)object; // emptyQueue should be done upon every simulation // update if possible/sensible to do so - (BOOL) emptyQueue; @end
// // PDFReaderBookDelegate.h // // Copyright (C) 2011-2013 Julius Oklamcak. All rights reserved. // Portions (C) 2014 Mark Eissler. 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> @interface PDFReaderBookDelegate : NSObject <UIApplicationDelegate> @end
#pragma once #include "Common/primitive_type.h" #include "Math/TVector3.h" #include "FileIO/SDL/TCommandInterface.h" #include "Core/Texture/TTexture.h" #include "Core/Quantity/SpectralStrength.h" #include "Core/Texture/TConstantTexture.h" #include <iostream> #include <memory> namespace ph { class CookingContext; class InputPacket; class Image : public TCommandInterface<Image> { public: Image(); virtual ~Image() = default; virtual std::shared_ptr<TTexture<real>> genTextureReal( CookingContext& context) const; virtual std::shared_ptr<TTexture<Vector3R>> genTextureVector3R( CookingContext& context) const; virtual std::shared_ptr<TTexture<SpectralStrength>> genTextureSpectral( CookingContext& context) const; private: template<typename OutputType> inline std::shared_ptr<TTexture<OutputType>> genDefaultTexture() const { std::cerr << "warning: at Image::genTexture(), " << "no implementation provided, generating a constant one" << std::endl; return std::make_shared<TConstantTexture<OutputType>>(OutputType(1)); } // command interface public: explicit Image(const InputPacket& packet); static SdlTypeInfo ciTypeInfo(); static void ciRegister(CommandRegister& cmdRegister); static void registerMathFunctions(CommandRegister& cmdRegister); }; }// end namespace ph #include "Actor/Image/Image.ipp" /* <SDL_interface> <category> image </category> <type_name> image </type_name> <name> Image </name> <description> A block of data. </description> </SDL_interface> */
// // DYMovieVController.h // LoveMovie // // Created by xudingyang on 16/5/13. // Copyright © 2016年 许定阳. All rights reserved. // #import <UIKit/UIKit.h> @interface DYMovieVController : UIViewController @end
// // AMGolTableViewCell.h // aMenjar // // Created by Mauro Vime Castillo on 12/9/14. // Copyright (c) 2014 Mauro Vime Castillo. All rights reserved. // #import <UIKit/UIKit.h> @interface AMGolTableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIImageView *foto; @property (weak, nonatomic) IBOutlet UILabel *plato; @end
#ifndef __CAMERA_H__ #define __CAMERA_H__ #include "Object.h" #include <glm/glm.hpp> /** @ingroup game * @{ */ /// A camera through which the world can be rendered. class Camera : public Object { public: /// Create new camera. Camera(); /// Destructor virtual ~Camera() { } /// Get the direction in which the camera is currently facing. /** * @return The direction in which the camera is currently facing */ glm::vec3 forward() const; /// Get the direction to the right of the camera. /** * @return The direction to the right of the camera */ glm::vec3 right() const; /// Get the camera's up-vector. /** * @return The camera's up-vector */ glm::vec3 up() const; /// Get the camera's view matrix (translation and orientation). /** * @return The view matrix */ glm::mat4 view() const; /// Get field of view. /** * Default: 45.0 * @return Field of view (in degrees, 0.0-180.0) */ float fieldOfView() const; /// Set field of view. /** * @param fieldOfView Field of view (in degrees, 0.0-180.0) */ void setFieldOfView(float fieldOfView); /// Get near plane. /** * Default: 0.1 * @return Near plane */ float nearPlane() const; /// Get far plane. /** * Default: 100.0 * @return Far plane */ float farPlane() const; /// Set near and far planes. /** * @param near Near plane. * @param far Far plane. */ void setNearAndFarPlanes(float near, float far); /// Get the projection matrix. /** * @param width Width of context to render to. * @param height Height of context to render to. * @return Projection matrix */ glm::mat4 projection(int width, int height) const; private: float _fieldOfView = 45.f; float zNear = 0.1f; float zFar = 100.f; }; /** @} */ #endif
// // TrainingLevelSectionTableViewCell.h // HighCBar // // Created by shadow on 14-7-25. // Copyright (c) 2014年 genio. All rights reserved. // #import <UIKit/UIKit.h> @interface TrainingLevelSectionTableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIImageView *iconImageView; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @end
/* * Copyright (C) 2011 Philippe Gerum <rpm@xenomai.org>. * * Xenomai is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Xenomai 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 Xenomai; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef _XENO_ASM_SH_BITS_INIT_H #define _XENO_ASM_SH_BITS_INIT_H #ifndef __KERNEL__ #error "Pure kernel header included from user-space!" #endif #include <linux/init.h> #include <asm/xenomai/calibration.h> #include <asm-generic/xenomai/bits/timeconv.h> int xnarch_escalation_virq; int xnpod_trap_fault(xnarch_fltinfo_t *fltinfo); void xnpod_schedule_handler(void); static rthal_trap_handler_t xnarch_old_trap_handler; static int xnarch_trap_fault(unsigned event, rthal_pipeline_stage_t *stage, void *data) { xnarch_fltinfo_t fltinfo; fltinfo.exception = event; fltinfo.regs = data; return xnpod_trap_fault(&fltinfo); } unsigned long xnarch_calibrate_timer(void) { /* * Compute the time needed to program the dedicated hrtimer. * The return value is expressed in hrclock counter unit. */ return xnarch_ns_to_tsc(rthal_timer_calibrate()); } int xnarch_calibrate_sched(void) { nktimerlat = xnarch_calibrate_timer(); if (nktimerlat == 0) return -ENODEV; nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; return 0; } static inline int xnarch_init(void) { int ret; ret = rthal_init(); if (ret) return ret; xnarch_init_timeconv(RTHAL_CLOCK_FREQ); ret = xnarch_calibrate_sched(); if (ret) return ret; xnarch_escalation_virq = rthal_alloc_virq(); if (xnarch_escalation_virq == 0) return -ENOSYS; rthal_virtualize_irq(&rthal_domain, xnarch_escalation_virq, (rthal_irq_handler_t) &xnpod_schedule_handler, NULL, NULL, IPIPE_HANDLE_MASK | IPIPE_WIRED_MASK); xnarch_old_trap_handler = rthal_trap_catch(&xnarch_trap_fault); return 0; } static inline void xnarch_exit(void) { rthal_trap_catch(xnarch_old_trap_handler); rthal_virtualize_irq(&rthal_domain, xnarch_escalation_virq, NULL, NULL, NULL, 0); rthal_free_virq(xnarch_escalation_virq); rthal_exit(); } #endif /* !_XENO_ASM_SH_BITS_INIT_H */
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: android/libcore/luni/src/main/java/org/apache/harmony/security/pkcs7/SignedData.java // #ifndef _OrgApacheHarmonySecurityPkcs7SignedData_H_ #define _OrgApacheHarmonySecurityPkcs7SignedData_H_ #include "J2ObjC_header.h" @class OrgApacheHarmonySecurityAsn1ASN1Sequence; @protocol JavaUtilList; /*! @author Boris Kuznetsov @version $Revision$ */ /*! @brief As defined in PKCS #7: Cryptographic Message Syntax Standard (http://www.ietf.org/rfc/rfc2315.txt) SignedData ::= SEQUENCE { version Version, digestAlgorithms DigestAlgorithmIdentifiers, contentInfo ContentInfo, certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL, crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, signerInfos SignerInfos } */ @interface OrgApacheHarmonySecurityPkcs7SignedData : NSObject #pragma mark Public - (id<JavaUtilList>)getCertificates; - (id<JavaUtilList>)getCRLs; - (id<JavaUtilList>)getSignerInfos; - (jint)getVersion; - (NSString *)description; @end J2OBJC_STATIC_INIT(OrgApacheHarmonySecurityPkcs7SignedData) FOUNDATION_EXPORT OrgApacheHarmonySecurityAsn1ASN1Sequence *OrgApacheHarmonySecurityPkcs7SignedData_ASN1_; J2OBJC_STATIC_FIELD_GETTER(OrgApacheHarmonySecurityPkcs7SignedData, ASN1_, OrgApacheHarmonySecurityAsn1ASN1Sequence *) J2OBJC_TYPE_LITERAL_HEADER(OrgApacheHarmonySecurityPkcs7SignedData) #endif // _OrgApacheHarmonySecurityPkcs7SignedData_H_
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Styling/SlateStyle.h" /** */ class FLuaDebuggerStyle { public: static void Initialize(); static void Shutdown(); /** reloads textures used by slate renderer */ static void ReloadTextures(); /** @return The Slate style set for the Shooter game */ static const ISlateStyle& Get(); static FName GetStyleSetName(); private: static TSharedRef< class FSlateStyleSet > Create(); private: static TSharedPtr< class FSlateStyleSet > StyleInstance; };
// // AppDelegate.h // PXCOCHelper // // Created by peixinchen on 15-4-18. // Copyright (c) 2015年 peixinchen. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // StandViewController.h // Stand for Something // // Created by Alper Cugun on 12/8/13. // Copyright (c) 2014 Hubbub. All rights reserved. // #import <UIKit/UIKit.h> #import <CoreMotion/CoreMotion.h> #import <CoreLocation/CoreLocation.h> #import <AudioToolbox/AudioToolbox.h> #import <Social/Social.h> #import <MapKit/MapKit.h> #import "StandManager.h" #import "NSDictionary+URLEncoding.h" #import "OpenInBrowserActivity.h" #import "CopyLinkToPasteboardActivity.h" @interface StandViewController : UIViewController <CLLocationManagerDelegate, UITextFieldDelegate> @property (strong) CLLocationManager *locationManager; // TODO remove currentLocation? @property (strong) CLLocation *currentLocation; @property (strong) StandManager *standManager; @property (strong) NSURLSession *urlSession; @property (strong) NSBlockOperation *requestOperation; @property (strong) CMMotionManager *motionManager; @property (assign) double smoothX; @property (assign) double smoothY; @property (assign) double smoothZ; typedef NS_ENUM(NSInteger, StandingState) { StandingBefore, StandingDuring, StandingGraceMovement, StandingGraceTouch, StandingDone, DontAllowStart }; // Object where we store all touches on the correct view over their lifetime @property (strong) NSMutableSet *currentTouches; @property (assign) StandingState standingState; @property (strong) NSDate *startTime; @property (strong) NSDate *endTime; @property (strong) NSTimer *secondTimer; // Seconds the app has been in grace and which are deducted from the time actually standing @property (assign) double pauseSeconds; @property (strong) NSTimer *graceTimer; @property (strong) NSDate *graceStart; @property (strong) IBOutlet UIView *containerView; @property (strong) UIView *startView; @property (strong) UIView *standingView; @property (strong) UIView *graceView; @property (strong) UIView *doneView; // Start view controls @property (strong) IBOutlet UIImageView *startButton; @property (strong) IBOutlet UIButton *helpButton; @property (strong) IBOutlet UITextField *textField; @property (strong) IBOutlet UIView *helpView; @property (strong) IBOutlet UIButton *howToButton; @property (strong) IBOutlet UIButton *aboutButton; @property (strong) IBOutlet UIButton *closeHelpButton; // Standing view controls @property (strong) IBOutlet UILabel *standingText; @property (strong) IBOutlet UILabel *standingHoursL; @property (strong) IBOutlet UILabel *standingHoursR; @property (strong) IBOutlet UILabel *standingMinutesL; @property (strong) IBOutlet UILabel *standingMinutesR; @property (strong) IBOutlet UILabel *standingSecondsL; @property (strong) IBOutlet UILabel *standingSecondsR; // Grace view controls @property (strong) IBOutlet UIImageView *graceButton; @property (strong) IBOutlet UILabel *countdownLabel; @property (strong) IBOutlet UIButton *doneButton; // Done view controls @property (strong) IBOutlet MKMapView *mapView; @property (strong) IBOutlet UILabel *doneText; @property (strong) IBOutlet UIButton *tweetButton; @property (strong) IBOutlet UIButton *shareButton; @property (strong) IBOutlet UIButton *againButton; - (void)startStanding; @end
/*========================================================== * Copyright 2017 Institute for X-ray Physics (University of Göttingen) * * 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. *========================================================*/ void symmetry(double*, double*, double, double, int, int);
#pragma once #include "Exps.h" #include "Stms.h" #include "CLabel.h" namespace IRTTRANSLATOR { using IRT::TBINOP; using IRT::TCJUMP; using IRT::CLabel; using IRT::CTemp; using IRT::IExp; using IRT::IStm; using IRT::CCONST; using IRT::CNAME; using IRT::CTEMP; using IRT::CBINOP; using IRT::CMEM; using IRT::CCALL; using IRT::CESEQ; using IRT::CMOVE; using IRT::CEXP; using IRT::CJUMP; using IRT::CCJUMP; using IRT::CSEQ; using IRT::CLABEL; class ITranslator { public: virtual IExp *unEx() const = 0; virtual IStm *unNx() const = 0; virtual IStm *unCx( CLabel *ifTrue, CLabel *ifFalse ) const = 0; }; }
// // Copyright 2009-2011 Facebook // // 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. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface UIView (TTCategory) /** * Shortcut for frame.origin.x. * * Sets frame.origin.x = left */ @property (nonatomic) CGFloat left; /** * Shortcut for frame.origin.y * * Sets frame.origin.y = top */ @property (nonatomic) CGFloat top; /** * Shortcut for frame.origin.x + frame.size.width * * Sets frame.origin.x = right - frame.size.width */ @property (nonatomic) CGFloat right; /** * Shortcut for frame.origin.y + frame.size.height * * Sets frame.origin.y = bottom - frame.size.height */ @property (nonatomic) CGFloat bottom; /** * Shortcut for frame.size.width * * Sets frame.size.width = width */ @property (nonatomic) CGFloat width; /** * Shortcut for frame.size.height * * Sets frame.size.height = height */ @property (nonatomic) CGFloat height; /** * Shortcut for center.x * * Sets center.x = centerX */ @property (nonatomic) CGFloat centerX; /** * Shortcut for center.y * * Sets center.y = centerY */ @property (nonatomic) CGFloat centerY; /** * Return the x coordinate on the screen. */ @property (nonatomic, readonly) CGFloat ttScreenX; /** * Return the y coordinate on the screen. */ @property (nonatomic, readonly) CGFloat ttScreenY; /** * Return the x coordinate on the screen, taking into account scroll views. */ @property (nonatomic, readonly) CGFloat screenViewX; /** * Return the y coordinate on the screen, taking into account scroll views. */ @property (nonatomic, readonly) CGFloat screenViewY; /** * Return the view frame on the screen, taking into account scroll views. */ @property (nonatomic, readonly) CGRect screenFrame; /** * Shortcut for frame.origin */ @property (nonatomic) CGPoint origin; /** * Shortcut for frame.size */ @property (nonatomic) CGSize size; @property (nonatomic) CGPoint orientationCenter; /** * Return the width in portrait or the height in landscape. */ @property (nonatomic, readonly) CGFloat orientationWidth; /** * Return the height in portrait or the width in landscape. */ @property (nonatomic, readonly) CGFloat orientationHeight; /** * Finds the first descendant view (including this view) that is a member of a particular class. */ - (UIView*)descendantOrSelfWithClass:(Class)cls; /** * Finds the first ancestor view (including this view) that is a member of a particular class. */ - (UIView*)ancestorOrSelfWithClass:(Class)cls; /** * Removes all subviews. */ - (void)removeAllSubviews; /** * The view controller whose view contains this view. */ - (UIViewController*)viewController; /** * Searches the view hierarchy recursively for the first responder, starting with this window. */ - (UIView*)findFirstResponder; /** * Searches the view hierarchy recursively for the first responder, starting with topView. */ - (UIView*)findFirstResponderInView:(UIView*)topView; @end
// // MIDIReciever.h // MidiKeyboard // // Created by Volter on 20.04.14. // Copyright (c) 2014 volter9. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreMIDI/CoreMIDI.h> @protocol MIDIReceiver <NSObject> @optional - (void)receiveMIDIInput: (NSArray *)packet; - (void)receiveMIDINotification: (NSString *)message withNotification: (const MIDINotification *)notification; @end
#include <pebble.h> #include "description.h" #include "../types.h" #include "../constants.h" static Window *s_window; static ScrollLayer *s_scroll_layer; static TextLayer *s_name_layer; static TextLayer *s_description_layer; static const int max_scroll_height = 10000; extern GFont s_font_semi_bold_20; extern GFont s_font_semi_bold_22; void description_window_init(void) { s_window = window_create(); window_set_background_color(s_window, GColorWhite); window_set_window_handlers(s_window, (WindowHandlers) { .load = description_window_load, .unload = description_window_unload }); } void description_window_deinit(void) { window_destroy(s_window); } void description_window_show(show show) { window_stack_push(s_window, true); description_window_update(show); } void description_window_hide(void) { window_stack_remove(s_window, true); } bool description_window_is_visible(void) { return window_stack_get_top_window() == s_window; } void description_window_update(show show) { Layer *window_layer = window_get_root_layer(s_window); GRect bounds = layer_get_frame(window_layer); text_layer_set_text(s_name_layer, show.name); text_layer_set_text(s_description_layer, show.description); GSize name_size = text_layer_get_content_size(s_name_layer); GSize desc_size = text_layer_get_content_size(s_description_layer); text_layer_set_size(s_name_layer, name_size); layer_set_frame( text_layer_get_layer(s_name_layer), grect_inset( GRect(0, 0, bounds.size.w, name_size.h + PADDING), GEdgeInsets(PADDING, PADDING, 0, PADDING) ) ); layer_set_frame( text_layer_get_layer(s_description_layer), grect_inset( GRect( 0, name_size.h + 5, bounds.size.w, name_size.h + 5 + desc_size.h ), GEdgeInsets(0, PADDING) ) ); scroll_layer_set_content_size( s_scroll_layer, GSize(bounds.size.w, name_size.h + 5 + desc_size.h + (PADDING * 4)) ); } static void description_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_frame(window_layer); GRect max_text_bounds = GRect(0, 0, bounds.size.w, max_scroll_height); // Initialize the scroll layer s_scroll_layer = scroll_layer_create(bounds); // This binds the scroll layer to the window so that up and down map to scrolling // You may use scroll_layer_set_callbacks to add or override interactivity scroll_layer_set_click_config_onto_window(s_scroll_layer, window); // Initialize the text layer s_name_layer = text_layer_create(max_text_bounds); // Style the text text_layer_set_background_color(s_name_layer, GColorClear); text_layer_set_text_color(s_name_layer, GColorBlack); text_layer_set_text_alignment(s_name_layer, GTextAlignmentLeft); text_layer_set_font(s_name_layer, s_font_semi_bold_22); text_layer_set_overflow_mode(s_name_layer, GTextOverflowModeWordWrap); // Initialize the text layer s_description_layer = text_layer_create(max_text_bounds); // Style the text text_layer_set_background_color(s_description_layer, GColorClear); text_layer_set_text_color(s_description_layer, GColorBlack); text_layer_set_text_alignment(s_description_layer, GTextAlignmentLeft); text_layer_set_font(s_description_layer, s_font_semi_bold_20); text_layer_set_overflow_mode(s_description_layer, GTextOverflowModeWordWrap); // Add the layers for display scroll_layer_add_child(s_scroll_layer, text_layer_get_layer(s_name_layer)); scroll_layer_add_child(s_scroll_layer, text_layer_get_layer(s_description_layer)); layer_add_child(window_layer, scroll_layer_get_layer(s_scroll_layer)); } static void description_window_unload(Window *window) { text_layer_destroy(s_description_layer); text_layer_destroy(s_name_layer); scroll_layer_destroy(s_scroll_layer); }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_listen_socket_execlp_66b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-66b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Fixed string * Sinks: execlp * BadSink : execute command with execlp * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #ifdef _WIN32 #include <process.h> #define EXECLP _execlp #else /* NOT _WIN32 */ #define EXECLP execlp #endif #ifndef OMITBAD void CWE78_OS_Command_Injection__char_listen_socket_execlp_66b_badSink(char * dataArray[]) { /* copy data out of dataArray */ char * data = dataArray[2]; /* execlp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__char_listen_socket_execlp_66b_goodG2BSink(char * dataArray[]) { char * data = dataArray[2]; /* execlp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } #endif /* OMITGOOD */
QString HQt_LatexShowAlert (QString String);
// // The MIT License (MIT) // // Copyright (c) 2015 Microsoft // // 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. // // ThaliMobile // THEAppContext.h // #import <Foundation/Foundation.h> // THEAppContext interface. @interface THEAppContext : NSObject // Class singleton. + (instancetype)singleton; // Starts communications. - (void)startCommunications; // Stops communications. - (void)stopCommunications; @end
// // Created by Yuanjun Xiong on 18/11/2015. // #ifndef DENSEFLOW_UTILS_H #define DENSEFLOW_UTILS_H #include "common.h" void writeZipFile(std::vector<std::vector<uchar> >& data, std::string name_temp, std::string archive_name); #endif //DENSEFLOW_UTILS_H
/** * Copyright (c) 2016 Peter Cannici * Licensed under the MIT (X11) license. See LICENSE. */ #include "test.h" int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { ptrdiff_t num_suites = suite_registry_end - suite_registry_begin; for (int i = 0; i < num_suites; i++) pt_add_suite(suite_registry_begin[i]); return pt_run(); }
#ifndef FLTPROPSLIDER_H #define FLTPROPSLIDER_H #include <QWidget> #include "util.h" namespace Ui { class FltPropSlider; } class FltPropSlider : public QWidget { Q_OBJECT public: explicit FltPropSlider(QWidget *parent = 0); FltPropSlider(QString caption, float minVal, float maxVal, float step, float divisor, QWidget *parent = 0); ~FltPropSlider(); float getValue(); void setValue(float val); public slots: signals: void valChanged(float val); private slots: void on_slider_valueChanged(int value); private: Ui::FltPropSlider *ui; float minValue, maxValue, valStep, divisor; }; #endif // FLTPROPSLIDER_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__wchar_t_type_overrun_memcpy_03.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow.label.xml Template File: point-flaw-03.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * Sinks: type_overrun_memcpy * GoodSink: Perform the memcpy() and prevent overwriting part of the structure * BadSink : Overwrite part of the structure by incorrectly using the sizeof(struct) in memcpy() * Flow Variant: 03 Control flow: if(5==5) and if(5!=5) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define SRC_STR L"0123456789abcde0123" typedef struct _charVoid { wchar_t charFirst[16]; void * voidSecond; void * voidThird; } charVoid; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__wchar_t_type_overrun_memcpy_03_bad() { if(5==5) { { charVoid * structCharVoid = (charVoid *)malloc(sizeof(charVoid)); structCharVoid->voidSecond = (void *)SRC_STR; /* Print the initial block pointed to by structCharVoid->voidSecond */ printWLine((wchar_t *)structCharVoid->voidSecond); /* FLAW: Use the sizeof(*structCharVoid) which will overwrite the pointer y */ memcpy(structCharVoid->charFirst, SRC_STR, sizeof(*structCharVoid)); structCharVoid->charFirst[(sizeof(structCharVoid->charFirst)/sizeof(wchar_t))-1] = L'\0'; /* null terminate the string */ printWLine((wchar_t *)structCharVoid->charFirst); printWLine((wchar_t *)structCharVoid->voidSecond); free(structCharVoid); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(5!=5) instead of if(5==5) */ static void good1() { if(5!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { charVoid * structCharVoid = (charVoid *)malloc(sizeof(charVoid)); structCharVoid->voidSecond = (void *)SRC_STR; /* Print the initial block pointed to by structCharVoid->voidSecond */ printWLine((wchar_t *)structCharVoid->voidSecond); /* FIX: Use the sizeof(structCharVoid->charFirst) to avoid overwriting the pointer y */ memcpy(structCharVoid->charFirst, SRC_STR, sizeof(structCharVoid->charFirst)); structCharVoid->charFirst[(sizeof(structCharVoid->charFirst)/sizeof(wchar_t))-1] = L'\0'; /* null terminate the string */ printWLine((wchar_t *)structCharVoid->charFirst); printWLine((wchar_t *)structCharVoid->voidSecond); free(structCharVoid); } } } /* good2() reverses the bodies in the if statement */ static void good2() { if(5==5) { { charVoid * structCharVoid = (charVoid *)malloc(sizeof(charVoid)); structCharVoid->voidSecond = (void *)SRC_STR; /* Print the initial block pointed to by structCharVoid->voidSecond */ printWLine((wchar_t *)structCharVoid->voidSecond); /* FIX: Use the sizeof(structCharVoid->charFirst) to avoid overwriting the pointer y */ memcpy(structCharVoid->charFirst, SRC_STR, sizeof(structCharVoid->charFirst)); structCharVoid->charFirst[(sizeof(structCharVoid->charFirst)/sizeof(wchar_t))-1] = L'\0'; /* null terminate the string */ printWLine((wchar_t *)structCharVoid->charFirst); printWLine((wchar_t *)structCharVoid->voidSecond); free(structCharVoid); } } } void CWE122_Heap_Based_Buffer_Overflow__wchar_t_type_overrun_memcpy_03_good() { good1(); good2(); } #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()..."); CWE122_Heap_Based_Buffer_Overflow__wchar_t_type_overrun_memcpy_03_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__wchar_t_type_overrun_memcpy_03_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifndef ScheduledAction_h #define ScheduledAction_h #include "script/include/squirrel.h" #include <wtf/Timer.h> class DOMTimer; class ThreadTimers; class ScheduledAction { public: ScheduledAction(HSQUIRRELVM v, HSQOBJECT* function, int timeout, bool singleShot, ThreadTimers* threadTimers, DOMTimer* pDOMTimer); ~ScheduledAction(); void Fire(Timer<ScheduledAction>*); void ref() {refCount++;} void deref(); void SetTimerId(int timerId) {m_timerId = timerId;} protected: void Start(int timeout, bool singleShot); int refCount; HSQOBJECT m_function; HSQUIRRELVM m_v; Timer<ScheduledAction> m_timer; int m_bSingleShot; DOMTimer* m_DOMTimer; int m_timerId; }; #endif // ScheduledAction_h
// // AppDelegate.h // FWPageControl // // Created by Chin on 15/3/16. // Copyright (c) 2015年 Chin. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/** * \file blas/blas_vector.h * * \brief Dense vector arithmetic using BLAS. * */ #ifndef BLAS_BLAS_VECTOR_H #define BLAS_BLAS_VECTOR_H #include "invlib/dense/vector_data.h" #include "invlib/sparse/sparse_data.h" #include "invlib/blas/blas_generic.h" namespace invlib { // -------------------- // // Forward Declarations // // -------------------- // template <typename SType, template <typename> typename VData> class BlasVector; template <typename SType, template <typename> typename MData> class BlasMatrix; template <typename SType, template <typename> typename VData> SType dot(const BlasVector<SType, VData>&, const BlasVector<SType, VData>&); // ------------------- // // Blas Vector Class // // ------------------- // /** * \brief Dense Vector Arithmetic using BLAS * * Implements a dense vector class that uses BLAS level 1 functions for vector * arithmetic. In addition to that the vector type provides functions for scaling * and addition of a constant, which are necessary for use with the CG solver. * * \tparam SType Floating point type used for the representation of * the vector elements. */ template < typename SType, template <typename> typename VData = VectorData > class BlasVector : public VData<SType> { public: // -------------- // // Type Aliases // // -------------- // using RealType = SType; using VectorType = BlasVector; using MatrixType = BlasVector; using ResultType = BlasVector; // ------------------------------- // // Constructors and Destructors // // ------------------------------- // BlasVector() = default; /*! Performs a shallow copy of the BlasVector object. */ BlasVector(const BlasVector &) = default; BlasVector(BlasVector &&) = default; /*! Performs a shallow copy of the BlasVector object. */ BlasVector & operator=(const BlasVector & ) = default; BlasVector & operator=( BlasVector &&) = default; /*! Construct BlasVector object from given VData object. * * Simply forwards the copy constructor call to that of the super class. * Its behavior thus depends on the VData class. */ BlasVector(const VData<SType> & v); /*! Construct BlasVector object from given VData object. * * Forwards the move constructor call to that of the super class. * Its behavior thus depends on the VData class. */ BlasVector(VData<SType> &&v); // ------------ // // Data access // // ------------ // SType * get_element_pointer() { return elements.get(); } const SType * get_element_pointer() const { return elements.get(); } // ------------ // // Arithmetic // // ------------ // void accumulate(const BlasVector &v); void accumulate(SType c); void subtract(const BlasVector &v); void scale(SType c); SType norm() const; friend SType dot<>(const BlasVector&, const BlasVector&); protected: // ------------------- // // Base Class Members // // ------------------- // using VData<SType>::elements; using VData<SType>::n; }; #include "blas_vector.cpp" } // namespace invlib #endif // BLAS_BLAS_VECTOR_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-66b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sinks: w32_spawnv * BadSink : execute command with spawnv * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> #ifndef OMITBAD void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_badSink(char * dataArray[]) { /* copy data out of dataArray */ char * data = dataArray[2]; { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* spawnv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnv(_P_WAIT, COMMAND_INT_PATH, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_goodG2BSink(char * dataArray[]) { char * data = dataArray[2]; { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* spawnv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnv(_P_WAIT, COMMAND_INT_PATH, args); } } #endif /* OMITGOOD */
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @class NSArray, NSLayoutManager, NSTextContainer, NSTextStorage; @interface XCETextLayout : NSObject { NSLayoutManager *_layoutManager; struct _NSRange _glyphRange; double _usedHeight; BOOL _layoutDone; NSArray *_coloredRects; } @property(retain, nonatomic) NSArray *coloredRects; // @synthesize coloredRects=_coloredRects; @property(nonatomic) struct _NSRange glyphRange; // @synthesize glyphRange=_glyphRange; @property(readonly, nonatomic) NSLayoutManager *layoutManager; // @synthesize layoutManager=_layoutManager; - (void)drawColoredRects:(id)arg1 forTextOrigin:(struct CGPoint)arg2; - (double)heightAtCharacterPosition:(unsigned long long)arg1; - (void)drawAt:(struct CGPoint)arg1; @property(readonly, nonatomic) double usedHeight; @property(nonatomic) double width; // @dynamic width; - (void)_doLayout; - (void)setAttributedString:(id)arg1; - (void)invalidateLayout; @property(readonly, nonatomic) NSTextContainer *textContainer; @property(readonly, nonatomic) NSTextStorage *textStorage; - (void)dealloc; - (id)init; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE476_NULL_Pointer_Dereference__struct_14.c Label Definition File: CWE476_NULL_Pointer_Dereference.label.xml Template File: sources-sinks-14.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: 14 Control flow: if(globalFive==5) and if(globalFive!=5) * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE476_NULL_Pointer_Dereference__struct_14_bad() { twoIntsStruct * data; if(globalFive==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(globalFive==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printIntLine(data->intOne); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G1() - use badsource and goodsink by changing the second globalFive==5 to globalFive!=5 */ static void goodB2G1() { twoIntsStruct * data; if(globalFive==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(globalFive!=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) { printIntLine(data->intOne); } else { printLine("data is NULL"); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */ static void goodB2G2() { twoIntsStruct * data; if(globalFive==5) { /* POTENTIAL FLAW: Set data to NULL */ data = NULL; } if(globalFive==5) { /* FIX: Check for NULL before attempting to print data */ if (data != NULL) { printIntLine(data->intOne); } else { printLine("data is NULL"); } } } /* goodG2B1() - use goodsource and badsink by changing the first globalFive==5 to globalFive!=5 */ static void goodG2B1() { twoIntsStruct * data; if(globalFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data */ { twoIntsStruct tmpData; tmpData.intOne = 0; tmpData.intTwo = 0; data = &tmpData; } } if(globalFive==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printIntLine(data->intOne); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */ static void goodG2B2() { twoIntsStruct * data; if(globalFive==5) { /* FIX: Initialize data */ { twoIntsStruct tmpData; tmpData.intOne = 0; tmpData.intTwo = 0; data = &tmpData; } } if(globalFive==5) { /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printIntLine(data->intOne); } } void CWE476_NULL_Pointer_Dereference__struct_14_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__struct_14_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE476_NULL_Pointer_Dereference__struct_14_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52a.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-52a.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: memmove * BadSink : Copy data to string using memmove * 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> #ifndef OMITBAD /* bad function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52b_badSink(wchar_t * data); void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52_bad() { wchar_t * data; data = (wchar_t *)malloc(100*sizeof(wchar_t)); /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ wmemset(data, L'A', 100-1); /* fill with L'A's */ data[100-1] = L'\0'; /* null terminate */ CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52b_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; data = (wchar_t *)malloc(100*sizeof(wchar_t)); /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ wmemset(data, L'A', 50-1); /* fill with L'A's */ data[50-1] = L'\0'; /* null terminate */ CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52b_goodG2BSink(data); } void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_52_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include "../termo.h" #include "taplib.h" int main (int argc, char *argv[]) { termo_t *tk; termo_key_t key; termo_mouse_event_t ev; int button, line, col; char buffer[32]; size_t len; plan_tests (60); tk = termo_new_abstract ("vt100", NULL, 0); termo_push_bytes (tk, "\e[M !!", 6); key.type = -1; is_int (termo_getkey (tk, &key), TERMO_RES_KEY, "getkey yields RES_KEY for mouse press"); is_int (key.type, TERMO_TYPE_MOUSE, "key.type for mouse press"); ev = -1; button = -1; line = -1; col = -1; is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_PRESS, "mouse event for press"); is_int (button, 1, "mouse button for press"); is_int (line, 0, "mouse line for press"); is_int (col, 0, "mouse column for press"); is_int (key.modifiers, 0, "modifiers for press"); len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 13, "string length for press"); is_str (buffer, "MousePress(1)", "string buffer for press"); len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_MOUSE_POS); is_int (len, 21, "string length for press"); is_str (buffer, "MousePress(1) @ (0,0)", "string buffer for press"); termo_push_bytes (tk, "\e[M@\"!", 6); key.type = -1; ev = -1; button = -1; line = -1; col = -1; termo_getkey (tk, &key); is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_DRAG, "mouse event for drag"); is_int (button, 1, "mouse button for drag"); is_int (line, 0, "mouse line for drag"); is_int (col, 1, "mouse column for drag"); is_int (key.modifiers, 0, "modifiers for press"); termo_push_bytes (tk, "\e[M##!", 6); key.type = -1; ev = -1; button = -1; line = -1; col = -1; termo_getkey (tk, &key); is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_RELEASE, "mouse event for release"); is_int (line, 0, "mouse line for release"); is_int (col, 2, "mouse column for release"); is_int (key.modifiers, 0, "modifiers for press"); termo_push_bytes (tk, "\e[M0++", 6); key.type = -1; ev = -1; button = -1; line = -1; col = -1; termo_getkey (tk, &key); is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_PRESS, "mouse event for Ctrl-press"); is_int (button, 1, "mouse button for Ctrl-press"); is_int (line, 10, "mouse line for Ctrl-press"); is_int (col, 10, "mouse column for Ctrl-press"); is_int (key.modifiers, TERMO_KEYMOD_CTRL, "modifiers for Ctrl-press"); len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 15, "string length for Ctrl-press"); is_str (buffer, "C-MousePress(1)", "string buffer for Ctrl-press"); // rxvt protocol termo_push_bytes (tk, "\e[32;20;20M", 11); key.type = -1; is_int (termo_getkey (tk, &key), TERMO_RES_KEY, "getkey yields RES_KEY for mouse press rxvt protocol"); is_int (key.type, TERMO_TYPE_MOUSE, "key.type for mouse press rxvt protocol"); is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_PRESS, "mouse event for press rxvt protocol"); is_int (button, 1, "mouse button for press rxvt protocol"); is_int (line, 19, "mouse line for press rxvt protocol"); is_int (col, 19, "mouse column for press rxvt protocol"); is_int (key.modifiers, 0, "modifiers for press rxvt protocol"); termo_push_bytes (tk, "\e[35;20;20M", 11); is_int (termo_getkey (tk, &key), TERMO_RES_KEY, "getkey yields RES_KEY for mouse release rxvt protocol"); is_int (key.type, TERMO_TYPE_MOUSE, "key.type for mouse release rxvt protocol"); ev = -1; button = -1; line = -1; col = -1; is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_RELEASE, "mouse event for release rxvt protocol"); is_int (line, 19, "mouse line for release rxvt protocol"); is_int (col, 19, "mouse column for release rxvt protocol"); is_int (key.modifiers, 0, "modifiers for release rxvt protocol"); // SGR protocol termo_push_bytes (tk, "\e[<0;30;30M", 11); key.type = -1; is_int (termo_getkey (tk, &key), TERMO_RES_KEY, "getkey yields RES_KEY for mouse press SGR encoding"); is_int (key.type, TERMO_TYPE_MOUSE, "key.type for mouse press SGR encoding"); ev = -1; button = -1; line = -1; col = -1; is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_PRESS, "mouse event for press SGR"); is_int (button, 1, "mouse button for press SGR"); is_int (line, 29, "mouse line for press SGR"); is_int (col, 29, "mouse column for press SGR"); is_int (key.modifiers, 0, "modifiers for press SGR"); termo_push_bytes (tk, "\e[<0;30;30m", 11); key.type = -1; is_int (termo_getkey (tk, &key), TERMO_RES_KEY, "getkey yields RES_KEY for mouse release SGR encoding"); is_int (key.type, TERMO_TYPE_MOUSE, "key.type for mouse release SGR encoding"); ev = -1; button = -1; line = -1; col = -1; is_int (termo_interpret_mouse (tk, &key, &ev, &button, &line, &col), TERMO_RES_KEY, "interpret_mouse yields RES_KEY"); is_int (ev, TERMO_MOUSE_RELEASE, "mouse event for release SGR"); termo_push_bytes (tk, "\e[<0;500;300M", 13); key.type = -1; ev = -1; button = -1; line = -1; col = -1; termo_getkey (tk, &key); termo_interpret_mouse (tk, &key, &ev, &button, &line, &col); is_int (line, 299, "mouse line for press SGR wide"); is_int (col, 499, "mouse column for press SGR wide"); termo_destroy (tk); return exit_status (); }
#ifndef Distance_IS_INCLUDED #define Distance_IS_INCLUDED #include "../Coor/Coor.h" #include <blitz/array.h> #include <cmath> using namespace blitz; #ifndef sqr_IS_INCLUDED #define sqr_IS_INCLUDED inline double sqr(double x) {return x*x;}; #endif // **************************************************************** // * DISTANCE * // **************************************************************** class Distance { protected: CoorSpinDiff* Coordinate; CoorSpinDiff* TrialCoordinate; int numParticles; // Number of particles int Nm1; // numParticles - 1 int numDimensions; // Number of dimension // Array of Upper matrix composed of the distance between // particle i and j Array<double, 2> interElectronicDistances; // The (new) distance from the current particle to the other particles Array<double, 1> trialColumn; Array<double, 1> trialRow; int currentParticle; // This is the particle that currently is // (proposed) moved public: Distance() {} void attach(CoorSpinDiff* _Coordinate, CoorSpinDiff* _TrialCoordinate, int _numParticles); void initialize(); void setToNextParticle(); void setCurrentParticle(int _currentParticle); void suggestMove(); void acceptMove(); void rejectMove() {} double getPotential(); Array<double, 2> getInterElectronicDistances() {return interElectronicDistances;} Array<double, 1> getTrialColumn() {return trialColumn;} Array<double, 1> getTrialRow() {return trialRow;} }; // **************************************************************** // * DISTANCEDIFF * // **************************************************************** class DistanceDiff : public Distance { protected: double h; // Differential parameter, // dr/dx ~= ( r(x+h) - r(x-h) )/2h double twoh; // 2*h int differentiate; // Which dimension (x=0, y=1 or z=2 in three dim.) // to be differentiated public: DistanceDiff() {} void attach(CoorSpinDiff* _Coordinate, CoorSpinDiff* _TrialCoordinate, int _numParticles, double _h, int _differentiate); void initialize(); void suggestMove(); void acceptMove(); void rejectMove() {} }; #endif
// -*- C++ -*- /*************************************************************************** * blitz/vecexprwrap.h Vector expression templates wrapper class * * $Id: vecexprwrap.h,v 2.0 2009/01/22 17:03:42 patrime Exp $ * * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Suggestions: blitz-dev@oonumerics.org * Bugs: blitz-bugs@oonumerics.org * * For more information, please see the Blitz++ Home Page: * http://oonumerics.org/blitz/ * ***************************************************************************/ #ifndef BZ_VECEXPRWRAP_H #define BZ_VECEXPRWRAP_H #ifndef BZ_BLITZ_H #include <blitz/blitz.h> #endif BZ_NAMESPACE(blitz) template<typename P_expr> class _bz_VecExpr { public: typedef P_expr T_expr; typedef _bz_typename T_expr::T_numtype T_numtype; #ifdef BZ_PASS_EXPR_BY_VALUE _bz_VecExpr(T_expr a) : iter_(a) { } #else _bz_VecExpr(const T_expr& a) : iter_(a) { } #endif #ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR _bz_VecExpr(const _bz_VecExpr<T_expr>& a) : iter_(a.iter_) { } #endif T_numtype operator[](int i) const { return iter_[i]; } T_numtype operator()(int i) const { return iter_(i); } int length(int recommendedLength) const { return iter_.length(recommendedLength); } static const int _bz_staticLengthCount = P_expr::_bz_staticLengthCount, _bz_dynamicLengthCount = P_expr::_bz_dynamicLengthCount, _bz_staticLength = P_expr::_bz_staticLength; int _bz_suggestLength() const { return iter_._bz_suggestLength(); } bool _bz_hasFastAccess() const { return iter_._bz_hasFastAccess(); } T_numtype _bz_fastAccess(int i) const { return iter_._bz_fastAccess(i); } private: _bz_VecExpr(); T_expr iter_; }; BZ_NAMESPACE_END #endif // BZ_VECEXPRWRAP_H
#ifndef dplyr_tools_all_na_H #define dplyr_tools_all_na_H template <int RTYPE> inline bool all_na_impl(const Vector<RTYPE>& x) { return all(is_na(x)).is_true(); } template <> inline bool all_na_impl<REALSXP>(const NumericVector& x) { return all(is_na(x) & !is_nan(x)).is_true(); } inline bool all_na(SEXP x) { RCPP_RETURN_VECTOR(all_na_impl, x); } #endif
/* * timer.c * * Created on: Dec 7, 2015 * Author: longqi */ #include "timer.h" #include "CanBus.h" float32 heartbeat = 0; void configureTimer0() { DINT; // Disable CPU interrupts // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; PieVectTable.TINT0 = &cpu_timer0_isr; //Timer 0 EDIS; InitCpuTimers(); #if (CPU_FRQ_150MHZ) // Configure CPU-Timer 0 to interrupt every second: // 150MHz CPU Freq, 1 second Period (in uSeconds) ConfigCpuTimer(&CpuTimer0, 150, 1000000); #endif // To ensure precise timing, use write-only instructions to write to the entire register. Therefore, if any // of the configuration bits are changed in ConfigCpuTimer and InitCpuTimers (in DSP2833x_CpuTimers.h), the // below settings must also be updated. CpuTimer0Regs.TCR.all = 0x4000; // Use write-only instruction to set TSS bit = 0 // Enable CPU int1 which is connected to CPU-Timer 0, IER |= M_INT1; // Enable TINT0 in the PIE: Group 1 interrupt 7 PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM StartCpuTimer0(); } interrupt void cpu_timer0_isr(void) { CpuTimer0.InterruptCount++; // Acknowledge this interrupt to receive more interrupts from group 1 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; heartbeat += 1; struct CAN_DATA data_to_send; data_to_send.data0 = heartbeat + 0; data_to_send.data1 = heartbeat + 1; data_to_send.data2 = heartbeat + 2; data_to_send.index = HEART_BEAT_INDEX; send_data(BIC_HB_ID_INDEX, data_to_send); }
#include <stdio.h> int main() { char *name = "Andrew"; printf("Hello %s\n", name); return 0; }
/* * File: maincode.c * Author: klnla * * Created on June 10, 2021, 2:42 PM */ /* 1. condicion START 2. enviar direccion slave 3. esperar Ack 4. enviar dato 5. esperar Ack 6. condicion STOP*/ #include <xc.h> #include "cabecera.h" #define _XTAL_FREQ 48000000UL unsigned char cuenta = 0; void mssp_conf(void){ SSPCON1bits.SSPEN = 1; //habilitar el MSSP SSPCON1bits.SSPM = 0b1000; //MSSP en modo i2c maestro SSPADD = 119; //datarate 100k } void pcf8574_write(unsigned char direccion, unsigned char dato){ SSPCON2bits.SEN = 1; while(SSPCON2bits.SEN == 1); //(1)cond.Start SSPBUF = direccion; //(2)slaveaddr+Wr while(SSPSTATbits.BF == 1); while(SSPSTATbits.R_nW == 1); //(3)ACK SSPBUF = dato; //(4)datasend while(SSPSTATbits.BF == 1); while(SSPSTATbits.R_nW == 1); //(5)ACK SSPCON2bits.PEN = 1; while(SSPCON2bits.PEN == 1); //(6)cond.Stop } void main(void) { mssp_conf(); while(1){ pcf8574_write(0x40, cuenta); cuenta++; __delay_ms(100); } }
// 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. // The use and distribution terms for this software are covered by the Eclipse // Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which // can be found in the file epl-v10.html at the root of this distribution. // By using this software in any fashion, you are agreeing to be bound by the // terms of this license. You must not remove this notice, or any other, from // this software. // Copyright (c) 2013-2016, Ken Leung. All rights reserved. #pragma once ////////////////////////////////////////////////////////////////////////////// #include "x2d/XScene.h" NS_BEGIN(@@APPID@@) ////////////////////////////////////////////////////////////////////////////// // struct CC_DLL Splash : public f::XScene { __decl_create_scene(Splash) __decl_deco_ui() }; NS_END
/* $Id: memory.c,v 1.4 2011/01/25 16:30:49 ellson Exp $ $Revision: 1.4 $ */ /* vim:set shiftwidth=4 ts=8: */ /************************************************************************* * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ #include "geometry.h" #include "render.h" typedef struct freenode { struct freenode *nextfree; } Freenode; typedef struct freeblock { struct freeblock *next; struct freenode *nodes; } Freeblock; #include "mem.h" #include <stdlib.h> #include <stdio.h> static int gcd(int y, int x) { while (x != y) { if (y < x) x = x - y; else y = y - x; } return x; } #define LCM(x,y) ((x)%(y) == 0 ? (x) : (y)%(x) == 0 ? (y) : x*(y/gcd(x,y))) void freeinit(Freelist * fl, int size) { fl->head = NULL; fl->nodesize = LCM(size, sizeof(Freenode)); if (fl->blocklist != NULL) { Freeblock *bp, *np; bp = fl->blocklist; while (bp != NULL) { np = bp->next; free(bp->nodes); free(bp); bp = np; } } fl->blocklist = NULL; } void *getfree(Freelist * fl) { int i; Freenode *t; Freeblock *mem; if (fl->head == NULL) { int size = fl->nodesize; char *cp; mem = GNEW(Freeblock); mem->nodes = gmalloc(sqrt_nsites * size); cp = (char *) (mem->nodes); for (i = 0; i < sqrt_nsites; i++) { makefree(cp + i * size, fl); } mem->next = fl->blocklist; fl->blocklist = mem; } t = fl->head; fl->head = t->nextfree; return ((void *) t); } void makefree(void *curr, Freelist * fl) { ((Freenode *) curr)->nextfree = fl->head; fl->head = (Freenode *) curr; }
/* Copyright (C) 2002, The IPDR Organization, all rights reserved. * The use and distribution of this software is governed by the terms of * the license agreement which can be found in the file LICENSE.TXT at * the top of this source tree. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF * ANY KIND, either express or implied. */ /***************************************************** * File : IPDRReadTool.h * * Description : * * Author : Infosys Tech Ltd * * Modification History : * *---------------------------------------------------* * Date Name Change/Description * *---------------------------------------------------* * 02/18/02 Created * *****************************************************/ #ifndef _IPDR_READTOOL_H #define _IPDR_READTOOL_H #include <stdio.h> #include <string.h> #include <stdlib.h> #include "utils/IPDRMemory.h" #include "common/descriptor.h" #include "utils/errorCode.h" #include "utils/utils.h" #include "common/IPDRDocWriter.h" #include "common/IPDRDocReader.h" #include "xml/IPDRXMLRecordHelper.h" #include "utils/UUIDUtil.h" #include "curl/curl.h" #include "curl/types.h" #include "curl/easy.h" #include "common/getFile.h" #define MAX_STR_LENGTH 40000 /* Structures for the list of service information */ typedef struct ServiceInfo { FILE* fp; FNFType* pFNFType_; ListNameSpaceInfo* pListNameSpaceInfo_; } ServiceInfo; typedef struct ListServiceInfo { ServiceInfo* pServiceInfo_; struct ListServiceInfo* pNext_; } ListServiceInfo; /* Functions for using the list of service information */ int appendListServiceInfo( ListServiceInfo** pHeadRef, FILE* fp, FNFType* pFNFType, ListNameSpaceInfo* pListNameSpaceInfo ); int addListServiceInfo(ListServiceInfo** pHeadRef, FILE* fp, FNFType* pFNFType, ListNameSpaceInfo* pListNameSpaceInfo ); int printListServiceInfo(ListServiceInfo* pListServiceInfo); ServiceInfo* newServiceInfo(void); int freeListServiceInfo(ListServiceInfo **pHeadRef); int freeServiceInfo(ServiceInfo* ServiceInfo); int generateRawData( IPDRCommonParameters* pIPDRCommonParameters, FNFData* pFNFData, ListServiceInfo* pListServiceInfo, int* pErrorCode ); int validateInputParams( int argCount, char* argValues[], unsigned int* schemaValFlag, unsigned int* outDirFlag, unsigned int* versionFlag, char* outFileDir, char* ipdrVer, IPDRCommonParameters* pIPDRCommonParameters, int* pErrorCode ); /* int validateInputParams( int argCount, char* argValues[], unsigned int* schemaValFlag, unsigned int* outDirFlag, char* outFileDir, IPDRCommonParameters* pIPDRCommonParameters, int* pErrorCode ); */ int populateIPDRCommonParameters( IPDRCommonParameters* pIPDRCommonParameters, int* pErrorCode ); int getLengthListServiceInfo( ListServiceInfo* pListServiceInfo ); int printUsage(); int getElementName(char* pServInfoAttrName, AttributeDescriptor* pAttributeDescriptor, ListAttributeDescriptor* pListServiceAttributeDescriptor ); int getComplexElementName(char* pServInfoAttrName, char* pComplexType, ListAttributeDescriptor* pListServiceAttributeDescriptor ); int getFieldValue(AttributeDescriptor* pAttributeDescriptor, ServiceInfo* pServiceInfo, ListIPDRData* pCurrentIPDRData, int* pErrorCode ); int getComplexFieldValue( IPDRCommonParameters* pIPDRCommonParameters, char* fieldValue, AttributeDescriptor* pAttributeDescriptor, ListAttributeDescriptor* pListServiceAttributeDescriptor, ServiceInfo* pServiceInfo, char *pComplexType, ListIPDRData* pCurrentIPDRData, int* pErrorCode ); char* Findindex(char *cPtr, char c); char* writeEscapedChar(char* str); char* insertEscChar(char *string, char delim); char* getStringBetweenDelims(char* string, char* startPoint, char* endPoint); #endif
/* * This file is part of the KDE project * * Copyright (c) 2005 Cyrille Berger <cberger@cberger.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIS_MATH_TOOLBOX_H #define KIS_MATH_TOOLBOX_H #include <QObject> #include <QRect> #include <KoGenericRegistry.h> #include <KoColorSpace.h> #include "kis_types.h" #include "kis_paint_device.h" #include <new> #ifdef _MSC_VER #pragma warning(disable: 4290) // disable "C++ exception specification ignored" warning #endif #pragma GCC diagnostic ignored "-Wcast-align" typedef double(*PtrToDouble)(const quint8*, int); typedef void (*PtrFromDouble)(quint8*, int, double); class KRITAIMAGE_EXPORT KisMathToolbox : public QObject { Q_OBJECT public: struct KisFloatRepresentation { KisFloatRepresentation(uint nsize, uint ndepth) throw(std::bad_alloc) : coeffs(new float[nsize*nsize*ndepth]) , size(nsize) , depth(ndepth) { // XXX: Valgrind shows that these are being used without being initialised. for (quint32 i = 0; i < nsize * nsize * ndepth; ++i) { coeffs[i] = 0; } } ~KisFloatRepresentation() { if (coeffs) delete[] coeffs; } float* coeffs; uint size; uint depth; }; typedef KisFloatRepresentation KisWavelet; public: KisMathToolbox(KoID id); virtual ~KisMathToolbox(); public: inline QString id() { return m_id.id(); } inline QString name() { return m_id.name(); } /** * This function initialize a wavelet structure * @param lay the layer that will be used for the transformation */ inline KisWavelet* initWavelet(KisPaintDeviceSP lay, const QRect&) throw(std::bad_alloc); inline uint fastWaveletTotalSteps(const QRect&); /** * This function reconstruct the layer from the information of a wavelet * @param src layer from which the wavelet will be computed * @param buff if set to 0, the buffer will be initialized by the function, * you might want to give a buff to the function if you want to use the same buffer * in transformToWavelet and in untransformToWavelet, use initWavelet to initialize * the buffer */ virtual KisWavelet* fastWaveletTransformation(KisPaintDeviceSP src, const QRect&, KisWavelet* buff = 0) = 0; /** * This function reconstruct the layer from the information of a wavelet * @param dst layer on which the wavelet will be untransform * @param wav the wavelet * @param buff if set to 0, the buffer will be initialized by the function, * you might want to give a buff to the function if you want to use the same buffer * in transformToWavelet and in untransformToWavelet, use initWavelet to initialize * the buffer */ virtual void fastWaveletUntransformation(KisPaintDeviceSP dst, const QRect&, KisWavelet* wav, KisWavelet* buff = 0) = 0; bool getToDoubleChannelPtr(QList<KoChannelInfo *> cis, QVector<PtrToDouble>& f); bool getFromDoubleChannelPtr(QList<KoChannelInfo *> cis, QVector<PtrFromDouble>& f); double minChannelValue(KoChannelInfo *); double maxChannelValue(KoChannelInfo *); signals: void nextStep(); protected: /** * This function transform a paint device into a KisFloatRepresentation, this function is colorspace independent, * for Wavelet, Pyramid and FFT the data is always the exact value of the channel stored in a float. */ void transformToFR(KisPaintDeviceSP src, KisFloatRepresentation*, const QRect&); /** * This function transform a KisFloatRepresentation into a paint device, this function is colorspace independent, * for Wavelet, Pyramid and FFT the data is always the exact value of the channel stored in a float. */ void transformFromFR(KisPaintDeviceSP dst, KisFloatRepresentation*, const QRect&); private: KoID m_id; }; class KRITAIMAGE_EXPORT KisMathToolboxRegistry : public KoGenericRegistry<KisMathToolbox*> { public: virtual ~KisMathToolboxRegistry(); static KisMathToolboxRegistry * instance(); private: KisMathToolboxRegistry(); KisMathToolboxRegistry(const KisMathToolboxRegistry&); KisMathToolboxRegistry operator=(const KisMathToolboxRegistry&); }; inline KisMathToolbox::KisWavelet* KisMathToolbox::initWavelet(KisPaintDeviceSP src, const QRect& rect) throw(std::bad_alloc) { int size; int maxrectsize = (rect.height() < rect.width()) ? rect.width() : rect.height(); for (size = 2; size < maxrectsize; size *= 2) ; qint32 depth = src->colorSpace()->colorChannelCount(); return new KisWavelet(size, depth); } inline uint KisMathToolbox::fastWaveletTotalSteps(const QRect& rect) { int size, steps; int maxrectsize = (rect.height() < rect.width()) ? rect.width() : rect.height(); steps = 0; for (size = 2; size < maxrectsize; size *= 2) steps += size / 2; ; return steps; } #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __javax_print_attribute_Attribute__ #define __javax_print_attribute_Attribute__ #pragma interface #include <java/lang/Object.h> extern "Java" { namespace javax { namespace print { namespace attribute { class Attribute; } } } } class javax::print::attribute::Attribute : public ::java::lang::Object { public: virtual ::java::lang::Class *getCategory () = 0; virtual ::java::lang::String *getName () = 0; static ::java::lang::Class class$; } __attribute__ ((java_interface)); #endif /* __javax_print_attribute_Attribute__ */
/* PR c/7652 */ /* { dg-do compile } */ /* { dg-require-effective-target alloca } */ /* { dg-options "-Wimplicit-fallthrough" } */ extern void bar (int); extern int bar2 (void); extern int *map; void f (int i) { switch (i) { case 1: bar (0); /* { dg-warning "statement may fall through" } */ static int i = 10; case 2: bar (99); } switch (i) { case 1: { /* { dg-warning "statement may fall through" "" { target c } . } */ int a[i]; /* { dg-warning "statement may fall through" "" { target c++ } . } */ } case 2: bar (99); } switch (i) { case 1: for (int j = 0; j < 10; j++) /* { dg-warning "statement may fall through" "" { target c } . } */ map[j] = j; /* { dg-warning "statement may fall through" "" { target c++ } . } */ case 2: bar (99); } switch (i) { case 1: do bar (2); while (--i); /* { dg-warning "statement may fall through" } */ case 2: bar (99); } switch (i) { case 1: { switch (i + 2) case 4: bar (1); /* { dg-warning "statement may fall through" } */ case 5: bar (5); return; } case 2: bar (99); } switch (i) { case 1:; case 2:; } switch (i) { } switch (i) { case 1: if (i & 1) /* { dg-warning "statement may fall through" } */ { bar (23); break; } case 2: bar (99); } switch (i) { case 1: if (i > 9) /* { dg-warning "statement may fall through" } */ { bar (9); if (i == 10) { bar (10); break; } } case 2: bar (99); } int r; switch (i) { case 1: r = bar2 (); if (r) /* { dg-warning "statement may fall through" } */ break; case 2: bar (99); } switch (i) { case 1: r = bar2 (); if (r) return; if (!i) /* { dg-warning "statement may fall through" } */ return; case 2: bar (99); } }
/* ncmpc (Ncurses MPD Client) * (c) 2004-2010 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef NCMPC_H #define NCMPC_H #include "command.h" /** put the terminal in a sane mode and stop/suspend ncmpc */ void sigstop(void); void begin_input_event(void); void end_input_event(void); int do_input_event(command_t cmd); #endif /* NCMPC_H */
// // EnemyFactory.h // TowerDefense // // Created by jowu on 15/11/30. // // #ifndef __TowerDefense__EnemyFactory__ #define __TowerDefense__EnemyFactory__ #include "cocos2d.h" #include "Enemy.h" class EnemyFactory { public: static Enemy* create(EnemyID id); }; #endif /* defined(__TowerDefense__EnemyFactory__) */