text stringlengths 4 6.14k |
|---|
// 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 below 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.
//
// Vulkan Cookbook
// ISBN: 9781786468154
// © Packt Publishing Limited
//
// Author: Pawel Lapinski
// LinkedIn: https://www.linkedin.com/in/pawel-lapinski-84522329
//
// Chapter: 01 Instance and Devices
// Recipe: 18 Creating a logical device with geometry shaders and graphics and compute queues
#ifndef CREATING_A_LOGICAL_DEVICE_WITH_GEOMETRY_SHADERS_AND_GRAPHICS_AND_COMPUTE_QUEUES
#define CREATING_A_LOGICAL_DEVICE_WITH_GEOMETRY_SHADERS_AND_GRAPHICS_AND_COMPUTE_QUEUES
#include "Common.h"
namespace VulkanCookbook {
bool CreateLogicalDeviceWithGeometryShadersAndGraphicsAndComputeQueues( VkInstance instance,
VkDevice & logical_device,
VkQueue & graphics_queue,
VkQueue & compute_queue );
} // namespace VulkanCookbook
#endif // CREATING_A_LOGICAL_DEVICE_WITH_GEOMETRY_SHADERS_AND_GRAPHICS_AND_COMPUTE_QUEUES |
#pragma once
// STL includes
#include <string>
#include <vector>
#include <stdlib.h>
#include <math.h>
// Qt includes
#include <QTimer>
// hyperion incluse
#include <leddevice/LedDevice.h>
/// Linear Smooting class
///
/// This class processes the requested led values and forwards them to the device after applying
/// a linear smoothing effect. This class can be handled as a generic LedDevice.
class LinearColorSmoothing : public QObject, public LedDevice
{
Q_OBJECT
public:
/// Constructor
/// @param LedDevice the led device
/// @param LedUpdatFrequency The frequency at which the leds will be updated (Hz)
/// @param settingTime The time after which the updated led values have been fully applied (sec)
/// @param updateDelay The number of frames to delay outgoing led updates
LinearColorSmoothing(LedDevice *ledDevice, double ledUpdateFrequency, int settlingTime, unsigned updateDelay, bool continuousOutput);
/// Destructor
virtual ~LinearColorSmoothing();
/// write updated values as input for the smoothing filter
///
/// @param ledValues The color-value per led
/// @return Zero on succes else negative
///
virtual int write(const std::vector<ColorRgb> &ledValues);
/// Switch the leds off
virtual int switchOff();
private slots:
/// Timer callback which writes updated led values to the led device
void updateLeds();
private:
/**
* Pushes the colors into the output queue and popping the head to the led-device
*
* @param ledColors The colors to queue
*/
void queueColors(const std::vector<ColorRgb> & ledColors);
/// The led device
LedDevice * _ledDevice;
/// The interval at which to update the leds (msec)
const int64_t _updateInterval;
/// The time after which the updated led values have been fully applied (msec)
const int64_t _settlingTime;
/// The Qt timer object
QTimer _timer;
/// The timestamp at which the target data should be fully applied
int64_t _targetTime;
/// The target led data
std::vector<ColorRgb> _targetValues;
/// The timestamp of the previously written led data
int64_t _previousTime;
/// The previously written led data
std::vector<ColorRgb> _previousValues;
/** The number of updates to keep in the output queue (delayed) before being output */
const unsigned _outputDelay;
/** The output queue */
std::list<std::vector<ColorRgb> > _outputQueue;
// prevent sending data to device when no intput data is sent
bool _writeToLedsEnable;
/// Flag for dis/enable continuous output to led device regardless there is new data or not
bool _continuousOutput;
};
|
#import "DetailViewBase.h"
/** Displays info about the app, including credits. */
@interface AppInfoView : DetailViewBase
@end
|
//
// ViewController.h
// KSToolkit
//
// Created by bing.hao on 15/9/9.
// Copyright (c) 2015年 bing.hao. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
//
// AppDelegate.h
// MakeIt
//
// Created by zhangyuan on 2/3/15.
// Copyright (c) 2015 NextCloudMedia. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WXApi.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate, WXApiDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// JKAppearanceProvider.h
// JKEasyAFNetworking
//
// Created by Jayesh Kawli Backup on 12/6/14.
// Copyright (c) 2014 Jayesh Kawli. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JKAppearanceProvider : NSObject
+(UIColor*)DarkOrangeColor;
@end
|
//
// CyclePageViewTikTokCell.h
// HyCycleView
// https://github.com/hydreamit/HyCycleView
//
// Created by Hy on 2016/5/20.
// Copyright © 2016年 Hy. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CyclePageViewTikTokCell : UICollectionViewCell
@property (nonatomic,strong) UIImageView *imageView;
@end
NS_ASSUME_NONNULL_END
|
/*************************************************************************
* libjson-rpc-cpp
*************************************************************************
* @file filedescriptorclient.h
* @date 26.10.2016
* @author Jean-Daniel Michaud <jean.daniel.michaud@gmail.com>
* @license See attached LICENSE.txt
************************************************************************/
#ifndef JSONRPC_CPP_FILEDESCRITPTORCLIENT_H_
#define JSONRPC_CPP_FILEDESCRITPTORCLIENT_H_
#include "../iclientconnector.h"
#include <jsonrpccpp/common/exception.h>
namespace jsonrpc
{
class FileDescriptorClient : public IClientConnector
{
public:
FileDescriptorClient(int inputfd, int outputfd);
virtual ~FileDescriptorClient();
virtual void SendRPCMessage(const std::string& message, std::string& result) throw (JsonRpcException);
private:
int inputfd;
int outputfd;
bool IsReadable(int fd);
};
} /* namespace jsonrpc */
#endif /* JSONRPC_CPP_FILEDESCRITPTORCLIENT_H_ */
|
//
// ZBRegisterDemo.h
// ZBSmartLiveSDK
//
// Created by app on 16/10/13.
// Copyright © 2016年 LipYoung. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ZBRegisterDemo : UIViewController
@end
|
//
// UITextField+matchesRegex.h
// iOSCoreLibrary
//
// Created by Iain McManus on 6/02/13.
//
//
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
@interface UITextField (matchesRegex)
- (BOOL) matchesRegex:(NSString*) inRegex;
@end
#endif // TARGET_OS_IPHONE |
/**
* @version $Id: 8b1b6422d42f3a55b4aee31ab588debf1416cd3b $
*/
#ifndef TDME_NETWORK_NIOINTEREST
#define TDME_NETWORK_NIOINTEREST
#include <libtdme/globals/globals.h>
namespace TDMENetwork {
/**
* @brief type definiton for io interest, see NIONetworkServerClient::INTEREST_*
*/
typedef uint8_t NIOInterest;
const NIOInterest NIO_INTEREST_NONE = 0;
const NIOInterest NIO_INTEREST_READ = 1;
const NIOInterest NIO_INTEREST_WRITE = 2;
};
#endif
|
void main()
{
int x;
x = 2;
return;
};
|
//
// WPHeader.h
// CombinationDev
//
// Created by wwp on 16/6/7.
// Copyright © 2016年 gucheng. All rights reserved.
//
#ifndef WPHeader_h
#define WPHeader_h
//CGRect
#define Screen_WIDTH self.view.frame.size.width
#define Screen_HEIGHT self.view.frame.size.height
//设备尺寸
#define _iPhone4_ (CGSizeEqualToSize(CGSizeMake(320, 480), [UIScreen mainScreen].bounds.size))
#define _iPhone5_ (CGSizeEqualToSize(CGSizeMake(320, 568), [UIScreen mainScreen].bounds.size))
#define _iPhone6_ (CGSizeEqualToSize(CGSizeMake(375, 667), [UIScreen mainScreen].bounds.size))
#define _iPhone6P_ (CGSizeEqualToSize(CGSizeMake(414, 736), [UIScreen mainScreen].bounds.size))
//颜色
#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
//weak or strong
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
#endif
|
/*
* zsummerX License
* -----------
*
* zsummerX is licensed under the terms of the MIT license reproduced below.
* This means that zsummerX is free software and can be used for both academic
* and commercial purposes at absolutely no cost.
*
*
* ===============================================================================
*
* Copyright (C) 2010-2015 YaweiZhang <yawei.zhang@foxmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ===============================================================================
*
* (end of COPYRIGHT)
*/
#ifndef _ZSUMMER_TCPSOCKET_IMPL_H_
#define _ZSUMMER_TCPSOCKET_IMPL_H_
#include "common_impl.h"
#include "select_impl.h"
namespace zsummer
{
namespace network
{
class TcpSocket : public std::enable_shared_from_this<TcpSocket>
{
public:
TcpSocket();
~TcpSocket();
bool initialize(const EventLoopPtr &summer);
inline bool getPeerInfo(std::string & remoteIP, unsigned short &remotePort)
{
remoteIP = _remoteIP;
remotePort = _remotePort;
return true;
}
bool doConnect(const std::string & remoteIP, unsigned short remotePort, _OnConnectHandler && handler);
bool doSend(char * buf, unsigned int len, _OnSendHandler && handler);
bool doRecv(char * buf, unsigned int len, _OnRecvHandler && handler);
bool doClose();
void OnPostClose();
void onSelectMessage(bool rd, bool wt, bool err);
bool attachSocket(SOCKET s, const std::string& remoteIP, unsigned short remotePort);
private:
std::string logSection();
private:
EventLoopPtr _summer;
std::string _remoteIP;
unsigned short _remotePort = 0;
tagRegister _register;
_OnConnectHandler _onConnectHandler;
_OnRecvHandler _onRecvHandler;
unsigned int _iRecvLen = 0;
char * _pRecvBuf = NULL;
_OnSendHandler _onSendHandler;
unsigned int _iSendLen = 0;
char * _pSendBuf = NULL;
};
typedef std::shared_ptr<TcpSocket> TcpSocketPtr;
}
}
#endif
|
#ifndef _MATRIX_EXCEPT_
#define _MATRIX_EXCEPT_
#include <sstream>
#include <exception>
namespace math
{
class exception : public std::exception
{
std::string msg_;
public:
exception (const char* msg) throw() : msg_(msg) {;}
exception (const std::ostringstream& msg) throw() : msg_(msg.str().c_str()) {;}
exception () throw() : msg_() {;}
exception (const exception& ex) throw() : msg_(ex.what()) {;}
exception& operator= (const exception& ex) throw() {
msg_ = ex.what();
return *this;
}
virtual ~exception() throw() {;}
virtual const char* what() const throw() { return msg_.c_str(); }
};
#define THROW(X)\
math::exception ex(X);\
throw(ex);
}
#endif
|
/*
* cigargen.h
*
* Created on: Aug 28, 2014
* Author: ivan
*/
#ifndef CIGARGEN_H_
#define CIGARGEN_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <string>
#include <sstream>
#include <algorithm>
#include "libs/edlib.h"
#include "utility/utility_general.h"
#include "sequences/sequence_alignment.h"
#define EDLIB_M 0
#define EDLIB_EQUAL 0
#define EDLIB_X 3
#define EDLIB_I 1
#define EDLIB_D 2
#define EDLIB_S 4
#define EDLIB_H 5 /// Not used in GraphMap currently (26.01.2016.)
#define EDLIB_NOP 6
#define EDLIB_N 7 // Large gaps (e.g. splicing sites).
inline char EdlibOpToChar(int8_t op) {
return (op == EDLIB_M || op == EDLIB_EQUAL || op == EDLIB_X) ? 'M' :
(op == EDLIB_I) ? 'I' :
(op == EDLIB_D) ? 'D' :
(op == EDLIB_S) ? 'S' :
(op == EDLIB_H) ? 'H' : 0;
}
inline char EdlibOpToCharExtended(int8_t op) {
return (op == EDLIB_EQUAL) ? '=' :
(op == EDLIB_X) ? 'X' :
(op == EDLIB_M) ? 'M' :
(op == EDLIB_I) ? 'I' :
(op == EDLIB_D) ? 'D' :
(op == EDLIB_S) ? 'S' :
(op == EDLIB_H) ? 'H' : 0;
}
std::string AlignmentToCigar(unsigned char *alignment, int alignmentLength, bool extended_format);
int AlignmentToBasicCigar(unsigned char* alignment, int alignmentLength, char** cigar_);
int AlignmentToExtendedCigar(unsigned char* alignment, int alignmentLength, char** cigar_);
int AlignmentToExtendedCigarArray(unsigned char* alignment, int alignmentLength, std::vector<CigarOp> &cigar);
std::string AlignmentToMD(std::vector<unsigned char>& alignment, const int8_t *ref_data, int64_t alignment_position_start);
/// Searches for consecutive EDLIB_I and EDLIB_D (or vice versa) operations, and replaces the overlap with EDLIB_X.
std::vector<unsigned char> FixAlignment(unsigned char* alignment, int alignmentLength);
/// In case an alignment has leading/trailing EDLIB_I operations, they will be replaced with EDLIB_S.
int ConvertInsertionsToClipping(unsigned char* alignment, int alignmentLength);
/// Counts the number of leading and trailing clipped bases (or insertions).
int CountClippedBases(unsigned char* alignment, int alignmentLength, int64_t *ret_num_clipped_front, int64_t *ret_num_clipped_back);
/// Sums up the bases on the reference the alignment spans through (EDLIB_M and EDLIB_D operations).
int64_t CalculateReconstructedLength(unsigned char *alignment, int alignmentLength);
/// Counts each operation type, and calculates the alignment score as well (while rescoring the alignment with the given scores/penalties).
int CountAlignmentOperations(std::vector<unsigned char> &alignment, const int8_t *read_data, const int8_t *ref_data, int64_t reference_hit_id, int64_t alignment_position_start, SeqOrientation orientation,
int64_t match, int64_t mismatch, int64_t gap_open, int64_t gap_extend,
bool skip_leading_and_trailing_insertions,
int64_t *ret_eq, int64_t *ret_x, int64_t *ret_i, int64_t *ret_d, int64_t *ret_alignment_score, int64_t *ret_edit_dist, int64_t *ret_nonclipped_length);
/// Reverses the operations in a CIGAR string.
std::string ReverseCigarString(std::string &cigar);
std::string PrintAlignmentToString(const unsigned char* query, const int queryLength,
const unsigned char* target, const int targetLength,
const unsigned char* alignment, const int alignmentLength,
const int position, const int modeCode, int row_width=100);
int GetAlignmentPatterns(const unsigned char* query, const int64_t queryLength,
const unsigned char* target, const int64_t targetLength,
const unsigned char* alignment, const int64_t alignmentLength,
std::string &ret_query, std::string &ret_target, std::string &ret_match_pattern);
void FixAlignmentLeadingTrailingID(std::vector<unsigned char>& alignment, int64_t *ref_start, int64_t *ref_end);
#endif /* CIGARGEN_H_ */
|
/*
Fontname: -FreeType-PxPlus IBM VGA9-Medium-R-Normal--16-160-72-72-P-72-ISO10646-1
Copyright: Outline (vector) version (c) 2015 VileR
Glyphs: 18/781
BBX Build Mode: 2
*/
const uint8_t u8g2_font_pxplusibmvga9_mn[269] U8G2_FONT_SECTION("u8g2_font_pxplusibmvga9_mn") =
"\22\2\4\3\4\4\1\1\5\10\13\0\377\12\375\12\0\0\0\0\0\0\364 \7\271\345\307\227\0*\17"
"\271\345\207\26\21\242\71\210!\22\221\7\7+\15\271\345G 'e%'\217\2\0,\12\271\345\307\231"
"\234\62)\0-\11\271\345\307\340\36\23\0.\11\271\345\307\3\71i\0/\14\271\345\207\214\23\323\273x"
"\20\0\60\22\271e!\22Q$!$\241\37I\10\211(\42\6\61\13\271\345\21\233\242\323W\266\0\62"
"\15\271\345\250Q'\246w\62\42\267\0\63\17\271\345\250Q\247\210PN\211\214L\61\0\64\20\271e\22"
"\233\42\222\220\21\221\71\223SF\13\65\17\271e\70\221Sg(\247DF\246\30\0\66\22\271e\231\22"
"\223\223\263Q\42#\42#\42#S\14\67\14\271e\70\221\221S\246\235\346\0\70\25\271\345\250Q\42#"
"\42#S\243DFDFDF\246\30\0\71\20\271\345\250Q\42#\42#c\247\231\20\65\0:\14\271"
"\345\7\223\223G$'\17\7\0\0\0";
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <OfficeImport/CMShapeUtils.h>
@interface CMShapeUtils (Private)
+ (int)mapFormulaKeywordValue:(int)arg1 geometry:(id)arg2;
+ (float)normalizedAngle:(float)arg1;
+ (int)radToMilliMinutes:(double)arg1;
+ (double)milliMinutesToRad:(int)arg1;
+ (int)radToNativeAngle:(double)arg1 isEscher:(_Bool)arg2;
+ (double)nativeAngleToRad:(int)arg1 isEscher:(_Bool)arg2;
@end
|
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2022 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS___HONGKANGPARSER___H__
#define __OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS___HONGKANGPARSER___H__
#include <modules/spacecraftinstruments/util/sequenceparser.h>
#include <filesystem>
namespace openspace {
class HongKangParser : public SequenceParser {
public:
HongKangParser(std::string name, std::string fileName, std::string spacecraft,
const ghoul::Dictionary& translationDictionary,
std::vector<std::string> potentialTargets);
bool create() override;
std::string findPlaybookSpecifiedTarget(std::string line);
private:
std::filesystem::path _defaultCaptureImage;
double _metRef = 299180517;
std::string _name;
std::string _fileName;
std::string _spacecraft;
std::map<std::string, std::unique_ptr<Decoder>> _fileTranslation;
std::vector<std::string> _potentialTargets;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS___HONGKANGPARSER___H__
|
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Checks for usage of non-CLSCompliant types in public exposed entities.
//
//-------------------------------------------------------------------------------------------------
#pragma once
class CLSComplianceChecker
{
public:
static
void VerifyCLSCompliance(SourceFile * SourceFile);
static
void VerifyNameofProjectRootNamespaceIsCLSCompliant(
CompilerProject * Project,
ErrorTable * ErrorLog);
private:
CLSComplianceChecker(SourceFile * File)
{
VSASSERT( File,
"NULL Source File Unexpected!!!");
m_Compiler = File->GetCompiler();
}
void VerifyCLSComplianceForContainerAndNestedTypes(BCSYM_Container * Container);
void VerifyCLSComplianceForContainer(BCSYM_Container * Container);
void VerifyThatMembersAreNotMarkedCLSCompliant(BCSYM_Container * Container);
void VerifyMemberNotMarkedCLSCompliant(BCSYM_NamedRoot * Member);
static
bool ContainerIsPartOfRootNamespace(BCSYM_Container * Container);
void VerifyNameIsCLSCompliant(BCSYM_NamedRoot * NamedEntity);
static
bool IsNameCLSCompliant(_In_opt_z_ STRING * Name);
static
bool IsSyntheticMember(BCSYM_NamedRoot * Member);
static
bool IsExplicitlyMarkedCLSCompliant(BCSYM_NamedRoot * Member);
static
bool IsExplicitlyMarkedNonCLSCompliant(BCSYM_NamedRoot * Member);
void VerifyBasesForCLSCompliance(BCSYM_Container * Container);
void VerifyMembersForCLSCompliance(BCSYM_Container * Container);
void ValidateNonCLSCompliantMemberInCLSCompliantContainer(
BCSYM_NamedRoot * Member,
BCSYM_Container * ParentOfMember);
void VerifyProcForCLSCompliance(
BCSYM_Proc * Proc,
BCSYM_Container * ParentOfProc);
void VerifyOverloadsForCLSCompliance(BCSYM_Proc * PossiblyOverloadedProc);
void VerifyOverloadsForCLSCompliance(
BCSYM_Proc * OverloadedProc,
BCSYM_Proc * OverloadingProc);
void VerifyEnumUnderlyingTypeForCLSCompliance(BCSYM_Container * PossibleEnum);
void VerifyConstraintsAreCLSCompliant(BCSYM_NamedRoot * ContainerOrProc);
bool IsTypeCLSCompliant(
BCSYM * RawType,
BCSYM_NamedRoot * NamedContext);
static
bool IsAccessibleOutsideAssembly(BCSYM_NamedRoot * Member);
void ReportErrorOnSymbol(
ERRID ErrID,
BCSYM_NamedRoot * SymbolToReportErrorOn,
_In_opt_z_ STRING * ErrorReplString1 = NULL,
_In_opt_z_ STRING * ErrorReplString2 = NULL,
_In_opt_z_ STRING * ErrorReplString3 = NULL,
_In_opt_z_ STRING * ErrorReplString4 = NULL,
_In_opt_z_ STRING * ErrorReplString5 = NULL);
void ReportErrorOnSymbol(
ERRID ErrID,
BCSYM * SymbolToReportErrorOn,
BCSYM_NamedRoot * NamedContext,
_In_opt_z_ STRING * ErrorReplString1 = NULL,
_In_opt_z_ STRING * ErrorReplString2 = NULL,
_In_opt_z_ STRING * ErrorReplString3 = NULL,
_In_opt_z_ STRING * ErrorReplString4 = NULL,
_In_opt_z_ STRING * ErrorReplString5 = NULL);
void ReportErrorAtLocation(
ERRID ErrID,
Location * ErrorLocation,
BCSYM_NamedRoot * NamedContext,
_In_opt_z_ STRING * ErrorReplString1 = NULL,
_In_opt_z_ STRING * ErrorReplString2 = NULL,
_In_opt_z_ STRING * ErrorReplString3 = NULL,
_In_opt_z_ STRING * ErrorReplString4 = NULL,
_In_opt_z_ STRING * ErrorReplString5 = NULL);
Compiler *m_Compiler;
};
|
/* Include file for the GAPS plane class */
#ifndef __R3__PLANE__H__
#define __R3__PLANE__H__
/* Begin namespace */
namespace gaps {
/* Initialization functions */
int R3InitPlane();
void R3StopPlane();
/* Class definition */
class R3Plane {
public:
// Constructor functions
R3Plane(void);
R3Plane(const R3Plane& plane);
R3Plane(RNScalar a, RNScalar b, RNScalar c, RNScalar d);
R3Plane(const RNScalar array[4]);
R3Plane(const R3Vector& normal, RNScalar d);
R3Plane(const R3Point& point, const R3Vector& normal);
R3Plane(const R3Point& point, const R3Line& line);
R3Plane(const R3Point& point, const R3Vector& vector1, const R3Vector& vector2);
R3Plane(const R3Point& point1, const R3Point& point2, const R3Point& point3);
R3Plane(const RNArray<R3Point *>& points, RNBoolean polygon_vertices = TRUE);
R3Plane(R3Point *points, int npoints, RNBoolean polygon_vertices = TRUE);
// Property functions/operators
const RNScalar A(void) const;
const RNScalar B(void) const;
const RNScalar C(void) const;
const RNScalar D(void) const;
const RNScalar operator[](int i) const;
const R3Point Point(void) const;
const R3Vector& Normal(void) const;
const RNBoolean IsZero(void) const;
const RNBoolean operator==(const R3Plane& plane) const;
const RNBoolean operator!=(const R3Plane& plane) const;
// Manipulation functions/operators
void Flip(void);
void Mirror(const R3Plane& plane);
void Translate(const R3Vector& vector);
void Reposition(const R3Point& point);
void Align(const R3Vector& normal);
void Transform(const R3Transformation& transformation);
void InverseTransform(const R3Transformation& transformation);
void Reset(const R3Point& point, const R3Vector& normal);
// Draw functions/operators
void Draw(void) const;
// Arithmetic functions/operators
R3Plane operator-(void) const;
// Undocumented functions/operators
RNScalar& operator[](int i);
private:
R3Vector v;
RNScalar d;
};
/* Public variables */
extern const R3Plane R3null_plane;
extern const R3Plane R3posxz_plane;
extern const R3Plane R3posxy_plane;
extern const R3Plane R3posyz_plane;
extern const R3Plane R3negxz_plane;
extern const R3Plane R3negxy_plane;
extern const R3Plane R3negyz_plane;
#define R3xz_plane R3posxz_plane
#define R3xy_plane R3posxy_plane
#define R3yz_plane R3posyz_plane
/* Inline functions */
inline const RNScalar R3Plane::
A (void) const
{
return v[0];
}
inline const RNScalar R3Plane::
B (void) const
{
return v[1];
}
inline const RNScalar R3Plane::
C (void) const
{
return v[2];
}
inline const RNScalar R3Plane::
D (void) const
{
return d;
}
inline const RNScalar R3Plane::
operator[](int i) const
{
assert ((i>=0) && (i<=3));
return ((i == 3) ? d : v[i]);
}
inline const R3Vector& R3Plane::
Normal (void) const
{
return v;
}
inline const RNBoolean R3Plane::
IsZero (void) const
{
// Return whether plane has zero normal vector
return v.IsZero();
}
inline const RNBoolean R3Plane::
operator==(const R3Plane& plane) const
{
// Return whether plane is equal
return ((v == plane.v) && (d == plane.d));
}
inline const RNBoolean R3Plane::
operator!=(const R3Plane& plane) const
{
// Return whether plane is not equal
return (!(*this == plane));
}
inline R3Plane R3Plane::
operator-(void) const
{
// Return plane with flipped orientation
return R3Plane(-v, -d);
}
inline void R3Plane::
Flip(void)
{
v = -v;
d = -d;
}
inline void R3Plane::
Align(const R3Vector& normal)
{
// Align plane normal - keep same distance to origin
v = normal;
}
inline RNScalar& R3Plane::
operator[](int i)
{
assert ((i>=0) && (i<=3));
return ((i == 3) ? d : v[i]);
}
// End namespace
}
// End include guard
#endif
|
#ifndef __TABLE_H
#define __TABLE_H
/* Quick-and-dirty hash table implementation, mapping strings to void pointers (char * -> void *) */
#endif |
//
// TJSBaseCollectionViewCell.h
// TianJiCloud
//
// Created by 朱鹏 on 2017/8/2.
// Copyright © 2017年 TianJiMoney. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TJSBaseCollectionViewCellDelegate.h"
#import "TJSBaseCollectionReusableViewProtocol.h"
@interface TJSBaseCollectionViewCell : UICollectionViewCell<TJSBaseCollectionReusableViewProtocol>
@property (nonatomic,weak)id <TJSBaseCollectionViewCellDelegate> delegate;
@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/NSObject-Protocol.h>
@class DVTRangeArray, DVTSourceCodeLanguage, NSArray, NSAttributedString, NSDictionary, NSImage, NSString;
@protocol DVTTextCompletionItem <NSObject>
@property(readonly, copy) NSString *accessibilityLabel;
@property(readonly) BOOL notRecommended;
@property(retain) DVTRangeArray *fuzzyMatchingRanges;
@property double fuzzyMatchingScore;
@property double priority;
@property(readonly) unsigned long long priorityComparatorKind;
@property(readonly) long long priorityBucket;
@property(readonly) NSImage *icon;
@property(readonly, copy) NSAttributedString *descriptionText;
@property(readonly, copy) NSString *parentText;
@property(readonly, copy) NSString *completionText;
@property(readonly, copy) NSString *displayType;
@property(readonly, copy) NSString *displayText;
@property(readonly, copy, nonatomic) NSString *name;
@optional
@property(readonly) NSString *usr;
@property(readonly, copy) NSString *action;
@property(readonly) NSImage *highlightedStatusIcon;
@property(readonly) NSImage *statusIcon;
@property(readonly, copy) NSArray *additionalCompletions;
@property(readonly) int completionItemStyle;
@property(readonly) DVTSourceCodeLanguage *language;
@property(readonly, copy) NSString *displaySignature;
@property(readonly, copy) NSAttributedString *attributedDisplaySignature;
@property(readonly, copy) DVTRangeArray *briefDisplayTextRanges;
@property(readonly, copy) DVTRangeArray *displayTextRanges;
@property(readonly, copy) DVTRangeArray *nameRanges;
@property(readonly, copy) NSString *briefDisplayText;
@property(readonly, copy) NSAttributedString *attributedDisplayType;
- (unsigned long long)leadingCharactersToReplaceFromString:(NSString *)arg1 location:(unsigned long long)arg2;
- (void)attributedInfoWithContext:(NSDictionary *)arg1 completionBlock:(void (^)(NSAttributedString *))arg2;
@end
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The xbhcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHAIN_PARAMS_H
#define BITCOIN_CHAIN_PARAMS_H
#include "bignum.h"
#include "uint256.h"
#include <vector>
using namespace std;
#define MESSAGE_START_SIZE 4
typedef unsigned char MessageStartChars[MESSAGE_START_SIZE];
class CAddress;
class CBlock;
struct CDNSSeedData {
string name, host;
CDNSSeedData(const string &strName, const string &strHost) : name(strName), host(strHost) {}
};
/**
* CChainParams defines various tweakable parameters of a given instance of the
* xbhcoin system. There are three: the main network on which people trade goods
* and services, the public test network which gets reset from time to time and
* a regression test mode which is intended for private networks only. It has
* minimal difficulty to ensure that blocks can be found instantly.
*/
class CChainParams
{
public:
enum Network {
MAIN,
TESTNET,
REGTEST,
MAX_NETWORK_TYPES
};
enum Base58Type {
PUBKEY_ADDRESS,
SCRIPT_ADDRESS,
SECRET_KEY,
EXT_PUBLIC_KEY,
EXT_SECRET_KEY,
MAX_BASE58_TYPES
};
const uint256& HashGenesisBlock() const { return hashGenesisBlock; }
const MessageStartChars& MessageStart() const { return pchMessageStart; }
const vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
int GetDefaultPort() const { return nDefaultPort; }
const CBigNum& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
virtual const CBlock& GenesisBlock() const = 0;
virtual bool RequireRPCPassword() const { return true; }
const string& DataDir() const { return strDataDir; }
virtual Network NetworkID() const = 0;
const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
const std::vector<unsigned char> &Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
virtual const vector<CAddress>& FixedSeeds() const = 0;
int RPCPort() const { return nRPCPort; }
protected:
CChainParams() {}
uint256 hashGenesisBlock;
MessageStartChars pchMessageStart;
// Raw pub key bytes for the broadcast alert signing key.
vector<unsigned char> vAlertPubKey;
int nDefaultPort;
int nRPCPort;
CBigNum bnProofOfWorkLimit;
int nSubsidyHalvingInterval;
string strDataDir;
vector<CDNSSeedData> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
};
/**
* Return the currently selected parameters. This won't change after app startup
* outside of the unit tests.
*/
const CChainParams &Params();
/** Sets the params returned by Params() to those for the given network. */
void SelectParams(CChainParams::Network network);
/**
* Looks for -regtest or -testnet and then calls SelectParams as appropriate.
* Returns false if an invalid combination is given.
*/
bool SelectParamsFromCommandLine();
inline bool TestNet() {
// Note: it's deliberate that this returns "false" for regression test mode.
return Params().NetworkID() == CChainParams::TESTNET;
}
inline bool RegTest() {
return Params().NetworkID() == CChainParams::REGTEST;
}
#endif
|
void main(void) /* b mixed mode expression */
{
float x;
int y;
int w;
x = w + y ;
} |
#if !defined(PRIMITIVES_H)
/* ========================================================================
$File: $
$Date: $
$Revision: $
$Creator: Felipe Oliveira $
$Notice: (C) Copyright 2018 by Felpz. All Rights Reserved. $
======================================================================== */
#define PRIMITIVES_H
#include <glm/glm.hpp>
#include "shaderpp.h"
#include <vector>
struct line_t; /* handler for line primitive */
struct line_buffer_t; /* buffer for dynamic allocating lines */
struct point_set_t;
struct sphere_t;
struct generic_cone_t;
struct plane_t;
struct cube_t;
struct material_t;
struct Light;
struct lines3D_t;
struct point_list_t;
struct sphere_t * sphere_create(glm::vec3 center, float radius, int detail_level);
void sphere_render(struct sphere_t *sphere, Shader shader, Light *light, bool apply_transforms = true);
void sphere_bind_material(struct sphere_t *sphere, struct material_t *material);
void sphere_set_wireframe(struct sphere_t *sphere);
struct generic_cone_t *generic_cone_create(float radiusA,glm::vec3 mainAxisA, float radiusB, glm::vec3 mainAxisB,
double theta1, double theta2, int detail_level);
void generic_cone_render(struct generic_cone_t *generic_cone, Shader shader, Light *light, bool apply_transforms = true);
void generic_cone_bind_material(struct generic_cone_t *generic_cone,
struct material_t *material);
struct plane_t * plane_create(glm::vec3 point, glm::vec3 normal,
float side_length, int detail_level);
void plane_render(struct plane_t *plane, Shader shader, Light *light, bool apply_transforms = true);
void plane_bind_material(struct plane_t *plane, struct material_t *material);
//Cube is allways aligned to origin and centered at 0, rotate/scale yourself
struct cube_t *cube_create(float side, int detail_level);
void cube_bind_material(struct cube_t *cube, struct material_t *material);
void cube_render(struct cube_t *cube, Shader shader, Light *light, bool apply_transforms = true);
struct material_t *material_create(glm::vec3 albedo, int shouldLight=1);
struct material_t *material_create_index(glm::vec3 albedo, int index, int shouldLight=1);
void geometry_set_transform(void *geometry, glm::mat4 modeltransform);
struct line_t *line_create(glm::vec3 A, glm::vec3 B,
float base_radius, int detail_level);
void line_render(struct line_t *line, Shader shader, Light *light,
bool apply_transforms = true);
void line_bind_material(struct line_t *line, struct material_t *material);
struct line_buffer_t * line_buffer_create(int detail_level);
void line_buffer_push_line(struct line_buffer_t *buffer, glm::vec3 A, glm::vec3 B,
float base_radius);
void line_buffer_bind_material(struct line_buffer_t *buffer, struct material_t *material);
void line_buffer_finished(struct line_buffer_t *buffer);
void line_buffer_render(struct line_buffer_t *buffer, Shader shader,
Light *light, bool apply_transforms = true);
void line_buffer_transform(struct line_buffer_t *buffer, glm::mat4 rot,
glm::mat4 tra, glm::mat4 sca);
struct point_set_t * point_set_create(std::vector<glm::vec3> points);
void point_set_bind_material(struct point_set_t *set, struct material_t *material);
void point_set_render(struct point_set_t *set, Shader shader, Light *light);
////////////////////////// LINES 3D //////////////////////////////////////
struct lines3D_t * lines3D_create(std::vector<glm::vec3> data,
std::vector<glm::vec3> colors);
void lines3D_render(struct lines3D_t *lines3, Shader shader);
struct point_list_t *point_list_create(std::vector<glm::vec3> data,
std::vector<glm::vec3> colors);
void point_list_render(struct point_list_t *plist, Shader shader, float radius=3.0f);
//////////////////////////////////////////////////////////////////////////
// export material function
void check_and_bind_material_to_shader(struct material_t *material, Shader shader);
#endif |
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef TRANSACTIONTABLEMODEL_H
#define TRANSACTIONTABLEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class Credits_TransactionRecord;
class Bitcredit_TransactionTablePriv;
class Bitcredit_WalletModel;
class Credits_CWallet;
/** UI model for the transaction table of a wallet.
*/
class Bitcredit_TransactionTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit Bitcredit_TransactionTableModel(Credits_CWallet* credits_wallet, Credits_CWallet *keyholder_wallet, bool isForDepositWallet, Bitcredit_WalletModel *parent = 0);
~Bitcredit_TransactionTableModel();
enum ColumnIndex {
Status = 0,
Date = 1,
Type = 2,
ToAddress = 3,
Amount = 4,
DepositAmount = 4
};
/** Roles to get specific information from a transaction row.
These are independent of column.
*/
enum RoleIndex {
/** Type of transaction */
TypeRole = Qt::UserRole,
/** Date and time this transaction was created */
DateRole,
/** Long description (HTML format) */
LongDescriptionRole,
/** Address of transaction */
AddressRole,
/** Label of address related to transaction */
LabelRole,
/** Net amount of transaction */
AmountRole,
/** Unique identifier */
TxIDRole,
/** Transaction hash */
TxHashRole,
/** Is transaction confirmed? */
ConfirmedRole,
/** Formatted amount, without brackets when unconfirmed */
FormattedAmountRole,
/** Formatted amount, without brackets when unconfirmed */
FormattedDepositAmountRole,
/** Transaction status (Credits_TransactionRecord::Status) */
StatusRole
};
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
private:
Credits_CWallet* wallet;
Credits_CWallet* keyholder_wallet;
Bitcredit_WalletModel *walletModel;
QStringList columns;
Bitcredit_TransactionTablePriv *priv;
bool isForDepositWallet;
QString lookupAddress(const std::string &address, bool tooltip) const;
QVariant addressColor(const Credits_TransactionRecord *wtx) const;
QString formatTxStatus(const Credits_TransactionRecord *wtx) const;
QString formatTxDate(const Credits_TransactionRecord *wtx) const;
QString formatTxType(const Credits_TransactionRecord *wtx) const;
QString formatTxToAddress(const Credits_TransactionRecord *wtx, bool tooltip) const;
QString formatTxAmount(const Credits_TransactionRecord *wtx, bool showUnconfirmed=true) const;
QString formatTxAmountWithDeposit(const Credits_TransactionRecord *wtx, bool showUnconfirmed=true) const;
QString formatTxDepositAmount(const Credits_TransactionRecord *wtx) const;
QString formatTooltip(const Credits_TransactionRecord *rec) const;
QVariant txStatusDecoration(const Credits_TransactionRecord *wtx) const;
QVariant txAddressDecoration(const Credits_TransactionRecord *wtx) const;
public slots:
void updateTransaction(const QString &hash, int status);
void updateConfirmations();
void updateDisplayUnit();
friend class Bitcredit_TransactionTablePriv;
};
#endif // TRANSACTIONTABLEMODEL_H
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef __cplusplus
# error This header can only be compiled as C++.
#endif
#ifndef __INCLUDED_PROTOCOL_H__
#define __INCLUDED_PROTOCOL_H__
#include "serialize.h"
#include "netbase.h"
#include <string>
#include "uint256.h"
extern bool fTestNet;
static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)
{
return testnet ? 18424 : 8424;
}
extern unsigned char pchMessageStart[4];
/** Message header.
* (4) message start.
* (12) command.
* (4) size.
* (4) checksum.
*/
class CMessageHeader
{
public:
CMessageHeader();
CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn);
std::string GetCommand() const;
bool IsValid() const;
IMPLEMENT_SERIALIZE
(
READWRITE(FLATDATA(pchMessageStart));
READWRITE(FLATDATA(pchCommand));
READWRITE(nMessageSize);
READWRITE(nChecksum);
)
// TODO: make private (improves encapsulation)
public:
enum {
MESSAGE_START_SIZE=sizeof(::pchMessageStart),
COMMAND_SIZE=12,
MESSAGE_SIZE_SIZE=sizeof(int),
CHECKSUM_SIZE=sizeof(int),
MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE,
CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE
};
char pchMessageStart[MESSAGE_START_SIZE];
char pchCommand[COMMAND_SIZE];
unsigned int nMessageSize;
unsigned int nChecksum;
};
/** nServices flags */
enum
{
NODE_NETWORK = (1 << 0),
};
/** A CService with information about it as peer */
class CAddress : public CService
{
public:
CAddress();
explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK);
void Init();
IMPLEMENT_SERIALIZE
(
CAddress* pthis = const_cast<CAddress*>(this);
CService* pip = (CService*)pthis;
if (fRead)
pthis->Init();
if (nType & SER_DISK)
READWRITE(nVersion);
if ((nType & SER_DISK) ||
(nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH)))
READWRITE(nTime);
READWRITE(nServices);
READWRITE(*pip);
)
void print() const;
// TODO: make private (improves encapsulation)
public:
uint64 nServices;
// disk and network only
unsigned int nTime;
// memory only
int64 nLastTry;
};
/** inv message data */
class CInv
{
public:
CInv();
CInv(int typeIn, const uint256& hashIn);
CInv(const std::string& strType, const uint256& hashIn);
IMPLEMENT_SERIALIZE
(
READWRITE(type);
READWRITE(hash);
)
friend bool operator<(const CInv& a, const CInv& b);
bool IsKnownType() const;
const char* GetCommand() const;
std::string ToString() const;
void print() const;
// TODO: make private (improves encapsulation)
public:
int type;
uint256 hash;
};
#endif // __INCLUDED_PROTOCOL_H__
|
//
// ViewController.h
// AFNetworking
//
// Created by Kevin on 15/3/25.
// Copyright (c) 2015年 Kevin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
#include "../global.h"
#include "../Menu.h"
extern FlashTask flashTask;
extern bool newFWFlashed;
extern bool gotFWFlashError;
extern bool gotFWChecksumError;
extern char md5FPGAServer[48];
bool fpgaFlashStarted;
void flashFPGACascade(int pos, bool force);
void readStoredMD5SumFlash(int pos, bool force, const char* fname, char* md5sum);
void checkStoredMD5SumFlash(int pos, bool force, int line, const char* fname, char* storedMD5Sum, char* serverMD5Sum);
ProgressCallback createFPGAFlashProgressCallback(int pos, bool force, int line);
Menu fpgaFlashMenu("FPGAFlashMenu", OSD_FIRMWARE_CONFIG_RECONFIG_MENU, NO_SELECT_LINE, NO_SELECT_LINE, [](uint16_t controller_data, uint8_t menu_activeLine, bool isRepeat) {
if (!isRepeat && CHECK_CTRLR_MASK(controller_data, MENU_CANCEL)) {
_readFile("/etc/firmware_variant", firmwareVariant, 64, DEFAULT_FW_VARIANT);
currentMenu = &firmwareConfigMenu;
currentMenu->Display();
return;
}
if (!isRepeat && CHECK_CTRLR_MASK(controller_data, MENU_OK)) {
if (!fpgaFlashStarted) {
fpgaFlashStarted = true;
newFWFlashed = false;
gotFWFlashError = false;
gotFWChecksumError = false;
flashFPGACascade(0, true);
}
return;
}
}, NULL, [](uint8_t Address, uint8_t Value) {
fpgaFlashStarted = false;
}, true);
void flashFPGACascade(int pos, bool force) {
DEBUG2("flashFPGACascade: %i\n", pos);
switch (pos) {
case 0:
currentMenu->startTransaction();
flashFPGACascade(pos + 1, force);
break;
case 1:
fpgaTask.DoWriteToOSD(0, MENU_OFFSET + MENU_BUTTON_LINE, (uint8_t*) MENU_BACK_LINE, [ pos, force ]() {
flashFPGACascade(pos + 1, force);
});
break;
/*
FPGA
*/
case 2: // Check for FPGA firmware version
if (force) {
flashFPGACascade(pos + 2, force);
} else {
_readFile(SERVER_FPGA_MD5, md5FPGAServer, 33, DEFAULT_MD5_SUM_ALT);
readStoredMD5SumFlash(pos, force, STAGED_FPGA_MD5, md5FPGA);
}
break;
case 3:
checkStoredMD5SumFlash(pos, force, MENU_FWCONF_RECONF_FPGA_LINE, LOCAL_FPGA_MD5, md5FPGA, md5FPGAServer);
break;
case 4: // Flash FPGA firmware
flashTask.SetProgressCallback(createFPGAFlashProgressCallback(pos, force, MENU_FWCONF_RECONF_FPGA_LINE));
taskManager.StartTask(&flashTask);
break;
case 5:
flashTask.ClearProgressCallback();
const char* result;
if (gotFWFlashError) {
result = (
" ERROR switching firmware! "
"Please try again! DO NOT restart system!"
);
} else if (gotFWChecksumError) {
result = (
" Checksum error on one or more files! "
" Please download firmware again! "
);
} else {
if (newFWFlashed) {
result = (
" Firmware successfully switched! "
);
} else {
result = (
" Firmware is already up to date!"
);
}
}
fpgaTask.DoWriteToOSD(0, MENU_OFFSET + MENU_FWCONF_RECONF_RESULT_LINE, (uint8_t*) result, [ pos, force ]() {
flashFPGACascade(pos + 1, force);
});
break;
case 6:
if (!gotFWFlashError) {
_writeFile("/etc/firmware_variant", firmwareVariant, 64);
fpgaTask.DoResetFPGA();
}
default:
currentMenu->endTransaction();
break;
}
}
ProgressCallback createFPGAFlashProgressCallback(int pos, bool force, int line) {
return [ pos, force, line ](int read, int total, bool done, int error) {
if (error != NO_ERROR) {
gotFWFlashError = true;
fpgaTask.DoWriteToOSD(12, MENU_OFFSET + line, (uint8_t*) "[ ERROR FLASHING ] done.", [ pos, force ]() {
flashFPGACascade(pos + 1, force);
});
return;
}
if (done) {
fpgaTask.DoWriteToOSD(12, MENU_OFFSET + line, (uint8_t*) "[********************] done.", [ pos, force ]() {
// IMPORTANT: do only advance here, if done is true!!!!!
newFWFlashed |= true;
flashFPGACascade(pos + 1, force);
});
return;
}
displayProgress(read, total, line);
};
}
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2016 Zumobi Inc.
*
* 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>
#import "ZBiM.h"
@interface ZBiMContentHubContainerViewController : UIViewController<UIScrollViewDelegate, UIWebViewDelegate, ZBiMContentHubContainerDelegate>
@property (nonatomic, weak) IBOutlet UIView *contentHubContainerView;
@property (nonatomic, weak) IBOutlet UIButton *closeButton;
@property (nonatomic, weak) IBOutlet UIButton *backButton;
@property (nonatomic, weak) IBOutlet UIView *navBar;
@property (nonatomic, weak) IBOutlet UISegmentedControl *tabPicker;
@property (nonatomic, weak) IBOutlet UIWebView *regularWebView;
@property (nonatomic, weak) IBOutlet UILabel *resourceTypeLabel;
@property (nonatomic, weak) IBOutlet UILabel *titleLabel;
@property (nonatomic, strong) NSString *uriOverride;
@property (nonatomic, strong) NSArray *tagsOverride;
- (IBAction)backButtonPressed:(id)sender;
- (IBAction)closeButtonPressed:(id)sender;
- (IBAction)tabPickerSelectionChanged:(id)sender;
@end
|
#ifndef STATE_H
#define STATE_H
#include <string>
#include <memory>
#include "external/json/json.h"
#include "entitymanager.h"
#include "camera.h"
#include "luascript.h"
///Base class for states
/**
* The base class for our state machine, provides functions
* for initializing state, running the state and memory clean-up
*/
class State {
public:
State();
virtual ~State();
/**
* Run the state, this function becomes the main Input thread
* after starting up the physics and rendering threads
* @return The next state to run, returning quit exits program
*/
virtual std::string Run();
/**
* Set the exit code to return from Run and set exit to true
* @param val The exit code to return from Run
* @see Run
*/
void SetExit(std::string val);
///Set exit to false
void UnsetExit();
///Get the State's EntityManager
std::shared_ptr<EntityManager> Manager();
/**
* Set the state's name
* @param name The name to set
*/
void SetName(std::string name);
///Get the state's name
std::string Name();
/**
* Save the state data so that it can be loaded later
* @return Json::Value containing the state data
*/
virtual Json::Value Save();
/**
* Load the state from a Json::Value
* @param val The Json::Value to load from
*/
virtual void Load(Json::Value val);
protected:
/**
* The state's rendering thread, takes care of drawing all objects
* and providing framerate limiting condition variable notifications
* to all other threads
* NOT USED AT THE MOMENT
*/
//virtual void RenderThread() = 0;
/**
* The state's physics thread, takes care of updating and moving
* all objects and managing physics between the objects
* NOT USED AT THE MOMENT
*/
//virtual void PhysicsThread() = 0;
///Initialize state memory
virtual void Init();
///Free the memory used by the state
virtual void Free();
///Is this good? I don't know.
///Call the script's LogicUpdate function
virtual void LogicUpdate();
///Call the script's RenderUpdate function
virtual void RenderUpdate();
private:
/**
* Store references to the state object in the script and
* the functions we'll be calling on it
*/
void StoreRefs();
protected:
std::shared_ptr<EntityManager> mManager;
std::shared_ptr<Camera> mCamera;
std::string mName;
//Should this be atomic?
bool mExit;
std::string mExitCode;
///The state's script
LuaScript mScript;
///Condition variable and double check bool variable
//std::condition_variable mCondVar;
//Do i need this?
//std::atomic<bool> mCondBool;
};
#endif |
//
// SafeObjectMacro.h
// LayZhangDemo
//
// Created by LayZhang on 2017/8/24.
// Copyright © 2017年 Zhanglei. All rights reserved.
//
#ifndef SafeObjectMacro_h
#define SafeObjectMacro_h
//#import "NSObject+Safe.h"
//#import "NSArray+Safe.h"
//#import "NSMutableArray+Safe.h"
//#import "NSDictionary+Safe.h"
//#import "NSMutableDictionary+Safe.h"
//#import "NSMutableSet+Safe.h"
#endif /* SafeObjectMacro_h */
|
//
// PGDatePicker+Common.h
// Demo
//
// Created by piggybear on 2018/3/18.
// Copyright © 2018年 piggybear. All rights reserved.
//
#import "PGDatePicker.h"
@interface PGDatePicker (Common)
- (NSInteger)weekDayMappingFrom:(NSString *)weekString;
- (NSString *)weekMappingFrom:(NSInteger)weekDay;
- (NSInteger)daysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month;
@end
|
/**********************************************************************
regversion.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "config.h"
#include "regint.h"
#include <stdio.h>
extern const char*
onig_version(void)
{
static char s[12];
xsnprintf(s, sizeof(s), "%d.%d.%d",
ONIGURUMA_VERSION_MAJOR,
ONIGURUMA_VERSION_MINOR,
ONIGURUMA_VERSION_TEENY);
return s;
}
extern const char*
onig_copyright(void)
{
static char s[58];
xsnprintf(s, sizeof(s),
"Oniguruma %d.%d.%d : Copyright (C) 2002-2018 K.Kosako",
ONIGURUMA_VERSION_MAJOR,
ONIGURUMA_VERSION_MINOR,
ONIGURUMA_VERSION_TEENY);
return s;
}
|
//
// XHTextFieldScrollView.h
// XHTextField
//
// Created by 曾 宪华 on 13-12-18.
// Copyright (c) 2013年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^DidDisMissCompledBlock)(void);
@class XHTextField;
@protocol XHTextFieldScrollViewDelegate <NSObject>
@required
- (void)keyboardDidShow;
- (void)keyboardDidScrollToPoint:(CGPoint)point;
- (void)keyboardWillBeDismissed;
- (void)keyboardWillSnapBackToPoint:(CGPoint)point;
@end
@interface XHTextFieldScrollView : UIScrollView
@property (nonatomic, assign) id <XHTextFieldScrollViewDelegate> textFieldScrollViewDelegate;
@property (nonatomic, strong) UIPanGestureRecognizer *dismissivePanGestureRecognizer;
@property (nonatomic, copy) DidDisMissCompledBlock didDisMissCompledBlock;
@end
|
#pragma once
#include "LuaPlus.h"
/* Manages lua state object */
class LuaManager
{
private:
LuaPlus::LuaState* luaState;
public:
LuaManager(void);
~LuaManager(void);
void ExecuteFile(char* fileName);
};
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <iWorkImport/TSCH3DSceneObject.h>
// Not exported
@interface TSCH3DChartStageSceneObject : TSCH3DSceneObject
{
TSCH3DSceneObject *mMain;
}
+ (id)objectWithMain:(id)arg1;
- (void)postGetBounds:(id)arg1;
- (void)postrender:(id)arg1;
- (void)getSelectionKnobsPositions:(id)arg1;
- (void)rayPick:(id)arg1;
- (void)getBounds:(id)arg1;
- (void)render:(id)arg1;
- (void)render:(id)arg1 selector:(SEL)arg2;
- (void)prerender:(id)arg1;
- (void)dealloc;
- (id)initWithMain:(id)arg1;
@end
|
/*
* Program from Fig.8 of
* 2013FSE - Nori,Sharma - Termination Proofs from Tests
*
* Date: 18.12.2013
* Author: heizmann@informatik.uni-freiburg.de
*
*/
typedef enum {false, true} bool;
extern int __VERIFIER_nondet_int(void);
int main() {
int c, u, v, w, x, y, z;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
z = __VERIFIER_nondet_int();
u = x;
v = y;
w = z;
c = 0;
while (x >= y) {
c = c + 1;
if (z > 1) {
z = z - 1;
x = x + z;
} else {
y = y + 1;
}
}
return 0;
}
|
//
// stockChartDataSource.h
// cvChart
//
// Created by He Jun on 10-7-27.
// Copyright 2010 SmilingMobile. All rights reserved.
//
typedef enum {
StockDataIntraDay = 0,
StockDataOneWeek,
StockDataThreeWeeks,
StockDataOneMonth,
StockDataThreeMonths,
StockDataSixMonths,
StockDataOneYear,
StockDataTwoYears,
StockDataThreeYears,
StockDataFiveYears,
StockDataMax,
}StockDataTimeFrame_e;
@protocol StockChartDataSource
@required
- (NSArray *)ChartGetRecordsByName:(NSString *)name Period:(StockDataTimeFrame_e)timeFrame;
@end
|
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Copyright (c) 2014-2019 The DigiByte Core developers
// Copyright (c) 2014-2019 The Auroracoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef AURORACOIN_LIMITEDMAP_H
#define AURORACOIN_LIMITEDMAP_H
#include <assert.h>
#include <map>
/** 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:
explicit limitedmap(size_type nMaxSizeIn)
{
assert(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 (map.size() > nMaxSize) {
map.erase(rmap.begin()->second);
rmap.erase(rmap.begin());
}
rmap.insert(make_pair(x.second, ret.first));
}
}
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);
}
void update(const_iterator itIn, const mapped_type& v)
{
// Using map::erase() with empty range instead of map::find() to get a non-const iterator,
// since it is a constant time operation in C++11. For more details, see
// https://stackoverflow.com/questions/765148/how-to-remove-constness-of-const-iterator
iterator itTarget = map.erase(itIn, itIn);
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);
}
size_type max_size() const { return nMaxSize; }
size_type max_size(size_type s)
{
assert(s > 0);
while (map.size() > s) {
map.erase(rmap.begin()->second);
rmap.erase(rmap.begin());
}
nMaxSize = s;
return nMaxSize;
}
};
#endif // AURORACOIN_LIMITEDMAP_H
|
/*numPass=9, numTotal=9
Verdict:ACCEPTED, Visibility:1, Input:"4 10
-1 6", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:1, Input:"4 10
-1 3", ExpOutput:"NO
", Output:"NO"
Verdict:ACCEPTED, Visibility:1, Input:"10 20
20 50", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:1, Input:"0 0
-1 0", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:0, Input:"-1 -5
-6 9", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:0, Input:"0 1
1 10", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:0, Input:"7 9
2 3", ExpOutput:"NO
", Output:"NO"
Verdict:ACCEPTED, Visibility:0, Input:"1 10
5 7", ExpOutput:"YES
", Output:"YES"
Verdict:ACCEPTED, Visibility:0, Input:"8 10
5 7", ExpOutput:"NO
", Output:"NO"
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
int i;
struct point { int leftindex; int rightindex;};
struct point* pts;
pts=(struct point*)malloc(2*sizeof(struct point));
for(i=0;i<2;i++){
scanf("%d %d\n", &((pts[i]).leftindex),&((pts[i]).rightindex));
}
if((pts[0]).leftindex<=(pts[1]).rightindex)
{
printf("YES");
}
else if((pts[1]).leftindex>=(pts[0]).rightindex)
{
printf("YES");
}
else {printf("NO");}
return 0;
} |
//
// ViewController.h
// 滚动顶部视图处理练习
//
// Created by ShenYj on 2016/10/20.
// Copyright © 2016年 ShenYj. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */
/*=========================================================================
Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of future
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#define MAX_DISTANCE_SQ 100000
#define MIN_TOL 0.00005
#include "mex.h"
#include "MARS_findFaces.h"
#include "math.h"
#include "time.h"
static const size_t size = 1<<16;
static const int iteration = 1000000;
void
mexFunction(
int nlhs,
mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
{
srand( time(NULL));
float point[3];
float v0[3];
float v1[3];
float v2[3];
int i;
v0[0] = 20.8820;
v0[0] = -89.1166;
v0[1] = -40.2763;
v1[0] = 20.4478;
v1[0] = -89.3205;
v1[1] = -40.0466;
v2[0] = 20.9045;
v2[0] = -88.8135;
v2[1] = -40.9288;
for (i = 0; i < iteration; i++)
{
point[0] = ((double) rand())/RAND_MAX * 100;
point[1] = ((double) rand())/RAND_MAX * 100;
point[2] = ((double) rand())/RAND_MAX * 100;
isInTriangle(point, v0, v1, v2, 1e-5);
}
}
|
/*
* Copyright (C) 2013-2015
*
* @author jxfengzi@gmail.com
* @date 2013-11-19
*
* @file ActionResponse.h
*
* @remark
*
*/
#ifndef __ACTION_RESPONSE_H__
#define __ACTION_RESPONSE_H__
#include "tiny_base.h"
#include "UpnpAction.h"
#include "UpnpError.h"
#include "HttpMessage.h"
TINY_BEGIN_DECLS
TinyRet ActionFromResponse(UpnpAction *action, UpnpError *error, HttpMessage *response);
TinyRet ActionToResponse(UpnpAction *action, HttpMessage *response);
TINY_END_DECLS
#endif /* __ACTION_RESPONSE_H__ */ |
/*numPass=0, numTotal=9
Verdict:WRONG_ANSWER, Visibility:1, Input:"abcdef", ExpOutput:"bdfhjl", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"wxyz", ExpOutput:"tvxz", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"zyxw", ExpOutput:"zxvt", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"t", ExpOutput:"n", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"lly", ExpOutput:"xxx", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"qwerty", ExpOutput:"htjjnx", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"manuallyaddedtestcases", ExpOutput:"zbbpbxxxbhhjhnjlnfbljl", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"yllyl", ExpOutput:"xxxxx", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"visibility", ExpOutput:"rrlrdrxrnx", Output:""
*/
#include <stdio.h>
int main() {
int i=0;
char stri[100],stro[i];
for(i=0;i<=100;i++)
{
scanf("%c",&stri[i]);
while(stri[i]!='\0')
{
return 0;
}
stro[i]=stri[i]+stri[i]-96;
if(stro[i]>122)
{
stro[i]=stro[i]-122+96;
printf("%c",stro[i]);
}
else
printf("%c",stro[i]);
}
return 0;
} |
//
// CTVideoRecord.h
// yili
//
// Created by casa on 15/10/21.
// Copyright © 2015年 Beauty Sight Network Technology Co.,Ltd. All rights reserved.
//
#import <CTPersistance/CTPersistance.h>
typedef NS_ENUM(NSUInteger, CTVideoRecordStatus) {
// record status when downloading
CTVideoRecordStatusDownloading = 0,
CTVideoRecordStatusDownloadFinished = 1,
CTVideoRecordStatusDownloadFailed = 2,
CTVideoRecordStatusWaitingForDownload = 3,
// record status when finding
CTVideoRecordStatusNotFound = 4,
CTVideoRecordStatusNative = 5,
CTVideoRecordStatusPaused = 6,
};
@interface CTVideoRecord : CTPersistanceRecord
@property (nonatomic, copy) NSNumber *identifier;
@property (nonatomic, copy) NSString *remoteUrl;
@property (nonatomic, copy) NSString *nativeUrl;
@property (nonatomic, copy) NSNumber *status;
@property (nonatomic, copy) NSNumber *progress;
@end
|
#include "Player.h"
#include "display.h"
class HumanPlayerStub: public Player {
public:
HumanPlayerStub(int displayPos, int initialMoney);
int bet(int minimumBid, display gameDisplay);
int discard(display gameDisplay);
};
|
#ifndef SAKI_GIRL_ACHIGA_YUU_H
#define SAKI_GIRL_ACHIGA_YUU_H
#include "../table/girl.h"
namespace saki
{
class Yuu : public GirlCrtp<Yuu>
{
public:
using GirlCrtp<Yuu>::GirlCrtp;
void onMonkey(std::array<Exist, 4> &exists, const Table &table) override;
void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override;
private:
static const int LV5_VAL = 90;
static const int LV4_VAL = 60;
static const int LV3_VAL = 30;
static const std::vector<T34> LV5_TARS;
static const std::vector<T34> LV4_TARS;
static const std::vector<T34> LV3_TARS;
};
} // namespace saki
#endif // SAKI_GIRL_ACHIGA_YUU_H
|
//
// NewsProvider.h
// News
//
// Created by vic on 16/1/22.
// Copyright © 2016年 NW. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NewsProvider : NSObject
+ (instancetype)shareInstance;
- (void)fetchInfoListSuccess:(void(^)(NSArray *list))success
failure:(void(^)(NSError *error))failure;
@end
|
// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include <memory>
#include "swganh_core/messages/controllers/command_queue_enqueue.h"
#include "command_interface.h"
#include "command_properties.h"
namespace swganh
{
namespace observer
{
class ObserverInterface;
}
}
namespace swganh
{
namespace app
{
class SwganhKernel;
}
namespace object
{
class Object;
class Creature;
}
namespace messages
{
namespace controllers
{
class CommandQueueEnqueue;
}
} // namespace messages::controllers
namespace command
{
class BaseSwgCommand : public CommandInterface
{
public:
virtual void Initialize(swganh::app::SwganhKernel* kernel, const CommandProperties& properties);
const std::shared_ptr<swganh::observer::ObserverInterface> GetController() const;
void SetController(std::shared_ptr<swganh::observer::ObserverInterface> controller);
virtual bool Validate();
swganh::app::SwganhKernel* GetKernel() const;
uint32_t GetActionCounter() const;
uint32_t GetPriority() const;
CommandGroup GetCommandGroup() const;
uint32_t GetTargetRequiredType() const;
uint64_t GetAllowedStateBitmask() const;
uint64_t GetAllowedLocomotionBitmask() const;
float GetMaxRangeToTarget() const;
float GetDefaultTime() const;
std::string GetRequiredAbility() const;
bool IsQueuedCommand() const;
const std::shared_ptr<object::Object>& GetActor() const;
void SetActor(std::shared_ptr<object::Object> object);
const std::shared_ptr<object::Object>& GetTarget() const;
std::shared_ptr<object::Creature> GetTargetCreature();
void SetTarget(std::shared_ptr<object::Object> target);
const std::wstring& GetCommandString() const;
virtual void SetCommandProperties(const CommandProperties& properties);
virtual void PostRun(bool success) {}
const swganh::messages::controllers::CommandQueueEnqueue& GetCommandRequest() const;
void SetCommandRequest(swganh::messages::controllers::CommandQueueEnqueue command_request);
private:
swganh::app::SwganhKernel* kernel_;
const CommandProperties* properties_;
std::shared_ptr<swganh::observer::ObserverInterface> controller_;
mutable std::shared_ptr<object::Object> actor_;
mutable std::shared_ptr<object::Object> target_;
swganh::messages::controllers::CommandQueueEnqueue command_request_;
};
}
}
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
@interface SimLocalThrowable : NSObject
{
id _data;
}
+ (id)throwableWithData:(id)arg1;
@property (retain, nonatomic) id data;
- (id)initWithData:(id)arg1;
@end
|
/*
* Copyright 2019 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrDawnProgramBuilder_DEFINED
# define GrDawnProgramBuilder_DEFINED
# include "src/gpu/dawn/GrDawnProgramDataManager.h"
# include "src/gpu/dawn/GrDawnUniformHandler.h"
# include "src/gpu/dawn/GrDawnVaryingHandler.h"
# include "src/sksl/SkSLCompiler.h"
# include "dawn/dawncpp.h"
# include "src/gpu/glsl/GrGLSLProgramBuilder.h"
class GrPipeline;
struct GrDawnProgram : public SkRefCnt
{
struct RenderTargetState
{
SkISize fRenderTargetSize;
GrSurfaceOrigin fRenderTargetOrigin;
RenderTargetState()
{
this->invalidate();
}
void invalidate()
{
fRenderTargetSize.fWidth = -1;
fRenderTargetSize.fHeight = -1;
fRenderTargetOrigin = (GrSurfaceOrigin) -1;
}
/**
* Gets a float4 that adjusts the position from Skia device coords to GL's normalized device
* coords. Assuming the transformed position, pos, is a homogeneous float3, the vec, v, is
* applied as such:
* pos.x = dot(v.xy, pos.xz)
* pos.y = dot(v.zw, pos.yz)
*/
void getRTAdjustmentVec(float* destVec)
{
destVec[0] = 2.f / fRenderTargetSize.fWidth;
destVec[1] = -1.f;
if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin)
{
destVec[2] = -2.f / fRenderTargetSize.fHeight;
destVec[3] = 1.f;
}
else
{
destVec[2] = 2.f / fRenderTargetSize.fHeight;
destVec[3] = -1.f;
}
}
};
typedef GrGLSLBuiltinUniformHandles BuiltinUniformHandles;
GrDawnProgram(const GrDawnUniformHandler::UniformInfoArray& uniforms, uint32_t geometryUniformSize, uint32_t fragmentUniformSize)
: fDataManager(uniforms, geometryUniformSize, fragmentUniformSize)
{
}
std::unique_ptr<GrGLSLPrimitiveProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fFragmentProcessors;
int fFragmentProcessorCnt;
dawn::BindGroupLayout fBindGroupLayout;
dawn::RenderPipeline fRenderPipeline;
GrDawnProgramDataManager fDataManager;
RenderTargetState fRenderTargetState;
BuiltinUniformHandles fBuiltinUniformHandles;
void setRenderTargetState(const GrRenderTarget*, GrSurfaceOrigin);
dawn::BindGroup setData(GrDawnGpu* gpu, const GrRenderTarget*, GrSurfaceOrigin origin, const GrPrimitiveProcessor&, const GrPipeline&, const GrTextureProxy* const primProcTextures[]);
};
class GrDawnProgramBuilder : public GrGLSLProgramBuilder
{
public:
static sk_sp<GrDawnProgram> Build(GrDawnGpu*, GrRenderTarget* renderTarget, GrSurfaceOrigin origin, const GrPipeline&, const GrPrimitiveProcessor&, const GrTextureProxy* const primProcProxies[], GrPrimitiveType primitiveType, dawn::TextureFormat colorFormat, bool hasDepthStencil, dawn::TextureFormat depthStencilFormat, GrProgramDesc* desc);
const GrCaps* caps() const override;
GrGLSLUniformHandler* uniformHandler() override
{
return &fUniformHandler;
}
const GrGLSLUniformHandler* uniformHandler() const override
{
return &fUniformHandler;
}
GrGLSLVaryingHandler* varyingHandler() override
{
return &fVaryingHandler;
}
GrDawnGpu* gpu() const
{
return fGpu;
}
private:
GrDawnProgramBuilder(GrDawnGpu*, GrRenderTarget*, GrSurfaceOrigin, const GrPrimitiveProcessor&, const GrTextureProxy* const primProcProxies[], const GrPipeline&, GrProgramDesc*);
dawn::ShaderModule createShaderModule(const GrGLSLShaderBuilder&, SkSL::Program::Kind, SkSL::Program::Inputs* inputs);
GrDawnGpu* fGpu;
GrDawnVaryingHandler fVaryingHandler;
GrDawnUniformHandler fUniformHandler;
typedef GrGLSLProgramBuilder INHERITED;
};
#endif
|
/*
** Copyright 2014-2015 Robert Fratto. See the LICENSE.txt file at the top-level
** directory of this distribution.
**
** Licensed under the MIT license <http://opensource.org/licenses/MIT>. This file
** may not be copied, modified, or distributed except according to those terms.
*/
#include "AST.h"
#include "Values.h"
#include "Block.h"
#include "generator.h"
#include "VarExpr.h"
#include "BinOpExpr.h"
#include "ReturnStmt.h"
#include "FuncCall.h"
#include "NegativeExpr.h"
#include "ExternFunction.h"
#include "CondBlock.h"
#include "IfStmts.h"
#include "IncrementExpr.h"
#include "ExplicitDeclStmt.h"
#include "Loop.h"
#include "LoopSkip.h"
#include "ArrayExpr.h"
#include "ArrayAccess.h"
#include "CastExpr.h"
#include "DerefExpr.h"
#include "AddressOfExpr.h"
#include "TernaryExpr.h"
#include "AnyID.h"
#include "EnumStmt.h"
#include "DotExpr.h"
#include "DeclPair.h"
#include "CommaStmt.h" |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "swap.h"
void test_swap()
{
int a = 4;
int b = 2;
swap(&a, &b, sizeof(int));
assert(a == 2 && b == 4);
printf("test_swap successful\n");
}
int main(int argc, char *argv[])
{
test_swap();
return EXIT_SUCCESS;
}
|
//
// PIDemoModelProtocol.h
// kiwi-blocks-demo
//
// Created by Harlan Kellaway on 5/4/15.
// Copyright (c) 2015 Prolific Interactive. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol PIDemoModelProtocol <NSObject>
+ (instancetype)modelFromJSONDictionary:(NSDictionary *)JSONDictionary;
@end
|
// -*- c++ -*-
// Generated by gmmproc 2.44.0 -- DO NOT MODIFY!
#ifndef _GTKMM_PANED_P_H
#define _GTKMM_PANED_P_H
#include <gtkmm/private/container_p.h>
#include <glibmm/class.h>
namespace Gtk
{
class Paned_Class : public Glib::Class
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef Paned CppObjectType;
typedef GtkPaned BaseObjectType;
typedef GtkPanedClass BaseClassType;
typedef Gtk::Container_Class CppClassParent;
typedef GtkContainerClass BaseClassParent;
friend class Paned;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
const Glib::Class& init();
static void class_init_function(void* g_class, void* class_data);
static Glib::ObjectBase* wrap_new(GObject*);
protected:
//Callbacks (default signal handlers):
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
//You could prevent the original default signal handlers being called by overriding the *_impl method.
//Callbacks (virtual functions):
};
} // namespace Gtk
#endif /* _GTKMM_PANED_P_H */
|
//
// SANetworkBatchRequest.h
// ECM
//
// Created by 学宝 on 16/1/18.
// Copyright © 2016年 浙江网仓科技有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SANetworkAccessoryProtocol.h"
@class SANetworkBatchRequest;
@class SANetworkResponse;
@protocol SANetworkBatchRequestResponseDelegate <NSObject>
@optional
- (void)networkBatchRequest:(SANetworkBatchRequest *)batchRequest completedByResponseArray:(NSArray<SANetworkResponse *> *)responseArray;
@end
@class SANetworkRequest;
@protocol SANetworkAccessoryProtocol;
@interface SANetworkBatchRequest : NSObject
@property (nonatomic, weak) id<SANetworkBatchRequestResponseDelegate>delegate;
/**
* @brief 当某一个请求错误时,其他请求是否继续,默认YES继续
*/
@property (nonatomic, assign) BOOL isContinueByFailResponse;
- (instancetype)initWithRequestArray:(NSArray<SANetworkRequest *> *)requestArray;
/**
* @brief 开始网络请求
*/
- (void)startBatchRequest;
/**
* @brief 停止网络请求
*/
- (void)stopBatchRequest;
/**
* @brief 添加实现了SANetworkAccessoryProtocol的插件对象
*
* @param accessoryDelegate 插件对象
* @warning 务必在启动请求之前添加插件。
*/
- (void)addNetworkAccessoryObject:(id<SANetworkAccessoryProtocol>)accessoryDelegate;
@end
|
//
// SkyGuideView.h
// SkyComponentsPod
//
// Created by SimonLiu on 16/3/22.
// Copyright © 2016年 Jason.He. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SkyGuideView : UIView
@property (nonatomic, copy) void(^disappearHandler)(void); // 引导页面消失时的回调
@property (nonatomic, assign) BOOL isPageIndicator; // 是否需要手动添加页码标记
- (instancetype)initWithFrame:(CGRect)frame Images:(NSArray *)images;
- (void)showInView:(UIView *)inView;
@end
|
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2016 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef APPLESEED_FOUNDATION_IMAGE_IPROGRESSIVEIMAGEFILEREADER_H
#define APPLESEED_FOUNDATION_IMAGE_IPROGRESSIVEIMAGEFILEREADER_H
// appleseed.foundation headers.
#include "foundation/core/concepts/noncopyable.h"
// appleseed.main headers.
#include "main/dllsymbol.h"
// Standard headers.
#include <cstddef>
// Forward declarations.
namespace foundation { class CanvasProperties; }
namespace foundation { class ImageAttributes; }
namespace foundation { class Tile; }
namespace foundation
{
//
// Progressive image file reader interface.
//
class APPLESEED_DLLSYMBOL IProgressiveImageFileReader
: public NonCopyable
{
public:
// Destructor.
virtual ~IProgressiveImageFileReader() {}
// Open an image file.
virtual void open(
const char* filename) = 0;
// Close the image file.
virtual void close() = 0;
// Return true if an image file is currently open.
virtual bool is_open() const = 0;
// Read canvas properties.
virtual void read_canvas_properties(
CanvasProperties& props) = 0;
// Read image attributes.
virtual void read_image_attributes(
ImageAttributes& attrs) = 0;
// Read an image tile. Returns a newly allocated tile.
virtual Tile* read_tile(
const size_t tile_x,
const size_t tile_y) = 0;
};
} // namespace foundation
#endif // !APPLESEED_FOUNDATION_IMAGE_IPROGRESSIVEIMAGEFILEREADER_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_file_w32_spawnv_01.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-01.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: file Read input from a file
* GoodSource: Fixed string
* Sink: w32_spawnv
* BadSink : execute command with spawnv
* Flow Variant: 01 Baseline
*
* */
#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
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <process.h>
#ifndef OMITBAD
void CWE78_OS_Command_Injection__char_file_w32_spawnv_01_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from a file */
size_t dataLen = strlen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (100-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgets(data+dataLen, (int)(100-dataLen), pFile) == NULL)
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
fclose(pFile);
}
}
}
{
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 */
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
{
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);
}
}
void CWE78_OS_Command_Injection__char_file_w32_spawnv_01_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()...");
CWE78_OS_Command_Injection__char_file_w32_spawnv_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_file_w32_spawnv_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* charFifo.c
*
* Created on: Nov 9, 2014
* Author: Nicholas
*/
#include "charFifo.h"
#include "stdlib.h"
#define FIFO_WRAP(i) ((i < 0) ? (g_usFifoSize - i) : ((i >= g_usFifoSize) ? (i - g_usFifoSize) : i))
char g_pcFifo[10];
unsigned short g_usFifoHead = 0;
unsigned short g_usFifoTail = 0;
const unsigned short g_usFifoSize = 10;
// THIS FUNCTION IS NO LONGER NECESSARY. WILL BE REIMPLEMENTED FOR RTOS.
unsigned char create_fifo(const unsigned short size) {
// g_usFifoSize = size; //Save size to global variable
// free(g_pcFifo); //Free memory allocated to old FIFO
// char tempArray[size];
// g_pcFifo = tempArray;
// g_pcFifo = malloc(size * sizeof(char)); //Allocate memory for FIFO
return 1;
// if (g_pcFifo != NULL) { //Ensure memory allocation was successful
// return 1;
// }
// else { //If it wasn't, return 0
// return 0;
// }
}
unsigned char fifo_put(char item) {
unsigned short new_tail = FIFO_WRAP(g_usFifoTail + 1); //Get the index in front of the tail
if (new_tail != g_usFifoHead) { //If the index in front of the tail is not the head
g_pcFifo[g_usFifoTail] = item;
g_usFifoTail = new_tail;
return 1; //Success
} else { //If the head is at the next index, FIFO is full
return 0; //Fail
}
}
unsigned char fifo_get(char* container) {
if (g_usFifoHead != g_usFifoTail) { //If the FIFO is not empty
*container = g_pcFifo[g_usFifoHead];//Put the oldest char into the container
if (g_usFifoHead + 1 >= g_usFifoSize)//If moving the head will cause an overflow
{
g_usFifoHead = 0; //Wrap to zero
} else {
g_usFifoHead++;
}
return 1; //Success
} else {
return 0; //Fail, FIFO is empty
}
}
|
//
// CD2Hyper.h
// hyper
//
// Created by James Tuley on 2/18/07.
// Copyright 2007 Jay Tuley. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "CD2PluginProtocolV1.h"
@interface CD2Hyper : NSObject<CD2PluginProtocolV1>
- (BOOL)openTermWindowForPath:(NSString *)aPath;
@end
|
//
// GPKGFeaturePreviewImportTestCase.h
// geopackage-iosTests
//
// Created by Brian Osborn on 3/6/20.
// Copyright © 2020 NGA. All rights reserved.
//
#import "GPKGImportGeoPackageTestCase.h"
@interface GPKGFeaturePreviewImportTestCase : GPKGImportGeoPackageTestCase
@end
|
#ifndef GENERAL_H
#define GENERAL_H
#include "../include/symbolic.h"
///////////////////////////////////////////////////////////////////////////////
// Stdlib includes ////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
///////////////////////////////////////////////////////////////////////////////
// Ghost includes /////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//@ #include <listex.gh>
///////////////////////////////////////////////////////////////////////////////
// PolarSLL includes + config /////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "polarssl_definitions/polarssl_definitions.h"
#define MAX_PACKAGE_SIZE 8192
#define MIN_DATA_SIZE 4
#define NONCE_SIZE 16
#define HASH_SIZE 64
#define HMAC_SIZE 64
#define GCM_IV_SIZE 16
#define GCM_MAC_SIZE 16
#define GCM_KEY_SIZE 32
#define RSA_KEY_SIZE 256
#define RSA_BIT_KEY_SIZE (8 * RSA_KEY_SIZE)
#define RSA_SERIALIZED_KEY_SIZE 2048
///////////////////////////////////////////////////////////////////////////////
// Auxiliary functions ////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void *malloc_wrapper(int size);
//@ requires 0 <= size;
/*@ ensures result != 0 &*&
malloc_block(result, size) &*& chars(result, size, ?cs) &*&
true == ((char *)0 < result &&
result + size <= (char *)UINTPTR_MAX); @*/
void write_buffer(char **target, const char *source, int length);
/*@ requires pointer(target, ?t) &*& chars(t, length, ?cs) &*&
[?f]crypto_chars(?kind, source, length, ?ccs0) &*&
length > 0 &*& kind == normal ||
(kind == secret && length >= MINIMAL_STRING_SIZE)
&*& length <= INT_MAX &*& t + length <= (void*) UINTPTR_MAX; @*/
/*@ ensures pointer(target, t + length) &*&
crypto_chars(kind, t, length, ccs0) &*&
[f]crypto_chars(kind, source, length, ccs0); @*/
///////////////////////////////////////////////////////////////////////////////
// Auxiliary lemmas ///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/*@
// cs_to_ccs and ints
lemma void equal_append_chars_of_int(int i1, int i2, list<char> cs1,
list<char> cs2);
requires INT_MIN <= i1 && i1 <= INT_MAX &*& INT_MIN <= i2 && i2 <= INT_MAX &*&
append(chars_of_int(i1), cs1) == append(chars_of_int(i2), cs2);
ensures cs1 == cs2 &*& i1 == i2;
fixpoint list<crypto_char> ccs_of_int(int i)
{
return cs_to_ccs(chars_of_int(i));
}
lemma void equal_append_ccs_of_int(int i1, int i2, list<crypto_char> ccs1,
list<crypto_char> ccs2);
requires INT_MIN <= i1 && i1 <= INT_MAX &*& INT_MIN <= i2 && i2 <= INT_MAX &*&
append(ccs_of_int(i1), ccs1) == append(ccs_of_int(i2), ccs2);
ensures ccs1 == ccs2 &*& i1 == i2;
fixpoint int unbounded_int_of_chars(list<char> cs)
{
return
length(cs) == sizeof(int) ?
int_of_chars(cs)
:
head(cs)
;
}
fixpoint list<char> chars_of_unbounded_int(int i)
{
return
INT_MIN <= i && i <= INT_MAX ?
chars_of_int(i)
:
cons(i, nil)
;
}
lemma void chars_of_unbounded_int_bounds(int i);
requires true;
ensures INT_MIN <= i && i <= INT_MAX ?
INT_MIN <= head(chars_of_unbounded_int(i)) &*&
head(chars_of_unbounded_int(i)) <= INT_MAX
:
head(chars_of_unbounded_int(i)) == i;
// nat_length
fixpoint nat nat_length<T>(list<T> xs)
{
switch(xs)
{
case nil : return zero;
case cons(x0, xs0) : return succ(nat_length(xs0));
}
}
fixpoint list<T> repeat<T>(T t, nat n)
{
switch(n)
{
case succ(n0): return cons(t, repeat(t, n0));
case zero: return nil;
}
}
lemma void repeat_length<T>(T t, nat n);
requires true;
ensures nat_length(repeat(t, n)) == n;
lemma void length_equals_nat_length<T>(list<T> xs);
requires true;
ensures length(xs) == int_of_nat(nat_length(xs));
lemma void int_of_nat_injective(nat n1, nat n2);
requires int_of_nat(n1) == int_of_nat(n2);
ensures n1 == n2;
@*/
#endif
|
//
// JMTableViewCell.h
// JMSystemNotifications
//
// Created by jerome morissard on 04/04/2015.
// Copyright (c) 2015 Jérôme Morissard. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JMTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *notificationNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *notificationOSLabel;
@property (weak, nonatomic) IBOutlet UIView *circularView;
@property (weak, nonatomic) IBOutlet UIButton *testButton;
@end
|
#pragma strict_types
#include "../def.h"
inherit MASTER_ROOM;
inherit MOD_DOOR;
void create_object(void);
void reset(int arg);
void create_object(void)
{
set_short("The main kitchen of the castle");
set_long("This is the main kitchen of the castle, where the food for " +
"the lords and commanders is prepared. It is a big, dimly " +
"lit room with three large ovens. The black stone walls are " +
"covered with shelves and cupboards, and many sacks, crates " +
"and barrels are on the floor. In the middle of the room are " +
"a few benches and tables and a chest is by the south wall. " +
"The room is lit only by the fires in the ovens, and strange, " +
"long shadows dance on the walls.\n");
set_new_light(5);
set_skip_obvious(1);
add_property("indoors");
add_item("room|kitchen","This is the main kitchen of the castle");
add_item("oven|ovens","There are three large ovens in the kitchen. A " +
"lot of food could be prepared in them. The fires are lit");
add_item("walls|wall","Black stone walls covered by shelves and " +
"cupboards");
add_item("shelf|shelves","Wooden shelves filled with cans and bottles");
add_item("can|cans|bottle|bottles","Cans and bottles containing " +
"spices and other things used when preparing food");
add_item("cupboard|cupboards","Containing various kitchen utensils, no " +
"doubt");
add_item("utensil|utensils","Well, that's what kitchen cupboards " +
"usually contain, right?");
add_item("sack|sacks|barrel|barrels|crate|crates","Containing different " +
"types of supplies");
add_item("floor","Smooth, black stone");
add_item("table|tables|bench|benches","Used for preparing food on");
add_item("chest","The chest is open. It contains sheets of tablecloth " +
"and shining silver tableware");
add_item("sheet|sheets|tablecloth","White linen tablecloth. It would " +
"look very nice on a big oak table");
add_item("tableware","Shining silver tableware. Forks, spoons and " +
"knives. Very classy stuff");
add_item("fork|forks|spoon|spoons|knife|knives","Very classy silver " +
"tableware");
add_item("fire|fires","The fires are lit in the ovens, spreading warmth " +
"in the room and making long shadows dance on the walls");
add_item("shadow|shadows","Long shadows dancing around on the walls");
(ROOM + "lev2_dininghall")->load_doors();
reset(0);
}
void reset(int arg)
{
add_monster(MONSTER + "darkling_chef",1);
::reset(arg);
}
|
// this file only exist because of dear_imgui_internal include via "imgui_internal.h"
// but we like to include it via "imgui/imgui_internal.h"
#include "imgui/imgui_internal.h"
|
#ifndef TCL_SEAHAVEN_H
#define TCL_SEAHAVEN_H
#include "CTclApp/CTclAppCanvas.h"
class CTclSeahaven;
class CTclSeahavenCmd : public CTclAppCanvasCmd {
private:
CTclSeahaven *seahaven_;
public:
CTclSeahavenCmd(CTclApp *app);
~CTclSeahavenCmd();
string getCommandName () const { return "CTclSeahaven"; }
string getCommandClass() const { return "CTclSeahaven"; }
CTclAppCanvas *createInstance(CTclApp *app);
};
#endif
|
/*
Author: Pakkpon Phongthawee
LANG: C
Problem: Two level series
*/
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int sum = a;
while(a*c+1<b){
a*=c++;
sum+=a;
}
printf("%d",sum);
return 0;
}
|
/* #include "stm32f4_i2c.h" */
#ifndef __STM32F4_I2C_H
#define __STM32F4_I2C_H
#include "stm32f4xx.h"
/*=====================================================================================================*/
/*=====================================================================================================*/
#define I2C1_DR_Address ((u32)0x40005410)
#define I2C_TIME ((u32)65535)
#define I2C1_SPEED ((u32)400000)
/*=====================================================================================================*/
/*=====================================================================================================*/
void I2C_Config(void);
u32 I2C_DMA_Read( u8*, u8, u8, u8* );
u32 I2C_DMA_ReadReg( u8, u8, u8*, u8 );
u32 I2C_DMA_Write( u8*, u8, u8, u8* );
u32 I2C_DMA_WriteReg( u8, u8, u8*, u8 );
void I2C1_Send_DMA_IRQ( void );
void I2C1_Recv_DMA_IRQ( void );
u32 I2C_TimeOut( void );
u32 MS5611_ReadData( u8*, u8, u8 );
u32 MS5611_WriteCom( u8, u8 );
/*=====================================================================================================*/
/*=====================================================================================================*/
#endif
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@interface WebUICertificateError : NSObject
{
}
+ (_Bool)isClientCertificateError:(long long)arg1;
+ (_Bool)isServerCertificateError:(long long)arg1;
+ (_Bool)proceedWithClientCertificateIdentity:(struct __SecIdentity *)arg1 context:(id)arg2;
+ (id)newAlertToListPossibleClientSideCertificatesWithContext:(id)arg1;
+ (id)newAlertToHandleClientSideCertificateErrorCode:(long long)arg1 context:(id)arg2;
+ (_Bool)canAuthenticateAgainstProtectionSpace:(id)arg1;
+ (_Bool)userAllowsCertificateTrust:(struct __SecTrust *)arg1 host:(id)arg2 applicationDisplayName:(id)arg3;
+ (id)applyAuthenticationChain:(struct __CFArray *)arg1 toRequest:(id)arg2;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_listen_socket_execl_52a.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-52a.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Fixed string
* Sink: execl
* BadSink : execute command with execl
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%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 EXECL _execl
#else /* NOT _WIN32 */
#define EXECL execl
#endif
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__char_listen_socket_execl_52b_badSink(char * data);
void CWE78_OS_Command_Injection__char_listen_socket_execl_52_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a listen socket */
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(char) * (100 - dataLen - 1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[dataLen + recvResult / sizeof(char)] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE78_OS_Command_Injection__char_listen_socket_execl_52b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE78_OS_Command_Injection__char_listen_socket_execl_52b_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
CWE78_OS_Command_Injection__char_listen_socket_execl_52b_goodG2BSink(data);
}
void CWE78_OS_Command_Injection__char_listen_socket_execl_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()...");
CWE78_OS_Command_Injection__char_listen_socket_execl_52_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_listen_socket_execl_52_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef _ILI9341_t3_font_Impact_
#define _ILI9341_t3_font_Impact_
#include "ILI9341_t3.h"
#ifdef __cplusplus
extern "C" {
#endif
extern const ILI9341_t3_font_t Impact_8;
extern const ILI9341_t3_font_t Impact_9;
extern const ILI9341_t3_font_t Impact_10;
extern const ILI9341_t3_font_t Impact_11;
extern const ILI9341_t3_font_t Impact_12;
extern const ILI9341_t3_font_t Impact_13;
extern const ILI9341_t3_font_t Impact_14;
extern const ILI9341_t3_font_t Impact_16;
extern const ILI9341_t3_font_t Impact_18;
extern const ILI9341_t3_font_t Impact_20;
extern const ILI9341_t3_font_t Impact_24;
extern const ILI9341_t3_font_t Impact_28;
extern const ILI9341_t3_font_t Impact_32;
extern const ILI9341_t3_font_t Impact_40;
extern const ILI9341_t3_font_t Impact_48;
extern const ILI9341_t3_font_t Impact_60;
extern const ILI9341_t3_font_t Impact_72;
extern const ILI9341_t3_font_t Impact_96;
#ifdef __cplusplus
} // extern "C"
#endif
#endif
|
#include <stdio.h>
#include <sys/time.h>
#include <ibcrypt/chacha.h>
#include <ibcrypt/rsa.h>
#include <ibcrypt/rsa_util.h>
#include <ibcrypt/sha256.h>
#include <ibcrypt/zfree.h>
#include <libibur/util.h>
#include <libibur/endian.h>
#include "../util/log.h"
#include "bg_manager.h"
#include "login_server.h"
#include "cli.h"
#include "friendreq.h"
#include "conversation.h"
pthread_t bg_manager;
pthread_mutex_t bg_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t bg_wait = PTHREAD_COND_INITIALIZER;
pthread_mutex_t net_lock = PTHREAD_MUTEX_INITIALIZER;
#define WAITTIME ((uint64_t) 10000ULL)
int acquire_netlock() {
pthread_mutex_lock(&net_lock);
int s = get_mode();
if(s == -1) {
pthread_mutex_unlock(&net_lock);
return 1;
}
return 0;
}
void release_netlock() {
pthread_mutex_unlock(&net_lock);
}
int add_umessage(struct message *m) {
int ret = 0;
uint8_t *sender = &m->message[0x01];
uint8_t *payload = &m->message[0x29];
uint8_t type = m->message[0x29];
char s_hex[65];
to_hex(sender, 0x20, s_hex);
LOG("message from %s of length %llu", s_hex, m->length);
uint64_t p_len = decbe64(&m->message[0x21]);
/* check the lengths */
if(p_len + 0x29 != m->length) {
/* server lying is a crashing error */
return -1;
}
switch(type) {
case 0:
/* typical message from friend */
ret = parse_conv_message(sender, payload, p_len);
break;
case 1:
/* friend request */
ret = parse_friendreq(sender, payload, p_len);
break;
case 2:
ret = parse_friendreq_response(sender, payload, p_len);
break;
}
return ret;
}
int add_pkeyresp(struct message *m) {
pthread_mutex_lock(&bg_lock);
if(get_mode() != 2) {
pthread_mutex_unlock(&bg_lock);
return -1;
}
pkey_resp = m;
pthread_cond_broadcast(&bg_wait);
pthread_mutex_unlock(&bg_lock);
return 0;
}
int add_unotfound(struct message *m) {
pthread_mutex_lock(&bg_lock);
if(get_mode() != 2) {
pthread_mutex_unlock(&bg_lock);
return -1;
}
pkey_resp = m;
pthread_cond_broadcast(&bg_wait);
pthread_mutex_unlock(&bg_lock);
return 0;
}
void *background_thread(void *_arg) {
struct server_connection *sc = (struct server_connection *) _arg;
while(get_mode() != -1) {
if(acquire_netlock() != 0) break;
struct message *m = recv_message(sc->ch, &sc->keys, WAITTIME);
if(handler_status(sc->ch) != 0) {
set_mode(-1);
}
if(m == NULL) {
release_netlock();
continue;
}
int ret = 0;
switch(m->message[0]) {
case 0:
ret = add_umessage(m);
break;
case 1:
ret = add_pkeyresp(m);
break;
case 0xff:
ret = add_unotfound(m);
break;
}
if(ret != 0) {
break;
}
release_netlock();
}
release_netlock();
ERR("background thread crashed");
acquire_writelock(&lock);
stop = 1;
release_writelock(&lock);
set_mode(-1);
pthread_cond_broadcast(&bg_wait);
return NULL;
}
int start_bg_thread(struct server_connection *sc) {
if(pthread_create(&bg_manager, NULL, background_thread, sc) != 0) {
ERR("failed to start background thread");
return -1;
}
return 0;
}
|
#ifndef _gpio_h_
#define _gpio_h_
void gpio_output_init(int n);
void gpio_set(int n);
void gpio_clr(int n);
#endif /* _gpio_h_ */
|
#ifndef GPIO_AUX_UART_H_INCLUDED
#define GPIO_AUX_UART_H_INCLUDED
#include "gpio.h"
#define AUX_BASE ( 0x3F000000UL + 0x215000 )
#define AUX_ENA_MINIUART ( 1 << 0 )
#define AUX_ENA_SPI1 ( 1 << 1 )
#define AUX_ENA_SPI2 ( 1 << 2 )
#define AUX_IRQ_SPI2 ( 1 << 2 )
#define AUX_IRQ_SPI1 ( 1 << 1 )
#define AUX_IRQ_MU ( 1 << 0 )
#define AUX_MULCR_8BIT_MODE ( 3 << 0 ) /* See errata for this value */
#define AUX_MULCR_BREAK ( 1 << 6 )
#define AUX_MULCR_DLAB_ACCESS ( 1 << 7 )
#define AUX_MUMCR_RTS ( 1 << 1 )
#define AUX_MULSR_DATA_READY ( 1 << 0 )
#define AUX_MULSR_RX_OVERRUN ( 1 << 1 )
#define AUX_MULSR_TX_EMPTY ( 1 << 5 )
#define AUX_MULSR_TX_IDLE ( 1 << 6 )
#define AUX_MUMSR_CTS ( 1 << 5 )
#define AUX_MUCNTL_RX_ENABLE ( 1 << 0 )
#define AUX_MUCNTL_TX_ENABLE ( 1 << 1 )
#define AUX_MUCNTL_RTS_FLOW ( 1 << 2 )
#define AUX_MUCNTL_CTS_FLOW ( 1 << 3 )
#define AUX_MUCNTL_RTS_FIFO ( 3 << 4 )
#define AUX_MUCNTL_RTS_ASSERT ( 1 << 6 )
#define AUX_MUCNTL_CTS_ASSERT ( 1 << 7 )
#define AUX_MUSTAT_SYMBOL_AV ( 1 << 0 )
#define AUX_MUSTAT_SPACE_AV ( 1 << 1 )
#define AUX_MUSTAT_RX_IDLE ( 1 << 2 )
#define AUX_MUSTAT_TX_IDLE ( 1 << 3 )
#define AUX_MUSTAT_RX_OVERRUN ( 1 << 4 )
#define AUX_MUSTAT_TX_FIFO_FULL ( 1 << 5 )
#define AUX_MUSTAT_RTS ( 1 << 6 )
#define AUX_MUSTAT_CTS ( 1 << 7 )
#define AUX_MUSTAT_TX_EMPTY ( 1 << 8 )
#define AUX_MUSTAT_TX_DONE ( 1 << 9 )
#define AUX_MUSTAT_RX_FIFO_LEVEL ( 7 << 16 )
#define AUX_MUSTAT_TX_FIFO_LEVEL ( 7 << 24 )
struct gpio_uart{
volatile unsigned int IRQ;
volatile unsigned int ENABLES;
volatile unsigned int reserved1[((0x40 - 0x04) / 4) - 1];
volatile unsigned int MU_IO;
volatile unsigned int MU_IER;
volatile unsigned int MU_IIR;
volatile unsigned int MU_LCR;
volatile unsigned int MU_MCR;
volatile unsigned int MU_LSR;
volatile unsigned int MU_MSR;
volatile unsigned int MU_SCRATCH;
volatile unsigned int MU_CNTL;
volatile unsigned int MU_STAT;
volatile unsigned int MU_BAUD;
volatile unsigned int reserved2[(0x80 - 0x68) / 4];
volatile unsigned int SPI0_CNTL0;
volatile unsigned int SPI0_CNTL1;
volatile unsigned int SPI0_STAT;
volatile unsigned int SPI0_IO;
volatile unsigned int SPI0_PEEK;
volatile unsigned int reserved3[(0xC0 - 0x94) / 4];
volatile unsigned int SPI1_CNTL0;
volatile unsigned int SPI1_CNTL1;
volatile unsigned int SPI1_STAT;
volatile unsigned int SPI1_IO;
volatile unsigned int SPI1_PEEK;
};
extern struct gpio_uart* RPI_GetAux( void );
extern void mini_uart_init( int baud, int bits);
extern void mini_uart_write( char c );
extern unsigned char mini_uart_read(void);
extern void uart_buff_read(char *ptr, int len, char delim);
#endif
|
//
// Copyright (c) 2008-2019 the Urho3D project.
//
// 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
#ifdef URHO3D_IS_BUILDING
#include "Urho3D.h"
#else
#include <Urho3D/Urho3D.h>
#endif
namespace Urho3D
{
/// %Condition on which a thread can wait.
class URHO3D_API Condition
{
public:
/// Construct.
Condition();
/// Destruct.
~Condition();
/// Set the condition. Will be automatically reset once a waiting thread wakes up.
void Set();
/// Wait on the condition.
void Wait();
private:
#ifndef _WIN32
/// Mutex for the event, necessary for pthreads-based implementation.
void* mutex_;
#endif
/// Operating system specific event.
void* event_;
};
}
|
int VC0706_takePics(void);
void setupParallelPhotoCount(void);
void updatePhotoCount(uint8 pic_count);
void VC0706_setNumReboots(void); |
#import "MOBProjection.h"
@interface MOBProjectionEPSG4647 : MOBProjection
@end
|
// Copyright (c) 2011-2013 The CoinsBazar developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef ADDRESSTABLEMODEL_H
#define ADDRESSTABLEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class AddressTablePriv;
class WalletModel;
class CWallet;
/**
Qt model of the address book in the core. This allows views to access and modify the address book.
*/
class AddressTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
~AddressTableModel();
enum ColumnIndex {
Label = 0, /**< User specified label */
Address = 1 /**< CoinsBazar address */
};
enum RoleIndex {
TypeRole = Qt::UserRole /**< Type of address (#Send or #Receive) */
};
/** Return status of edit/insert operation */
enum EditStatus {
OK, /**< Everything ok */
NO_CHANGES, /**< No changes were made during edit operation */
INVALID_ADDRESS, /**< Unparseable address */
DUPLICATE_ADDRESS, /**< Address already in address book */
WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */
KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */
};
static const QString Send; /**< Specifies send address */
static const QString Receive; /**< Specifies receive address */
/** @name Methods overridden from QAbstractTableModel
@{*/
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent) const;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
Qt::ItemFlags flags(const QModelIndex &index) const;
/*@}*/
/* Add an address to the model.
Returns the added address on success, and an empty string otherwise.
*/
QString addRow(const QString &type, const QString &label, const QString &address);
/* Look up label for address in address book, if not found return empty string.
*/
QString labelForAddress(const QString &address) const;
/* Look up row index of an address in the model.
Return -1 if not found.
*/
int lookupAddress(const QString &address) const;
EditStatus getEditStatus() const { return editStatus; }
private:
WalletModel *walletModel;
CWallet *wallet;
AddressTablePriv *priv;
QStringList columns;
EditStatus editStatus;
/** Notify listeners that data changed. */
void emitDataChanged(int index);
public slots:
/* Update address list from core.
*/
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
friend class AddressTablePriv;
};
#endif // ADDRESSTABLEMODEL_H
|
//
// OLCAppDelegate.h
// OLCVideoPlayer
//
// Created by Lakitha Sam on 08/02/2015.
// Copyright (c) 2015 Lakitha Sam. All rights reserved.
//
@import UIKit;
@interface OLCAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// RCIOItem.h
// ReactiveCocoaIO
//
// Created by Uri Baghin on 9/26/12.
// Copyright (c) 2013 Uri Baghin. All rights reserved.
//
#import <Foundation/Foundation.h>
@class RACSignal, RACChannelTerminal, RCIODirectory;
// Specifies how the file system item should be accessed.
//
// RCIOItemModeReadWrite - Access the item for both reading and writing.
// If the item doesn't exist on the file system,
// it will be created.
// RCIOItemModeExclusiveAccess - Ensure the returned RCIOItem is the only handle
// to the file system item. Doesn't currently
// provide any guarantee to that other than
// ensuring the file system item didn't exist
// before the call.
typedef enum : NSUInteger {
RCIOItemModeReadWrite = 0,
RCIOItemModeExclusiveAccess = 1 << 8,
} RCIOItemMode;
@interface RCIOItem : NSObject
// Returns a signal that sends the item at `url`, then completes.
//
// url - The url of the file system item to access.
// mode - Specifies how the file system item should be accessed.
//
// Note that the RCIOItem class itself does not support creating items that
// do not already exist on the file system. Use the subclasses instead.
+ (RACSignal *)itemWithURL:(NSURL *)url mode:(RCIOItemMode)mode;
// Equivalent to `-itemWithURL:url mode:RCIOItemModeReadWrite`.
+ (RACSignal *)itemWithURL:(NSURL *)url;
// The url of the receiver.
- (NSURL *)url;
// Returns a signal that sends the URL of the receiver.
@property (nonatomic, strong, readonly) RACSignal *urlSignal;
// Returns a signal that sends the parent directory of the receiver.
@property (nonatomic, strong, readonly) RACSignal *parentSignal;
@end
@interface RCIOItem (ExtendedAttributes)
// Returns a channel terminal for the receiver's extended attribute identified
// by `key`.
- (RACChannelTerminal *)extendedAttributeChannelForKey:(NSString *)key;
@end
|
#ifndef __VECTOR_3D_H__
#define __VECTOR_3D_H__
#include <cmath>
class Vector3D {
public:
union {
struct { float x, y, z; };
struct { float r, g, b; };
float v[3];
};
Vector3D();
Vector3D(float x,float y,float z);
Vector3D(float val);
Vector3D(const Vector3D& v);
Vector3D(const Vector3D& from,const Vector3D& to);
Vector3D& operator=(const Vector3D& v);
Vector3D& operator+=(const Vector3D& v);
Vector3D operator+(const Vector3D& v) const;
Vector3D& operator-=(const Vector3D& v);
Vector3D operator-(const Vector3D& v) const;
Vector3D& operator*=(const float a);
Vector3D operator*(const float a)const;
Vector3D operator*(const Vector3D& v) const;
Vector3D& operator/=(const float a);
Vector3D operator/(const float a)const;
friend Vector3D operator*(const float a, const Vector3D& v);
static Vector3D zero();
static Vector3D abs(Vector3D v);
Vector3D crossProduct(const Vector3D& v) const;
float length() const;
float dot(const Vector3D& v) const;
Vector3D& normalize();
};
#endif
|
#ifndef BOMBERMAN_UTIL_H
#define BOMBERMAN_UTIL_H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define E_NOTICE 0
#define E_WARNING 1
#define E_ERROR 2
#define E_ALL 3
#define MAX_LOG_MSG_SIZE 512
void log_message(FILE * fd, int level, const char * format, va_list args);
void log_notice(FILE *fd, const char *format, ...);
void log_warn(FILE *fd, const char *format, ...);
void log_error(FILE *fd, const char *format, ...);
#endif /* BOMBERMAN_UTIL_H */
|
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/msw/private/webview_edge.h
// Purpose: wxMSW Edge Chromium wxWebView backend private classes
// Author: Tobias Taschner
// Created: 2020-01-15
// Copyright: (c) 2020 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef wxWebViewEdge_PRIVATE_H
# define wxWebViewEdge_PRIVATE_H
# include "wx/dynlib.h"
# include "wx/msw/private/comptr.h"
# include <Webview2.h>
# ifndef __ICoreWebView2Environment_INTERFACE_DEFINED__
# endif
class wxWebViewEdgeImpl
{
public:
explicit wxWebViewEdgeImpl(wxWebViewEdge* webview);
~wxWebViewEdgeImpl();
bool Create();
wxWebViewEdge* m_ctrl;
wxCOMPtr<ICoreWebView2Environment> m_webViewEnvironment;
wxCOMPtr<ICoreWebView2> m_webView;
wxCOMPtr<ICoreWebView2Controller> m_webViewController;
bool m_initialized;
bool m_isBusy;
wxString m_pendingURL;
int m_pendingContextMenuEnabled;
int m_pendingAccessToDevToolsEnabled;
// WebView Events tokens
EventRegistrationToken m_navigationStartingToken = {};
EventRegistrationToken m_navigationCompletedToken = {};
EventRegistrationToken m_newWindowRequestedToken = {};
EventRegistrationToken m_documentTitleChangedToken = {};
EventRegistrationToken m_contentLoadingToken = {};
// WebView Event handlers
HRESULT OnNavigationStarting(ICoreWebView2* sender, ICoreWebView2NavigationStartingEventArgs* args);
HRESULT OnNavigationCompleted(ICoreWebView2* sender, ICoreWebView2NavigationCompletedEventArgs* args);
HRESULT OnNewWindowRequested(ICoreWebView2* sender, ICoreWebView2NewWindowRequestedEventArgs* args);
HRESULT OnDocumentTitleChanged(ICoreWebView2* sender, IUnknown* args);
HRESULT OnContentLoading(ICoreWebView2* sender, ICoreWebView2ContentLoadingEventArgs* args);
HRESULT OnEnvironmentCreated(HRESULT result, ICoreWebView2Environment* environment);
HRESULT OnWebViewCreated(HRESULT result, ICoreWebView2Controller* webViewController);
wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList;
int m_historyPosition;
bool m_historyLoadingFromList;
bool m_historyEnabled;
void UpdateBounds();
ICoreWebView2Settings* GetSettings();
static bool ms_isInitialized;
static wxDynamicLibrary ms_loaderDll;
static bool Initialize();
static void Uninitialize();
friend class wxWebViewEdgeModule;
};
#endif
|
//
// NSTimer+JJ.h
// JJObjCTool
//
// Created by gongjian03 on 6/2/15.
// Copyright (c) 2015 gongjian. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface NSTimer (JJ)
#pragma mark - execute time
+ (double)jj_measureExecutionTime:(void (^)())block;
+ (void)jj_startTiming;
+ (double)jj_timeInterval;
@end
|
//
// ViewController.h
// Mastermind
//
// Created by manolo on 1/26/15.
// Copyright (c) 2015 manolosavi. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController <UIAlertViewDelegate>
@end |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE476_NULL_Pointer_Dereference__int_04.c
Label Definition File: CWE476_NULL_Pointer_Dereference.label.xml
Template File: sources-sinks-04.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: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE)
*
* */
#include "std_testcase.h"
#include <wchar.h>
/* The two variables below are declared "const", so a tool should
be able to identify that reads of these will always return their
initialized values. */
static const int STATIC_CONST_TRUE = 1; /* true */
static const int STATIC_CONST_FALSE = 0; /* false */
#ifndef OMITBAD
void CWE476_NULL_Pointer_Dereference__int_04_bad()
{
int * data;
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
}
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Attempt to use data, which may be NULL */
printIntLine(*data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second STATIC_CONST_TRUE to STATIC_CONST_FALSE */
static void goodB2G1()
{
int * data;
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
}
if(STATIC_CONST_FALSE)
{
/* 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);
}
else
{
printLine("data is NULL");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
int * data;
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
}
if(STATIC_CONST_TRUE)
{
/* FIX: Check for NULL before attempting to print data */
if (data != NULL)
{
printIntLine(*data);
}
else
{
printLine("data is NULL");
}
}
}
/* goodG2B1() - use goodsource and badsink by changing the first STATIC_CONST_TRUE to STATIC_CONST_FALSE */
static void goodG2B1()
{
int * data;
if(STATIC_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Initialize data */
{
int tmpData = 5;
data = &tmpData;
}
}
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Attempt to use data, which may be NULL */
printIntLine(*data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
int * data;
if(STATIC_CONST_TRUE)
{
/* FIX: Initialize data */
{
int tmpData = 5;
data = &tmpData;
}
}
if(STATIC_CONST_TRUE)
{
/* POTENTIAL FLAW: Attempt to use data, which may be NULL */
printIntLine(*data);
}
}
void CWE476_NULL_Pointer_Dereference__int_04_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__int_04_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE476_NULL_Pointer_Dereference__int_04_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "DVTGradientImageButton.h"
// Not exported
@interface GPUTraceFrameStepperButton : DVTGradientImageButton
{
}
+ (Class)cellClass;
@property SEL mouseUpAction;
@property SEL mouseDownAction;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_file_execlp_06.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-06.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: file Read input from a file
* GoodSource: Fixed string
* Sink: execlp
* BadSink : execute command with wexeclp
* Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"ls"
#define COMMAND_ARG2 L"-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#ifdef _WIN32
#include <process.h>
#define EXECLP _wexeclp
#else /* NOT _WIN32 */
#define EXECLP execlp
#endif
/* The variable below is declared "const", so a tool should be able
* to identify that reads of this will always give its initialized value. */
static const int STATIC_CONST_FIVE = 5;
#ifndef OMITBAD
void CWE78_OS_Command_Injection__wchar_t_file_execlp_06_bad()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(STATIC_CONST_FIVE==5)
{
{
/* Read input from a file */
size_t dataLen = wcslen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (100-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgetws(data+dataLen, (int)(100-dataLen), pFile) == NULL)
{
printLine("fgetws() failed");
/* Restore NUL terminator if fgetws fails */
data[dataLen] = L'\0';
}
fclose(pFile);
}
}
}
}
/* wexeclp - 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
/* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */
static void goodG2B1()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(STATIC_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
}
/* wexeclp - 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);
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(STATIC_CONST_FIVE==5)
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
}
/* wexeclp - 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);
}
void CWE78_OS_Command_Injection__wchar_t_file_execlp_06_good()
{
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()...");
CWE78_OS_Command_Injection__wchar_t_file_execlp_06_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_file_execlp_06_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include "gdt.h"
#include "interrupt.h"
#include "klib.h"
#include "types.h"
/***
* idt pointer instance
*/
struct idt_ptr IDT_PTR = {
.limit = (sizeof(struct idt_entry_raw) * IDT_ENTRY_COUNT) - 1,
.base = (uint32_t)IDT_ENTRIES,
};
/***
* configure idt, by default all error handlers are hard halt
*/
extern void hard_halt();
void idt_init() {
//memset(IDT_ENTRIES, NULL, sizeof(struct idt_entry_raw) * IDT_ENTRY_COUNT);
int i;
for (i = 0; i < IDT_ENTRY_COUNT; i++)
idt_register(i, (uint32_t)&hard_halt, IDT_GATE_INT_ATTR);
}
/***
* register isr
*/
void idt_register(uint8_t idt_slot, uint32_t isr, enum idt_gate_access access) {
struct idt_entry_raw *entry = &IDT_ENTRIES[idt_slot];
// only supports ring isr located in kernel right now
entry->segment = (uint16_t)GDT_ENTRY_KERNEL_CODE;
entry->zero = 0;
entry->base_low = (uint16_t)((uint32_t)isr & 0xFFFF);
entry->base_high = (uint16_t)(((uint32_t)isr >> 16) & 0xFFFF);
entry->access = access;
}
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "PBXResourcesBuildPhase.h"
@interface PBXResourcesBuildPhase (PBXInspectorPanelSupport)
- (id)displayName;
@end
|
//
// APTableView.h
// InkedMargin
//
// Created by alok pandey on 01/02/16.
// Copyright © 2016 alok pandey. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface APTableView : NSTableView
@end
|
// This code is part of the Super Play Library (http://www.superplay.info),
// and may only be used under the terms contained in the LICENSE file,
// included with the Super Play Library.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
#pragma once
#include <TinySTL/stdint.h>
#include <TinySTL/string.h>
#include "Macros.h"
NAMESPACE(SPlay)
class Image
{
public:
// Constructor
Image();
// Destructor
~Image();
// Create an image from a bitmap
static Image* create(const tinystl::string& _strFilename);
// Initialize
bool initialize(const tinystl::string& _strFilename);
// Close
void close();
// Get pixels
uint32_t* getPixels() const {return m_pImage;}
// Get width
int getWidth() const {return m_iWidth;}
// Get height
int getHeight() const {return m_iHeight;}
private:
// Image size
int m_iWidth;
int m_iHeight;
// Image pointer
uint32_t* m_pImage;
};
ENDNAMESPACE
|
/////////////////////////////////////////////////////
// file: ScopePipe.h
//
// Header for ScopePipe c++ class
//
// Revision History:
// 01/2012 original version
// (created 'self-standing' code,
// to separate from main program)
// Author: ejo
//////////////////////////////////////////////////////
#pragma once
#include <iostream>
#include <fstream>
#include <string>
using std::string;
class ScopePipe {
public:
ScopePipe();
~ScopePipe();
int init();
int plot_init();
int plot_lut_data(int AC_adr);
int notrigger();
int plot();
int multiplot();
int send_cmd(const string &plot_cmd);
int finish();
private:
FILE *gp_cmd;
string filename;
string filename_lut;
string filename_lut_0;
string filename_lut_1;
string filename_lut_2;
string filename_lut_3;
string plot_cmd;
};
|
#pragma once
namespace ui
{
// This object exists to force MFC to keep our main thread alive until all of
// our objects have cleaned themselves up. All objects Addref this object on
// instantiation and Release it when they delete themselves. When there are no
// more outstanding objects, the destructor is called (from Release), where we
// call AfxPostQuitMessage to signal MFC we are done.
// We never call Create on this object so that all Dialogs created with it are
// ownerless. This means they show up in Task Manager, Alt + Tab, and on the taskbar.
class CParentWnd : public CWnd, IUnknown
{
public:
CParentWnd();
~CParentWnd();
_Check_return_ STDMETHODIMP QueryInterface(REFIID riid, _Deref_out_opt_ LPVOID* ppvObj) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
private:
LONG m_cRef;
HWINEVENTHOOK m_hwinEventHook; // Hook to trap header reordering
};
_Check_return_ CParentWnd* GetParentWnd();
} // namespace ui |
#pragma once
#include <array>
#include <complex>
#include <config/enums.h>
#include <math/svd/settings.h>
#include <memory>
#include <unsupported/Eigen/CXX11/Tensor>
class MpoSite;
class TensorsFinite;
class ModelFinite {
public:
using Scalar = std::complex<double>;
private:
friend TensorsFinite;
struct Cache {
std::optional<std::vector<size_t>> cached_sites = std::nullopt;
std::optional<Eigen::Tensor<Scalar, 4>> multisite_mpo = std::nullopt;
std::optional<Eigen::Tensor<Scalar, 2>> multisite_ham = std::nullopt;
std::optional<Eigen::Tensor<Scalar, 4>> multisite_mpo_squared = std::nullopt;
std::optional<Eigen::Tensor<Scalar, 2>> multisite_ham_squared = std::nullopt;
};
mutable Cache cache;
std::vector<Eigen::Tensor<Scalar, 4>> get_compressed_mpo_squared(std::optional<svd::settings> svd_settings = std::nullopt);
void randomize();
void build_mpo();
void build_mpo_squared();
void clear_mpo_squared();
bool has_mpo_squared() const;
void compress_mpo_squared(std::optional<svd::settings> svd_settings = std::nullopt);
void set_reduced_energy(double total_energy);
void set_reduced_energy_per_site(double site_energy);
void perturb_hamiltonian(double coupling_ptb, double field_ptb, PerturbMode perturbMode);
public:
std::vector<std::unique_ptr<MpoSite>> MPO; /*!< A list of stored Hamiltonian MPO tensors,indexed by chain position. */
std::vector<size_t> active_sites;
ModelType model_type = ModelType::ising_tf_rf;
public:
ModelFinite();
~ModelFinite(); // Read comment on implementation
ModelFinite(ModelFinite &&other); // default move ctor
ModelFinite &operator=(ModelFinite &&other); // default move assign
ModelFinite(const ModelFinite &other); // copy ctor
ModelFinite &operator=(const ModelFinite &other); // copy assign
void initialize(ModelType model_type_, size_t model_size);
size_t get_length() const;
bool is_real() const;
bool has_nan() const;
void assert_validity() const;
const MpoSite &get_mpo(size_t pos) const;
MpoSite &get_mpo(size_t pos);
// For reduced energy MPO's
[[nodiscard]] bool is_reduced() const;
[[nodiscard]] bool is_perturbed() const;
[[nodiscard]] bool is_compressed_mpo_squared() const;
[[nodiscard]] double get_energy_reduced() const;
[[nodiscard]] double get_energy_per_site_reduced() const;
// For multisite
std::array<long, 4> active_dimensions() const;
Eigen::Tensor<Scalar, 4> get_multisite_mpo(const std::vector<size_t> &sites, std::optional<std::vector<size_t>> nbody = std::nullopt) const;
Eigen::Tensor<Scalar, 2> get_multisite_ham(const std::vector<size_t> &sites, std::optional<std::vector<size_t>> nbody = std::nullopt) const;
const Eigen::Tensor<Scalar, 4> &get_multisite_mpo() const;
const Eigen::Tensor<Scalar, 2> &get_multisite_ham() const;
Eigen::Tensor<Scalar, 4> get_multisite_mpo_reduced_view(double energy_per_site) const;
Eigen::Tensor<Scalar, 4> get_multisite_mpo_squared_reduced_view(double energy_per_site) const;
std::array<long, 4> active_dimensions_squared() const;
Eigen::Tensor<Scalar, 4> get_multisite_mpo_squared(const std::vector<size_t> &sites, std::optional<std::vector<size_t>> nbody = std::nullopt) const;
Eigen::Tensor<Scalar, 2> get_multisite_ham_squared(const std::vector<size_t> &sites, std::optional<std::vector<size_t>> nbody = std::nullopt) const;
const Eigen::Tensor<Scalar, 4> &get_multisite_mpo_squared() const;
const Eigen::Tensor<Scalar, 2> &get_multisite_ham_squared() const;
void clear_cache(LogPolicy logPolicy = LogPolicy::QUIET) const;
std::vector<size_t> get_active_ids() const;
};
|
/*
* POSIX library for Lua 5.1, 5.2 & 5.3.
* Copyright (C) 2013-2016 Gary V. Vaughan
* Copyright (C) 2010-2013 Reuben Thomas <rrt@sc3d.org>
* Copyright (C) 2008-2010 Natanael Copa <natanael.copa@gmail.com>
* Clean up and bug fixes by Leo Razoumov <slonik.az@gmail.com> 2006-10-11
* Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> 07 Apr 2006 23:17:49
* Based on original by Claudio Terra for Lua 3.x.
* With contributions by Roberto Ierusalimschy.
* With documentation from Steve Donovan 2012
*/
/***
Generate pathnames matching a shell-style pattern.
Functions generating a table of filenames that match a shell-style
pattern string.
@module posix.glob
*/
#include <config.h>
#include <glob.h>
#include "_helpers.c"
/***
Find all files in this directory matching a shell pattern.
@function glob
@string[opt="*"] pat shell glob pattern
@treturn table matching filenames
@see glob(3)
@see glob.lua
*/
static int
Pglob(lua_State *L)
{
const char *pattern = optstring(L, 1, "*");
glob_t globres;
checknargs(L, 1);
if (glob(pattern, 0, NULL, &globres))
return pusherror(L, pattern);
else
{
unsigned int i;
lua_newtable(L);
for (i=1; i<=globres.gl_pathc; i++)
{
lua_pushstring(L, globres.gl_pathv[i-1]);
lua_rawseti(L, -2, i);
}
globfree(&globres);
return 1;
}
}
static const luaL_Reg posix_glob_fns[] =
{
LPOSIX_FUNC( Pglob ),
{NULL, NULL}
};
LUALIB_API int
luaopen_posix_glob(lua_State *L)
{
luaL_register(L, "posix.glob", posix_glob_fns);
lua_pushliteral(L, "posix.glob for " LUA_VERSION " / " PACKAGE_STRING);
lua_setfield(L, -2, "version");
return 1;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.