text
stringlengths
4
6.14k
typedef struct Occupant { char name[60]; int age; char gender; } Occupant;
// // GORuleObject.h // Gobi // // Created by Wojtek Kordylewski on 20.01.14. // Copyright (c) 2014 Gobi. All rights reserved. // #import <Foundation/Foundation.h> #import "GORuleConditionAssociationObject.h" @interface GORuleObject : NSObject @property (nonatomic) uint _id; @property (nonatomic, copy) NSString *name; @property (nonatomic) GORuleOperator ruleOperator; @property (nonatomic) NSMutableArray *conditions; @property (nonatomic) NSMutableArray *actions; @end
#ifndef FIX42_MASSQUOTE_H #define FIX42_MASSQUOTE_H #include "Message.h" namespace FIX42 { class MassQuote : public Message { public: MassQuote() : Message(MsgType()) {} MassQuote(const FIX::Message& m) : Message(m) {} MassQuote(const Message& m) : Message(m) {} MassQuote(const MassQuote& m) : Message(m) {} static FIX::MsgType MsgType() { return FIX::MsgType("i"); } MassQuote( const FIX::QuoteID& aQuoteID ) : Message(MsgType()) { set(aQuoteID); } FIELD_SET(*this, FIX::QuoteReqID); FIELD_SET(*this, FIX::QuoteID); FIELD_SET(*this, FIX::QuoteResponseLevel); FIELD_SET(*this, FIX::DefBidSize); FIELD_SET(*this, FIX::DefOfferSize); FIELD_SET(*this, FIX::NoQuoteSets); class NoQuoteSets: public FIX::Group { public: NoQuoteSets() : FIX::Group(296,302,FIX::message_order(302,311,312,309,305,310,313,314,315,316,317,436,435,308,306,362,363,307,364,365,367,304,295,0)) {} FIELD_SET(*this, FIX::QuoteSetID); FIELD_SET(*this, FIX::UnderlyingSymbol); FIELD_SET(*this, FIX::UnderlyingSymbolSfx); FIELD_SET(*this, FIX::UnderlyingSecurityID); FIELD_SET(*this, FIX::UnderlyingIDSource); FIELD_SET(*this, FIX::UnderlyingSecurityType); FIELD_SET(*this, FIX::UnderlyingMaturityMonthYear); FIELD_SET(*this, FIX::UnderlyingMaturityDay); FIELD_SET(*this, FIX::UnderlyingPutOrCall); FIELD_SET(*this, FIX::UnderlyingStrikePrice); FIELD_SET(*this, FIX::UnderlyingOptAttribute); FIELD_SET(*this, FIX::UnderlyingContractMultiplier); FIELD_SET(*this, FIX::UnderlyingCouponRate); FIELD_SET(*this, FIX::UnderlyingSecurityExchange); FIELD_SET(*this, FIX::UnderlyingIssuer); FIELD_SET(*this, FIX::EncodedUnderlyingIssuerLen); FIELD_SET(*this, FIX::EncodedUnderlyingIssuer); FIELD_SET(*this, FIX::UnderlyingSecurityDesc); FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDescLen); FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDesc); FIELD_SET(*this, FIX::QuoteSetValidUntilTime); FIELD_SET(*this, FIX::TotQuoteEntries); FIELD_SET(*this, FIX::NoQuoteEntries); class NoQuoteEntries: public FIX::Group { public: NoQuoteEntries() : FIX::Group(295,299,FIX::message_order(299,55,65,48,22,167,200,205,201,202,206,231,223,207,106,348,349,107,350,351,132,133,134,135,62,188,190,189,191,60,336,64,40,193,192,15,0)) {} FIELD_SET(*this, FIX::QuoteEntryID); FIELD_SET(*this, FIX::Symbol); FIELD_SET(*this, FIX::SymbolSfx); FIELD_SET(*this, FIX::SecurityID); FIELD_SET(*this, FIX::IDSource); FIELD_SET(*this, FIX::SecurityType); FIELD_SET(*this, FIX::MaturityMonthYear); FIELD_SET(*this, FIX::MaturityDay); FIELD_SET(*this, FIX::PutOrCall); FIELD_SET(*this, FIX::StrikePrice); FIELD_SET(*this, FIX::OptAttribute); FIELD_SET(*this, FIX::ContractMultiplier); FIELD_SET(*this, FIX::CouponRate); FIELD_SET(*this, FIX::SecurityExchange); FIELD_SET(*this, FIX::Issuer); FIELD_SET(*this, FIX::EncodedIssuerLen); FIELD_SET(*this, FIX::EncodedIssuer); FIELD_SET(*this, FIX::SecurityDesc); FIELD_SET(*this, FIX::EncodedSecurityDescLen); FIELD_SET(*this, FIX::EncodedSecurityDesc); FIELD_SET(*this, FIX::BidPx); FIELD_SET(*this, FIX::OfferPx); FIELD_SET(*this, FIX::BidSize); FIELD_SET(*this, FIX::OfferSize); FIELD_SET(*this, FIX::ValidUntilTime); FIELD_SET(*this, FIX::BidSpotRate); FIELD_SET(*this, FIX::OfferSpotRate); FIELD_SET(*this, FIX::BidForwardPoints); FIELD_SET(*this, FIX::OfferForwardPoints); FIELD_SET(*this, FIX::TransactTime); FIELD_SET(*this, FIX::TradingSessionID); FIELD_SET(*this, FIX::FutSettDate); FIELD_SET(*this, FIX::OrdType); FIELD_SET(*this, FIX::FutSettDate2); FIELD_SET(*this, FIX::OrderQty2); FIELD_SET(*this, FIX::Currency); }; }; }; } #endif
#ifndef LOGGING_ILOGOUTPUT_H #define LOGGING_ILOGOUTPUT_H #include <string> class ILogOutput { public: /// virtual destructor virtual inline ~ILogOutput () {}; /** * @brief Writes a normal log to the output (pure virtual) * * @param Message The message to be written */ virtual void Write ( const std :: string & Message ) = 0; /** * @brief Writes a error log to the output (pure virtual) * * @param Message The message to be written */ virtual void WriteError ( const std :: string & Output ) = 0; }; #endif
#ifndef __MAD_MESSAGE__H__ #define __MAD_MESSAGE__H__ #include "MadSemaphore.h" typedef void(*madMsgFree_Callback)(MadVptr p); typedef struct _MadMsgQCB_t { MadU16 rdyg; MadU16 rdy[MAD_THREAD_RDY_NUM]; MadU8 **top; MadU8 **bottom; MadU8 **head; MadU8 **tail; MadSemCB_t *sem; MadU16 cnt; MadU16 size; } MadMsgQCB_t; extern const MadU8 MAD_MSG_EMPTY[]; extern MadMsgQCB_t* madMsgQCreateCarefully (MadU16 size, MadBool sendBlock); extern void madMsgQClear (MadMsgQCB_t **pMsgQ, madMsgFree_Callback msgFree); extern MadU8 madMsgCheck (MadMsgQCB_t **pMsgQ, MadVptr *msg); extern MadU8 madMsgWait (MadMsgQCB_t **pMsgQ, MadVptr *msg, MadTime_t to); extern MadU8 madDoMsgSend (MadMsgQCB_t **pMsgQ, MadVptr msg, MadBool block, MadTime_t to, MadU8 err); extern void madDoMsgQShut (MadMsgQCB_t **pMsgQ, MadBool opt); extern void madDoMsgQDelete (MadMsgQCB_t **pMsgQ, MadBool opt); #define madMsgQCreate(size) madMsgQCreateCarefully(size, MFALSE); #define madMsgSend(pMsgQ, msg) madDoMsgSend(pMsgQ, msg, MFALSE, 0, MAD_ERR_OK) #define madMsgSendBlock(pMsgQ, msg, to) madDoMsgSend(pMsgQ, msg, MTRUE, to, MAD_ERR_OK) #define madMsgQShut(pMsgQ) madDoMsgQShut(pMsgQ, MTRUE) #define madMsgQDelete(pMsgQ) madDoMsgQDelete(pMsgQ, MTRUE) #endif
/** * @cond ___LICENSE___ * * Copyright (c) 2016-2018 Zefiros Software. * * 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. * * @endcond */ #pragma once #ifndef __ENGINE_MEMORYPOOLABLEINSTANTIATOR_H__ #define __ENGINE_MEMORYPOOLABLEINSTANTIATOR_H__ #include "memory/instantiator/memoryPoolInstantiator.h" #include "memory/instantiator/poolableInstantiator.h" template< typename tT, typename tBase = tT > class MemoryPoolableInstantiator : public PoolableInstantiator< tT, tBase > { public: explicit MemoryPoolableInstantiator(size_t blocksize = 1000, size_t maxBlocks = 1000) : mMemoryPool(blocksize, maxBlocks) { } virtual tBase *Create() override { return mMemoryPool.Create(); } virtual void Destroy(tBase *object) override { mMemoryPool.Destroy(object); } virtual AbstractInstantiator *Copy() override { return new MemoryPoolableInstantiator< tT, tBase >(mMemoryPool.GetBlockSize(), mMemoryPool.GetMaxBlocks()); } private: MemoryPoolInstantiator< tT, tBase > mMemoryPool; MemoryPoolableInstantiator(const MemoryPoolableInstantiator &); }; #endif
// // Notes.h // awAcmeNotes // // Created by Bill DeWeese on 8/25/13. // Copyright (c) 2013 AirWatch. All rights reserved. // #import <Foundation/Foundation.h> @interface Notes : NSObject +(NSMutableDictionary *)getAllNotes; +(void)setCurrentKey:(NSString *)key; +(NSString *)getCurrentKey; +(void)setNoteForCurrentKey:(NSString *)note; +(void)setNote:(NSString *)note forKey:(NSString *)key; +(void)saveNotes; +(void)removeObjectForKey:(NSString *)key; +(void)didReceiveCloudData:(NSDictionary *)d; +(void)dataUpdatedFromCloud:(NSNotification *)notification; @end
#ifndef INCLUDED_PENDULUM #define INCLUDED_PENDULUM #include <DRDSP/types.h> #include <DRDSP/dynamics/model.h> using namespace DRDSP; struct PendulumWrap { void operator()( VectorXd& x ) const; }; struct Pendulum : Model<> { Pendulum() : Model<>(5) {} VectorXd operator()( const VectorXd& state ) const; MatrixXd Partials( const VectorXd& state ) const; friend struct PendulumFamily; protected: double Omega = 1.0, length = 1.1, mass = 7.0, A = 0.15, delta1 = 0.245, delta2 = 0.245; double f1( double sinphi, double cosphi ) const; double f2( double cosphi ) const; double f3( double cospsi ) const; double f4( double cosphi ) const; double vpDot( double sinphi, double cosphi, double costheta, double cospsi, double vp, double vt ) const; double vtDot( double sinphi, double cosphi, double sintheta, double cospsi, double vp, double vt ) const; double f1d( double sinphi, double cosphi ) const; double f3d( double sinpsi ) const; }; struct PendulumFamily : Family<Pendulum> { PendulumFamily() : Family<Pendulum>(5,1) {} Pendulum operator()( const VectorXd& parameter ) const { Pendulum P; P.Omega = parameter[0]; return P; } }; struct FlatEmbedding : Embedding { FlatEmbedding() : Embedding(5,8) {} VectorXd operator()( const VectorXd& x ) const; MatrixXd Derivative( const VectorXd& x ) const; MatrixXd DerivativeAdjoint( const VectorXd& x ) const; MatrixXd Derivative2( const VectorXd& x, uint32_t mu ) const; }; struct DoughnutEmbedding : Embedding { double R1 = 2.0, R2 = 4.0; DoughnutEmbedding() : Embedding(5,6) {} VectorXd operator()( const VectorXd& x ) const; MatrixXd Derivative( const VectorXd& x ) const; MatrixXd DerivativeAdjoint( const VectorXd& x ) const; MatrixXd Derivative2( const VectorXd& x, uint32_t mu ) const; }; typedef RKDynamicalSystem<Pendulum,PendulumWrap> PendulumSolver; #endif
#ifndef GUIUTIL_H #define GUIUTIL_H #include <QString> #include <QObject> #include <QMessageBox> class SendCoinsRecipient; QT_BEGIN_NAMESPACE class QFont; class QLineEdit; class QWidget; class QDateTime; class QUrl; class QAbstractItemView; QT_END_NAMESPACE /** Utility functions used by the Bitcoin Qt UI. */ namespace GUIUtil { // Create human-readable string from date QString dateTimeStr(const QDateTime &datetime); QString dateTimeStr(qint64 nTime); // Render Bitcoin addresses in monospace font QFont bitcoinAddressFont(); // Set up widgets for address and amounts void setupAddressWidget(QLineEdit *widget, QWidget *parent); void setupAmountWidget(QLineEdit *widget, QWidget *parent); // Parse "2chcoin:" URI into recipient object, return true on successful parsing // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out); bool parseBitcoinURI(QString uri, SendCoinsRecipient *out); // HTML escaping for rich text controls QString HtmlEscape(const QString& str, bool fMultiLine=false); QString HtmlEscape(const std::string& str, bool fMultiLine=false); /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing is selected. @param[in] column Data column to extract from the model @param[in] role Data role to extract from the model @see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress */ void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole); /** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when no suffix is provided by the user. @param[in] parent Parent window (or 0) @param[in] caption Window caption (or empty, for default) @param[in] dir Starting directory (or empty, to default to documents directory) @param[in] filter Filter specification such as "Comma Separated Files (*.csv)" @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix. */ QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedSuffixOut=0); /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking. @returns If called from the GUI thread, return a Qt::DirectConnection. If called from another thread, return a Qt::BlockingQueuedConnection. */ Qt::ConnectionType blockingGUIThreadConnection(); // Determine whether a widget is hidden behind other windows bool isObscured(QWidget *w); // Open debug.log void openDebugLogfile(); /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text representation if needed. This assures that Qt can word-wrap long tooltip messages. Tooltips longer than the provided size threshold (in characters) are wrapped. */ class ToolTipToRichTextFilter : public QObject { Q_OBJECT public: explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); protected: bool eventFilter(QObject *obj, QEvent *evt); private: int size_threshold; }; bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); /** Help message for Bitcoin-Qt, shown with --help. */ class HelpMessageBox : public QMessageBox { Q_OBJECT public: HelpMessageBox(QWidget *parent = 0); /** Show message box or print help message to standard output, based on operating system. */ void showOrPrint(); /** Print help message to console */ void printToConsole(); private: QString header; QString coreOptions; QString uiOptions; }; } // namespace GUIUtil #endif // GUIUTIL_H
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_signal.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gmange <gmange@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2014/02/04 11:24:09 by gmange #+# #+# */ /* Updated: 2016/12/22 21:53:14 by gmange ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> #include <signal.h> #include "libft.h" #include "ft_exit.h" #include "keys.h" #include "minishell.h" #include "debug.h" #include "ft_signal.h" /* ** static void sig_cont(int n) ** { ** t_env *env; ** env = init_env(); ** display(env); ** (void)n; ** } */ /* ** TODO: catch resize window signal to refresh ATTR for correct input */ /* ** to manage 'fg' signal, setup waitpid properly ** signal(SIGCONT, SIG_DFL); ** signal(SIGCONT, sig_cont); */ /* ** How to manage init_t_env error? */ static void sig_int(int n) { t_env *env; if (init_t_env(&env) != EXIT_SUCCESS) { tputs_str("SIG_INT error retrieving env variable", STDERR_FILENO, e_always); ft_exit(env, ft_end(env, EXIT_SUCCESS)); } else ft_key_ctrl_g(env); (void)n; } /* ** signal(SIGWINCH, SIG_DFL); ** signal(SIGTWINCH, sig_winch); ** - ** static void sig_winch(int n) ** { ** debug_tputs_p("\nsig_winch n: ", n, "\n", e_always); ** (void)n; ** } */ /* ** ignoring SIGTERM, prevents from closing on `pkill 21sh` and messing term, ** though keeping it is safe during debuging w/ DEBUG_ON=1 */ void sig_ign(void) { if (!isatty(STDIN_FILENO)) return ; signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); } void sig_dfl(void) { signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); signal(SIGTSTP, SIG_DFL); if (!DEBUG) signal(SIGTERM, SIG_DFL); signal(SIGCHLD, SIG_DFL); } /* ** signal(SIGTSTP, sig_int); */ void sig_init(void) { if (!isatty(STDIN_FILENO)) return ; signal(SIGINT, sig_int); signal(SIGQUIT, sig_int); signal(SIGTSTP, SIG_IGN); if (!DEBUG) signal(SIGTERM, SIG_IGN); }
//================================================================================== // Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved. // /// \author AMD Developer Tools Team /// \file apExceptionEvent.h /// //================================================================================== //------------------------------ apExceptionEvent.h ------------------------------ #ifndef __APEXCEPTIONEVENT #define __APEXCEPTIONEVENT // Forward declarations: template <class TransferableObjectType> class osTransferableObjectCreator; // Infra: #include <AMDTBaseTools/Include/AMDTDefinitions.h> #include <AMDTBaseTools/Include/gtString.h> #include <AMDTOSWrappers/Include/osExceptionReason.h> // Local: #include <AMDTAPIClasses/Include/Events/apEvent.h> // ---------------------------------------------------------------------------------- // Class Name: AP_API apExceptionEvent // General Description: // Represents the event of an exception that is thrown by one of the debugged // process threads. // Author: AMD Developer Tools Team // Creation Date: 30/3/2004 // ---------------------------------------------------------------------------------- class AP_API apExceptionEvent : public apEvent { public: apExceptionEvent(osThreadId triggeringThreadId, osExceptionReason exceptionReason, osInstructionPointer exceptionAddress, bool isSecondChance = false); // Overrides osTransferableObject: virtual osTransferableObjectType type() const; virtual bool writeSelfIntoChannel(osChannel& ipcChannel) const; virtual bool readSelfFromChannel(osChannel& ipcChannel); // Overrides apEvent: virtual EventType eventType() const; virtual apEvent* clone() const; // Self functions: osExceptionReason exceptionReason() const { return _exceptionReason; }; osInstructionPointer exceptionAddress() const { return _exceptionAddress; }; bool isSecondChance() const { return _isSecondChance; }; bool isFatalLinuxSignal() const; private: friend class osTransferableObjectCreator<apExceptionEvent>; // Do not allow the use of the default constructor: apExceptionEvent(); private: // The exception reason: osExceptionReason _exceptionReason; // The address in which the exception occur: osInstructionPointer _exceptionAddress; // Contains true iff this is a second chance exception: // (I.E: The debugged process is about to die) bool _isSecondChance; }; #endif // __APEXCEPTIONEVENT
// // UIImage+SuExt.h // SuUtility // // Created by KevinSu on 15/10/17. // Copyright (c) 2015年 SuXiaoMing. All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (SU) /** * 加载图片 * * @param imageName 图片名 * * @return 适配系统的图片 */ + (instancetype)imageWithName:(NSString *)imageName; /** * 返回一张自由拉伸的图片 */ + (instancetype)resizedImageWithName:(NSString *)imageName; + (instancetype)resizedImageWithName:(NSString *)imageName left:(CGFloat)left top:(CGFloat)top; /** * 获取view所对应的图片 * * @param view 目标view * * @return image */ + (instancetype)captureImageWithViwe:(UIView *)view; /** * 获得给定颜色和大小的图片 * * @param color 指定的图片颜色 * @param size 指定返回的图片大小 * * @return 返回指定颜色和大小的图片 */ + (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size; /** * 圆形图片 * * @param name 待处理的图片名 * @param borderWidth 边框宽度 * @param borderColor 边框颜色 * * @return 原型图片 */ + (instancetype)circleImageWithName:(NSString *)name borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor; - (UIImage *)createNewImageWithBg:(UIImage *)bgImage icon:(UIImage *)icon; - (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat)size; /** * 第一个参数string:二维码信息 * 第二个参数imageSize:二维码的宽或者高 * 第三个参数icon:需要添加到二维码上面的图片的名字 * 第四个参数iconSize:需要添加到二维码上面的图片的size; */ + (UIImage *)imageWithQRCodeImageMessage:(NSString *)string imageSize:(CGFloat)imageSize icon:(NSString *)icon iconSize:(CGSize)iconSize; //图片拉伸、平铺接口 - (UIImage *)resizableImageWithCompatibleCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode; //图片以ScaleToFit方式拉伸后的CGSize - (CGSize)sizeOfScaleToFit:(CGSize)scaledSize; //将图片转向调整为向上 - (UIImage *)fixOrientation; //以ScaleToFit方式压缩图片 - (UIImage *)compressedImageWithSize:(CGSize)compressedSize; - (UIImage*)imageRotatedByDegrees:(CGFloat)degrees; @end
// // DateMonger.h // DateMonger // // Created by edwardtoday on 12/22/14. // Copyright (c) 2014 edwardtoday. All rights reserved. // #import <Foundation/Foundation.h> @interface NSDate (DateMonger) + (instancetype)bnrDateMongerWithYear:(int)y month:(int)m day:(int)d; @end
#ifndef EventVec3_H #define EventVec3_H #include "nau/event/iEventData.h" #include "nau/math/vec3.h" namespace nau { namespace event_ { class EventVec3: public IEventData { friend class EventFactory; public: ~EventVec3(void); void setData(void *data); void *getData(void); protected: EventVec3(nau::math::vec3 v); EventVec3(const EventVec3 &c); EventVec3(void); nau::math::vec3 v; }; }; }; #endif
/* * Copyright (c) 2012 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #include <stddef.h> #include <inttypes.h> #include <stdlib.h> #include <stdio.h> #include <bus/cpu/cpu.h> #include "irq-mux.h" static irq_mux_handle_t *irq_mux_handle_alloc(void); static void irq_mux_handle_free(irq_mux_handle_t *); void irq_mux_init(irq_mux_t *irq_mux) { TAILQ_INIT(&irq_mux->im_tq); irq_mux->im_total = 0; } void irq_mux_handle(irq_mux_t *irq_mux) { irq_mux_handle_t *hdl_np; if (TAILQ_EMPTY(&irq_mux->im_tq)) return; TAILQ_FOREACH(hdl_np, &irq_mux->im_tq, handles) { hdl_np->imh_hdl(hdl_np); } } void irq_mux_handle_add(irq_mux_t *irq_mux, void (*hdl)(irq_mux_handle_t *), void *user_data) { irq_mux_handle_t *n_hdl; /* Disable interrupts */ cpu_intc_disable(); n_hdl = irq_mux_handle_alloc(); n_hdl->imh_hdl = hdl; n_hdl->imh_user_ptr = user_data; n_hdl->imh = irq_mux; irq_mux->im_total++; TAILQ_INSERT_TAIL(&irq_mux->im_tq, n_hdl, handles); /* Enable interrupts */ cpu_intc_enable(); } void irq_mux_handle_remove(irq_mux_t *irq_mux, void (*hdl)(irq_mux_handle_t *)) { irq_mux_handle_t *hdl_np; if (TAILQ_EMPTY(&irq_mux->im_tq)) return; TAILQ_FOREACH(hdl_np, &irq_mux->im_tq, handles) { if (hdl_np->imh_hdl == hdl) { TAILQ_REMOVE(&irq_mux->im_tq, hdl_np, handles); irq_mux_handle_free(hdl_np); return; } } } static irq_mux_handle_t * irq_mux_handle_alloc(void) { irq_mux_handle_t *n_hdl; if ((n_hdl = (irq_mux_handle_t *)malloc(sizeof(irq_mux_handle_t))) == NULL) return NULL; return n_hdl; } static void irq_mux_handle_free(irq_mux_handle_t *hdl) { free(hdl); }
/* * Copyright (C) Narf Industries <info@narfindustries.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DEALER_H #define DEALER_H 1 #define PLAYER_COUNT 5 #define FOR_EACH_PLAYER for (unsigned int pid = 1; pid <= PLAYER_COUNT; pid++) { ssize_t process(void); #endif
// Contents of DLLDefines.h #ifndef _cn_cbor_DLLDEFINES_H_ #define _cn_cbor_DLLDEFINES_H_ /* Cmake will define cn_cbor_EXPORTS on Windows when it configures to build a shared library. If you are going to use another build system on windows or create the visual studio projects by hand you need to define cn_cbor_EXPORTS when building a DLL on windows. */ // We are using the Visual Studio Compiler and building Shared libraries #if defined(_WIN32) #if defined(CN_CBOR_IS_DLL) #define CN_CBOR_EXPORT __declspec(dllexport) #else #define CN_CBOR_EXPORT #endif /* cn_cbor_EXPORTS */ #else /* defined (_WIN32) */ #define CN_CBOR_EXPORT #endif #endif /* _cn_cbor_DLLDEFINES_H_ */
/* * * Copyright (c) 2016 Simon Schmidt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #pragma once /* i686 HALT implementation. */ inline static void arch_halt() { for(;;) asm volatile("hlt"); }
#import "MOBProjection.h" @interface MOBProjectionEPSG2719 : MOBProjection @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" #import "NSSecureCoding-Protocol.h" @class NSData, NSObject<OS_dispatch_queue>; @interface PKImage : NSObject <NSSecureCoding> { NSObject<OS_dispatch_queue> *_queue; _Bool _shouldTile; _Bool _shouldStretch; struct PKEdgeInsets _capInsets; NSData *_imageData; struct CGImage *_imageRef; double _scale; long long _orientation; } + (_Bool)supportsSecureCoding; + (id)passesImageNamed:(id)arg1; + (id)hashOfImageNamed:(id)arg1 inBundle:(id)arg2; + (id)imageNamed:(id)arg1 inBundle:(id)arg2; + (id)URLForImageNamed:(id)arg1 inBundle:(id)arg2 scale:(double *)arg3; @property(readonly, nonatomic) double scale; // @synthesize scale=_scale; - (_Bool)_isTiledWhenStretchedToSize:(struct CGSize)arg1; - (void)_queue_createImageRefIfNecessary; - (id)notificationIconData; - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (void)drawInRect:(struct CGRect)arg1 inContext:(struct CGContext *)arg2 withBlendMode:(int)arg3 alpha:(double)arg4; - (void)drawInRect:(struct CGRect)arg1 inContext:(struct CGContext *)arg2; - (id)resizableImageByTilingCenterPixel; - (id)resizableImageByStretchingWithCapInsets:(struct PKEdgeInsets)arg1; - (id)resizableImageByTilingWithCapInsets:(struct PKEdgeInsets)arg1; - (id)resizedImageWithConstraints:(id)arg1; - (id)blurredImageWithRadius:(unsigned long long)arg1 constraints:(id)arg2; @property(readonly, nonatomic) struct PKEdgeInsets capInsets; @property(readonly, nonatomic) _Bool stretches; @property(readonly, nonatomic) _Bool tiles; - (void)preheatBitmapData; @property(readonly, nonatomic) NSData *imageData; // @synthesize imageData=_imageData; @property(readonly, nonatomic) long long orientation; // @synthesize orientation=_orientation; @property(readonly, nonatomic) struct CGImage *imageRef; // @synthesize imageRef=_imageRef; @property(readonly, nonatomic) struct CGSize size; - (void)dealloc; - (id)initWithCGImage:(struct CGImage *)arg1 scale:(double)arg2 orientation:(long long)arg3; - (id)initWithData:(id)arg1 scale:(double)arg2; - (id)init; @end
/* * WARNING: do not edit! * Generated by makefile from include/openssl/opensslconf.h.in * * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifdef __cplusplus extern "C" { #endif #ifdef OPENSSL_ALGORITHM_DEFINES # error OPENSSL_ALGORITHM_DEFINES no longer supported #endif /* * OpenSSL was configured with the following options: */ #ifndef OPENSSL_SYS_WIN32 # define OPENSSL_SYS_WIN32 1 #endif #ifndef OPENSSL_NO_COMP # define OPENSSL_NO_COMP #endif #ifndef OPENSSL_NO_MD2 # define OPENSSL_NO_MD2 #endif #ifndef OPENSSL_NO_RC5 # define OPENSSL_NO_RC5 #endif #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif #ifndef OPENSSL_NO_AFALGENG # define OPENSSL_NO_AFALGENG #endif #ifndef OPENSSL_NO_ASAN # define OPENSSL_NO_ASAN #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG # define OPENSSL_NO_CRYPTO_MDEBUG #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE #endif #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 # define OPENSSL_NO_EC_NISTP_64_GCC_128 #endif #ifndef OPENSSL_NO_EGD # define OPENSSL_NO_EGD #endif #ifndef OPENSSL_NO_FUZZ_AFL # define OPENSSL_NO_FUZZ_AFL #endif #ifndef OPENSSL_NO_FUZZ_LIBFUZZER # define OPENSSL_NO_FUZZ_LIBFUZZER #endif #ifndef OPENSSL_NO_HEARTBEATS # define OPENSSL_NO_HEARTBEATS #endif #ifndef OPENSSL_NO_MSAN # define OPENSSL_NO_MSAN #endif #ifndef OPENSSL_NO_SCTP # define OPENSSL_NO_SCTP #endif #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif #ifndef OPENSSL_NO_SSL3 # define OPENSSL_NO_SSL3 #endif #ifndef OPENSSL_NO_SSL3_METHOD # define OPENSSL_NO_SSL3_METHOD #endif #ifndef OPENSSL_NO_UBSAN # define OPENSSL_NO_UBSAN #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif #ifndef OPENSSL_NO_WEAK_SSL_CIPHERS # define OPENSSL_NO_WEAK_SSL_CIPHERS #endif #ifndef OPENSSL_NO_AFALGENG # define OPENSSL_NO_AFALGENG #endif /* * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers * don't like that. This will hopefully silence them. */ #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; /* * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the * declarations of functions deprecated in or before <version>. Otherwise, they * still won't see them if the library has been built to disable deprecated * functions. */ #if defined(OPENSSL_NO_DEPRECATED) # define DECLARE_DEPRECATED(f) #elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); #else # define DECLARE_DEPRECATED(f) f; #endif #ifndef OPENSSL_FILE # ifdef OPENSSL_NO_FILENAMES # define OPENSSL_FILE "" # define OPENSSL_LINE 0 # else # define OPENSSL_FILE __FILE__ # define OPENSSL_LINE __LINE__ # endif #endif #ifndef OPENSSL_MIN_API # define OPENSSL_MIN_API 0 #endif #if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API # undef OPENSSL_API_COMPAT # define OPENSSL_API_COMPAT OPENSSL_MIN_API #endif #if OPENSSL_API_COMPAT < 0x10100000L # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_1_0(f) #endif #if OPENSSL_API_COMPAT < 0x10000000L # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_0_0(f) #endif #if OPENSSL_API_COMPAT < 0x00908000L # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_0_9_8(f) #endif #define OPENSSL_CPUID_OBJ /* Generate 80386 code? */ #undef I386_ONLY #undef OPENSSL_UNISTD #define OPENSSL_UNISTD <unistd.h> #define OPENSSL_EXPORT_VAR_AS_FUNCTION /* * The following are cipher-specific, but are part of the public API. */ #if !defined(OPENSSL_SYS_UEFI) # define BN_LLONG /* Only one for the following should be defined */ # undef SIXTY_FOUR_BIT_LONG # undef SIXTY_FOUR_BIT # define THIRTY_TWO_BIT #endif #define RC4_INT unsigned int #ifdef __cplusplus } #endif
/******************************************************************************* * File Name: Enc_L.h * Version 2.20 * * Description: * This file contains the Alias definitions for Per-Pin APIs in cypins.h. * Information on using these APIs can be found in the System Reference Guide. * * Note: * ******************************************************************************** * Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. *******************************************************************************/ #if !defined(CY_PINS_Enc_L_ALIASES_H) /* Pins Enc_L_ALIASES_H */ #define CY_PINS_Enc_L_ALIASES_H #include "cytypes.h" #include "cyfitter.h" /*************************************** * Constants ***************************************/ #define Enc_L_0 (Enc_L__0__PC) #define Enc_L_0_INTR ((uint16)((uint16)0x0001u << Enc_L__0__SHIFT)) #define Enc_L_INTR_ALL ((uint16)(Enc_L_0_INTR)) #endif /* End Pins Enc_L_ALIASES_H */ /* [] END OF FILE */
// // Copyright (c) 2008-2014 the Urho3D project. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #include "GraphicsDefs.h" #include "RefCounted.h" #include "Vector.h" #include <d3d9.h> namespace Urho3D { class Graphics; class VertexBuffer; /// Element in the vertex declaration. struct VertexDeclarationElement { /// Stream index. unsigned stream_; /// Element type. VertexElement element_; /// Element offset. unsigned offset_; }; /// Vertex declaration. class URHO3D_API VertexDeclaration : public RefCounted { public: /// Construct with vertex element mask. VertexDeclaration(Graphics* graphics, unsigned elementMask); /// Construct with vertex buffers and element masks to base declaration on. VertexDeclaration(Graphics* graphics, const PODVector<VertexBuffer*>& buffers, const PODVector<unsigned>& elementMasks); /// Construct with vertex buffers (shared pointer vector) and element masks to base declaration on. VertexDeclaration(Graphics* graphics, const Vector<SharedPtr<VertexBuffer> >& buffers, const PODVector<unsigned>& elementMasks); /// Destruct. ~VertexDeclaration(); /// Return Direct3D vertex declaration. IDirect3DVertexDeclaration9* GetDeclaration() const { return declaration_; } private: /// Create declaration. void Create(Graphics* graphics, const PODVector<VertexDeclarationElement>& elements); /// Release declaration. void Release(); /// Direct3D vertex declaration. IDirect3DVertexDeclaration9* declaration_; }; }
// // UIMessageInputViewController.h // DouPaiwo // // Created by J006 on 15/6/27. // Copyright (c) 2015年 paiwo.co. All rights reserved. // #import "BaseViewController.h" #import "UserInstance.h" #define kKeyboardView_Height 216.0 #define kMessageInputView_Height 50.0 #define kMessageInputView_HeightMax 120.0 #define kMessageInputView_PadingHeight 7.0 #define kMessageInputView_Width_Tool 35.0 #define kMessageInputView_MediaPadding 1.0 #define kPaddingLeftWidth 15.0 #define kKeyWindow [UIApplication sharedApplication].keyWindow typedef NS_ENUM(NSInteger, UIMessageInputViewContentType) { UIMessageInputViewContentTypeComment = 0, UIMessageInputViewContentTypePriMsg, UIMessageInputViewContentTypeTopic, UIMessageInputViewContentTypeTask }; typedef NS_ENUM(NSInteger, UIMessageInputViewState) { UIMessageInputViewStateSystem, UIMessageInputViewStateEmotion, UIMessageInputViewStateAdd }; @protocol UIMessageInputViewControllerDelegate; @interface UIMessageInputViewController : UIView<UITextViewDelegate> @property (strong, nonatomic) NSString *placeHolder; @property (assign, nonatomic) BOOL isAlwaysShow; @property (assign, nonatomic, readonly) UIMessageInputViewContentType contentType; @property (strong, nonatomic) UserInstance *toUser; @property (strong, nonatomic) NSNumber *commentOfId; @property (nonatomic, weak) id<UIMessageInputViewControllerDelegate> delegate; + (instancetype)messageInputViewWithType:(UIMessageInputViewContentType)type; + (instancetype)messageInputViewWithType:(UIMessageInputViewContentType)type placeHolder:(NSString *)placeHolder; - (void)prepareToShow; - (void)prepareToDismiss; - (void)prepareToHold; - (BOOL)notAndBecomeFirstResponder; - (BOOL)isAndResignFirstResponder; - (BOOL)isCustomFirstResponder; - (void)prepareToAtSomeOne; @end @protocol UIMessageInputViewControllerDelegate <NSObject> @optional - (void)messageInputView:(UIMessageInputViewController *)inputView sendText:(NSString *)text; - (void)messageInputView:(UIMessageInputViewController *)inputView sendBigEmotion:(NSString *)emotionName; - (void)messageInputView:(UIMessageInputViewController *)inputView addIndexClicked:(NSInteger)index; - (void)messageInputView:(UIMessageInputViewController *)inputView heightToBottomChenged:(CGFloat)heightToBottom; @end
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "lab4.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/adc.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/pwm.h" #include "driverlib/sysctl.h" // FFT #include "optfft.h" /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "semphr.h" // Bring image frequency global variable into scope extern double imageFrequency; extern xTaskHandle imageCaptureHandle; #define NUM_SAMPLES 256 // Sample rate in Hz #define SAMPLE_FREQ 34500 double computeFrequency(signed int); void imageCapture(void* taskDataPtr) { imageCaptureDataStruct* dataPtr = (imageCaptureDataStruct*) taskDataPtr; signed int* realData = dataPtr->processedDataPtr; double* frequency = dataPtr->frequencyPtr; while(1) { // Disable interrupts during FFT reading IntMasterDisable(); // Compute FFT signed int imaginaryData[256] = {0}; for (int i = 0; i < NUM_SAMPLES - 1; i++) { unsigned int adcReading[1] = {0}; // Collect input image data // Below code adapted from temperature_sensor.c in IAR examples/peripherals // Clear the interrupt status flag. This is done to make sure the // interrupt flag is cleared before we sample. ADCIntClear(ADC0_BASE, 3); // Trigger the ADC conversion. ADCProcessorTrigger(ADC0_BASE, 3); // Wait for conversion to be completed. while(!ADCIntStatus(ADC0_BASE, 3, false)) { } // Clear the ADC interrupt flag. ADCIntClear(ADC0_BASE, 3); // Read ADC Value from ADC0. ADCSequenceDataGet(ADC0_BASE, 3, adcReading); // convert adcReading from 0, 1023 to -31, 32 // 1023 / 16 = 63 -> 0 to 63; 63 - 31 = 32, 0 - 31 = -31 signed int adcReadingConverted = ((signed int)adcReading[0]) / 16 - 31; realData[i] = adcReadingConverted; } // Range of samples is -31 to 32 signed int maxIndex = optfft(realData, imaginaryData); // Get frequency of signal *frequency = (SAMPLE_FREQ * maxIndex) / NUM_SAMPLES; // Update global variable imageFrequency = *frequency; // Re-enable interrupts IntMasterEnable(); vTaskSuspend(imageCaptureHandle); vTaskDelay(100); } } double computeFrequency(signed int maxIndex) { double frequency = SAMPLE_FREQ * maxIndex / NUM_SAMPLES; return frequency; }
// // UIBarButtonItem+YRJBarButtonItem.h // YRJKit // // Created by YURENJIE on 2018/3/7. // Copyright © 2018年 yurenjie. All rights reserved. // #import <UIKit/UIKit.h> @interface UIBarButtonItem (YRJBarButtonItem) @property (nullable, nonatomic, copy) void (^actionBlock)(id); @end
#ifndef GXX_INET2_SOCKET_H #define GXX_INET2_SOCKET_H #include <exception> namespace gxx { namespace inet2 { struct socket_exception : std::exception { int errno; const char* what() const { return strerror(errno); } } enum class socktype { tcp, udp, unix, }; class socket { inet::socket sock; //exception socket(gxx::hostaddr addr, int port, socktype type); socket(); void connect(gxx::hostaddr addr, int port, socktype type); }; } } #endif
// // RSSFeedItemXML.h // RssReader // // Created by YannickL on 10/03/14. // Copyright (c) 2014 Yannick Loriot. All rights reserved. // #import <Foundation/Foundation.h> @interface RSSFeedItemXML : NSObject @property (nonatomic, strong) NSString *guid; @property (nonatomic, strong) NSString *summary; @property (nonatomic, strong) NSString *title; @property (nonatomic, strong) NSString *link; @property (nonatomic, strong) NSDate *pubDate; @end
/* CpuArch.h -- CPU specific code 2015-10-31: Igor Pavlov : Public domain */ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H #include "7zTypes.h" EXTERN_C_BEGIN /* MY_CPU_LE means that CPU is LITTLE ENDIAN. MY_CPU_BE means that CPU is BIG ENDIAN. If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform. MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. */ #if defined(_M_X64) \ || defined(_M_AMD64) \ || defined(__x86_64__) \ || defined(__AMD64__) \ || defined(__amd64__) #define MY_CPU_AMD64 #endif #if defined(MY_CPU_AMD64) \ || defined(_M_IA64) \ || defined(__AARCH64EL__) \ || defined(__AARCH64EB__) #define MY_CPU_64BIT #endif #if defined(_M_IX86) || defined(__i386__) #define MY_CPU_X86 #endif #if defined(MY_CPU_X86) || defined(MY_CPU_AMD64) #define MY_CPU_X86_OR_AMD64 #endif #if defined(MY_CPU_X86) \ || defined(_M_ARM) \ || defined(__ARMEL__) \ || defined(__THUMBEL__) \ || defined(__ARMEB__) \ || defined(__THUMBEB__) #define MY_CPU_32BIT #endif #if defined(_WIN32) && defined(_M_ARM) #define MY_CPU_ARM_LE #endif #if defined(_WIN32) && defined(_M_IA64) #define MY_CPU_IA64_LE #endif #if defined(MY_CPU_X86_OR_AMD64) \ || defined(MY_CPU_ARM_LE) \ || defined(MY_CPU_IA64_LE) \ || defined(__LITTLE_ENDIAN__) \ || defined(__ARMEL__) \ || defined(__THUMBEL__) \ || defined(__AARCH64EL__) \ || defined(__MIPSEL__) \ || defined(__MIPSEL) \ || defined(_MIPSEL) \ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) #define MY_CPU_LE #endif #if defined(__BIG_ENDIAN__) \ || defined(__ARMEB__) \ || defined(__THUMBEB__) \ || defined(__AARCH64EB__) \ || defined(__MIPSEB__) \ || defined(__MIPSEB) \ || defined(_MIPSEB) \ || defined(__m68k__) \ || defined(__s390x__) \ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) #define MY_CPU_BE #endif #if defined(MY_CPU_LE) && defined(MY_CPU_BE) Stop_Compiling_Bad_Endian #endif #ifdef MY_CPU_LE #if defined(MY_CPU_X86_OR_AMD64) \ /* || defined(__AARCH64EL__) */ #define MY_CPU_LE_UNALIGN #endif #endif #ifdef MY_CPU_LE_UNALIGN #define GetUi16(p) (*(const UInt16 *)(const void *)(p)) #define GetUi32(p) (*(const UInt32 *)(const void *)(p)) #define GetUi64(p) (*(const UInt64 *)(const void *)(p)) #define SetUi16(p, v) { *(UInt16 *)(p) = (v); } #define SetUi32(p, v) { *(UInt32 *)(p) = (v); } #define SetUi64(p, v) { *(UInt64 *)(p) = (v); } #else #define GetUi16(p) ( (UInt16) ( \ ((const Byte *)(p))[0] | \ ((UInt16)((const Byte *)(p))[1] << 8) )) #define GetUi32(p) ( \ ((const Byte *)(p))[0] | \ ((UInt32)((const Byte *)(p))[1] << 8) | \ ((UInt32)((const Byte *)(p))[2] << 16) | \ ((UInt32)((const Byte *)(p))[3] << 24)) #define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) #define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ _ppp_[0] = (Byte)_vvv_; \ _ppp_[1] = (Byte)(_vvv_ >> 8); } #define SetUi32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ _ppp_[0] = (Byte)_vvv_; \ _ppp_[1] = (Byte)(_vvv_ >> 8); \ _ppp_[2] = (Byte)(_vvv_ >> 16); \ _ppp_[3] = (Byte)(_vvv_ >> 24); } #define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \ SetUi32(_ppp2_ , (UInt32)_vvv2_); \ SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); } #endif #if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ (_MSC_VER >= 1300) /* Note: we use bswap instruction, that is unsupported in 386 cpu */ #include <stdlib.h> #pragma intrinsic(_byteswap_ulong) #pragma intrinsic(_byteswap_uint64) #define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) #define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) #define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v) #elif defined(MY_CPU_LE_UNALIGN) && defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p)) #define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p)) #define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v) #else #define GetBe32(p) ( \ ((UInt32)((const Byte *)(p))[0] << 24) | \ ((UInt32)((const Byte *)(p))[1] << 16) | \ ((UInt32)((const Byte *)(p))[2] << 8) | \ ((const Byte *)(p))[3] ) #define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) #define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ _ppp_[0] = (Byte)(_vvv_ >> 24); \ _ppp_[1] = (Byte)(_vvv_ >> 16); \ _ppp_[2] = (Byte)(_vvv_ >> 8); \ _ppp_[3] = (Byte)_vvv_; } #endif #define GetBe16(p) ( (UInt16) ( \ ((UInt16)((const Byte *)(p))[0] << 8) | \ ((const Byte *)(p))[1] )) #ifdef MY_CPU_X86_OR_AMD64 typedef struct { UInt32 maxFunc; UInt32 vendor[3]; UInt32 ver; UInt32 b; UInt32 c; UInt32 d; } Cx86cpuid; enum { CPU_FIRM_INTEL, CPU_FIRM_AMD, CPU_FIRM_VIA }; void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d); Bool x86cpuid_CheckAndRead(Cx86cpuid *p); int x86cpuid_GetFirm(const Cx86cpuid *p); #define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF)) #define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF)) #define x86cpuid_GetStepping(ver) (ver & 0xF) Bool CPU_Is_InOrder(); Bool CPU_Is_Aes_Supported(); #endif EXTERN_C_END #endif
#ifndef SANDBOX_MY_SANDBOX_APPS_BLASTX_OWN_FUNCTIONS_ //parse_arguments.cpp int PARSE_ARGUMENTS(int argc,char const ** argv,Values comVal) #define SANDBOX_MY_SANDBOX_APPS_DNA_SIMULATION_MY_HEADER_ #endif // #ifndef SANDBOX_MY_SANDBOX_APPS_DNA_SIMULATION_MY_HEADER_
@interface MSPair : NSObject { id first; // 8 = 0x8 id second; // 16 = 0x10 } + (id)pairWith:(id)arg1 and:(id)arg2; @property(retain, nonatomic) id second; // @synthesize second; @property(retain, nonatomic) id first; // @synthesize first; - (void).cxx_destruct; @end
// // BKBBaseItem+Misc.h // BlurgKnowledgeBase (BKB) // // Created by Viktor Antonov on 02/01/2018. // Copyright © 2018 Viktor Antonov. 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 "BKBBaseItem.h" /** Miscellaneous section of BKBBaseItem. Stuff methods */ @interface BKBBaseItem (Misc) ///------------------------------- /// @name Map Routine ///------------------------------- /** Append map @param map To append */ - (void)misc_appendMap:(NSDictionary *)map; ///------------------------------- /// @name JSON Routine ///------------------------------- /* JSON string @return source map as JSON string */ - (NSString *)misc_jsonAsString; /** JSON data @return source map as JSON data */ - (NSData *)misc_jsonAsData; @end
/*** * Inferno Engine v4 2015-2017 * Written by Tomasz "Rex Dex" Jonarski * * [# filter: input\generic #] ***/ #pragma once #include "inputDevice.h" #include "inputStructures.h" namespace base { namespace input { /// generic keyboard device class BASE_INPUT_API GenericKeyboard : public NoCopy { public: GenericKeyboard(IContext* owner, DeviceID id = 0); // reset state void reset(); // process the repeat key void update(); // set keyboard repeat and delay void setRepeatAndDelay(const Float delay, const Float repeatRate); // emit a key down event void keyDown(const KeyCode keyCode); // emit a key up event void keyUp(const KeyCode keyCode); // emit a char void charDown(const KeyScanCode scanCode); // get the control key mask KeyMask getCurrentKeyMask() const; // get the current SHIFT/CTRL/ALT key mask private: Bool m_pressedKeys[(Uint16)KeyCode::KEY_MAX]; // windows owning given pressed keys struct RepeatKey { KeyCode m_keyCode; KeyMask m_keyMask; NativeTimePoint m_nextRepeatTime; Bool m_pressed; Uint32 m_maxRepeat; FORCEINLINE RepeatKey() : m_keyCode((KeyCode)0) , m_maxRepeat(1) , m_pressed(false) {} FORCEINLINE RepeatKey(const KeyCode code, const KeyMask keyMask, const NativeTimePoint& nextRepeatTime) : m_keyCode(code) , m_keyMask(keyMask) , m_nextRepeatTime(nextRepeatTime) , m_maxRepeat(1) , m_pressed(true) {} FORCEINLINE void reset() { m_keyCode = (KeyCode)0; m_maxRepeat = 1; m_pressed = false; } FORCEINLINE const Bool valid() const { return m_pressed; } }; RepeatKey m_repeatKey; NativeTimeInterval m_keyRepeatDelay; NativeTimeInterval m_keyRepeatPeriod; IContext* m_context; DeviceID m_id; }; } // input } // base
// // MVADataBus.h // VisitBCN // // Created by Mauro Vime Castillo on 14/11/14. // Copyright (c) 2014 Mauro Vime Castillo. All rights reserved. // #import <Foundation/Foundation.h> #import "CHCSVParser.h" #import "MVABusSeq.h" #import "MVAStop.h" #import "MVARoute.h" #import "MVAFrequencies.h" /** * This class englobes all the data of the bus network. * * We can represent this class as a table: * * | Bus stops | Bus hash | Bus routes | Bus routes hash | Trips ida | Trips ida hash | Trips vuelta | Trips vuelta hash | Frequencies | * |:---------:|:----------:|:----------:|:---------------:|:---------:|:--------------:|:------------:|:-----------------:|:-----------:| * | Array | Hash table | Array | Hash table | Array | Hash table | Array | Hash table | Array | * * @since version 1.0 */ @interface MVADataBus : NSObject /** * The stops of the bus network * * @see MVAStop class * @since version 1.0 */ @property NSMutableArray *busStops; /** * This hash table is used to index the stopIDs and make more efficient the algorithm executions * * @since version 1.0 */ @property NSMutableDictionary *busHash; /** * The routes that operate in the bus network * * @see MVARoute class * @since version 1.0 */ @property NSMutableArray *busRoutes; /** * This hash table is used to index the routeIDs and make more efficient the algorithm executions * * @since version 1.0 */ @property NSMutableDictionary *busRoutesHash; /** * The trips in the 'forward' direction * * @see MVATrip class * @since version 1.0 */ @property NSMutableArray *tripsIda; /** * This hash table is used to index the 'tripsIda' and make more efficient the algorithm executions * * @since version 1.0 */ @property NSMutableDictionary *tripsHashIda; /** * The trips in the'backward' direction * * @see MVATrip class * @since version 1.0 */ @property NSMutableArray *tripsVuelta; /** * This hash table is used to index the 'tripsVuelta' and make more efficient the algorithm executions * * @since version 1.0 */ @property NSMutableDictionary *tripsHashVuelta; /** * The frequencies of all the bus routes and directions * * @see MVAFrequencies class * @since version 1.0 */ @property NSMutableArray *frequencies; /** * This function initiates the parsing of the bus data * * @since version 1.0 */ - (void)parseDataBase; /** * This function is used as a query to retrieve the frequency for a given stop, time and calendar. Cost: O(F), where F is the number of frequencies. * * @param stop The bus stop that performs the query * @param currentTime The time for which the query is performed * @param serviceID The identifier of the service that operates in that stop at that moment * * @return The frequency in seconds (double) * * @since version 1.0 */ -(double)frequencieForStop:(MVAStop *)stop andTime:(double)currentTime andCalendar:(NSString *)serviceID; @end
// // AnimationDef.h // SpaceStationKeeper // // Created by Sean Dawson on 21/05/2014. // // #ifndef SpaceStationKeeper_AnimationDef_h #define SpaceStationKeeper_AnimationDef_h #include "TextureDef.h" using namespace std; class AnimationDef : public TextureDef { public: // Constructors/Destructors AnimationDef(Node node, string animationName); virtual ~AnimationDef(); // Getters/Setters /*! Gets the name of the animation. */ string getName(); /*! Gets the frame that the animation starts on. */ int getFrameStart(); /*! Gets the frame that the animation stops on. */ int getFrameEnd(); /*! Gets the rate (in fps) that the animation should play by default. */ float getRate(); /*! Gets if the animation should loop by default. */ bool getLoop(); /*! Gets if the TextureDef can be used for animation. */ bool getIsAnimated(); // Static Methods /*! Constructs an instance of TextureDef from a loaded YAML node. This should * be called by an AssetLoader and not directly through scripts. */ static std::shared_ptr<AnimationDef> FromYamlNode(Node node, string animationName); private: // Fields /*! The name of the animation. */ string _name; /*! The frame that the animation starts on. */ int _frameStart; /*! The frame that the animation stops on. */ int _frameEnd; /*! The rate (in fps) that the animation should play by default. */ float _rate; /*! Determines if the animation should loop by default. */ bool _loop; }; /*! A shared pointer reference to a TextureDef object. */ typedef std::shared_ptr<AnimationDef> AnimationDefRef; /*! A specilization of GetAssetType to allow compile time definition of this * classes AssetType. */ template <> struct GetAssetType<AnimationDef> { static const AssetType value = AssetType::Animation; }; #endif
#ifndef _CST_VITERBI_H__ #define _CST_VITERBI_H__ #include "cst_file.h" #include "cst_math.h" #include "cst_utterance.h" typedef struct cst_vit_cand_struct { int score; cst_val *val; int ival, pos; cst_item *item; struct cst_vit_cand_struct *next; } cst_vit_cand; cst_vit_cand *new_vit_cand(); void vit_cand_set(cst_vit_cand *vc, cst_val *val); void vit_cand_set_int(cst_vit_cand *vc, int ival); void delete_vit_cand(cst_vit_cand *vc); typedef struct cst_vit_path_struct { int score; int state; cst_vit_cand *cand; cst_features *f; struct cst_vit_path_struct *from; struct cst_vit_path_struct *next; } cst_vit_path; cst_vit_path *new_vit_path(); void delete_vit_path(cst_vit_path *vp); typedef struct cst_vit_point_struct { cst_item *item; int num_states; int num_paths; cst_vit_cand *cands; cst_vit_path *paths; cst_vit_path **state_paths; struct cst_vit_point_struct *next; } cst_vit_point; cst_vit_point *new_vit_point(); void delete_vit_point(cst_vit_point *vp); struct cst_viterbi_struct; /* Functions for user call back, to find candiates at a point, and to join (and score) paths */ typedef cst_vit_cand *(cst_vit_cand_f_t)(cst_item *s, struct cst_viterbi_struct *vd); typedef cst_vit_path *(cst_vit_path_f_t)(cst_vit_path *p, cst_vit_cand *c, struct cst_viterbi_struct *vd); typedef struct cst_viterbi_struct { int num_states; cst_vit_cand_f_t *cand_func; cst_vit_path_f_t *path_func; int big_is_good; cst_vit_point *timeline; cst_vit_point *last_point; cst_features *f; } cst_viterbi; cst_viterbi *new_viterbi(cst_vit_cand_f_t *cand_func, cst_vit_path_f_t *path_func); void delete_viterbi(cst_viterbi *vd); void viterbi_initialise(cst_viterbi *vd,cst_relation *r); void viterbi_decode(cst_viterbi *vd); int viterbi_result(cst_viterbi *vd, const char *n); void viterbi_copy_feature(cst_viterbi *vd,const char *featname); #endif
// // Tomato Media Core // ±àÂë̽²â // ×÷ÕߣºSunnyCase // ´´½¨Ê±¼ä£º2015-12-31 // #pragma once #include "Tomato.Core/Tomato.Core.h" #include <MLang.h> DEFINE_NS_CORE class EncodingDetector { public: EncodingDetector(); ~EncodingDetector(); DWORD DetectCodePage(const std::string& text); private: WRL::ComPtr<IMultiLanguage2> _multiLang; }; END_NS_CORE
// // This source file is part of appleseed. // Visit https://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2017-2018 Esteban Tovagliari, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once // appleseed.renderer headers. #include "renderer/modeling/aov/iaovfactory.h" // appleseed.foundation headers. #include "foundation/utility/autoreleaseptr.h" // appleseed.main headers. #include "main/dllsymbol.h" // Forward declarations. namespace foundation { class Dictionary; } namespace foundation { class DictionaryArray; } namespace renderer { class AOV; } namespace renderer { class ParamArray; } namespace renderer { // // A factory for emission AOVs. // class APPLESEED_DLLSYMBOL EmissionAOVFactory : public IAOVFactory { public: // Delete this instance. void release() override; // Return a string identifying this AOV model. const char* get_model() const override; // Return metadata for this AOV model. foundation::Dictionary get_model_metadata() const override; // Return metadata for the inputs of this AOV model. foundation::DictionaryArray get_input_metadata() const override; // Create a new AOV instance. foundation::auto_release_ptr<AOV> create( const ParamArray& params) const override; }; } // namespace renderer
// System call numbers #define SYS_fork 1 #define SYS_exit 2 #define SYS_wait 3 #define SYS_pipe 4 #define SYS_read 5 #define SYS_kill 6 #define SYS_exec 7 #define SYS_fstat 8 #define SYS_chdir 9 #define SYS_dup 10 #define SYS_getpid 11 #define SYS_sbrk 12 #define SYS_sleep 13 #define SYS_uptime 14 #define SYS_open 15 #define SYS_write 16 #define SYS_mknod 17 #define SYS_unlink 18 #define SYS_link 19 #define SYS_mkdir 20 #define SYS_close 21 #define SYS_history 22 #define SYS_wait2 23 #define SYS_yield 24 #define SYS_add_history 25 #define SYS_set_prio 26 #define SYS_init_history 27
// // Copyright (c) 2014 Roland Sorel // See LICENSE.md // #ifndef CBEATMODEL_H #define CBEATMODEL_H #include <set> #include "IBeatModel.h" class CBeatModelObject; // This is the base class for the beat model. // It implements the IBeatModel api along with its // own behavior. class CBeatModel : public IBeatModel { public: // Ctor. CBeatModel(); // Destructor. virtual ~CBeatModel(); // Initialize the beat model. virtual void initialize(); // The Controller uses these methods // // Turn on the beat generator. virtual void on(); // Turn off the beat generator. virtual void off(); // Change the beat frequency to the bpm value immediately. virtual void setBPM( int bpm ); // Observers can use these methods // // Returns the bpm or 0 if the genetator is off. virtual int getBPM(); // Observers can register to be notified of the beat. virtual void registerBeatObserver( IObserver* ob ); // Observers can deregister. virtual void removeBeatObserver( IObserver* ob ); // Observers can register to be notified of changes to BPM. virtual void registerBpmObserver( IObserver* ob ); // Observers can deregister. virtual void removeBpmObserver( IObserver* ob ); // Called by the beat model object whenever a beat is started. void beatEvent(); private: // Called every time the bpm changes. // This is used to notify BPM obervers. void notifyBpmObservers(); // Called every time the beat happens. // This is used to notify beat obervers. void notifyBeatObservers(); // Observers. std::set<IObserver*> m_beatObservers; std::set<IObserver*> m_bpmObservers; // BPM. int m_bpm; // The beat model object, which uses the thread. CBeatModelObject* m_modelObject; }; #endif // CBEATMODEL_H
// Copyright (c) 2011-2015 The Deuscoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef DEUSCOIN_QT_ADDRESSTABLEMODEL_H #define DEUSCOIN_QT_ADDRESSTABLEMODEL_H #include <QAbstractTableModel> #include <QStringList> class AddressTablePriv; class WalletModel; class CWallet; /** Qt model of the address book in the core. This allows views to access and modify the address book. */ class AddressTableModel : public QAbstractTableModel { Q_OBJECT public: explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0); ~AddressTableModel(); enum ColumnIndex { Label = 0, /**< User specified label */ Address = 1 /**< Deuscoin address */ }; enum RoleIndex { TypeRole = Qt::UserRole /**< Type of address (#Send or #Receive) */ }; /** Return status of edit/insert operation */ enum EditStatus { OK, /**< Everything ok */ NO_CHANGES, /**< No changes were made during edit operation */ INVALID_ADDRESS, /**< Unparseable address */ DUPLICATE_ADDRESS, /**< Address already in address book */ WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */ KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */ }; static const QString Send; /**< Specifies send address */ static const QString Receive; /**< Specifies receive address */ /** @name Methods overridden from QAbstractTableModel @{*/ int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; bool setData(const QModelIndex &index, const QVariant &value, int role); QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex &parent) const; bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); Qt::ItemFlags flags(const QModelIndex &index) const; /*@}*/ /* Add an address to the model. Returns the added address on success, and an empty string otherwise. */ QString addRow(const QString &type, const QString &label, const QString &address); /* Look up label for address in address book, if not found return empty string. */ QString labelForAddress(const QString &address) const; /* Look up row index of an address in the model. Return -1 if not found. */ int lookupAddress(const QString &address) const; EditStatus getEditStatus() const { return editStatus; } private: WalletModel *walletModel; CWallet *wallet; AddressTablePriv *priv; QStringList columns; EditStatus editStatus; /** Notify listeners that data changed. */ void emitDataChanged(int index); public Q_SLOTS: /* Update address list from core. */ void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status); friend class AddressTablePriv; }; #endif // DEUSCOIN_QT_ADDRESSTABLEMODEL_H
#ifndef TWO_DEE_H_INCLUDED #define TWO_DEE_H_INCLUDED namespace venk { class Matrix33; class Vector2d : public Tuple<float, 2> { private: static const int X = 0; static const int Y = 1; static const int U = 0; static const int V = 1; public: static const std::size_t tuple_size = 2; static const eScalarType element_type = BufferElementType<float>::element_type; Vector2d(float x, float y) { elements[X] = x; elements[Y] = y; } float magnitude() const { return sqrtf(elements[X] * elements[X] + elements[Y] * elements[Y]); } inline float& x() { return elements[X]; }; inline float x() const { return elements[X]; }; inline float& y() { return elements[Y]; }; inline float y() const { return elements[Y]; }; inline float& u() { return elements[U]; }; inline float u() const { return elements[U]; }; inline float& v() { return elements[V]; }; inline float v() const { return elements[V]; }; }; inline float dot(const Vector2d& a, const Vector2d& b) { return a.x() * b.x() + a.y() * b.y(); } class Vertex2d : public Tuple<float, 3> { public: static const int X = 0; static const int Y = 1; static const int W = 2; static const std::size_t tuple_size = 3; static const eScalarType element_type = BufferElementType<float>::element_type; }; } #endif
/* Implementation of the server prototype MIT License Copyright (c) [2017] [Neilson P. Marcil] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <ctype.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/un.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include "server.h" /* internal error code */ const int8_t ERR_CANNOT_BIND_SOCKET = -1; const int8_t ERR_CANNOT_CREATE_SOCKET = -2; /* catching termination signal to cleanup */ void close_resources(int signum); int g_serverSocket; int create_new_server(struct serverparams *params) { int socket = 0; socket = open_server_socket(params->port, params->domain, params->type, params->protocol); // socket created, listening the server if (socket > 0) { set_sigterm_handler(socket); listen_and_accept(socket, params->queue, params->request_handler); return 0; } // there was an error, throwing it return socket; } int open_server_socket(int port, int domain, int type, int protocol) { struct sockaddr_in saddr; int ssocket = 0; print_info("Creating a new server socket to listen on port %d", port); if ((ssocket = socket(domain, type, protocol)) < 0) { print_error("Could not create a socket: %d", errno); return ERR_CANNOT_CREATE_SOCKET; } memset(&saddr, 0, sizeof(saddr)); saddr.sin_family = domain; saddr.sin_port = htons(port); saddr.sin_addr.s_addr = INADDR_ANY; if (bind(ssocket, (struct sockaddr*)&saddr, sizeof(saddr)) < 0) { print_error("Cannot bind to socket, maybe port already in use?"); return ERR_CANNOT_BIND_SOCKET; } print_info("Server socket [%d] binded on port %d", ssocket, port); return ssocket; } void listen_and_accept(int socket, int queue, void (*handler)(int)) { struct sockaddr_in caddr; unsigned int caddrLen = sizeof(caddr); int client = 0; memset(&caddr, 0, caddrLen); listen(socket, queue); print_info("Now accepting incoming connection"); while ((client = accept(socket, (struct sockaddr*)&caddr, &caddrLen)) != -1) { print_info("Connection accepted from %d", caddr.sin_addr.s_addr); if (fork() == 0) // in child process { close(socket); handler(client); } else // in parent process { close(client); } } } void set_sigterm_handler(int serverSocketDesc) { g_serverSocket = serverSocketDesc; struct sigaction action; memset(&action, 0, sizeof(struct sigaction)); action.sa_handler = close_resources; sigaction(SIGTERM, &action, NULL); sigaction(SIGINT, &action, NULL); } void close_resources(int signum) { print_info("Closing socket [%d]", g_serverSocket); close(g_serverSocket); }
// // HomeworkViewController.h // FinalProject // // Created by chengjie yin on 12/2/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @class Task; @class TaskViewController; @class Course; @interface HomeworkViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource >{ NSMutableArray *homeworkList; } // single Course object used for storing course information @property (nonatomic, retain) Course *currentCourse; // NSMutableArray used for storing all tasks @property (nonatomic, retain) NSMutableArray *homeworkList; // single Task object used for storing task information @property (nonatomic, retain) Task *task; // TaskViewController used for displaying edit task GUI page @property (nonatomic, retain) IBOutlet TaskViewController *taskViewController; @end
#ifndef INPUTDATA_H #define INPUTDATA_H #include "Driver.h" #include "Trailer.h" #include "Location.h" #include "Base.h" #include "Source.h" #include "Customer.h" class InputData { public: InputData(); static InputData* getInstance(); static std::vector<Driver*>* getDrivers(); static std::vector<Trailer*>* getTrailers(); static std::vector<Location*>* getLocations(); static std::vector<Base*>* getBases(); static std::vector<Source*>* getSources(); static std::vector<Customer*>* getCustomers(); void calcNeighborsLocations(); Driver* findDriver(int id); Trailer* findTrailer(int id); Location* findLocation(int id); static double getDistance(int origin, int destination); static double getTime(int origin, int destination); static int getTimeInMinutes(int origin, int destination); inline static int getHorizon(){return instance->horizon_;} inline static int getUnit(){return instance->unit_;} inline static int getNumInst(){return instance->numInst_;} void resizeTimeAndDistanceMatrices(int numLocations); inline double* getDistancesFrom(int orig) {return distance_[orig];} inline double* getTimeFrom(int orig) {return time_[orig];} inline int* getTimeInMinutesFrom(int orig) {return timeInMinutes_[orig];} inline static void setHorizon(int horizon){instance->horizon_ = horizon;} inline static void setUnit(int unit){instance->unit_ = unit;} inline static void setNumInst(int numInst){instance->numInst_ = numInst;} virtual ~InputData(); protected: private: std::vector<Driver*> drivers_; std::vector<Trailer*> trailers_; std::vector<Location*> locations_; std::vector<Base*> bases_; std::vector<Source*> sources_; std::vector<Customer*> customers_; double** distance_; double** time_; int** timeInMinutes_; int horizon_, unit_, numInst_; //int** windowSize_; //find de cada um * //acesso e criação de matriz static InputData* instance; }; #endif // INPUTDATA_H
#ifndef _H_ICP_ #define _H_ICP_ #include <gpc/gpc.h> #include "../csm_all.h" /** This sets the stage. */ void sm_icp(struct sm_params*params, struct sm_result*res); /** This is the meat */ int icp_loop(struct sm_params*params, const double*q0, double*x_new, double*total_error, int*nvalid, int*iterations); /** This is the beef: computing in closed form the next estimate given the correspondences. */ int compute_next_estimate(struct sm_params*params, const double x_old[3], double x_new[3]); /** This termination criterium use epsilon_xy and epsilon_th. It is useless when using the point-to-line-distance; however, we put it here because one can choose to use the point-to-point distance. */ int termination_criterion(struct sm_params*params, const double*delta); /** Naif algorithm */ void find_correspondences(struct sm_params*params); /** Smart algorithm */ void find_correspondences_tricks(struct sm_params*params); /** Checks that find_correspondences_tricks and find_correspondences behave the same. Exit(-1) on error. */ void debug_correspondences(struct sm_params * params); void kill_outliers_trim(struct sm_params*params, double*total_error); void kill_outliers_double(struct sm_params*params); void compute_covariance_exact( LDP laser_ref, LDP laser_sens, const gsl_vector*x, val *cov0_x, val *dx_dy1, val *dx_dy2); void visibilityTest(LDP ld, const gsl_vector*x_old); /** Marks a ray invalid if reading is outside range [min_reading, max_reading]. */ void ld_invalid_if_outside(LDP ld, double min_reading, double max_reading); void swap_double(double*a,double*b); #endif
/** ** edwin.lzh@gmail.com **/ #include "wordcheck/platform.h" #include "wordcheck/utils.h" char *wordcheck_utils_ltrim(char *s) { while (isspace(*s)) s++; return s; } char *wordcheck_utils_rtrim(char *s) { char *back = s + strlen(s); while (isspace(*--back)) ; *(back + 1) = '\0'; return s; } char *wordcheck_utils_trim(char *s) { return wordcheck_utils_rtrim(wordcheck_utils_ltrim(s)); } void wordcheck_utils_strtoupper(char *str) { int len = strlen(str), i; for (i = 0; i < len; i++) { if (str[i] >= 'a' && str[i] <= 'z') { str[i] = str[i] - 'a' + 'A'; } } } void wordcheck_utils_strtolower(char *str) { int len = strlen(str), i; for (i = 0; i < len; i++) { if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = str[i] - 'A' + 'a'; } } } void wordcheck_utils_strreverse(char *str) { int len, i; char *buf; len = strlen(str); buf = malloc(len + 1); memset(buf, 0, len + 1); for (i = len - 1; i >= 0; i--) { buf[len - 1 - i] = str[i]; } memset(str, 0, len + 1); memcpy(str, buf, len); } int wordcheck_utils_strpos(char *haystack, char *needle) { char *p = strstr(haystack, needle); if (p) return p - haystack; return -1; }
// // MKMapView+Zooming.h // FoursquareTest // // Updated by Egor Dovzhenko on 24.07.13. // #import <MapKit/MapKit.h> @interface MKMapView (Zooming) - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated; @end
#include "wayland-desktop-shell-client-protocol.h" #include <stdio.h> #include <stdlib.h> #include <wayland-client.h> #include <time.h> #include <string.h> #include "client/window.h" #include "client/registry.h" #include "log.h" #include "list.h" list_t *surfaces; struct registry *registry; enum scaling_mode { SCALING_MODE_STRETCH, SCALING_MODE_FILL, SCALING_MODE_FIT, SCALING_MODE_CENTER, SCALING_MODE_TILE, }; void sway_terminate(void) { int i; for (i = 0; i < surfaces->length; ++i) { struct window *window = surfaces->items[i]; window_teardown(window); } list_free(surfaces); registry_teardown(registry); exit(EXIT_FAILURE); } int main(int argc, const char **argv) { init_log(L_INFO); surfaces = create_list(); registry = registry_poll(); if (argc != 4) { sway_abort("Do not run this program manually. See man 5 sway and look for output options."); } if (!registry->desktop_shell) { sway_abort("swaybg requires the compositor to support the desktop-shell extension."); } int desired_output = atoi(argv[1]); sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length); int i; struct output_state *output = registry->outputs->items[desired_output]; struct window *window = window_setup(registry, output->width, output->height, false); if (!window) { sway_abort("Failed to create surfaces."); } desktop_shell_set_background(registry->desktop_shell, output->output, window->surface); list_add(surfaces, window); cairo_surface_t *image = cairo_image_surface_create_from_png(argv[2]); double width = cairo_image_surface_get_width(image); double height = cairo_image_surface_get_height(image); const char *scaling_mode_str = argv[3]; enum scaling_mode scaling_mode = SCALING_MODE_STRETCH; if (strcmp(scaling_mode_str, "stretch") == 0) { scaling_mode = SCALING_MODE_STRETCH; } else if (strcmp(scaling_mode_str, "fill") == 0) { scaling_mode = SCALING_MODE_FILL; } else if (strcmp(scaling_mode_str, "fit") == 0) { scaling_mode = SCALING_MODE_FIT; } else if (strcmp(scaling_mode_str, "center") == 0) { scaling_mode = SCALING_MODE_CENTER; } else if (strcmp(scaling_mode_str, "tile") == 0) { scaling_mode = SCALING_MODE_TILE; } else { sway_abort("Unsupported scaling mode: %s", scaling_mode_str); } for (i = 0; i < surfaces->length; ++i) { struct window *window = surfaces->items[i]; if (window_prerender(window) && window->cairo) { switch (scaling_mode) { case SCALING_MODE_STRETCH: cairo_scale(window->cairo, (double) window->width / width, (double) window->height / height); cairo_set_source_surface(window->cairo, image, 0, 0); break; case SCALING_MODE_FILL: { double window_ratio = (double) window->width / window->height; double bg_ratio = width / height; if (window_ratio > bg_ratio) { double scale = (double) window->width / width; cairo_scale(window->cairo, scale, scale); cairo_set_source_surface(window->cairo, image, 0, (double) window->height/2 / scale - height/2); } else { double scale = (double) window->height / height; cairo_scale(window->cairo, scale, scale); cairo_set_source_surface(window->cairo, image, (double) window->width/2 / scale - width/2, 0); } break; } case SCALING_MODE_FIT: { double window_ratio = (double) window->width / window->height; double bg_ratio = width / height; if (window_ratio > bg_ratio) { double scale = (double) window->height / height; cairo_scale(window->cairo, scale, scale); cairo_set_source_surface(window->cairo, image, (double) window->width/2 / scale - width/2, 0); } else { double scale = (double) window->width / width; cairo_scale(window->cairo, scale, scale); cairo_set_source_surface(window->cairo, image, 0, (double) window->height/2 / scale - height/2); } break; } case SCALING_MODE_CENTER: cairo_set_source_surface(window->cairo, image, (double) window->width/2 - width/2, (double) window->height/2 - height/2); break; case SCALING_MODE_TILE: { cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image); cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); cairo_set_source(window->cairo, pattern); break; } default: sway_abort("Scaling mode '%s' not implemented yet!", scaling_mode_str); } cairo_paint(window->cairo); window_render(window); } } while (wl_display_dispatch(registry->display) != -1); for (i = 0; i < surfaces->length; ++i) { struct window *window = surfaces->items[i]; window_teardown(window); } list_free(surfaces); registry_teardown(registry); return 0; }
#include "dbg.h" #include "halmos.h" #include "preproc.h" #include "verifier.h" #include <errno.h> #include <stdio.h> #include <time.h> static const char* flags[halmosflag_size] = { "", "--verbose", "--summary", "--preproc", "--no-preproc", "--no-verify", "--report-count", "--report-hash", "--report-time", "--help", // "--include", }; static const size_t flagsArgc[halmosflag_size] = { 0, /* none */ 1, /* verbose */ 0, /* summary */ 1, /* preproc - the output file */ 0, /* no-preproc */ 0, /* no-verify */ 0, /* report-count */ 0, /* report-hash */ 0, /* report-time */ // 0, /* include */ }; static const char* help = "NAME\n" "\thalmos, a compiler for the halmos language\n" "\n" "SYNOPSIS\n" "\thalmos [optons] file\n" "\n" "DESCRIPTION\n"; void halmosInit(struct halmos* h) { size_t i; for (i = 0; i < halmosflag_size; i++) { h->flags[i] = 0; h->flagsArgv[i] = NULL; } } void halmosClean(struct halmos* h) { (void) h; } void halmosCompile(struct halmos* h, const char* filename) { size_t i; struct preproc p; struct verifier vrf; double ptime = 0.0; double vrftime = 0.0; verifierInit(&vrf); preprocInit(&p); if (h->flags[halmosflag_help]) { printf("%s", help); h->flags[halmosflag_no_preproc] = 1; h->flags[halmosflag_no_verify] = 1; } if (h->flags[halmosflag_verbose]) { errno = 0; size_t verb = strtoul(h->flagsArgv[halmosflag_verbose][0], NULL, 10); if (errno) { printf("%s requires a positive integer\n", flags[halmosflag_verbose]); h->flags[halmosflag_no_preproc] = 1; h->flags[halmosflag_no_verify] = 1; } else { verifierSetVerbosity(&vrf, verb); } } if (!h->flags[halmosflag_no_preproc]) { printf("------preproc\n"); printf("------%s\n", filename); clock_t start = clock(); preprocCompile(&p, filename, "out.mm"); clock_t end = clock(); ptime = ((double) end - start) / CLOCKS_PER_SEC; /* don't verify if preproc failed */ if (p.errCount > 0) { h->flags[halmosflag_no_verify] = 1; } printf("Found %lu errors\n", p.errCount); } /* don't compile if preproc was specified */ if (!h->flags[halmosflag_preproc] && !h->flags[halmosflag_no_verify]) { printf("------verifier\n"); clock_t start = clock(); verifierCompile(&vrf, "out.mm"); clock_t end = clock(); vrftime = ((double) end - start) / CLOCKS_PER_SEC; printf("Found %lu errors\n", vrf.errc); } if (h->flags[halmosflag_summary]) { printf("------summary\n"); h->flags[halmosflag_report_count] = 1; h->flags[halmosflag_report_hash] = 1; h->flags[halmosflag_report_time] = 1; } if (h->flags[halmosflag_report_count]) { printf("------symbol count\n"); for (i = symType_constant; i < symType_size; i++) { printf("Parsed %lu %s symbols\n", vrf.symCount[i], symTypeString(i)); } } if (h->flags[halmosflag_report_hash]) { printf("------hash collision count\nFound %lu collisions\n", vrf.hashc); } if (h->flags[halmosflag_report_time]) { printf("------processing time\npreprocessing: %lf sec\n" "verification: %lf sec\n", ptime, vrftime); } preprocClean(&p); verifierClean(&vrf); } enum halmosflag halmosParseFlag(struct halmos* h, const char* tok) { size_t i; for (i = 0; i < halmosflag_size; i++) { if (strcmp(flags[i], tok) == 0) { h->flags[i] = 1; return i; } } return halmosflag_none; } int halmosMain(int argc, char* argv[]) { if (argc < 2) { printf("Usage: halmos [flags] <filename>\n"); return 0; } struct halmos h; halmosInit(&h); int i; for (i = 1; i < argc - 1; i++) { enum halmosflag flag = halmosParseFlag(&h, argv[i]); if (flag == halmosflag_none) { printf("unrecognized flag %s\n", argv[i]); return 0; } if (flagsArgc[flag] > 0) { h.flagsArgv[flag] = &argv[i + 1]; } i += flagsArgc[flag]; if (i >= argc - 1) { printf("%s takes %lu arguments\n", flags[flag], flagsArgc[flag]); return 0; } } if (i > argc) { printf("Missing input file\n"); return 0; } halmosCompile(&h, argv[argc - 1]); halmosClean(&h); return 0; }
#ifndef KP_CPUID_H #define KP_CPUID_H // SIMD Instruction Flags //// #define CPU_FEATURE_MMX 0x0001 // MMX #define CPU_FEATURE_SSE 0x0002 // Streaming SIMD Extension #define CPU_FEATURE_SSE2 0x0004 // Streaming SIMD Extension 2 #define CPU_FEATURE_SSE3 0x0008 // Streaming SIMD Extension 3 #define CPU_FEATURE_SSSE3 0x0010 // Supplemental Streaming SIMD Extension 3 #define CPU_FEATURE_SSE41 0x0020 // Streaming SIMD Extension 4.1 #define CPU_FEATURE_SSE42 0x0040 // Streaming SIMD Extension 4.2 #define CPU_FEATURE_3DNOW 0x0080 // 3DNow! #define CPU_FEATURE_3DNOWEX 0x0100 // AMD extensions to 3DNow! #define CPU_FEATURE_MMXEX 0x0200 // AMD extensions to MMX // CPU Vendor & Model Name String Length //// #define MAX_VNAME_LEN 13 // 3x4=12 bytes +1 for '/0' #define MAX_MNAME_LEN 64 // PROCESSOR_INFORMATION STRUCTURE //// typedef struct PROCESSOR_INFORMATION { char vendorName[MAX_VNAME_LEN]; // Vendor name, 'GenuineIntel','AuthenticAMD', etc.. char modelName[MAX_MNAME_LEN]; // Model name, e.g. 'Intel Pentium-Pro' int Family; // Processor family, 6 = Pentium-Pro architecture int Model; // Processor model, 1 = Pentium-Pro for family = 6 int Stepping; // Processor revision number unsigned long Feature; // DWORD bitfield of processor features unsigned long OS_Support; // DWORD bitfield of supported OS features unsigned long Checks; // DWORD bitfield mask of checked bits in feature and os_support fields. } CPUINFO; // GetCPUInfo Function //// int GetCPUInfo(CPUINFO *info); // CPUID SIMD Feature Flags Values in the EDX Register //// #define EDX_FF_MMX 0x00800000 // 23rd bit #define EDX_FF_SSE 0x02000000 // 25th bit #define EDX_FF_SSE2 0x04000000 // 26th bit // CPUID SIMD Feature Flags Values in the ECX Register //// #define ECX_FF_SSE3 0x00000001 // 0th bit #define ECX_FF_SSSE3 0x00000200 // 9th bit #define ECX_FF_SSE41 0x00080000 // 19th bit #define ECX_FF_SSE42 0x00100000 // 20th bit - GenuineIntel Only! // CPUID SIMD Feature Flags Values in the EDX Register on AMD //// // These are part of the Extended Feature Identifiers only on AMD // Have to call CPUID with EAX set to 80000001h #define EDX_FF_3DNOW 0x80000000 // 31st bit #define EDX_FF_3DNOWEX 0x40000000 // 30th bit #define EDX_FF_MMXEX 0x00400000 // 22th bit // CPU Model Names //// #define CPU_AMD_AM486 "AMD Am486" #define CPU_AMD_K5 "AMD K5" #define CPU_AMD_K6 "AMD K6" #define CPU_AMD_K6_2 "AMD K6-2" #define CPU_AMD_K6_3 "AMD K6-3" #define CPU_AMD_K7_ATHLON "AMD K7 Athlon" #define CPU_AMD_K7_DURON "AMD K7 Duron" #define CPU_AMD_K8 "AMD K8 Athlon/Sempron/Opteron 64/FX/X2/M" #define CPU_AMD_UNKNOWN "Unknown AMD" #define CPU_INTEL_486DX "INTEL 486DX" #define CPU_INTEL_486SX "INTEL 486SX" #define CPU_INTEL_486DX2 "INTEL 486DX2" #define CPU_INTEL_486SL "INTEL 486SL" #define CPU_INTEL_486SX2 "INTEL 486SX2" #define CPU_INTEL_486DX2E "INTEL 486DX2E" #define CPU_INTEL_486DX4 "INTEL 486DX4" #define CPU_INTEL_PENTIUM "INTEL Pentium" #define CPU_INTEL_PENTIUM_MMX "INTEL Pentium-MMX" #define CPU_INTEL_PENTIUM_PRO "INTEL Pentium-Pro" #define CPU_INTEL_PENTIUM_II "INTEL Pentium-II" #define CPU_INTEL_CELERON "INTEL Celeron" #define CPU_INTEL_PENTIUM_M "INTEL Pentium-M" #define CPU_INTEL_PENTIUM_XEON "INTEL Pentium-III Xeon" #define CPU_INTEL_CORE "INTEL Core" #define CPU_INTEL_CORE2 "INTEL Core 2" #define CPU_INTEL_ATOM "INTEL Atom" #define CPU_INTEL_CORE7 "INTEL Core i7" #define CPU_INTEL_PENTIUM_III "INTEL Pentium-III" #define CPU_INTEL_PENTIUM_4 "INTEL Pentium-4" #define CPU_INTEL_UNKNOWN "Unknown INTEL" #define CPU_CYRIX "Cyrix" #define CPU_CENTAUR "Centaur" #define CPU_UMC "UMC" #define CPU_NEXGEN "NexGen" #define CPU_NSC "National Semiconductor" #define CPU_RISE "Rise Technology" #define CPU_SIS "SiS" #define CPU_TM "Transmeta" #define CPU_UNKNOWN "Unknown" #endif // ! KP_CPUID_H
#pragma once #ifndef MAINH #define MAINH extern void DoClock(int state); extern volatile int measured; enum { ADC_A, ADC_D, ADC_S, ADC_R, ADC_CURVATURE, ADC_VELOCITY, ADC_Count }; extern int clockup; extern int Measure; extern int timesincelastclocktick; extern int adcchannels[ADC_Count]; extern void doTimer(); extern void EnvelopeReset(); extern void EnvelopeTrigger(int sw); extern volatile int i2csending; extern volatile int i2creceiving; #endif
// Copyright 2016 The Draco Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef DRACO_CORE_MACROS_H_ #define DRACO_CORE_MACROS_H_ #include "assert.h" #include "draco/draco_features.h" #ifdef ANDROID_LOGGING #include <android/log.h> #define LOG_TAG "draco" #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) #else #define LOGI printf #define LOGE printf #endif #include <iostream> namespace draco { #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName &) = delete; \ void operator=(const TypeName &) = delete; #ifndef FALLTHROUGH_INTENDED #define FALLTHROUGH_INTENDED void(0); #endif #ifndef LOG #define LOG(...) std::cout #endif #ifndef VLOG #define VLOG(...) std::cout #endif } // namespace draco #ifdef DRACO_DEBUG #define DRACO_DCHECK(x) (assert(x)); #define DRACO_DCHECK_EQ(a, b) assert((a) == (b)); #define DRACO_DCHECK_NE(a, b) assert((a) != (b)); #define DRACO_DCHECK_GE(a, b) assert((a) >= (b)); #define DRACO_DCHECK_GT(a, b) assert((a) > (b)); #define DRACO_DCHECK_LE(a, b) assert((a) <= (b)); #define DRACO_DCHECK_LT(a, b) assert((a) < (b)); #define DRACO_DCHECK_NOTNULL(x) assert((x) != NULL); #else #define DRACO_DCHECK(x) #define DRACO_DCHECK_EQ(a, b) #define DRACO_DCHECK_NE(a, b) #define DRACO_DCHECK_GE(a, b) #define DRACO_DCHECK_GT(a, b) #define DRACO_DCHECK_LE(a, b) #define DRACO_DCHECK_LT(a, b) #define DRACO_DCHECK_NOTNULL(x) #endif // Helper macros for concatenating macro values. #define DRACO_MACROS_IMPL_CONCAT_INNER_(x, y) x##y #define DRACO_MACROS_IMPL_CONCAT_(x, y) DRACO_MACROS_IMPL_CONCAT_INNER_(x, y) // Expand the n-th argument of the macro. Used to select an argument based on // the number of entries in a variadic macro argument. Example usage: // // #define FUNC_1(x) x // #define FUNC_2(x, y) x + y // #define FUNC_3(x, y, z) x + y + z // // #define VARIADIC_MACRO(...) \ // DRACO_SELECT_NTH_FROM_3(__VA_ARGS__, FUNC_3, FUNC_2, FUNC_1) __VA_ARGS__ // #define DRACO_SELECT_NTH_FROM_2(_1, _2, NAME) NAME #define DRACO_SELECT_NTH_FROM_3(_1, _2, _3, NAME) NAME #define DRACO_SELECT_NTH_FROM_4(_1, _2, _3, _4, NAME) NAME #endif // DRACO_CORE_MACROS_H_
#ifndef __GTHREE_AREA_H__ #define __GTHREE_AREA_H__ #include <gtk/gtk.h> #include <gthree/gthree.h> G_BEGIN_DECLS #define GTHREE_TYPE_AREA (gthree_area_get_type ()) #define GTHREE_AREA(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ GTHREE_TYPE_AREA, \ GthreeArea)) #define GTHREE_IS_AREA(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ GTHREE_TYPE_AREA)) typedef struct { GtkGLArea parent; } GthreeArea; G_DEFINE_AUTOPTR_CLEANUP_FUNC (GthreeArea, g_object_unref) typedef struct { GtkGLAreaClass parent_class; } GthreeAreaClass; GTHREE_API GType gthree_area_get_type (void) G_GNUC_CONST; GTHREE_API GtkWidget *gthree_area_new (GthreeScene *scene, GthreeCamera *camera); GTHREE_API GthreeScene * gthree_area_get_scene (GthreeArea *area); GTHREE_API void gthree_area_set_scene (GthreeArea *area, GthreeScene *scene); GTHREE_API GthreeCamera * gthree_area_get_camera (GthreeArea *area); GTHREE_API void gthree_area_set_camera (GthreeArea *area, GthreeCamera *camera); GTHREE_API GthreeRenderer *gthree_area_get_renderer (GthreeArea *area); G_END_DECLS #endif /* __GTHREE_AREA_H__ */
// Copyright (c) 2015-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_TEST_TEST_BITCOIN_H #define BITCOIN_TEST_TEST_BITCOIN_H #include <chainparamsbase.h> #include <fs.h> #include <key.h> #include <pubkey.h> #include <random.h> #include <scheduler.h> #include <txdb.h> #include <txmempool.h> #include <memory> #include <boost/thread.hpp> extern uint256 insecure_rand_seed; extern FastRandomContext insecure_rand_ctx; static inline void SeedInsecureRand(bool fDeterministic = false) { if (fDeterministic) { insecure_rand_seed = uint256(); } else { insecure_rand_seed = GetRandHash(); } insecure_rand_ctx = FastRandomContext(insecure_rand_seed); } static inline uint32_t InsecureRand32() { return insecure_rand_ctx.rand32(); } static inline uint256 InsecureRand256() { return insecure_rand_ctx.rand256(); } static inline uint64_t InsecureRandBits(int bits) { return insecure_rand_ctx.randbits(bits); } static inline uint64_t InsecureRandRange(uint64_t range) { return insecure_rand_ctx.randrange(range); } static inline bool InsecureRandBool() { return insecure_rand_ctx.randbool(); } /** Basic testing setup. * This just configures logging and chain parameters. */ struct BasicTestingSetup { ECCVerifyHandle globalVerifyHandle; explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN); ~BasicTestingSetup(); fs::path SetDataDir(const std::string& name); private: const fs::path m_path_root; }; /** Testing setup that configures a complete environment. * Included are data directory, coins database, script check threads setup. */ class CConnman; class CNode; struct CConnmanTest { static void AddNode(CNode& node); static void ClearNodes(); }; class PeerLogicValidation; struct TestingSetup: public BasicTestingSetup { boost::thread_group threadGroup; CConnman* connman; CScheduler scheduler; std::unique_ptr<PeerLogicValidation> peerLogic; explicit TestingSetup(const std::string& chainName = CBaseChainParams::MAIN); ~TestingSetup(); }; class CBlock; struct CMutableTransaction; class CScript; // // Testing fixture that pre-creates a // 100-block REGTEST-mode block chain // struct TestChain100Setup : public TestingSetup { TestChain100Setup(); // Create a new block with just given transactions, coinbase paying to // scriptPubKey, and try to add it to the current chain. CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey); ~TestChain100Setup(); std::vector<CTransactionRef> m_coinbase_txns; // For convenience, coinbase transactions CKey coinbaseKey; // private/public key needed to spend coinbase transactions }; class CTxMemPoolEntry; struct TestMemPoolEntryHelper { // Default values CAmount nFee; int64_t nTime; unsigned int nHeight; bool spendsCoinbase; unsigned int sigOpCost; LockPoints lp; TestMemPoolEntryHelper() : nFee(0), nTime(0), nHeight(1), spendsCoinbase(false), sigOpCost(4) { } CTxMemPoolEntry FromTx(const CMutableTransaction& tx); CTxMemPoolEntry FromTx(const CTransactionRef& tx); // Change the default value TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; } TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; } TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; } TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; } TestMemPoolEntryHelper &SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; } }; CBlock getBlock13b8a(); // define an implicit conversion here so that uint256 may be used directly in BOOST_CHECK_* std::ostream& operator<<(std::ostream& os, const uint256& num); #endif
#include <stdio.h> #include <stdlib.h> #include "rbtree.h" struct rbtree_learn { struct rb_node rbtree_learn_node; int num; }; struct rbtree_learn * rbtree_learn_search(struct rb_root *root, int num) { struct rb_node *node = root->rb_node; while (node) { struct rbtree_learn *data = container_of(node, struct rbtree_learn, rbtree_learn_node); if (num < data->num) node = node->rb_left; else if (num > data->num) node = node->rb_right; else return data; } return NULL; } int rbtree_learn_insert(struct rb_root *root, struct rbtree_learn *data) { struct rb_node **tmp = &(root->rb_node), *parent = NULL; /* Figure out where to put new node */ while (*tmp) { struct rbtree_learn *this = container_of(*tmp, struct rbtree_learn, rbtree_learn_node); parent = *tmp; if (data->num < this->num) tmp = &((*tmp)->rb_left); else if (data->num > this->num) tmp = &((*tmp)->rb_right); else return -1; } /* Add new node and rebalance tree. */ rb_link_node(&data->rbtree_learn_node, parent, tmp); rb_insert_color(&data->rbtree_learn_node, root); return 0; } void rbtree_learn_delete(struct rb_root *root, int num) { struct rbtree_learn *data = rbtree_learn_search(root, num); if (!data) { fprintf(stderr, "Not found %d.\n", num); return; } rb_erase(&data->rbtree_learn_node, root); free(data); } void print_rbtree(struct rb_root *tree) { struct rb_node *node; struct rbtree_learn *type; /* for (node = rb_first(tree); node; node = rb_next(node)) printf("%d ", rb_entry(node, struct rbtree_learn, rbtree_learn_node)->num); */ rb_for_each_entry(type, node, tree, rbtree_learn_node) printf("%d ", type->num); printf("\n"); } int main(int argc, char *argv[]) { struct rb_root rbtree_learn_tree = RB_ROOT; struct rbtree_learn *tmp; /* int i, ret, num; if (argc < 2) { fprintf(stderr, "Usage: %s num\n", argv[0]); exit(-1); } num = atoi(argv[1]); printf("Please enter %d integers:\n", num); for (i = 0; i < num; i++) { tmp = malloc(sizeof(struct rbtree_learn)); if (!tmp) perror("Allocate dynamic memory"); scanf("%d", &tmp->num); ret = rbtree_learn_insert(&rbtree_learn_tree, tmp); if (ret < 0) { fprintf(stderr, "The %d already exists.\n", tmp->num); free(tmp); } } */ tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 8; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 87; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 7; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 21; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 13; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 33; rbtree_learn_insert(&rbtree_learn_tree, tmp); tmp = malloc(sizeof(struct rbtree_learn)); tmp->num = 63; rbtree_learn_insert(&rbtree_learn_tree, tmp); printf("\norigin \n"); print_rbtree(&rbtree_learn_tree); rbtree_learn_delete(&rbtree_learn_tree, 21); printf("\ndelete 21\n"); print_rbtree(&rbtree_learn_tree); /* free */ struct rb_node *node1, *node2; rb_for_each_safe(node1, node2, &rbtree_learn_tree) { rb_erase(node1, &rbtree_learn_tree); free(container_of(node1, struct rbtree_learn, rbtree_learn_node)); } return 0; }
/* * POSIX library for Lua 5.1, 5.2, 5.3 & 5.4. * Copyright (C) 2013-2022 Gary V. Vaughan * Copyright (C) 2010-2013 Reuben Thomas <rrt@sc3d.org> * Copyright (C) 2008-2010 Natanael Copa <natanael.copa@gmail.com> * Clean up and bug fixes by Leo Razoumov <slonik.az@gmail.com> 2006-10-11 * Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> 07 Apr 2006 23:17:49 * Based on original by Claudio Terra for Lua 3.x. * With contributions by Roberto Ierusalimschy. * With documentation from Steve Donovan 2012 */ /*** General Library. Functions for separating a pathname into file and directory components. @module posix.libgen */ #include <libgen.h> #include "_helpers.c" /*** File part of path. @function basename @string path file to act on @treturn[1] string filename part of *path*, if successful @return[2] nil @treturn[2] string error message @treturn[2] int errnum @see basename(3) */ static int Pbasename(lua_State *L) { char *b; size_t len; void *ud; lua_Alloc lalloc; const char *path = luaL_checklstring(L, 1, &len); size_t path_len; checknargs(L, 1); path_len = strlen(path) + 1; lalloc = lua_getallocf(L, &ud); if ((b = lalloc(ud, NULL, 0, path_len)) == NULL) return pusherror(L, "lalloc"); lua_pushstring(L, basename(strcpy(b,path))); lalloc(ud, b, path_len, 0); return 1; } /*** Directory name of path. @function dirname @string path file to act on @treturn[1] string directory part of *path*, if successful @return[2] nil @treturn[2] string error message @treturn[2] int errnum @see dirname(3) */ static int Pdirname(lua_State *L) { char *b; size_t len; void *ud; lua_Alloc lalloc; const char *path = luaL_checklstring(L, 1, &len); size_t path_len; checknargs(L, 1); path_len = strlen(path) + 1; lalloc = lua_getallocf(L, &ud); if ((b = lalloc(ud, NULL, 0, path_len)) == NULL) return pusherror(L, "lalloc"); lua_pushstring(L, dirname(strcpy(b,path))); lalloc(ud, b, path_len, 0); return 1; } static const luaL_Reg posix_libgen_fns[] = { LPOSIX_FUNC( Pbasename ), LPOSIX_FUNC( Pdirname ), {NULL, NULL} }; LUALIB_API int luaopen_posix_libgen(lua_State *L) { luaL_newlib(L, posix_libgen_fns); lua_pushstring(L, LPOSIX_VERSION_STRING("libgen")); lua_setfield(L, -2, "version"); return 1; }
#pragma once #include "block.h" class CTetrisDlg : public CDialog { public: CTetrisDlg(CWnd* pParent = NULL); ~CTetrisDlg(); enum { IDD = IDD_TETRIS_DIALOG, ROW = 20, COL = 10, WIDTH = COL << 5, HEIGHT = ROW << 5 }; protected: BOOL PreTranslateMessage(MSG *pMsg); protected: HICON m_hIcon; private: CMenu m_menu; CImage m_bk; CImage m_block; CImage m_window; CImage m_gameover; CDC m_memDC; CBitmap m_memBmp; CClientDC *m_pDC; BYTE **m_board; Block *m_pBlock; BYTE m_level; BYTE m_gameParam; BYTE m_nextColor; UINT m_lines; UINT m_score; BYTE m_mouseOver; void Update(); void AdjustFrame(); void Initialize(); void RedrawBkgnd(RECT rect); void DrawText(SHORT x1, SHORT y1, SHORT x2, SHORT y2, CString &text, UINT format, COLORREF clr); void SetFontSize(BYTE size); void Play(MCIDEVICEID id); void UpdateBlock(); void UpdateWindow(); void NextRandomBlock(); BYTE NextRandomColor(); Block *BlockFromIndex(BYTE i); BOOL CheckLine(BYTE row); void RemoveLine(BYTE row); BOOL IsGameOver(BYTE blockType); void GameOver(); public: virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg UINT OnGetDlgCode(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnGameNew(); afx_msg void OnGamePause(); afx_msg void OnGameStop(); afx_msg void OnLevelBeginner(); afx_msg void OnLevelIntermediate(); afx_msg void OnLevelAdvanced(); afx_msg void OnLevelExpert(); afx_msg void OnLevelDevil(); afx_msg void OnLevelHell(); afx_msg void OnGameSound(); afx_msg void OnGameExit(); afx_msg void OnHelpAbout(); DECLARE_MESSAGE_MAP() }; // CAboutDlg dialog class CAboutDlg : public CDialog { public: CAboutDlg(CWnd* pParent = NULL) : CDialog(CAboutDlg::IDD, pParent) {} // Dialog Data enum { IDD = IDD_ABOUTBOX }; };
#ifndef F2IRSENSORS_H #define F2IRSENSORS_H #include <stdint.h> namespace rcr { namespace robots { namespace scribbler2 { class Scribbler2; class F2IRSensors { private: Scribbler2 &s2; public: F2IRSensors( Scribbler2& s2_ ); ~F2IRSensors(); void setIRPower( int pwm ); uint16_t getIR(); }; }}} #endif // F2IRSENSORS_H
#include "parser.h" #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include "item.h" typedef struct { #define FILEPATH_LEN 256 char filepath[256]; FILE *file; } Parser; void init(Parser *m, const char *filepath); bool open_file(Parser *m); bool read_all(Parser *m); void parse_line(Parser *m, const char *line); void close_file(Parser *m); void parser_parse_all() { static const char filename[] = "def.txt"; Parser m; init(&m, filename); if(!open_file(&m)) exit(1); if(!read_all(&m)) exit(1); close_file(&m); } void init(Parser *m, const char *filepath) { //Ensure null termination. strncpy will not null terminate // if the length of src is n! Security! strncpy(m->filepath, filepath, FILEPATH_LEN - 1); m->filepath[FILEPATH_LEN - 1] = '\0'; m->file = NULL; } bool open_file(Parser *m) { FILE *f = fopen(m->filepath, "r"); if(f) { m->file = f; return true; } else { perror(m->filepath); return false; } } bool read_all(Parser *m) { #define READ_ALL_BUF_LEN 256 bool read_at_least_one = false; while(1) { char buf[READ_ALL_BUF_LEN]; if(!fgets(buf, READ_ALL_BUF_LEN, m->file)) { if(!read_at_least_one) fprintf(stderr, "%s contains no definitions\n", m->filepath); return read_at_least_one; } read_at_least_one = true; printf("read: %s", buf); parse_line(m, buf); } return true; } void parse_line(Parser *m, const char *line) { ItemSpec s = {}; sscanf(line, ITEMSPEC_NAME_FORMAT " %d", s.name, &s.obstacle); printf("spec: name (%s), obstacle(%d)\n\n", s.name, s.obstacle); } void close_file(Parser *m) { fclose(m->file); }
/* * Author: doe300 * * See the file "LICENSE" for the full license governing this code. */ #ifndef VC4C_TEST_STDLIB_H #define VC4C_TEST_STDLIB_H #include "cpptest.h" #include "config.h" class TestMathFunctions : public Test::Suite { public: TestMathFunctions(const vc4c::Configuration& config = {}); void testAcos(); void testAcosh(); void testAcosPi(); void testAsin(); void testAsinh(); void testAsinPi(); void testAtan(); void testAtan2(); void testAtanh(); void testAtanPi(); void testAtan2Pi(); void testCbrt(); void testCeil(); void testCopysign(); void testCos(); void testCosh(); void testCosPi(); void testErfc(); void testErf(); void testExp(); void testExp2(); void testExp10(); void testExpm1(); void testFabs(); void testFdim(); void testFloor(); void testFma(); void testFmax(); void testFmin(); void testFmod(); void testFract(); void testFrexp(); void testHypot(); void testIlogb(); void testLdexp(); void testLgamma(); void testLgammaR(); void testLog(); void testLog2(); void testLog10(); void testLog1p(); void testLogb(); void testMad(); void testMaxMag(); void testMinMag(); void testModf(); void testNan(); void testNextafter(); void testPow(); void testPown(); void testPowr(); void testRemainder(); void testRemquo(); void testRint(); void testRootn(); void testRound(); void testRsqrt(); void testSin(); void testSinCos(); void testSinh(); void testSinPi(); void testSqrt(); void testTan(); void testTanh(); void testTanPi(); void testTgamma(); void testTrunc(); private: void onMismatch(const std::string& expected, const std::string& result); vc4c::Configuration config; }; #endif /* VC4C_TEST_STDLIB_H */
/************************************************************************ * * CppSharp * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #pragma once #include <llvm/Object/ELF.h> namespace CppSharp { namespace CppParser { template<typename ELFT> class ELFDumper { public: ELFDumper(const llvm::object::ELFFile<ELFT> *Obj); std::vector<llvm::StringRef> getNeededLibraries() const; private: typedef llvm::object::ELFFile<ELFT> ELFO; typedef typename ELFO::Elf_Sym Elf_Sym; typedef typename ELFO::Elf_Dyn Elf_Dyn; typedef typename ELFO::Elf_Dyn_Range Elf_Dyn_Range; typedef typename ELFO::Elf_Phdr Elf_Phdr; typedef typename ELFO::uintX_t uintX_t; /// \brief Represents a region described by entries in the .dynamic table. struct DynRegionInfo { DynRegionInfo() : Addr(nullptr), Size(0), EntSize(0) {} /// \brief Address in current address space. const void *Addr; /// \brief Size in bytes of the region. uintX_t Size; /// \brief Size of each entity in the region. uintX_t EntSize; }; llvm::StringRef getDynamicString(uint64_t Offset) const; const Elf_Dyn *dynamic_table_begin() const; const Elf_Dyn *dynamic_table_end() const; llvm::iterator_range<const Elf_Dyn*> dynamic_table() const { return llvm::make_range(dynamic_table_begin(), dynamic_table_end()); } const ELFO *Obj; DynRegionInfo DynamicRegion; llvm::StringRef DynamicStringTable; }; template <typename ELFT> ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> *Obj) { llvm::SmallVector<const Elf_Phdr *, 4> LoadSegments; auto ProgramHeaders = Obj->program_headers(); if (ProgramHeaders.takeError()) { llvm::report_fatal_error("Error reading program headers"); return; } for (const Elf_Phdr &Phdr : ProgramHeaders.get()) { if (Phdr.p_type == llvm::ELF::PT_DYNAMIC) { DynamicRegion.Addr = Obj->base() + Phdr.p_offset; uint64_t Size = Phdr.p_filesz; if (Size % sizeof(Elf_Dyn)) llvm::report_fatal_error("Invalid dynamic table size"); DynamicRegion.Size = Phdr.p_filesz; continue; } if (Phdr.p_type != llvm::ELF::PT_LOAD || Phdr.p_filesz == 0) continue; LoadSegments.push_back(&Phdr); } auto toMappedAddr = [&](uint64_t VAddr) -> const uint8_t *{ const Elf_Phdr **I = std::upper_bound( LoadSegments.begin(), LoadSegments.end(), VAddr, [](uint64_t VAddr, const Elf_Phdr *Phdr) { return VAddr < Phdr->p_vaddr; }); if (I == LoadSegments.begin()) llvm::report_fatal_error("Virtual address is not in any segment"); --I; const Elf_Phdr &Phdr = **I; uint64_t Delta = VAddr - Phdr.p_vaddr; if (Delta >= Phdr.p_filesz) llvm::report_fatal_error("Virtual address is not in any segment"); return Obj->base() + Phdr.p_offset + Delta; }; const char *StringTableBegin = nullptr; uint64_t StringTableSize = 0; for (const Elf_Dyn &Dyn : dynamic_table()) { switch (Dyn.d_tag) { case llvm::ELF::DT_STRTAB: StringTableBegin = (const char *)toMappedAddr(Dyn.getPtr()); break; case llvm::ELF::DT_STRSZ: StringTableSize = Dyn.getVal(); break; } } if (StringTableBegin) DynamicStringTable = StringRef(StringTableBegin, StringTableSize); } template <typename ELFT> const typename ELFDumper<ELFT>::Elf_Dyn * ELFDumper<ELFT>::dynamic_table_begin() const { return reinterpret_cast<const Elf_Dyn *>(DynamicRegion.Addr); } template <typename ELFT> const typename ELFDumper<ELFT>::Elf_Dyn * ELFDumper<ELFT>::dynamic_table_end() const { uint64_t Size = DynamicRegion.Size; return dynamic_table_begin() + Size / sizeof(Elf_Dyn); } template <class ELFT> llvm::StringRef ELFDumper<ELFT>::getDynamicString(uint64_t Value) const { return llvm::StringRef(DynamicStringTable.data() + Value); } template<class ELFT> std::vector<llvm::StringRef> ELFDumper<ELFT>::getNeededLibraries() const { std::vector<llvm::StringRef> Libs; for (const auto &Entry : dynamic_table()) if (Entry.d_tag == llvm::ELF::DT_NEEDED) Libs.push_back(getDynamicString(Entry.d_un.d_val)); return Libs; } } }
// // THJModalViewController.h // // THJAlertController // // Created by Thanyaluk on 18/08/15. // Copyright (c) 2015 Thanyaluk Jirapech-umpai. All rights reserved. // @import UIKit; @interface THJModalViewController : UIViewController @end
// For License please refer to LICENSE file in the root of YALField project #import "YALFieldConfigurator.h" @interface YALRegistrationConfigurator : YALFieldConfigurator @end
#include <stdio.h> int contains(char *s, char *t); int main(void) { printf ("%d\n", contains ("I wanna shoot something", "thing")); printf ("%d\n", contains ("I wanna shoot somethingthing", "thing")); printf ("%d\n", contains ("I wanna shoot somethingthingthin", "thing")); printf ("%d\n", contains ("Let's get in range!", "ge")); printf ("%d\n", contains ("Wanna see the fireworks?", "wanna")); printf ("%d\n", contains ("Look at the pretty explosions!", " ")); printf ("%d\n", contains ("Kaboom!", "")); printf ("%d\n", contains ("aaa", "aa")); printf ("%d\n", contains ("aaaa", "aa")); printf ("%d\n", contains ((char *) 0, "aaa")); printf ("%d\n", contains ("aaa", (char *) 0)); printf ("%d\n", contains ((char *) 0, (char *) 0)); /* 1 2 2 2 0 4 0 2 3 */ /* 0 0 0 */ return 0; }
// // SWAppDelegate.h // SWToolbox // // Created by CocoaPods on 03/14/2015. // Copyright (c) 2014 Sarun Wongpatcharapakorn. All rights reserved. // #import <UIKit/UIKit.h> @interface SWAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // ContactGrabber.h // glimpse // // Created by Rebecca Vessal on 2/2/14. // Copyright (c) 2014 Student. All rights reserved. // #import <Foundation/Foundation.h> #import <AddressBook/AddressBook.h> @protocol ContactGrabberDelegate <NSObject> @required -(void)showContacts; @end @interface ContactGrabber : NSObject @property (nonatomic, weak) id <ContactGrabberDelegate> delegate; -(id)initWithDictionary:(NSMutableDictionary*)dictionary; - (void)getPersonContact; @end
#include <stdio.h> int main() { int a = 0; #define M1(x) x+1 // <def-atom> 3*M1(2); // <use-atom> #define M2(x) (-2*x) // <def-atom> 3*M2(2); // <no-atom> 3*M2(3+2); // <use-atom> #define M3(x, y) x*y // <def-atom> M3(2+3, 4+5); // <use-atom> M3((2+3), (4+5)); // <no-atom> #define M3_2(x, y) (x)*y // <def-atom> M3(2+3, 4+5); // <use-atom> M3((2+3), (4+5)); // <no-atom> #define M4(x, y) (x)*(y) // <def-atom> <param-wrapped> !M4(2+3, 4+5); // <use-atom> !(M4(2+3, 4+5)); // <no-atom> #define M5(x, y) ((x)*(y)) // <no-atom> <param-wrapped> !M5(2+3, 4+5); // <no-atom> #define M6 printf("a"); /*<def-atom> <param-wrapped>*/\ printf("b"); \ printf("c\n"); M6; // <use-atom> if (a) M6; // <use-atom> #define M7 do { /*<no-atom> <do-wrapped> <param-wrapped>*/\ printf("a"); \ printf("b"); \ printf("c\n"); \ } while(0) M7; // <no-atom> if (a) M7; // <no-atom> #define M8 { /*<def-atom> <param-wrapped>*/\ printf("a"); \ printf("b"); \ printf("c\n"); \ } if (a) M8; // <use-atom> //else 1; #define M9(x, y) do { /*<def-atom> <do-wrapped>*/\ a = x*y; \ } while (0) M9(2+3, 4+5); // <use-atom> if (a) M9(2+3, 4+5); // <use-atom> #define M10(x, y) do { /*<no-atom> <do-wrapped> <param-wrapped>*/\ a = (x)*(y); \ } while (0) if (a) M10(2+3, 4+5); // <no-atom> // Has additional semicolon at end of definition that breaks if/else's #define M11(x, y) do { /*<def-atom> <param-wrapped>*/\ a = (x)*(y); \ } while (0); if (a) M11(2+3, 4+5); // <use-atom> else 1; if (a) { M11(2+3, 4+5) } // <no-atom> else 1; // Even though it's on a single line, multiple statements will brake if-statements #define M12 1; 2 /*<def-atom> <param-wrapped>*/ if (a) M12; // <use-atom> M12; // <no-atom> // Technically not multiline since it's a single expression #define M13 (1 + /*<no-atom> <param-wrapped>*/\ 2) if (a) M13; // <no-atom> M13; // <no-atom> #define M14 // <no-atom> <param-wrapped> #define M15(x) #x // <no-atom> <do-wrapped> <param-wrapped> #define M16 1 // <no-atom> <param-wrapped> #define M17 "abc" // <no-atom> <param-wrapped> #define M18 abc // <no-atom> <param-wrapped> #define M19 ab.c // <def-atom> <param-wrapped> #define M20 (ab.c) // <no-atom> <param-wrapped> }
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <SDL/SDL_ttf.h> #include <SDL/SDL.h> #include <SDL/SDL_gfxPrimitives.h> #include <SDL/SDL_rotozoom.h> #include <SDL/SDL_image.h> #include <float.h> #include <string.h> #ifndef CONSTANTE_H #define CONSTANTE_H #define TRUE 1 #define FALSE 0 #define CP_WIDTH_RENDER 750 #define CP_WIDTH_MENU 200 #define CP_HEIGHT_RENDER 500 #define CP_RAYON_X 0.006 #define CP_RAYON_Y 0.00075 #define MAX_SIZE_TAG 100 #define MAX_SIZE_MEMBER 500 #define MAX_SIZE_NODE_IN_WAY 2000 #define SIZE_EARTH 40075000 #define DIST_ONE_DEGREE 111319.4444 #define TYPE_WAY_RESIDENTIAL 1 #define TYPE_WAY_CYCLEWAY 2 #define TYPE_WAY_TERTIARY 3 #define TYPE_WAY_PEDESTRIAN 4 #define TYPE_WAY_PRIMARY 5 #define TYPE_WAY_UNCLASSIFIED 6 #define TYPE_WAY_BUILDING 7 #define TYPE_WAY_GRASS 8 #define TYPE_WAY_GRASSS 18 #define TYPE_WAY_FOOTWAY 9 #define TYPE_WAY_WALL 10 #define TYPE_WAY_RAIL 11 #define TYPE_WAY_LAYER 12 #define TYPE_WAY_BOUDARY_ADMIN 13 #define TYPE_WAY_BRIDGE 14 #define TYPE_WAY_RIVERBANK 15 #define TYPE_WAY_NATURALWATER 16 #define TYPE_WAY_WALL_BUILDING 17 #define TYPE_WAY_COAST 18 #define TYPE_WAY_BUILDING_AREA 19 #define TYPE_WAY_CONSTRUCTION 20 #define MOOV_MID_CENTER 0 #define MOOV_MID_LEFT 1 #define MOOV_MID_RIGHT 2 #define MOOV_UP_CENTER 3 #define MOOV_UP_LEFT 4 #define MOOV_UP_RIGHT 5 #define MOOV_DOWN_CENTER 6 #define MOOV_DOWN_LEFT 7 #define MOOV_DOWN_RIGHT 8 #define ORDER_RIVERBANK 0 #define ORDER_WATER 1 #define ORDER_FOREST 2 #define ORDER_PARK 3 #define ORDER_UNCLASSIFIED 4 #define ORDER_SERVICE 5 #define ORDER_HIGHWAY 6 #define ORDER_FOOTWAY 7 #define ORDER_PEDESTRIAN 8 #define ORDER_BRIDGE 9 #define ORDER_BUILDING 10 #define ORDER_RESIDENTIAL 11 #define ORDER_CYCLEWAY 12 #define ORDER_TERTIARY 13 #define ORDER_SECONDARY 14 #define ORDER_PRIMARY 15 #define ORDER_WALL 16 #define ORDER_FENCE 17 #define ORDER_GRASS 18 #define ORDER_RAIL 19 #define ORDER_SUBWAY 20 #define ORDER_ADMINISTRATIVE 21 #define IMG_COFFEE 0 #define IMG_CHURCH 1 #define IMG_MUSEE 2 #define IMG_POSTE 3 #define IMG_RESTAURANT 4 #define IMG_TEL 5 #define IMG_TRAFFIC 6 #define IMG_VELO 7 #endif
#ifndef SCENE_H #define SCENE_H #include <boost/optional.hpp> #include <unordered_map> #include "camera.h" #include "game_object.h" #include "light.h" #include "sky.h" #include "terrain.h" class Scene { public: const std::shared_ptr<Sky> sky; Terrain terrain; Scene(const std::shared_ptr<Sky> sky) : sky(sky) {} // Objects template<class T> void for_each_game_object(T t) const { std::for_each(begin(game_objects), end(game_objects), [t] (std::pair<unsigned int, std::shared_ptr<GameObject>> el) { t(el.second); }); } Scene& add_game_object(const std::shared_ptr<GameObject> object); Scene& remove_game_object(const unsigned int id); std::shared_ptr<GameObject> get_game_object(const unsigned int id) const; // Lights template<class T> void for_each_directional_light(T t) const { std::for_each(begin(directional_lights), end(directional_lights), [t] (std::pair<unsigned int, std::shared_ptr<DirectionalLight>> el) { t(el.second); }); } Scene& add_directional_light(const std::shared_ptr<DirectionalLight> light); Scene& remove_directional_light(const unsigned int id); std::shared_ptr<DirectionalLight> get_directional_light(const unsigned int id) const; template<class T> void for_each_point_light(T t) const { std::for_each(begin(point_lights), end(point_lights), [t](std::pair<unsigned int, std::shared_ptr<PointLight>> el) { t(el.second); }); } Scene& add_point_light(const std::shared_ptr<PointLight> light); Scene& remove_point_light(const unsigned int id); std::shared_ptr<PointLight> get_point_light(const unsigned int id) const; template<class T> void for_each_spot_light(T t) const { std::for_each(begin(spot_lights), end(spot_lights), [t](std::pair<unsigned int, std::shared_ptr<SpotLight>> el) { t(el.second); }); } Scene& add_spot_light(const std::shared_ptr<SpotLight> light); Scene& remove_spot_light(const unsigned int id); std::shared_ptr<SpotLight> get_spot_light(const unsigned int id) const; // Cameras template<class T> void for_each_camera(T t) const { std::for_each(begin(cameras), end(cameras), [t](std::pair<unsigned int, std::shared_ptr<Camera>> el) { t(el.second); }); } Scene& add_camera(const std::shared_ptr<Camera> camera); Scene& remove_camera(const unsigned int id); std::shared_ptr<Camera> get_camera(const unsigned int id) const; boost::optional<std::shared_ptr<Camera>> get_active_camera() const; Scene& set_active_camera(const unsigned int id); private: std::unordered_map<unsigned int, std::shared_ptr<GameObject>> game_objects; std::unordered_map<unsigned int, std::shared_ptr<DirectionalLight>> directional_lights; std::unordered_map<unsigned int, std::shared_ptr<PointLight>> point_lights; std::unordered_map<unsigned int, std::shared_ptr<SpotLight>> spot_lights; std::unordered_map<unsigned int, std::shared_ptr<Camera>> cameras; boost::optional<unsigned int> active_camera_id; }; #endif
#ifdef __OBJC__ #import <UIKit/UIKit.h> #endif #import "TyphoonConfigPostProcessor+Internal.h" #import "TyphoonConfigPostProcessor.h" #import "TyphoonConfiguration.h" #import "TyphoonJsonStyleConfiguration.h" #import "TyphoonPlistStyleConfiguration.h" #import "TyphoonPropertyStyleConfiguration.h" #import "TyphoonDefinition+Config.h" #import "TyphoonOptionMatcher+Internal.h" #import "TyphoonOptionMatcher.h" #import "TyphoonDefinition+Option.h" #import "TyphoonGlobalConfigCollector.h" #import "TyphoonBundleResource.h" #import "TyphoonPathResource.h" #import "TyphoonResource.h" #import "TyphoonStartup.h" #import "TyphoonAbstractDetachableComponentFactoryPostProcessor.h" #import "TyphoonDefinitionPostProcessor.h" #import "TyphoonInstancePostProcessor.h" #import "TyphoonOrdered.h" #import "TyphoonAutoInjection.h" #import "TyphoonFactoryAutoInjectionPostProcessor.h" #import "TyphoonInjectedObject.h" #import "TyphoonDefinition+Infrastructure.h" #import "TyphoonInjectionsEnumeration.h" #import "TyphoonAbstractInjection.h" #import "TyphoonInject.h" #import "TyphoonInjection.h" #import "TyphoonInjectionByCollection.h" #import "TyphoonInjectionByComponentFactory.h" #import "TyphoonInjectionByConfig.h" #import "TyphoonInjectionByCurrentRuntimeArguments.h" #import "TyphoonInjectionByDictionary.h" #import "TyphoonInjectionByFactoryReference.h" #import "TyphoonInjectionByObjectFromString.h" #import "TyphoonInjectionByObjectInstance.h" #import "TyphoonInjectionByReference.h" #import "TyphoonInjectionByRuntimeArgument.h" #import "TyphoonInjectionByType.h" #import "TyphoonInjectionContext.h" #import "TyphoonInjections.h" #import "TyphoonParameterInjection.h" #import "TyphoonPropertyInjection.h" #import "Collections+CustomInjection.h" #import "NSDictionary+CustomInjection.h" #import "TyphoonBlockDefinition+InstanceBuilder.h" #import "TyphoonBlockDefinition+Internal.h" #import "TyphoonBlockDefinitionController.h" #import "TyphoonDefinition+InstanceBuilder.h" #import "TyphoonDefinition+Internal.h" #import "TyphoonFactoryDefinition.h" #import "TyphoonInjectionDefinition.h" #import "TyphoonObjectWithCustomInjection.h" #import "TyphoonReferenceDefinition.h" #import "TyphoonMethod+InstanceBuilder.h" #import "TyphoonMethod.h" #import "TyphoonDefinitionNamespace.h" #import "TyphoonBlockDefinition.h" #import "TyphoonDefinition.h" #import "TyphoonAssembly+TyphoonAssemblyFriend.h" #import "TyphoonAssembly.h" #import "TyphoonAssemblyAccessor.h" #import "NSObject+FactoryHooks.h" #import "NSInvocation+TCFCustomImplementation.h" #import "NSInvocation+TCFUnwrapValues.h" #import "NSInvocation+TCFWrapValues.h" #import "NSMethodSignature+TCFUnwrapValues.h" #import "NSValue+TCFUnwrapValues.h" #import "TyphoonAssemblyAdviser.h" #import "TyphoonAssemblyBuilder+PlistProcessor.h" #import "TyphoonAssemblyBuilder.h" #import "TyphoonAssemblyDefinitionBuilder.h" #import "TyphoonAssemblyPropertyInjectionPostProcessor.h" #import "TyphoonAssemblySelectorAdviser.h" #import "TyphoonBlockComponentFactory.h" #import "TyphoonCallStack.h" #import "TyphoonCircularDependencyTerminator.h" #import "TyphoonCollaboratingAssembliesCollector.h" #import "TyphoonCollaboratingAssemblyPropertyEnumerator.h" #import "TyphoonCollaboratingAssemblyProxy.h" #import "TyphoonComponentFactory+InstanceBuilder.h" #import "TyphoonComponentFactory+TyphoonDefinitionRegisterer.h" #import "TyphoonFactoryPropertyInjectionPostProcessor.h" #import "TyphoonMemoryManagementUtils.h" #import "TyphoonParentReferenceHydratingPostProcessor.h" #import "TyphoonRuntimeArguments.h" #import "TyphoonStackElement.h" #import "TyphoonComponentsPool.h" #import "TyphoonWeakComponentsPool.h" #import "TyphoonComponentFactory.h" #import "TyphoonDefinitionRegisterer.h" #import "TyphoonPreattachedComponentsRegisterer.h" #import "TyphoonViewControllerInjector.h" #import "TyphoonStoryboardDefinition.h" #import "TyphoonStoryboardDefinitionContext.h" #import "TyphoonNibLoader.h" #import "TyphoonViewControllerNibResolver.h" #import "UIView+TyphoonDefinitionKey.h" #import "UIViewController+TyphoonStoryboardIntegration.h" #import "NSLayoutConstraint+TyphoonOutletTransfer.h" #import "TyphoonComponentFactory+Storyboard.h" #import "TyphoonDefinition+Storyboard.h" #import "TyphoonLoadedView.h" #import "TyphoonStoryboard.h" #import "TyphoonStoryboardProvider.h" #import "TyphoonStoryboardResolver.h" #import "TyphoonViewControllerFactory.h" #import "TyphoonViewHelpers.h" #import "UIResponder+TyphoonOutletTransfer.h" #import "UIView+TyphoonOutletTransfer.h" #import "TyphoonBundledImageTypeConverter.h" #import "TyphoonUIColorTypeConverter.h" #import "TyphooniOS.h" #import "TyphoonPatcher.h" #import "TyphoonTestUtils.h" #import "NSNullTypeConverter.h" #import "TyphoonNSNumberTypeConverter.h" #import "TyphoonNSURLTypeConverter.h" #import "TyphoonPassThroughTypeConverter.h" #import "TyphoonPrimitiveTypeConverter.h" #import "TyphoonColorConversionUtils.h" #import "TyphoonTypeConversionUtils.h" #import "TyphoonTypeConverter.h" #import "TyphoonTypeConverterRegistry.h" #import "TyphoonTypeDescriptor.h" #import "Typhoon+Infrastructure.h" #import "Typhoon.h" #import "NSArray+TyphoonManualEnumeration.h" #import "NSObject+DeallocNotification.h" #import "NSObject+PropertyInjection.h" #import "NSObject+TyphoonIntrospectionUtils.h" #import "TyphoonMethodSwizzler.h" #import "TyphoonSwizzlerDefaultImpl.h" #import "TyphoonIntrospectionUtils.h" #import "TyphoonLinkerCategoryBugFix.h" #import "TyphoonSelector.h" #import "TyphoonUtils.h" #import "OCLogTemplate.h" #import "NSObject+DeallocNotification.h" #import "TyphoonIntrospectionUtils.h" #import "TyphoonTypeDescriptor.h" #import "TyphoonUtils.h" #import "NSInvocation+TCFInstanceBuilder.h" FOUNDATION_EXPORT double TyphoonVersionNumber; FOUNDATION_EXPORT const unsigned char TyphoonVersionString[];
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double EMFRAMEVersionNumber; FOUNDATION_EXPORT const unsigned char EMFRAMEVersionString[];
// // UIButton+ZDCountDown.h // ZDKonw // // Created by Alexcai on 15/8/11. // Copyright (c) 2015年 zhidier. All rights reserved. // #import <UIKit/UIKit.h> @interface UIButton (ZDCountDown) /** * 按钮倒计时方法 * * @param second 倒计时长(秒) */ - (void)beginCountDownWithSecond:(NSInteger)second; /** * 停止倒计时,并清空计时 */ - (void)stopCountDown; @end
// // ZOEActionSheet.h // AiyoyouCocoapods // // Created by aiyoyou on 2017/6/7. // Copyright © 2017年 zoenet. All rights reserved. // #import <UIKit/UIKit.h> @interface ZOEActionSheet : UIView @property (nonatomic) CGFloat titleFontSize;//titleLabel font size,default is 18. @property (nonatomic) CGFloat buttonFontSize;//uibutton font size,default is 18. @property (nonatomic) CGFloat buttonHeight;//default is 50 @property (nonatomic,assign) CGFloat scale;//界面缩放比例 @property (nonatomic,strong) UIColor *titleTextColor; @property (nonatomic,strong) UIColor *buttonTextColor; @property (nonatomic,readonly)NSInteger cancelButtonIndex; @property (nonatomic,assign) BOOL disAble;//是否可被代码dismiss(不点击操作button),default is Yes @property (nonatomic,copy) NSString *actionDescription; - (instancetype)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; - (void)showWithBlock:(void(^)(NSInteger buttonIndex))block; /** 移除当前的alertView(不会触发block回调) */ - (void)dismissZOEActionSheet; /** 根据buttonIndex 设置button文字颜色 @param color 文字颜色 @param buttonIndex 按钮索引,cancelButtonIndex=0 otherButtonTitles以此类推 */ - (void)setButtonTextColor:(UIColor *)color buttonIndex:(NSInteger)buttonIndex; /** 通过title添加Button @param title 按钮文本 */ - (void)addButtonWithTitle:(NSString *)title; /** 移除所有ZOEAlertView(不会触发block回调) */ + (void)dismissAllZOEActionSheet; /** 获取单前所有actionSheet @return AllActionSheet */ + (NSArray *)getAllActionSheet; @end
// Copyright (c) 2011-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ELECTRUM_QT_EDITADDRESSDIALOG_H #define ELECTRUM_QT_EDITADDRESSDIALOG_H #include <QDialog> class AddressTableModel; namespace Ui { class EditAddressDialog; } QT_BEGIN_NAMESPACE class QDataWidgetMapper; QT_END_NAMESPACE /** Dialog for editing an address and associated information. */ class EditAddressDialog : public QDialog { Q_OBJECT public: enum Mode { NewReceivingAddress, NewSendingAddress, EditReceivingAddress, EditSendingAddress }; explicit EditAddressDialog(Mode mode, QWidget *parent); ~EditAddressDialog(); void setModel(AddressTableModel *model); void loadRow(int row); QString getAddress() const; void setAddress(const QString &address); public Q_SLOTS: void accept(); private: bool saveCurrentRow(); Ui::EditAddressDialog *ui; QDataWidgetMapper *mapper; Mode mode; AddressTableModel *model; QString address; }; #endif // ELECTRUM_QT_EDITADDRESSDIALOG_H
// // YSCoreTextAttachmentProtocol.h // YSCoreTextViewExample // // Created by Yu Sugawara on 2014/03/19. // Copyright (c) 2014年 Yu Sugawara. All rights reserved. // #import <Foundation/Foundation.h> @protocol YSCoreTextAttachmentProtocol <NSObject> - (NSAttributedString*)attachmentString; - (CGFloat)ascent; - (CGFloat)descent; - (CGFloat)width; - (UIEdgeInsets)contentInset; @optional + (void)insertAttachment:(id<YSCoreTextAttachmentProtocol>)attachment atIndex:(NSUInteger)index toAttributedString:(NSMutableAttributedString *)toAttributedString; - (UIEdgeInsets)contentEdgeInsets; - (void)setContentEdgeInsets:(UIEdgeInsets)insets; - (id)object; @property (nonatomic) CGPoint drawPoint; @end
// // VisualScreenSpace.h // // // Created by Narendra Umate on 7/15/17. // // #pragma once #include "Buffer.h" class VisualScreenSpace { public: VisualScreenSpace(const Effect& effect); virtual ~VisualScreenSpace(); VisualEffect* getVisualEffect() { return m_visualEffect; } VertexBuffer* getVertexBuffer() { return m_vertexBuffer; } IndexBuffer* getIndexBuffer(const int& index) { return m_indexBuffers[index]; } protected: VisualEffect* m_visualEffect; VertexBuffer* m_vertexBuffer; IndexBuffer* m_indexBuffers[1]; };
// // CloudFolder.h // arc // // Created by Jerome Cheng on 15/4/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> #import "Folder.h" #import "CloudFolderDelegate.h" @protocol CloudFolder <NSObject, Folder> @property (weak, nonatomic) id<CloudFolderDelegate> delegate; + (id<CloudFolder>)getRoot; - (void)updateContents; - (void)cancelOperations; - (BOOL)hasOngoingOperations; - (int)ongoingOperationCount; @end
#pragma once namespace detail { template<typename T> using IsSimpleComponent = typename std::enable_if<std::is_base_of<juce::Component, T>::value && !std::is_base_of<juce::ImageComponent, T>::value && !std::is_base_of<juce::Button, T>::value && !std::is_base_of<juce::Label, T>::value && !std::is_base_of<juce::Slider, T>::value>::type; template<typename T> using IsImageComponent = typename std::enable_if<std::is_base_of<juce::ImageComponent, T>::value>::type; template<typename T> using IsButton = typename std::enable_if<std::is_base_of<juce::Button, T>::value>::type; template<typename T> using IsLabel = typename std::enable_if<std::is_base_of<juce::Label, T>::value>::type; template<typename T> using IsSlider = typename std::enable_if<std::is_base_of<juce::Slider, T>::value>::type; } /** Adds reactive extensions to a `Component` (or subclass). */ template<typename ComponentType> class Reactive<ComponentType, detail::IsSimpleComponent<ComponentType>> : public ComponentType { public: /// Creates a new instance. @see `juce::Component::Component`. template<typename... Args> Reactive(Args&&... args) : ComponentType(std::forward<Args>(args)...), rx(*this) {} /// The reactive extension object. const ComponentExtension rx; }; /** Adds reactive extensions to an `ImageComponent` (or subclass). */ template<typename ImageComponentType> class Reactive<ImageComponentType, detail::IsImageComponent<ImageComponentType>> : public ImageComponentType { public: /// Creates a new instance. @see `juce::ImageComponent::ImageComponent`. template<typename... Args> Reactive(Args&&... args) : ImageComponentType(std::forward<Args>(args)...), rx(*this) {} /// The reactive extension object. const ImageComponentExtension rx; }; /** Adds reactive extensions to a `Button` (or subclass). */ template<typename ButtonType> class Reactive<ButtonType, detail::IsButton<ButtonType>> : public ButtonType { public: /// Creates a new instance. @see `juce::Button::Button`. template<typename... Args> Reactive(Args&&... args) : ButtonType(std::forward<Args>(args)...), rx(*this) {} /// The reactive extension object. const ButtonExtension rx; }; /** Adds reactive extensions to a `Label` (or subclass). */ template<typename LabelType> class Reactive<LabelType, detail::IsLabel<LabelType>> : public LabelType { public: /// Creates a new instance. @see `juce::Label::Label`. template<typename... Args> Reactive(Args&&... args) : LabelType(std::forward<Args>(args)...), rx(*this) {} /// The reactive extension object. const LabelExtension rx; }; /** Adds reactive extensions to a `Slider` (or subclass). */ template<typename SliderType> class Reactive<SliderType, detail::IsSlider<SliderType>> : public SliderType { typedef std::function<double(const juce::String&)> GetValueFromText_Function; typedef std::function<juce::String(double)> GetTextFromValue_Function; GetValueFromText_Function getValueFromText_Function; GetTextFromValue_Function getTextFromValue_Function; PublishSubject<GetValueFromText_Function> getValueFromText_Subject; PublishSubject<GetTextFromValue_Function> getTextFromValue_Subject; public: /// Creates a new instance. @see `juce::Slider::Slider`. template<typename... Args> Reactive(Args&&... args) : SliderType(std::forward<Args>(args)...), rx(*this, getValueFromText_Subject, getTextFromValue_Subject) { getValueFromText_Subject.subscribe([this](const GetValueFromText_Function& function) { this->getValueFromText_Function = function; }); getTextFromValue_Subject.subscribe([this](const GetTextFromValue_Function& function) { this->getTextFromValue_Function = function; this->updateText(); }); } /// The reactive extension object. const SliderExtension rx; ///@cond INTERNAL double getValueFromText(const juce::String& text) override { if (getValueFromText_Function) return getValueFromText_Function(text); else return SliderType::getValueFromText(text); } juce::String getTextFromValue(double value) override { if (getTextFromValue_Function) return getTextFromValue_Function(value); else return SliderType::getTextFromValue(value); } ///@endcond };
/* POSIX getopt for Windows AT&T Public License Code given out at the 1985 UNIFORUM conference in Dallas. */ #ifndef __GNUC__ #include "wingetopt.h" #include "config.h" //#define NULL 0 #define EOF (-1) #define ERR(s, c) if(opterr){\ char errbuf[2];\ errbuf[0] = c; errbuf[1] = '\n';\ fputs(argv[0], stderr);\ fputs(s, stderr);\ fputc(c, stderr);} //(void) write(2, argv[0], (unsigned)strlen(argv[0]));\ //(void) write(2, s, (unsigned)strlen(s));\ //(void) write(2, errbuf, 2);} int opterr = 1; int optind = 1; int optopt; char *optarg; int getopt(int argc, char **argv, char *opts) { static int sp = 1; register int c; register char *cp; if(sp == 1) if(optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return(EOF); else if(strcmp(argv[optind], "--") == NULL) { optind++; return(EOF); } optopt = c = argv[optind][sp]; if(c == ':' || (cp=strchr(opts, c)) == NULL) { ERR(": illegal option -- ", c); if(argv[optind][++sp] == '\0') { optind++; sp = 1; } return('?'); } if(*++cp == ':') { if(argv[optind][sp+1] != '\0') optarg = &argv[optind++][sp+1]; else if(++optind >= argc) { ERR(": option requires an argument -- ", c); sp = 1; return('?'); } else optarg = argv[optind++]; sp = 1; } else { if(argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = NULL; } return(c); } #endif /* __GNUC__ */
#include "input.h" void catch_signal(int signal) { quit = true; } void setup_input() { max_speed = 3; accel = malloc(sizeof(directions)); speed = malloc(sizeof(directions)); pressed_keys = malloc(sizeof(keys)); pressed_keys->up = false; pressed_keys->down = false; pressed_keys->left = false; pressed_keys->right = false; accel->up = 0; accel->down = 0; accel->left = 0; accel->right = 0; speed->up = 0; speed->down = 0; speed->left = 0; speed->right = 0; } void teardown_input(void) { free(accel); free(speed); free(pressed_keys); } void update_input() { if (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: quit = true; break; case SDL_KEYDOWN: handle_keypress(event.key.keysym.sym); break; case SDL_KEYUP: handle_keyup(event.key.keysym.sym); break; } } if (accel->up > 0) accel->up--; if (accel->down > 0) accel->down--; if (accel->left > 0) accel->left--; if (accel->right > 0) accel->right--; if (speed->up > 0) speed->up--; if (speed->down > 0) speed->down--; if (speed->left > 0) speed->left--; if (speed->right > 0) speed->right--; if (pressed_keys->up) accel->up = 2; if (pressed_keys->down) accel->down = 2; if (pressed_keys->left) accel->left = 2; if (pressed_keys->right) accel->right = 2; speed->up += accel->up; speed->down += accel->down; speed->left += accel->left; speed->right += accel->right; if (speed->up > max_speed) speed->up = max_speed; if (speed->down > max_speed) speed->down = max_speed; if (speed->left > max_speed) speed->left = max_speed; if (speed->right > max_speed) speed->right = max_speed; ship->rect.x += (speed->right - speed->left); ship->rect.y += (speed->down - speed->up); } void handle_keypress(SDLKey key) { switch (key) { case SDLK_f: toggle_fullscreen(); break; case SDLK_ESCAPE: quit = true; break; case SDLK_UP: pressed_keys->up = true; break; case SDLK_DOWN: pressed_keys->down = true; break; case SDLK_LEFT: pressed_keys->left = true; break; case SDLK_RIGHT: pressed_keys->right = true; break; default: break; } } void handle_keyup(SDLKey key) { switch (key) { case SDLK_UP: pressed_keys->up = false; break; case SDLK_DOWN: pressed_keys->down = false; break; case SDLK_LEFT: pressed_keys->left = false; break; case SDLK_RIGHT: pressed_keys->right = false; break; default: break; } }
#pragma once #include <math.h> namespace piLibs { static inline float clamp01( float x ) { if( x<0.0f ) return 0.0f; if( x>1.0f ) return 1.0f; return x; } static inline float fminf( float a, float b ) { return (a<b)?a:b; } static inline float fmaxf( float a, float b ) { return (a>b)?a:b; } static float mix( float a, float b, float x ) { return a + (b-a)*x; } static float sign( float x ) { if( x<0.0f ) return -1.0f; if( x>0.0f ) return 1.0f; return 0.0f; } static inline float smoothstep( float a, float b, float x ) { if( x<a ) return 0.0f; if( x>b ) return 1.0f; x = (x-a)/(b-a); return x*x*(3.0f-2.0f*x); } static inline float smoothstep( float a, float b, float x, int *reg ) { if( x<a ) { *reg=0; return 0.0f; } if( x>b ) { *reg=2; return 1.0f; } x = (x-a)/(b-a); *reg = 1; return x*x*(3.0f-2.0f*x); } static inline float cubicPulse( float c, float w, float x ) { x = fabsf(x - c); if( x>w ) return 0.0f; x /= w; return 1.0f - x*x*(3.0f-2.0f*x); } static inline float impulse( float b, float x ) { const float h = b*x; return h*expf(1.0f-h); } static inline float almost( float x, float m, float n ) { if( x>m ) return x; const float a = 2.0f*n - m; const float b = 2.0f*m - 3.0f*n; const float t = x/m; return (a*t + b)*t*t + n; } static inline float hash2f( int n ) { n = (n << 13) ^ n; n = (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff; return (1.0f/2147483647.0f) * (float)n; } static inline float hash2sf( int n ) { n = (n << 13) ^ n; n = (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff; return -1.0f + (2.0f/2147483647.0f) * (float)n; } } // namespace piLibs
#ifndef CARDWIDGET_H #define CARDWIDGET_H #include <QWidget> namespace Ui { class CardWidget; } class Card; class CardWidget : public QWidget { Q_OBJECT public: explicit CardWidget(Card* c, QWidget *parent = NULL); ~CardWidget(); void refresh(); void highlight(bool hl); QString tooltipString() const; private: Ui::CardWidget* ui; Card* m_card; }; #endif // CARDWIDGET_H
// Copyright 2016 Mitchell Kember. Subject to the MIT License. #ifndef SET_H #define SET_H #include "intern.h" #include <stdbool.h> struct Set; // Creates a new empty set. struct Set *new_set(void); // Attempts to add 'id' to the set. If 'id' is not already in the set, adds it // and returns true. Otherwise, returns false. bool add_to_set(struct Set *set, InternId id); // Frees the memory associated with a set. void free_set(struct Set *set); #endif
#ifndef Py_OPCODE_H #define Py_OPCODE_H #define POP_TOP 1 #define UNARY_NOT 12 #define BINARY_MODULO 22 #define BINARY_ADD 23 #define BINARY_SUBSCR 25 #define STORE_SLICE 40 #define STORE_SUBSCR 60 #define BINARY_AND 64 #define PRINT_ITEM 71 #define PRINT_NEWLINE 72 #define RETURN_VALUE 83 #define POP_BLOCK 87 #define HAVE_ARGUMENT 90 #define STORE_NAME 90 #define LOAD_CONST 100 /* Index in const list */ #define LOAD_NAME 101 /* Index in name list */ #define LOAD_ATTR 105 /* Index in name list */ #define IMPORT_NAME 107 /* Index in name list */ #define JUMP_FORWARD 110 /* Number of bytes to skip */ #define JUMP_IF_FALSE 111 /* "" */ #define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */ #define LOAD_GLOBAL 116 /* Index in name list */ #define SETUP_LOOP 120 /* Target address (absolute) */ #define LOAD_FAST 124 /* Local variable number */ #define STORE_FAST 125 /* Local variable number */ #define SET_LINENO 127 /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ #define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ #define MAKE_FUNCTION 132 /* #defaults */ #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) #endif /* !Py_OPCODE_H */
/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkDecodingImageGenerator_DEFINED #define SkDecodingImageGenerator_DEFINED #include "SkBitmap.h" #include "SkImageGenerator.h" class SkData; class SkStreamRewindable; /** * An implementation of SkImageGenerator that calls into * SkImageDecoder. */ class SkDecodingImageGenerator : public SkImageGenerator { public: virtual ~SkDecodingImageGenerator(); virtual SkData* refEncodedData() SK_OVERRIDE; // This implementaion of getInfo() always returns true. virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE; virtual bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) SK_OVERRIDE; /** * These options will be passed on to the image decoder. The * defaults are sensible. * * @param fSampleSize If set to > 1, tells the decoder to return a * smaller than original bitmap, sampling 1 pixel for * every size pixels. e.g. if sample size is set to 3, * then the returned bitmap will be 1/3 as wide and high, * and will contain 1/9 as many pixels as the original. * Note: this is a hint, and the codec may choose to * ignore this, or only approximate the sample size. * * @param fDitherImage Set to true if the the decoder should try to * dither the resulting image when decoding to a smaller * color-space. The default is true. * * @param fRequestedColorType If not given, then use whichever * config the decoder wants. Else try to use this color * type. If the decoder won't support this color type, * SkDecodingImageGenerator::Create will return * NULL. kIndex_8_SkColorType is not supported. */ struct Options { Options() : fSampleSize(1) , fDitherImage(true) , fUseRequestedColorType(false) , fRequestedColorType() { } Options(int sampleSize, bool dither) : fSampleSize(sampleSize) , fDitherImage(dither) , fUseRequestedColorType(false) , fRequestedColorType() { } Options(int sampleSize, bool dither, SkColorType colorType) : fSampleSize(sampleSize) , fDitherImage(dither) , fUseRequestedColorType(true) , fRequestedColorType(colorType) { } const int fSampleSize; const bool fDitherImage; const bool fUseRequestedColorType; const SkColorType fRequestedColorType; }; /** * These two functions return a SkImageGenerator that calls into * SkImageDecoder. They return NULL on failure. * * The SkData version of this function is preferred. If the stream * has an underlying SkData (such as a SkMemoryStream) pass that in. * * This object will unref the stream when done or on failure. Since * streams have internal state (position), the caller should not pass * a shared stream in. Pass either a new duplicated stream in or * transfer ownership of the stream. This factory asserts * stream->unique(). * * For example: * SkStreamRewindable* stream; * ... * SkImageGenerator* gen * = SkDecodingImageGenerator::Create( * stream->duplicate(), SkDecodingImageGenerator::Options()); * ... * SkDELETE(gen); * * @param Options (see above) * * @return NULL on failure, a new SkImageGenerator on success. */ static SkImageGenerator* Create(SkStreamRewindable* stream, const Options& opt); /** * @param data Contains the encoded image data that will be used by * the SkDecodingImageGenerator. Will be ref()ed by the * SkImageGenerator constructor and and unref()ed on deletion. */ static SkImageGenerator* Create(SkData* data, const Options& opt); private: SkData* fData; SkStreamRewindable* fStream; const SkImageInfo fInfo; const int fSampleSize; const bool fDitherImage; SkDecodingImageGenerator(SkData* data, SkStreamRewindable* stream, const SkImageInfo& info, int sampleSize, bool ditherImage); static SkImageGenerator* Create(SkData*, SkStreamRewindable*, const Options&); typedef SkImageGenerator INHERITED; }; // // Example of most basic use case: // // bool install_data(SkData* data, SkBitmap* dst) { // return SkInstallDiscardablePixelRef( // SkDecodingImageGenerator::Create( // data, SkDecodingImageGenerator::Options()), dst, NULL); // } // bool install_stream(SkStreamRewindable* stream, SkBitmap* dst) { // return SkInstallDiscardablePixelRef( // SkDecodingImageGenerator::Create( // stream, SkDecodingImageGenerator::Options()), dst, NULL); // } #endif // SkDecodingImageGenerator_DEFINED
//---------------------------------------------------------------------------- #ifndef RequestIntDlgH #define RequestIntDlgH //---------------------------------------------------------------------------- #include <vcl\System.hpp> #include <vcl\Windows.hpp> #include <vcl\SysUtils.hpp> #include <vcl\Classes.hpp> #include <vcl\Graphics.hpp> #include <vcl\StdCtrls.hpp> #include <vcl\Forms.hpp> #include <vcl\Controls.hpp> #include <vcl\Buttons.hpp> #include <vcl\ExtCtrls.hpp> //---------------------------------------------------------------------------- class TOKBottomDlg : public TForm { __published: TButton *OKBtn; TButton *CancelBtn; TBevel *Bevel1; TEdit *Edit1; TLabel *Label1; private: public: virtual __fastcall TOKBottomDlg(TComponent* AOwner); }; //---------------------------------------------------------------------------- extern PACKAGE TOKBottomDlg *OKBottomDlg; //---------------------------------------------------------------------------- int RequestInt(String Caption, String Text, int Default); #endif
#pragma once namespace hackerrank { namespace bmgandre { namespace regex { namespace applications { class valid_pan_format { public: static void solve(); }; } // namespace applications } // namespace regex } // namespace bmgandre } // namespace hackerrank
// // The MIT License(MIT) // // Copyright(c) 2014 Demonsaw LLC // // 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 _EJA_SEARCH_COMPONENT_H_ #define _EJA_SEARCH_COMPONENT_H_ #include "component/component.h" #include "system/type.h" namespace eja { class entity; class search_component final : public component { make_factory(search_component); private: size_t m_swarm = 1; size_t m_weight = 0; public: search_component() { } // Interface virtual void clear() override; // Utility void add_swarm(const size_t swarm = 1) { m_swarm += swarm; } void sub_swarm(const size_t swarm = 1) { m_swarm -= swarm; } void add_weight(const size_t weight = 1) { m_weight += weight; } void sub_weight(const size_t weight = 1) { m_weight -= weight; } // Has bool has_swarm() const { return m_swarm > 0; } bool has_weight() const { return m_weight > 0; } // Set void set_swarm(const size_t swarm) { m_swarm = swarm; } void set_weight(const size_t weight) { m_weight = weight; } // Get size_t get_swarm() const { return m_swarm; } size_t get_weight() const { return m_weight; } }; } #endif
["Land_CncBarrier_F",0,0,0], ["Land_CncBarrierMedium_F",0,0,0], ["Land_CncBarrierMedium4_F",0,0,0], ["Land_CncBarrier_stripes_F",0,0,0], ["Land_CncWall4_F",0,0,0], ["Land_CncShelter_F",0,0,0],
#include "io.h" #include "panic.h" #include "pit.h" #define PIT_CLOCK_FREQUENCY 1193180 void pit_set_frequency(uint32_t hz) { uint32_t divisor = PIT_CLOCK_FREQUENCY / hz; if(divisor > 0xffff) { panic("frequency too low"); } outb(0x43, 0x36); outb(0x40, divisor & 0xff); outb(0x40, (divisor >> 8) & 0xff); }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <AirPortAssistant/StepByStepUIViewController_DevicePicker.h> #import "StepByStepUIDevicePicker-Protocol.h" @class NSString; @interface StepByStepUIViewController_Join_Config : StepByStepUIViewController_DevicePicker <StepByStepUIDevicePicker> { NSString *personalizedBaseName; unsigned int productID; int deviceKind; } @property(retain, nonatomic) NSString *personalizedBaseName; // @synthesize personalizedBaseName; - (_Bool)showMoreOptions; - (void)selectedDeviceUpdated; - (id)devicePickerLabel; - (id)deviceTableLabel; - (void)setupDevices; - (void)updateNavigationButtons; - (void)prepareParams; - (void)primaryActionSelected:(_Bool)arg1; - (void)setupHeaderAndFooter; - (void)setupEditableBaseStationName; - (void)textFieldDidChangeAtIndexPath:(id)arg1; - (_Bool)shouldChangeTextField:(id)arg1 atIndexPath:(id)arg2 forTextIndex:(unsigned long long)arg3 toString:(id)arg4; - (void)viewDidLoad; - (id)initWithNibName:(id)arg1 bundle:(id)arg2; @end
// // STXCommentCell.h // STXDynamicTableViewExample // // Created by Jesse Armand on 10/4/14. // Copyright (c) 2014 2359 Media Pte Ltd. All rights reserved. // @import UIKit; #import "STXCommentItem.h" typedef NS_ENUM(int16_t, STXCommentCellStyle) { STXCommentCellStyleSingleComment, STXCommentCellStyleShowAllComments }; @class STXCommentCell; @protocol STXCommentCellDelegate <NSObject> @optional - (void)commentCellWillShowAllComments:(STXCommentCell *)commentCell; - (void)commentCell:(STXCommentCell *)commentCell willShowCommenter:(id<STXUserItem>)commenter; - (void)commentCell:(STXCommentCell *)commentCell didSelectURL:(NSURL *)url; - (void)commentCell:(STXCommentCell *)commentCell didSelectHashtag:(NSString *)hashtag; - (void)commentCell:(STXCommentCell *)commentCell didSelectMention:(NSString *)mention; @end @interface STXCommentCell : UITableViewCell @property (copy, nonatomic) id <STXCommentItem> comment; @property (nonatomic) NSInteger totalComments; @property (weak, nonatomic) id <STXCommentCellDelegate> delegate; - (instancetype)initWithStyle:(STXCommentCellStyle)style comment:(id<STXCommentItem>)comment reuseIdentifier:(NSString *)reuseIdentifier; - (instancetype)initWithStyle:(STXCommentCellStyle)style totalComments:(NSInteger)totalComments reuseIdentifier:(NSString *)reuseIdentifier; @end
// // UIColor+Palette.h // ZhongRongJinFu // // Created by erongdu_cxk on 15/9/29. // Copyright (c) 2015年 Yosef Lin. All rights reserved. // #import <UIKit/UIKit.h> @interface UIColor (Palette) /** * * 十六进制加透明度 * * @param hexString 颜色的十六进制 * @param alpha 透明度 * * @return 返回UIColor */ + (instancetype)colorFromHexString:(NSString *)hexString Alpha:(CGFloat)alpha; /** * * 十六进制,6位长度不包含透明度,8位前2位是透明度,后面是颜色值 * * @param hexString 颜色的十六进制,如“#ffffff”或者#FFFFFFF * * @return 返回UIColor类型 */ + (instancetype)colorFromHexString:(NSString *)hexString; /** * * 通过传递包含r,g,b,a值的数组生成颜色 * * @param rgbaArray 包含R,G,B,A * * @return 返回UIColor类型 */ + (instancetype)colorFromRGBAArray:(NSArray *)rgbaArray; /** * * 通过传入的值装换成颜色,比如255,255,255,1 * * @param r 红色取值范围[0,255] * @param g 绿色取值范围[0,255] * @param b 蓝色取值范围[0,255] * @param a 透明度取值范围[0,1] * * @return 返回UIColor类型 */ + (instancetype)colorWithR:(CGFloat)red G:(CGFloat)green B:(CGFloat)blue A:(CGFloat)alpha; /** * * 返回颜色所对应的十六进制值 * * @return 该颜色的十六进制 */ - (NSString *)hexString; /** * * 返回颜色所分别对应的R,G,B,A值 * * @return 包含R,G,B,A值的数组 */ - (NSArray *)rgbaArray; /** * * 返回红色数值 * * @return 红色值 */ - (CGFloat)red; /** * * 返回绿色数值 * * @return 绿色值 */ - (CGFloat)green; /** * * 返回蓝色值 * * @return 蓝色值 */ - (CGFloat)blue; /** * * 返回透明值 * * @return 透明值 */ - (CGFloat)alpha; /** * * 更改颜色的透明度 * * @param alpha 更改的透明度 * * @return 返回新的UIColor */ - (instancetype)changeAlpha:(CGFloat)alpha; @end
// // Created by Dani Postigo on 2/5/14. // #import <Foundation/Foundation.h> #import <DPObject/BasicDelegater.h> @interface DPObjectObserver : BasicDelegater { NSMutableArray *objects; NSMutableArray *objectKeys; } @property(nonatomic, strong) NSMutableArray *objects; @property(nonatomic, strong) NSMutableArray *objectKeys; + (DPObjectObserver *) observer; - (void) addObject: (id) object keys: (NSArray *) keys; - (void) removeObject: (id) object; @end
#include <stdio.h> #include <stdlib.h> #include <string.h> char word[200]; int next_found = 0; int n; int cmp_char(const void * p1, const void * p2) { return (int)(*(char *)p1) - (int)(*(char *)p2); } int find(int id) { int i; int ans = -1; int d = 99; for (i = id +1; i < n; i++) if ( ((int)word[i] > (int)word[id]) && ((int)(word[i] - (int)word[id] < d)) ) { ans = i; d = (int)word[i] - (int)word[id]; } return ans; } int try(int id) { int chng_id = find(id); if (chng_id == -1) return 0; char tmp; tmp = word[id]; word[id] = word[chng_id]; word[chng_id] = tmp; qsort(&word[id+1], n - id - 2, sizeof(char), cmp_char); next_found = 1; return 1; } int main(void) { n = 0; int i = 0; while (1 == scanf("%c", &word[i])) i++; n = i; i = n - 1; while ((i >= 0) && !next_found) if (!try(i)) i--; if (1 == next_found) for (i = 0; i < n; i++) printf("%c", word[i]); else printf("no word"); }
#ifndef _TOYOTA_ALARM_CEASAR_TELEMATIC_H_ #define _TOYOTA_ALARM_CEASAR_TELEMATIC_H_ #include "GlobalDef.h" //*******************************************************************************/ // TL2/6/7 639 xx xx xF xx xx xx xx xx (AlarmState) //*******************************************************************************/ // OEM Alarm @ 1s //*******************************************************************************/ // TL2/6/7 AlarmState x0 = Disarmed // TL2/6/7 AlarmState x4 = Waiting to be armed // TL2/6/7 AlarmState x8 = Armed // TL2/6/7 AlarmState xC = Triggered #define TOYOTA_ALARM_DISARMED 0x00 #define TOYOTA_ALARM_ARMING 0x04 #define TOYOTA_ALARM_ARMED 0x08 #define TOYOTA_ALARM_TRIGGER 0x0C void ToyotaAlarm_CeasarTelematic_Update(Uint8 AlarmState); #endif
/* * st_trace.c, part of "klib" project. * * Created on: 30.05.2016, 16:54 * Author: Vsevolod Lutovinov <klopp@yandex.ru> */ #include "st_trace.h" #include "list.h" #include "_lock.h" #include "sig.h" #ifndef NDEBUG /* ---------------------------------------------------------------------------*/ typedef struct { char name[_ST_NAME_MAX + 1]; char file[_ST_FILE_MAX + 1]; char arg[_ST_ARG_MAX + 1]; char ret[_ST_RET_MAX + 1]; unsigned line; } _st_trace; static Stack _st_stack = NULL; static size_t _st_over = 0; static __lock_type _st_lock; /* ---------------------------------------------------------------------------*/ static void _st_signal( int signo ) { switch( signo ) { case SIGSEGV: case SIGILL: case SIGABRT: case SIGBUS: case SIGFPE: case SIGSYS: fprintf( stderr, "\nGot signal %s, stack trace:\n\n", signal_name( signo ) ); st_dump( NULL, NULL, " ", 2 ); break; default: break; } signal( signo, SIG_DFL ); } /* ---------------------------------------------------------------------------*/ static void _st_down( void ) { sdestroy( _st_stack ); } /* ---------------------------------------------------------------------------*/ void _st_init( void ) { if( !_st_stack ) { _st_stack = screate( list_Free ); atexit( _st_down ); signal( SIGSEGV, _st_signal ); signal( SIGABRT, _st_signal ); signal( SIGILL, _st_signal ); signal( SIGBUS, _st_signal ); signal( SIGFPE, _st_signal ); signal( SIGSYS, _st_signal ); __initlock( _st_lock ); } } /* ---------------------------------------------------------------------------*/ size_t _st_push( const char *ret, const char *name, const char *arg, const char *file, unsigned line ) { __lock( _st_lock ); _st_trace *data = Calloc( sizeof( _st_trace ), 1 ); strncpy( data->ret, ret, _ST_RET_MAX ); strncpy( data->name, name, _ST_NAME_MAX ); strncpy( data->file, file, _ST_FILE_MAX ); strncpy( data->arg, arg, _ST_ARG_MAX ); data->line = line; size_t i = strlen( data->arg ); if( *arg == '(' ) { memmove( data->arg, data->arg + 1, i ); i--; } if( i && *( data->arg + i - 1 ) == ')' ) { *( data->arg + i - 1 ) = 0; } if( !spush( _st_stack, data ) ) { _st_over++; } __unlock( _st_lock ); return _st_stack->size; } /* ---------------------------------------------------------------------------*/ void _st_pop( void ) { __lock( _st_lock ); if( _st_over ) { _st_over--; } else { Free( spop( _st_stack ) ); } __unlock( _st_lock ); } /* ---------------------------------------------------------------------------*/ static void _default_dumper( const char *ret, const char *name, const char *arg, const char *file, unsigned line, FILE *handle ) { fprintf( handle, "%s %s(%s) at %s, line %u\n", ret, name, arg, file, line ); } /* ---------------------------------------------------------------------------*/ void st_dump( const st_dumper dumper, FILE *file, const char *tab, int numbers ) { __lock( _st_lock ); size_t n = 1; size_t i = _st_stack->size; st_dumper _dumper = dumper ? dumper : _default_dumper; const char *_tab = tab ? tab : ""; FILE *_file = file ? file : stderr; LNode node = _st_stack->tail; while( node ) { _st_trace *data = node->data; node = node->prev; size_t j = 0; if( numbers ) { fprintf( _file, numbers == 2 ? "%zu. " : "%zu ", n ); n++; } while( tab && *_tab && j < _st_stack->size - i ) { fprintf( _file, "%s", _tab ); j++; } i--; _dumper( data->ret, data->name, data->arg, data->file, data->line, _file ); } __unlock( _st_lock ); } #endif
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #ifndef darktoken_TXDB_H #define darktoken_TXDB_H #include "txdb-leveldb.h" #endif // darktoken_TXDB_H
/* * Descriptors.h * (c) 2014 flabbergast * USB Descriptors. * Most code comes from a LUFA library Demo (license below). */ /* LUFA Library Copyright (C) Dean Camera, 2014. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. 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, 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. */ /** \file * * Header file for Descriptors.c. */ #ifndef _DESCRIPTORS_H_ #define _DESCRIPTORS_H_ /* Includes: */ #include <avr/pgmspace.h> #include <LUFA/Drivers/USB/USB.h> /* Macros: */ /** Endpoint address of the CDC device-to-host notification IN endpoint. */ #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) /** Endpoint address of the CDC device-to-host data IN endpoint. */ #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) /** Endpoint address of the CDC host-to-device data OUT endpoint. */ #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4) /** Size in bytes of the CDC device-to-host notification IN endpoint. */ #define CDC_NOTIFICATION_EPSIZE 8 /** Size in bytes of the CDC data IN and OUT endpoints. */ #define CDC_TXRX_EPSIZE 16 /** Endpoint address of the Keyboard HID reporting IN endpoint. */ #define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1) /** Size in bytes of the Keyboard HID reporting IN endpoint. */ #define KEYBOARD_EPSIZE 8 /* Type Defines: */ /** Type define for the device configuration descriptor structure. This must be defined in the * application code, as the configuration descriptor contains several sub-descriptors which * vary between devices, and which describe the device's usage to the host. */ typedef struct { USB_Descriptor_Configuration_Header_t Config; // CDC Control Interface USB_Descriptor_Interface_Association_t CDC_IAD; USB_Descriptor_Interface_t CDC_CCI_Interface; USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; // CDC Data Interface USB_Descriptor_Interface_t CDC_DCI_Interface; USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; USB_Descriptor_Endpoint_t CDC_DataInEndpoint; // Keyboard HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_KeyboardHID; USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; /** Enum for the device interface descriptor IDs within the device. Each interface descriptor * should have a unique ID index associated with it, which can be used to refer to the * interface from other descriptors. */ enum InterfaceDescriptors_t { INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ INTERFACE_ID_Keyboard = 2, /**< Keyboard interface descriptor ID */ }; /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, const void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); #endif