text stringlengths 4 6.14k |
|---|
//
// FCOverlayViewController.h
//
// Created by Almer Lucke on 10/11/13.
// Copyright (c) 2013 Farcoding. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* In-between view controller to allow animating the presentation of the actual view controller to be presented.
* This class also makes sure the new window will not be deallocated until the presented view controller is dismissed.
* All auto rotation methods are forwarded to the presented view controller to allow the presented view controller
* to decide which rotations are allowed
*/
@interface FCOverlayViewController : UIViewController
/**
* This method should never be called by any other class then the FCOverlay class.
*
* @param newWindow the new key and visible window
* @param viewController the view controller to be presented
* @param animated animate the presentation or not
* @param queued was queued or not
* @param completion called when the presentation is finished
*
* @return In-between FCOverlayViewController instance
*/
- (instancetype)initWithWindow:(UIWindow *)window
viewController:(UIViewController *)viewController
animated:(BOOL)animated
queued:(BOOL)queued
completion:(void (^)(void))completion;
- (instancetype)initWithWindow:(UIWindow *)window
fromWindow:(UIWindow *)fromWindow
viewController:(UIViewController *)viewController
animated:(BOOL)animated
queued:(BOOL)queued
completion:(void (^)(void))completion;
@end
|
/**
* SensirionSHT is an Arduino library that provides easy, non-blocking access to
* Sensirion SHT1x temperature and humidity sensors (and compatible).
*
* @author sekdiy (https://github.com/sekdiy/SensirionSHT)
* @date 02.07.2015
* @version See git comments for changes.
*/
#ifndef SENSIRIONSHT_H
#define SENSIRIONSHT_H
#include <math.h>
#include <Sensirion.h> // http://playground.arduino.cc/Code/Sensirion
class SensirionSHT: public Sensirion {
public:
SensirionSHT(unsigned int dataPin, //!< Arduino pin that the sensor's data line is connected to.
unsigned int clockPin, //!< Arduino pin that the sensor's clock line is connected to.
float period = 3.0f //!< Measurement period (in seconds), since the sensor needs time to aquire a value.
); //!< Initializes instance attributes, enforcing a lower limit to the period duration.
bool hasTemperature(); //!< Checks for errors or invalid temperature measurement value. @return True iff a valid temperature result is available
bool hasHumidity(); //!< Checks for errors or invalid humidity measurement value. @return True iff a valid humidity result is available
bool hasDewpoint(); //!< Checks for errors or invalid dew point measurement value. @return True iff a valid dew point result is available
bool isOutdated(); //!< Checks for errors or outdated results. @return False iff a valid new measurement result arrived within the most recent tick period.
float getTemperature(); //!< Returns the current temperature value, only sensible if hasTemperature() returns true.
float getHumidity(); //!< Returns the current humidity value, only sensible if hasHumidity() returns true.
float getDewpoint(); //!< Returns the current dew point value, only sensible if hasTemperature() and hasHumidity() return true.
unsigned int getError(); //!< Returns the error from the last measurement (according to the definitions in the Sensirion library).
/** The tick() method does the actual work.
* A measurement cycle consists of an initial temperature measurement and a followup humidity measurement.
* For timing and accuracy information please see the documentation of your sensor.
*
* Once a period is completed, a new measurement cycle is started.
* As soon as a measurement result is available, the temperature value is stored and the humidity value is requested.
* Once the humidity value becomes available and has been stored too, the values are marked as fresh and we're ready for the next cycle.
*
* Call this method periodically and always provide the tick duration (time elapsed since the last call).
*
* @param duration The duration of the current tick period (in seconds).
* @return An error value according to the definitions in the Sensirion library (i.e. 0 on succes).
*/
unsigned int tick(float duration);
protected:
bool _fresh = false; //!< Are fresh results in?
bool _ready = false; //!< Is measurement currently running?
float _period; //!< Waiting period inbetween measurements
float _duration; //!< Time waited during current period
float _temperature = NAN; //!< Calculated temperature
float _humidity = NAN; //!< Calculated humidity
unsigned int _mode; //!< Measurement mode (TEMP or HUMI)
unsigned int _data; //!< Raw measurement result
unsigned int _error; //!< Most recent error
};
#endif // SENSIRIONSHT_H
|
//
// Created by Daniel Marchese on 9/1/15.
//
#ifndef EMULATORCORE_MMIOREGISTERCONTROLLER_H
#define EMULATORCORE_MMIOREGISTERCONTROLLER_H
#include "../../Common.h"
#include "MemoryController.h"
class MMIORegisterController : public MemoryController {
private:
uint8_t _interruptRegister;
uint8_t _interruptEnableRegister;
public:
MMIORegisterController(MemoryMap *map);
uint8_t read(uint16_t addr);
void write(uint16_t addr, uint8_t value);
void reset();
};
#endif //EMULATORCORE_MMIOREGISTERCONTROLLER_H
|
#ifndef YFIELDUPDATER
#define YFIELDUPDATER
#include "Visitor.h"
class YFieldUpdater : public Visitor
{
public:
YFieldUpdater();
void visit(SpatialIndexCell *cell);
void visit(TransformGroupNode *node);
};
#endif |
//
// PKObject.h
// PutioKit
//
// Created by orta therox on 29/10/2012.
// Copyright (c) 2012 Ahmet AYGÜN. All rights reserved.
//
@interface PKObject : NSObject
+ (id)objectWithDictionary:(NSDictionary *)dictionary;
- (void)updateObjectWithDictionary:(NSDictionary *)dictionary;
@end
|
//
// AppDelegate.h
// BannerAutoLayout
//
// Created by Erika Washburn on 7/15/15.
// Copyright (c) 2015 ARC. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef __PINCH_TO_CACTUS_H_
#define __PINCH_TO_CACTUS_H_
#include "stCactusGraphs.h"
#include "sonLib.h"
stCactusGraph *getCactusGraphForThreadSet(stPinchThreadSet *threadSet, stCactusNode **startCactusNode,
stList **deadEndComponent, bool attachEndsInFlower, int64_t minLengthForChromosome,
double proportionOfUnalignedBasesForNewChromosome,
bool breakChainsAtReverseTandems, int64_t maximumMedianSpacingBetweenLinkedEnds);
#endif // __PINCH_TO_CACTUS_H_
|
//
// ViewController.h
// T8JSBridge
//
// Created by 琦张 on 16/4/16.
// Copyright © 2016年 T8. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
/*
* 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 TKCapabilitiesManager : NSObject
{
_Bool _isRingtoneStoreAvailable;
_Bool _isToneStoreAvailable;
}
+ (id)sharedCapabilitiesManager;
@property(nonatomic) _Bool isToneStoreAvailable; // @synthesize isToneStoreAvailable=_isToneStoreAvailable;
@property(nonatomic) _Bool isRingtoneStoreAvailable; // @synthesize isRingtoneStoreAvailable=_isRingtoneStoreAvailable;
- (void)_checkRingtoneStoreAvailability;
- (_Bool)hasUserGeneratedVibrationsCapability;
- (_Bool)hasVibratorCapability;
- (_Bool)hasTelephonyCapability;
- (void)dealloc;
- (id)init;
@end
|
//===--------------------------------------------------------------------------------*- C++ -*-===//
// _
// | |
// __| | __ ___ ___ ___
// / _` |/ _` \ \ /\ / / '_ |
// | (_| | (_| |\ V V /| | | |
// \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain
//
//
// This file is distributed under the MIT License (MIT).
// See LICENSE.txt for details.
//
//===------------------------------------------------------------------------------------------===//
#pragma once
#include "dawn/Optimizer/Pass.h"
#include "dawn/Support/Assert.h"
#include <set>
#include <unordered_map>
namespace dawn {
namespace iir {
class Stencil;
class DoMethod;
} // namespace iir
/// @brief PassTemporaryToStencilFunction pass will identify temporaries of a stencil and replace
/// their pre-computations
/// by a stencil function. Each reference to the temporary is later replaced by the stencil function
/// call.
/// * Input: well formed SIR and IIR with the list of mss/stages, temporaries used
/// * Output: modified SIR, new stencil functions are inserted and calls. Temporary fields are
/// removed. New stencil functions instantiations are inserted into the IIR. Statements' accesses
/// are recomputed.
/// @ingroup optimizer
///
/// This pass is not necessary to create legal code and is hence not in the debug-group
class PassIntervalPartitioning : public Pass {
public:
PassIntervalPartitioning() : Pass("PassIntervalPartitioning") {}
/// @brief Pass implementation
bool run(const std::shared_ptr<iir::StencilInstantiation>& stencilInstantiation,
const Options& options = {}) override;
};
} // namespace dawn
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.13.2\Source\Uno\Collections\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#ifndef __APP_UNO_COLLECTIONS_I_ENUMERATOR__FUSE_ANIMATIONS_MIXER_HANDLE_LONG__H__
#define __APP_UNO_COLLECTIONS_I_ENUMERATOR__FUSE_ANIMATIONS_MIXER_HANDLE_LONG__H__
#include <app/Uno.Collections.IEnumerator.h>
#include <app/Uno.IDisposable.h>
#include <app/Uno.Object.h>
#include <Uno.h>
namespace app { namespace Fuse { namespace Animations { struct MixerHandle__long; } } }
namespace app {
namespace Uno {
namespace Collections {
::uInterfaceType* IEnumerator__Fuse_Animations_MixerHandle_long___typeof();
struct IEnumerator__Fuse_Animations_MixerHandle_long_
{
::app::Fuse::Animations::MixerHandle__long*(*__fp_get_Current)(void*);
static ::app::Fuse::Animations::MixerHandle__long* Current(::uObject* __this) { return ((IEnumerator__Fuse_Animations_MixerHandle_long_*)uGetInterfacePtr(__this, IEnumerator__Fuse_Animations_MixerHandle_long___typeof()))->__fp_get_Current((::uByte*)__this + (__this->__obj_type->TypeType == uTypeTypeStruct ? sizeof(::uObject) : 0)); }
};
}}}
#endif
|
#ifndef _SYSTEM_SIDEMENU_H_
#define _SYSTEM_SIDEMENU_H_
#endif
|
//
// 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"
@protocol AVVideoDeviceSessionDelegate <NSObject>
@optional
- (void)onVideoSessionChangeCameraComplete;
- (void)onVideoSessionStopComplete;
- (void)onVideoSessionStartComplete;
@end
|
#ifndef __GAME__TOOL__
#define __GAME__TOOL__
#include "cocos2d.h"
#define PI 3.1415926f
#define InRadians360 6.2831853f
#define InAngle360 360.0f
#define InAngleHalf360 180.0f
namespace TOOL
{
///////////////////////////////////////////////////////////////////////////////
////////////// ×Ö½Ú²Ù×÷º¯Êý //////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//¶ÔnumÖÐÌØ¶¨×Ö½Ú½øÐиü¸Ä
//num ÔªÊý¾Ý
//index ÐèÒª»ñÈ¡µÄλÖÃ
inline int GetBinNum(unsigned int num, int index)
{
return (num >> (index - 1)) & 1;
}
//»ñÈ¡numÖÐÌØ¶¨×Ö½ÚµÄÊý¾Ý
//num ÔªÊý¾Ý
//index ÐèÒª¸ü¸ÄµÄ×Ö½ÚλÖÃ
//flag ¸ü¸ÄµÄÊý¾Ý
inline void SetBinNum(unsigned int& num, int index, int flag)
{
--index;
num = (num&~(1 << index)) | (flag << index);
}
//»ñÈ¡8λ×Ö½ÚÊý¾Ý
//num ÔªÊý¾Ý
//index ÐèÒª»ñÈ¡µÄÊý¾ÝËùÔÚµÄ×é
//numÒÔ8λΪһ×é,¼´Ò»×éΪһ¸ö0x000000FF
inline int GetHexNum(unsigned int num, int index)
{
return (num >> (8 * (index - 1))) & 0x000000FF;
}
//ÉèÖÃ8λ×Ö½ÚÊý¾Ý
//num ÔªÊý¾Ý
//index ÐèÒª»ñÈ¡µÄÊý¾ÝËùÔÚµÄ×é
//flag ¸ü¸ÄµÄÊý¾Ý
//numÒÔ8λΪһ×é,¼´Ò»×éΪһ¸ö0x000000FF
inline void SetHexNum(unsigned int& num, int index, int flag)
{
--index;
num = (num&~(0x000000FF << index)) | (flag << 8 * index);
}
//»ñÈ¡¸ß16λÊý¾Ý
inline int GetHigData(unsigned int num)
{
return num >> 16;
}
//num ÐèÒª¸ü¸ÄµÄÊý¾Ý
//data Ð޸ĵÄÊý¾Ý
//ÉèÖøß16λÊý¾Ý
inline void SetHigData(unsigned int& num, int data)
{
num = (num & 0x0000FFFF) | (data << 16);
}
//num ÐèÒª¸ü¸ÄµÄÊý¾Ý
//data Ð޸ĵÄÊý¾Ý
//ÉèÖõÍ16λÊý¾Ý
inline void SetLowData(unsigned int& num, int data)
{
num = (num & 0xFFFF0000) | (data & 0x0000FFFF);
}
//»ñÈ¡µÍ16λÊý¾Ý
inline int GetLowData(unsigned int num)
{
return num & 0x0000FFFF;
}
//»ñÈ¡ÈÎÒâλÊý×Ö½ÚÊý¾Ý
inline unsigned int GetDataFromSize(unsigned int sor, int size, int begin = 0)
{
unsigned int mask = 0xFFFFFFFF;
mask = ~(mask << size);
mask = mask << begin;
return (sor&mask) >> begin;
}
//ÉèÖÃÈÎÒâλÊý×Ö½ÚÊý¾Ý
inline void SetDataFromSize(unsigned int& sor, unsigned int data, int size, int begin = 0)
{
unsigned int mask = 0xFFFFFFFF;
mask = ~(mask << size);
mask = ~(mask << begin);
sor = sor&mask | ((data << begin)&mask);
}
template <class T>
inline T* GetDataFromFile(char* fileName, int *size)
{
return (T*)(cocos2d::FileUtils::getInstance()->getFileData(fileName, "rb", size));
}
template <class T>
inline void GetDataFromFile(char* fileName, T* data, int size)
{
unsigned char* ch = (unsigned char*)data;
FILE *f = fopen(fileName, "wb");
if (!fp)
break;
fwrite(ch, sizeof(T), size / sizeof(T), fp);
}
//¿¨Âí¿ËµÄ¿ªÆ½·½Ëã·¨
inline float kamake_sqr(float number)
{
long i;
float x, y;
const float f = 1.5F;
x = number * 0.5F;
y = number;
i = *(long *)&y;
i = 0x5f3759df - (i >> 1);
y = *(float *)&i;
y = y * (f - (x * y * y));
y = y * (f - (x * y * y));
return number * y;
}
//Á½µã¼ä¾àÀë
inline float PointToPoint(cocos2d::Point p1, cocos2d::Point p2)
{
float dx = p1.x - p2.x;
float dy = p1.y - p2.y;
return kamake_sqr(dx*dx + dy*dy);
}
//Á½µã¼ä¾àÀë
inline float PointToPoint(float x1, float y1, float x2, float y2)
{
float dx = x1 - x2;
float dy = y1 - y2;
return kamake_sqr(dx*dx + dy*dy);
}
//¼ÓÃÜ
template<class T>
T Lock(T data)
{
return data;
}
//½âÃÜ
template<class T>
T Unlock(T data)
{
return data;
}
};
#endif |
#ifndef GL_DEBUG_DRAWER_H
#define GL_DEBUG_DRAWER_H
#include "LinearMath/btIDebugDraw.h"
#include "ofMain.h"
class GLDebugDrawer : public btIDebugDraw
{
int m_debugMode;
public:
GLDebugDrawer();
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor);
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color);
virtual void drawBox (const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha);
virtual void drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha);
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
virtual void reportErrorWarning(const char* warningString);
virtual void draw3dText(const btVector3& location,const char* textString);
virtual void setDebugMode(int debugMode);
virtual int getDebugMode() const { return m_debugMode;}
};
#endif//GL_DEBUG_DRAWER_H
|
/* -----------------------------------------------------------------------------
* *
* * File Name: HeapInterface.h
* * Author: Danny Tran
* * Description: HeapInterface header file
* * Date: 21 April 2017
* *
* ---------------------------------------------------------------------------- */
#ifndef HEAPINTERFACE_H
#define HEAPINTERFACE_H
#include <iostream>
#include <stdexcept>
#include <string>
//Heap Interface
template <typename T>
class HeapInterface
{
public:
virtual bool isEmpty() const = 0; //returns true if empty, false otherwise
virtual int size() const = 0; //returns size of the heap
virtual void add(T value) throw (std::runtime_error) = 0; //option to throw exception based on implementation
virtual void remove() throw(std::runtime_error) = 0; //throws exception if there is nothing to remove
virtual T peekTop() const throw(std::runtime_error) = 0; //returns the item at the top of the heap
virtual ~HeapInterface() { };
};
#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 "IDEActivityLogSection.h"
#import "DVTSimpleSerialization-Protocol.h"
@class NSString;
// Not exported
@interface GPUDebuggerLog : IDEActivityLogSection <DVTSimpleSerialization>
{
NSString *text;
}
+ (id)defaultLogSectionDomainType;
+ (id)assetBundle;
@property(retain) NSString *text; // @synthesize text;
- (void).cxx_destruct;
- (void)dvt_writeToSerializer:(id)arg1;
- (id)dvt_initFromDeserializer:(id)arg1;
- (id)navigableItem_documentType;
- (void)addLogItem:(id)arg1;
- (id)initLogWithTitle:(id)arg1 serializationPath:(id)arg2;
@end
|
//
// BMOrderFilloutChildMgrCell.h
// BaMinTickets
//
// Created by ganfuchuan on 16/3/3.
// Copyright © 2016年 ganfuchuan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BMOrderFilloutChildMgrCell : UITableViewCell
@end
|
#include "interrupt.h"
#include "platform/current/timer.h"
void c_irq_handler() {
cpu_timer_ack();
}
void c_swi_handler() {
}
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/pen.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PEN_H_
# define _WX_GTK_PEN_H_
//-----------------------------------------------------------------------------
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen : public wxPenBase
{
public:
wxPen()
{
}
wxPen(const wxColour& colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
wxPen(const wxPenInfo& info);
virtual ~wxPen();
bool operator==(const wxPen& pen) const;
bool operator!=(const wxPen& pen) const
{
return !(*this == pen);
}
void SetColour(const wxColour& colour) override;
void SetColour(unsigned char red, unsigned char green, unsigned char blue) override;
void SetCap(wxPenCap capStyle) override;
void SetJoin(wxPenJoin joinStyle) override;
void SetStyle(wxPenStyle style) override;
void SetWidth(int width) override;
void SetDashes(int number_of_dashes, const wxDash* dash) override;
void SetStipple(const wxBitmap& stipple) override;
wxColour GetColour() const override;
wxPenCap GetCap() const override;
wxPenJoin GetJoin() const override;
wxPenStyle GetStyle() const override;
int GetWidth() const override;
int GetDashes(wxDash** ptr) const override;
int GetDashCount() const;
wxDash* GetDash() const;
wxBitmap* GetStipple() const override;
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") wxPen(const wxColour& col, int width, int style);
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") void SetStyle(int style)
{
SetStyle((wxPenStyle) style);
}
protected:
wxGDIRefData* CreateGDIRefData() const override;
wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const override;
wxDECLARE_DYNAMIC_CLASS(wxPen);
};
#endif
|
/**
* @file src/tools/SerialComImpl_other.h
* @date Mar 2016
* @author PhRG - opticalp.fr
*/
/*
Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
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 SRC_SERIALCOMIMPL_OTHER_H_
#define SRC_SERIALCOMIMPL_OTHER_H_
#ifndef __unix__
#ifndef WIN32
#include "Poco/Exception.h"
#include <string>
/**
* SerialComImpl
*
* (non-)Implementation of the serial communication (unknown system)
*/
class SerialComImpl
{
public:
SerialComImpl() { }
virtual ~SerialComImpl() { }
/**
* Open the serial com port
*/
void open(std::string comPort)
{
throw Poco::NotImplementedException(
"SerialCom::open() is not implemented "
"for this platform");
}
/**
* Close the com port
*
* @throw Poco::IOException if any problem occurs
*/
void close()
{
throw Poco::NotImplementedException(
"SerialCom::close() is not implemented "
"for this platform");
}
void setPortSettings(int speed, char parity, int wordSize,
int stopBits, size_t bufSize)
{
throw Poco::NotImplementedException(
"SerialCom::setPortSettings() is not implemented "
"for this platform");
}
/**
* Check if the port is open and valid
*
* @throw Poco::IOException if not valid
*/
void checkOpen()
{
throw Poco::NotImplementedException(
"SerialCom::checkOpen() is not implemented "
"for this platform");
}
/**
* read data from the com port
*
* @param buffer allocated char buffer that will be filled
* with received data
* @param bufSize buffer size
* @return size of read data
*/
size_t read(char* buffer, size_t bufSize)
{
throw Poco::NotImplementedException(
"SerialCom::read() is not implemented "
"for this platform");
}
/**
* write data to the com port
*
* @param buffer char buffer that is to be sent
* to the com port
* @param bufSize buffer size
* @return number of sent characters
*/
size_t write(const char* buffer, size_t bufSize)
{
throw Poco::NotImplementedException(
"SerialCom::write() is not implemented "
"for this platform");
}
protected:
size_t mBufSize;
std::string portName;
};
#endif /* WIN32 */
#endif /* __unix__ */
#endif /* SRC_SERIALCOMIMPL_OTHER_H_ */
|
#ifndef NSSCRIPTABLEOBJECTBASE_H_
#define NSSCRIPTABLEOBJECTBASE_H_
#include <windows.h>
#include "plugin_common/pluginbase.h"
#include "utils/Log.h"
#if TRACE_METHODS
#define TRACE_SCRIPTABLE_METHOD() LogMessage(U(__FUNCTION__) L" %p", npobj)
#define TRACE_SCRIPTABLE_METHOD_ARGS(fmt, ...) LogMessage(U(__FUNCTION__) L" %p " fmt, npobj, __VA_ARGS__)
#else
#define TRACE_SCRIPTABLE_METHOD()
#define TRACE_SCRIPTABLE_METHOD_ARGS(...)
#endif
template<class T>
static NPObject* AllocateNpObject(NPP npp, NPClass*) {
NPObject* obj = new T(npp);
return obj;
}
/*------------------------------------------------------------------------
class nsScriptableObjectBase : public NPObject
Inherits From:
Description: Helper class that can be used to map calls to the
NPObject hooks into virtual methods on instances of
classes that derive from this class.
Data members:
------------------------------------------------------------------------*/
class nsScriptableObjectBase : public NPObject {
public:
nsScriptableObjectBase(NPP npp);
virtual ~nsScriptableObjectBase();
public:
// Virtual NPObject hooks called through this base class. Override
// as you see fit.
virtual void Invalidate();
virtual bool HasMethod(NPIdentifier name);
virtual bool Invoke(NPIdentifier name, const NPVariant *args,
uint32_t argCount, NPVariant *result);
virtual bool InvokeDefault(const NPVariant *args, uint32_t argCount,
NPVariant *result);
virtual bool HasProperty(NPIdentifier name);
virtual bool GetProperty(NPIdentifier name, NPVariant *result);
virtual bool SetProperty(NPIdentifier name, const NPVariant *value);
virtual bool RemoveProperty(NPIdentifier name);
virtual bool Enumerate(NPIdentifier **value, uint32_t *count);
virtual bool Construct(const NPVariant *args, uint32_t argCount, NPVariant *result);
static void _Deallocate(NPObject *npobj);
static void _Invalidate(NPObject *npobj);
static bool _HasMethod(NPObject *npobj, NPIdentifier name);
static bool _Invoke(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
static bool _InvokeDefault(NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
static bool _HasProperty(NPObject * npobj, NPIdentifier name);
static bool _GetProperty(NPObject *npobj, NPIdentifier name,
NPVariant *result);
static bool _SetProperty(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
static bool _RemoveProperty(NPObject *npobj, NPIdentifier name);
static bool _Enumerate(NPObject *npobj, NPIdentifier **value,
uint32_t *count);
static bool _Construct(NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
protected:
NPP npp;
};
#define DECLARE_NPOBJECT_CLASS_WITH_BASE(_class) \
static NPClass s##_class##_NPClass = { \
NP_CLASS_STRUCT_VERSION, \
AllocateNpObject<_class>, \
nsScriptableObjectBase::_Deallocate, \
nsScriptableObjectBase::_Invalidate, \
nsScriptableObjectBase::_HasMethod, \
nsScriptableObjectBase::_Invoke, \
nsScriptableObjectBase::_InvokeDefault, \
nsScriptableObjectBase::_HasProperty, \
nsScriptableObjectBase::_GetProperty, \
nsScriptableObjectBase::_SetProperty, \
nsScriptableObjectBase::_RemoveProperty, \
nsScriptableObjectBase::_Enumerate, \
nsScriptableObjectBase::_Construct \
}
#define GET_NPOBJECT_CLASS(_class) &s##_class##_NPClass
#endif
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
//************************ Includes *****************************
//**************Symbolic Constant Macros (defines) *************
//************************ Typedefs *****************************
//************ Declarations (Statics and globals) ***************
//******************* Function Prototypes ***********************
#ifdef __cplusplus
extern "C" {
#endif
void ExampleInit(void);
#ifdef __cplusplus
}
#endif
|
//
// AppDelegate.h
// CAIAutoCode
//
// Created by liyufeng on 14/12/22.
// Copyright (c) 2014年 liyufeng. 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
|
//
// MSGSSimpleClient.h
// ENSSample
//
// Created by Peter Verhage on 27-01-14.
//
//
#import "MSGSClient.h"
@interface MSGSSimpleClient : NSObject
+ (MSGSSimpleClient *)sharedInstance;
- (void)registerEndpointWithDeviceToken:(NSData *)deviceToken
success:(void (^)(MSGSEndpoint *endpoint))success
failure:(void (^)(NSError *error))failure;
- (void)registerEndpointWithDeviceToken:(NSData *)deviceToken
endpointType:(NSString *)endpointType
success:(void (^)(MSGSEndpoint *endpoint))success
failure:(void (^)(NSError *error))failure;
- (void)fetchSubscriptionWithChannelCode:(NSString *)channelCode
success:(void (^)(MSGSSubscription *subscription))success
failure:(void (^)(NSError *error))failure;
- (void)fetchSubscriptionsWithLimit:(NSNumber *)limit
offset:(NSNumber *)offset
sort:(NSArray *)sort
success:(void (^)(NSArray *subscriptions, BOOL hasMore))success
failure:(void (^)(NSError *error))failure;
- (void)fetchSubscriptionsWithTags:(NSArray *)tags
limit:(NSNumber *)limit
offset:(NSNumber *)offset
sort:(NSArray *)sort
success:(void (^)(NSArray *subscriptions, BOOL hasMore))success
failure:(void (^)(NSError *error))failure;
- (void)countSubscriptionsWithTags:(NSArray *)tags
success:(void (^)(NSInteger count))success
failure:(void (^)(NSError *error))failure;
- (void)subscribeWithChannelCode:(NSString *)channelCode
success:(void (^)(MSGSSubscription *subscription))success
failure:(void (^)(NSError *error))failure;
- (void)unsubscribeWithChannelCode:(NSString *)channelCode
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure;
@end
|
//
// ISOLogger.h
//
// Created by Peter Jenkins on 10/18/13.
// Copyright (c) 2013 Peter Jenkins. All rights reserved.
//
#import <Foundation/Foundation.h>
#define ISOLog(format, ...) printf("%s\n", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String])
#define ISOLogLoud(format, ...) printf("\n\n!!!! %s !!!!\n\n\n", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String])
@interface ISOLogger : NSObject
+ (void)redirectLogsToFile;
@end
|
// 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>
/**
* Delegate protocol to handle reordering of cells in SNLInteractionTableView.
*/
@protocol SNLInteractionTableViewReorderDelegate <UITableViewDelegate>
/**
* Called when user long presses a cell.
*/
- (void)startedReorderAtIndexPath:(NSIndexPath *)indexPath;
/**
* Called every time 2 cells switch positions.
* To update the data source when a cell is dragged to a new position.
*/
- (void)moveRowFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
/**
* Called when user stops dragging.
*/
- (void)finishedReorderAtIndexPath:(NSIndexPath *)indexPath;
@end
@interface SNLInteractionTableView : UITableView
/**
* TableViews delegate ViewController to handle reordering.
*/
@property (nonatomic, weak) id <SNLInteractionTableViewReorderDelegate> delegate;
/**
* Toolbar is shown when cell is tapped.
*
* Default: YES.
*/
@property (nonatomic) BOOL toolbarEnabled;
#pragma mark - Functionality
/**
* Custom separator is enabled. Inherited from Storyboard.
*
* Default: NO
*/
@property (nonatomic) BOOL customSeparatorEnabled;
/**
* Deselect selected cell and calls tableView:willDeselectRowAtIndexPath and
* tableView:didDeselectRowAtIndexPath of delegate.
*/
- (void)deselectSelectedRow;
/**
* Reloads rows at indexPath like normal tableView does, but maintans selection.
*/
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths andKeepSelection:(BOOL)keepSelection;
@end
|
//
// LocalNotificationViewController.h
// PAFinal
//
// Created by STANLEY CALIXTE on 5/26/14.
// Copyright (c) 2014 STANLEY CALIXTE. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "FeatureManagerViewController.h"
@interface LocalNotificationViewController : FeatureManagerViewController
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
- (IBAction)scheduleNotification:(id)sender;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__unsigned_int_max_square_06.c
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-06.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: max Set data to the max value for unsigned int
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: square
* GoodSink: Ensure there will not be an overflow before squaring data
* BadSink : Square data, which can lead to overflow
* Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#include <math.h>
/* The variable below is declared "const", so a tool should be able
to identify that reads of this will always give its initialized
value. */
static const int STATIC_CONST_FIVE = 5;
#ifndef OMITBAD
void CWE190_Integer_Overflow__unsigned_int_max_square_06_bad()
{
unsigned int data;
data = 0;
if(STATIC_CONST_FIVE==5)
{
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = UINT_MAX;
}
if(STATIC_CONST_FIVE==5)
{
{
/* POTENTIAL FLAW: if (data*data) > UINT_MAX, this will overflow */
unsigned int result = data * data;
printUnsignedLine(result);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */
static void goodB2G1()
{
unsigned int data;
data = 0;
if(STATIC_CONST_FIVE==5)
{
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = UINT_MAX;
}
if(STATIC_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Add a check to prevent an overflow from occurring */
if (abs((long)data) <= (long)sqrt((double)UINT_MAX))
{
unsigned int result = data * data;
printUnsignedLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
unsigned int data;
data = 0;
if(STATIC_CONST_FIVE==5)
{
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = UINT_MAX;
}
if(STATIC_CONST_FIVE==5)
{
/* FIX: Add a check to prevent an overflow from occurring */
if (abs((long)data) <= (long)sqrt((double)UINT_MAX))
{
unsigned int result = data * data;
printUnsignedLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodG2B1() - use goodsource and badsink by changing the first STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */
static void goodG2B1()
{
unsigned int data;
data = 0;
if(STATIC_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */
data = 2;
}
if(STATIC_CONST_FIVE==5)
{
{
/* POTENTIAL FLAW: if (data*data) > UINT_MAX, this will overflow */
unsigned int result = data * data;
printUnsignedLine(result);
}
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
unsigned int data;
data = 0;
if(STATIC_CONST_FIVE==5)
{
/* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */
data = 2;
}
if(STATIC_CONST_FIVE==5)
{
{
/* POTENTIAL FLAW: if (data*data) > UINT_MAX, this will overflow */
unsigned int result = data * data;
printUnsignedLine(result);
}
}
}
void CWE190_Integer_Overflow__unsigned_int_max_square_06_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE190_Integer_Overflow__unsigned_int_max_square_06_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__unsigned_int_max_square_06_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
Dwarf Therapist
Copyright (c) 2009 Trey Stout (chmod)
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 DWARF_MODEL_PROXY_H
#define DWARF_MODEL_PROXY_H
#include <QtWidgets>
class Dwarf;
class DwarfModel;
class QScriptEngine;
class DwarfModelProxy: public QSortFilterProxyModel {
Q_OBJECT
public:
//these roles are for the right click sorting of the name column
typedef enum {
DSR_NAME_ASC = 0,
DSR_NAME_DESC,
DSR_ID_ASC,
DSR_ID_DESC,
DSR_AGE_ASC,
DSR_AGE_DESC,
DSR_SIZE_ASC,
DSR_SIZE_DESC,
DSR_DEFAULT
} DWARF_SORT_ROLE;
DwarfModelProxy(QObject *parent = 0);
DwarfModel* get_dwarf_model() const;
void sort(int column, Qt::SortOrder order);
Qt::SortOrder m_last_sort_order;
QList<QString> get_script_names() {return m_scripts.keys();}
QString get_script(const QString script_name) {return m_scripts.value(script_name);}
void clear_script(const QString script_name = "");
void refresh_script();
QList<Dwarf*> get_filtered_dwarves();
public slots:
void cell_activated(const QModelIndex &idx);
void setFilterFixedString(const QString &pattern);
void sort(int, DwarfModelProxy::DWARF_SORT_ROLE, Qt::SortOrder order);
void apply_script(const QString &script_name, const QString &script_body);
void test_script(const QString &script_body);
void clear_test();
signals:
void filter_changed();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const;
private:
QString m_filter_text;
QString m_test_script;
QScriptEngine *m_engine;
QHash<QString,QString> m_scripts;
};
#endif
|
//
// AppDelegate.h
// HuLaQuan
//
// Created by hok on 1/5/16.
// Copyright © 2016 Jianghao. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property float autoSizeScaleX;
@property float autoSizeScaleY;
@property (strong, nonatomic) UIWindow *window;
+ (instancetype)sharedAppDelegate;
- (void)NIMLoginAction;
-(void)NIMLoginout;
- (void)NIMLoginAutoAction;
@end
|
//
// Copyright (c) 2015, Microsoft Corporation
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
#pragma once
#include "IAdapter.h"
#include "AdapterConstants.h"
#include "ConfigManager.h"
#include "BridgeConfig.h"
#include "IBridge.h"
namespace Bridge
{
class BridgeDevice;
class DsbBridge final : public IBridge, public IAdapterSignalListener, public std::enable_shared_from_this<DsbBridge>
{
public:
static std::shared_ptr<DsbBridge> SingleInstance();
DsbBridge();
virtual ~DsbBridge();
// IBridge
QStatus Initialize() override;
QStatus Shutdown() override;
void AddAdapter(_In_ std::shared_ptr<IAdapter> adapter) override;
QStatus AddDevice(_In_ std::shared_ptr<IAdapter> adapter, _In_ std::shared_ptr<IAdapterDevice> device) override;
// IAdapterSignalListener implementation
void AdapterSignalHandler(_In_ std::shared_ptr<IAdapter> sender, _In_ std::shared_ptr<IAdapterSignal> signal, _In_opt_ intptr_t context = 0) override;
QStatus InitializeDevices(_In_ std::shared_ptr<IAdapter> adapter, _In_ ConfigManager& configMgr, _In_ bool isUpdate = false);
inline std::map<int, std::shared_ptr<BridgeDevice>>& GetDeviceList() { return m_deviceList; }
ConfigManager* GetConfigManager(std::shared_ptr<IAdapter> adapter);
private:
static std::shared_ptr<DsbBridge> g_TheOneOnlyInstance;
QStatus RegisterAdapterSignalHandlers(std::shared_ptr<IAdapter> adapter, bool isRegister);
QStatus InitializeAdapters();
QStatus CreateDevice(_In_ std::shared_ptr<IAdapter> adapter, _In_ std::shared_ptr<IAdapterDevice> device);
QStatus UpdateDevice(_In_ std::shared_ptr<IAdapter> adapter, _In_ std::shared_ptr<IAdapterDevice> device, _In_ bool exposedOnAllJoynBus);
QStatus RemoveDevice(_In_ std::shared_ptr<IAdapter> adapter, _In_ std::shared_ptr<IAdapterDevice> device);
void MonitorThread();
QStatus InitializeInternal();
QStatus ShutdownInternal();
// indicate if alljoyn has been initialized
bool m_alljoynInitialized;
// underlying adapters
std::vector<std::shared_ptr<IAdapter>> m_adapters;
// CSP / configuration for each adapter
std::vector<ConfigManager*> m_configManagers;
// device representations
std::map<int, std::shared_ptr<BridgeDevice>> m_deviceList;
// Synchronization object
std::recursive_mutex m_bridgeLock; // TODO: This should be re-architected to use a std mutex
std::mutex m_threadLock;
std::condition_variable m_actionRequired;
std::thread m_thread;
bool m_triggerReset;
bool m_stopWorkerThread;
bool m_workerThreadStopped;
public:
ConfigManager* GetConfigManagerForBusObject(_In_ alljoyn_busobject busObject);
// The following is needed to synchronize access to the configuration file.
// It is unlikely, but possible that a device is added to the config file
// at the same time the CSP attempts to read it.
friend CspBridge;
std::recursive_mutex& GetLock(); // TODO: This should be re-architected and removed
//called from background MonitorThread();
QStatus Reset();
void TriggerReset() { { std::lock_guard<std::mutex> threadlock(m_threadLock); m_triggerReset = true; } m_actionRequired.notify_one(); }
};
}
|
// Copyright (c) 2009 James Wynn <james@jameswynn.com>
// All rights reserved. This file is part of simplefilewatcher, distributed
// under the MIT license. For full terms please see the LICENSE file.
#ifndef _FW_FILEWATCHER_H_
#define _FW_FILEWATCHER_H_
#include <stdexcept>
#include <string>
#include <memory>
namespace FW
{
/// Type for a string
typedef std::string String;
/// Type for a watch id
typedef unsigned long WatchID;
// forward declarations
class FileWatcherImpl;
class FileWatchListener;
/// Base exception class
/// @class Exception
class Exception : public std::runtime_error
{
public:
Exception(const String &message) : std::runtime_error(message) {}
};
/// Exception thrown when a file is not found.
/// @class FileNotFoundException
class FileNotFoundException : public Exception
{
public:
FileNotFoundException() : Exception("File not found") {}
FileNotFoundException(const String &filename)
: Exception("File not found (" + filename + ")")
{
}
};
/// Actions to listen for. Rename will send two events, one for
/// the deletion of the old file, and one for the creation of the
/// new file.
namespace Actions
{
enum Action {
/// Sent when a file is created or renamed
Add = 1,
/// Sent when a file is deleted or renamed
Delete = 2,
/// Sent when a file is modified
Modified = 4
};
};
typedef Actions::Action Action;
/// Listens to files and directories and dispatches events
/// to notify the parent program of the changes.
/// @class FileWatcher
class FileWatcher
{
public:
///
///
FileWatcher();
///
///
virtual ~FileWatcher();
/// Add a directory watch. Same as the other addWatch, but doesn't have
/// recursive option.
/// For backwards compatibility.
/// @exception FileNotFoundException Thrown when the requested directory
/// does not exist
WatchID addWatch(const String &directory, FileWatchListener *watcher);
/// Add a directory watch
/// @exception FileNotFoundException Thrown when the requested directory
/// does not exist
WatchID addWatch(const String &directory, FileWatchListener *watcher,
bool recursive);
/// Remove a directory watch. This is a brute force search O(nlogn).
void removeWatch(const String &directory);
/// Remove a directory watch. This is a map lookup O(logn).
void removeWatch(WatchID watchid);
/// Updates the watcher. Must be called often.
void update();
private:
/// The implementation
std::unique_ptr<FileWatcherImpl> mImpl;
}; // end FileWatcher
/// Basic interface for listening for file events.
/// @class FileWatchListener
class FileWatchListener
{
public:
FileWatchListener() {}
virtual ~FileWatchListener() {}
/// Handles the action file action
/// @param watchid The watch id for the directory
/// @param dir The directory
/// @param filename The filename that was accessed (not full path)
/// @param action Action that was performed
virtual void handleFileAction(WatchID watchid, const String &dir,
const String &filename,
Action action) = 0;
}; // class FileWatchListener
}; // namespace FW
#endif //_FW_FILEWATCHER_H_
|
/*-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Project 6
File: nsh5_gid.h
Created by: Fritts and Slayter
Last edit on: 12/04/2013 (Slayter)
Description: A list of functions for:
-getting data from a file or user and running these commands
-callback functions for these commands
-parsing data given by the user
-helper functions for making parsing data easier
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-*/
/*Includes. -------------------------------------------*/
#include <stdbool.h>
#include <stdint.h>
/*Data Structures. -------------------------------------------*/
/*A pair of command and callback for a given command. EX: "set",&userCommand_L1_set()*/
typedef struct
{
char *command;
void (* func)(char**);
}command_L1_t;
extern command_L1_t userCommands[];
/*A struct that will hold a complex string if the user gives one.*/
typedef struct
{
bool cs_present;
char cs[1024];
}simpleComplexString_t;
extern simpleComplexString_t scs;
extern simpleComplexString_t scsEmpty;
/*Getting data from user. -------------------------------------------*/
/*parseCommand function was called
input: N/A
output: N/A
description: Takes the input from the user using stdio and places that data in a buffer
for later analysis.*/
extern void getUserInput(void);
/*Callback functions for all of the major commands. -------------------------------------------*/
/*SET function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to set a env variable this function is called.*/
void userCommand_L1_set(char **givenData);
/*TES function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to delete a env variable this function is called.*/
void userCommand_L1_tes(char **givenData);
/*ALIAS function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to set a alias for anything this function is called.*/
void userCommand_L1_alias(char **givenData);
/*SAILA function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to delete an alias that was created this function is called.*/
void userCommand_L1_saila(char **givenData);
/*EXIT function was called
input: dont care (not used)
output: N/A
description: When a user wants to exit the program this function is called and exit(0) is called.*/
void userCommand_L1_exit(char **givenData);
/*HELP function was called
input: dont care (not used)
output: N/A
description: When a user wants wants to see the help menu this function is called.
displays descriptions for user.*/
void userCommand_L1_help(char **givenData);
/*ECHO function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to echo the given input this function is called.*/
void userCommand_L1_echo(char **givenData);
/*WHERE function was called
input: double pointer of data that procedes the command given.
output: N/A
description: When a user wants to run the where command this function is called.*/
void userCommand_L1_where(char **givenData);
|
//
// TVModel.h
// TVModel
//
// Created by X.I. Losada on 04/02/16.
// Copyright © 2016 XiLosada. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TVModel.
FOUNDATION_EXPORT double TVModelVersionNumber;
//! Project version string for TVModel.
FOUNDATION_EXPORT const unsigned char TVModelVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TVModel/PublicHeader.h>
|
/**
* ______ ___
* / ____/___ / | _____________ __________
* / / __/ __ \/ /| |/ ___/ ___/ _ \/ ___/ ___/
* / /_/ / /_/ / ___ / /__/ /__/ __(__ |__ )
* \____/\____/_/ |_\___/\___/\___/____/____/
*
* The MIT License (MIT)
* Copyright (c) 2009-2022 Gerardo Orellana <hello @ goaccess.io>
*
* 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 COLOR_H_INCLUDED
#define COLOR_H_INCLUDED
#define COLOR_STR_LEN 9
/* Color Items/Fields */
typedef enum CSTM_COLORS {
COLOR_NORMAL,
COLOR_MTRC_HITS,
COLOR_MTRC_VISITORS,
COLOR_MTRC_DATA,
COLOR_MTRC_BW,
COLOR_MTRC_AVGTS,
COLOR_MTRC_CUMTS,
COLOR_MTRC_MAXTS,
COLOR_MTRC_PROT,
COLOR_MTRC_MTHD,
COLOR_MTRC_HITS_PERC,
COLOR_MTRC_HITS_PERC_MAX,
COLOR_MTRC_VISITORS_PERC,
COLOR_MTRC_VISITORS_PERC_MAX,
COLOR_PANEL_COLS,
COLOR_BARS,
COLOR_ERROR,
COLOR_SELECTED,
COLOR_PANEL_ACTIVE,
COLOR_PANEL_HEADER,
COLOR_PANEL_DESC,
COLOR_OVERALL_LBLS,
COLOR_OVERALL_VALS,
COLOR_OVERALL_PATH,
COLOR_ACTIVE_LABEL,
COLOR_BG,
COLOR_DEFAULT,
COLOR_PROGRESS,
} GColorItem;
/* Default Color Schemes */
typedef enum SCHEMES {
NO_COLOR,
MONOCHROME,
STD_GREEN,
MONOKAI,
} GShemes;
#include "commons.h"
/* Each color properties */
typedef struct GColorPair_ {
short idx; /* color pair index identifier */
short fg; /* foreground color */
short bg; /* background color */
} GColorPair;
/* Color */
typedef struct GColors_ {
GColorItem item; /* screen item */
GColorPair *pair; /* color pair */
int attr; /* color attributes, e.g., bold */
short module; /* panel */
} GColors;
GColors *color_default (void);
GColors *color_error (void);
GColors *color_overall_lbls (void);
GColors *color_overall_path (void);
GColors *color_overall_vals (void);
GColors *color_panel_active (void);
GColors *color_panel_desc (void);
GColors *color_panel_header (void);
GColors *color_progress (void);
GColors *color_selected (void);
GColors *get_color_by_item_module (GColorItem item, GModule module);
GColors *get_color (GColorItem item);
GColors *get_color_normal (void);
void free_color_lists (void);
void set_colors (int force);
void set_normal_color (void);
#endif // for #ifndef COLOR_H
|
// OCMockito by Jon Reid, https://qualitycoding.org
// Copyright 2022 Jonathan M. Reid. See LICENSE.txt
#import "MKTReturnValueSetter.h"
NS_ASSUME_NONNULL_BEGIN
@interface MKTClassReturnSetter : MKTReturnValueSetter
- (instancetype)initWithSuccessor:(nullable MKTReturnValueSetter *)successor NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithType:(char const *)handlerType successor:(nullable MKTReturnValueSetter *)successor NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
|
//
// LHStoriesFromCardViewController.h
// LovingHeart
//
// Created by Edward Chiang on 2014/4/2.
// Copyright (c) 2014年 LovineHeart. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LHStoriesFromCardViewController : PFQueryTableViewController
@property (nonatomic, strong) LHIdea *ideaObject;
@end
|
#include "C:\Factory\Common\all.h"
#include "C:\Factory\SubTools\libs\bmptbl.h"
static autoTable_t *Bmp;
static void MakeBmp(void)
{
int c1;
int c2;
Bmp = newTable(getZero, noop_u);
resizeTable(Bmp, 256, 256);
for(c1 = 0; c1 < 256; c1++)
for(c2 = 0; c2 < 256; c2++)
{
int chr = c1 * 256 + c2;
uint color;
if(isJChar(chr))
color = 0x0000ff;
else
color = 0xffffff;
setTableCell(Bmp, c2, c1, color);
}
}
int main(int argc, char **argv)
{
MakeBmp();
tWriteBMPFile(c_getOutFile("JMap.bmp"), Bmp);
openOutDir();
}
|
static int
waitee_main(int fd)
{
pid_t pid;
pid = getpid();
if (write(fd, &pid, sizeof(pid)) != sizeof(pid))
return (1);
if (close(fd) == -1)
return (2);
for (;;)
;
/* NOTREACHED */
return (3);
}
#define R 0
#define W 1
static int
waiter_main(int fds[2])
{
pid_t pid;
int wfd;
if (close(fds[R]) == -1)
return (1);
wfd = fds[W];
pid = fork();
switch (pid) {
case -1:
return (2);
case 0:
return (waitee_main(wfd));
default:
break;
}
if (close(wfd) == -1)
return (3);
wait4(pid, NULL, 0, NULL);
/* NOTREACHED */
return (4);
}
int
main(int argc, const char *argv[])
{
struct timespec timeout;
pid_t cpid, pid;
int fds[2], rfd, sig, status;
if (pipe(fds) == -1)
return (1);
pid = fork();
switch (pid) {
case -1:
return (2);
case 0:
return (waiter_main(fds));
default:
break;
}
if (close(fds[W]) == -1)
return (3);
rfd = fds[R];
if (read(rfd, &cpid, sizeof(cpid)) != sizeof(cpid))
return (4);
if (close(rfd) == -1)
return (5);
timeout.tv_sec = 1;
timeout.tv_nsec = 0;
if (nanosleep(&timeout, NULL) == -1)
return (6);
sig = SIGKILL;
if (kill(pid, sig) == -1)
return (7);
if (wait4(pid, &status, 0, NULL) == -1)
return (8);
if (!WIFSIGNALED(status))
return (9);
if (WTERMSIG(status) != sig)
return (10);
if (kill(cpid, SIGKILL) == -1)
return (11);
return (0);
}
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Pods_Funnel_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Funnel_TestsVersionString[];
|
#ifndef IMAGE_H
#define IMAGE_H
#include <string>
#include "ImageEffect.h"
using std::string;
class Image
{
private:
string path;
unsigned char *data;
int width, height, channels;
bool has_image_loaded;
bool modified_in_memory;
void clear_data();
public:
Image();
Image(string);
~Image();
bool load_from_file(string);
bool write_to_file(string);
void resize_image(int);
void apply_effect(ImageEffect *);
void apply_effects(ImageEffect **, int);
unsigned char *get_data();
void set_new_data(unsigned char *, int, int, int);
string get_filepath();
int get_width();
int get_height();
int get_channels();
bool is_image_loaded();
bool has_been_modified();
};
#endif // IMAGE_H
|
//
// PlaySoundAction.h
// Misty-Island-Rescue-iPad
//
// Created by Johannes Amilon on 11/26/10.
// Copyright 2010 Vitamin Se Media AB. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "SimpleAudioEngine.h"
@interface PlaySoundAction : CCActionInstant {
NSString *filePath;
float volume;
ALuint source;
}
@property (nonatomic) float volume;
+(id) actionWithFilePath:(NSString *)file;
+(void)pauseSounds;
+(void)resumeSounds;
+(void)clearSounds;
+(void)stopSounds;
+(void)adjustGainOnFX:(ALfloat)value;
+(void)setSoundsPrevented:(BOOL)state;
-(id) initWithFilePath:(NSString *)file;
@end
|
//
// AGXGcodeReaderController.h
// AGXWidgetGcode
//
// Created by Char Aznable on 2018/6/27.
// Copyright © 2018 github.com/CharLemAznable. All rights reserved.
//
#ifndef AGXWidgetGcode_AGXGcodeReaderController_h
#define AGXWidgetGcode_AGXGcodeReaderController_h
#import <AGXWidget/AGXWidget/AGXPhotoPickerController.h>
#import <AGXGcode/AGXGcode/AGXDecodeHints.h>
#import <AGXGcode/AGXGcode/AGXGcodeResult.h>
@protocol AGXGcodeReaderControllerDelegate;
@interface AGXGcodeReaderController : AGXPhotoPickerController
@property (nonatomic, AGX_WEAK) id<AGXGcodeReaderControllerDelegate> gcodeReaderDelegate;
@property (nonatomic, AGX_STRONG) AGXDecodeHints *hint;
@end
@protocol AGXGcodeReaderControllerDelegate <NSObject>
@optional
- (void)gcodeReaderController:(AGXGcodeReaderController *)reader didReadResult:(AGXGcodeResult *)result;
- (void)gcodeReaderController:(AGXGcodeReaderController *)reader failedWithError:(NSError *)error;
@end
#endif /* AGXWidgetGcode_AGXGcodeReaderController_h */
|
// Generated by xsd compiler for ios/objective-c
// DO NOT CHANGE!
#import <Foundation/Foundation.h>
#import "PicoClassSchema.h"
#import "PicoPropertySchema.h"
#import "PicoConstants.h"
#import "PicoBindable.h"
/**
Type that represents the unique identifier for a single product.
@ingroup FindingServicePortType
*/
@interface Finding_ProductId : NSObject <PicoBindable> {
@private
NSString *_value;
NSString *_type;
}
/**
(public property)
type : NSString, wrapper for primitive string
*/
@property (nonatomic, retain) NSString *value;
/**
(public property)
type : NSString, wrapper for primitive string
*/
@property (nonatomic, retain) NSString *type;
@end
|
#include <stdio.h>
int main(int argc, char *argv[])
{
char *states[] = {
"California", "Oregon", NULL,
"Washington", "Texas"
};
int num_states = 5;
for(int i = 0; i < num_states; i++) {
printf("state %d: %s\n", i, states[i]);
}
// update states
states[2] = "New York";
for(int i = 0; i < num_states; i++) {
printf("state %d: %s\n", i, states[i]);
}
// update args
argv[0] = "Hello World!";
for(int i = 0; i < argc; i++) {
printf("arg %d: %s.\n", i, argv[i]);
}
return 0;
}
|
/* NSData+FormEncoding.h
*
* Created by Adam Duke on 7/6/11.
* Copyright 2011 Adam Duke. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
@interface NSData (FormEncoding)
+ (NSData *)formEncodedDataFor:(NSDictionary *)requestParameters;
@end
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <DTXConnectionServices/DTXFileDescriptorTransport.h>
@class NSArray, NSObject<OS_dispatch_semaphore>, NSObject<OS_dispatch_source>;
@interface DTXSocketTransport : DTXFileDescriptorTransport
{
NSObject<OS_dispatch_semaphore> *_socketAcceptedSem;
NSObject<OS_dispatch_source> *_acceptSource;
NSArray *_addresses;
int _port;
}
+ (id)addressForHost:(const char *)arg1 port:(int)arg2;
+ (id)schemes;
@property(readonly) int port; // @synthesize port=_port;
- (id)localAddresses;
- (void)disconnect;
- (unsigned long long)transmit:(const void *)arg1 ofLength:(unsigned long long)arg2;
- (id)initWithRemoteAddress:(id)arg1;
- (void)dealloc;
- (id)initWithLocalPort:(int)arg1;
- (id)initWithConnectedSocket:(int)arg1 disconnectAction:(CDUnknownBlockType)arg2;
- (void)_commonSocketTransportInit;
- (void)_setupChannelWithConnectedSocket:(int)arg1 assumingOwnership:(BOOL)arg2 orDisconnectBlock:(CDUnknownBlockType)arg3;
- (id)initWithLocalAddress:(id)arg1;
- (void)_setupWithLocalPort:(int)arg1;
@end
|
//
// Person.h
// MagicalRecord-coreData
//
// Created by baijiahulian on 15/8/25.
// Copyright (c) 2015年 BJHL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Person : NSObject
@property (nonatomic, retain) NSNumber * age;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * idNumber;
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <VoiceMemos/RCMemoPlaybackViewController.h>
#import "RCAVPreviewControllerObserver-Protocol.h"
@class NSTimer, RCSavedRecording, UIButton;
@interface RCPlayMemoViewController : RCMemoPlaybackViewController <RCAVPreviewControllerObserver>
{
NSTimer *_playbackTimer;
double _defaultVisibleDuration;
UIButton *_beginTrimButton;
UIButton *_cancelTrimButton;
UIButton *_performTrimButton;
_Bool _trimmingEnabledBeforeOverride;
_Bool _trimming;
_Bool _trimmingEnabled;
RCSavedRecording *_savedRecording;
double _nextStartTime;
id _endTrimReloadDataSourceBlock;
}
@property(copy, nonatomic) id endTrimReloadDataSourceBlock; // @synthesize endTrimReloadDataSourceBlock=_endTrimReloadDataSourceBlock;
@property(nonatomic) double nextStartTime; // @synthesize nextStartTime=_nextStartTime;
@property(nonatomic, getter=isTrimmingEnabled) _Bool trimmingEnabled; // @synthesize trimmingEnabled=_trimmingEnabled;
@property(nonatomic, getter=isTrimming) _Bool trimming; // @synthesize trimming=_trimming;
@property(readonly, nonatomic) RCSavedRecording *savedRecording; // @synthesize savedRecording=_savedRecording;
- (void).cxx_destruct;
- (CDStruct_73a5d3ca)_selectedTimeRange;
- (void)_deleteSelectedTimeRangeAsCopy:(_Bool)arg1 completionBlock:(id)arg2;
- (_Bool)_isSelectionTrimmable;
- (void)_cancelTrim;
- (void)_performTrim;
- (void)_beginTrimmingAction;
- (void)_endTrimming;
- (void)_beginTrimming;
- (void)_updateTrimModeButtons;
- (void)_pausePlayback;
- (void)_resumePlayback;
- (void)_updateInterfaceForAVPlaybackState;
- (void)previewController:(id)arg1 playbackTimeDidUpdateToCurrentTime:(double)arg2;
- (void)previewController:(id)arg1 playbackDidStopPlayingWithError:(id)arg2;
- (void)previewController:(id)arg1 playbackTimeDidJumpWithPreviousTime:(double)arg2;
- (void)previewController:(id)arg1 playbackDidBeginWithRate:(float)arg2;
- (void)waveformViewController:(id)arg1 didScrubToTime:(double)arg2;
- (id)previewController;
- (void)dismiss;
- (void)commitEditing;
- (void)updateNavigationItem;
- (void)setCurrentTime:(double)arg1;
- (void)setScreenUpdatesDisabled:(_Bool)arg1;
- (void)setPlaying:(_Bool)arg1;
- (void)_setPlaying:(_Bool)arg1 updatePlayer:(_Bool)arg2;
- (long long)defaultControlsConfiguration;
- (void)viewWillDisappear:(_Bool)arg1;
- (void)viewDidAppear:(_Bool)arg1;
- (void)viewWillAppear:(_Bool)arg1;
- (void)viewDidLoad;
- (void)dealloc;
- (id)initWithSavedRecording:(id)arg1;
@end
|
//
// ShipScore.h
// WULESI
//
// Created by 吴 wuziqi on 12-6-2.
// Copyright 2012年 同济大学. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "Score.h"
@interface ShipScore : Score {
}
+ (id)createScoreLabel:(scoreValue)value;
@end
|
//
// RavenMessage.h
// Raven
//
// Created by Joe Rickerby on 20/08/2014.
//
#import <Foundation/Foundation.h>
typedef enum {
kRavenLogLevelDebug,
kRavenLogLevelInfo,
kRavenLogLevelWarning,
kRavenLogLevelError,
kRavenLogLevelFatal
} RavenLogLevel;
/**
* Represents a message containing a Sentry 'event' that can be sent using -[RavenClient send:].
*/
@interface RavenMessage : NSObject <NSCoding>
+ (instancetype)messageWithString:(NSString *)messageString;
+ (instancetype)messageWithString:(NSString *)messageString level:(RavenLogLevel)level;
+ (instancetype)messageWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
+ (instancetype)messageWithLevel:(RavenLogLevel)level format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);
+ (instancetype)messageWithError:(NSError *)error;
+ (instancetype)messageWithError:(NSError *)error level:(RavenLogLevel)level;
+ (instancetype)messageWithException:(NSException *)exception;
+ (instancetype)messageWithException:(NSException *)exception level:(RavenLogLevel)level;
@property (copy) NSString *message;
@property (copy) NSDate *timestamp;
@property (assign) RavenLogLevel level;
@property (copy) NSString *culprit;
@property (copy) NSDictionary *extra;
@property (copy) NSDictionary *tags;
@property (copy) NSDictionary *stacktrace;
@property (copy) NSDictionary *exception;
@property (copy) NSDictionary *user;
@property (copy) NSString *formatString;
/**
* Get the message as a dictionary, ready to be encoded as JSON and sent to sentry.
*/
- (NSDictionary *)dictionaryRepresentation;
/**
* Get the message as a dictionary, ready to be encoded as JSON and sent to sentry.
* The extra and tags parameters will be merged with those on this message, with the message entries taking priority.
*/
- (NSDictionary *)dictionaryRepresentationWithExtra:(NSDictionary *)extra tags:(NSDictionary *)tags;
/**
* Use to convert a callstack symbols array (from +[NSThread callStackSymbols], for example) to a dictionary suitable
* for the 'stacktrace' property.
*/
+ (NSDictionary *)stacktraceDictFromCallStackSymbols:(NSArray *)callStackSymbols;
@end
|
#include <gmp.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include "primes.h"
bool isPrime(mpz_t n) {
mpz_t i, c, r;
mpz_init(i);
mpz_init(c);
mpz_init(r);
if (mpz_cmp_si(n, 2) < 0) return false;
if (mpz_cmp_si(n, 2) == 0) return true;
mpz_mod_ui(r, n, 2);
if (mpz_cmp_ui(r, 0) == 0) return false;
for (mpz_set_ui(i, 2); mpz_cmp(i, n) < 0; mpz_add_ui(i, i, 1)) {
mpz_mod(r, n, i);
if (mpz_cmp_ui(r, 0) == 0) return false;
}
return true;
}
|
//
// Controller.h
//
// Created by Paul Kim on 8/21/09.
// Copyright 2009-2012 Noodlesoft, LLC. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
@class NoodleTableView;
@interface Controller : NSObject
{
IBOutlet NoodleTableView *_stickyRowTableView;
IBOutlet NSTableView *_iPhoneTableView;
NSMutableArray *_names;
}
@end
|
#ifndef VECTOR_3F_H
#define VECTOR_3F_H
#include <iostream>
class Vector2f;
class Vector3f
{
public:
static const Vector3f ZERO;
static const Vector3f UP;
static const Vector3f RIGHT;
static const Vector3f FORWARD;
Vector3f( float f = 0.f );
Vector3f( float x, float y, float z );
Vector3f( const Vector2f& xy, float z );
Vector3f( float x, const Vector2f& yz );
// copy constructors
Vector3f( const Vector3f& rv );
// assignment operators
Vector3f& operator = ( const Vector3f& rv );
// no destructor necessary
// returns the ith element
const float& operator [] ( int i ) const;
float& operator [] ( int i );
float& x();
float& y();
float& z();
float x() const;
float y() const;
float z() const;
Vector2f xy() const;
Vector2f xz() const;
Vector2f yz() const;
Vector3f xyz() const;
Vector3f yzx() const;
Vector3f zxy() const;
float abs() const;
float absSquared() const;
void normalize();
Vector3f normalized() const;
Vector2f homogenized() const;
void negate();
// ---- Utility ----
operator const float* () const; // automatic type conversion for OpenGL
operator float* (); // automatic type conversion for OpenGL
void print() const;
Vector3f& operator += ( const Vector3f& v );
Vector3f& operator -= ( const Vector3f& v );
Vector3f& operator *= ( float f );
static float dot( const Vector3f& v0, const Vector3f& v1 );
static Vector3f cross( const Vector3f& v0, const Vector3f& v1 );
// computes the linear interpolation between v0 and v1 by alpha \in [0,1]
// returns v0 * ( 1 - alpha ) * v1 * alpha
static Vector3f lerp( const Vector3f& v0, const Vector3f& v1, float alpha );
// computes the cubic catmull-rom interpolation between p0, p1, p2, p3
// by t \in [0,1]. Guarantees that at t = 0, the result is p0 and
// at p1, the result is p2.
static Vector3f cubicInterpolate( const Vector3f& p0, const Vector3f& p1, const Vector3f& p2, const Vector3f& p3, float t );
private:
float m_elements[ 3 ];
};
// component-wise operators
Vector3f operator + ( const Vector3f& v0, const Vector3f& v1 );
Vector3f operator - ( const Vector3f& v0, const Vector3f& v1 );
Vector3f operator * ( const Vector3f& v0, const Vector3f& v1 );
Vector3f operator / ( const Vector3f& v0, const Vector3f& v1 );
// unary negation
Vector3f operator - ( const Vector3f& v );
// multiply and divide by scalar
Vector3f operator * ( float f, const Vector3f& v );
Vector3f operator * ( const Vector3f& v, float f );
Vector3f operator / ( const Vector3f& v, float f );
bool operator == ( const Vector3f& v0, const Vector3f& v1 );
bool operator != ( const Vector3f& v0, const Vector3f& v1 );
inline std::ostream& operator << ( std::ostream& os, const Vector3f& v)
{
os << "Vector3f <" << v[0] << ", " << v[1] << ", " << v[2] << ">";
return os;
}
#endif // VECTOR_3F_H
|
#ifndef PRINT_CONFIGURATION_H
#define PRINT_CONFIGURATION_H
#include <iomanip> // std::setw
#include <mutation_accumulation/configuration/configuration/configuration_interface.h> // monte_carlo::Configuration_Interface
#include <mutation_accumulation/simulation/files.h> // monte_carlo::open_file_for_output
/*************************************************************************/
namespace monte_carlo {
namespace print_utility {
/* if one of these two overloaded functions is deleted the other will take over by up- or down-casting tt */
inline void print_time(std::ostream &out_stream, const int &tt) {
out_stream << std::setw(10) << tt;
}
inline void print_time(std::ostream &out_stream, const double &tt) {
out_stream << std::setw(20) << std::setprecision(10) << tt;
}
}
/**
* print out state of Configuration_Interface object
*/
template <class time_type, class population_type>
std::ostream & operator<<(std::ostream &out_stream, const Configuration_Interface<time_type, population_type> &configuration) {
print_utility::print_time(out_stream, configuration.get_time());
for (int pop = 0; pop < configuration.number_sub_pops(); pop++)
for (int spe = 0; spe < configuration.number_species(); spe++)
out_stream << std::setw(20) << configuration.get_population(Pop(pop), Spe(spe)) << " ";
return out_stream;
}
/**
* print out time course of path object in Configuration_Interface object
*/
template <class time_type, class population_type>
void print_path(const Configuration_Interface<time_type, population_type> &configuration, const std::string &file_name) {
boost::shared_ptr<std::ofstream> ofstream_ptr = open_file_for_output(file_name);
for (int node = 0; node < configuration.number_filled_nodes(); node++) {
print_utility::print_time(*ofstream_ptr, configuration.get_path_time(Node(node)));
for (int pop = 0; pop < configuration.number_sub_pops(); pop++)
for (int spe = 0; spe < configuration.number_species(); spe++)
*ofstream_ptr << std::setw(20) << configuration.get_path_population(Pop(pop), Spe(spe), Node(node)) << " ";
*ofstream_ptr << std::endl;
}
}
}
#endif /* PRINT_CONFIGURATION_H */
|
/* $Id$ */
#ifndef MODULES_H
#define MODULES_H
#ifndef COMMON_CORE_H
# error You should include "common_core.h" first.
#endif
#ifdef MAX_CONFIG_MOD_NAME
# define MAX_MODULE_NAME MAX_CONFIG_MOD_NAME
#else
# define MAX_MODULE_NAME 40
#endif
struct module_t {
/* API version, *not* module version; check that module is
* compatible with this version of the server.
*/
int version;
/* API minor version. Provides API feature milestones. Not checked
* during module init. */
int minor_version;
/** Index to this modules structures in config vectors. */
int module_index;
/* type of module */
int type;
/* The module name. the name of the module's C file */
const char *name;
/* The handle for the DSO. Internal use only. */
void *dynamic_load_handle;
/* A pointer to the next module in the list */
module *next;
/* magic cookie to identify a module structure. see also mod_so */
unsigned long magic;
/* À ºÎºÐÀº *_MODULE_STUFF·Î Ç×»ó assign µÈ´Ù. */
config_t *config; /* configuration table */
registry_t *registry; /* registry of module */
int (*init)(void); /* initialize function of module */
int (*main)(slot_t*); /* main function of meta module */
scoreboard_t *scoreboard; /* status of processes and threads */
void (*register_hooks)(void); /* register hook api */
};
#define MODULE_MAGIC_NUMBER_MAJOR 1
#define MODULE_MAGIC_NUMBER_MINOR 1
#define CORE_MODULE_TYPE 0x10
#define STANDARD_MODULE_TYPE 0x20
#define TEST_MODULE_TYPE 0x40
#define STATIC_MODULE_TYPE 0x01
#define DYNAMIC_MODULE_TYPE 0x02
#define MODULE_MAGIC_COOKIE 0x53425448 /* "SB60" 0x53 for S, 0x42 for B, ..*/
#define STANDARD_MODULE_STUFF \
MODULE_MAGIC_NUMBER_MAJOR, \
MODULE_MAGIC_NUMBER_MINOR, \
-1, \
STANDARD_MODULE_TYPE, \
__FILE__,/* name */ \
NULL, /* dynamic load handle */ \
NULL, /* next module */ \
MODULE_MAGIC_COOKIE
#define CORE_MODULE_STUFF \
MODULE_MAGIC_NUMBER_MAJOR, \
MODULE_MAGIC_NUMBER_MINOR, \
-1, \
CORE_MODULE_TYPE, \
__FILE__,/* name */ \
NULL, /* dynamic load handle */ \
NULL, /* next module */ \
MODULE_MAGIC_COOKIE
#define TEST_MODULE_STUFF \
MODULE_MAGIC_NUMBER_MAJOR, \
MODULE_MAGIC_NUMBER_MINOR, \
-1, \
TEST_MODULE_TYPE, \
__FILE__,/* name */ \
NULL, /* dynamic load handle */ \
NULL, /* next module */ \
MODULE_MAGIC_COOKIE
extern SB_DECLARE_DATA module *first_module;
SB_DECLARE(module *)find_module(const char *mod_name);
SB_DECLARE(void) set_static_modules(module *list[]);
SB_DECLARE(int) load_static_modules(void);
SB_DECLARE(int) load_dynamic_modules(void);
SB_DECLARE(module*) load_module(const char *mod_struct_name,
const char *modulename,
char registry_only);
SB_DECLARE(module*) add_module(module *this, const char *mod_symbol_name);
SB_DECLARE(void) clear_module_list(void);
SB_DECLARE(int) init_core_modules(module *start_module);
SB_DECLARE(int) init_standard_modules(module *start_module);
SB_DECLARE(void) list_static_modules(FILE *out);
SB_DECLARE(void) list_static_modules_str(char *result);
SB_DECLARE(void) list_modules(FILE *out);
SB_DECLARE(void) list_modules_str(char *result);
SB_DECLARE(void) list_config(FILE *out, char *module_name);
SB_DECLARE(void) list_config_str(char *result, char *module_name);
#define DEFAULT_SERVER_PORT 8605
#define DEFAULT_SERVER_PORTSTR "8605"
extern SB_DECLARE_DATA int gSoftBotListenPort;
SB_DECLARE(int) assignSoftBotPort(const char *modname, char module_portid);
SB_DECLARE(void) show_portinfo();
/* XXX this must move to server.h */
SB_DECLARE(void) do_unittest();
#endif
|
#ifndef __RTC_H__
#define __RTC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <xboot.h>
struct rtc_time_t {
u8_t second;
u8_t minute;
u8_t hour;
u8_t week;
u8_t day;
u8_t month;
u16_t year;
};
struct rtc_t
{
/* The rtc name */
char * name;
/* Set rtc time */
bool_t (*settime)(struct rtc_t * rtc, struct rtc_time_t * time);
/* Get rtc time */
bool_t (*gettime)(struct rtc_t * rtc, struct rtc_time_t * time);
/* Private data */
void * priv;
};
struct rtc_t * search_rtc(const char * name);
struct rtc_t * search_first_rtc(void);
struct device_t * register_rtc(struct rtc_t * rtc, struct driver_t * drv);
void unregister_rtc(struct rtc_t * rtc);
bool_t rtc_settime(struct rtc_t * rtc, struct rtc_time_t * time);
bool_t rtc_gettime(struct rtc_t * rtc, struct rtc_time_t * time);
#ifdef __cplusplus
}
#endif
#endif /* __RTC_H__ */
|
#ifndef MENU_H
#define MENU_H
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
class Menu
{
public:
Menu();
void setDisplay(Adafruit_PCD8544 *display);
void display(int val);
void checkButton();
private:
void showSaved();
void showOptions(int value);
Adafruit_PCD8544 *_display;
int pos = 0;
unsigned char upDown[7];
const int btnUp = 7;
const int btnDown = 6;
const int btnSelect = 5;
int eePos = 1;
};
#endif //Menu_h
|
//=========================================================
// src/c2-printf_main.c: generated by Hardware Configurator
//
// This file will be updated when saving a document.
// leave the sections inside the "$[...]" comment tags alone
// or they will be overwritten!!
//=========================================================
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <SI_EFM8BB1_Register_Enums.h> // SFR declarations
#include "InitDevice.h"
#include <stdio.h>
// $[Generated Includes]
// [Generated Includes]$
//-----------------------------------------------------------------------------
// SiLabs_Startup() Routine
// ----------------------------------------------------------------------------
// This function is called immediately after reset, before the initialization
// code is run in SILABS_STARTUP.A51 (which runs before main() ). This is a
// useful place to disable the watchdog timer, which is enable by default
// and may trigger before main() in some instances.
//-----------------------------------------------------------------------------
void SiLabs_Startup (void)
{
// Call hardware initialization routine
}
uint8_t xdata printData[255] _at_ 0x000; /* array at xdata 0x000 */
//-----------------------------------------------------------------------------
// main() Routine
// ----------------------------------------------------------------------------
int main (void)
{
int i, size;
enter_DefaultMode_from_RESET();
for(i = 0;i<sizeof(printData); i++)
{
printData[i] = 0;
}
while (1)
{
i = 0;
while(1) {
i++;
size = sprintf(printData, "Hello, world #%u!\n", i); // print "Hello, world #0 (etc)
printData[254] = size; // tell the computer how many bytes to transfer
while(printData[254] != 0); // wait for the computer software to reset our flag
}
}
}
|
int
main(int argc, const char *argv[])
{
int fd, flags;
const char *path;
if (argc < 2)
return (1);
path = argv[1];
fd = open(path, O_RDWR);
if (fd == -1)
return (2);
flags = fcntl(fd, F_GETFL);
if (flags == -1)
return (3);
return ((O_ACCMODE & flags) == O_RDWR ? 0 : 4);
}
|
extern zend_class_entry *ouchbase_entitymanager_ce;
ZEPHIR_INIT_CLASS(Ouchbase_EntityManager);
PHP_METHOD(Ouchbase_EntityManager, __construct);
PHP_METHOD(Ouchbase_EntityManager, registerManagedEntityClass);
PHP_METHOD(Ouchbase_EntityManager, registerManagedEntityClasses);
PHP_METHOD(Ouchbase_EntityManager, getRepository);
PHP_METHOD(Ouchbase_EntityManager, getCachedRepository);
PHP_METHOD(Ouchbase_EntityManager, persist);
PHP_METHOD(Ouchbase_EntityManager, delete);
PHP_METHOD(Ouchbase_EntityManager, refresh);
PHP_METHOD(Ouchbase_EntityManager, flush);
PHP_METHOD(Ouchbase_EntityManager, clear);
PHP_METHOD(Ouchbase_EntityManager, update);
PHP_METHOD(Ouchbase_EntityManager, getConnection);
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager___construct, 0, 0, 1)
ZEND_ARG_INFO(0, couchbase)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_registermanagedentityclass, 0, 0, 2)
ZEND_ARG_INFO(0, entityClassName)
ZEND_ARG_INFO(0, entityRepositoryClassName)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_registermanagedentityclasses, 0, 0, 1)
ZEND_ARG_INFO(0, map)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_getrepository, 0, 0, 1)
ZEND_ARG_INFO(0, entityClassName)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_getcachedrepository, 0, 0, 1)
ZEND_ARG_INFO(0, repositoryClassName)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_persist, 0, 0, 1)
ZEND_ARG_INFO(0, entity)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_delete, 0, 0, 1)
ZEND_ARG_INFO(0, entity)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_refresh, 0, 0, 1)
ZEND_ARG_INFO(0, entity)
ZEND_ARG_INFO(0, concurrent)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ouchbase_entitymanager_update, 0, 0, 2)
ZEND_ARG_INFO(0, entity)
ZEND_ARG_INFO(0, callback)
ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(ouchbase_entitymanager_method_entry) {
PHP_ME(Ouchbase_EntityManager, __construct, arginfo_ouchbase_entitymanager___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Ouchbase_EntityManager, registerManagedEntityClass, arginfo_ouchbase_entitymanager_registermanagedentityclass, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, registerManagedEntityClasses, arginfo_ouchbase_entitymanager_registermanagedentityclasses, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, getRepository, arginfo_ouchbase_entitymanager_getrepository, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, getCachedRepository, arginfo_ouchbase_entitymanager_getcachedrepository, ZEND_ACC_PROTECTED)
PHP_ME(Ouchbase_EntityManager, persist, arginfo_ouchbase_entitymanager_persist, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, delete, arginfo_ouchbase_entitymanager_delete, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, refresh, arginfo_ouchbase_entitymanager_refresh, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, flush, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, clear, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, update, arginfo_ouchbase_entitymanager_update, ZEND_ACC_PUBLIC)
PHP_ME(Ouchbase_EntityManager, getConnection, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
|
//
// LockerViewController.h
// Meiei
//
// Created by lanou3g on 15/11/17.
// Copyright © 2015年 南南南. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LockerViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@end
|
/**
* main 函数参数处理
*/
#ifndef _PREDEAL_H
#define _PREDEAL_H
#include <string>
using namespace std;
class PreDeal {
private:
int _argc;
char** _argv;
string _err_msg;
string _app_name;
public:
PreDeal(int argc, char *argv[], const string& err_msg = "");
void appName(const string appname);
void set_err_msg(const string& err_msg);
void operator() (int& port, string& IpList, string& code);
private:
void print_err();
int atoi_port(const char* port_s); //转换成正整数
};
#endif // _PRESEAL_H
|
#include "task.h"
size_t sim_memsize(int n) {
return (n * n + n) * sizeof(long double);
}
void copy_tmp_to_A(long double *A, long double *tmp, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
A[i * n + j] = tmp[i * n + j];
}
}
}
int sim(int n, long double* A, long double* tmp, long double precision) {
long double *xa = &tmp[n * n];
for (int step = 0; step < n - 2; step++) {
int indent = step + 1;
if (_DEBUG) printf("\n**Step #%d**\n", indent);
if (_DEBUG) printf("Extracting vector a and computing it's norm\n");
xa[step] = 0.;
long double norm_a = 0.;
for (int i = indent; i < n; i++) {
xa[i] = A[i * n + step];
norm_a += xa[i] * xa[i];
}
norm_a = sqrt(norm_a);
if (_DEBUG) printf("Computing vector x\n");
xa[indent] -= norm_a;
long double norm_x = 0.;
for (int i = indent; i < n; i++) {
norm_x += xa[i] * xa[i];
}
norm_x = sqrt(norm_x);
if (fabsl(norm_x) < precision) {
continue;
}
for (int i = indent; i < n; i++) {
xa[i] /= norm_x;
}
if (_DEBUG) printf("Computing A_%d\n", indent);
if (_DEBUG) printf("U * A\n");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
tmp[i * n + j] = 0.;
for (int k = 0; k < n; k++) {
long double U;
if (i == k) {
U = 1 - 2 * xa[i] * xa[k];
} else {
U = -2 * xa[i] * xa[k];
}
tmp[i * n + j] += U * A[k * n + j];
}
}
}
copy_tmp_to_A(A, tmp, n);
if (_DEBUG) printf("U * A * U\n");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
tmp[i * n + j] = 0.;
for (int k = 0; k < n; k++) {
long double U;
if (k == j) {
U = 1 - 2 * xa[k] * xa[j];
} else {
U = -2 * xa[k] * xa[j];
}
tmp[i * n + j] += A[i * n + k] * U;
}
}
}
copy_tmp_to_A(A, tmp, n);
}
if (_DEBUG) {
printf("\nА:\n");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
printf("%.9LF\t", A[i * n + j]);
}
printf("\n");
}
}
return 0;
}
|
//
// NSString+SBRXCallbackURL.h
// XCallbackURLParserDemo
//
// Created by Sebastian Rehnby on 8/8/13.
// Copyright (c) 2013 Sebastian Rehnby. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (SBRXCallbackURL)
- (NSString *)sbr_URLEncode;
- (NSString *)sbr_URLDecode;
@end
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double PantryVersionNumber;
FOUNDATION_EXPORT const unsigned char PantryVersionString[];
|
//
// LConfigureEntity.h
//
// Created by Liu Stuart on 15/5/29.
// Copyright (c) 2015年 Lines. All rights reserved.
//
#import <Foundation/Foundation.h>
// a structure used for network configuration xml file
// each LConfigureEntity stands for an entry in configure file, that's xml file is an dictionary with each value = LConfigureEntity
@interface LConfigureEntity : NSObject <NSCoding>
/// url string, the param will be "%@", for convenience in "get", no "%@" in "post"
@property (nonatomic, strong) NSString *url;
/// string array, each string stand for a param name in "post", or only an occupition in "get"
@property (nonatomic, strong) NSArray *params;
/// result's class name
@property (nonatomic, strong) NSString *resultType;
/// @"get" or @"post", in lowwer case
@property (nonatomic, strong) NSString *method;
/// how long the data should be cachec, unit: seconds
@property (nonatomic, assign) NSUInteger cacheSeconds;
/// YES, using https connection, NO, using http
@property (nonatomic, assign) BOOL isSecure;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_file_w32spawnl_54e.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-54e.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: file Read input from a file
* GoodSource: Fixed string
* Sink: w32spawnl
* BadSink : execute command with spawnl
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <process.h>
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE78_OS_Command_Injection__char_file_w32spawnl_54e_badSink(char * data)
{
/* spawnl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
_spawnl(_P_WAIT, COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_file_w32spawnl_54e_goodG2BSink(char * data)
{
/* spawnl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
_spawnl(_P_WAIT, COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITGOOD */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE194_Unexpected_Sign_Extension__negative_malloc_66b.c
Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml
Template File: sources-sink-66b.tmpl.c
*/
/*
* @description
* CWE: 194 Unexpected Sign Extension
* BadSource: negative Set data to a fixed negative number
* GoodSource: Positive integer
* Sinks: malloc
* BadSink : Allocate memory using malloc() with the size of data
* Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE194_Unexpected_Sign_Extension__negative_malloc_66b_badSink(short dataArray[])
{
/* copy data out of dataArray */
short data = dataArray[2];
/* Assume we want to allocate a relatively small buffer */
if (data < 100)
{
/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,
* the conversion will cause malloc() to allocate a very large amount of data or fail */
char * dataBuffer = (char *)malloc(data);
/* Do something with dataBuffer */
memset(dataBuffer, 'A', data-1);
dataBuffer[data-1] = '\0';
printLine(dataBuffer);
free(dataBuffer);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE194_Unexpected_Sign_Extension__negative_malloc_66b_goodG2BSink(short dataArray[])
{
short data = dataArray[2];
/* Assume we want to allocate a relatively small buffer */
if (data < 100)
{
/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,
* the conversion will cause malloc() to allocate a very large amount of data or fail */
char * dataBuffer = (char *)malloc(data);
/* Do something with dataBuffer */
memset(dataBuffer, 'A', data-1);
dataBuffer[data-1] = '\0';
printLine(dataBuffer);
free(dataBuffer);
}
}
#endif /* OMITGOOD */
|
//
// Created by Mark van der Broek on 27/02/2017.
//
#ifndef ORACS_DEPOT_H
#define ORACS_DEPOT_H
#include <vector>
#include "../inc/vehicle.h"
#include <fstream>
class Env;
/**
* Depot is a class which holds a vehicle list and has a limited inventory.
*/
class Depot {
Env * d_env; /*!< Environment pointer */
int d_id; /*!< ID of the depot */
std::vector<Vehicle> d_vehicles; /*!< Vector of vehicles of the depot */
int d_inventory; /*!< Total inventoryof the depot */
int d_leftOverInventory; /*!< Leftover inventory of the depot */
public:
Depot() = delete;
Depot(Env *env, int id, int leftOverInventory);
Depot(Env *env, int id, std::vector<Vehicle> &vehicles, int leftOverInventory);
std::vector<Vehicle> & getVehicles();
Vehicle & getVehicle(int vehicleNumber);
int getID();
int getNumberOfVehicles();
int getLeftOverInventory() const;
int getInventory() const;
void changeInventory(int amount);
void updateInventory();
void addVehicle(Vehicle vehicle);
friend std::ostream& operator<<(std::ostream &os, Depot const &depot);
};
/**
* Get the list of vehicles.
* @return Vector of vehicles
*/
inline std::vector<Vehicle> &Depot::getVehicles()
{
return d_vehicles;
}
/**
* Get the vehicle with position vehicleNumber.
* @param vehicleNumber Position of the vehicle within the vehicle vector
* @return Vehicle to be selected
*/
inline Vehicle &Depot::getVehicle(int vehicleNumber)
{
return d_vehicles[vehicleNumber];
}
/**
* Get ID of the depot.
* @return ID of the depot
*/
inline int Depot::getID()
{
return d_id;
}
/**
* Get number of vehicles within the depot.
* @return Number of vehicles within the depot
*/
inline int Depot::getNumberOfVehicles()
{
return d_vehicles.size();
}
/**
* Change the left over inventory of the depot.
* @param amount Amount the change the inventory with
*/
inline void Depot::changeInventory(int amount)
{
d_leftOverInventory += amount;
}
/**
* Get the total inventory of the depot.
* @return Total inventory of the depot
*/
inline int Depot::getInventory() const
{
return d_inventory;
}
/**
* Add vehicle to the depot.
* @param vehicle Vehicle to be added
*/
inline void Depot::addVehicle(Vehicle vehicle)
{
d_vehicles.push_back(vehicle);
}
#endif //ORACS_DEPOT_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_44.c
Label Definition File: CWE124_Buffer_Underwrite__malloc.label.xml
Template File: sources-sink-44.tmpl.c
*/
/*
* @description
* CWE: 124 Buffer Underwrite
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sinks: memcpy
* BadSink : Copy string to data using memcpy
* Flow Variant: 44 Data/control flow: data passed as an argument from one function to a function in the same source file called via a function pointer
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
static void badSink(wchar_t * data)
{
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(wchar_t));
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
/* INCIDENTAL CWE-401: Memory Leak - data may not point to location
* returned by malloc() so can't safely call free() on it */
}
}
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_44_bad()
{
wchar_t * data;
/* define a function pointer */
void (*funcPtr) (wchar_t *) = badSink;
data = NULL;
{
wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t));
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSink(wchar_t * data)
{
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(wchar_t));
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
/* INCIDENTAL CWE-401: Memory Leak - data may not point to location
* returned by malloc() so can't safely call free() on it */
}
}
static void goodG2B()
{
wchar_t * data;
void (*funcPtr) (wchar_t *) = goodG2BSink;
data = NULL;
{
wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t));
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
funcPtr(data);
}
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_44_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_44_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_44_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include <string.h>
static char *c_strcpy(char *dest, const char *src)
{
return strcpy(dest,src);
}
|
#define MICROPY_HW_BOARD_NAME "Sprite_v2b"
#define MICROPY_HW_MCU_NAME "samd51G19"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PB03)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA07)
#define DEFAULT_SPI_BUS_MISO (&pin_PA04)
#define DEFAULT_UART_BUS_TX (&pin_PB09)
#define DEFAULT_UART_BUS_RX (&pin_PB08)
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
|
//
// TextureManager.h
// yobatronika
//
// Created by Maxim Fedorenko on 07.04.15.
//
//
#ifndef yobatronika_TextureManager_h
#define yobatronika_TextureManager_h
#include <map>
#include <string>
#include <memory>
#include <SDL.h>
namespace Yoba {
class TextureManager {
private:
std::map<std::string, SDL_Texture*> m_textureMap;
static std::shared_ptr<TextureManager> m_spInstance;
/// \todo other constructors
TextureManager(){};
public:
~TextureManager();
bool load(std::string fileName, std::string id, SDL_Renderer *pRenderer);
void draw(std::string id, int x, int y, int width, int height,
SDL_Renderer *pRenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);
void drawFrame(std::string id, int x, int y, int width, int height, int currentRow, int currentFrame,
SDL_Renderer *pRenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);
void clearFromTextureMap(std::string id);
void clean();
static std::shared_ptr<TextureManager> Instance();
static void DeleteInstance();
};
}
#endif
|
#pragma once
#include "stdafx.h"
namespace NumericOptimization { namespace AutomaticDifferentiation {
/*
Interface for Automatic Differentiation implemented through operator overloading method
*/
template <class NumericType> class IDifferentiableNumber {
public:
virtual ~IDifferentiableNumber() {};
// Setters/Getters
virtual inline NumericType GetFunctionValue() const = 0;
virtual inline NumericType GetDerivative( __in const size_t index ) const = 0;
virtual inline size_t GetDiffCount() const = 0;
virtual inline void SetFunctionValue( __in const NumericType value ) = 0;
virtual inline HRESULT SetDifferentiation( __in const size_t totalDiffs, __in const size_t diffIx ) = 0;
virtual inline void SetDerivativeValue( __in const size_t index, __in const NumericType value ) = 0;
};
} } |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void ex1(){
srand(time(NULL));
FILE *aula;
aula = fopen("aula.txt", "w+");
for(int k = 0; k<10; k++) fprintf(aula, "I like %d peannuts.\n", rand()%6000);
rewind(aula);
char teste[10][25];
for(int k = 0; k<10; k++){
fgets(teste[k], 25, aula);
printf("%s\n", teste[k]);
}
rewind(aula);
int a;
while(fscanf(aula, "%*s %*s %d %*s\n", &a) != EOF) printf("%d\n", a);
fclose(aula);
}
void ex2(){
FILE *linhas, *linhas2;
linhas = fopen("linhas.txt", "r");
linhas2 = fopen("linhas2.txt", "w+");
char linha[50];
while(fgets(linha, 50, linhas) != NULL){
if(linha[0] != '#'){
fprintf(linhas2, "%s", linha);
printf("%s", linha);
}
}
fclose(linhas);
fclose(linhas2);
}
int main(){
ex2();
return 0;
}
|
#ifndef CAMERA_COMPONENT_H
#define CAMERA_COMPONENT_H
#include "Component.h"
#include <SFML/Graphics/View.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include "QueuedVector.h"
class RendererComponent;
namespace sf
{
class RenderTarget;
}
class CameraComponent
:public Component
{
public:
CameraComponent();
void SetViewport(float x, float y, float width, float height);
void SetOrthoSize(float size);
void OnSignalingInitiazation() override;
void OnDestruction() override;
void SetLayerMask(int mask);
void Render(QueuedVector<RendererComponent*> const& gObjects);
void Zoom(float factor);
sf::Vector2f ScreenToWorldSpace(sf::Vector2i const& pos) const;
void Awake() override;
void SetRenderTarget(sf::RenderTarget* target);
inline sf::View const& GetView() const { return m_View; }
inline bool ShouldRenderLayer(int layer) { return (layer & m_LayerMask) == layer; };
private:
void AdjustScreenSize();
void ApplyView();
sf::View m_View;
float m_OrthoSize;
int m_LayerMask;
sf::RenderTarget* m_RenderTarget;
};
#endif |
/*
File: DLG.H
Author: Patrick Reilly (TeamB) CIS: 71333,2764
Date: 9/16/93
Desc: Header file for ScrollGroup and ScrollDialog classes.
This file is the header file for a pair of classes that allow use of a
scroll-able dialog box. It is designed for (but doesn't require) a TV.H-like
master header file with the following lines:
...
#ifdef Uses_ScrollDialog
#define Uses_TDialog
#define INC_DLG_H
#endif
#ifdef Uses_ScrollGroup
#define Uses_TGroup
#define INC_DLG_H
#endif
...
#include <tv.h>
...
#ifdef INC_DLG_H
#include "Dlg.h"
#endif
...
*/
#if defined(Uses_ScrollGroup) && !defined(Def_ScrollGroup)
#define Def_ScrollGroup
class TRect;
class TScrollBar;
class TEvent;
class TBackground;
class ScrollGroupInit
{
public:
ScrollGroupInit(TBackground* (*fn)(TRect)) : bkgdMaker(fn)
{}
TBackground* (*bkgdMaker)(TRect);
};
class ScrollGroup : public TGroup, public virtual ScrollGroupInit
{
public:
ScrollGroup(const TRect&, TScrollBar*, TScrollBar*);
virtual void changeBounds(const TRect&);
virtual void handleEvent(TEvent&);
virtual void scrollDraw();
virtual void scrollTo(int, int);
virtual void setLimit(int, int);
virtual void setState(ushort, Boolean);
virtual void focusSubView(TView*);
static TBackground* initBackground(TRect);
TScrollBar* hScrollBar;
TScrollBar* vScrollBar;
TBackground* background;
TPoint delta;
TPoint limit;
};
#endif
#if defined(Uses_ScrollDialog) && !defined(Def_ScrollDialog)
#define Def_ScrollDialog
class TRect;
class TEvent;
class ScrollGroup;
const ushort sbHorBar = 0x0001;
const ushort sbVerBar = 0x0002;
class ScrollDialog : public TDialog
{
public:
ScrollDialog(const TRect&, const char*, ushort);
virtual void handleEvent(TEvent&);
ScrollGroup* scrollGroup;
};
#endif
|
/***************************************************************************
DCCObject.h
-------------------
begin : Wed Jul 2 15:23:24 CDT 2003
copyright : (C) 2005 by Andrew Ruder
email : aeruder@ksu.edu
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
@class DCCObject, DCCSendObject, DCCReceiveObject, NSString, NSDictionary, NSData;
NSString *BuildDCCSendRequest(NSDictionary *info);
extern NSString *DCCStatusTransferring;
extern NSString *DCCStatusError;
extern NSString *DCCStatusTimeout;
extern NSString *DCCStatusDone;
extern NSString *DCCStatusConnecting;
extern NSString *DCCStatusAborted;
extern NSString *DCCInfoFileName; //NSString
extern NSString *DCCInfoFileSize; //NSNumber
extern NSString *DCCInfoPort; //NSNumber
extern NSString *DCCInfoHost; //NSHost
extern NSString *DCCInfoNick; //NSString
#ifndef DCCOBJECT_H
#define DCCOBJECT_H
/* The DCC support's ideas(and much of the code) came mostly from
* Juan Pablo Mendoza <jpablo@gnome.org>
*/
@protocol DCCObjectDelegateProtocol
- DCCInitiated: aConnection;
- DCCStatusChanged: (NSString *)aStatus forObject: aConnection;
- DCCReceivedData: (NSData *)data forObject: aConnection;
- DCCDone: aConnection;
- DCCNeedsMoreData: aConnection;
@end
#import <Foundation/NSObject.h>
#import <netclasses/NetBase.h>
#import <netclasses/NetTCP.h>
#include <stdint.h>
@interface DCCObject : NSObject < NetObject >
{
uint32_t transferredBytes;
id delegate;
NSString *status;
NSDictionary *info;
NSDictionary *userInfo;
id transport;
}
- initWithDelegate: aDelegate withInfo: (NSDictionary *)info
withUserInfo: (NSDictionary *)userInfo;
- (uint32_t)transferredBytes;
- (void)abortConnection;
- (void)connectionLost;
- connectionEstablished: (id <NetTransport>)aTransport;
- dataReceived: (NSData *)data;
- transport;
- (NSString *)status;
- (NSDictionary *)info;
- (NSDictionary *)userInfo;
@end
@interface DCCReceiveObject : DCCObject < TCPConnecting >
{
id connection;
}
- initWithReceiveOfFile: (NSDictionary *)info
withDelegate: aDelegate
withTimeout: (int)seconds
withUserInfo: (NSDictionary *)userInfo;
- connectingFailed: (NSString *)error;
- connectingStarted: (TCPConnecting *)aConnection;
@end
@interface DCCSendObject : DCCObject
{
TCPPort *port;
NSTimer *timeout;
uint32_t blockSize;
uint32_t confirmedBytes;
NSMutableData *receivedData;
NSMutableData *dataToWrite;
BOOL noMoreData;
}
- initWithSendOfFile: (NSString *)name
withSize: (NSNumber *)size
withDelegate: aDelegate
withTimeout: (int)seconds
withBlockSize: (uint32_t)numBytes
withUserInfo: (NSDictionary *)userInfo;
- initWithSendOfFile: (NSString *)name
withSize: (NSNumber *)size
withDelegate: aDelegate
withTimeout: (int)seconds
withBlockSize: (uint32_t)numBytes
withUserInfo: (NSDictionary *)userInfo
withPort: (int)low to: (int)high;
- writeData: (NSData *)someData;
- (uint32_t)blockSize;
@end
#endif
|
#include "boot.h"
#include "cpustr.h"
static char *cpu_name(int level)
{
static char buf[6];
if (level == 64) {
return "x86-64";
} else {
if (level == 15)
level = 6;
sprintf(buf, "i%d86", level);
return buf;
}
}
int validate_cpu(void)
{
u32 *err_flags;
int cpu_level, req_level;
const unsigned char *msg_strs;
check_cpu(&cpu_level, &req_level, &err_flags);
if (cpu_level < req_level) {
printf("This kernel requires an %s CPU, ",
cpu_name(req_level));
printf("but only detected an %s CPU.\n",
cpu_name(cpu_level));
return -1;
}
if (err_flags) {
int i, j;
puts("This kernel requires the following features "
"not present on the CPU:\n");
msg_strs = (const unsigned char *)x86_cap_strs;
for (i = 0; i < NCAPINTS; i++) {
u32 e = err_flags[i];
for (j = 0; j < 32; j++) {
if (msg_strs[0] < i ||
(msg_strs[0] == i && msg_strs[1] < j)) {
msg_strs += 2;
while (*msg_strs++)
;
}
if (e & 1) {
if (msg_strs[0] == i &&
msg_strs[1] == j &&
msg_strs[2])
printf("%s ", msg_strs+2);
else
printf("%d:%d ", i, j);
}
e >>= 1;
}
}
putchar('\n');
return -1;
} else {
return 0;
}
}
|
/**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2022 UniPro <ugene@unipro.ru>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _U2_READ_ASSEMBLY_TASK_
#define _U2_READ_ASSEMBLY_TASK_
#include <U2Lang/ReadDocumentTaskFactory.h>
namespace U2 {
class Document;
class DocumentFormat;
class DocumentProviderTask;
namespace Workflow {
class ConvertToIndexedBamTask;
class WorkflowContext;
class ReadAssemblyTask : public ReadDocumentTask {
Q_OBJECT
public:
ReadAssemblyTask(const QString& url, const QString& datasetName, WorkflowContext* ctx);
virtual void prepare();
virtual void run();
virtual QList<Task*> onSubTaskFinished(Task* subTask);
private:
WorkflowContext* ctx;
DocumentFormat* format;
Document* doc;
ConvertToIndexedBamTask* convertTask;
DocumentProviderTask* importTask;
};
class ConvertToIndexedBamTask : public Task {
public:
ConvertToIndexedBamTask(const DocumentFormatId& formatId, const GUrl& url, WorkflowContext* ctx);
virtual void run();
GUrl getResultUrl() const;
const QStringList& getConvertedFiles() const;
private:
DocumentFormatId formatId;
GUrl url;
GUrl result;
WorkflowContext* ctx;
QStringList convertedFiles;
private:
void addConvertedFile(const GUrl& url);
};
class ReadAssemblyTaskFactory : public ReadDocumentTaskFactory {
public:
ReadAssemblyTaskFactory();
virtual ReadDocumentTask* createTask(const QString& url, const QVariantMap& hints, WorkflowContext* ctx);
};
} // namespace Workflow
} // namespace U2
#endif // _U2_READ_ASSEMBLY_TASK_
|
#define NMAX 10
#define NDIM 3
|
#include <stdio.h>
#include "common.h"
#include <termios.h>
#include <unistd.h>
#include <errno.h>
#define ECHOFLAGS (ECHO | ECHOE | ECHOK | ECHONL)
//#define DUBUG
/**************************************
*函数set_disp_mode用于控制是否开启输入回显功能
*如果option为0,则关闭回显,为1则打开回显
**************************************/
int set_disp_mode(int fd,int option)
{
int err;
struct termios term;
if(tcgetattr(fd,&term)==-1){
perror("Cannot get the attribution of the terminal");
return 1;
}
if(option)
term.c_lflag|=ECHOFLAGS;
else
term.c_lflag &=~ECHOFLAGS;
err=tcsetattr(fd,TCSAFLUSH,&term);
if(err==-1 && err==EINTR){
perror("Cannot set the attribution of the terminal");
return 1;
}
return 0;
}
int main (int argc, char *argv[])
{
int fd = open("/home/farsight/samba/server/record.txt",O_RDWR | O_APPEND | O_CREAT, 0666);
if(-1 == fd)
{
perror("open");
return -1;
}
Record buf;
bzero(&buf,sizeof(buf));
#ifdef DUBUG
/*打印出当前所有注册的用户*/
lseek(fd, 0, SEEK_SET);
while(read(fd, &buf, sizeof(buf)))
{
printf("%s,%s\n",buf.name,buf.passwd);
}
#endif
/*注册*/
while(1)
{
char temp[50];
printf("Input your name:");fflush(stdout);
gets(buf.name);
set_disp_mode(STDIN_FILENO,0);
printf("Input your password:");fflush(stdout);
gets(buf.passwd);
putchar('\n');
printf("Input your password again:");fflush(stdout);
gets(temp);
putchar('\n');
set_disp_mode(STDIN_FILENO,1);
if( 0 != strcmp(temp,buf.passwd))
{
printf("Two input password is not the same!\n");
continue;
}
else
{
lseek(fd, 0 , SEEK_END);
write(fd,&buf,sizeof(buf));
printf("Continue to register? y/n\n");
gets(temp);
if('y' == *temp)
{
continue;
}
else
{
break;
}
}
}
#ifdef DUBUG
/*打印出当前所有注册的用户*/
lseek(fd, 0, SEEK_SET);
while(read(fd, &buf, sizeof(buf)))
{
printf("%s,%s\n",buf.name,buf.passwd);
}
#endif
return 0;
}
|
/*
* =====================================================================================
*
* Filename: null.c
*
* Description: null, '\0', 0
*
* Version: 1.0
* Created: 04/18/13 21:09:56
* Revision: none
* Compiler: gcc
*
* Author: Li Xiang (gk), lixiang-best@163.com
* Company: Li Xiang in Xiamen China.
*
* =====================================================================================
*/
#include<stdio.h>
int main(void){
printf("NULL=%d\n",NULL);
printf("\\0=%d\n",'\0');
printf("0=%d\n",0);
exit(0);
}
|
/*
* Copyright (c) 2006 Atheros Communications Inc.
* All rights reserved.
*
* $ATH_LICENSE_HOSTSDK0_C$
*
*/
/*
* Copyright (c) 2013 Qualcomm Atheros, Inc.
* All Rights Reserved.
* Qualcomm Atheros Confidential and Proprietary.
*/
#ifndef _ATH_TESTCMD_LIB_H
#define _ATH_TESTCMD_LIB_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _AthDataRate {
ATH_RATE_1M,
ATH_RATE_2M,
ATH_RATE_5_5M,
ATH_RATE_11M,
ATH_RATE_6M,
ATH_RATE_9M,
ATH_RATE_12M,
ATH_RATE_18M,
ATH_RATE_24M,
ATH_RATE_36M,
ATH_RATE_48M,
ATH_RATE_54M,
ATH_RATE_6_5M,
ATH_RATE_13M,
ATH_RATE_19_5M,
ATH_RATE_26M,
ATH_RATE_39M,
ATH_RATE_52M,
ATH_RATE_58_5M,
ATH_RATE_65M,
ATH_RATE_HT40_13_5M,
ATH_RATE_HT40_27M,
ATH_RATE_HT40_40_5M,
ATH_RATE_HT40_54M,
ATH_RATE_HT40_81M,
ATH_RATE_HT40_108M,
ATH_RATE_HT40_121_5M,
ATH_RATE_HT40_135M,
} AthDataRate;
typedef enum _AthHtMode {
ATH_NOHT,
ATH_HT20,
ATH_HT40Minus,
ATH_HT40Plus,
} AthHtMode;
int athApiInit(void);
void athApiCleanup(void);
void athChannelSet(int channel);
void athRateSet(AthDataRate r);
void athTxPowerSet(int txpwr);
void athHtModeSet(AthHtMode mode);
/** @breif Enable long preamble */
int athSetLongPreamble(int enable);
/** @breif Set the interval between frames in aifs number
* @param slot aifs slot 0->SIFS, 1->PIFS, 2->DIFS, ... 253 */
void athSetAifsNum(int slot);
void athTxPacketSizeSet(int size);
void athShortGuardSet(int enable);
int athTxSineStart(void);
int athTx99Start(void);
int athTxFrameStart(void);
int athTxStop(void);
int athRxPacketStart(void);
int athRxPacketStop(void);
uint32_t athRxGetErrorFrameNum(void);
uint32_t athRxGetGoodFrameNum(void);
const char *athGetErrorString(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
|
/* MateComponent component browser
*
* AUTHORS:
* Dan Siemon <dan@coverfire.com>
* Rodrigo Moya <rodrigo@mate-db.org>
* Patanjali Somayaji <patanjali@morelinux.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 Library 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "matecomponent-browser.h"
#include <matecomponent/matecomponent-main.h>
#include <gtk/gtk.h>
#ifdef ENABLE_NLS
#include <locale.h>
#endif
int
main (int argc, char *argv [])
{
#ifdef ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, MATECOMPONENT_SUPPORT_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
gtk_init (&argc, &argv);
matecomponent_init (&argc, argv);
matecomponent_browser_create_window ();
/* run the application */
matecomponent_main ();
return 0;
}
|
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.arch = MODULE_ARCH_INIT,
};
MODULE_INFO(intree, "Y");
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x8d25670a, "module_layout" },
{ 0x53732bc8, "kmalloc_caches" },
{ 0x15692c87, "param_ops_int" },
{ 0x2e5810c6, "__aeabi_unwind_cpp_pr1" },
{ 0xa50e1be3, "i2c_transfer" },
{ 0xfa2a45e, "__memzero" },
{ 0x27e1a049, "printk" },
{ 0xcf19421f, "kmem_cache_alloc_trace" },
{ 0x37a0cba, "kfree" },
{ 0x9d669763, "memcpy" },
{ 0xefd6cf06, "__aeabi_unwind_cpp_pr0" },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
|
#ifndef __CONFIG_H_
#define __CONFIG_H_
#define POT_MTD "/dev/mtd12"
#define POT_FILENAME "/tmp/pot_value"
#define POT_MAX_VALUE 4320 /* 4320 minutes */
#define POT_RESOLUTION 1 /* minute */
#define POT_PORT 3333 /* potval listen this port */
#define NAND_FLASH_BLOCKSIZE (128 * 1024) /* bytes, 128KB */
#define NAND_FLASH_PAGESIZE 2048
#define FIRST_NTP_TIME_OFFSET (2 * NAND_FLASH_BLOCKSIZE)
#define FIRST_WIFISTATION_MAC_OFFSET (FIRST_NTP_TIME_OFFSET + NAND_FLASH_PAGESIZE)
#endif
|
//
// distoneonx.h
// physher
//
// Created by mathieu on 9/7/20.
// Copyright © 2020 Mathieu Fourment. All rights reserved.
//
#ifndef distoneonx_h
#define distoneonx_h
#include "distmodel.h"
#include "hashtable.h"
#include "mjson.h"
#include "parameters.h"
DistributionModel* new_OneOnXDistributionModel(Parameters* x);
Model* new_OneOnXDistributionModel_from_json(json_node* node, Hashtable* hash);
#endif /* distoneonx_h */
|
/*
* linux/drivers/cpufreq/cpufreq_performance.c
*
* Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/cpufreq.h>
#include <linux/init.h>
static int cpufreq_governor_performance(struct cpufreq_policy *policy,
unsigned int event)
{
switch (event) {
case CPUFREQ_GOV_START:
case CPUFREQ_GOV_LIMITS:
pr_debug("setting to %u kHz because of event %u\n",
policy->max, event);
__cpufreq_driver_target(policy, policy->max,
CPUFREQ_RELATION_H);
cpufreq_notify_utilization(policy, 100);
break;
default:
break;
}
return 0;
}
#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE_MODULE
static
#endif
struct cpufreq_governor cpufreq_gov_performance = {
.name = "performance",
.governor = cpufreq_governor_performance,
.owner = THIS_MODULE,
};
static int __init cpufreq_gov_performance_init(void)
{
return cpufreq_register_governor(&cpufreq_gov_performance);
}
static void __exit cpufreq_gov_performance_exit(void)
{
cpufreq_unregister_governor(&cpufreq_gov_performance);
}
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
MODULE_LICENSE("GPL");
fs_initcall(cpufreq_gov_performance_init);
module_exit(cpufreq_gov_performance_exit);
|
/* -*- mode:c -*- */
/* $Id: reuse_getsignalstring.c 6528 2011-11-25 18:08:26Z cher $ */
/* Copyright (C) 2002-2011 Alexander Chernov <cher@ejudge.ru> */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include "reuse_osdeps.h"
#include <stdio.h>
static const char * const signal_strings[] =
{
[0x5] = "Access violation",
[0x6] = "In page error",
[0x8] = "Invalid handle",
[0x17] = "No memory",
[0x1D] = "Illegal instruction",
[0x25] = "Noncontinuable exception",
[0x26] = "Invalid disposition",
[0x8C] = "Array bounds exceeded",
[0x8D] = "Denormal operand",
[0x8E] = "Divide by zero",
[0x8F] = "Inexact result",
[0x90] = "Float invalid operation",
[0x91] = "Float overflow",
[0x92] = "Float stack check",
[0x93] = "Float underflow",
[0x94] = "Integer divide by zero",
[0x95] = "Integer overflow",
[0x96] = "Privileged instruction",
[0xFD] = "Stack overflow",
[0x100] = "Software abort",
[0x13A] = "Control C Exit",
[0x142] = "DLL init failed",
[0x26B] = "DLL init failed logoff",
};
/**
* NAME: os_GetSignalString
* PURPOSE: get the signal name
* ARGS: s - signal number
* RETURN: string with the signal name
*/
const char *
os_GetSignalString(int s)
{
static char buf[128];
if (s > 0 && s < sizeof(signal_strings)/sizeof(signal_strings[0])
&& signal_strings[s]) {
snprintf(buf, sizeof(buf), "Exception 0x%X - %s",
(0xc0000000 | s), signal_strings[s]);
return buf;
}
snprintf(buf, sizeof(buf), "Exception 0x%X", (0xc0000000 | s));
return buf;
}
/*
* Local variables:
* compile-command: "make -C .."
* End:
*/
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2016 Google Inc.
* Copyright (C) 2016 Intel Corporation
*
* 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 2 of the License.
*
* 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.
*/
#include <arch/acpi.h>
#include <console/console.h>
#include <device/device.h>
#include <ec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <soc/nhlt.h>
#include "gpio.h"
static const char *oem_id_maxim = "GOOGLE";
static const char *oem_table_id_maxim = "EVEMAX";
static void mainboard_init(device_t dev)
{
mainboard_ec_init();
gpio_configure_pads(late_gpio_table, ARRAY_SIZE(late_gpio_table));
}
static unsigned long mainboard_write_acpi_tables(
device_t device, unsigned long current, acpi_rsdp_t *rsdp)
{
uintptr_t start_addr;
uintptr_t end_addr;
struct nhlt *nhlt;
start_addr = current;
nhlt = nhlt_init();
if (!nhlt)
return start_addr;
/* 4 Channel DMIC array */
if (nhlt_soc_add_rt5514(nhlt, AUDIO_LINK_SSP0, 4))
printk(BIOS_ERR, "Couldn't add rt5514.\n");
/* RT5663 Headset codec */
if (nhlt_soc_add_rt5663(nhlt, AUDIO_LINK_SSP1))
printk(BIOS_ERR, "Couldn't add headset codec.\n");
/* MAXIM98927 Smart Amps for left and right channel */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0))
printk(BIOS_ERR, "Couldn't add max98927\n");
end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr,
oem_id_maxim, oem_table_id_maxim, 0);
if (end_addr != start_addr)
acpi_add_table(rsdp, (void *)start_addr);
return end_addr;
}
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
dev->ops->acpi_inject_dsdt_generator = chromeos_dsdt_generator;
dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};
|
#ifndef TIMESCALEDRAW_H
#define TIMESCALEDRAW_H
#include <qwt_scale_draw.h>
#include <QDateTime>
#include <QTime>
class TimeScaleDraw : public QwtScaleDraw
{
public:
TimeScaleDraw();
~TimeScaleDraw();
virtual QwtText label(double v) const;
};
#endif // TIMESCALEDRAW_H
|
/*
* This file is part of eash
* Copyright (C) Remy Saissy <remy.saissy@gmail.com>
* eash 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.
* eash is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <vga.h>
#include <examour_api.h>
#include "commands.h"
#include "segments_ctl.h"
const command_t const segments_subcommands[] =
{
{"help", "?", "Help of the segments subcommands.", NULL, do_segments_help},
{NULL, NULL, NULL, NULL, NULL}
};
int do_segments_help(void)
{
puts("Segments commands list:\n");
list_commands(segments_subcommands);
return (0);
}
int do_segments_cs_ctl(void)
{
return (0);
}
int do_segments_ss_ctl(void)
{
return (0);
}
int do_segments_ds_ctl(void)
{
return (0);
}
int do_segments_es_ctl(void)
{
return (0);
}
int do_segments_fs_ctl(void)
{
return (0);
}
int do_segments_gs_ctl(void)
{
return (0);
}
int do_segments_get_sp(void)
{
return (0);
}
int do_segments_get_pc(void)
{
return (0);
}
|
/*
* Linux network driver for Brocade Converged Network Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* 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.
*/
/*
* Copyright (c) 2005-2011 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*/
#ifndef __BFA_MSGQ_H__
#define __BFA_MSGQ_H__
#include "bfa_defs.h"
#include "bfi.h"
#include "bfa_ioc.h"
#include "bfa_cs.h"
#define BFA_MSGQ_FREE_CNT(_q) \
(((_q)->consumer_index - (_q)->producer_index - 1) & ((_q)->depth - 1))
#define BFA_MSGQ_INDX_ADD(_q_indx, _qe_num, _q_depth) \
((_q_indx) = (((_q_indx) + (_qe_num)) & ((_q_depth) - 1)))
#define BFA_MSGQ_CMDQ_NUM_ENTRY 128
#define BFA_MSGQ_CMDQ_SIZE \
(BFI_MSGQ_CMD_ENTRY_SIZE * BFA_MSGQ_CMDQ_NUM_ENTRY)
#define BFA_MSGQ_RSPQ_NUM_ENTRY 128
#define BFA_MSGQ_RSPQ_SIZE \
(BFI_MSGQ_RSP_ENTRY_SIZE * BFA_MSGQ_RSPQ_NUM_ENTRY)
#define bfa_msgq_cmd_set(_cmd, _cbfn, _cbarg, _msg_size, _msg_hdr) \
do { \
(_cmd)->cbfn = (_cbfn); \
(_cmd)->cbarg = (_cbarg); \
(_cmd)->msg_size = (_msg_size); \
(_cmd)->msg_hdr = (_msg_hdr); \
} while (0)
struct bfa_msgq;
typedef void (*bfa_msgq_cmdcbfn_t)(void *cbarg, enum bfa_status status);
struct bfa_msgq_cmd_entry {
struct list_head qe;
bfa_msgq_cmdcbfn_t cbfn;
void *cbarg;
size_t msg_size;
struct bfi_msgq_mhdr *msg_hdr;
};
enum bfa_msgq_cmdq_flags {
BFA_MSGQ_CMDQ_F_DB_UPDATE = 1,
};
struct bfa_msgq_cmdq {
bfa_fsm_t fsm;
enum bfa_msgq_cmdq_flags flags;
u16 producer_index;
u16 consumer_index;
u16 depth; /* FW Q depth is 16 bits */
struct bfa_dma addr;
struct bfa_mbox_cmd dbell_mb;
u16 token;
int offset;
int bytes_to_copy;
struct bfa_mbox_cmd copy_mb;
struct list_head pending_q; /* pending command queue */
struct bfa_msgq *msgq;
};
enum bfa_msgq_rspq_flags {
BFA_MSGQ_RSPQ_F_DB_UPDATE = 1,
};
typedef void (*bfa_msgq_mcfunc_t)(void *cbarg, struct bfi_msgq_mhdr *mhdr);
struct bfa_msgq_rspq {
bfa_fsm_t fsm;
enum bfa_msgq_rspq_flags flags;
u16 producer_index;
u16 consumer_index;
u16 depth; /* FW Q depth is 16 bits */
struct bfa_dma addr;
struct bfa_mbox_cmd dbell_mb;
int nmclass;
struct {
bfa_msgq_mcfunc_t cbfn;
void *cbarg;
} rsphdlr[BFI_MC_MAX];
struct bfa_msgq *msgq;
};
struct bfa_msgq {
struct bfa_msgq_cmdq cmdq;
struct bfa_msgq_rspq rspq;
struct bfa_wc init_wc;
struct bfa_mbox_cmd init_mb;
struct bfa_ioc_notify ioc_notify;
struct bfa_ioc *ioc;
};
u32 bfa_msgq_meminfo(void);
void bfa_msgq_memclaim(struct bfa_msgq *msgq, u8 *kva, u64 pa);
void bfa_msgq_attach(struct bfa_msgq *msgq, struct bfa_ioc *ioc);
void bfa_msgq_regisr(struct bfa_msgq *msgq, enum bfi_mclass mc,
bfa_msgq_mcfunc_t cbfn, void *cbarg);
void bfa_msgq_cmd_post(struct bfa_msgq *msgq,
struct bfa_msgq_cmd_entry *cmd);
void bfa_msgq_rsp_copy(struct bfa_msgq *msgq, u8 *buf, size_t buf_len);
#endif
|
/*
* flow-table-hairpin: A flow table API offload driver user-space backend
*
* Copyright (C) 2015 Netronome.
*
* Contacts: Simon Horman <simon.horman@netronome.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; version 2 of the License.
*
* 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.
*/
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <sys/socket.h>
#include <linux/if_flow.h>
#include <flow-table/data.h>
#include "flow-table-hairpind/ftbe.h"
#include "flow-table-hairpind/list.h"
#include "flow-table-hairpind/log.h"
struct ftbe_dummy_rule {
struct list_head list;
struct net_flow_rule rule;
};
/* A list will be very inefficient for large numbers of rules
* but it seems sufficient for prototyping a dummy backend.
*/
static LIST_HEAD(ftbe_rules);
static int
ftbe_dummy_get_flows(int table, int min_prio, int max_prio,
int (*cb)(const struct net_flow_rule *rule, void *data),
void *cb_data)
{
struct ftbe_dummy_rule *rule, *tmp;
list_for_each_entry_safe(rule, tmp, &ftbe_rules, list) {
if (table != rule->rule.table_id ||
(min_prio >= 0 && rule->rule.priority < min_prio) ||
(max_prio >= 0 && rule->rule.priority > max_prio))
continue;
if (cb(&rule->rule, cb_data))
return -1;
}
return 0;
}
static int
ftbe_dummy_set_flow(const struct net_flow_rule *rule)
{
struct ftbe_dummy_rule *r;
/* XXX Verify table, header, match, actions, etc... are valid. */
/* Return an error for a duplicate rule */
list_for_each_entry(r, &ftbe_rules, list) {
if (r->rule.table_id != rule->table_id)
continue;
if (r->rule.uid == rule->uid) {
fthp_log_warn("Rejecting rule for table %d with "
"duplicate uid %d\n", rule->table_id,
rule->uid);
return -1;;
}
if (flow_table_field_refs_are_subset(r->rule.matches,
rule->matches)) {
fthp_log_warn("Rejecting rule for table %d with "
"duplicate match. New rule's uid is %d. "
"Existing rule's uid is %d\n",
rule->table_id, rule->uid, r->rule.uid);
return -1;;
}
}
r = malloc(sizeof *r);
if (!r)
return -1;
if (flow_table_rule_clone_data(&r->rule, rule)) {
free(r);
return -1;
}
INIT_LIST_HEAD(&r->list);
list_add(&r->list, &ftbe_rules);
fthp_log_debug("Added rule to table %d with uid %d\n",
rule->table_id, rule->uid);
return 0;
}
static void
__ftbe_dummy_del_rule(struct ftbe_dummy_rule *rule)
{
list_del(&rule->list);
flow_table_free_actions(rule->rule.actions);
free(rule->rule.matches);
free(rule);
}
static int ftbe_dummy_del_flow(const struct net_flow_rule *rule)
{
struct ftbe_dummy_rule *r, *tmp;
list_for_each_entry_safe(r, tmp, &ftbe_rules, list) {
if (r->rule.table_id != rule->table_id)
continue;
if (!flow_table_field_refs_are_subset(r->rule.matches,
rule->matches))
continue;
__ftbe_dummy_del_rule(r);
}
return 0;
}
static void ftbe_dummy_destroy(void)
{
struct ftbe_dummy_rule *f, *tmp;
list_for_each_entry_safe(f, tmp, &ftbe_rules, list)
__ftbe_dummy_del_rule(f);
}
static const struct ftbe_class ftbe_dummy = {
.destroy = ftbe_dummy_destroy,
.get_flows = ftbe_dummy_get_flows,
.set_flow = ftbe_dummy_set_flow,
.del_flow = ftbe_dummy_del_flow,
};
int ftbe_dummy_register(void) {
return ftbe_register(&ftbe_dummy);
}
|
/*____________________________________________________________________________
FreeAmp - The Free MP3 Player
Portions Copyright (C) 1999 EMusic.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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: DropTarget.h,v 1.7 2000/09/16 11:47:48 elrod Exp $
____________________________________________________________________________*/
#ifndef INCLUDED_DROPTARGET_H_
#define INCLUDED_DROPTARGET_H_
#include <ole2.h>
#define UWM_DROPURLS WM_USER + 42
#define UWM_MOVEITEMS WM_USER + 43
class FAR DropTarget : public IDropTarget
{
public:
DropTarget(HWND hwnd);
~DropTarget ();
void Enable(bool bEnable);
void TargetIsSource(bool isSrc);
void ScrollFunction();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj);
STDMETHOD_(ULONG, AddRef)(void);
STDMETHOD_(ULONG, Release)(void);
/* IDropTarget methods */
STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD dwKeyState,
POINTL pt, LPDWORD pdwEffect);
STDMETHOD(DragOver)(DWORD dwKeyState, POINTL pt, LPDWORD pdwEffect);
STDMETHOD(DragLeave)();
STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD dwKeyState,
POINTL pt, LPDWORD pdwEffect);
private:
void CheckAutoScroll(POINT pt);
void AutoScroll(int scrollCode);
ULONG m_refs;
HWND m_hwnd;
bool m_acceptFormat;
bool m_enabled;
bool m_allowMove;
bool m_targetIsSource;
HBRUSH m_insertBrush;
int m_oldItem;
RECT m_insertRect;
RECT m_scrollRect;
bool m_scrolling;
int m_scrollCode;
int m_timer;
};
#endif // INCLUDED_DROPTARGET_H_ |
/*
* vhost-net support
*
* Copyright Red Hat, Inc. 2010
*
* Authors:
* Michael S. Tsirkin <mst@redhat.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/
#include "net.h"
#include "net/tap.h"
#include "virtio-net.h"
#include "vhost_net.h"
#include "config.h"
#ifdef CONFIG_VHOST_NET
#include <linux/vhost.h>
#include <sys/socket.h>
#include <linux/kvm.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/virtio_ring.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stdio.h>
#include "vhost.h"
struct vhost_net {
struct vhost_dev dev;
struct vhost_virtqueue vqs[2];
int backend;
VLANClientState *vc;
};
unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
{
/* Clear features not supported by host kernel. */
if (!(net->dev.features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY))) {
features &= ~(1 << VIRTIO_F_NOTIFY_ON_EMPTY);
}
if (!(net->dev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC))) {
features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
}
if (!(net->dev.features & (1 << VIRTIO_NET_F_MRG_RXBUF))) {
features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
}
return features;
}
void vhost_net_ack_features(struct vhost_net *net, unsigned features)
{
net->dev.acked_features = net->dev.backend_features;
if (features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) {
net->dev.acked_features |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
}
if (features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
net->dev.acked_features |= (1 << VIRTIO_RING_F_INDIRECT_DESC);
}
if (features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
net->dev.acked_features |= (1 << VIRTIO_NET_F_MRG_RXBUF);
}
}
static int vhost_net_get_fd(VLANClientState *backend)
{
switch (backend->info->type) {
case NET_CLIENT_TYPE_TAP:
return tap_get_fd(backend);
default:
fprintf(stderr, "vhost-net requires tap backend\n");
return -EBADFD;
}
}
struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
{
int r;
struct vhost_net *net = qemu_malloc(sizeof *net);
if (!backend) {
fprintf(stderr, "vhost-net requires backend to be setup\n");
goto fail;
}
r = vhost_net_get_fd(backend);
if (r < 0) {
goto fail;
}
net->vc = backend;
net->dev.backend_features = tap_has_vnet_hdr(backend) ? 0 :
(1 << VHOST_NET_F_VIRTIO_NET_HDR);
net->backend = r;
r = vhost_dev_init(&net->dev, devfd);
if (r < 0) {
goto fail;
}
if (!tap_has_vnet_hdr_len(backend,
sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
}
if (~net->dev.features & net->dev.backend_features) {
fprintf(stderr, "vhost lacks feature mask %" PRIu64 " for backend\n",
(uint64_t)(~net->dev.features & net->dev.backend_features));
vhost_dev_cleanup(&net->dev);
goto fail;
}
/* Set sane init value. Override when guest acks. */
vhost_net_ack_features(net, 0);
return net;
fail:
qemu_free(net);
return NULL;
}
int vhost_net_start(struct vhost_net *net,
VirtIODevice *dev)
{
struct vhost_vring_file file = { };
int r;
if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
tap_set_vnet_hdr_len(net->vc,
sizeof(struct virtio_net_hdr_mrg_rxbuf));
}
net->dev.nvqs = 2;
net->dev.vqs = net->vqs;
r = vhost_dev_start(&net->dev, dev);
if (r < 0) {
return r;
}
net->vc->info->poll(net->vc, false);
qemu_set_fd_handler(net->backend, NULL, NULL, NULL);
file.fd = net->backend;
for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
if (r < 0) {
r = -errno;
goto fail;
}
}
return 0;
fail:
file.fd = -1;
while (--file.index >= 0) {
int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
assert(r >= 0);
}
net->vc->info->poll(net->vc, true);
vhost_dev_stop(&net->dev, dev);
if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
tap_set_vnet_hdr_len(net->vc, sizeof(struct virtio_net_hdr));
}
return r;
}
void vhost_net_stop(struct vhost_net *net,
VirtIODevice *dev)
{
struct vhost_vring_file file = { .fd = -1 };
for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
assert(r >= 0);
}
net->vc->info->poll(net->vc, true);
vhost_dev_stop(&net->dev, dev);
if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
tap_set_vnet_hdr_len(net->vc, sizeof(struct virtio_net_hdr));
}
}
void vhost_net_cleanup(struct vhost_net *net)
{
vhost_dev_cleanup(&net->dev);
if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
tap_set_vnet_hdr_len(net->vc, sizeof(struct virtio_net_hdr));
}
qemu_free(net);
}
#else
struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
{
return NULL;
}
int vhost_net_start(struct vhost_net *net,
VirtIODevice *dev)
{
return -ENOSYS;
}
void vhost_net_stop(struct vhost_net *net,
VirtIODevice *dev)
{
}
void vhost_net_cleanup(struct vhost_net *net)
{
}
unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
{
return features;
}
void vhost_net_ack_features(struct vhost_net *net, unsigned features)
{
}
#endif
|
/*
* MyD
* main.c
* Copyright (C) 2000-2001 Hironori FUJII
*
*/
#include <config.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include "myd.h"
#include "edit.h"
#include "term.h"
#include "getsel.h"
#define PROGRAM "MyD"
MYD myd;
char *prompt = PROGRAM "> ";
#define SCROLL_STEP 4
/* ¥Æ¡¼¥ÞÈÖ¹æ */
int theme_no = DEFAULT_THEME;
char * color_word[] = {
"1",
"34",
"1;36"
};
void usage(char *prog){
printf(
PROGRAM " ver " VERSION "\n"
"dictionary look up tool\n"
"usage: %s [options]\n"
" options\n"
" [-d <dic_filename>]\n"
" [-t <theme_no>] select a theme\n"
" [-h] print the help\n"
" [-v] print the version\n"
, prog);
exit(0);
}
inline int is_kanji(char c){
return c & 0x80;
}
char * putkchar(char *str, int *x, int *y){
if(is_kanji(*str)){
if(*x == term_width - 1){
putchar(' ');
(*y) ++;
(*x) = 0;
return str;
}
putchar(*str++);
(*x) ++;
putchar(*str++);
(*x) ++;
}else{
putchar(*str++);
(*x) ++;
}
if(*x >= term_width){
(*x) -= term_width;
(*y) ++;
}
return str;
}
void move_cursor(int cursor){
term_move(strlen(prompt) + cursor, 0);
fflush(stdout);
}
void print_prompt(char *str, int cursor){
term_move(0, 0);
fputs(prompt, stdout);
fputs(str, stdout);
move_cursor(cursor);
}
void print_status(MYD myd, int n_match){
int i;
char str[256];
snprintf(str, sizeof(str), "%d/%d", n_match, myd_n_index(myd));
str[255] = '\0';
term_move(0, term_height-1);
term_attr_set("7");
i = term_width - 1 - strlen(str);
for(;i>0;i--)
putchar(' ');
fputs(str, stdout);
term_attr_reset();
}
void display_word(char *str, int *x, int *y){
term_attr_set(color_word[theme_no]);
while(*str){
if(*y >= term_height - 1)
break;
str = putkchar(str, x, y);
}
term_attr_reset();
}
void display_mean(char *str, int *x, int *y){
int tab_stop = term_width / 2;
if(tab_stop > 8)
tab_stop = 8;
putkchar(" ", x, y);
while(*str){
if(*y >= term_height - 1)
break;
while(*x < tab_stop)
putkchar(" ", x, y);
str = putkchar(str, x, y);
}
putchar('\n');
if(*x != 0){
(*x) = 0;
(*y) ++;
}
}
void display(MYD myd, int index, int n_match, int scroll){
int i;
int x, y;
term_clear();
print_prompt(edit.text, edit.cursor);
term_move(0, 1);
x = 0;
y = 1;
i = scroll;
while(i < n_match){
/* ñ¸ì¤Îɽ¼¨ */
display_word(myd_key(myd, index+i), &x, &y);
if(y >= term_height - 1)
break;
/* °ÕÌ£¤Îɽ¼¨ */
display_mean(myd_text(myd, index+i), &x, &y);
i ++;
if(y >= term_height - 1)
break;
}
print_status(myd, n_match);
}
void main_loop(){
char *cs;
int index;
int n_match;
int scroll = 0;
cs = check_sel();
if(cs)
edit_set_text(cs);
n_match = myd_bsearch(myd, edit.text, &index);
display(myd, index, n_match, scroll);
print_prompt(edit.text, edit.cursor);
while(1){
int c;
c = term_getch();
if(isprint(c)){
edit_ins_char(c);
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
}else{
switch(c){
/*
* move cursor
*/
case 1: /* ^A */
edit_cur_head();
move_cursor(edit.cursor);
continue;
case 2: /* ^B */
case KEY_LEFT:
edit_cur_back();
move_cursor(edit.cursor);
continue;
case 5: /* ^E */
edit_cur_tail();
move_cursor(edit.cursor);
continue;
case 6: /* ^F */
case KEY_RIGHT:
edit_cur_forward();
move_cursor(edit.cursor);
continue;
/*
* scroll
*/
case 16: /* ^P */
case KEY_PPAGE:
case KEY_UP:
if(scroll == 0)
continue;
scroll -= SCROLL_STEP;
if(scroll < 0)
scroll = 0;
break;
case 14: /* ^N */
case KEY_NPAGE:
case KEY_DOWN:
if(scroll == n_match - 1)
continue;
scroll += SCROLL_STEP;
if(scroll >= n_match)
scroll = n_match - 1;
break;
/*
* delete text
*/
case 8: /* ^H */
edit_back_space();
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
case 4: /* ^D */
case 0x7f:
edit_del_char();
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
case 21: /* ^U */
case 10: /* ^J */
case 13: /* ^M */
edit_clear();
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
case 11: /* ^K */
edit_kill();
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
case 20: /* ^T */
edit_transpose();
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
case 12: /* ^L */
break;
/* Exit */
case 24: /* ^X */
return;
case ERR: /* timeout */
cs = check_sel();
if(cs){
edit_set_text(cs);
n_match = myd_bsearch(myd, edit.text, &index);
scroll = 0;
break;
}else
continue;
default:
break;
}
}
display(myd, index, n_match, scroll);
print_prompt(edit.text, edit.cursor);
}
}
void finish(int s){
get_sel_end();
term_end();
myd_close(myd);
exit(s);
}
int main(int argc, char *argv[]){
char dic_filename[1024];
struct stat st;
int update_interval = 300; /* milli second */
snprintf(dic_filename, sizeof(dic_filename), "%s%s%s",
getenv("HOME"), "/", HOME_DIC_FILENAME);
if(stat(dic_filename, &st) == -1){
strcpy(dic_filename, SYSTEM_DIC_PATH);
}
while(1){
int c;
c = getopt(argc, argv, "d:t:hvi:");
if(c == -1)
break;
switch(c){
case 'd':
strcpy(dic_filename, optarg);
break;
case 't':
theme_no = atoi(optarg);
break;
case 'i':
update_interval = atoi(optarg);
break;
case 'h':
usage(argv[0]);
case 'v':
printf(PROGRAM " version " VERSION "\n");
exit(0);
case ':':
case '?':
exit(1);
}
}
myd = myd_open(dic_filename);
if(!myd){
perror(dic_filename);
exit(1);
}
term_init();
term_timeout(update_interval);
get_sel_init(getenv("DISPLAY"));
main_loop();
finish(0);
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.