text stringlengths 4 6.14k |
|---|
/////////////////////////////////////////////////////////////////////////////
// Name: slider.h
// Purpose: wxSlider class
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id: slider.h,v 1.9 2005/02/14 22:27:07 RN Exp $
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SLIDER_H_
#define _WX_SLIDER_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "slider.h"
#endif
#include "wx/control.h"
#include "wx/slider.h"
#include "wx/stattext.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
// Slider
class WXDLLEXPORT wxSlider: public wxSliderBase
{
DECLARE_DYNAMIC_CLASS(wxSlider)
public:
wxSlider();
inline wxSlider(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr)
{
Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
}
~wxSlider();
bool Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr);
virtual int GetValue() const ;
virtual void SetValue(int);
void SetRange(int minValue, int maxValue);
inline int GetMin() const { return m_rangeMin; }
inline int GetMax() const { return m_rangeMax; }
void SetMin(int minValue) { SetRange(minValue, m_rangeMax); }
void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); }
// For trackbars only
void SetTickFreq(int n, int pos);
inline int GetTickFreq() const { return m_tickFreq; }
void SetPageSize(int pageSize);
int GetPageSize() const ;
void ClearSel() ;
void ClearTicks() ;
void SetLineSize(int lineSize);
int GetLineSize() const ;
int GetSelEnd() const ;
int GetSelStart() const ;
void SetSelection(int minPos, int maxPos);
void SetThumbLength(int len) ;
int GetThumbLength() const ;
void SetTick(int tickPos) ;
// set min/max size of the slider
virtual void DoSetSizeHints( int minW, int minH,
int maxW = -1, int maxH = -1,
int incW = -1, int incH = -1 );
protected:
virtual wxSize DoGetBestSize() const;
virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags);
virtual void DoMoveWindow(int x, int y, int w, int h);
void Command(wxCommandEvent& event);
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
// Common processing to invert slider values based on wxSL_INVERSE
virtual int ValueInvertOrNot(int value) const;
wxStaticText* m_macMinimumStatic ;
wxStaticText* m_macMaximumStatic ;
wxStaticText* m_macValueStatic ;
int m_rangeMin;
int m_rangeMax;
int m_pageSize;
int m_lineSize;
int m_tickFreq;
private :
DECLARE_EVENT_TABLE()
};
#endif
// _WX_SLIDER_H_
|
/*****************************************************************************************
* *
* owl *
* *
* Copyright (c) 2014 Jonas Strandstedt *
* *
* 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 __LOGMANAGER_H__
#define __LOGMANAGER_H__
#include <owl/designpattern/singleton.hpp>
#include <owl/logging/log.h>
#include <vector>
#include <sstream>
#include <cstdio>
#include <cstring>
namespace owl {
class LogManager: public Singleton<LogManager> {
public:
void addLogger(Log* logger);
void log(Log::LogLevel level, const std::string& category, const std::string& message);
friend class Singleton<LogManager>;
protected:
LogManager();
~LogManager();
private:
std::vector<Log*> _loggers;
}; // LogManager
} // owl
#include <owl/logging/logmanager.inl>
#endif
|
#ifndef STK_DF_INTERNAL_H
#define STK_DF_INTERNAL_H
/* Helpful socket defs */
#define set_sock_buf_nice(_socket, _level, _option_name, _bufsize, _port, _env) do { \
int _rc, _buf = _bufsize; \
while(_buf > 65536) { \
_rc = setsockopt(_socket, _level, _option_name, &_buf, sizeof(_buf)); \
if (_rc == 0) break; \
if (_buf == _bufsize) STK_LOG(STK_LOG_ERROR,"Failed to set %s socket buffer size %d on port %d, env %p err %d df %d", \
_option_name == SO_RCVBUF ? "receive" : "send", _buf, _port, _env, errno, _socket);\
_buf /= 2; \
} \
if(_buf != _bufsize && _rc == 0) \
STK_LOG(STK_LOG_NORMAL,"Set socket %s buffer size %d on port %d, env %p", \
_option_name == SO_RCVBUF ? "receive" : "send", _buf, _port, _env); \
} while(0)
/* Common data flow defines - needed in a separate header for testing */
#define STK_DATA_FLOW_CLIENTIP_ID 0x8110
#define STK_DATA_FLOW_CLIENT_PROTOCOL_ID 0x8120
#endif
|
// Memory layout
#define EXTMEM 0x8000 // Start of extended memory(REAL)
#define PHYSTOP 0x2000000 // Top physical memory (512MB)
#define DEVSPACE 0xFE000000 // Other devices are at high addresses
// MMI/O layout (GPI/O and UART)
#ifdef QEMU
#define GPIO_BASE_P 0x101e4000
#define UART0_BASE_P 0x101f1000
#define GPIO_BASE_V 0xf2200000
#define UART0_BASE_V 0xf22f1000
#endif
#ifdef REAL
#define GPIO_BASE_P 0x20200000
#define UART0_BASE_P 0x20201000
#define GPIO_BASE_V 0xf2200000
#define UART0_BASE_V 0xf2201000
#endif
//VIC base address
#define VIC_BASE 0xfffef000
//ARM Timer base address
#define TIMER_BASE 0x7e00b000
//Exception Vector Table Address
#define VEC_TBL 0xffff0000
// Key addresses for address space layout (see kmap in vm.c for layout)
#define KERNBASE 0xc0000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
#endif
#define V2P(a) (((uint) (a)) - KERNBASE)
#define P2V(a) (((void *) (a)) + KERNBASE)
#define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
#define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts
|
/*
* Copyright 2017 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef P2P_CLIENT_RELAYPORTFACTORYINTERFACE_H_
#define P2P_CLIENT_RELAYPORTFACTORYINTERFACE_H_
#include <memory>
#include <string>
#include BOSS_WEBRTC_U_p2p__base__portinterface_h //original-code:"p2p/base/portinterface.h"
#include BOSS_WEBRTC_U_rtc_base__refcount_h //original-code:"rtc_base/refcount.h"
namespace rtc {
class AsyncPacketSocket;
class Network;
class PacketSocketFactory;
class Thread;
} // namespace rtc
namespace webrtc {
class TurnCustomizer;
} // namespace webrtc
namespace cricket {
class Port;
struct ProtocolAddress;
struct RelayServerConfig;
// A struct containing arguments to RelayPortFactory::Create()
struct CreateRelayPortArgs {
CreateRelayPortArgs();
rtc::Thread* network_thread;
rtc::PacketSocketFactory* socket_factory;
rtc::Network* network;
const ProtocolAddress* server_address;
const RelayServerConfig* config;
std::string username;
std::string password;
std::string origin;
webrtc::TurnCustomizer* turn_customizer;
};
inline CreateRelayPortArgs::CreateRelayPortArgs() {}
// A factory for creating RelayPort's.
class RelayPortFactoryInterface {
public:
virtual ~RelayPortFactoryInterface() {}
// This variant is used for UDP connection to the relay server
// using a already existing shared socket.
virtual std::unique_ptr<Port> Create(const CreateRelayPortArgs& args,
rtc::AsyncPacketSocket* udp_socket) = 0;
// This variant is used for the other cases.
virtual std::unique_ptr<Port> Create(const CreateRelayPortArgs& args,
int min_port,
int max_port) = 0;
};
} // namespace cricket
#endif // P2P_CLIENT_RELAYPORTFACTORYINTERFACE_H_
|
///////////////////////////////////////////////////////////////////////////////
// Name: wx/mgl/popupwin.h
// Purpose: wxPopupWindow class for wxMGL
// Author: Vadim Zeitlin
// Created: 06.01.01
// RCS-ID: $Id: popupwin.h,v 1.7 2004/05/23 20:51:18 JS Exp $
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_POPUPWIN_H_
#define _WX_POPUPWIN_H_
// ----------------------------------------------------------------------------
// wxPopupWindow
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase
{
public:
wxPopupWindow() { }
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
{ (void)Create(parent, flags); }
bool Create(wxWindow *parent, int flags = wxBORDER_NONE)
{
return wxPopupWindowBase::Create(parent) &&
wxWindow::Create(parent, -1,
wxDefaultPosition, wxDefaultSize,
(flags & wxBORDER_MASK) | wxPOPUP_WINDOW);
}
protected:
DECLARE_DYNAMIC_CLASS(wxPopupWindow)
};
#endif // _WX_POPUPWIN_H_
|
//
// OKUtils_NSBundle.h
// OKUtils
//
// Created by MAC on 2017/8/24.
// Copyright © 2017年 HERB. All rights reserved.
//
#import <Foundation/Foundation.h>
/// 获取当前语言
FOUNDATION_EXTERN NSString *OKCurrentLanguage(void);
/// 获取APP名称
FOUNDATION_EXTERN NSString *OKAPP_NAME(void);
/// 获取APP版本
FOUNDATION_EXTERN NSString *OKAPP_VERSION(void);
/// 获取APP build版本
FOUNDATION_EXTERN NSString *OKAPP_BUILD(void);
/// 获取Documents目录 [苹果建议将程序中建立的或在程序中浏览到的文件数据保存在该目录下,iTunes备份和恢复的时候会包括此目录]
FOUNDATION_EXTERN NSString *OKDocumentsPath(void);
/// 获得Documents下指定文件名的文件路径
FOUNDATION_EXTERN NSString *OKDocumentFilePath(NSString *fileName);
/// 获取Library目录 [存储程序的默认设置或其它状态信息]
FOUNDATION_EXTERN NSString *OKLibraryPath(void);
/// 获取Caches目录 [存放缓存文件,iTunes不会备份此目录,此目录下文件不会在应用退出删除]
FOUNDATION_EXTERN NSString *OKCachesPath(void);
/// references 目录包含应用程序的偏好设置文件
FOUNDATION_EXTERN NSString *OKLibraryOreferencePath(void);
/// 获取Tmp目录
FOUNDATION_EXTERN NSString *OKTmpPath(void);
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSData.h"
// Not exported
@interface NSConcreteData : NSData
{
unsigned int _isInline:1;
unsigned int _retainCount:31;
unsigned long long _length;
unsigned long long _capacity;
void *_bytes;
union {
unsigned char _space[12];
id _deallocator;
void _field1;
} _u;
}
- (void)finalize;
- (void)dealloc;
- (id)initWithBytes:(void *)arg1 length:(unsigned long long)arg2 copy:(_Bool)arg3 freeWhenDone:(_Bool)arg4 bytesAreVM:(_Bool)arg5;
- (id)initWithBytes:(void *)arg1 length:(unsigned long long)arg2 copy:(_Bool)arg3 deallocator:(id)arg4;
- (id)init;
- (void)getBytes:(void *)arg1 range:(struct _NSRange)arg2;
- (void)getBytes:(void *)arg1 length:(unsigned long long)arg2;
- (void)getBytes:(void *)arg1;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (const void *)bytes;
- (unsigned long long)length;
@end
|
/* Copyright (c) 2007 Duncan Sharpe, Steve Arch
**
** 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 __VIEWSTATE_H
#define __VIEWSTATE_H
#include "transx.h"
#include "transxstate.h"
using namespace std;
class viewstate
{
int mfdposition;
int viewmode;
int varviewmode;
int viewfunction,varviewfunction;
bool switchmode;
static bool renderviewport;
bool mfdactive;//If there's an MFD associated with this
viewstate(UINT tmfd, class shipptrs *shipptrs);
class transxstate *state;//Pointer to the transxstate associated with this
void selfdownshift();
void resetshift();
public:
bool doupdate(Sketchpad *sketchpad, int tw, int th, TransxMFD *mfdptr);
bool getrenderviewport(){return renderviewport;};
class MFDvariable *GetCurrVariable();
static void preparetoclose();
void setmfdactive(bool temp){mfdactive=temp;};
void movetonextfunction();
void movetopreviousfunction();
void inc_viewmode();
void togglefunctionswitch(){switchmode=!switchmode;viewfunction=varviewfunction;viewmode=varviewmode;};
void savecurrent(FILEHANDLE scn);
void restoresave(FILEHANDLE scn);
int getvariableviewmode(){return varviewmode;};
class MFDvarhandler *GetVarhandler();
void fliphelpsystem();
~viewstate();
friend class shipptrs;
};
#endif |
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
*
* @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
**/
#if OS_OBJECT_USE_OBJC
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
/**
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
*
* @see http://nshipster.com/ns_enum-ns_options/
**/
#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif
extern NSString *const kReachabilityChangedNotification;
typedef NS_ENUM(NSInteger, NetworkStatus) {
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
};
@class UDCReachability;
typedef void (^NetworkReachable)(UDCReachability * reachability);
typedef void (^NetworkUnreachable)(UDCReachability * reachability);
@interface UDCReachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(UDCReachability*)reachabilityWithHostname:(NSString*)hostname;
+(UDCReachability*)reachabilityForInternetConnection;
+(UDCReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(UDCReachability*)reachabilityForLocalWiFi;
-(UDCReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end |
#include <stdio.h>
int main(int argc, char** argv) {
printf("%d", 2)
return 0;
}
|
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
/* returns the array index of the string */
/* (index of first match is returned, or -1) */
int index_in_str_array(const char *const string_array[], const char *key)
{
int i;
for (i = 0; string_array[i] != 0; i++) {
if (strcmp(string_array[i], key) == 0) {
return i;
}
}
return -1;
}
int index_in_strings(const char *strings, const char *key)
{
int idx = 0;
while (strings[0]) {
if (strcmp(strings, key) == 0) {
return idx;
}
strings += strlen(strings) + 1; /* skip NUL */
idx++;
}
return -1;
}
/* returns the array index of the string, even if it matches only a beginning */
/* (index of first match is returned, or -1) */
#ifdef UNUSED
int index_in_substr_array(const char *const string_array[], const char *key)
{
int i;
int len = strlen(key);
if (len) {
for (i = 0; string_array[i] != 0; i++) {
if (strncmp(string_array[i], key, len) == 0) {
return i;
}
}
}
return -1;
}
#endif
int index_in_substrings(const char *strings, const char *key)
{
int len = strlen(key);
if (len) {
int idx = 0;
while (strings[0]) {
if (strncmp(strings, key, len) == 0) {
return idx;
}
strings += strlen(strings) + 1; /* skip NUL */
idx++;
}
}
return -1;
}
const char *nth_string(const char *strings, int n)
{
while (n) {
n--;
strings += strlen(strings) + 1;
}
return strings;
}
|
#include "lsl_common.h"
/* function [CreatedAt] = lsl_get_created_at(LibHandle,StreamInfo) */
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray*prhs[] )
{
/* handle of the desired field */
mxArray *field;
/* temp pointer */
uintptr_t *pTmp;
/* function handle */
lsl_get_created_at_t func;
/* input/output variables */
uintptr_t info;
double created_at;
if (nrhs != 2)
mexErrMsgTxt("2 input argument(s) required.");
if (nlhs != 1)
mexErrMsgTxt("1 output argument(s) required.");
/* get function handle */
field = mxGetField(prhs[0],0,"lsl_get_created_at");
if (!field)
mexErrMsgTxt("The field does not seem to exist.");
pTmp = (uintptr_t*)mxGetData(field);
if (!pTmp)
mexErrMsgTxt("The field seems to be empty.");
func = (lsl_get_created_at_t*)*pTmp;
/* get additional inputs */
info = *(uintptr_t*)mxGetData(prhs[1]);
/* invoke & return */
created_at = func(info);
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); *(double*)mxGetData(plhs[0]) = (double)created_at;
}
|
//
// TVIMediaTrack.h
// TwilioVideo
//
// Copyright © 2016 Twilio Inc. All rights reserved.
//
/**
* `TVITrackState` is an enum defines the possible states of a track.
*/
typedef NS_ENUM(NSUInteger, TVITrackState) {
/**
* Track ended.
*/
TVITrackStateEnded = 0,
/**
* Track live.
*/
TVITrackStateLive,
};
/**
* `TVITrack` is the base class from which all other Track types are dervied.
*/
@interface TVITrack : NSObject
/**
* @brief A unique identifier for the Track.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *trackId;
/**
* @brief Indicates if the track is enabled or not.
*/
@property (nonatomic, assign, readonly, getter=isEnabled) BOOL enabled;
/**
* @brief The current state of the Track.
*/
@property (nonatomic, assign, readonly) TVITrackState state;
/**
* @brief Developers shouldn't initialize this class directly.
*
* @discussion `TVITrack` cannot be created explicitly.
*/
- (null_unspecified instancetype)init __attribute__((unavailable("TVITrack cannot be created explicitly.")));
@end
|
#ifndef __ETH_LOW__H__
#define __ETH_LOW__H__
#include "eth_low_cfg.h"
void eth_low_deinit (mEth_t *eth);
MadBool eth_low_init (mEth_t *eth, const mEth_InitData_t *initData, mEth_Callback_t fn, MadVptr ep);
MadBool eth_phy_init (mEth_t *eth);
MadBool eth_mac_deinit (mEth_t *eth);
MadBool eth_mac_init (mEth_t *eth);
MadBool eth_mac_start (mEth_t *eth);
void eth_low_ExtEvent(mEth_t *eth);
void eth_low_PhyEvent(mEth_t *eth);
MadBool eth_port_init (mEth_t *eth);
#endif
|
/*************************************************************************/
/* image_loader_jpegd.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef IMAGE_LOADER_TINYEXR_H
#define IMAGE_LOADER_TINYEXR_H
#include "io/image_loader.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class ImageLoaderHDR : public ImageFormatLoader {
public:
virtual Error load_image(Ref<Image> p_image, FileAccess *f);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
ImageLoaderHDR();
};
#endif
|
//
// JPSMainViewController.h
// remotecam
//
// Created by JP Simard on 2014-04-10.
// Copyright (c) 2014 JP Simard. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JPSMainViewController : UIViewController
@end
|
#ifndef LIST_H
#define LIST_H
#include <stdbool.h>
struct list_node {
void *data;
struct list_node *next;
struct list_node *prev;
};
struct list {
unsigned int length;
struct list_node *head;
struct list_node *tail;
};
struct list_iter {
const struct list *list;
struct list_node *current;
};
extern void list_init(struct list *l);
extern void list_add_front(struct list *l, void *data);
extern void list_add_back(struct list *l, void *data);
extern void list_clear(struct list *l);
extern void list_iter_begin(const struct list *l, struct list_iter *iter);
extern bool list_iter_end(const struct list_iter *iter);
extern void *list_iter_data(const struct list_iter *iter);
extern void list_iter_next(struct list_iter *iter);
#endif
|
//
// AppDelegate.h
// ZJ 线程之间的通信
//
// Created by base on 15/09/19.
// Copyright © 2015年 base. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// PXLWheelBarController.h
// PXLWheelBar
//
// Created by Fabio Cerdeiral on 12/01/12.
// Copyright (c) 2012 pixel4. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PXLWheelBar.h"
@protocol PXLWheelBarControllerDelegate;
@interface PXLWheelBarController : UIViewController <PXLWheelBarDelegate> {
@package
Class _wheelBarClass;
}
@property (strong, readonly, nonatomic) PXLWheelBar *wheelBar;
@property (copy, nonatomic) NSArray *viewControllers;
@property (strong, nonatomic) UIViewController *selectedViewController;
@property (assign, nonatomic) NSUInteger selectedIndex;
@property (weak, nonatomic) id<PXLWheelBarControllerDelegate> delegate;
- (id)initWithWheelBarClass:(Class)wheelBarClass;
- (UIImage *)snapshotOfView:(UIView *)view;
@end
@protocol PXLWheelBarControllerDelegate <NSObject>
@optional
- (BOOL)wheelBarController:(PXLWheelBarController *)controller shouldSelectViewController:(UIViewController *)viewController;
- (void)wheelBarController:(PXLWheelBarController *)controller didSelectViewController:(UIViewController *)viewController;
@end
@interface UIViewController (PXLWheelBarControllerItem)
@property (strong, readonly, nonatomic) PXLWheelBarController *wheelBarController;
@end |
#ifndef JANSSON_EXTENSION_UGLY_H
#define JANSSON_EXTENSION_UGLY_H
#include <jansson.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
Create a default object of the given json_type with a typical neutral value.
@param type JSON type to create an object for.
@returns Returns an object of the given type.
*/
json_t *json_oftype(json_type type);
/*
Identifies the json type of a given string.
@param str JSON type to create an object for.
@returns Returns an object of the given type.
*/
json_type json_typeofs(const char *str);
/*
Returns a json from a given string.
@param str JSON in string from.
@returns Returns the JSON contained within str.
*/
json_t *json_ofvalue(const char *str);
/*
Invers an object or array into a new object.
@param json JSON object or array.
@returns Returns an object containing key and value arrays or NULL.
*/
json_t *json_invert(json_t *json);
/*
Combines an array of keys and an array of values into a single object.
The value array may be null or smaller. The key array may also be smaller.
The result is as one would expect.
@param keys Keys for the new object
@param values Values for the new object
@returns Returns the combined JSON object or NULL on error.
*/
json_t *json_object_zip(json_t *keys, json_t *values);
/*
Splits an objects into its keys and values and returns them in a new object.
The new object contains two arrays. One is stored under "keys", one under "values".
@param json JSON object to be split
@returns Returns an object container with the keys and values or NULL on error.
*/
json_t *json_object_unzip(json_t *json);
/*
Replaces the value of json with value.
The type of JSON is not altered (not currently possible in jansson).
Instead the value is casted to the type where possible.
If no cast was possible, the function returns without action.
@warning The type of json is not altered (not currently possible in jansson). True, false or null can never be replaced (again due to jansson).
@note We could use a double pointer approach but it would result in other problems.
@param json JSON to be replaced (Any but null, false or true)
@param value The value to be set
@returns Returns 0 on success and -1 on error.
*/
int json_value_set(json_t *json, const char *value);
/*
Returns the value assoziated with the json string, integer or real as string.
@warning The returned value must be freed
@param json JSON to be replaced (Any but null, false or true)
@returns Returns a string representing the value in json. Must be freed.
*/
char *json_value_copy(json_t *json);
#ifdef __cplusplus
}
#endif
#endif /*JANSSON_EXTENSION_UGLY_H*/ |
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
/* rfc1716 */
#ifndef ICMP_UNREACH_FILTER_PROHIB
#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */
#endif
#ifndef ICMP_UNREACH_HOST_PRECEDENCE
#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host precedence violation */
#endif
#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* precedence cutoff */
#endif
/* Data section of the probe packet */
#ifndef HAVE_ICMP_NEXTMTU
/* Path MTU Discovery (RFC1191) */
struct my_pmtu {
u_short ipm_void;
u_short ipm_nextmtu;
};
#endif
/* What a GRE packet header looks like */
struct grehdr {
u_int16_t flags;
u_int16_t proto;
u_int16_t length; /* PPTP version of these fields */
u_int16_t callId;
};
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47
#endif
/* For GRE, we prepare what looks like a PPTP packet */
#define GRE_PPTP_PROTO 0x880b
static void udp_prep(struct traceroute *, struct outdata *);
static int udp_check(struct traceroute *, const u_char *, int);
static void tcp_prep(struct traceroute *, struct outdata *);
static int tcp_check(struct traceroute *, const u_char *, int);
static void gre_prep(struct traceroute *, struct outdata *);
static int gre_check(struct traceroute *, const u_char *, int);
static void gen_prep(struct traceroute *, struct outdata *);
static int gen_check(struct traceroute *, const u_char *, int);
static void icmp_prep(struct traceroute *, struct outdata *);
static int icmp_check(struct traceroute *, const u_char *, int);
static struct hostinfo *gethostinfo(const char *hostname);
/* Forwards */
static void freehostinfo(struct hostinfo *);
static void getaddr(u_int32_t *, char *);
static struct hostinfo *gethostinfo(const char *);
static u_short in_cksum(u_short *, int);
static u_short p_cksum(struct ip *, u_short *, int);
static char *pr_type(u_char);
#ifdef IPSEC
static int setpolicy __P((int so, char *policy));
#endif
static struct outproto *setproto(char *);
static int str2val(const char *, const char *, int, int);
static void tvsub(struct timeval *, struct timeval *);
static void usage(void);
static void pkt_compare(const u_char *, int, const u_char *, int);
#ifndef HAVE_USLEEP
int usleep(u_int);
#endif
static int send_probe(struct traceroute *, int, int);
static double deltaT(struct timeval *t1p, struct timeval *t2p);
static void setsin(struct sockaddr_in *, u_int32_t);
/* List of supported protocols. The first one is the default. The last
one is the handler for generic protocols not explicitly listed. */
struct outproto protos[] = {
{
"udp",
"spt dpt len sum",
IPPROTO_UDP,
sizeof(struct udphdr),
32768 + 666,
udp_prep,
udp_check
},
{
"tcp",
"spt dpt seq ack xxflwin sum urp",
IPPROTO_TCP,
sizeof(struct tcphdr),
32768 + 666,
tcp_prep,
tcp_check
},
{
"gre",
"flg pro len clid",
IPPROTO_GRE,
sizeof(struct grehdr),
GRE_PPTP_PROTO,
gre_prep,
gre_check
},
{
"icmp",
"typ cod sum ",
IPPROTO_ICMP,
sizeof(struct icmp),
0,
icmp_prep,
icmp_check
},
{
NULL,
NULL,
0,
2 * sizeof(u_short),
0,
gen_prep,
gen_check
},
};
|
#include "queue.h"
#include<stdlib.h>
#include<stdio.h>
struct print_queue *head=NULL, *tail=NULL;
int size=-1;
void add(struct comando cmd){
//printf("%s %s\n", cmd.key, cmd.value);
if(!tail){
tail = (struct print_queue*)malloc(sizeof(struct print_queue));
tail->cmd = (struct comando*)malloc(sizeof(cmd));
tail->cmd->cmd = cmd.cmd;
tail->cmd->key = cmd.key;
tail->cmd->value = cmd.value;
tail->next = NULL;
head = tail;
}else{
struct print_queue *tmp = (struct print_queue*)malloc(sizeof(struct print_queue));
tmp->cmd = (struct comando*)malloc(sizeof(cmd));
tmp->cmd->cmd = cmd.cmd;
tmp->cmd->key = cmd.key;
tmp->cmd->value = cmd.value;
tail->next = tmp;
tail = tmp;
tail->next=NULL;
}
size++;
}
struct comando* top(){
if(head!=NULL){
struct comando *tmp = head->cmd;
head = head->next;
size--;
if(head == NULL)
tail = NULL;
return tmp;
}else
return NULL;
}
|
/**
* \file
* The default implementation of bcp_queue (see \ref bcp_queue.h). This
* implementation uses linked list DS to store data packets.
* \author
* Yad Tahir <yst11 at imperial.ac.uk>
*/
#include "bcp_queue.h"
#include "bcp.h"
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
void bcp_queue_init(void *c){
//Setup BCP
struct bcp_conn * bcp_c = (struct bcp_conn *) c;
bcp_c->packet_queue.list = &(bcp_c->packet_queue_list);
bcp_c->packet_queue.bcp_connection = c;
list_init(bcp_c->packet_queue_list);
PRINTF("DEBUG: Bcp Queue has been initialized \n");
/**
* As seen, the actual memory allocation for the queue has to be performed
* separately by another component (the default implementation is BCP_Queue_Allocater.
* This will provide a great flexiablity in terms of extending the queue items and provide a customized header.
*/
}
struct bcp_queue_item * bcp_queue_top(struct bcp_queue *s){
return list_head(*s->list);
}
struct bcp_queue_item * bcp_queue_element(struct bcp_queue *s, uint16_t index){
struct bcp_queue_item * i = bcp_queue_top(s);
int j;
for(j = 1 ; j < index+1; j++)
i = list_item_next(i);
return i;
}
void bcp_queue_remove(struct bcp_queue *s, struct bcp_queue_item *i){
PRINTF("DEBUG: Removing an item from the packet queue\n");
//Null is not allowed here
if(i != NULL) {
list_remove(*s->list, i);
memb_free(s->memb, i);
}else{
PRINTF("ERROR: Passed queue item record cannot be removed from the packet queue\n");
}
}
void bcp_queue_pop(struct bcp_queue *s){
PRINTF("DEBUG: Removing the first item from the packet queue\n");
struct bcp_queue_item * i = bcp_queue_top(s);
bcp_queue_remove(s, i);
}
int bcp_queue_length(struct bcp_queue *s){
return list_length(*s->list);
}
struct bcp_queue_item * bcp_queue_push(struct bcp_queue *s, struct bcp_queue_item *i){
struct bcp_queue_item * newRow;
//Make sure the queue is not full
uint16_t current_queue_length = bcp_queue_length(s);
if(current_queue_length + 1 > MAX_PACKET_QUEUE_SIZE){
PRINTF("ERROR: Packet Queue is full, a new packet will be dropped \n");
return NULL;
}
// Allocate a memory block for the new record
newRow = memb_alloc(s->memb);
if(newRow == NULL) {
PRINTF("DEBUG: Error, memory cannot be allocated for a bcp_queue_item record \n");
return NULL;
}
//Sets the fields of the new record
newRow->next = NULL;
newRow->hdr.bcp_backpressure = 0;
newRow->data_length = i->data_length;
memcpy(newRow->data, i->data, newRow->data_length);
//Add the row to the queue
list_push(*s->list, newRow);
PRINTF("DEBUG: Pushing a new data packet to the packet queue\n");
return bcp_queue_top(s);
}
void bcp_queue_clear(struct bcp_queue *s){
//For every stored record
while(bcp_queue_top(s) != NULL) {
bcp_queue_pop(s);
}
PRINTF("DEBUG: Packet Queue has been cleared\n");
} |
//
// GSCollectionViewItemModel.h
// GSKitDemo
//
// Created by OSU on 16/7/28.
// Copyright © 2016年 GarryLance. All rights reserved.
//
#import "GSModelBase.h"
@interface GSCollectionViewItemModel : GSModelBase
@property (copy, nonatomic) NSString * placeholderImageName;
@property (copy, nonatomic) NSString * imageName;
@property (copy, nonatomic) NSURL * imageUrl;
@property (copy, nonatomic) NSString * title;
@property (copy, nonatomic) NSDictionary * titleAttributes;
@end
|
#ifndef __EDITOR_H__
#define __EDITOR_H__
#include "Module.h"
#include "Skybox.h"
#include "MathGeoLib\include\MathGeoLib.h"
#include "ImGuizmo\ImGuizmo.h"
#include "imgui/imgui.h"
#include "WarningWindow.h" // Needed here because of WarningType
#include <list>
#include <vector>
class GameObject;
class FPSGraph;
class WindowOptions;
class HardwareInfo;
class Console;
class Assets;
class Hierarchy;
class Inspector;
class Window;
class CameraWindow;
class ResourcesWindow;
class MaterialCreatorWindow;
class ShaderEditorWindow;
class LightingWindow;
class LayersWindow;
class RenderTexEditorWindow;
class TestWindow;
class CurveWindow;
class TerrainWindow;
class ComponentCar;
using namespace std;
class ModuleEditor : public Module
{
public:
ModuleEditor(const char* name, bool start_enabled = true);
~ModuleEditor();
bool Init(Data& config);
bool Start();
update_status PreUpdate();
update_status Update();
bool CleanUp();
void HandleInput();
string GetAssetsCurrentDir()const;
void RefreshAssets()const;
void InitSizes();
void OnResize(int screen_width, int screen_height);
bool UsingKeyboard() const;
bool UsingMouse() const;
//GameObject selection
void SelectSingle(GameObject* game_object);
void AddSelect(GameObject* game_object);
void Unselect(GameObject* game_object);
void UnselectAll();
bool IsSelected(GameObject* game_object) const;
void RemoveSelected();
void DisplayWarning(WarningType type, const char *format, ...);
private:
//Game Simulation Options
void GameOptions()const;
//Editor Windows
update_status EditorWindows();
//Menus
void FileMenu();
void HelpMenu();
void WindowsMenu();
void EditMenu();
void DebugMenu();
void GameObjectMenu();
void PhysicsMenu();
bool QuitWindow();
void OnSaveCall();
void OpenSaveSceneWindow();
void SaveSceneWindow();
void DisplayGizmo();
public:
Assets* assets = nullptr;
MaterialCreatorWindow* material_creator_win = nullptr;
RenderTexEditorWindow* rendertex_win = nullptr;
Skybox skybox;
std::list<GameObject*> selected;
GameObject* copy_go = nullptr;
ImGuizmo::OPERATION gizmo_operation = ImGuizmo::OPERATION::TRANSLATE;
ImGuizmo::MODE gizmo_mode = ImGuizmo::MODE::WORLD;
bool gizmo_enabled = true;
int assign_wheel = -1;
GameObject* wheel_assign = nullptr;
bool assign_item = false;
ComponentCar* to_assign_item = nullptr;
bool disable_grid = false;
private:
bool using_keyboard;
bool using_mouse;
bool select_dragging = false;
ImVec2 start_drag;
vector<Window*> windows;
// Permanent windows
Hierarchy* hierarchy = nullptr;
Inspector* inspector = nullptr;
// Other windows
FPSGraph* fps_graph_win = nullptr;
WindowOptions* winoptions_win = nullptr;
HardwareInfo* hardware_win = nullptr;
CameraWindow* camera_win = nullptr;
ResourcesWindow* resource_win = nullptr;
ShaderEditorWindow* shader_editor_win = nullptr;
LightingWindow* lighting_win = nullptr;
LayersWindow* layers_win = nullptr;
TestWindow* test_win = nullptr;
CurveWindow* curve_win = nullptr;
WarningWindow* warning_window = nullptr;
TerrainWindow* terrain_window = nullptr;
bool save_scene_win = false;
string scene_name_to_save;
public:
float heightmapMaxHeight = 1.0f;
bool lockSelection = false;
private:
bool save_quit = false;
bool quit = false;
};
#endif |
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* hprose/httpserver.h *
* *
* hprose http server class for php-cpp. *
* *
* LastModified: Jul 11, 2014 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
#ifndef HPROSE_HTTPSERVER_H_
#define HPROSE_HTTPSERVER_H_
/*
#include <unordered_map>
#include <regex>
#include <phpcpp.h>
namespace Hprose {
const int32_t E_ERROR = 1;
const int32_t E_WARNING = 2;
const int32_t E_PARSE = 4;
const int32_t E_NOTICE = 8;
const int32_t E_CORE_ERROR = 16;
const int32_t E_CORE_WARNING = 32;
const int32_t E_COMPILE_ERROR = 64;
const int32_t E_COMPILE_WARNING = 128;
const int32_t E_USER_ERROR = 256;
const int32_t E_USER_WARNING = 512;
const int32_t E_USER_NOTICE = 1024;
const int32_t E_STRICT = 2048;
const int32_t E_RECOVERABLE_ERROR = 4096;
const int32_t E_DEPRECATED = 8192;
const int32_t E_USER_DEPRECATED = 16384;
#if PHP_VERSION_ID >= 50400
const int32_t E_ALL = 32767;
#elif PHP_VERSION_ID >= 50300
const int32_t E_ALL = 30719;
#elif PHP_VERSION_ID >= 50200
const int32_t E_ALL = 6143;
#else
const int32_t E_ALL = 2047;
#endif
inline std::string error_message(int32_t error_code) {
switch (error_code) {
case E_ERROR: return "Error";
case E_WARNING: return "Warning";
case E_PARSE: return "Parse Error";
case E_NOTICE: return "Notice";
case E_CORE_ERROR: return "Core Error";
case E_CORE_WARNING: return "Core Warning";
case E_COMPILE_ERROR: return "Compile Error";
case E_COMPILE_WARNING: return "Compile Warning";
case E_USER_ERROR: return "User Error";
case E_USER_WARNING: return "User Warning";
case E_USER_NOTICE: return "User Notice";
case E_STRICT: return "Run-time Notice";
case E_RECOVERABLE_ERROR: return "Recoverable Error";
case E_DEPRECATED: return "Deprecated";
case E_USER_DEPRECATED: return "User Deprecated";
default: return "Unknown Error";
}
}
const char *magic_methods[] = {
"__construct",
"__destruct",
"__call",
"__callStatic",
"__get",
"__set",
"__isset",
"__unset",
"__sleep",
"__wakeup",
"__toString",
"__invoke",
"__set_state",
"__clone"
};
class HttpServer : public Php::Base {
private:
std::unordered_map<std::string, Php::Value> functions;
std::unordered_map<std::string, std::string> funcnames;
std::unordered_map<std::string, int32_t> resultmodes;
std::unordered_map<std::string, Php::Value> simplemodes;
std::vector<Php::Value> filters;
std::set<std::string> origins;
bool debug = false;
bool crossdomain = false;
bool p3p = false;
bool get = true;
bool simple = false;
int32_t error_type = E_ALL & ~E_NOTICE;
std::string error = "";
Php::Value &inputFilter(Php::Value &data) {
int32_t count = (int32_t)filters.size();
for (int32_t i = count - 1; i >= 0; --i) {
data = filters[i].call("inputFilter", data, this);
}
return data;
}
Php::Value &outputFilter(Php::Value &data) {
int32_t count = (int32_t)filters.size();
for (int32_t i = 0; i < count; ++i) {
data = filters[i].call("outputFilter", data, this);
}
return data;
}
public:
Php::Value __filterHandler(Php::Parameters ¶ms) {
Php::Value &data = params[0];
std::regex regex("<b>.*? error<\\/b>:(.*?)<br");
std::smatch match;
if (std::regex_match(data.stringValue(), match, regex)) {
std::string error = std::regex_replace(match[1].str(),
std::regex(debug ?
"<.*?>" :
" in <b>.*<\\/b>$"),
"");
data = TagError + serialize_string(trim(error)) + TagEnd;
}
return outputFilter(data);
}
Php::Value __errorHandler(Php::Parameters ¶ms) {
int32_t err_no = params[0];
std::string err_str = params[1];
std::string err_file = params[2];
std::string err_line = params[3];
if (debug) err_str += " in " + err_file + " on line " + err_line;
error = error_message(err_no) + ": " + err_str;
sendError();
Php::exit();
}
};
}
*/
#endif /* HPROSE_HTTPSERVER_H_ */
|
// RUN: %ocheck 0 %s
f_calls;
f()
{
f_calls++;
return 7;
}
struct A
{
int i, j, k;
};
check(const struct A *p, int a, int b, int c)
{
if(p->i != a || p->j != b || p->k != c)
abort();
}
main()
{
struct A x[] = {
{ 1, 2, 3 },
{ 1, 2, 3 },
[2 ... 5] = { f(), 5, 6 }
};
if(f_calls != 1)
abort();
check(&x[0], 1, 2, 3);
check(&x[1], 1, 2, 3);
check(&x[2], 7, 5, 6);
check(&x[3], 7, 5, 6);
check(&x[4], 7, 5, 6);
check(&x[5], 7, 5, 6);
return 0;
}
|
//
// BuffListViewController.h
// BuffDemo
//
// Created by BoWang(r4l.xyz) on 16/5/5.
// Copyright © 2016年 BoWang(r4l.xyz). All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BuffListViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
{
}
@property (nonatomic,strong) UITableView *buffListTableView;
@end
|
#import "MOBProjection.h"
@interface MOBProjectionEPSG32127 : MOBProjection
@end
|
//
// TweetViewController.h
// NicoTwi
//
// Created by Pontago on 2013/05/14.
// Copyright (c) 2013年 Pontago. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TweetViewController : UITableViewController
@property (strong, nonatomic) NSNumber *videoId;
@end
|
#ifndef UTILS_H
#define UTILS_H
/*
File: utils.h
Description: Various system-level utility functions.
Created: May 6, 2017
Author: Matt Mumau
*/
#ifndef UTILS_DATETIME_MAXLEN
#define UTILS_DATETIME_MAXLEN 23
#endif
/* Copies a properly formatted time string into the provided string. */
void utils_mktime(time_t time, char *string);
/* Get a time format appropriate for an HTTP response */
void utils_mkresponsetime(char *string, size_t len);
/* Get the difference in seconds between the timespecs; nano-second precision) */
double utils_timediff(struct timespec end_time, struct timespec start_time);
double utils_timespec_to_secs(struct timespec ts);
#endif |
//
// ScrollViewAutolayout.h
// test app
//
// Created by Canopus 4 on 01/05/14.
// Copyright (c) 2014 Iftekhar. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ScrollViewAutolayout : UIScrollView
@property(nonatomic, strong) IBOutlet UIView *contentView;
@property(nonatomic, assign) CGSize scrollContentSize;
@end
|
/*
* Copyright (c) 2015-2015 Texas Instruments Incorporated
*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* asin(x)
* Method :
* Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
* we approximate asin(x) on [0,0.5] by
* asin(x) = x + x*x^2*R(x^2)
* where
* R(x^2) is a rational approximation of (asin(x)-x)/x^3
* and its remez error is bounded by
* |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75)
*
* For x in [0.5,1]
* asin(x) = pi/2-2*asin(sqrt((1-x)/2))
* Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
* then for x>0.98
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
* For x<=0.98, let pio4_hi = pio2_hi/2, then
* f = hi part of s;
* c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
* and
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
* = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
*
* Special cases:
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
*/
#include <float.h>
#include <stdint.h>
#include "math.h"
#include "math_private.h"
_DATA_ACCESS static const __ieee64_t
one = C(1.00000000000000000000e+00), /* 0x3FF00000, 0x00000000 */
huge = C(1.000e+300),
pio2_hi = C(1.57079632679489655800e+00), /* 0x3FF921FB, 0x54442D18 */
pio2_lo = C(6.12323399573676603587e-17), /* 0x3C91A626, 0x33145C07 */
pio4_hi = C(7.85398163397448278999e-01), /* 0x3FE921FB, 0x54442D18 */
/* coefficient for R(x^2) */
pS0 = C( 1.66666666666666657415e-01), /* 0x3FC55555, 0x55555555 */
pS1 = C(-3.25565818622400915405e-01), /* 0xBFD4D612, 0x03EB6F7D */
pS2 = C( 2.01212532134862925881e-01), /* 0x3FC9C155, 0x0E884455 */
pS3 = C(-4.00555345006794114027e-02), /* 0xBFA48228, 0xB5688F3B */
pS4 = C( 7.91534994289814532176e-04), /* 0x3F49EFE0, 0x7501B288 */
pS5 = C( 3.47933107596021167570e-05), /* 0x3F023DE1, 0x0DFDF709 */
qS1 = C(-2.40339491173441421878e+00), /* 0xC0033A27, 0x1C8A2D4B */
qS2 = C( 2.02094576023350569471e+00), /* 0x40002AE5, 0x9C598AC8 */
qS3 = C(-6.88283971605453293030e-01), /* 0xBFE6066C, 0x1B8D0159 */
qS4 = C( 7.70381505559019352791e-02); /* 0x3FB3B8C5, 0xB12E9282 */
__ieee64_t
F(asin)(__ieee64_t x)
{
__ieee64_t t=0.0,w,p,q,c,r,s;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>= 0x3ff00000) { /* |x|>= 1 */
uint32_t lx;
GET_LOW_WORD(lx,x);
if(((ix-0x3ff00000)|lx)==0)
/* asin(1)=+-pi/2 with inexact */
return x*pio2_hi+x*pio2_lo;
__raise_invalid();
return NAN; /* asin(|x|>1) is NaN */
} else if (ix<0x3fe00000) { /* |x|<0.5 */
if(ix<0x3e500000) { /* if |x| < 2**-26 */
if(huge+x>one) return x;/* return x with inexact if x!=0*/
}
t = x*x;
p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
w = p/q;
return x+x*w;
}
/* 1> |x|>= 0.5 */
w = one-F(fabs)(x);
t = w*0.5;
p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
s = F(sqrt)(t);
if(ix>=0x3FEF3333) { /* if |x| > 0.975 */
w = p/q;
t = pio2_hi-(2.0*(s+s*w)-pio2_lo);
} else {
w = s;
SET_LOW_WORD(w,0);
c = (t-w*w)/(s+w);
r = p/q;
p = 2.0*s*r-(pio2_lo-2.0*c);
q = pio4_hi-2.0*w;
t = pio4_hi-(p-q);
}
if(hx>0) return t; else return -t;
}
#if LDBL_MANT_DIG == DBL_MANT_DIG
long double asinl(long double x) __attribute__((__alias__("asin")));
#endif
|
/*
* Copyright (c) 2018-2019 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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 ARM_COMPUTE_TEST_GATHER_DATASET
#define ARM_COMPUTE_TEST_GATHER_DATASET
#include "utils/TypePrinter.h"
#include "arm_compute/core/Types.h"
namespace arm_compute
{
namespace test
{
namespace datasets
{
class GatherDataset
{
public:
using type = std::tuple<TensorShape, TensorShape, int>;
struct iterator
{
iterator(std::vector<TensorShape>::const_iterator input_shapes_it,
std::vector<TensorShape>::const_iterator starts_values_it,
std::vector<int>::const_iterator axis_it)
: _input_shapes_it{ std::move(input_shapes_it) },
_indices_shapes_it{ std::move(starts_values_it) },
_axis_it{ std::move(axis_it) }
{
}
std::string description() const
{
std::stringstream description;
description << "InputShape=" << *_input_shapes_it << ":";
description << "IndicesShape=" << *_indices_shapes_it << ":";
description << "Axis=" << *_axis_it << ":";
return description.str();
}
GatherDataset::type operator*() const
{
return std::make_tuple(*_input_shapes_it, *_indices_shapes_it, *_axis_it);
}
iterator &operator++()
{
++_input_shapes_it;
++_indices_shapes_it;
++_axis_it;
return *this;
}
private:
std::vector<TensorShape>::const_iterator _input_shapes_it;
std::vector<TensorShape>::const_iterator _indices_shapes_it;
std::vector<int>::const_iterator _axis_it;
};
iterator begin() const
{
return iterator(_input_shapes.begin(), _indices_shapes.begin(), _axis.begin());
}
int size() const
{
return std::min(_input_shapes.size(), std::min(_indices_shapes.size(), _axis.size()));
}
void add_config(TensorShape input_shape, TensorShape indices_shape, int axis)
{
_input_shapes.emplace_back(std::move(input_shape));
_indices_shapes.emplace_back(std::move(indices_shape));
_axis.emplace_back(std::move(axis));
}
protected:
GatherDataset() = default;
GatherDataset(GatherDataset &&) = default;
private:
std::vector<TensorShape> _input_shapes{};
std::vector<TensorShape> _indices_shapes{};
std::vector<int> _axis{};
};
class SmallGatherDataset final : public GatherDataset
{
public:
SmallGatherDataset()
{
// 2D input
add_config(TensorShape(15U, 15U), TensorShape(5U), 0);
add_config(TensorShape(15U, 15U), TensorShape(5U), 1);
add_config(TensorShape(5U, 5U), TensorShape(80U), -1);
// 3D input
add_config(TensorShape(5U, 5U, 5U), TensorShape(19U), 0);
add_config(TensorShape(5U, 4U, 6U), TensorShape(30U), 1);
add_config(TensorShape(3U, 5U, 7U), TensorShape(20U), 2);
add_config(TensorShape(5U, 4U, 6U), TensorShape(30U), -1);
add_config(TensorShape(3U, 5U, 7U), TensorShape(20U), -2);
// 4D input
add_config(TensorShape(4U, 3U, 4U, 5U), TensorShape(4U), 0);
add_config(TensorShape(4U, 3U, 5U, 5U), TensorShape(5U), 1);
add_config(TensorShape(4U, 3U, 2U, 5U), TensorShape(6U), 2);
add_config(TensorShape(3U, 4U, 4U, 6U), TensorShape(7U), 3);
add_config(TensorShape(4U, 3U, 5U, 5U), TensorShape(5U), -1);
add_config(TensorShape(4U, 3U, 2U, 5U), TensorShape(6U), -2);
add_config(TensorShape(3U, 4U, 4U, 6U), TensorShape(7U), -3);
}
};
class LargeGatherDataset final : public GatherDataset
{
public:
LargeGatherDataset()
{
// 2D input
add_config(TensorShape(150U, 150U), TensorShape(50U), 0);
add_config(TensorShape(150U, 150U), TensorShape(50U), 1);
add_config(TensorShape(150U, 150U), TensorShape(50U), -1);
// 3D input
add_config(TensorShape(50U, 40U, 60U), TensorShape(33U), 0);
add_config(TensorShape(40U, 50U, 60U), TensorShape(24U), 1);
add_config(TensorShape(70U, 80U, 100U), TensorShape(50U), 2);
add_config(TensorShape(40U, 50U, 60U), TensorShape(24U), -1);
add_config(TensorShape(70U, 80U, 100U), TensorShape(50U), -2);
// 4D input
add_config(TensorShape(30U, 40U, 20U, 20U), TensorShape(33U), 0);
add_config(TensorShape(23U, 10U, 60U, 20U), TensorShape(24U), 1);
add_config(TensorShape(14U, 20U, 10U, 31U), TensorShape(30U), 2);
add_config(TensorShape(34U, 10U, 40U, 20U), TensorShape(50U), 3);
add_config(TensorShape(23U, 10U, 60U, 20U), TensorShape(24U), -1);
add_config(TensorShape(14U, 20U, 10U, 31U), TensorShape(30U), -2);
add_config(TensorShape(34U, 10U, 40U, 20U), TensorShape(50U), -3);
}
};
} // namespace datasets
} // namespace test
} // namespace arm_compute
#endif /* ARM_COMPUTE_TEST_GATHER_DATASET */
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2016-2018 The PIVX developers
// Copyright (c) 2018 The Ion Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UTILTIME_H
#define BITCOIN_UTILTIME_H
#include <stdint.h>
#include <string>
int64_t GetTime();
int64_t GetTimeMillis();
int64_t GetTimeMicros();
void SetMockTime(int64_t nMockTimeIn);
void MilliSleep(int64_t n);
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
std::string DurationToDHMS(int64_t nDurationTime);
#endif // BITCOIN_UTILTIME_H
|
//===============================================================================
//
// Copyright(c) 2015 Advanced Micro Devices, Inc.All Rights Reserved
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//=================================================================================
#ifndef _SMU7_INTERFACE_H_
#define _SMU7_INTERFACE_H_
#include <AMDTDriverTypedefs.h>
// Smu7IndexData: Smu7 MMIO offset for data access
typedef struct
{
uint32 m_index;
uint32 m_data;
} Smu7IndexData;
// Smu7Logging: Smu7 message logging ids
typedef struct
{
uint32 m_start;
uint32 m_dump;
} Smu7Logging;
// Smu7MessageParam: Smu7 message exchange parameters
typedef struct
{
uint32 m_msgId;
uint32 m_resp;
uint32 m_arg;
uint32 m_fill;
} Smu7MessageParam;
//Smu7CounterTable: SMU7 counter table
typedef struct
{
uint32 m_pwrCu0;
uint32 m_pwrCu1;
uint32 m_tempCalcCu0;
uint32 m_tempCalcCu1;
uint32 m_tempMeasCu0;
uint32 m_tempMeasCu1;
uint32 m_pwriGpu;
uint32 m_pwrPcie;
uint32 m_pwrDdr;
uint32 m_pwrDisplay;
uint32 m_pwrPackage;
uint32 m_tempCalcGpu;
uint32 m_tempMeasGpu;
uint32 m_sclk;
uint32 m_voltVddcLoad;
uint32 m_currVddc;
} Smu7CounterTable;
// Smu7Interface: Smu7 interfacing structure
typedef struct
{
uint64 m_gpuBaseAddress;
uint64 m_mappedAddress;
uint64 m_mappedSize;
uint64 m_indexDataPair;
uint64 m_indexDataPairSize;
Smu7CounterTable m_counterTable;
Smu7MessageParam m_messageParam;
Smu7Logging m_logging;
Smu7IndexData m_indexData;
} Smu7Interface;
// CollectSMU8RegisterValues: Collect all SMU counter values
// based on the mask set and fill in the pData
bool CollectSMU7RegisterValues(void* pSmu,
uint8* pData,
uint32* pLength);
// Smu7SessionInitialize:
bool Smu7SessionInitialize(void* pSmu);
// Smu7SessionClose
bool Smu7SessionClose(void* pSmu);
#endif //_SMU7_INTERFACE_H_
|
/*
* Copyright (c) 2016 Renat R. Dusaev <crank@qcrypt.org>
* Author: Renat R. Dusaev <crank@qcrypt.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# include "evGen/aprimeCrossSection.h"
static const char _static_usageMsg[] = "\
Usage:\n\
$ %s <thetaRange> <thetaNBins> <xRange> <xNBins>\n\
Application produces 2D histogram data (map) for being used\n\
with gnuplot.\n\
";
int
main(int argc, char * argv[]) {
uint16_t Z = 82,
thetaNBins,
xNBins;
int16_t i, j;
double A = 207.2,
massAPrime = 1,
E0 = 100,
epsilon = 1e-5,
xRange, xStep,
thetaRange, thetaStep,
sigma,
x, theta;
FILE * outF;
void * wsPtr = NULL;
if( argc != 5 ) {
fprintf( stderr, _static_usageMsg, argv[0] );
return EXIT_FAILURE;
}
init_aprime_cross_section_workspace(
/* unsigned short, material Z ... */ Z,
/* double, material A ........... */ A,
/* double, suggested A' mass, GeV */ massAPrime,
/* double, E_0, GeV ............. */ E0,
/* double, supposed mixing fuctor */ epsilon,
# define send_numsparameter_arg( type, txtName, dft, name, descr ) dft,
for_all_p348lib_aprimeCS_GSL_chi_comp_parameter( send_numsparameter_arg )
# undef send_numsparameter_arg
&wsPtr
);
thetaRange = atof( argv[1] )*M_PI;
thetaNBins = atoi( argv[2] );
thetaStep = 2*thetaRange/(thetaNBins-1);
xRange = atof( argv[3] );
xNBins = atoi( argv[4] );
xStep = (upper_cut_x(wsPtr) - lower_cut_x(wsPtr))/(xNBins-1);
{
outF = fopen( "out.dat", "w" );
fprintf( outF, "# Parameters: thetaRange -> +/- %e\n", thetaRange );
fprintf( outF, "# thetaNBins = %u\n", thetaNBins );
fprintf( outF, "# xRange -> %e...%e\n", _p348_CST_electronMass_GeV,
xRange - _p348_CST_electronMass_GeV );
fprintf( outF, "# xNBins = %u\n", xNBins );
for( i = 0; i < xNBins; ++i ) {
for( j = -thetaNBins/2.; j < thetaNBins/2.; ++j ) {
x = i*xStep + _p348_CST_electronMass_GeV/E0;
theta = j*thetaStep;
sigma = aprime_cross_section( x,
theta,
wsPtr );
fprintf( outF, "%e %e %e\n", x, theta, sigma );
}
fprintf( outF, "\n" );
}
}
x = 1 - _p348_CST_electronMass_GeV/E0;
theta = 0;
printf( "Singular value at x = %e, theta = %e: sigma = %e < %e?\n",
x, theta,
aprime_cross_section( x, theta, wsPtr ),
analytic_integral_estimation( wsPtr ) );
free_aprime_cross_section_workspace( wsPtr );
return EXIT_SUCCESS;
}
|
//
// RGViewController.h
// RGToastSample
//
// Copyright (c) 2013 Ryan Grier (http://www.ryangrier.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface RGViewController : UIViewController
- (IBAction)showShortToast:(id)sender;
- (IBAction)showLongToast:(id)sender;
- (IBAction)showManyShortToasts:(id)sender;
- (IBAction)showManyLongToasts:(id)sender;
@end
|
//
// AppDelegate.h
// Example
//
// Created by Seven on 15-2-10.
// Copyright (c) 2015年 Allgateways. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
|
//
// DAVSession.h
// DAVKit
//
// Copyright Matt Rajca 2010. All rights reserved.
//
@class DAVBaseRequest;
@protocol DAVSessionDelegate;
/* All paths are relative to the root of the server */
@interface DAVSession : NSObject {
@private
NSURL *_rootURL;
BOOL _allowUntrustedCertificate;
BOOL _send100ContinueRequests;
id <DAVSessionDelegate> _delegate;
}
@property (readonly) NSURL *rootURL;
@property (assign) BOOL allowUntrustedCertificate;
@property (nonatomic) BOOL send100ContinueRequests;
@property (nonatomic, readonly, assign) id <DAVSessionDelegate> delegate;
/*
The root URL should include a scheme and host, followed by any root paths
**NOTE: omit the trailing slash (/)**
Example: http://idisk.me.com/steve
*/
- (id)initWithRootURL:(NSURL *)url delegate:(id <DAVSessionDelegate>)delegate;
- (void)resetCredentialsCache;
// Convenience methods that call through to the delegate
- (void)appendFormatToReceivedTranscript:(NSString *)format, ...;
- (void)appendFormatToSentTranscript:(NSString *)format, ...;
- (void)appendFormatToTranscript:(NSString *)format arguments:(va_list)argList sent:(BOOL)sent;
@end
@protocol DAVSessionDelegate <NSObject>
@optional
- (void)webDAVSession:(DAVSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSInteger disposition, NSURLCredential *credential))completionHandler;
// The sent argument indicates whether the data was sent or received
- (void)webDAVSession:(DAVSession *)session appendStringToTranscript:(NSString *)string sent:(BOOL)sent;
@end
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* 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.
*/
// This config is mostly used to ensure that the nan-boxing object model
// continues to build (i.e. catches usage of mp_obj_t that don't work with
// this representation).
// select nan-boxing object model
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_D)
// native emitters don't work with nan-boxing
#define MICROPY_EMIT_X86 (0)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_ARM (0)
#include <stdint.h>
typedef int64_t mp_int_t;
typedef uint64_t mp_uint_t;
#define UINT_FMT "%llu"
#define INT_FMT "%lld"
#define SIZE_T_FMT "%lu"
|
#include "unity.h"
#include "mock_mapping.h"
#include "../partition.h"
void setUp(void)
{
mock_setUp();
}
void tearDown(void)
{
mock_tearDown();
}
#define ASSERT_RW(RET, MEM, ADDR, PTR, BYTES) \
TEST_ASSERT_EQUAL_INT(STATUS_OK, RET); \
TEST_ASSERT_EQUAL_PTR(&MEM, used_mem); \
TEST_ASSERT_EQUAL_UINT32(ADDR, used_addr); \
TEST_ASSERT_EQUAL_PTR((char*)PTR, used_ptr); \
TEST_ASSERT_EQUAL_UINT32(BYTES, used_bytes)
#define ASSERT_ERASE(RET, MEM, ADDR, BYTES) \
TEST_ASSERT_EQUAL_INT(STATUS_OK, RET); \
TEST_ASSERT_EQUAL_PTR(&MEM, used_mem); \
TEST_ASSERT_EQUAL_UINT32(ADDR, used_addr); \
TEST_ASSERT_EQUAL_UINT32(BYTES, used_bytes)
void test_identity(void)
{
DECLARE_NULL_MEMORY_DEVICE(mem);
DECLARE_PARTITION(part, &mem, 0, 1000);
ASSERT_RW(partition_read(&part, 123, (char*)0xDEAD, 100), mem, 123, 0xDEAD, 100);
ASSERT_RW(partition_write(&part, 123, (char*)0xDEAD, 100), mem, 123, 0xDEAD, 100);
ASSERT_ERASE(partition_erase(&part, 123, 100), mem, 123, 100);
}
void test_offset(void)
{
DECLARE_NULL_MEMORY_DEVICE(mem);
DECLARE_PARTITION(part, &mem, 1000, 1000);
ASSERT_RW(partition_read(&part, 123, (char*)0xDEAD, 100), mem, 1123, 0xDEAD, 100);
ASSERT_RW(partition_write(&part, 123, (char*)0xDEAD, 100), mem, 1123, 0xDEAD, 100);
ASSERT_ERASE(partition_erase(&part, 0, 100), mem, 1000, 100);
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_identity);
RUN_TEST(test_offset);
return UNITY_END();
}
|
#include "touchmon.h"
/* server thread to serve requests comming from socket */
void *server_thread(void *ptr) {
int srv_socket_fd, con_socket_fd;
struct sockaddr_un srv_sock_addr;
fd_set fdset;
struct timeval timeout;
struct req_message request;
struct rep_message reply;
if((srv_socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
test_brk = TRUE;
tst_brkm(TBROK, terminate, "Server: could not create socket! error:%i %s", errno, strerror(errno));
}
srv_sock_addr.sun_family = AF_UNIX;
strncpy(&srv_sock_addr.sun_path[0], setting_socket_s, sizeof(srv_sock_addr.sun_path) - 1);
if(bind(srv_socket_fd, (struct sockaddr *) &srv_sock_addr, sizeof(struct sockaddr_un)) == -1) {
test_brk = TRUE;
tst_brkm(TBROK, terminate, "Server: could not bind to socket! error:%i %s", errno, strerror(errno));
}
if(listen(srv_socket_fd, 10) == -1) {
test_brk = TRUE;
tst_brkm(TBROK, terminate, "Server: could not listen on socket! error:%i %s", errno, strerror(errno));
}
while(run) {
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
if(setting_verbose >= 4)
fprintf(stderr, "Touchtest server: waiting for clients\n");
FD_ZERO(&fdset);
FD_SET(srv_socket_fd, &fdset);
if(select(srv_socket_fd + 1, &fdset, NULL, NULL, &timeout) == 1) {
if(setting_verbose >= 3)
fprintf(stderr, "Touchtest server: received request\n");
// we have data to read:
con_socket_fd = accept(srv_socket_fd, NULL, NULL);
if(con_socket_fd == -1) {
tst_resm(TWARN, "error while accepting request: errno %i %s", errno, strerror(errno));
continue;
}
if(recv(con_socket_fd, (void *) &request, sizeof(struct req_message), 0) == -1) {
tst_resm(TWARN, "error while receiving request: %i %s", errno, strerror(errno));
close(con_socket_fd);
continue;
}
// handle request:
if(setting_verbose >= 3)
fprintf(stderr, "Touchtest server: read request\n");
switch (request.type) {
case REQUEST_COUNTERVAL:
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Handled counter request\n");
reply.type = REPLY_COUNTERVAL;
reply.value = input_event_counter;
if(send(con_socket_fd, (void *) &reply, sizeof(struct rep_message), 0) == -1)
{
tst_resm(TWARN, "Touchtest server: Could not send reply to request for countervalue: errno %i %s\n", errno, strerror(errno));
}
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Handled request for countervalue\n");
break;
case REQUEST_POLL:
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Received poll-request\n");
reply.type = REPLY_POLL;
reply.value = event_thread_ready;
if(send(con_socket_fd, (void *) &reply, sizeof(struct rep_message), 0) == -1)
{
tst_resm(TWARN, "Touchtest server: Could not send reply to poll-request: %i %s\n", errno, strerror(errno));
break;
}
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Handled poll-request\n");
break;
case REQUEST_TERM:
run = FALSE;
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Received request for termination\n");
break;
case REQUEST_RESET:
input_event_counter = 0;
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Received request for counter reset\n");
break;
default:
if(setting_verbose >= 2)
fprintf(stderr, "Touchtest server: Received unsupported request!\n");
break;
}
close(con_socket_fd);
}
}
close(srv_socket_fd);
unlink(setting_socket_s);
return NULL;
}
|
//
// ScottAlertViewController.h
// QQLive
//
// Created by Scott_Mr on 2016/12/1.
// Copyright © 2016年 Scott. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ScottAlertView.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, ScottAlertTransitionStyle) { // 动画类型
ScottAlertTransitionStyleFade = 0,
ScottAlertTransitionStyleScaleFade,
ScottAlertTransitionStyleDropDown,
scottAlertTransitionStyleCustom
};
typedef NS_ENUM(NSInteger, ScottAlertControllerStyle) {
ScottAlertControllerStyleActionSheet = 0,
ScottAlertControllerStyleAlert
};
@interface ScottAlertViewController : UIViewController
@property (nonatomic, strong, readonly) UIView *alertView;
@property (nonatomic, assign, readonly) ScottAlertControllerStyle preferredStyle;
@property (nonatomic, assign, readonly) ScottAlertTransitionStyle transitionStyle;
@property (nonatomic, assign, readonly) Class transitionAnimationClass;
@property (nonatomic, strong) UIView *backgroundView;
@property (nonatomic, strong) UIColor *backgroundColor;
// 是否可以点击背景消失(默认为NO)
@property (nonatomic, assign) BOOL tapBackgroundDismissEnable;
// Default is 15
@property (nonatomic, assign) CGFloat alertStyleMargin;
// Default is 0
@property (nonatomic, assign) CGFloat actionSheetStyleMargin;
// Default centerY
@property (nonatomic, assign) CGFloat alertOriginY;
@property (nonatomic, copy) void(^dismissCompleteBlock)();
+ (instancetype)alertControllerWithAlertView:(UIView *)alertView;
+ (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(ScottAlertControllerStyle)preferredStyle;
+ (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(ScottAlertControllerStyle)preferredStyle transitionAnimationStyle:(ScottAlertTransitionStyle)transitionStyle;
+ (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(ScottAlertControllerStyle)preferredStyle transitionAnimationClass:(Class)transitionAnimationClass;
- (void)dismissViewControllerAnimated:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
|
#pragma once
#include "window.h"
class DialogWindow : public Window {
public:
void setup() override;
void registerWidgets() override;
void nextTurn() override;
void destroy() override;
};
|
#pragma once
#if ENABLE_THREADING
# if USE_CUSTOM_THREADLOCAL
# include "global.h"
# include "threadstorage.h"
# define THREADLOCAL(T) ::Engine::Threading::Global<T, ::Engine::Threading::ThreadStorage>
# else
# include "Generic/proxy.h"
# define THREADLOCAL(T) thread_local ::Engine::Proxy<T>
# endif
#else
# include "Generic/proxy.h"
# define THREADLOCAL(T) ::Engine::Proxy<T>
#endif
#if EMSCRIPTEN
# define thread_local thread_local_not_supported_on_emscripten provoke_syntax_error
#endif
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <SpriteKit/SKFieldNode.h>
@interface SKLinearGravityFieldNode : SKFieldNode
{
}
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)init;
- (void)_initialize;
- (id)_descriptionClassName;
@end
|
/********************************************************************************
* The MIT License (MIT) *
* *
* Copyright (C) 2016 Alex Nolasco *
* *
*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 "HL7Summary.h"
@class HL7MedicationSummaryEntry;
@interface HL7MedicationSummary : HL7Summary <NSCopying, NSCoding>
- (NSArray<HL7MedicationSummaryEntry *> *_Nonnull)allEntries;
@end
|
#ifndef OPENTISSUE_UTILITY_GL_GL_DRAW_POINT_H
#define OPENTISSUE_UTILITY_GL_GL_DRAW_POINT_H
//
// OpenTissue Template Library
// - A generic toolbox for physics-based modeling and simulation.
// Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
//
// OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
//
#include <OpenTissue/configuration.h>
#include <OpenTissue/utility/gl/gl.h>
#include <OpenTissue/core/math/math_vector3.h>
namespace OpenTissue
{
namespace gl
{
/**
* Draw Point.
*
*/
template <typename vector3_type>
inline void DrawPoint( vector3_type const & p , double const radius = 0.1)
{
typedef typename vector3_type::value_type value_type;
GLUquadric * qobj = gluNewQuadric();
glPushMatrix();
glTranslatef( p(0), p(1), p(2) );
GLint slices = 8;
GLint stacks = 8;
gluSphere( qobj, radius, slices, stacks );
glPopMatrix();
gluDeleteQuadric( qobj );
}
} // namespace gl
} // namespace OpenTissue
//OPENTISSUE_UTILITY_GL_GL_DRAW_POINT_H
#endif
|
#pragma once
#include "resource.h"
#include "Rectangle.h"
#include "Color.h"
namespace Syntax
{
namespace Graphics
{
class PanelPrototype :
public Syntax::Graphics::Resource
{
public:
PanelPrototype(const Syntax::Database::IRecord *record);
virtual ~PanelPrototype(void);
virtual void BuildResource();
virtual void FreeResource();
const Syntax::Math::RectangleI& Dimensions() {return dimensions;}
const Syntax::Utility::Guid& BackgroundTexture() {return backgroundTexture;}
const Syntax::Math::Color32& BackgroundColor() {return backgroundColor;}
bool UseBackgroundImage() {return useBackgroundImage;}
bool AnchorLeft() {return anchorLeft;}
bool AnchorRight() {return anchorRight;}
bool AnchorTop() {return anchorTop;}
bool AnchorBottom() {return anchorBottom;}
unsigned short Z() {return z;}
private:
Syntax::Math::RectangleI dimensions;
Syntax::Utility::Guid backgroundTexture;
Syntax::Math::Color32 backgroundColor;
bool useBackgroundImage;
bool anchorLeft;
bool anchorRight;
bool anchorTop;
bool anchorBottom;
unsigned short z;
};
}
}
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@interface CDMModelManager : NSObject
{
}
+ (id)stringRepresentationOfModelObject:(id)arg1;
@end
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef __cplusplus
# error This header can only be compiled as C++.
#endif
#ifndef __INCLUDED_PROTOCOL_H__
#define __INCLUDED_PROTOCOL_H__
#include "serialize.h"
#include "netbase.h"
#include <string>
#include "uint256.h"
extern bool fTestNet;
static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)
{
return testnet ? 24452 : 20566;//return testnet
}
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__
|
//
// AccessoryViewController.h
// HomeKitDemo
//
// Copyright (c) 2014 AT&T. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <HomeKit/HomeKit.h>
@interface AccessoryViewController : UITableViewController <UIPickerViewDataSource, UIPickerViewDelegate>
@property (nonatomic, strong) HMHome *home;
@property (nonatomic, strong) HMAccessory *accessory;
@end
|
%%
%% KDE4xHb - Bindings libraries for Harbour/xHarbour and KDE 4
%%
%% Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%
$project=KDE4xHb
$module=KDEUI
$header
$includes
$beginSlotsClass
$signal=|extenderCreated( QWidget * extender, const QModelIndex & index )
$signal=|extenderDestroyed( QWidget * extender, const QModelIndex & index )
$endSlotsClass
|
#pragma once
#include "py_ptr.h"
namespace python {
template<typename T>
struct py_iterator : public details::py_ptrbase<py_iterator<T>> {
PYPTR_CONSTRUCTORS(py_iterator)
typename details::pyptr_type<T>::type next() {
if (ptr == nullptr) {
return T();
}
auto nextPtr = PyIter_Next(ptr);
if (nextPtr == nullptr && (PyErr_Occurred() == nullptr || PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
details::set_ptr<Type>::set_clone(ptr, nullptr, true);
return nullptr;
}
return steal(nextPtr);
}
};
PYPTR_TEMPLATE_CHECKPTR(py_iterator<T>, "iterator", PyIter_Check(ptr), typename T)
template<typename T>
struct py_generator : public details::py_ptrbase<py_generator<T>> {
PYPTR_CONSTRUCTORS(py_generator);
private:
T send_internal(PyObject *value) {
if (ptr == nullptr) {
return nullptr;
}
auto nextPtr = _PyGen_Send(ptr, value);
if (nextPtr == nullptr) {
if (PyErr_Occurred() == nullptr || PyErr_ExceptionMatches(PyExc_StopIteration) || PyErr_ExceptionMatches(PyExc_GeneratorExit)) {
PyErr_Clear();
} else {
details::throw_pyerr();
}
details::clear_ptr(ptr, nullptr);
return T();
}
return typename details::pyptr_type<T>::type(steal(nextPtr));
}
public:
template<typename TArg>
T send(const TArg& value) {
return send_internal(value);
}
T next() {
return send_internal(nullptr);
}
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3
private:
template<typename TReturn>
T send_internal(PyObject *value, TReturn& returnValue) const {
if (ptr == nullptr) {
returnValue = TReturn();
return T();
}
auto nextPtr = _PyGen_Send(ptr, value);
if (nextPtr == nullptr) {
PyObject *returned;
if (_PyGen_FetchStopIterationValue(&returned) != 0) {
details::throw_pyerr();
}
returnValue = typename details::pyptr_type<TReturn>::type(borrow(returned));
details::clear_ptr(ptr, nullptr);
return nullptr;
}
return typename details::pyptr_type<T>::type(steal(nextPtr));
}
public:
template<typename TArg, typename TReturn>
T send(const TArg& value, TReturn& returnValue) const {
return send_internal(value, returnValue);
}
template<typename TReturn>
T next(TReturn& returnValue) {
return send_internal(nullptr, returnValue);
}
#endif
};
PYPTR_TEMPLATE_CHECKPTR(py_generator<T>, PyGen_Type, PyGen_Check(ptr), typename T);
namespace details {
template<typename T>
struct iterator {
typedef typename ::std::forward_iterator_tag iterator_category;
typedef typename T value_type;
typedef typename void difference_type;
typedef difference_type distance_type;
typedef typename T *pointer;
typedef typename T& reference;
py_iterator<T> iterObj;
typename pyptr_type<T>::type current;
iterator(py_iterator<T> iterObj) : iterObj(iterObj) { }
iterator<T> operator++(int) {
auto result = *this;
current = iterObj.next();
return result;
}
iterator<T>& operator++() {
current = iterObj.next();
return *this;
}
T operator*() const {
return current;
}
bool operator==(const iterator<T>& other) const {
return !iterObj && !other.iterObj;
}
bool operator!=(const iterator<T>& other) const {
return iterObj || other.iterObj;
}
};
#define PYPTR_ITERABLE(T) \
py_iterator<T> iter() { return steal(PyObject_GetIter(ptr)); } \
details::iterator<T> begin() { return ++details::iterator<T>(iter()); } \
details::iterator<T> end() { return details::iterator<T>(nullptr); }
}
}
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtNetwork>
#include <QLabel>
#include <QVector>
#include <QListWidget>
#include <QFile>
#include "article.h"
#include "login2.h"
#include "cookiejar.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
signals:
private slots:
void login();
void logout();
void sync();
void getauth(QString user, QString pw);
void getauthreply();
void getlogoutreply();
void pusharticle();
void pusharticlereply();
void updatelist();
void showarticle();
private:
void loadLocalData();
void loadLocalList(const QVector<Article>& );
void saveLocalData();
Ui::MainWindow *ui;
QNetworkAccessManager *netManager;
QNetworkReply *reply;
CookieJar *cookies;
Login2 *dlgLogin;
QLabel *labelCurrentStatus;
//QFile localFile;
//QDataStream tube;
QString strUser;
QString strPw;
QVector<Article> articlelist;
};
#endif // MAINWINDOW_H
|
//-*-c++-*-
#pragma once
#include <memory>
#include "brightray/browser/browser_main_parts.h"
#include "base/threading/thread.h"
#include "content/public/browser/browser_main_parts.h"
#include "base/memory/ref_counted.h"
#include "browser/browser.h"
#include "api/api.h"
namespace meson {
class APIServer;
class Browser;
class MesonMainParts : public brightray::BrowserMainParts {
public:
explicit MesonMainParts();
virtual ~MesonMainParts();
static MesonMainParts* Get(void);
public:
void PreMainMessageLoopRun(void) override;
void PostMainMessageLoopRun(void) override;
bool MainMessageLoopRun(int* result_code) override;
#if defined(OS_MACOSX)
void PreMainMessageLoopStart() override;
void FreeAppDelegate();
#endif
Browser* browser() { return browser_.get(); }
bool SetExitCode(int exit_code);
int GetExitCode() const;
private:
static MesonMainParts* self_;
std::unique_ptr<Browser> browser_;
std::unique_ptr<API> api_;
scoped_refptr<APIServer> api_server_;
int* exit_code_;
private:
DISALLOW_COPY_AND_ASSIGN(MesonMainParts);
};
}
|
// Copyright (c) 2013-2014 The Gtacoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef GTACOIN_NOUI_H
#define GTACOIN_NOUI_H
extern void noui_connect();
#endif // GTACOIN_NOUI_H
|
#import <UIKit/UIKit.h>
#import "MBTest.h"
FOUNDATION_EXPORT double FWAddVersionNumber;
FOUNDATION_EXPORT const unsigned char FWAddVersionString[];
|
//
// MWPhotoBrowser.h
// MWPhotoBrowser
//
// Created by Michael Waterfall on 14/10/2010.
// Copyright 2010 d3i. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MWPhoto.h"
#import "MWPhotoProtocol.h"
#import "MWCaptionView.h"
// Debug Logging
#if 0 // Set to 1 to enable debug logging
#define MWLog(x, ...) NSLog(x, ## __VA_ARGS__);
#else
#define MWLog(x, ...)
#endif
@class MWPhotoBrowser;
@protocol MWPhotoBrowserDelegate <NSObject>
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser;
- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index;
@optional
- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index;
- (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index;
- (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index;
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index;
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index;
- (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
@end
@interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate>
@property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
@property (nonatomic) BOOL zoomPhotosToFill;
@property (nonatomic) BOOL displayNavArrows;
@property (nonatomic) BOOL displayActionButton;
@property (nonatomic) BOOL displaySelectionButtons;
@property (nonatomic) BOOL alwaysShowControls;
@property (nonatomic) BOOL enableGrid;
@property (nonatomic) BOOL enableSwipeToDismiss;
@property (nonatomic) BOOL startOnGrid;
@property (nonatomic) NSUInteger delayToHideElements;
@property (nonatomic, readonly) NSUInteger currentIndex;
// Init
- (id)initWithPhotos:(NSArray *)photosArray;
- (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
// Reloads the photo browser and refetches data
- (void)reloadData;
// Set page that photo browser starts on
- (void)setCurrentPhotoIndex:(NSUInteger)index;
// Navigation
- (void)showNextPhotoAnimated:(BOOL)animated;
- (void)showPreviousPhotoAnimated:(BOOL)animated;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22a.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml
Template File: sources-sink-22a.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Initialize data as a large string
* GoodSource: Initialize data as a small string
* Sink: snprintf
* BadSink : Copy data to string using snprintf
* Flow Variant: 22 Control flow: Flow controlled by value of a global variable. Sink functions are in a separate file from sources.
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define SNPRINTF _snprintf
#else
#define SNPRINTF snprintf
#endif
#ifndef OMITBAD
/* The global variable below is used to drive control flow in the source function */
int CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_badGlobal = 0;
char * CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_badSource(char * data);
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_bad()
{
char * data;
data = (char *)malloc(100*sizeof(char));
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_badGlobal = 1; /* true */
data = CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_badSource(data);
{
char dest[50] = "";
/* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
SNPRINTF(dest, strlen(data), "%s", data);
printLine(data);
free(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* The global variables below are used to drive control flow in the source functions. */
int CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B1Global = 0;
int CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B2Global = 0;
/* goodG2B1() - use goodsource and badsink by setting the static variable to false instead of true */
char * CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B1Source(char * data);
static void goodG2B1()
{
char * data;
data = (char *)malloc(100*sizeof(char));
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B1Global = 0; /* false */
data = CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B1Source(data);
{
char dest[50] = "";
/* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
SNPRINTF(dest, strlen(data), "%s", data);
printLine(data);
free(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if in the source function */
char * CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B2Source(char * data);
static void goodG2B2()
{
char * data;
data = (char *)malloc(100*sizeof(char));
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B2Global = 1; /* true */
data = CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_goodG2B2Source(data);
{
char dest[50] = "";
/* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
SNPRINTF(dest, strlen(data), "%s", data);
printLine(data);
free(data);
}
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_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()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_22_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include "lily_api_embed.h"
/* This file is to be compiled only by emscripten, and serves as a bridge
between the js of a browser and Lily's C code.
Since emscripten can't run main() twice, this instead supplies a series of
helper functions to be called by the js side. It also has the impl for puts
that's necessary. */
lily_state *get_parser()
{
lily_options *options = lily_new_default_options();
lily_state *state = lily_new_state(options);
options->allow_sys = 1;
return parser;
}
int run_parser(lily_state *state, char *to_parse)
{
return lily_parse_string(state, "[tryit]", to_parse);
}
void destroy_parser(lily_state *state)
{
lily_free_state(parser);
}
char *get_parser_error(lily_state *state)
{
return lily_get_error(state);
}
|
#pragma once
/* X-macro format: opcode, description, mask.
Due to interpreter logic, operands MUST be sorted in "least (stricter) mask first" order. */
#define FOR_OPCODES(DO) \
DO(00E0, L"Clears the screen.", 0x00E0) \
DO(00EE, L"Returns from a subroutine.", 0x00EE) \
DO(0NNN, L"Calls RCA 1802 program at address NNN.", 0x0FFF) \
DO(1NNN, L"Jumps to address NNN.", 0x1FFF) \
DO(2NNN, L"Calls subroutine at NNN.", 0x2FFF) \
DO(3XNN, L"Skips the next instruction if VX equals NN.", 0x3FFF) \
DO(4XNN, L"Skips the next instruction if VX doesn't equal NN.", 0x4FFF) \
DO(5XY0, L"Skips the next instruction if VX equals VY.", 0x5FF0) \
DO(6XNN, L"Sets VX to NN.", 0x6FFF) \
DO(7XNN, L"Adds NN to VX.", 0x7FFF) \
DO(8XY0, L"Sets VX to the value of VY.", 0x8FF0) \
DO(8XY1, L"Sets VX to VX or VY (bitwise OR).", 0x8FF1) \
DO(8XY2, L"Sets VX to VX and VY (bitwise AND).", 0x8FF2) \
DO(8XY3, L"Sets VX to VX xor VY (bitwise XOR).", 0x8FF3) \
DO(8XY4, L"Adds VY to VX. VF is set to 1 when there's a carry, and to 0 when there isn't.", 0x8FF4) \
DO(8XY5, L"VY is subtracted from VX. VF is set to 0 when there's a borrow, and to 1 when there isn't.", 0x8FF5) \
DO(8XY6, L"Shift VY right by one and store in VX. VF is set to the value of the least significant bit of VY before the shift.", 0x8FF6) \
DO(8XY7, L"Sets VX to VY minus VX. VF is set to 0 when there's a borrow, and to 1 when there isn't.", 0x8FF7) \
DO(8XYE, L"Shifts VY left by one and store in VX. VF is set to the value of the most significant bit of VY before the shift.", 0x8FFE) \
DO(9XY0, L"Skips the next instruction if VX doesn't equal VY.", 0x9FF0) \
DO(ANNN, L"Sets I to the address NNN.", 0xAFFF) \
DO(BNNN, L"Jumps to the address (NNN + V0).", 0xBFFF) \
DO(CXNN, L"Sets VX to the result of a bitwise AND operation on a random number (0 to 255) and NN.", 0xCFFF) \
DO(DXYN, L"Draws a sprite at coordinate (VX, VY) that has a width of 8 pixels and a height of N pixels. Each row of 8 pixels is read as bit-coded starting from memory location I; I value doesn’t change after the execution of this instruction. VF is set to 1 if any screen pixels are flipped from set to unset when the sprite is drawn, and to 0 if that doesn’t happen.", 0xDFFF) \
DO(EX9E, L"Skips the next instruction if the key stored in VX is pressed.", 0xEF9E) \
DO(EXA1, L"Skips the next instruction if the key stored in VX isn't pressed.", 0xEFA1) \
DO(FX07, L"Sets VX to the value of the delay timer.", 0xFF07) \
DO(FX0A, L"A key press is awaited, and then stored in VX (blocking operation, all instructions halted until next key event).", 0xFF0A) \
DO(FX15, L"Sets the delay timer to VX.", 0xFF15) \
DO(FX18, L"Sets the sound timer to VX.", 0xFF18) \
DO(FX1E, L"Adds VX to I.", 0xFF1E) \
DO(FX29, L"Sets I to the location of the sprite for the character in VX.", 0xFF29) \
DO(FX33, L"Stores the binary-coded decimal representation of VX, with the most significant of three digits at the address in I, the middle digit at I plus 1, and the least significant digit at I plus 2.", 0xFF33) \
DO(FX55, L"Stores V0 to VX (including VX) in memory starting at address I. I is set to I + X + 1 after operation.", 0xFF55) \
DO(FX65, L"Fills V0 to VX (including VX) with values from memory starting at address I. I is set to I + X + 1 after operation.", 0xFF65)
|
#pragma once
#include "stdfx.h"
#include <map>
using namespace std;
#include "Entity.h"
class CEntityMgr{
public:
CEntityMgr(){}
CEntityMgr(const CEntityMgr &){}
CEntityMgr& operator=(const CEntityMgr&){}
~CEntityMgr(){}
public:
static CEntityMgr& GetInstance(){
static CEntityMgr inst;
return inst;
}
void Clear();
bool AddEntity(CEntity* object);
CEntity* GetEntity(string name);
void RemoveEntity(string name);
map<string, class CEntity*>* GetEntityList(){return &entityList;}
private:
map<string, class CEntity*> entityList;
};
#define EntityMgr CEntityMgr::GetInstance() |
//-----------------------------------------------------------------------
// Copyright 2011 Ciaran McHale.
//
// 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 CONFIG4CPP_LEX_BASE_H_
#define CONFIG4CPP_LEX_BASE_H_
//--------
// #include's and #define's
//--------
#include <wchar.h>
#include <config4cpp/Configuration.h>
#include "LexToken.h"
#include "MBChar.h"
#include "UidIdentifierProcessor.h"
#include "platform.h"
namespace CONFIG4CPP_NAMESPACE {
class LexBase
{
public:
//--------
// Public operations
//--------
void nextToken(LexToken &token);
//--------
// Constants for the type of a function.
//--------
enum FunctionType {
NOT_A_FUNC = 1,
STRING_FUNC = 2,
LIST_FUNC = 3,
BOOL_FUNC = 4
};
//--------
// Constants for lexical symbols, for everything except
// keywords and function names. Constants for those are
// defined in a subclass.
//--------
enum LexBaseSymbols {
LEX_IDENT_SYM = 1,
LEX_SEMICOLON_SYM = 2,
LEX_PLUS_SYM = 3,
LEX_QUESTION_EQUALS_SYM = 4,
LEX_EQUALS_SYM = 5,
LEX_EQUALS_EQUALS_SYM = 6,
LEX_NOT_EQUALS_SYM = 7,
LEX_STRING_SYM = 8,
LEX_COMMA_SYM = 9,
LEX_AND_SYM = 10,
LEX_OR_SYM = 11,
LEX_NOT_SYM = 12,
LEX_AT_SYM = 13,
LEX_OPEN_BRACKET_SYM = 14,
LEX_CLOSE_BRACKET_SYM = 15,
LEX_OPEN_BRACE_SYM = 16,
LEX_CLOSE_BRACE_SYM = 17,
LEX_OPEN_PAREN_SYM = 18,
LEX_CLOSE_PAREN_SYM = 19,
LEX_EOF_SYM = 20,
LEX_UNKNOWN_SYM = 21,
LEX_UNKNOWN_FUNC_SYM = 22,
LEX_IDENT_TOO_LONG_SYM = 23,
LEX_STRING_WITH_EOL_SYM = 24,
LEX_ILLEGAL_IDENT_SYM = 25,
LEX_TWO_DOTS_IDENT_SYM = 26,
LEX_BLOCK_STRING_WITH_EOF_SYM = 27,
LEX_SOLE_DOT_IDENT_SYM = 28,
};
struct KeywordInfo {
const char * m_spelling;
short m_symbol;
};
struct FuncInfo {
const char * m_spelling;
short m_funcType;
short m_symbol;
};
protected:
//--------
// Constructors and destructor
//--------
LexBase(
Configuration::SourceType sourceType,
const char * source,
UidIdentifierProcessor * uidIdentifierProcessor)
throw(ConfigurationException);
LexBase(const char * str) throw(ConfigurationException);
virtual ~LexBase();
//--------
// The constructors of a subclass should initialize the
// following variables.
//--------
KeywordInfo * m_keywordInfoArray;
int m_keywordInfoArraySize;
FuncInfo * m_funcInfoArray;
int m_funcInfoArraySize;
private:
//--------
// Implementation-specific operations
//--------
void searchForKeyword(
const char * spelling,
bool & found,
short & symbol);
void searchForFunction(
const char * spelling,
bool & found,
short & funcType,
short & symbol);
void nextChar() throw(ConfigurationException);
char nextByte();
void consumeString(LexToken & token);
void consumeBlockString(LexToken &token);
bool isKeywordChar(const MBChar & ch);
bool isIdentifierChar(const MBChar & ch);
//--------
// Instance variables
//--------
UidIdentifierProcessor * m_uidIdentifierProcessor;
bool m_amOwnerOfUidIdentifierProcessor;
int m_lineNum; // Used for error reporting
MBChar m_ch; // Lookahead character
Configuration::SourceType m_sourceType;
const char * m_source;
bool m_atEOF;
mbstate_t m_mbtowcState;
//--------
// CFG_INPUT_FILE uses m_file
// CFG_INPUT_STRING uses m_ptr and m_source
// CFG_INPUT_EXEC uses m_ptr and m_execOutput
//--------
BufferedFileReader m_file;
const char * m_ptr;
StringBuffer m_execOutput;
//--------
// Unsupported constructors and assignment operators
//--------
LexBase();
LexBase(const LexBase &);
LexBase & operator=(const LexBase &);
};
}; // namespace CONFIG4CPP_NAMESPACE
#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 "NSScroller.h"
@interface OrganizerScroller : NSScroller
{
}
+ (void)initialize;
- (BOOL)_needRedrawOnWindowChangedKeyState;
- (void)drawKnobSlotInRect:(struct CGRect)arg1 highlight:(BOOL)arg2;
- (void)drawKnob;
- (void)drawArrow:(unsigned long long)arg1 highlightPart:(unsigned long long)arg2;
@end
|
/*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HAVOK_TREE_VIEW_MANAGER__H
#define HAVOK_TREE_VIEW_MANAGER__H
/// This class implements some methods used to populate and handle user interaction with a tree-view representation of the
/// contents that is being processed. It is used by filters such as ViewXML and CreateSkeleton.
class hctTreeViewManager
{
public:
/// Constructor - takes a variant to use as the root of the tree, and an optional class registry.
hctTreeViewManager( const hkVariant* root ) : m_root(root) {}
virtual ~hctTreeViewManager() {}
/// Determines whether a specific class type should appear in the tree.
virtual bool isViewable( const hkVariant& variant ) = 0;
/// Determines whether a specific class type should be 'selectable' in some dialogs.
virtual bool isSelectable( const hkVariant& variant ) { return isViewable( variant ); }
/// Adds the root node to the specified tree control.
void init( HWND treeWnd );
/// Handles Win32 messages, especially the expansion of items in the tree.
BOOL handleNotification( LPNMHDR n );
/// Retrieves a variant structure for the currently selected tree item, if any.
bool getSelectedVariant( struct hkVariant& var );
protected:
/// Gets the index of a variant in the tree item <-> variant map,
/// adding a new entry if it was not found.
int getVariantIndex( const struct hkVariant& var );
/// Retrieves the name, the children and the index into the scene nodes bitmap,
/// for any given variant.
void getItemData( const struct hkVariant& var, hkStringOld& name, hkArray< hkVariant >& children, int& imageIndex );
/// Adds a variant as a child of a tree item.
void addItem( HTREEITEM parent, const struct hkVariant& var );
const hkVariant* m_root;
HWND m_treeWnd;
hkArray< hkVariant > m_variantMap;
};
/// A class that implements a tree viewer with the default behavior, i.e. all class types in the tree are displayed
/// and are selectable.
class hctDefaultTreeViewManager : public hctTreeViewManager
{
public:
hctDefaultTreeViewManager( const hkVariant* root ) : hctTreeViewManager( root ) {}
/*virtual*/ bool isViewable( const hkVariant& variant ) { return true; }
};
#endif // HAVOK_TREE_VIEW_MANAGER__H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907)
*
* Confidential Information of Havok. (C) Copyright 1999-2014
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
|
//
// YYBBFormNetworkAPIClient.h
// YYBBSDK
//
// Created by Wang_ruzhou on 16/8/18.
// Copyright © 2016年 Wang_ruzhou. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "UIActivityIndicatorView+AFNetworking.h"
#import "YYBBRequestURL.h"
#import "YYBBBaseRequest.h"
#import "YYBBBaseResponse.h"
#import "YYBBBaseResponseModel.h"
NS_ASSUME_NONNULL_BEGIN
/** 缓存的Block */
typedef void(^YYBBRequestCache)(id responseCache);
@protocol YYBBAppSessionManagerDelegate <NSObject>
+ (instancetype _Nonnull)sharedClient;
// AFN请求 失败成功整合, 返回数据不做处理
- (NSURLSessionDataTask *)yybb_requestWithMethod:(YYBBNetworkReuqetMethod)method
url:(NSString *)URLString
parameters:(nullable id)parameters
completionBlock:(YYBBCompletionBlcok)completionBlock;
/**
服务器协议好的成功回调, 默认Post
@param url url
@param parameters 参数
@param finishedBlock 完成回调, 其中responseObject已经取到resultData
*/
- (NSURLSessionDataTask *)yybb_commonRequestWithUrl:(NSString *)url
parameters:(nullable id)parameters
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
/**
服务器协议好的成功回调
@param method 请求方法
@param url url
@param parameters 参数
@param finishedBlock 完成回调, 其中responseObject已经取到resultData
*/
- (NSURLSessionDataTask *)yybb_commonRequestWithMethod:(YYBBNetworkReuqetMethod)method
url:(NSString *)url
parameters:(nullable id)parameters
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
/**
服务器协议好的成功回调, 可带缓存
@param method 请求方法
@param url url
@param parameters 参数
@param responseCache 缓存
@param finishedBlock 完成回调, 其中responseObject已经取到resultData
*/
- (NSURLSessionDataTask *)yybb_commonRequestWithMethod:(YYBBNetworkReuqetMethod)method
url:(NSString *)url
parameters:(nullable id)parameters
responseCache:(nullable YYBBRequestCache)responseCache
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
/**
request 对象请求 服务器协议好的成功回调
@param request request对象
@param finishedBlock 完成回调, 其中responseObject已经取到resultData
*/
- (NSURLSessionDataTask *)yybb_commonRequestWithRequest:(YYBBBaseRequest *)request
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
/**
request 对象 请求 服务器协议好的成功回调
@param request request对象
@param finishedBlock 完成回调, 其中responseObject已经取到resultData
*/
- (NSURLSessionDataTask *)yybb_commonRequestWithRequest:(YYBBBaseRequest *)request
responseCache:(nullable YYBBRequestCache)responseCache
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
/// 文件下载
/// @param urlString url
/// @param completion 完成回调
- (NSURLSessionDownloadTask *)yybb_downloadWithUrl:(NSString *)urlString
filePath:(NSString *)filePath
completion:(void (^)(NSURL *filePath, NSError *error))completion;
// 图片上传
- (NSURLSessionDownloadTask *)yybb_uploadWithURLString:(NSString *)URLString
parameters:(NSDictionary *)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
// 网络成功数据处理, 暴露出来给flutter调用
- (void)commonHandleResponseObjec:(id)responseObject
error:(NSError *)error
responseClass:(Class)responseClass
itemClass:(Class)itemClass
responseCache:(nullable YYBBRequestCache)responseCache
requestUrl:(NSString *)requestUrl
onFinished:(nullable YYBBCompletionBlcok)finishedBlock;
@end
/**
Body为 FormData
*/
@interface YYBBAPPBaseAPIClient : AFHTTPSessionManager<YYBBAppSessionManagerDelegate>
@end
/**
Body为 FormData
*/
@interface YYBBFormNetworkAPIClient : YYBBAPPBaseAPIClient
@end
/**
Body为raw json
*/
@interface YYBBJsonNetworkAPIClient : YYBBAPPBaseAPIClient
@end
NS_ASSUME_NONNULL_END
|
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
// class gamma_spline
//
//----------------------------------------------------------------------------
#ifndef AGG_GAMMA_SPLINE_INCLUDED
#define AGG_GAMMA_SPLINE_INCLUDED
#include "agg_basics.h"
#include "agg_bspline.h"
namespace agg
{
//------------------------------------------------------------------------
// Class-helper for calculation gamma-correction arrays. A gamma-correction
// array is an array of 256 unsigned chars that determine the actual values
// of Anti-Aliasing for each pixel coverage value from 0 to 255. If all the
// values in the array are equal to its index, i.e. 0,1,2,3,... there's
// no gamma-correction. Class agg::polyfill allows you to use custom
// gamma-correction arrays. You can calculate it using any approach, and
// class gamma_spline allows you to calculate almost any reasonable shape
// of the gamma-curve with using only 4 values - kx1, ky1, kx2, ky2.
//
// kx2
// +----------------------------------+
// | | | . |
// | | | . | ky2
// | | . ------|
// | | . |
// | | . |
// |----------------.|----------------|
// | . | |
// | . | |
// |-------. | |
// ky1 | . | | |
// | . | | |
// +----------------------------------+
// kx1
//
// Each value can be in range [0...2]. Value 1.0 means one quarter of the
// bounding rectangle. Function values() calculates the curve by these
// 4 values. After calling it one can get the gamma-array with call gamma().
// Class also supports the vertex source interface, i.e rewind() and
// vertex(). It's made for convinience and used in class gamma_ctrl.
// Before calling rewind/vertex one must set the bounding box
// box() using pixel coordinates.
//------------------------------------------------------------------------
class gamma_spline
{
public:
gamma_spline();
void values(double kx1, double ky1, double kx2, double ky2);
const unsigned char* gamma() const { return m_gamma; }
double y(double x) const;
void values(double* kx1, double* ky1, double* kx2, double* ky2) const;
void box(double x1, double y1, double x2, double y2);
void rewind(unsigned);
unsigned vertex(double* x, double* y);
private:
unsigned char m_gamma[256];
double m_x[4];
double m_y[4];
bspline m_spline;
double m_x1;
double m_y1;
double m_x2;
double m_y2;
double m_cur_x;
};
}
#endif
|
// Copyright (c) 2012 Kaue Soares da Silveira
//
// 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.
//
// Author: silveira.kaue@gmail.com (Kaue Soares da Silveira)
//
// Commonly used macros.
//
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#ifndef SRC_CLICK_MACROS_H_
#define SRC_CLICK_MACROS_H_
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // SRC_CLICK_MACROS_H_
|
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
// Copyright (c) 2012 Facebook. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "db/db_impl.h"
#include <deque>
#include <set>
#include <vector>
#include <string>
#include "db/dbformat.h"
#include "db/log_writer.h"
#include "db/snapshot.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "port/port.h"
#include "util/stats_logger.h"
namespace rocksdb {
class DBImplReadOnly : public DBImpl {
public:
DBImplReadOnly(const DBOptions& options, const std::string& dbname);
virtual ~DBImplReadOnly();
// Implementations of the DB interface
using DB::Get;
virtual Status Get(const ReadOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
std::string* value);
// TODO: Implement ReadOnly MultiGet?
using DBImpl::NewIterator;
virtual Iterator* NewIterator(const ReadOptions&,
ColumnFamilyHandle* column_family);
virtual Status NewIterators(
const ReadOptions& options,
const std::vector<ColumnFamilyHandle*>& column_family,
std::vector<Iterator*>* iterators) {
// TODO
return Status::NotSupported("Not supported yet.");
}
using DBImpl::Put;
virtual Status Put(const WriteOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
const Slice& value) {
return Status::NotSupported("Not supported operation in read only mode.");
}
using DBImpl::Merge;
virtual Status Merge(const WriteOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
const Slice& value) {
return Status::NotSupported("Not supported operation in read only mode.");
}
using DBImpl::Delete;
virtual Status Delete(const WriteOptions& options,
ColumnFamilyHandle* column_family, const Slice& key) {
return Status::NotSupported("Not supported operation in read only mode.");
}
virtual Status Write(const WriteOptions& options, WriteBatch* updates) {
return Status::NotSupported("Not supported operation in read only mode.");
}
using DBImpl::CompactRange;
virtual Status CompactRange(ColumnFamilyHandle* column_family,
const Slice* begin, const Slice* end,
bool reduce_level = false,
int target_level = -1) {
return Status::NotSupported("Not supported operation in read only mode.");
}
virtual Status DisableFileDeletions() {
return Status::NotSupported("Not supported operation in read only mode.");
}
virtual Status EnableFileDeletions(bool force) {
return Status::NotSupported("Not supported operation in read only mode.");
}
virtual Status GetLiveFiles(std::vector<std::string>&,
uint64_t* manifest_file_size,
bool flush_memtable = true) {
return Status::NotSupported("Not supported operation in read only mode.");
}
using DBImpl::Flush;
virtual Status Flush(const FlushOptions& options,
ColumnFamilyHandle* column_family) {
return Status::NotSupported("Not supported operation in read only mode.");
}
private:
friend class DB;
// No copying allowed
DBImplReadOnly(const DBImplReadOnly&);
void operator=(const DBImplReadOnly&);
};
}
|
//
// UrbanModel.h
// caa
//
// Created by xichao on 16/11/5.
// Copyright © 2016年 xichao. All rights reserved.
//
#import "BaseModel.h"
@interface UrbanModel : BaseModel
@property(nonatomic,strong)NSString *district;
@end
|
/****************************************************************************************
Copyright (C) 2014 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
#ifndef INCLUDE_GEOMETRY_UTILITY_H_
#define INCLUDE_GEOMETRY_UTILITY_H_
#include <fbxsdk.h>
/** Create a pyramid mesh with specific bottom width and height, and attach it to a node.
* /param pScene The scene in which the pyramid mesh is created.
* /param pName The name of the pyramid mesh and the node to which the pyramid is attached.
* /param pBottomWidht The width of the bottom side of the pyramid.
* /param pHeight The height of the pyramid.
* /return Return the node to which the pyramid mesh is attached.
*/
FbxNode * CreatePyramid(FbxScene * pScene, const char * pName, double pBottomWidth, double pHeight);
FbxNode* CreateCube(FbxScene* pScene, const char* pName, FbxDouble3& pLclTranslation);
#endif // INCLUDE_GEOMETRY_UTILITY_H_
|
/*
* Semi-accurate physics simulator (SAPS)
*
* Copyright (C) 2014 Michael Davenport <Davenport.physics@gmail.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.
*
*/
#ifndef MECHANICS_H
#define MECHANICS_H
#include <math.h>
long double new_position(long double currentPosition , long double expectedDisplacement , long double radius );
#endif
|
#ifndef _MINMAXHEAP_H_
#define _MINMAXHEAP_H_
#include <stdlib.h>
#include <errno.h>
#include <string.h>
/*
* Min-Max Heap Node
* type -> Does the node belong to a min level or a max one ?
* key -> Priority
* dataL -> Points to the data
*/
typedef struct MMHeapNode_ {
enum Type{
MIN,
MAX
} type;
int key;
void *data;
}MMHeapNode;
/*
* Min-Max Heap
* size -> Current size
* table -> Min-Max Heap
*/
typedef struct MinMaxHeap_ {
float threshold;
void (*destroy) (void *data);
int size;
int maximumSize;
int minimumSize;
int positions;
MMHeapNode **table;
}MinMaxHeap;
/* Initializes a Min-Max Heap
* Attention: Threshold must be greater than 0.50 for efficient reasons
*/
int initMinMaxHeap(MinMaxHeap *heap, void (*destroy) (void *data), int defaultSize, float threshold);
/* Inserts a node into the Min-Max Heap */
int mmHeapPut(MinMaxHeap *heap, int key, void *data);
/* Returns the element with the mininum priority. It sets data to point to the data from the minimum element */
int getMin(MinMaxHeap *heap, void **data);
/* Returns the element into data with the maximum priority. It sets data to point to the data from the maximum element */
int getMax(MinMaxHeap *heap, void **data);
/* Removes the element with the minimum priority*/
int removeMin(MinMaxHeap *heap);
/* Removes the element with the maximum priority*/
int removeMax(MinMaxHeap *heap);
/* Destroys the Min-Max Heap */
int destroyMinMaxHeap(MinMaxHeap *heap);
/* Helpful definitions */
#define PARENT(i) ((int)(((i)-1) >> 1))
#define LEFT(i) (((i) << 1) + 1)
#define RIGHT(i) (((i) << 1) + 2)
#endif
|
#pragma once
class Cubic {
public:
static float EaseIn( float t, float b, float c, float d );
static float EaseOut( float t, float b, float c, float d );
static float EaseInOut( float t, float b, float c, float d );
};
|
#ifndef _BEARERAUTH_H_
#define _BEARERAUTH_H_
#include "Authorization.h"
class BearerAuth : public Authorization {
public:
BearerAuth(const std::string & _data) : data(_data) { }
std::string createHeader() const {
std::string s = "Bearer ";
s += data;
return s;
}
private:
std::string data;
};
#endif
|
#pragma once
#include "stdafxMath.h"
#include "StaticMatrix.h"
namespace NumericOptimization { namespace Math { namespace LinearAlgebra {
// -------------------------------------------------------------------------------------------------------
// Unary Operators
// -------------------------------------------------------------------------------------------------------
template <typename Scalar, uint rows, uint columns >
inline Matrix<Scalar, rows, columns> operator- ( __in const Matrix<Scalar, rows, columns>& X ) {
Matrix<Scalar, rows, columns> Y( X );
Y *= Scalar( -1 );
return Y;
};
// -------------------------------------------------------------------------------------------------------
// Scalar Binary Operators
// -------------------------------------------------------------------------------------------------------
// Binary multiplication: Z = xY
template <typename Scalar, uint rows, uint columns >
inline Matrix<Scalar, rows, columns> operator* ( __in const Scalar& x, __in const Matrix<Scalar, rows, columns>& Y ) {
Matrix<Scalar, rows, columns> Z( Y );
Z *= x;
return Z;
};
// Binary multiplication: Z = Xy
template <typename Scalar, uint rows, uint columns >
inline Matrix<Scalar, rows, columns> operator* ( __in const Matrix<Scalar, rows, columns>& X, __in const Scalar& y ) {
Matrix<Scalar, rows, columns> Z( X );
Z *= y;
return Z;
};
// -------------------------------------------------------------------------------------------------------
// Matrix Binary Operators
// -------------------------------------------------------------------------------------------------------
// Binary addition: Z = X+Y
template <typename Scalar, uint rows, uint columns >
inline Matrix<Scalar, rows, columns> operator+ ( __in const Matrix<Scalar, rows, columns>& X, __in const Matrix<Scalar, rows, columns>& Y ) {
Matrix<Scalar, rows, columns> Z( X );
Z += Y;
return Z;
};
// Binary subtraction: Z = X-Y
template <typename Scalar, uint rows, uint columns >
inline Matrix<Scalar, rows, columns> operator- ( __in const Matrix<Scalar, rows, columns>& X, __in const Matrix<Scalar, rows, columns>& Y ) {
Matrix<Scalar, rows, columns> Z( X );
Z -= Y;
return Z;
};
template < typename Scalar, uint rowsLeft, uint columnsLeft, uint columnsRight >
inline Matrix< Scalar, rowsLeft, columnsRight > operator* (
__in const Matrix< Scalar, rowsLeft, columnsLeft >& left,
__in const Matrix< Scalar, columnsLeft, columnsRight >& right )
{
Matrix< Scalar, rowsLeft, columnsRight > result;
for ( uint i = 0; i < rowsLeft; i++ ) {
for ( uint j = 0; j < columnsRight; j++ ) {
Scalar* pTile = &result[i][j];
for ( uint k = 0; k < columnsLeft; k++ ) {
*pTile += ( left[i][k] * right[k][j] );
}
}
}
return result;
};
} } } |
#include "../include/csl.h"
void
CSL_Class_New ( void )
{
byte * name = ( byte* ) DataStack_Pop ( ) ;
DataObject_New (CLASS, 0, name, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ;
}
void //Word *
CSL_Class_Value_New ( )
{
byte * name = ( byte* ) DataStack_Pop ( ) ;
Word * word = DataObject_New (OBJECT, 0, name, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ;
}
void
CSL_Class_Clone ( void )
{
byte * name = ( byte* ) DataStack_Pop ( ) ;
DataObject_New (CLASS_CLONE, 0, name, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ;
}
void
CSL_DObject_New ( )
{
// clone DObject -- create an object with DObject as it's prototype (but not necessarily as it's namespace)
DataObject_New (DOBJECT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ;
}
Namespace *
CSL_Type_New ( )
{
byte * name ;
Namespace * ns = 0 ;
CSL_Token ( ) ;
name = ( byte* ) DataStack_Pop ( ) ;
if ( ( String_Equal ( "struct", name ) ) || ( String_Equal ( "class", name ) ) )
{
CSL_Token ( ) ;
name = ( byte* ) DataStack_Pop ( ) ;
}
ns = DataObject_New (C_TYPE, 0, name, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ;
return ns ;
}
int64
Type_Create ()
{
int64 size = 0 ;
byte * token = Lexer_ReadToken ( _Lexer_ ) ; //
if ( token [ 0 ] == '{' ) size = CSL_Parse_Typedef_Field (0, 0) ; //Namespace_ActivateAsPrimary ( ( byte* ) "C_Typedef" ) ;
return size ;
}
void
CSL_Typedef ( )
{
DataObject_New (C_TYPEDEF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 ) ; //--> _CSL_TypeDef ( ) ;
}
|
/* _priv/value.h -- This file is part of ooduck
*
* Copyright (C) 2015 David Delassus <david.jose.delassus@gmail.com>
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef __OODUCK_VALUE_PRIV_H
# error "Can't include private section"
#endif
/* declarations */
static void *Value_constructor (void *_self, va_list *app);
static void *Value_destructor (void *_self);
static bool Value_equal (const void *_self, const void *_other);
static void Value_get (const void *_self, void *dest, size_t size);
static void Value_set (void *_self, void *src, size_t size);
|
#ifndef COMMAND__1__H
#define COMMAND__1__H
#include "AbstractCommand.hpp"
class Data1;
/**
* A concrete Command using Data1 facade (mix of Mediator1 and Mediator2)
**/
class Command1 : public AbstractCommandBase<Command1>{
public:
explicit Command1(AbstractData *d=0, AbstractCommand * n=0);
virtual ~Command1();
virtual bool _Execute();
};
template<>
struct TraitCommandId<Command1>{
static CommandType Id(){return "command1";}
};
#endif // COMMAND__1__H
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@interface DocSetIndexDocument : NSObject
{
const void *_searchDocument;
}
+ (id)searchDocumentWithScheme:(id)arg1 parent:(id)arg2 name:(id)arg3;
+ (id)searchDocumentWithURL:(id)arg1;
- (void *)documentRef;
- (id)parent;
- (id)name;
- (id)schemeName;
- (id)URL;
- (void)dealloc;
- (id)initWithScheme:(id)arg1 parent:(id)arg2 name:(id)arg3;
- (id)initWithURL:(id)arg1;
- (id)initWithSKDocumentRef:(void *)arg1;
@end
|
//
// Cart.h
// Maishoku
//
// Created by Jonathan Sweemer on 11/23/11.
// Copyright (c) 2011 Dynaptico LLC. All rights reserved.
//
#import "Item.h"
#import "Option.h"
#import "Topping.h"
#import "Position.h"
#import <Foundation/Foundation.h>
@interface Cart : NSObject
+ (void)setInstructions:(NSString *)instructions;
+ (NSString *)instructions;
+ (void)addPosition:(Position *)position;
+ (void)removePosition:(Position *)position;
+ (void)clear;
+ (NSArray *)allPositions;
+ (NSInteger)size;
@end
|
#ifndef __SocketSession_H__
#define __SocketSession_H__
#include "dynamicpoolex.h"
#include "ifnet.h"
#include <set>
#include <list>
#include <deque>
class BinaryDataHeader : public IFxDataHeader
{
public:
BinaryDataHeader();
virtual ~BinaryDataHeader();
virtual unsigned int GetHeaderLength(){ return sizeof(m_dataRecvBuffer); } // 消息头长度
virtual void* GetPkgHeader();
virtual void* BuildSendPkgHeader(unsigned int& dwHeaderLen, unsigned int dwDataLen);
virtual bool BuildRecvPkgHeader(char* pBuff, unsigned int dwLen, unsigned int dwOffset);
virtual int __CheckPkgHeader(const char* pBuf);
private:
// // 消息头 为网络字节序
char m_dataRecvBuffer[8];
char m_dataSendBuffer[8];
static const unsigned int s_dwMagic = 'T' << 24 | 'E' << 16 | 'S' << 8 | 'T';
//static const UINT32 s_dwMagic = 12345678;
};
class WebSocketDataHeader : public IFxDataHeader
{
public:
WebSocketDataHeader();
virtual ~WebSocketDataHeader();
virtual unsigned int GetHeaderLength() { return m_dwHeaderLength; } // 消息头长度 这个只能BuildRecvPkgHeader之后调用
virtual void* GetPkgHeader();
virtual void* BuildSendPkgHeader(unsigned int& dwHeaderLen, unsigned int dwDataLen);
virtual bool BuildRecvPkgHeader(char* pBuff, unsigned int dwLen, unsigned int dwOffset);
virtual int __CheckPkgHeader(const char* pBuf);
virtual int ParsePacket(const char* pBuf, unsigned int dwLen);
private:
/************************/
/* 0x0 附加数据帧 */
/* 0x1 文本 */
/* 0x2 二进制 */
/* 0x3-7 保留 */
/* 0x8 关闭 */
/* 0x9 ping */
/* 0xA pong */
/* 0xB-F 保留 */
/************************/
unsigned char m_btOpCode;
unsigned char m_btFin;
unsigned char m_btMask;
unsigned long long m_qwPayloadLen;
unsigned char m_btMaskingKey[4];
private:
// // 消息头 为网络字节序
char m_dataRecvBuffer[16];
char m_dataSendBuffer[16];
static const unsigned int s_dwMagic = 'T' << 24 | 'E' << 16 | 'S' << 8 | 'T';
unsigned int m_dwHeaderLength;
//static const UINT32 s_dwMagic = 12345678;
};
#endif // !__SocketSession_H__
|
#ifndef BFBCOINFIELD_H
#define BFBCOINFIELD_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QDoubleSpinBox;
class QValueComboBox;
QT_END_NAMESPACE
/** Widget for entering bitcoin amounts.
*/
class BitcoinAmountField: public QWidget
{
Q_OBJECT
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
public:
explicit BitcoinAmountField(QWidget *parent = 0);
qint64 value(bool *valid=0) const;
void setValue(qint64 value);
/** Mark current value as invalid in UI. */
void setValid(bool valid);
/** Perform input validation, mark field as invalid if entered value is not valid. */
bool validate();
/** Change unit used to display amount. */
void setDisplayUnit(int unit);
/** Make field empty and ready for new input. */
void clear();
/** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
in these cases we have to set it up manually.
*/
QWidget *setupTabChain(QWidget *prev);
signals:
void textChanged();
protected:
/** Intercept focus-in event and ',' key presses */
bool eventFilter(QObject *object, QEvent *event);
private:
QDoubleSpinBox *amount;
QValueComboBox *unit;
int currentUnit;
void setText(const QString &text);
QString text() const;
private slots:
void unitChanged(int idx);
};
#endif // BFBCOINFIELD_H
|
//
// AppDelegate.h
// PaperCitekeyHandler
//
// Created by Plantagenet on 21/03/13.
// Copyright (c) 2013 Plantagenet. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
|
/*
* Copyright (C) 2013-2020 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* This code is a complete clean re-write of the stress tool by
* Colin Ian King <colin.king@canonical.com> and attempts to be
* backwardly compatible with the stress tool by Amos Waterland
* <apw@rossby.metr.ou.edu> but has more stress tests and more
* functionality.
*
*/
#include "stress-ng.h"
static const stress_help_t help[] = {
{ NULL, "dir N", "start N directory thrashing stressors" },
{ NULL, "dir-ops N", "stop after N directory bogo operations" },
{ NULL, "dir-dirs N", "select number of directories to exercise dir on" },
{ NULL, NULL, NULL }
};
/*
* stress_set_dir_dirs()
* set number of dir directories from given option string
*/
static int stress_set_dir_dirs(const char *opt)
{
uint64_t dir_dirs;
dir_dirs = stress_get_uint64(opt);
stress_check_range("dir-dirs", dir_dirs,
MIN_DIR_DIRS, MAX_DIR_DIRS);
return stress_set_setting("dir-dirs", TYPE_ID_UINT64, &dir_dirs);
}
#if defined(__DragonFly__)
#define d_reclen d_namlen
#endif
/*
* stress_dir_sync()
* attempt to sync a directory
*/
static void stress_dir_sync(const char *path)
{
#if defined(O_DIRECTORY)
int fd;
fd = open(path, O_RDONLY | O_DIRECTORY);
if (fd < 0)
return;
/*
* The interesting part of fsync is that in
* theory we can fsync a read only file and
* this could be a directory too. So try and
* sync.
*/
(void)shim_fsync(fd);
(void)close(fd);
#else
(void)path;
#endif
}
/*
* stress_dir_read()
* read all dentries
*/
static void stress_dir_read(
const stress_args_t *args,
const char *path)
{
DIR *dp;
struct dirent *de;
dp = opendir(path);
if (!dp)
return;
while ((de = readdir(dp)) != NULL) {
if (de->d_reclen == 0) {
pr_fail("%s: read a zero sized directory entry\n", args->name);
break;
}
}
(void)closedir(dp);
}
/*
* stress_dir_tidy()
* remove all dentries
*/
static void stress_dir_tidy(
const stress_args_t *args,
const uint64_t n)
{
uint64_t i;
for (i = 0; i < n; i++) {
char path[PATH_MAX];
uint64_t gray_code = (i >> 1) ^ i;
(void)stress_temp_filename_args(args,
path, sizeof(path), gray_code);
(void)rmdir(path);
}
}
/*
* stress_dir
* stress directory mkdir and rmdir
*/
static int stress_dir(const stress_args_t *args)
{
int ret;
uint64_t dir_dirs = DEFAULT_DIR_DIRS;
char pathname[PATH_MAX];
stress_temp_dir(pathname, sizeof(pathname), args->name, args->pid, args->instance);
(void)stress_get_setting("dir-dirs", &dir_dirs);
ret = stress_temp_dir_mk_args(args);
if (ret < 0)
return exit_status(-ret);
do {
uint64_t i, n = dir_dirs;
for (i = 0; i < n; i++) {
char path[PATH_MAX];
uint64_t gray_code = (i >> 1) ^ i;
(void)stress_temp_filename_args(args,
path, sizeof(path), gray_code);
if (mkdir(path, S_IRUSR | S_IWUSR) < 0) {
if ((errno != ENOSPC) && (errno != ENOMEM)) {
pr_fail_err("mkdir");
n = i;
break;
}
}
if (!keep_stressing())
goto abort;
inc_counter(args);
}
stress_dir_sync(pathname);
stress_dir_read(args, pathname);
stress_dir_tidy(args, n);
stress_dir_sync(pathname);
if (!keep_stressing_flag())
break;
(void)sync();
} while (keep_stressing());
abort:
/* force unlink of all files */
pr_tidy("%s: removing %" PRIu64 " directories\n",
args->name, dir_dirs);
stress_dir_tidy(args, dir_dirs);
(void)stress_temp_dir_rm_args(args);
return ret;
}
static const stress_opt_set_func_t opt_set_funcs[] = {
{ OPT_dir_dirs, stress_set_dir_dirs },
{ 0, NULL }
};
stressor_info_t stress_dir_info = {
.stressor = stress_dir,
.class = CLASS_FILESYSTEM | CLASS_OS,
.opt_set_funcs = opt_set_funcs,
.help = help
};
|
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#define GPIOBASE 0x80840000
#define PADR 0
#define PADDR (0x10 / sizeof(unsigned int))
#define PHDR (0x40 / sizeof(unsigned int))
#define PHDDR (0x44 / sizeof(unsigned int))
// These delay values are calibrated for the EP9301
// CPU running at 166 Mhz, but should work also at 200 Mhz
#define SETUP 15
#define PULSE 36
#define HOLD 22
#define COUNTDOWN(x) asm volatile ( \
"1:\n"\
"subs %1, %1, #1;\n"\
"bne 1b;\n"\
: "=r" ((x)) : "r" ((x)) \
);
//#define COUNTDOWN(x)
volatile unsigned int *gpio;
volatile unsigned int *phdr;
volatile unsigned int *phddr;
volatile unsigned int *padr;
volatile unsigned int *paddr;
void command(unsigned int);
void writechars(const char *);
unsigned int lcdwait(void);
void lcdinit(void);
/* This program takes lines from stdin and prints them to the
* 2 line LCD connected to the TS-7200 LCD header. e.g
*
* echo "hello world" | lcdmesg
*
* It may need to be tweaked for different size displays
*/
int main(int argc, char **argv) {
int i = 0;
lcdinit();
if (argc == 2) {
writechars(argv[1]);
}
if (argc > 2) {
lcdwait();
command(0xa8); // set DDRAM addr to second row
writechars(argv[2]);
}
if (argc >= 2) return 0;
while(!feof(stdin)) {
char buf[512];
lcdwait();
if (i) {
// XXX: this seek addr may be different for different
// LCD sizes! -JO
command(0xa8); // set DDRAM addr to second row
} else {
command(0x2); // return home
}
i = i ^ 0x1;
if (fgets(buf, sizeof(buf), stdin) != NULL) {
unsigned int len;
buf[0x27] = 0;
len = strlen(buf);
if (buf[len - 1] == '\n') buf[len - 1] = 0;
writechars(buf);
}
}
return 0;
}
void lcdinit(void) {
int fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd == -1)
{
perror("/dev/mem");
return;
}
gpio = (unsigned int *)mmap(0, getpagesize(),
PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIOBASE);
phdr = &gpio[PHDR];
padr = &gpio[PADR];
paddr = &gpio[PADDR];
phddr = &gpio[PHDDR];
*paddr = 0x0; // All of port A to inputs
*phddr |= 0x38; // bits 3:5 of port H to outputs
*phdr &= ~0x18; // de-assert EN, de-assert RS
usleep(15000);
command(0x38); // two rows, 5x7, 8 bit
usleep(4100);
command(0x38); // two rows, 5x7, 8 bit
usleep(100);
command(0x38); // two rows, 5x7, 8 bit
command(0x6); // cursor increment mode
lcdwait();
command(0x1); // clear display
lcdwait();
command(0xc); // display on, blink off, cursor off
lcdwait();
command(0x2); // return home
}
unsigned int lcdwait(void) {
int i, dat, tries = 0;
unsigned int ctrl = *phdr;
*paddr = 0x0; // set port A to inputs
ctrl = *phdr;
do {
// step 1, apply RS & WR
ctrl |= 0x30; // de-assert WR
ctrl &= ~0x10; // de-assert RS
*phdr = ctrl;
// step 2, wait
i = SETUP;
COUNTDOWN(i);
// step 3, assert EN
ctrl |= 0x8;
*phdr = ctrl;
// step 4, wait
i = PULSE;
COUNTDOWN(i);
// step 5, de-assert EN, read result
dat = *padr;
ctrl &= ~0x8; // de-assert EN
*phdr = ctrl;
// step 6, wait
i = HOLD;
COUNTDOWN(i);
} while (dat & 0x80 && tries++ < 1000);
return dat;
}
void command(unsigned int cmd) {
int i;
unsigned int ctrl = *phdr;
*paddr = 0xff; // set port A to outputs
// step 1, apply RS & WR, send data
*padr = cmd;
ctrl &= ~0x30; // de-assert RS, assert WR
*phdr = ctrl;
// step 2, wait
i = SETUP;
COUNTDOWN(i);
// step 3, assert EN
ctrl |= 0x8;
*phdr = ctrl;
// step 4, wait
i = PULSE;
COUNTDOWN(i);
// step 5, de-assert EN
ctrl &= ~0x8; // de-assert EN
*phdr = ctrl;
// step 6, wait
i = HOLD;
COUNTDOWN(i);
}
void writechars(const char *dat) {
int i;
unsigned int ctrl = *phdr;
do {
lcdwait();
*paddr = 0xff; // set port A to outputs
// step 1, apply RS & WR, send data
*padr = *dat++;
ctrl |= 0x10; // assert RS
ctrl &= ~0x20; // assert WR
*phdr = ctrl;
// step 2
i = SETUP;
COUNTDOWN(i);
// step 3, assert EN
ctrl |= 0x8;
*phdr = ctrl;
// step 4, wait 800 nS
i = PULSE;
COUNTDOWN(i);
// step 5, de-assert EN
ctrl &= ~0x8; // de-assert EN
*phdr = ctrl;
// step 6, wait
i = HOLD;
COUNTDOWN(i);
} while(*dat);
}
|
/** \file ignorecase.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "physfs.h"
#include "ignorecase.h"
/**
* Please see ignorecase.h for details.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE in the root of the source tree.
*
* \author Ryan C. Gordon.
*/
/* I'm not screwing around with stricmp vs. strcasecmp... */
static int caseInsensitiveStringCompare(const char *x, const char *y)
{
int ux, uy;
do
{
ux = toupper((int) *x);
uy = toupper((int) *y);
if (ux != uy)
return((ux > uy) ? 1 : -1);
x++;
y++;
} while ((ux) && (uy));
return(0);
} /* caseInsensitiveStringCompare */
static int locateOneElement(char *buf)
{
char *ptr;
char **rc;
char **i;
if (PHYSFS_exists(buf))
return(1); /* quick rejection: exists in current case. */
ptr = strrchr(buf, '/'); /* find entry at end of path. */
if (ptr == NULL)
{
rc = PHYSFS_enumerateFiles("/");
ptr = buf;
} /* if */
else
{
*ptr = '\0';
rc = PHYSFS_enumerateFiles(buf);
*ptr = '/';
ptr++; /* point past dirsep to entry itself. */
} /* else */
for (i = rc; *i != NULL; i++)
{
if (caseInsensitiveStringCompare(*i, ptr) == 0)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return(1);
} /* if */
} /* for */
/* no match at all... */
PHYSFS_freeList(rc);
return(0);
} /* locateOneElement */
int PHYSFSEXT_locateCorrectCase(char *buf)
{
int rc;
char *ptr;
char *prevptr;
while (*buf == '/') /* skip any '/' at start of string... */
buf++;
ptr = prevptr = buf;
if (*ptr == '\0')
return(0); /* Uh...I guess that's success. */
while (ptr = strchr(ptr + 1, '/'))
{
*ptr = '\0'; /* block this path section off */
rc = locateOneElement(buf);
*ptr = '/'; /* restore path separator */
if (!rc)
return(-2); /* missing element in path. */
} /* while */
/* check final element... */
return(locateOneElement(buf) ? 0 : -1);
} /* PHYSFSEXT_locateCorrectCase */
#ifdef TEST_PHYSFSEXT_LOCATECORRECTCASE
int main(int argc, char **argv)
{
int rc;
char buf[128];
PHYSFS_file *f;
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
return(1);
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
if (!PHYSFS_setWriteDir("."))
{
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
if (!PHYSFS_mkdir("/a/b/c"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
if (!PHYSFS_mkdir("/a/b/C"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
f = PHYSFS_openWrite("/a/b/c/x.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
f = PHYSFS_openWrite("/a/b/C/X.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
PHYSFS_deinit();
return(1);
} /* if */
strcpy(buf, "/a/b/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 1 failed\n");
strcpy(buf, "/a/B/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 2 failed\n");
strcpy(buf, "/a/b/C/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/C/X.txt") != 0))
printf("test 3 failed\n");
strcpy(buf, "/a/b/c/X.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 4 failed\n");
strcpy(buf, "/a/b/c/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -1) || (strcmp(buf, "/a/b/c/z.txt") != 0))
printf("test 5 failed\n");
strcpy(buf, "/A/B/Z/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -2) || (strcmp(buf, "/a/b/Z/z.txt") != 0))
printf("test 6 failed\n");
printf("Testing completed.\n");
printf(" If no errors were reported, you're good to go.\n");
PHYSFS_delete("/a/b/c/x.txt");
PHYSFS_delete("/a/b/C/X.txt");
PHYSFS_delete("/a/b/c");
PHYSFS_delete("/a/b/C");
PHYSFS_delete("/a/b");
PHYSFS_delete("/a");
PHYSFS_deinit();
return(0);
} /* main */
#endif
/* end of ignorecase.c ... */
|
#include <stdlib.h>
#include <inttypes.h>
#include <unistd.h>
#include <ncurses.h>
#include <time.h>
#include <string.h>
#include "packet.h"
#include "list.h"
#include "devices.h"
#include "colors.h"
const char *serialPort = "/dev/ttyUSB0";
static bool running;
int init_ncurses();
void close_ncurses();
void update_ncurses(int ch);
int main(int argc, char *argv[])
{
running = true;
int ch;
if(init_packet(serialPort) != 0) return -1;
if(init_ncurses() != 0) return -1;
if(init_list(0, LINES / 2) != 0) return -1;
if(init_devices(LINES / 2 + 1, LINES / 2) != 0) return -1;
while(running) {
ch = getch();
update_packet(ch);
update_ncurses(ch);
update_list(ch);
//TODO: Add help somewhere
}
close_list();
close_ncurses();
close_packet();
return 0;
}
void update_ncurses(int ch) {
if(ch == 'q' || ch == 'Q') {
running = false;
}
}
int init_ncurses() {
initscr();
start_color();
cbreak();
keypad(stdscr, TRUE);
noecho();
curs_set(0);
refresh();
timeout(0);
init_pair(COLOR_HEADER, COLOR_BLACK, COLOR_CYAN);
return 0;
}
void close_ncurses() {
endwin();
} |
/* Kaleidoscope - Firmware for computer input devices
* Copyright (C) 2013-2018 Keyboard.io, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Arduino.h>
//end of add your includes here
#ifdef __cplusplus
extern "C" {
#endif
void loop();
void setup();
#ifdef __cplusplus
} // extern "C"
#endif
//add your function definitions for the project KeyboardIO here
#define TS(X) //Serial.print(micros() );Serial.print("\t");Serial.println(X);
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include "kaleidoscope/version.h"
#include "kaleidoscope/device/device.h"
#include "kaleidoscope/device/key_indexes.h"
#include "kaleidoscope_internal/device.h"
#include "kaleidoscope_internal/deprecations.h"
#include "kaleidoscope/hid.h"
static constexpr DEPRECATED(KEYBOARDHARDWARE) kaleidoscope::Device &KeyboardHardware = kaleidoscope_internal::device;
#ifdef PER_KEY_DATA_STACKED
#define KEYMAP_STACKED(...) { PER_KEY_DATA_STACKED(XXX, __VA_ARGS__) }
#endif
#ifdef PER_KEY_DATA
#define KEYMAP(...) { PER_KEY_DATA(XXX, __VA_ARGS__) }
#endif
static constexpr DEPRECATED(ROWS) uint8_t ROWS = kaleidoscope_internal::device.matrix_rows;
static constexpr DEPRECATED(COLS) uint8_t COLS = kaleidoscope_internal::device.matrix_columns;
static constexpr DEPRECATED(LED_COUNT) uint8_t LED_COUNT = kaleidoscope_internal::device.led_count;
#include "kaleidoscope/KeyAddr.h"
#include "kaleidoscope/key_events.h"
#include "kaleidoscope/layers.h"
#include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h"
#include "kaleidoscope/macro_map.h"
#include "kaleidoscope_internal/event_dispatch.h"
#include "kaleidoscope_internal/LEDModeManager.h"
#include "kaleidoscope/macro_helpers.h"
#include "kaleidoscope/plugin.h"
#include "kaleidoscope/Runtime.h"
#define HOOK_MAX 64
#ifndef VERSION
#define VERSION "locally-built"
#endif
/** Kaleidoscope API (major) version.
*
* The API is guaranteed to be backwards compatible for the entire duration of a
* major version. However, breaking changes may come, and result in a major
* version bump. To help migration, the `KALEIDOSCOPE_API_VERSION` macro can be
* used to check the major version provided by the Kaleidoscope we are compiling
* against. This can be used to error out with a helpful message, or change how
* the API is used - it is entirely up to the plugin or sketch author. The point
* of this macro is to let them easily check the version.
*/
#define KALEIDOSCOPE_API_VERSION 2
/** Required Kaleidoscope major version.
*
* For the sake of convenience, defining `KALEIDOSCOPE_REQUIRED_API_VERSION`
* before including `Kaleidoscope.h` itself will result in comparing its value
* to `KALEIDOSCOPE_API_VERSION`. If they differ, a helpful error message is
* printed.
*
* Done so that a new API version would result in a helpful error message,
* instead of cryptic compile errors.
*/
#if defined(KALEIDOSCOPE_REQUIRED_API_VERSION) && (KALEIDOSCOPE_REQUIRED_API_VERSION != KALEIDOSCOPE_API_VERSION)
#define xstr(a) str(a)
#define str(a) #a
static_assert(KALEIDOSCOPE_REQUIRED_API_VERSION == KALEIDOSCOPE_API_VERSION,
"Kaleidoscope API version mismatch! We have version " xstr(KALEIDOSCOPE_API_VERSION)
" available, but version " xstr(KALEIDOSCOPE_REQUIRED_API_VERSION) " is required.");
#endif
// Use this function macro to register plugins with Kaleidoscope's
// hooking system. The macro accepts a list of plugin instances that
// must have been instantiated at global scope.
//
#define KALEIDOSCOPE_INIT_PLUGINS(...) _KALEIDOSCOPE_INIT_PLUGINS(__VA_ARGS__)
// For compatibility reasons we export class Runtime_ as Kaleidoscope_
// in global namespace.
//
DEPRECATED(GLOBAL_TYPENAME_KALEIDOSCOPE)
typedef kaleidoscope::Runtime_ Kaleidoscope_;
// For compatibility/usability reasons we enable the global variable
// Kaleidoscope in global namespace.
//
extern kaleidoscope::Runtime_ &Kaleidoscope;
|
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_TARGETEDMOVEMENTGENERATOR_H
#define TRINITY_TARGETEDMOVEMENTGENERATOR_H
#include "MovementGenerator.h"
#include "FollowerReference.h"
#include "Timer.h"
#include "Unit.h"
#include "PathGenerator.h"
class TargetedMovementGeneratorBase
{
public:
TargetedMovementGeneratorBase(Unit* target) { i_target.link(target, this); }
void stopFollowing() { }
protected:
FollowerReference i_target;
};
template<class T, typename D>
class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
{
protected:
TargetedMovementGeneratorMedium(Unit* target, float offset, float angle) :
TargetedMovementGeneratorBase(target), i_path(NULL),
i_recheckDistance(0), i_offset(offset), i_angle(angle),
i_recalculateTravel(false), i_targetReached(false) { }
~TargetedMovementGeneratorMedium() { delete i_path; }
public:
bool DoUpdate(T*, uint32);
Unit* GetTarget() const { return i_target.getTarget(); }
void unitSpeedChanged() { i_recalculateTravel = true; }
bool IsReachable() const { return (i_path) ? (i_path->GetPathType() & PATHFIND_NORMAL) : true; }
protected:
void _setTargetLocation(T* owner, bool updateDestination);
PathGenerator* i_path;
TimeTrackerSmall i_recheckDistance;
float i_offset;
float i_angle;
bool i_recalculateTravel : 1;
bool i_targetReached : 1;
};
template<class T>
class ChaseMovementGenerator : public TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >
{
public:
ChaseMovementGenerator(Unit* target)
: TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >(target) { }
ChaseMovementGenerator(Unit* target, float offset, float angle)
: TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >(target, offset, angle) { }
~ChaseMovementGenerator() { }
MovementGeneratorType GetMovementGeneratorType() { return CHASE_MOTION_TYPE; }
void DoInitialize(T*);
void DoFinalize(T*);
void DoReset(T*);
void MovementInform(T*);
static void _clearUnitStateMove(T* u) { u->ClearUnitState(UNIT_STATE_CHASE_MOVE); }
static void _addUnitStateMove(T* u) { u->AddUnitState(UNIT_STATE_CHASE_MOVE); }
bool EnableWalking() const { return false;}
bool _lostTarget(T* u) const { return u->GetVictim() != this->GetTarget(); }
void _reachTarget(T*);
};
template<class T>
class FollowMovementGenerator : public TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >
{
public:
FollowMovementGenerator(Unit* target)
: TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >(target){ }
FollowMovementGenerator(Unit* target, float offset, float angle)
: TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >(target, offset, angle) { }
~FollowMovementGenerator() { }
MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; }
void DoInitialize(T*);
void DoFinalize(T*);
void DoReset(T*);
void MovementInform(T*);
static void _clearUnitStateMove(T* u) { u->ClearUnitState(UNIT_STATE_FOLLOW_MOVE); }
static void _addUnitStateMove(T* u) { u->AddUnitState(UNIT_STATE_FOLLOW_MOVE); }
bool EnableWalking() const;
bool _lostTarget(T*) const { return false; }
void _reachTarget(T*) { }
private:
void _updateSpeed(T* owner);
};
#endif
|
#ifndef TestState_h__
#define TestState_h__
#include <string>
#include "StatefullTcpServer.h"
#include "../ClientInfo.h"
using namespace std;
class TestState
{
private:
string name;
public:
TestState();
virtual ~TestState();
string getName();
void setName(string name);
};
#endif // TestState_h__
|
/*
* board.h
*
* Created on: Jul 8, 2013
* Author: Administrator
*/
#ifndef BOARD_H_
#define BOARD_H_
void board_init(void);
#endif /* BOARD_H_ */
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* NAME
* pipe08.c
*
* DESCRIPTION
* Check that a SIGPIPE signal is generated when a write is
* attempted on an empty pipe.
*
* ALGORITHM
* 1. Write to a pipe after closing the read side.
* 2. Check for the signal SIGPIPE to be received.
*
* USAGE: <for command-line>
* pipe08 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -f : Turn off functionality Testing.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* USAGE
* pipe08
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS
* None
*/
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include "test.h"
#include "usctest.h"
char *TCID = "pipe08";
int TST_TOTAL = 1;
void setup(void);
void cleanup(void);
void sighandler(int);
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
int pipefd[2]; /* fds for pipe read/write */
char wrbuf[BUFSIZ];
int written, length;
int close_stat; /* exit status of close(read fd) */
/* parse standard options */
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
if (!STD_FUNCTIONAL_TEST) {
tst_resm(TWARN, "-f option should not be used");
}
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
TEST(pipe(pipefd));
if (TEST_RETURN != 0) {
tst_resm(TFAIL, "call failed unexpectedly");
continue;
}
if ((close_stat = close(pipefd[0])) == -1) {
tst_brkm(TBROK, cleanup, "close of read side failed");
}
strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz\0");
length = strlen(wrbuf);
/*
* the SIGPIPE signal will be caught here or else
* the program will dump core when the signal is
* sent
*/
written = write(pipefd[1], wrbuf, length);
}
cleanup();
tst_exit();
}
/*
* sighandler - catch signals and look for SIGPIPE
*/
void sighandler(int sig)
{
if (sig != SIGPIPE)
tst_resm(TFAIL, "expected SIGPIPE, got %d", sig);
else
tst_resm(TPASS, "got expected SIGPIPE signal");
}
/*
* setup() - performs all ONE TIME setup for this test.
*/
void setup()
{
tst_sig(NOFORK, sighandler, cleanup);
TEST_PAUSE;
}
/*
* cleanup() - performs all ONE TIME cleanup for this test at
* completion or premature exit.
*/
void cleanup()
{
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
}
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright 2014 Simon Stuerz *
* This file is part of RobotStation. *
* *
* RobotStation is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 2 of the License. *
* *
* RobotStation is distributed in the hope that it will be useful *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RobotStation. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef IMAGEPROCESSOR_H
#define IMAGEPROCESSOR_H
#include <QObject>
#include <QImage>
#include <QTimer>
#include <QDebug>
#include <QList>
#include <QSettings>
#include <QDir>
#include <QMutex>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "poseestimationengine.h"
using namespace cv;
class ImageProcessor : public QObject
{
Q_OBJECT
public:
explicit ImageProcessor(QObject *parent = 0);
Mat convertQImageToMat(QImage image);
QImage convertMatToQimage(Mat imageMat);
void saveCalibrationParameter(Mat intrinsic, Mat extrinsic);
Mat getIntrinsic();
Mat getExtrinsic();
Point2f getOpticalCenter();
QImage image();
private:
QTimer *m_timer;
int m_fps;
QMutex m_imageMutex;
Mat m_image;
Mat m_processedImage;
Mat m_intrinsic;
Mat m_extrinsic;
bool m_calibrated;
int m_processType;
double m_alpha;
double m_beta;
bool m_flipHorizontal;
bool m_flipVertical;
void loadSettings();
private slots:
void processImage();
void updateImage();
signals:
void imageReady(const Mat &image);
void originalImageReady(const Mat &image);
public slots:
void updateProcessType(const int& processType);
void updateBrightness(const double &brightness);
void updateContrast(const double &contrast);
void updateHorizontalFlip(const bool &flip);
void updateVerticalFlip(const bool &flip);
void updateFps(const int &fps);
void startProcessor();
void stopProcessor();
};
#endif // IMAGEPROCESSOR_H
|
/* { dg-do compile } */
/* { dg-options "-O2 -mbitops" } */
int
f (int i)
{
return i & 0x0ffff000;
}
/* { dg-final { scan-assembler "movb\.cl" } } */
|
/*
* X.25 Packet Layer release 002
*
* This is ALPHA test software. This code may break your machine,
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
* This code REQUIRES 2.1.15 or higher
*
* This module:
* This module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* History
* X.25 001 Jonathan Naylor Started coding.
*/
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <net/x25.h>
#ifdef KW_TAINT_ANALYSIS
extern void * get_tainted_stuff();
#endif
LIST_HEAD(x25_route_list);
DEFINE_RWLOCK(x25_route_list_lock);
/*
*/
static int x25_add_route(struct x25_address *address, unsigned int sigdigits,
struct net_device *dev)
{
struct x25_route *rt;
struct list_head *entry;
int rc = -EINVAL;
write_lock_bh(&x25_route_list_lock);
list_for_each(entry, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
if (!memcmp(&rt->address, address, sigdigits) &&
rt->sigdigits == sigdigits)
goto out;
}
rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
rc = -ENOMEM;
if (!rt)
goto out;
strcpy(rt->address.x25_addr, "000000000000000");
memcpy(rt->address.x25_addr, address->x25_addr, sigdigits);
rt->sigdigits = sigdigits;
rt->dev = dev;
atomic_set(&rt->refcnt, 1);
list_add(&rt->node, &x25_route_list);
rc = 0;
out:
write_unlock_bh(&x25_route_list_lock);
return rc;
}
/*
*/
static void __x25_remove_route(struct x25_route *rt)
{
if (rt->node.next) {
list_del(&rt->node);
x25_route_put(rt);
}
}
static int x25_del_route(struct x25_address *address, unsigned int sigdigits,
struct net_device *dev)
{
struct x25_route *rt;
struct list_head *entry;
int rc = -EINVAL;
write_lock_bh(&x25_route_list_lock);
list_for_each(entry, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
if (!memcmp(&rt->address, address, sigdigits) &&
rt->sigdigits == sigdigits && rt->dev == dev) {
__x25_remove_route(rt);
rc = 0;
break;
}
}
write_unlock_bh(&x25_route_list_lock);
return rc;
}
/*
*/
void x25_route_device_down(struct net_device *dev)
{
struct x25_route *rt;
struct list_head *entry, *tmp;
write_lock_bh(&x25_route_list_lock);
list_for_each_safe(entry, tmp, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
if (rt->dev == dev)
__x25_remove_route(rt);
}
write_unlock_bh(&x25_route_list_lock);
/* */
x25_clear_forward_by_dev(dev);
}
/*
*/
struct net_device *x25_dev_get(char *devname)
{
struct net_device *dev = dev_get_by_name(&init_net, devname);
if (dev &&
(!(dev->flags & IFF_UP) || (dev->type != ARPHRD_X25
#if IS_ENABLED(CONFIG_LLC)
&& dev->type != ARPHRD_ETHER
#endif
))){
dev_put(dev);
dev = NULL;
}
return dev;
}
/*
*/
struct x25_route *x25_get_route(struct x25_address *addr)
{
struct x25_route *rt, *use = NULL;
struct list_head *entry;
read_lock_bh(&x25_route_list_lock);
list_for_each(entry, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
if (!memcmp(&rt->address, addr, rt->sigdigits)) {
if (!use)
use = rt;
else if (rt->sigdigits > use->sigdigits)
use = rt;
}
}
if (use)
x25_route_hold(use);
read_unlock_bh(&x25_route_list_lock);
return use;
}
/*
*/
int x25_route_ioctl(unsigned int cmd, void __user *arg_actual)
{
struct x25_route_struct rt;
struct net_device *dev;
int rc = -EINVAL;
#ifdef KW_TAINT_ANALYSIS
void __user *arg = (void __user *)get_tainted_stuff();
#else
void __user *arg = arg_actual;
#endif
if (cmd != SIOCADDRT && cmd != SIOCDELRT)
goto out;
rc = -EFAULT;
if (copy_from_user(&rt, arg, sizeof(rt)))
goto out;
rc = -EINVAL;
if (rt.sigdigits > 15)
goto out;
dev = x25_dev_get(rt.device);
if (!dev)
goto out;
if (cmd == SIOCADDRT)
rc = x25_add_route(&rt.address, rt.sigdigits, dev);
else
rc = x25_del_route(&rt.address, rt.sigdigits, dev);
dev_put(dev);
out:
return rc;
}
/*
*/
void __exit x25_route_free(void)
{
struct x25_route *rt;
struct list_head *entry, *tmp;
write_lock_bh(&x25_route_list_lock);
list_for_each_safe(entry, tmp, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
__x25_remove_route(rt);
}
write_unlock_bh(&x25_route_list_lock);
}
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include "i82801dx.h"
static void usb_init(struct device *dev)
{
printk(BIOS_DEBUG, "USB: Setting up controller.. ");
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
printk(BIOS_DEBUG, "done.\n");
}
static struct device_operations usb_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = usb_init,
.enable = i82801dx_enable,
};
/* 82801DB/DBL/DBM USB1 */
static const struct pci_driver usb_driver_1 __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VID_INTEL,
.device = PCI_DID_INTEL_82801DB_USB1,
};
/* 82801DB/DBL/DBM USB2 */
static const struct pci_driver usb_driver_2 __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VID_INTEL,
.device = PCI_DID_INTEL_82801DB_USB2,
};
/* 82801DB/DBL/DBM USB3 */
static const struct pci_driver usb_driver_3 __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VID_INTEL,
.device = PCI_DID_INTEL_82801DB_USB3,
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.