text stringlengths 4 6.14k |
|---|
/* Copyright 2001-2004 The Apache Software Foundation
*
* 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.
*/
#include "mod_nss.h"
/* _________________________________________________________________
**
** Expression Handling
** _________________________________________________________________
*/
nss_expr_info_type nss_expr_info;
char *nss_expr_error;
nss_expr *nss_expr_comp(apr_pool_t *p, char *expr)
{
nss_expr_info.pool = p;
nss_expr_info.inputbuf = expr;
nss_expr_info.inputlen = strlen(expr);
nss_expr_info.inputptr = nss_expr_info.inputbuf;
nss_expr_info.expr = FALSE;
nss_expr_error = NULL;
if (nss_expr_yyparse())
return NULL;
return nss_expr_info.expr;
}
char *nss_expr_get_error(void)
{
if (nss_expr_error == NULL)
return "";
return nss_expr_error;
}
nss_expr *nss_expr_make(nss_expr_node_op op, void *a1, void *a2)
{
nss_expr *node;
node = (nss_expr *)apr_palloc(nss_expr_info.pool, sizeof(nss_expr));
node->node_op = op;
node->node_arg1 = (char *)a1;
node->node_arg2 = (char *)a2;
return node;
}
int nss_expr_exec(request_rec *r, nss_expr *expr)
{
BOOL rc;
rc = nss_expr_eval(r, expr);
if (nss_expr_error != NULL)
return (-1);
else
return (rc ? 1 : 0);
}
|
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
#import "FIRAuthRPCRequest.h"
#import "FIRIdentityToolkitRequest.h"
NS_ASSUME_NONNULL_BEGIN
/** @class FIRDeleteAccountRequest
@brief Represents the parameters for the deleteAccount endpoint.
@see https://developers.google.com/identity/toolkit/web/reference/relyingparty/deleteAccount
*/
@interface FIRDeleteAccountRequest : FIRIdentityToolkitRequest<FIRAuthRPCRequest>
/** @fn initWithEndpoint:APIKey:
@brief Please use initWithAPIKey:
*/
- (nullable instancetype)initWithEndpoint:(NSString *)endpoint
APIKey:(NSString *)APIKey NS_UNAVAILABLE;
/** @fn initWithAPIKey:
@brief Designated initializer.
@param APIKey The client's API Key.
@param localID The local ID.
@param accessToken The access token.
*/
- (nullable instancetype)initWithAPIKey:(NSString *)APIKey
localID:(NSString *)localID
accessToken:(NSString *)accessToken NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
// A good bit of this code was derived from the Three20 project
// and was customized to work inside ForestApp
//
// All modifications by ForestApp are licensed under
// the Apache License, Version 2.0
//
//
// Copyright 2009 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifdef USE_TI_UIDASHBOARDVIEW
#import <Foundation/Foundation.h>
@class LauncherItem;
@interface LauncherButton : UIButton {
BOOL dragging;
BOOL editing;
LauncherItem *item;
UIButton *button;
UIButton *closeButton;
UIButton *badge;
}
@property(nonatomic,readwrite,retain) LauncherItem *item;
@property(nonatomic,readonly) UIButton *closeButton;
@property(nonatomic) BOOL dragging;
@property(nonatomic) BOOL editing;
@end
#endif |
/*
* Copyright 2020 Google LLC
*
* 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.
*/
// **GENERATED FILE DO NOT MODIFY**
//
// This file is generated using:
// `tool/update-boringssl.py`
#include "../../../../../../third_party/boringssl/src/crypto/cipher_extra/e_aesccm.c"
|
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
* 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 SANDESHA2_MSG_NUMBER_H
#define SANDESHA2_MSG_NUMBER_H
/**
* @file sandesha2_msg_number.h
* @brief
*/
#include <sandesha2_error.h>
#include <axutil_env.h>
#include <axiom_node.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** @defgroup sandesha2_msg_number
* @ingroup sandesha2_wsrm
* @{
*/
typedef struct sandesha2_msg_number_t sandesha2_msg_number_t;
/**
* @brief Message Number ops struct
* Encapsulator struct for ops of sandesha2_msg_number
*/
/**
* @brief sandesha2_msg_number
* sandesha2_msg_number
*/
AXIS2_EXTERN sandesha2_msg_number_t* AXIS2_CALL
sandesha2_msg_number_create(
const axutil_env_t *env,
axis2_char_t *ns_value);
AXIS2_EXTERN sandesha2_msg_number_t* AXIS2_CALL
sandesha2_msg_number_clone(
const axutil_env_t *env,
sandesha2_msg_number_t *msg_number);
axis2_status_t AXIS2_CALL
sandesha2_msg_number_free_void_arg(
void *msg_num,
const axutil_env_t *env);
axis2_status_t AXIS2_CALL
sandesha2_msg_number_free(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env);
axis2_char_t* AXIS2_CALL
sandesha2_msg_number_get_namespace_value(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env);
axis2_status_t AXIS2_CALL
sandesha2_msg_number_set_msg_num(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env,
long value);
long AXIS2_CALL
sandesha2_msg_number_get_msg_num(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env);
void* AXIS2_CALL
sandesha2_msg_number_from_om_node(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env,
axiom_node_t *om_node);
axiom_node_t* AXIS2_CALL
sandesha2_msg_number_to_om_node(
sandesha2_msg_number_t *msg_num,
const axutil_env_t *env,
void *om_node);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* SANDESHA2_MSG_NUMBER_H */
|
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
#pragma once
#include <aws/machinelearning/MachineLearning_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace MachineLearning
{
namespace Model
{
/**
* <p> Represents the output of a <code>CreateMLModel</code> operation, and is an
* acknowledgement that Amazon ML received the request.</p> <p>The
* <code>CreateMLModel</code> operation is asynchronous. You can poll for status
* updates by using the <code>GetMLModel</code> operation and checking the
* <code>Status</code> parameter. </p>
*/
class AWS_MACHINELEARNING_API CreateMLModelResult
{
public:
CreateMLModelResult();
CreateMLModelResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
CreateMLModelResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline const Aws::String& GetMLModelId() const{ return m_mLModelId; }
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline void SetMLModelId(const Aws::String& value) { m_mLModelId = value; }
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline void SetMLModelId(Aws::String&& value) { m_mLModelId = value; }
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline void SetMLModelId(const char* value) { m_mLModelId.assign(value); }
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline CreateMLModelResult& WithMLModelId(const Aws::String& value) { SetMLModelId(value); return *this;}
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline CreateMLModelResult& WithMLModelId(Aws::String&& value) { SetMLModelId(value); return *this;}
/**
* <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>. This
* value should be identical to the value of the <code>MLModelId</code> in the
* request. </p>
*/
inline CreateMLModelResult& WithMLModelId(const char* value) { SetMLModelId(value); return *this;}
private:
Aws::String m_mLModelId;
};
} // namespace Model
} // namespace MachineLearning
} // namespace Aws
|
/*
* Copyright 2014-2022 Real Logic Limited.
*
* 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
*
* https://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 AERON_RETRANSMIT_HANDLER_H
#define AERON_RETRANSMIT_HANDLER_H
#include "collections/aeron_int64_to_ptr_hash_map.h"
#include "aeron_driver_common.h"
#include "aeronmd.h"
typedef enum aeron_retransmit_action_state_enum
{
AERON_RETRANSMIT_ACTION_STATE_DELAYED,
AERON_RETRANSMIT_ACTION_STATE_LINGERING,
AERON_RETRANSMIT_ACTION_STATE_INACTIVE,
}
aeron_retransmit_action_state_t;
typedef struct aeron_retransmit_action_stct
{
int64_t expiry_ns;
int32_t term_id;
int32_t term_offset;
size_t length;
aeron_retransmit_action_state_t state;
}
aeron_retransmit_action_t;
#define AERON_RETRANSMIT_HANDLER_MAX_RETRANSMITS (16)
typedef int (*aeron_retransmit_handler_resend_func_t)(
void *clientd, int32_t term_id, int32_t term_offset, size_t length);
typedef struct aeron_retransmit_handler_stct
{
aeron_retransmit_action_t retransmit_action_pool[AERON_RETRANSMIT_HANDLER_MAX_RETRANSMITS];
aeron_int64_to_ptr_hash_map_t active_retransmits_map;
uint64_t delay_timeout_ns;
uint64_t linger_timeout_ns;
int64_t *invalid_packets_counter;
}
aeron_retransmit_handler_t;
int aeron_retransmit_handler_init(
aeron_retransmit_handler_t *handler,
int64_t *invalid_packets_counter,
uint64_t delay_timeout_ns,
uint64_t linger_timeout_ns);
int aeron_retransmit_handler_close(aeron_retransmit_handler_t *handler);
int aeron_retransmit_handler_on_nak(
aeron_retransmit_handler_t *handler,
int32_t term_id,
int32_t term_offset,
size_t length,
size_t term_length,
int64_t now_ns,
aeron_retransmit_handler_resend_func_t resend,
void *resend_clientd);
int aeron_retransmit_handler_process_timeouts(
aeron_retransmit_handler_t *handler,
int64_t now_ns,
aeron_retransmit_handler_resend_func_t resend,
void *resend_clientd);
#endif //AERON_RETRANSMIT_HANDLER_H
|
/*
============================================================================
Name : LocationEngine.h
Author : Ross Savage
Copyright : 2007 Buddycloud
Description : Location Engine for determining the clients location
through multiple resources
History : 1.0
1.0 Initial Development
============================================================================
*/
#ifndef LOCATIONENGINE_H_
#define LOCATIONENGINE_H_
#include <e32base.h>
#include "CellTowerDataHandler.h"
#include "GpsDataHandler.h"
#include "LocationInterfaces.h"
#include "SignalStrengthDataHandler.h"
#include "Timer.h"
#include "TimeUtilities.h"
#include "WlanDataHandler.h"
#include "XmppInterfaces.h"
#include "XmlParser.h"
#ifdef __WINSCW__
#include "CellTowerDataSimulation.h"
#endif
/*
----------------------------------------------------------------------------
--
-- Enumerations
--
----------------------------------------------------------------------------
*/
enum TLocationEngineState {
ELocationShutdown, ELocationIdle, ELocationWaitForTimeout, ELocationWaitForResources
};
enum TLocationError {
ELocationErrorNone, ELocationErrorNoXmppInterface, ELocationErrorBadQueryResult
};
/*
----------------------------------------------------------------------------
--
-- CLocationEngine
--
----------------------------------------------------------------------------
*/
class CLocationEngine : public CBase, MLocationEngineDataInterface, MXmppStanzaObserver, MTimeoutNotification,
MGpsNotification, MCellTowerNotification, MWlanNotification, MSignalStrengthNotification {
public:
static CLocationEngine* NewL(MLocationEngineNotification* aEngineObserver);
static CLocationEngine* NewLC(MLocationEngineNotification* aEngineObserver);
~CLocationEngine();
private:
CLocationEngine();
void ConstructL(MLocationEngineNotification* aEngineObserver);
public:
void SetEngineObserver(MLocationEngineNotification* aEngineObserver);
void SetXmppWriteInterface(MXmppWriteInterface* aXmppInterface);
void SetTimeInterface(MTimeInterface* aTimeInterface);
public: // Setup & Config
void SetLanguageCodeL(TDesC8& aLangCode);
void SetCellActive(TBool aActive);
void SetGpsActive(TBool aActive);
void SetWlanActive(TBool aActive);
void TriggerEngine();
public: // Stop & shutdown
void StopEngine();
void PrepareShutdown();
public: // From MLocationEngineDataInterface
TBool CellDataAvailable();
TBool GpsDataAvailable();
TBool WlanDataAvailable();
public: // From MLocationEngineDataInterface
void GetGpsPosition(TReal& aLatitude, TReal& aLongitude);
public: // From MLocationEngineDataInterface
TLocationMotionState GetLastMotionState();
TInt GetLastPatternQuality();
TInt GetLastPlaceId();
private:
TFormattedTimeDesc GetCurrentTime();
private: // Analysis & Transmission
void InsertCellTowerDataL();
void InsertSignalStrengthL(TInt32 aSignalStrength);
void InsertIntoPayload(TInt aPosition, const TDesC8& aString, TPtr8& aLogStanza);
void BuildLocationPayload();
public: // From MTimeoutNotification
void TimerExpired(TInt aExpiryId);
public: // Implemented functions from MCellTowerNotification
void CellTowerData(TBuf<4> aCountryCode, TBuf<8> aNetworkIdentity, TUint aLocationAreaCode, TUint aCellId);
void CellTowerError(TCellTowerError aError);
public: // Implemented functions from MGpsNotification
void GpsData(TReal aLatitude, TReal aLongitude, TReal aAccuracy);
void GpsError(TGpsError aError);
public: // Implemented functions from MWlanNotification
void WlanData(TDesC8& aMac, TDesC8& aSecurity, TUint aRxLevel);
void WlanNotification(TWlanNotification aCode);
public: // Implemented functions from MSignalStrengthNotification
void SignalStrengthData(TInt32 aSignalStrength, TInt8 aSignalBars);
void SignalStrengthError(TSignalStrengthError aError);
public: // From MXmppStanzaObserver
void XmppStanzaAcknowledgedL(const TDesC8& aStanza, const TDesC8& aId);
private:
static const TInt KIdleTimeout = 180000000;
static const TInt KResourceTimeout = 40000000;
static const TInt KShutdownTimeout = 300000;
private:
MLocationEngineNotification* iEngineObserver;
MXmppWriteInterface* iXmppInterface;
MTimeInterface* iTimeInterface;
TLocationEngineState iEngineState;
CCustomTimer* iTimer;
HBufC8* iLangCode;
HBufC8* iLogStanza;
// Cell tower resource
CCellTowerDataHandler* iCellTowerDataHandler;
class TCellTowerData {
public:
TBuf8<4> CountryCode;
TBuf8<8> NetworkIdentity;
TUint LocationAreaCode;
TUint CellId;
};
TCellTowerData iLastCellTower;
// Cell Tower Simulation
#ifdef __WINSCW__
CCellTowerDataSimulation* iCellTowerSimulator;
#endif
// Gps resource
CGpsDataHandler* iGpsDataHandler;
TReal iGpsLatitude;
TReal iGpsLongitude;
TReal iGpsAccuracy;
// Other resources
CWlanDataHandler* iWlanDataHandler;
CSignalStrengthDataHandler* iSignalStrengthDataHandler;
TBool iCellEnabled;
TBool iGpsEnabled;
TBool iWlanEnabled;
// Location server results
TLocationMotionState iMotionState;
TInt iPatternQuality;
TInt iPlaceId;
};
#endif /*LOCATIONENGINE_H_*/
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import <Foundation/Foundation.h>
#import "TiViewProxy.h"
/**
Protocol for orientation controller.
*/
@protocol TiOrientationController <NSObject>
@required
-(void)childOrientationControllerChangedFlags:(id<TiOrientationController>) orientationController;
@property(nonatomic,readonly) TiOrientationFlags orientationFlags;
@property(nonatomic,readwrite,assign) id<TiOrientationController> parentOrientationController;
@end
/**
Protocol for Window
*/
@protocol TiWindowProtocol <TiOrientationController>
-(void)open:(id)args;
-(void)close:(id)args;
-(BOOL)_handleOpen:(id)args;
-(BOOL)_handleClose:(id)args;
-(BOOL)opening;
-(BOOL)closing;
-(BOOL)isModal;
-(BOOL)hidesStatusBar;
-(UIStatusBarStyle)preferredStatusBarStyle;
@property (nonatomic, readwrite, assign) BOOL isManaged;
//Containing controller will call these callbacks(appearance/rotation) on contained windows when it receives them.
-(void)viewWillAppear:(BOOL)animated;
-(void)viewWillDisappear:(BOOL)animated;
-(void)viewDidAppear:(BOOL)animated;
-(void)viewDidDisappear:(BOOL)animated;
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;
//Focus callbacks from containing or hosting controller
-(void)gainFocus;
-(void)resignFocus;
-(BOOL)handleFocusEvents;
//ViewController support. Always returns TiViewController (or subclass).
-(UIViewController*) hostingController;
@end
/**
Protocol for containment controller. Implemented by UIViewControllers that can host ProgrammingAssignment3 Windows
*/
@protocol TiControllerContainment <NSObject>
@required
-(BOOL)canHostWindows;
-(UIView *)hostingView;
//Called by light weight windows from their windowWillOpen, windowWillClose, windowDidOpen, windowDidClose methods
-(void)willOpenWindow:(id<TiWindowProtocol>)theWindow;
-(void)willCloseWindow:(id<TiWindowProtocol>)theWindow;
-(void)didOpenWindow:(id<TiWindowProtocol>)theWindow;
-(void)didCloseWindow:(id<TiWindowProtocol>)theWindow;
-(void)showControllerModal:(UIViewController*)theController animated:(BOOL)animated;
-(void)hideControllerModal:(UIViewController*)theController animated:(BOOL)animated;
@end
@protocol TiRootControllerProtocol <NSObject>
/**
The protocol for root controller.
It is not intended to be implemented by clients.
@see TiRootViewController
*/
@required
//Background Control
-(void)setBackgroundImage:(UIImage*)arg;
-(void)setBackgroundColor:(UIColor*)arg;
-(void)dismissDefaultImage;
//Keyboard stuff
-(BOOL)keyboardVisible;
-(void)dismissKeyboard;
-(void)didKeyboardFocusOnProxy:(TiViewProxy<TiKeyboardFocusableView> *)visibleProxy;
-(void)didKeyboardBlurOnProxy:(TiViewProxy<TiKeyboardFocusableView> *)blurredProxy;
//ViewController stuff
-(TiOrientationFlags)getDefaultOrientations;
-(UIViewController*)topPresentedController;
-(UIViewController<TiControllerContainment>*)topContainerController;
@end
|
#ifndef TASK_MANAGER_INCLUDED
#define TASK_MANAGER_INCLUDED
#include <Arduino.h>
#define LATE_TIME_THRESHOLD (10000)
#define TASK_QUEUE_SIZE (10)
#define MAX_TRIGGERS (10)
#define TIME_TRIGGER (0x01)
class Trigger {
public:
// this trigger is used for debugging log
virtual boolean isOn() = 0;
virtual byte trigger() = 0;
// set trigger at the beginning of loop
virtual byte setTrigger(byte event) = 0;
// update trigger after each task
virtual byte updateTrigger(byte event) = 0;
};
class Task;
class TaskHandler {
public:
// virtual method to implement in handlers
virtual void doTask(Task *task, byte trigger, unsigned long time) = 0;
};
class Task {
public:
// task id for management. must be unique, but no checks are done
byte id;
// event to match
byte trigger;
// time when trigger matches
unsigned long time;
// replaces command field
TaskHandler *handler;
// check for the match
boolean matches(byte trigger, unsigned long time);
// reset task
void clear();
};
class TaskManager {
private:
Task queue[TASK_QUEUE_SIZE];
// triggers are external to task manager
Trigger *triggers[MAX_TRIGGERS];
byte getEvents();
byte updateEvents(byte status);
Task* addTaskInternal(byte id, byte trigger, unsigned long firstInvocation, TaskHandler *handler);
public:
void init();
// manage tasks
Task* addTask(byte id, byte trigger, TaskHandler *handler);
Task* addTask(byte id, byte trigger, unsigned long invocationDelay, TaskHandler *handler);
void removeTask(byte id);
void writeDebugReportSync();
// manage triggers
void registerTrigger(Trigger *trigger);
// main loop
void loop();
};
extern TaskManager TM;
#endif
|
#ifndef LOCACAO_H_
#define LOCACAO_H_
#include"classeItemPersistencia.h"
//********************************************************************
// Construida e testeda
//********************************************************************
class Locacao: public ItemPersistencia
{
private:
unsigned int idCliente;
unsigned int idFilme;
int precoDeLocacao;
bool situacao;
public:
Locacao( unsigned int identificador, unsigned int idCliente, unsigned int idFilme,
int precoDeLocacao, bool situacao);
void obter( unsigned int &identificador, unsigned int &idCliente, unsigned int &idFilme,
int &precoDeLocacao, bool &situacao)const;
bool obterSituacao()const{return situacao;};
void atribuirSituacao(bool situacao){this->situacao=situacao;};
};
Locacao::Locacao( unsigned int identificador, unsigned int idCliente, unsigned int idFilme,
int precoDeLocacao, bool situacao):
ItemPersistencia(identificador),
idCliente(idCliente),
idFilme(idFilme),
precoDeLocacao(precoDeLocacao),
situacao(situacao)
{
tipoDaClasse=2;
}
void Locacao::obter( unsigned int &identificador, unsigned int &idCliente, unsigned int &idFilme,
int &precoDeLocacao, bool &situacao)const
{
identificador=this->identificador;
idCliente=this->idCliente;
idFilme=this->idFilme;
precoDeLocacao=this->precoDeLocacao;
situacao=this->situacao;
}
#endif /*LOCACAO_H_*/
|
/**
* Copyright (c) 2016-2018 Netflix, Inc. All rights reserved.
*
* 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 SRC_MSG_RESPONSE_MESSAGE_BUILDER_H_
#define SRC_MSG_RESPONSE_MESSAGE_BUILDER_H_
#include <MslError.h>
#include <keyx/KeyExchangeFactory.h>
#include <msg/MessageBuilder.h>
#include <map>
#include <memory>
#include <set>
#include <string>
namespace netflix {
namespace msl {
namespace entityauth { class EntityAuthenticationData; }
namespace keyx { class KeyRequestData; }
namespace tokens { class MasterToken; class UserIdToken; class ServiceToken; class MslUser; }
namespace userauth { class UserAuthenticationData; }
namespace util { class MslContext; }
namespace msg {
class ErrorHeader; class MessageHeader; class MessageCapabilities;
/**
* <p>A message builder provides methods for building messages.</p>
*
* @author Wesley Miaw <wmiaw@netflix.com>
*/
class ResponseMessageBuilder : public MessageBuilder
{
public:
/**
* Create a new message builder that will craft a new message in response
* to another message. The constructed message may be used as a request.
*
* @param ctx MSL context.
* @param requestHeader message header to respond to.
* @return the message builder.
* @throws MslMasterTokenException if the provided message's master token
* is not trusted.
* @throws MslCryptoException if the crypto context from a key exchange
* cannot be created.
* @throws MslKeyExchangeException if there is an error with the key
* request data or the key response data cannot be created.
* @throws MslUserAuthException if there is an error with the user
* authentication data or the user ID token cannot be created.
* @throws MslException if a user ID token in the message header is not
* bound to its corresponding master token or there is an error
* creating or renewing the master token.
*/
ResponseMessageBuilder(
std::shared_ptr<util::MslContext> ctx,
std::shared_ptr<MessageHeader> requestHeader);
};
}}} // namespace netflix::msl::msg
#endif /* SRC_MSG_RESPONSE_MESSAGE_BUILDER_H_ */
|
//
// RXSettledResult.h
// RXPromise Libraries
//
// Created by Luke Melia on 5/13/14.
//
//
#import <Foundation/Foundation.h>
@interface RXSettledResult : NSObject
@property (nonatomic, assign, readonly, getter=isFulfilled) BOOL fulfilled;
@property (nonatomic, assign, readonly, getter=isRejected) BOOL rejected;
@property (readonly, nonatomic) id result;
-(instancetype)initWithFulfilled:(BOOL)isFulfilled andResult:(id)valueOrReason;
@end
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2022 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "Indexes/IndexFactory.h"
namespace arangodb {
class ClusterIndexFactory final : public IndexFactory {
public:
static void linkIndexFactories(
application_features::ApplicationServer& server, IndexFactory& factory);
explicit ClusterIndexFactory(application_features::ApplicationServer&);
~ClusterIndexFactory() = default;
Result enhanceIndexDefinition( // normalize definition
velocypack::Slice const definition, // source definition
velocypack::Builder& normalized, // normalized definition (out-param)
bool isCreation, // definition for index creation
TRI_vocbase_t const& vocbase // index vocbase
) const override;
/// @brief index name aliases (e.g. "persistent" => "hash", "skiplist" =>
/// "hash") used to display storage engine capabilities
std::unordered_map<std::string, std::string> indexAliases() const override;
void fillSystemIndexes(
LogicalCollection& col,
std::vector<std::shared_ptr<Index>>& systemIndexes) const override;
/// @brief create indexes from a list of index definitions
void prepareIndexes(
LogicalCollection& col, velocypack::Slice indexesSlice,
std::vector<std::shared_ptr<Index>>& indexes) const override;
};
} // namespace arangodb
|
//
// VKDocs.h
//
// Copyright (c) 2016 VK.com
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "VKApiObject.h"
#import "VKApiObjectArray.h"
@class VKDocs;
/**
Docs type of VK API. See descriptions here https://vk.com/dev/doc
*/
@interface VKDocs : VKApiObject
@property(nonatomic, strong) NSNumber *id;
@property(nonatomic, strong) NSNumber *owner_id;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, strong) NSNumber *size;
@property(nonatomic, copy) NSString *ext;
@property(nonatomic, copy) NSString *url;
@property(nonatomic, copy) NSString *photo_100;
@property(nonatomic, copy) NSString *photo_130;
@property(nonatomic, strong) NSNumber *date;
@property(nonatomic, strong) NSNumber *type;
@end
/**
Array of API docs objects
*/
@interface VKDocsArray : VKApiObjectArray
@end |
//
// EnrollInputWifiPasswordViewController.h
// EnrollmentDemo
//
// Created by liunan on 1/9/15.
// Copyright (c) 2015 honeywell. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "EnrollBaseViewController.h"
#import "ATWapiNetworkInfo.h"
#import "Combox.h"
@interface EnrollInputWifiPasswordViewController : EnrollBaseViewController<ComboxDelegate, UITextFieldDelegate>
@property (strong, nonatomic) ATWapiNetworkInfo *selectedNetwork;
@end
|
//
// CSFileUntil.h
// ChatServer
//
// Created by 刘杨 on 2017/12/29.
// Copyright © 2017年 Married. All rights reserved.
//
#import <Foundation/Foundation.h>
#define CSFileManager [NSFileManager defaultManager]
@interface CSFileUntil : NSObject
+ (NSError *)createDirectory:(NSString *)path;
+ (NSString *)createFileOnPath:(NSString *)filePath;
+ (NSString *)createFileOnDir:(NSString *)dirPath filename:(NSString *)filename;
@end
|
/*
Copyright 2015-present the Material Components for iOS authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <UIKit/UIKit.h>
@interface HomeHeaderView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *backgroundImage;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *textLogo;
@end
|
#include "mcu.h"
#include "spi.h"
#ifdef __cplusplus
#include <chrono>
#include <stdio.h>
#include <thread>
#include <chrono>
using namespace std;
#endif
void MCU_RunProcedure(uint8_t id)
{
const uint16_t x0002reg = SPI_read(0x0002) & 0xFF;
const uint16_t interupt6 = 0x0008;
const uint16_t addrs[5] = {0x0006, 0x0, 0x0002, 0x0002, 0x0002};
const uint16_t values[5] = {
(uint16_t)(id != 0),
(uint16_t)(id),
(uint16_t)(x0002reg & ~interupt6),
(uint16_t)(x0002reg | interupt6),
(uint16_t)(x0002reg & ~interupt6)};
SPI_write_batch(addrs, values, 5);
SPI_read(0x0002);
}
uint8_t MCU_WaitForStatus(uint16_t timeout_ms)
{
auto t1 = std::chrono::high_resolution_clock::now();
auto t2 = t1;
unsigned short value = 0;
std::this_thread::sleep_for(std::chrono::milliseconds(1));
do {
value = SPI_read(0x0001) & 0xFF;
if (value != 0xFF) //working
break;
std::this_thread::sleep_for(std::chrono::milliseconds(1));
t2 = std::chrono::high_resolution_clock::now();
}while (std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count() < timeout_ms);
SPI_write(0x0006, 0); //return SPI control to PC
return value & 0x7F;
}
uint8_t MCU_SetParameter(MCU_Parameter param, float value)
{
uint8_t x0002reg = SPI_read(0x0002);
const uint8_t interupt7 = 0x04;
if(param==MCU_REF_CLK || param == MCU_BW)
{
uint8_t inputRegs[3];
value /= 1e6;
inputRegs[0] = (uint8_t)value; //frequency integer part
uint16_t fracPart = value * 1000.0 - inputRegs[0]*1000.0;
inputRegs[1] = (fracPart >> 8) & 0xFF;
inputRegs[2] = fracPart & 0xFF;
for(uint8_t i = 0; i < 3; ++i)
{
SPI_write(0, inputRegs[2-i]);
SPI_write(0x0002, x0002reg | interupt7);
SPI_write(0x0002, x0002reg & ~interupt7);
int status = MCU_WaitForStatus(10);
if(status != 0)
printf("MCU error status 0x%02X\n", status);
}
}
if(param==MCU_REF_CLK)
MCU_RunProcedure(4);
if(param == MCU_BW)
MCU_RunProcedure(3);
if(param == MCU_EXT_LOOPBACK_PAIR)
{
uint8_t intVal = (int)value;
SPI_write(0, intVal);
SPI_write(0x0002, x0002reg | interupt7);
SPI_write(0x0002, x0002reg & ~interupt7);
int status = MCU_WaitForStatus(10);
if(status != 0)
printf("MCU error status 0x%02X\n", status);
MCU_RunProcedure(9);
}
int status = MCU_WaitForStatus(100);
if(status != 0)
printf("MCU error status 0x%02X\n", status);
return status;
}
uint8_t MCU_UploadProgram(const uint8_t* binImage, const uint16_t len)
{
#ifndef NDEBUG
auto timeStart = std::chrono::high_resolution_clock::now();
#endif // NDEBUG
const auto timeout = std::chrono::milliseconds(100);
uint16_t i;
const uint32_t controlAddr = 0x0002;
const uint32_t statusReg = 0x0003;
const uint32_t addrDTM = 0x0004; //data to MCU
const uint16_t EMTPY_WRITE_BUFF = 1 << 0;
const uint16_t PROGRAMMED = 1 << 6;
const uint8_t fifoLen = 32;
//reset MCU, set mode
SPI_write(controlAddr, 0);
SPI_write(controlAddr, 2 & 0x3); //SRAM
for(i=0; i<len; i+=fifoLen)
{
//wait till EMPTY_WRITE_BUFF = 1
bool fifoEmpty = false;
auto t1 = std::chrono::high_resolution_clock::now();
auto t2 = t1;
do{
fifoEmpty = SPI_read(statusReg) & EMTPY_WRITE_BUFF;
t2 = std::chrono::high_resolution_clock::now();
}while( !fifoEmpty && (t2-t1)<timeout);
if(!fifoEmpty)
return -1;//ReportError(ETIMEDOUT, "MCU FIFO full");
//write 32 bytes into FIFO
{
uint8_t j;
uint16_t addr[fifoLen];
uint16_t data[fifoLen];
for(j=0; j<fifoLen; ++j)
{
addr[j] = addrDTM;
data[j] = binImage[i+j];
}
SPI_write_batch(addr, data, fifoLen);
}
#ifndef NDEBUG
printf("MCU programming : %4i/%4i\r", i+fifoLen, len);
#endif
}
//wait until programmed flag
{
bool programmed = false;
auto t1 = std::chrono::high_resolution_clock::now();
auto t2 = t1;
do{
programmed = SPI_read(statusReg) & PROGRAMMED;
t2 = std::chrono::high_resolution_clock::now();
}while( !programmed && (t2-t1)<timeout);
if(!programmed)
return -1;//ReportError(ETIMEDOUT, "MCU not programmed");
}
#ifndef NDEBUG
auto timeEnd = std::chrono::high_resolution_clock::now();
printf("\nMCU Programming finished, %li ms\n",
std::chrono::duration_cast<std::chrono::milliseconds>
(timeEnd-timeStart).count());
#endif //NDEBUG
return 0;
}
|
/***************************************************************
*
* Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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 _JOBSTATE_LOG_H
#define _JOBSTATE_LOG_H
// This class handles the writing of the jobstate.log file for Pegasus
// (this file was formerly created by the Pegasus tailstatd parsing
// the dagman.out file).
// Note: the jobstate.log file is meant to be machine-parseable, so
// no changes to the format of the output should be made without
// consulting the Pegasus developers.
// Note: if a jobstate.log file is specified, failing to write to the
// file is a fatal error.
// The format of the lines in the jobstate.log file is as follows:
// Normal: <timestamp> <node name> <event name> <condor id>
// <job tag> <(unused -- dash)> <sequence number>
// (note that the default for the <job tag> is the Pegasus site).
// DAGMan start: <timestamp> INTERNAL *** DAGMAN_STARTED <condor id> ***
// DAGMan exit: <timestamp> INTERNAL *** DAGMAN_FINISHED <exit code> ***
// Recovery started: <timestamp> INTERNAL *** RECOVERY_STARTED ***
// Recovery finished: <timestamp> INTERNAL *** RECOVERY_FINISHED ***
#include <set>
#include "condor_event.h"
#include "job.h"
class JobstateLog {
public:
/** Constructor.
*/
JobstateLog();
/** Destructor.
*/
~JobstateLog();
/** Set the name of the jobstate.log file.
@param The name of the jobstate.log file to write to.
*/
void SetLogFile(const char *jobstateLogFile ) {
_jobstateLogFile = strnewp( jobstateLogFile ); }
/** Get the jobstate.log file.
@return The jobstate.log file we're writing to.
*/
const char *LogFile() { return _jobstateLogFile; }
/** Flush all pending output to the jobstate log file.
*/
void Flush();
/** Set up the data structures we need to avoid re-writing previously-
written events when we're in recovery mode.
*/
void InitializeRecovery();
/** Initialize the jobstate.log sequence number to the correct value
when we're running a rescue DAG (start up one after the last
sequence number we've already written).
*/
void InitializeRescue();
/** Write the DAGMAN_STARTED "event".
@param The HTCondor ID of the DAGMan job itself.
*/
void WriteDagmanStarted( const CondorID &DAGManJobId );
/** Write the DAGMAN_FINISHED "event".
@param The DAGMan exit code.
*/
void WriteDagmanFinished( int exitCode );
/** Write the RECOVERY_STARTED "event".
*/
void WriteRecoveryStarted();
/** Write the RECOVERY_FINISHED "event".
*/
void WriteRecoveryFinished();
/** Write the RECOVERY_FAILURE "event".
*/
void WriteRecoveryFailure();
/** Write an actual event. Note that not all events will be written
-- only the ones that Pegasus cares about.
@param The event.
@param The DAG node corresponding to the event.
*/
void WriteEvent( const ULogEvent *event, Job *node );
/** Write the JOB_SUCCESS or JOB_FAILURE "event".
@param The DAG node corresponding to the "event".
*/
void WriteJobSuccessOrFailure( Job *node );
/** Write the [PRE|POST]_SCRIPT_STARTED "event".
@param The DAG node corresponding to the "event".
*/
void WriteScriptStarted( Job *node, bool isPost );
/** Write the [PRE|POST]_SCRIPT_SUCCESS or [PRE|POST]_SCRIPT_FAILURE
"event".
@param The DAG node corresponding to the "event".
*/
void WriteScriptSuccessOrFailure( Job *node, bool isPost );
/** Write the SUBMIT_FAILED "event".
@param The DAG node corresponding to the "event".
*/
void WriteSubmitFailure( Job *node );
private:
/** Write an event to the jobstate.log file.
@param The time at which this event occurred (or NULL)
@param The DAG node corresponding to the "event".
@param The event name.
@param The HTCondor ID string (or other data).
*/
void Write( const time_t *eventTimeP, Job *node,
const char *eventName, const char *condorID );
/** Write an event to the jobstate.log file.
@param The time at which this event occurred (or NULL)
@param The string we want to write to the file.
*/
void Write( const time_t *eventTimeP, const MyString &info );
/** Convert a CondorID to a string.
@param The cluster part of the CondorID.
@param The proc part of the CondorID.
@param A MyString to receive the resulting string.
*/
void CondorID2Str( int cluster, int proc, MyString &idStr );
/** Parse (partially) a line of the jobstate.log file.
@param The line (altered by this method)
@param The time_t reference to receive the timestamp of the event.
@param A MyString to receive the node name.
@param An int reference to receive the sequence number.
@return true if parsing succeeded, false otherwise.
*/
static bool ParseLine( MyString &line, time_t ×tamp,
MyString &nodeName, int &seqNum );
// The jobstate.log file we're writing to.
char *_jobstateLogFile;
// File pointer to the jobstate.log file.
FILE *_outfile;
// When in recovery mode, this is the timestamp of the last
// pre-recovery "real" event (used to avoid re-writing events).
time_t _lastTimestampWritten;
// A list of the line(s) in the jobstate.log file that have the
// timestamp _lastTimestampWritten (used to avoid re-writing
// events).
std::set<MyString> _lastTimestampLines;
};
#endif // _JOBSTATE_LOG_H
|
//
// Copyright 2016 Chris.
//
// 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.
//
//
// TWNetworkManager.h
// TWKit
//
// Created by Chris on 24/5/2016.
//
#import <Foundation/Foundation.h>
@class TWRequest, TWResponse;
@interface TWNetworkManager : NSObject
+ (TWNetworkManager *)sharedManager;
- (void)get:(TWRequest *)request forResponseClass:(Class)clazz
success:(void (^)(TWResponse *response))success
failure:(void (^)(NSError *error))failure;
- (void)post:(TWRequest *)request forResponseClass:(Class)clazz
success:(void (^)(TWResponse *response))success
failure:(void (^)(NSError *error))failure;
- (void)get:(TWRequest *)request forResponseClass:(Class)clazz
progress:(void (^)(NSProgress *downloadProgress))progress
success:(void (^)(TWResponse *response))success
failure:(void (^)(NSError *error))failure;
- (void)post:(TWRequest *)request forResponseClass:(Class)clazz
progress:(void (^)(NSProgress *uploadProgress))progress
success:(void (^)(TWResponse *response))success
failure:(void (^)(NSError *error))failure;
- (void)post:(TWRequest *)request forResponseClass:(Class)clazz
progress:(void (^)(NSProgress *uploadProgress))progress
parts:(NSArray *)parts
success:(void (^)(TWResponse *response))success
failure:(void (^)(NSError *error))failure;
- (void)abort:(NSString *)url;
@end
|
/*
** my_putnbr_base.c for 42shlib in /media/data/all/projects/42sh-v1/lib/my/src/string
**
** Made by kevin labbe
** Login <labbe_k@epitech.net>
**
** Started on Tue Apr 23 14:35:03 2013 kevin labbe
** Last update Tue Apr 30 18:34:44 2013 kevin labbe
*/
#include "my.h"
void my_putnbr_base(const int fd, int nbr, char *base)
{
int reste;
if (nbr < 0)
{
my_putchar(fd, '-');
nbr *= -1;
}
reste = nbr % strlen(base);
nbr /= strlen(base);
if (nbr != 0)
my_putnbr_base(fd, nbr, base);
my_putchar(fd, base[reste]);
}
|
#pragma once
#include <Engine/SceneManager/Algorithms/Validation/ValidationAlgorithm.h>
#include <list>
namespace Scheduler
{
class PerformerSkillsStopValidationAlgorithm : public StopValidationAlgorithm
{
public:
virtual void validate(const Stop& stop, ViolationsConsumer& violations_consumer) const override;
constexpr static const char* staticGetName( )
{
return "PerformerSkills";
}
virtual const char* getName( ) const override
{
return staticGetName( );
}
};
} |
//
// LCDatabaseCoordinator.h
// LeanCloud
//
// Created by Tang Tianyong on 6/1/15.
// Copyright (c) 2015 LeanCloud Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "LCDatabaseCommon.h"
@interface LCDatabaseCoordinator : NSObject
@property (readonly) NSString *databasePath;
- (instancetype)initWithDatabasePath:(NSString *)databasePath;
- (void)executeTransaction:(LCDatabaseJob)job fail:(LCDatabaseJob)fail;
- (void)executeJob:(LCDatabaseJob)job;
@end
|
/*
* Copyright 2005-2017 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
START_CLASS_DEF
CLASS = accessor
SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_long
IMPLEMENTS = pack_long
END_CLASS_DEF
*/
/* START_CLASS_IMP */
/*
Don't edit anything between START_CLASS_IMP and END_CLASS_IMP
Instead edit values between START_CLASS_DEF and END_CLASS_DEF
or edit "accessor.class" and rerun ./make_class.pl
*/
static int pack_long(grib_accessor*, const long* val,size_t *len);
static int unpack_long(grib_accessor*, long* val,size_t *len);
static void init_class(grib_accessor_class*);
typedef struct grib_accessor_int32 {
grib_accessor att;
/* Members defined in gen */
/* Members defined in int32 */
} grib_accessor_int32;
extern grib_accessor_class* grib_accessor_class_gen;
static grib_accessor_class _grib_accessor_class_int32 = {
&grib_accessor_class_gen, /* super */
"int32", /* name */
sizeof(grib_accessor_int32), /* size */
0, /* inited */
&init_class, /* init_class */
0, /* init */
0, /* post_init */
0, /* free mem */
0, /* describes himself */
0, /* get length of section */
0, /* get length of string */
0, /* get number of values */
0, /* get number of bytes */
0, /* get offset to bytes */
0, /* get native type */
0, /* get sub_section */
0, /* grib_pack procedures long */
0, /* grib_pack procedures long */
&pack_long, /* grib_pack procedures long */
&unpack_long, /* grib_unpack procedures long */
0, /* grib_pack procedures double */
0, /* grib_unpack procedures double */
0, /* grib_pack procedures string */
0, /* grib_unpack procedures string */
0, /* grib_pack array procedures string */
0, /* grib_unpack array procedures string */
0, /* grib_pack procedures bytes */
0, /* grib_unpack procedures bytes */
0, /* pack_expression */
0, /* notify_change */
0, /* update_size */
0, /* preferred_size */
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value */
0, /* unpack a subarray */
0, /* clear */
0, /* clone accessor */
};
grib_accessor_class* grib_accessor_class_int32 = &_grib_accessor_class_int32;
static void init_class(grib_accessor_class* c)
{
c->dump = (*(c->super))->dump;
c->next_offset = (*(c->super))->next_offset;
c->string_length = (*(c->super))->string_length;
c->value_count = (*(c->super))->value_count;
c->byte_count = (*(c->super))->byte_count;
c->byte_offset = (*(c->super))->byte_offset;
c->get_native_type = (*(c->super))->get_native_type;
c->sub_section = (*(c->super))->sub_section;
c->pack_missing = (*(c->super))->pack_missing;
c->is_missing = (*(c->super))->is_missing;
c->pack_double = (*(c->super))->pack_double;
c->unpack_double = (*(c->super))->unpack_double;
c->pack_string = (*(c->super))->pack_string;
c->unpack_string = (*(c->super))->unpack_string;
c->pack_string_array = (*(c->super))->pack_string_array;
c->unpack_string_array = (*(c->super))->unpack_string_array;
c->pack_bytes = (*(c->super))->pack_bytes;
c->unpack_bytes = (*(c->super))->unpack_bytes;
c->pack_expression = (*(c->super))->pack_expression;
c->notify_change = (*(c->super))->notify_change;
c->update_size = (*(c->super))->update_size;
c->preferred_size = (*(c->super))->preferred_size;
c->resize = (*(c->super))->resize;
c->nearest_smaller_value = (*(c->super))->nearest_smaller_value;
c->next = (*(c->super))->next;
c->compare = (*(c->super))->compare;
c->unpack_double_element = (*(c->super))->unpack_double_element;
c->unpack_double_subarray = (*(c->super))->unpack_double_subarray;
c->clear = (*(c->super))->clear;
c->make_clone = (*(c->super))->make_clone;
}
/* END_CLASS_IMP */
static int unpack_long(grib_accessor* a, long* val, size_t *len)
{
long value = 0;
/*long pos = a->offset;*/
/*unsigned char* data = grib_handle_of_accessor(a)->buffer->data;*/
if(*len < 1)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name , 1 );
*len = 0;
return GRIB_ARRAY_TOO_SMALL;
}
*val = value;
*len = 1;
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* val, size_t *len) {
return GRIB_NOT_IMPLEMENTED;
}
|
/*
This source is part of UnitKit, a unit test framework for Mac OS X
development. You can find more information about UnitKit at:
http://unitkit.org/
Copyright ©2005 James Duncan Davidson
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.
The use of the Apache License does not indicate that this project is
affiliated with the Apache Software Foundation.
*/
#import <Cocoa/Cocoa.h>
#import <UnitKit/UnitKit.h>
/*!
@class SinglePassClass
@abstract A simple class that has one method in it that calls UKPass once
@discussion This class is used by UKRunnerTests. Because it is being used by a test class manually added to a runner, and we don't want it run unless requested, it is not marked with the UKTest protocol.
*/
@interface SingleFail : NSObject {
}
@end
|
/*
* Copyright 2020 Google LLC
*
* 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 CLIF_TESTING_SHARED_PTR_PROTO_MEMBER_H_
#define CLIF_TESTING_SHARED_PTR_PROTO_MEMBER_H_
#include <memory>
// AST proto conveniently doubles as test object.
#include "clif/protos/ast.pb.h"
namespace proto2 = google::protobuf;
namespace clif_testing {
namespace shared_ptr_proto_member {
class ProtoHolderByValue {
public:
// ProtoHolderByValue(const clif::protos::AST&) leads to matcher failure.
ProtoHolderByValue(clif::protos::AST ast) : by_val_ast_{ast} {}
clif::protos::AST GetByValue() const { return by_val_ast_; }
const clif::protos::AST& GetConstRef() const { return by_val_ast_; }
void ResetSource(const std::string& new_source) {
by_val_ast_.set_source(new_source);
}
private:
clif::protos::AST by_val_ast_;
};
class ProtoHolderUniquePtr {
public:
ProtoHolderUniquePtr(std::unique_ptr<clif::protos::AST> ast)
: uq_ptr_ast_{std::move(ast)} {}
std::unique_ptr<clif::protos::AST> GetUniquePtr() {
return std::move(uq_ptr_ast_);
}
void ResetSource(const std::string& new_source) {
uq_ptr_ast_->set_source(new_source);
}
private:
std::unique_ptr<clif::protos::AST> uq_ptr_ast_;
};
class ProtoHolderSharedPtr {
public:
// NO Clif_PyObjAs() for shared_ptr:
// ProtoHolderSharedPtr(std::shared_ptr<clif::protos::AST> ast)
// But this works:
ProtoHolderSharedPtr(std::unique_ptr<clif::protos::AST> ast)
: sh_ptr_ast_{std::move(ast)} {}
std::shared_ptr<clif::protos::AST> GetSharedPtr() const {
return sh_ptr_ast_;
}
void ResetSource(const std::string& new_source) {
sh_ptr_ast_->set_source(new_source);
}
std::size_t GetSharedPtrUseCount() const { return sh_ptr_ast_.use_count(); }
private:
std::shared_ptr<clif::protos::AST> sh_ptr_ast_;
};
} // namespace shared_ptr_proto_member
} // namespace clif_testing
#endif // CLIF_TESTING_SHARED_PTR_PROTO_MEMBER_H_
|
//
// MyView.h
// 触摸
//
// Created by tarena on 16/4/13.
// Copyright © 2016年 tarena. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyView : UIView
@end
|
// Copyright 2020 Google LLC. All Rights Reserved.
//
// 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 OPS_SECURITY_PENTESTING_SCANNING_PLUSFISH_PARSERS_HTML_SCRAPER_H_
#define OPS_SECURITY_PENTESTING_SCANNING_PLUSFISH_PARSERS_HTML_SCRAPER_H_
#include <memory>
#include <vector>
#include "opensource/deps/base/macros.h"
#include "absl/container/node_hash_set.h"
#include "parsers/gumbo_parser.h"
#include "parsers/html_parser.h"
#include "proto/issue_details.pb.h"
#include "request.h"
#include "util/html_fingerprint.h"
namespace plusfish {
// Parses HTML using the gumbo parser. The scraper collect anchors and security
// issues using GumboFilters which each are given document nodes while iterating
// over the parsed HTML tree.
// Sample usage:
// HtmlScraper scraper;
// if (scraper.Parse("http://example.org", http_response_string)) {
// process(scraper.anchors());
// }
// delete scraper;
class HtmlScraper : HtmlParserInterface {
public:
HtmlScraper();
~HtmlScraper() override;
// Returns a vector with collected URLs.
const std::vector<std::string>& anchors() const override { return anchors_; }
// Returns a vector with collected Requests.
std::vector<std::unique_ptr<Request>>& requests() override {
return requests_;
}
// Returns a set with collected issues.
absl::node_hash_set<std::unique_ptr<IssueDetails>>& issues() override {
return issues_;
}
// Return the HTML fingerprint
std::unique_ptr<HtmlFingerprint> fingerprint() {
return std::move(fingerprint_);
}
// Parse HTML content. The Request is used for parsing relative URLs
// and registering security issues. Returns true when the Request and
// content were processed successfully. Else false is returned.
bool Parse(const Request* request, const std::string& html_content) override;
private:
// Anchors scraped from the response.
std::vector<std::string> anchors_;
// Requests (e.g. forms) scraped from the response.
std::vector<std::unique_ptr<Request>> requests_;
// Issues returned by filters.
absl::node_hash_set<std::unique_ptr<IssueDetails>> issues_;
// HTML fingerprint of the request.
std::unique_ptr<HtmlFingerprint> fingerprint_;
std::unique_ptr<GumboParser> gumbo_parser_;
DISALLOW_COPY_AND_ASSIGN(HtmlScraper);
};
} // namespace plusfish
#endif // OPS_SECURITY_PENTESTING_SCANNING_PLUSFISH_PARSERS_HTML_SCRAPER_H_
|
/*
** $Id: lgc.h,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
#ifndef lgc_h
#define lgc_h
#include "lobject.h"
#include "lstate.h"
/*
** Collectable objects may have one of three colors: white, which
** means the object is not marked; gray, which means the
** object is marked, but its references may be not marked; and
** black, which means that the object and all its references are marked.
** The main invariant of the garbage collector, while marking objects,
** is that a black object can never point to a white one. Moreover,
** any gray object must be in a "gray list" (gray, grayagain, weak,
** allweak, ephemeron) so that it can be visited again before finishing
** the collection cycle. These lists have no meaning when the invariant
** is not being enforced (e.g., sweep phase).
*/
/* how much to allocate before next GC step */
#if !defined(GCSTEPSIZE)
/* ~100 small strings */
#define GCSTEPSIZE (cast_int(100 * sizeof(TString)))
#endif
/*
** Possible states of the Garbage Collector
*/
#define GCSpropagate 0
#define GCSatomic 1
#define GCSswpallgc 2
#define GCSswpfinobj 3
#define GCSswptobefnz 4
#define GCSswpend 5
#define GCScallfin 6
#define GCSpause 7
#define issweepphase(g) \
(GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend)
/*
** macro to tell when main invariant (white objects cannot point to black
** ones) must be kept. During a collection, the sweep
** phase may break the invariant, as objects turned white may point to
** still-black objects. The invariant is restored when sweep ends and
** all objects are white again.
*/
#define keepinvariant(g) ((g)->gcstate <= GCSatomic)
/*
** some useful bit tricks
*/
#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
#define setbits(x,m) ((x) |= (m))
#define testbits(x,m) ((x) & (m))
#define bitmask(b) (1<<(b))
#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
#define l_setbit(x,b) setbits(x, bitmask(b))
#define resetbit(x,b) resetbits(x, bitmask(b))
#define testbit(x,b) testbits(x, bitmask(b))
/* Layout for bit use in 'marked' field: */
#define WHITE0BIT 0 /* object is white (type 0) */
#define WHITE1BIT 1 /* object is white (type 1) */
#define BLACKBIT 2 /* object is black */
#define FINALIZEDBIT 3 /* object has been marked for finalization */
/* bit 7 is currently used by tests (luaL_checkmemory) */
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
#define iswhite(x) testbits((x)->marked, WHITEBITS)
#define isblack(x) testbit((x)->marked, BLACKBIT)
#define isgray(x) /* neither white nor black */ \
(!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT)))
#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT)
#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS)
#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked)
#define changewhite(x) ((x)->marked ^= WHITEBITS)
#define gray2black(x) l_setbit((x)->marked, BLACKBIT)
#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
#define luaC_condGC(L,c) \
{if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}
#define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);)
#define luaC_barrier(L,p,v) { \
if (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) \
luaC_barrier_(L,obj2gco(p),gcvalue(v)); }
#define luaC_barrierback(L,p,v) { \
if (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) \
luaC_barrierback_(L,p); }
#define luaC_objbarrier(L,p,o) { \
if (isblack(p) && iswhite(o)) \
luaC_barrier_(L,obj2gco(p),obj2gco(o)); }
#define luaC_upvalbarrier(L,uv) \
{ if (iscollectable((uv)->v) && !upisopen(uv)) \
luaC_upvalbarrier_(L,uv); }
LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o);
LUAI_FUNC void luaC_freeallobjects (lua_State *L);
LUAI_FUNC void luaC_step (lua_State *L);
LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask);
LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency);
LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz);
LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);
LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o);
LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv);
LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);
LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv);
#endif
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_apache_hadoop_io_compress_lz4_Lz4Compressor */
#ifndef _Included_org_apache_hadoop_io_compress_lz4_Lz4Compressor
#define _Included_org_apache_hadoop_io_compress_lz4_Lz4Compressor
#ifdef __cplusplus
extern "C" {
#endif
#undef org_apache_hadoop_io_compress_lz4_Lz4Compressor_DEFAULT_DIRECT_BUFFER_SIZE
#define org_apache_hadoop_io_compress_lz4_Lz4Compressor_DEFAULT_DIRECT_BUFFER_SIZE 65536L
/*
* Class: org_apache_hadoop_io_compress_lz4_Lz4Compressor
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_initIDs
(JNIEnv *, jclass);
/*
* Class: org_apache_hadoop_io_compress_lz4_Lz4Compressor
* Method: compressBytesDirect
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_compressBytesDirect
(JNIEnv *, jobject);
/*
* Class: org_apache_hadoop_io_compress_lz4_Lz4Compressor
* Method: compressBytesDirectHC
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_compressBytesDirectHC
(JNIEnv *, jobject);
/*
* Class: org_apache_hadoop_io_compress_lz4_Lz4Compressor
* Method: getLibraryName
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_getLibraryName
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif
|
//
// LZGlobal.h
// LZNetworkingProURLSession
//
// Created by comst on 15/10/18.
// Copyright (c) 2015年 com.comst1314. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "LZUserInfo.h"
@interface LZGlobal : NSObject
@property (nonatomic, strong) LZUserInfo *userinfo;
+ (instancetype)sharedglobal;
@end
|
//
// FriendVerifyViewController.h
// Clan
//
// Created by chivas on 15/7/17.
// Copyright (c) 2015年 Youzu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FriendVerifyViewController : BaseViewController
@property (copy, nonatomic)NSString *uid;
@property (copy, nonatomic)NSString *username;
@end
|
//
// KSYPlayerOtherView.h
// KSYGPUStreamerDemo
//
// Created by 施雪梅 on 17/7/12.
// Copyright © 2016年 ksyun. All rights reserved.
//
/**
其他相关控制
*/
#import "KSYUIView.h"
@interface KSYPlayerOtherView: KSYUIView
@property (nonatomic)UIButton *btnReload; //reload
@property (nonatomic)UIButton *btnFloat; //悬浮窗
@property (nonatomic)UISwitch *switchRec; //录制
@property (nonatomic)UILabel *labelMeta; //信息显示页面
@property (nonatomic)UIButton *btnPrintMeta; //显示当前的媒体信息
@end
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __nsCheapSets_h__
#define __nsCheapSets_h__
#include "nsTHashtable.h"
#include <stdint.h>
/**
* A set that takes up minimal size when there are 0 or 1 entries in the set.
* Use for cases where sizes of 0 and 1 are even slightly common.
*/
template<typename EntryType>
class nsCheapSet
{
public:
typedef typename EntryType::KeyType KeyType;
typedef PLDHashOperator (*Enumerator)(EntryType* aEntry, void* userArg);
nsCheapSet() : mState(ZERO) {}
~nsCheapSet() { Clear(); }
/**
* Remove all entries.
*/
void Clear()
{
switch (mState) {
case ZERO:
break;
case ONE:
GetSingleEntry()->~EntryType();
break;
case MANY:
delete mUnion.table;
break;
default:
NS_NOTREACHED("bogus state");
break;
}
mState = ZERO;
}
nsresult Put(const KeyType aVal);
void Remove(const KeyType aVal);
bool Contains(const KeyType aVal)
{
switch (mState) {
case ZERO:
return false;
case ONE:
return GetSingleEntry()->KeyEquals(EntryType::KeyToPointer(aVal));
case MANY:
return !!mUnion.table->GetEntry(aVal);
default:
NS_NOTREACHED("bogus state");
return false;
}
}
uint32_t EnumerateEntries(Enumerator aEnumFunc, void* aUserArg)
{
switch (mState) {
case ZERO:
return 0;
case ONE:
if (aEnumFunc(GetSingleEntry(), aUserArg) == PL_DHASH_REMOVE) {
GetSingleEntry()->~EntryType();
mState = ZERO;
}
return 1;
case MANY:
return mUnion.table->EnumerateEntries(aEnumFunc, aUserArg);
default:
NS_NOTREACHED("bogus state");
return 0;
}
}
private:
EntryType* GetSingleEntry()
{
return reinterpret_cast<EntryType*>(&mUnion.singleEntry[0]);
}
enum SetState
{
ZERO,
ONE,
MANY
};
union
{
nsTHashtable<EntryType>* table;
char singleEntry[sizeof(EntryType)];
} mUnion;
enum SetState mState;
};
template<typename EntryType>
nsresult
nsCheapSet<EntryType>::Put(const KeyType aVal)
{
switch (mState) {
case ZERO:
new (GetSingleEntry()) EntryType(EntryType::KeyToPointer(aVal));
mState = ONE;
return NS_OK;
case ONE: {
nsTHashtable<EntryType>* table = new nsTHashtable<EntryType>();
EntryType* entry = GetSingleEntry();
table->PutEntry(entry->GetKey());
entry->~EntryType();
mUnion.table = table;
mState = MANY;
}
// Fall through.
case MANY:
mUnion.table->PutEntry(aVal);
return NS_OK;
default:
NS_NOTREACHED("bogus state");
return NS_OK;
}
}
template<typename EntryType>
void
nsCheapSet<EntryType>::Remove(const KeyType aVal)
{
switch (mState) {
case ZERO:
break;
case ONE:
if (Contains(aVal)) {
GetSingleEntry()->~EntryType();
mState = ZERO;
}
break;
case MANY:
mUnion.table->RemoveEntry(aVal);
break;
default:
NS_NOTREACHED("bogus state");
break;
}
}
#endif
|
//
// AddViewController.h
// 13-私人通讯录
//
// Created by FuYu on 15/8/24.
// Copyright (c) 2015年 FuYu. All rights reserved.
//
#import <UIKit/UIKit.h>
@class AddViewController,Contact;
@protocol AddViewControllerDelegate <NSObject>
@optional
- (void)addViewController:(AddViewController *)addVc didAddContact:(Contact *)contact;
@end
@interface AddViewController : UIViewController
@property (nonatomic, weak) id<AddViewControllerDelegate> delegate;
@end
|
/*
* ltfsTaskManagement.h
*
* Created on: Aug 28, 2012
* Author: chento
*/
#ifndef __LTFSTASKMANAGEMENT_H__
#define __LTFSTASKMANAGEMENT_H__
#include "stdafx.h"
#include "ltfsTaskLoadTape.h"
#include "ltfsTaskAutoClean.h"
#include "ltfsTaskCheckTape.h"
#include "ltfsTaskAuditTape.h"
#include "ltfsTaskDeleteTapeFile.h"
#ifndef __LTFS_SOAP_H__
#define __LTFS_SOAP_H__
#include "ltfs.h"
#endif
namespace ltfs_soapserver
{
enum DeleteFilesOnTapeStatus
{
DF_NOT_RUN = 0,
DF_RUNNING = 1,
DF_FINISHED = 2,
DF_FAILED = 3
};
class TaskManagement
{
public:
static
TaskManagement* GetInstance();
bool
LoadTaskQueue();
bool
SaveTaskQueue(bool serverStoped = false);
bool
AddTask(Task* pTask, bool needSave=true);
bool
QueryStatus(struct QueryTaskRslt& result);
bool
QueryLoadStatus();
bool
CancelTask(string &uid, TaskType type);
void
TaskCleaner();
void
TaskTapeAuditTrigger();
bool
GetServerStop();
bool IsTaskRunning(const string& barcode, TaskType taskType);
bool GetRunningTaskTapes(TaskType taskType, vector<string>& runningTapes);
DeleteFilesOnTapeStatus GetTapeDeleteFileStatus(const string& barcode);
void SetTapeDeleteFileStatus(const string& barcode, DeleteFilesOnTapeStatus status);
private:
TaskManagement();
~TaskManagement();
void
LoadTaskFrFile();
void
RecoverTask(boost::property_tree::ptree & taskTree);
void
RecoverFormat(boost::property_tree::ptree & formatTree);
time_t
GetLastStartTimeFromFile();
void
SetLastStartTimeToFile(time_t lastStartTime);
void
SaveTaskToFile();
void RefreshTapeList(map<string, string>& tapeShareMap,
map<string, time_t>& lastDeleteMap, map<string, UInt64_t>& pendingNumMap, time_t& refreshTime);
void TaskTapeDeleteFile();
private:
static TaskManagement* mInstance;
static boost::mutex mMutex;
std::vector<Task*> taskList_;
boost::mutex listMutex_;
boost::scoped_ptr<boost::thread> threadPtr_;
boost::scoped_ptr<boost::thread> auditPtr_;
boost::scoped_ptr<boost::thread> deleteFilesPtr_;
boost::mutex deleteFileOnTapeMapMutex_;
map<string, DeleteFilesOnTapeStatus> deleteFilesOnTapeMap_; //
bool stop_;
};
}
#endif /* LTFSTASKMANAGEMENT_H_ */
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Peter Lawrence
* Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
#ifndef _TUSB_NET_DEVICE_H_
#define _TUSB_NET_DEVICE_H_
#include "common/tusb_common.h"
#include "device/usbd.h"
#include "class/cdc/cdc.h"
// TODO should not include external files
#include "lwip/pbuf.h"
#include "netif/ethernet.h"
/* declared here, NOT in usb_descriptors.c, so that the driver can intelligently ZLP as needed */
#define CFG_TUD_NET_ENDPOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
/* Maximum Tranmission Unit (in bytes) of the network, including Ethernet header */
#define CFG_TUD_NET_MTU (1500 + SIZEOF_ETH_HDR)
#ifdef __cplusplus
extern "C" {
#endif
//--------------------------------------------------------------------+
// Application API
//--------------------------------------------------------------------+
// client must provide this: initialize any network state back to the beginning
void tud_network_init_cb(void);
// client must provide this: return false if the packet buffer was not accepted
bool tud_network_recv_cb(struct pbuf *p);
// client must provide this: 48-bit MAC address
// TODO removed later since it is not part of tinyusb stack
extern const uint8_t tud_network_mac_address[6];
// indicate to network driver that client has finished with the packet provided to network_recv_cb()
void tud_network_recv_renew(void);
// poll network driver for its ability to accept another packet to transmit
bool tud_network_can_xmit(void);
// if network_can_xmit() returns true, network_xmit() can be called once
void tud_network_xmit(struct pbuf *p);
//--------------------------------------------------------------------+
// INTERNAL USBD-CLASS DRIVER API
//--------------------------------------------------------------------+
void netd_init (void);
void netd_reset (uint8_t rhport);
uint16_t netd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len);
bool netd_control_request (uint8_t rhport, tusb_control_request_t const * request);
bool netd_control_complete (uint8_t rhport, tusb_control_request_t const * request);
bool netd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
void netd_report (uint8_t *buf, uint16_t len);
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_NET_DEVICE_H_ */
|
// nonce.h
/* Copyright 2009 10gen Inc.
*
* 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.
*/
#pragma once
namespace mongo {
typedef unsigned long long nonce;
struct Security {
Security();
nonce getNonce();
/** safe during global var initialization */
nonce getNonceInitSafe() {
init();
return getNonce();
}
private:
ifstream *_devrandom;
static bool _initialized;
void init(); // can call more than once
};
extern Security security;
} // namespace mongo
|
#pragma once
#include <functional>
namespace meshy {
class ByteArray;
class IStream
{
public:
typedef std::function<void(char const* buf, size_t size)> DataIndicationHandler;
/// 返回处理了多少个字节
virtual size_t receive(char* buffer, size_t bufferSize, size_t& readSize) = 0;
virtual size_t send(ByteArray const& byteArray) = 0;
virtual void disconnect() = 0;
virtual void OnDataIndication(DataIndicationHandler handler) = 0;
//virtual DataIndicationHandler GetDataIndication() = 0;
};
}
|
/*
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_query, ID3D10Query_iface);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface, REFIID riid, void **object)
{
struct d3d10_query *query = impl_from_ID3D10Query(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if ((IsEqualGUID(riid, &IID_ID3D10Predicate) && query->predicate)
|| IsEqualGUID(riid, &IID_ID3D10Query)
|| IsEqualGUID(riid, &IID_ID3D10Asynchronous)
|| IsEqualGUID(riid, &IID_ID3D10DeviceChild)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d3d10_query_AddRef(ID3D10Query *iface)
{
struct d3d10_query *This = impl_from_ID3D10Query(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u.\n", This, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d3d10_query_Release(ID3D10Query *iface)
{
struct d3d10_query *This = impl_from_ID3D10Query(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u.\n", This, refcount);
if (!refcount)
{
HeapFree(GetProcessHeap(), 0, This);
}
return refcount;
}
/* ID3D10DeviceChild methods */
static void STDMETHODCALLTYPE d3d10_query_GetDevice(ID3D10Query *iface, ID3D10Device **device)
{
FIXME("iface %p, device %p stub!\n", iface, device);
}
static HRESULT STDMETHODCALLTYPE d3d10_query_GetPrivateData(ID3D10Query *iface,
REFGUID guid, UINT *data_size, void *data)
{
FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
iface, debugstr_guid(guid), data_size, data);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateData(ID3D10Query *iface,
REFGUID guid, UINT data_size, const void *data)
{
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
iface, debugstr_guid(guid), data_size, data);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateDataInterface(ID3D10Query *iface,
REFGUID guid, const IUnknown *data)
{
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
return E_NOTIMPL;
}
/* ID3D10Asynchronous methods */
static void STDMETHODCALLTYPE d3d10_query_Begin(ID3D10Query *iface)
{
FIXME("iface %p stub!\n", iface);
}
static void STDMETHODCALLTYPE d3d10_query_End(ID3D10Query *iface)
{
FIXME("iface %p stub!\n", iface);
}
static HRESULT STDMETHODCALLTYPE d3d10_query_GetData(ID3D10Query *iface, void *data, UINT data_size, UINT flags)
{
FIXME("iface %p, data %p, data_size %u, flags %#x stub!\n", iface, data, data_size, flags);
return E_NOTIMPL;
}
static UINT STDMETHODCALLTYPE d3d10_query_GetDataSize(ID3D10Query *iface)
{
FIXME("iface %p stub!\n", iface);
return 0;
}
/* ID3D10Query methods */
static void STDMETHODCALLTYPE d3d10_query_GetDesc(ID3D10Query *iface, D3D10_QUERY_DESC *desc)
{
FIXME("iface %p, desc %p stub!\n", iface, desc);
}
static const struct ID3D10QueryVtbl d3d10_query_vtbl =
{
/* IUnknown methods */
d3d10_query_QueryInterface,
d3d10_query_AddRef,
d3d10_query_Release,
/* ID3D10DeviceChild methods */
d3d10_query_GetDevice,
d3d10_query_GetPrivateData,
d3d10_query_SetPrivateData,
d3d10_query_SetPrivateDataInterface,
/* ID3D10Asynchronous methods */
d3d10_query_Begin,
d3d10_query_End,
d3d10_query_GetData,
d3d10_query_GetDataSize,
/* ID3D10Query methods */
d3d10_query_GetDesc,
};
HRESULT d3d10_query_init(struct d3d10_query *query, BOOL predicate)
{
query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
query->refcount = 1;
query->predicate = predicate;
return S_OK;
}
|
/* Copyright (c) 2012 BDT Media Automation GmbH
*
* 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.
*
* DriveImpl.h
*
* Created on: Aug 6, 2012
* Author: More Zeng
*/
#pragma once
#include "SlotImpl.h"
namespace tape
{
class DriveImpl : public SlotImpl
{
public:
DriveImpl(int slotID)
: SlotImpl(slotID)
{
}
virtual
~DriveImpl()
{
Error error;
Unmount(error);
}
static fs::path
GetTapeFolder()
{
return fs::path("/opt/LTFStor/ltfsTapes");
}
static fs::path
GetLTFSFolder()
{
return fs::path("/opt/LTFStor/ltfsTapes");
}
bool
Mount(Error & error)
{
string barcode = Barcode();
if ( barcode.empty() ) {
error.SetError(
Error::ERROR_ENTRY_EMPTY,
string("No tape for format in drive ")
+ boost::lexical_cast<string>(SlotID()) );
return false;
}
fs::path pathTape = GetTapeFolder() / barcode;
fs::path pathLTFS = GetLTFSFolder() / barcode;
if ( ! fs::exists(pathTape) ) {
error.SetError(
Error::ERROR_NO_ENTRY,
string("No tape ")
+ barcode
+ " for format in drive "
+ boost::lexical_cast<string>(SlotID()) );
return false;
}
try {
if ( ! fs::is_symlink(pathLTFS) ) {
if ( fs::exists( "/tmp/.bdt.mount_error") ) {
error.SetError(
Error::ERROR_NO_ENTRY,
"Force error for debug" );
return false;
}
fs::create_symlink(pathTape,pathLTFS);
}
} catch(...) {
return false;
}
return true;
}
bool
Unmount(Error & error)
{
string barcode = Barcode();
if ( barcode.empty() ) {
return true;
}
fs::path pathTape = GetTapeFolder() / barcode;
fs::path pathLTFS = GetLTFSFolder() / barcode;
if ( ! fs::exists(pathLTFS) ) {
return true;
}
return fs::remove(pathLTFS);
}
bool
Format(Error & error)
{
string barcode = Barcode();
if ( barcode.empty() ) {
error.SetError(
Error::ERROR_ENTRY_EMPTY,
string("No tape in drive ")
+ boost::lexical_cast<string>(SlotID()) );
return false;
}
fs::path pathTape = GetTapeFolder() / barcode;
fs::path pathLTFS = GetLTFSFolder() / barcode;
if ( fs::exists(pathLTFS) ) {
error.SetError(
Error::ERROR_ENTRY_FULL,
string("Already mounting tape in drive ")
+ boost::lexical_cast<string>(SlotID()) );
return false;
}
if ( fs::exists(pathTape) ) {
if ( ! fs::remove_all(pathTape) ) {
error.SetError(
Error::ERROR_ENTRY_FULL,
string("Fail to erase tape for format in drive ")
+ boost::lexical_cast<string>(SlotID()) );
return false;
}
}
return fs::create_directory(pathTape);
}
};
}
|
//
// LocationServicesSettingsTableViewController.h
// Mage
//
//
#import <UIKit/UIKit.h>
#import "ValuePickerTableViewController.h"
#import <CoreLocation/CoreLocation.h>
#import <MaterialComponents/MDCContainerScheme.h>
@protocol LocationServicesDelegate
- (void) openSettingsTapped;
@end
@interface LocationServicesSettingsTableViewController : UITableViewController<CLLocationManagerDelegate>
- (instancetype) initWithScheme: (id<MDCContainerScheming>) containerScheme;
@end
|
#ifndef XP_H_
#define XP_H_
#include <stdint.h>
/*
* Arithmetic operations on extended integers of fixed precision.
*/
typedef uint8_t *xp_t;
/*
* Compare - returns: <0 if x < y
* 0 if x == y
* >0 if x > y
*/
int xp_cmp(int n, xp_t x, xp_t y);
#endif /* XP_H_ */
|
//
// TokenValidationHelper.h
// Copyright (c) 2013 Paul Meyer. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "OAuth2Client.h"
#import "JWT.h"
@interface TokenValidationHelper : NSObject
+(BOOL)validateIDToken:(JWT *)idToken forClient:(OAuth2Client *)client validationResults:(NSArray **)results;
+(BOOL)validateAccessToken:(JWT *)accessToken forClient:(OAuth2Client *)client validationResults:(NSArray **)results;
@end
|
//===-- lib/Parser/preprocessor.h -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef FORTRAN_PARSER_PREPROCESSOR_H_
#define FORTRAN_PARSER_PREPROCESSOR_H_
// A Fortran-aware preprocessing module used by the prescanner to implement
// preprocessing directives and macro replacement. Intended to be efficient
// enough to always run on all source files even when no preprocessing is
// performed, so that special compiler command options &/or source file name
// extensions for preprocessing will not be necessary.
#include "token-sequence.h"
#include "flang/Parser/char-block.h"
#include "flang/Parser/provenance.h"
#include <cstddef>
#include <list>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
namespace Fortran::parser {
class Prescanner;
// Defines a macro
class Definition {
public:
Definition(const TokenSequence &, std::size_t firstToken, std::size_t tokens);
Definition(const std::vector<std::string> &argNames, const TokenSequence &,
std::size_t firstToken, std::size_t tokens, bool isVariadic = false);
Definition(const std::string &predefined, AllSources &);
bool isFunctionLike() const { return isFunctionLike_; }
std::size_t argumentCount() const { return argumentCount_; }
bool isVariadic() const { return isVariadic_; }
bool isDisabled() const { return isDisabled_; }
bool isPredefined() const { return isPredefined_; }
const TokenSequence &replacement() const { return replacement_; }
bool set_isDisabled(bool disable);
TokenSequence Apply(const std::vector<TokenSequence> &args, AllSources &);
private:
static TokenSequence Tokenize(const std::vector<std::string> &argNames,
const TokenSequence &token, std::size_t firstToken, std::size_t tokens);
bool isFunctionLike_{false};
std::size_t argumentCount_{0};
bool isVariadic_{false};
bool isDisabled_{false};
bool isPredefined_{false};
TokenSequence replacement_;
};
// Preprocessing state
class Preprocessor {
public:
explicit Preprocessor(AllSources &);
void Define(std::string macro, std::string value);
void Undefine(std::string macro);
bool IsNameDefined(const CharBlock &);
std::optional<TokenSequence> MacroReplacement(
const TokenSequence &, const Prescanner &);
// Implements a preprocessor directive.
void Directive(const TokenSequence &, Prescanner *);
private:
enum class IsElseActive { No, Yes };
enum class CanDeadElseAppear { No, Yes };
CharBlock SaveTokenAsName(const CharBlock &);
TokenSequence ReplaceMacros(const TokenSequence &, const Prescanner &);
void SkipDisabledConditionalCode(
const std::string &, IsElseActive, Prescanner *, ProvenanceRange);
bool IsIfPredicateTrue(const TokenSequence &expr, std::size_t first,
std::size_t exprTokens, Prescanner *);
AllSources &allSources_;
std::list<std::string> names_;
std::unordered_map<CharBlock, Definition> definitions_;
std::stack<CanDeadElseAppear> ifStack_;
};
} // namespace Fortran::parser
#endif // FORTRAN_PARSER_PREPROCESSOR_H_
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <assert.h>
#include <exception>
// System.Threading.Timer
struct Timer_t1893171827;
#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_TimeSpan413522987.h"
// System.Void System.Threading.Timer::.cctor()
extern "C" void Timer__cctor_m1320176523 (Il2CppObject * __this /* static, unused */, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean System.Threading.Timer::Change(System.TimeSpan,System.TimeSpan)
extern "C" bool Timer_Change_m4108080222 (Timer_t1893171827 * __this, TimeSpan_t413522987 ___dueTime0, TimeSpan_t413522987 ___period1, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.Threading.Timer::Dispose()
extern "C" void Timer_Dispose_m4229130271 (Timer_t1893171827 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean System.Threading.Timer::Change(System.Int64,System.Int64,System.Boolean)
extern "C" bool Timer_Change_m4132562187 (Timer_t1893171827 * __this, int64_t ___dueTime0, int64_t ___period1, bool ___first2, const MethodInfo* method) IL2CPP_METHOD_ATTR;
|
//
// MGRefreshContentView.h
//
//
// Created by Mark Glagola on 5/4/13.
// Copyright (c) 2013 Mark Glagola. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SSPullToRefresh.h"
#import "HFLabelBold.h"
//taken from another project
@interface HFRefreshContentView : UIView <SSPullToRefreshContentView>
@property(nonatomic, strong, readonly) HFLabelBold *statusLabel;
@property (nonatomic) UIView *bgView;
- (id) initWithExpandedHeight:(CGFloat)expandedHeight;
@end
|
/*
initiator - re-runs a service repeatedly
(because cleaning up the init code for TLS was more work.)
(C)Copyright 2014-2017 Smithee,Spelvin,Agnew & Plinge, Inc.
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.
Support provided by the Security Industry Association
http://www.securityindustry.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define EQUALS ==
int main(int
argc,
char* argv[])
{ /* initiator */
int
done;
FILE* ef;
int
status;
status = 0;
fprintf(stderr, "repeating command: %s\n",
argv[1]);
done = 0;
system("echo yes >server_enable");
while (!done) {
system(argv[1]);
sleep(5);
ef = fopen("server_enable", "r");
if (ef EQUALS NULL) {
fprintf(stderr, "server no longer enabled. exiting.\n");
done = 1;
};
};
if (status != 0)
fprintf(stderr, "exit with status %d\n",
status);
return (status);
} /* initiator */
|
/*
* Note: Currently, the backtraces must still be checked manually. Therefore,
* these test cases should always pass.
* Todo: Automate the checking of backtrace addresses.
*/
#include <stdlib.h>
#include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/xtensa_api.h"
#include "esp_intr_alloc.h"
#define SW_ISR_LEVEL_1 7
#define SW_ISR_LEVEL_3 29
#define RECUR_DEPTH 3
#define ACTION_ABORT -1
#define ACTION_INT_WDT -2
// Set to (-1) for abort(), (-2) for interrupt watchdog
static int backtrace_trigger_source;
/*
* Recursive functions to generate a longer call stack. When the max specified
* recursion depth is reached, the following actions can be taken.
*/
static void __attribute__((__noinline__)) recursive_func(int recur_depth, int action)
{
if (recur_depth > 1) {
recursive_func(recur_depth - 1, action);
} else if (action >= 0) {
xt_set_intset(1 << action);
} else if (action == ACTION_ABORT) {
abort();
// Todo: abort() causes problems in GDB Stub backtrace due to being 'non returning'.
} else if (action == ACTION_INT_WDT) {
portDISABLE_INTERRUPTS();
while (1) {
;
}
}
}
static void level_three_isr (void *arg)
{
xt_set_intclear(1 << SW_ISR_LEVEL_3); //Clear interrupt
recursive_func(RECUR_DEPTH, backtrace_trigger_source); //Abort at the max recursive depth
}
static void level_one_isr(void *arg)
{
xt_set_intclear(1 << SW_ISR_LEVEL_1); //Clear interrupt
recursive_func(RECUR_DEPTH, SW_ISR_LEVEL_3); //Trigger nested interrupt max recursive depth
}
TEST_CASE("Test backtrace from abort", "[reset_reason][reset=abort,SW_CPU_RESET]")
{
//Allocate level one and three SW interrupts
esp_intr_alloc(ETS_INTERNAL_SW0_INTR_SOURCE, 0, level_one_isr, NULL, NULL); //Level 1 SW intr
esp_intr_alloc(ETS_INTERNAL_SW1_INTR_SOURCE, 0, level_three_isr, NULL, NULL); //Level 3 SW intr
backtrace_trigger_source = ACTION_ABORT;
recursive_func(RECUR_DEPTH, SW_ISR_LEVEL_1); //Trigger lvl 1 SW interrupt at max recursive depth
}
TEST_CASE("Test backtrace from interrupt watchdog timeout", "[reset_reason][reset=Interrupt wdt timeout on CPU0,SW_CPU_RESET]")
{
//Allocate level one and three SW interrupts
esp_intr_alloc(ETS_INTERNAL_SW0_INTR_SOURCE, 0, level_one_isr, NULL, NULL); //Level 1 SW intr
esp_intr_alloc(ETS_INTERNAL_SW1_INTR_SOURCE, 0, level_three_isr, NULL, NULL); //Level 3 SW intr
backtrace_trigger_source = ACTION_INT_WDT;
recursive_func(RECUR_DEPTH, SW_ISR_LEVEL_1); //Trigger lvl 1 SW interrupt at max recursive depth
}
|
/*
* Copyright 2010-2011 DIMA Research Group, TU Berlin
*
* 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.
*
* @author: Alexander Alexandrov <alexander.s.alexandrov@campus.tu-berlin.de>
*/
#ifndef USERCONNECTIONGENERATOR_H_
#define USERCONNECTIONGENERATOR_H_
#include "generator/base/BaseUserConnectionsGenerator.h"
using namespace Myriad;
using namespace Poco;
namespace GraphGen {
class UserConnectionsGenerator: public BaseUserConnectionsGenerator
{
public:
UserConnectionsGenerator(const string& name, GeneratorConfig& config, NotificationCenter& notificationCenter) :
BaseUserConnectionsGenerator(name, config, notificationCenter)
{
}
};
class UserConnectionsHydratorChain : public BaseUserConnectionsHydratorChain
{
public:
UserConnectionsHydratorChain(OperationMode& opMode, RandomStream& random, GeneratorConfig& config) :
BaseUserConnectionsHydratorChain(opMode, random, config)
{
}
};
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
// base method definitions (don't modify)
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
inline UserConnectionsHydratorChain BaseUserConnectionsGenerator::hydratorChain(BaseHydratorChain::OperationMode opMode, RandomStream& random)
{
return UserConnectionsHydratorChain(opMode, random, _config);
}
} // namespace GraphGen
#endif /* USERCONNECTIONGENERATOR_H_ */
|
/*
* Copyright 2016-2017 Tom van Dijk, Johannes Kepler University Linz
*
* 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 SYLVAN_SKIPLIST_H
#define SYLVAN_SKIPLIST_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Implementation of a simple limited-depth skiplist.
* The skiplist is used by the serialization mechanism in Sylvan.
* Each stored MTBDD is assigned a number starting with 1.
* Each bucket takes 32 bytes.
*/
typedef struct sylvan_skiplist *sylvan_skiplist_t;
/**
* Allocate a new skiplist of maximum size <size>.
* Only supports at most 0x7fffffff (max int32) buckets
*/
sylvan_skiplist_t sylvan_skiplist_alloc(size_t size);
/**
* Free the given skiplist.
*/
void sylvan_skiplist_free(sylvan_skiplist_t sl);
/**
* Get the number assigned to the given node <dd>.
* Returns 0 if no number was assigned.
*/
uint64_t sylvan_skiplist_get(sylvan_skiplist_t sl, MTBDD dd);
/**
* Assign the next number (starting at 1) to the given node <dd>.
*/
VOID_TASK_DECL_2(sylvan_skiplist_assign_next, sylvan_skiplist_t, MTBDD);
#define sylvan_skiplist_assign_next(sl, dd) RUN(sylvan_skiplist_assign_next, sl, dd)
/**
* Give the number of assigned nodes. (numbers 1,2,...,N)
*/
size_t sylvan_skiplist_count(sylvan_skiplist_t sl);
/**
* Get the MTBDD assigned to the number <index>, with the index 1,...,count.
*/
MTBDD sylvan_skiplist_getr(sylvan_skiplist_t sl, uint64_t index);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|
/* $NetBSD: i82365_isa.c,v 1.34 2012/10/27 17:18:24 chs Exp $ */
/*
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Marc Horowitz.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: i82365_isa.c,v 1.34 2012/10/27 17:18:24 chs Exp $");
#define PCICISADEBUG
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <sys/intr.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciachip.h>
#include <dev/ic/i82365reg.h>
#include <dev/ic/i82365var.h>
#include <dev/isa/i82365_isavar.h>
#ifdef PCICISADEBUG
int pcicisa_debug = 0;
#define DPRINTF(arg) if (pcicisa_debug) printf arg;
#else
#define DPRINTF(arg)
#endif
int pcic_isa_probe(device_t, cfdata_t, void *);
void pcic_isa_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(pcic_isa, sizeof(struct pcic_isa_softc),
pcic_isa_probe, pcic_isa_attach, NULL, NULL);
static const struct pcmcia_chip_functions pcic_isa_functions = {
pcic_chip_mem_alloc,
pcic_chip_mem_free,
pcic_chip_mem_map,
pcic_chip_mem_unmap,
pcic_chip_io_alloc,
pcic_chip_io_free,
pcic_chip_io_map,
pcic_chip_io_unmap,
pcic_isa_chip_intr_establish,
pcic_isa_chip_intr_disestablish,
pcic_chip_socket_enable,
pcic_chip_socket_disable,
pcic_chip_socket_settype,
NULL,
};
int
pcic_isa_probe(device_t parent, cfdata_t match, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_tag_t iot = ia->ia_iot;
bus_space_handle_t ioh, memh;
int val, found, msize;
if (ia->ia_nio < 1)
return 0;
if (ia->ia_niomem < 1)
return 0;
if (ISA_DIRECT_CONFIG(ia))
return 0;
/* Disallow wildcarded i/o address. */
if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
return 0;
if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM)
return 0;
if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh))
return 0;
if (ia->ia_iomem[0].ir_size == ISA_UNKNOWN_IOSIZ)
msize = PCIC_MEMSIZE;
else
msize = ia->ia_iomem[0].ir_size;
if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr,
msize, 0, &memh)) {
bus_space_unmap(iot, ioh, PCIC_IOSIZE);
return 0;
}
found = 0;
/*
* this could be done with a loop, but it would violate the
* abstraction
*/
bus_space_write_1(iot, ioh, PCIC_REG_INDEX, C0SA + PCIC_IDENT);
val = bus_space_read_1(iot, ioh, PCIC_REG_DATA);
if (pcic_ident_ok(val))
found++;
bus_space_write_1(iot, ioh, PCIC_REG_INDEX, C0SB + PCIC_IDENT);
val = bus_space_read_1(iot, ioh, PCIC_REG_DATA);
if (pcic_ident_ok(val))
found++;
bus_space_write_1(iot, ioh, PCIC_REG_INDEX, C1SA + PCIC_IDENT);
val = bus_space_read_1(iot, ioh, PCIC_REG_DATA);
if (pcic_ident_ok(val))
found++;
bus_space_write_1(iot, ioh, PCIC_REG_INDEX, C1SB + PCIC_IDENT);
val = bus_space_read_1(iot, ioh, PCIC_REG_DATA);
if (pcic_ident_ok(val))
found++;
bus_space_unmap(iot, ioh, PCIC_IOSIZE);
bus_space_unmap(ia->ia_memt, memh, msize);
if (!found)
return 0;
ia->ia_nio = 1;
ia->ia_io[0].ir_size = PCIC_IOSIZE;
ia->ia_niomem = 1;
ia->ia_iomem[0].ir_size = msize;
/* IRQ is special. */
ia->ia_ndrq = 0;
return 1;
}
void
pcic_isa_attach(device_t parent, device_t self, void *aux)
{
struct pcic_isa_softc *isc = device_private(self);
struct pcic_softc *sc = &isc->sc_pcic;
struct isa_attach_args *ia = aux;
isa_chipset_tag_t ic = ia->ia_ic;
bus_space_tag_t iot = ia->ia_iot;
bus_space_tag_t memt = ia->ia_memt;
bus_space_handle_t ioh;
bus_space_handle_t memh;
sc->dev = self;
/* Map i/o space. */
if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) {
printf(": can't map i/o space\n");
return;
}
/* Map mem space. */
if (bus_space_map(memt, ia->ia_iomem[0].ir_addr,
ia->ia_iomem[0].ir_size, 0, &memh)) {
printf(": can't map mem space\n");
return;
}
sc->membase = ia->ia_iomem[0].ir_addr;
sc->subregionmask =
(1 << (ia->ia_iomem[0].ir_size / PCIC_MEM_PAGESIZE)) - 1;
isc->sc_ic = ic;
sc->pct = &pcic_isa_functions;
sc->iot = iot;
sc->ioh = ioh;
sc->memt = memt;
sc->memh = memh;
if (ia->ia_nirq > 0)
sc->irq = ia->ia_irq[0].ir_irq;
else
sc->irq = ISA_UNKNOWN_IRQ;
printf("\n");
pcic_attach(sc);
pcic_isa_bus_width_probe(sc, iot, ioh, ia->ia_io[0].ir_addr,
PCIC_IOSIZE);
pcic_attach_sockets(sc);
config_interrupts(self, pcic_isa_config_interrupts);
}
|
/* Copyright 2013 - 2014 Yurii Litvinov, Smirnov Mikhail, Kogutich Denis
*
* 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. */
#pragma once
#include <QtCore/qglobal.h>
#include <QtCore/QMultiHash>
#include <QtCore/QList>
#include <QtCore/QScopedPointer>
#include <QtGui/QPixmap>
#include <QtGui/QFontMetrics>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QtGui/QWidget>
#include <QtGui/QLabel>
#else
#include <QtWidgets/QWidget>
#include <QtWidgets/QLabel>
#endif
#include "graphicsWidget.h"
#include "shapes/shape.h"
namespace trikControl {
/// Works in GUI thread and is responsible for all output to display.
class GuiWorker : public QObject
{
Q_OBJECT
public:
GuiWorker();
/// Returns a widget on which everything is drawn.
DisplayWidgetInterface &graphicsWidget();
public slots:
/// Shows image with given filename on display. Image is scaled to fill the screen and is cached on first read
/// for better performance.
void showImage(const QString &fileName);
/// Add a label to the specific position of the screen without redrawing it.
/// If there already is a label in these coordinates, its contents will be updated.
/// @param text - label text.
/// @param x - label x coordinate.
/// @param y - label y coordinate.
void addLabel(const QString &text, int x, int y);
/// Remove all labels from the screen and redraws it.
void removeLabels();
/// Queues worker object for deletion. It is actually deleted when control flow returns to event loop.
void deleteWorker();
/// Hides image widget.
void hide();
/// Sets background for a picture.
/// @param color - color of a background.
void setBackground(const QString &color);
/// Set painter width.
void setPainterWidth(int penWidth);
/// Set painter color.
void setPainterColor(const QString &color);
/// Clear everything painted with this object.
void clear();
/// Returns a display in a blank state.
void reset();
/// Draw point on the widget without redrawing it.
/// @param x - x coordinate.
/// @param y - y coordinate.
void drawPoint(int x, int y);
/// Draw line on the widget without redrawing it.
/// @param x1 - first point's x coordinate.
/// @param y1 - first point's y coordinate.
/// @param x2 - second point's x coordinate.
/// @param y2 - second point's y coordinate.
void drawLine(int x1, int y1, int x2, int y2);
/// Draw rect on the widget without redrawing it.
/// @param x - x coordinate.
/// @param y - y coordinate.
/// @param width - rect's width.
/// @param height - rect's height.
void drawRect(int x, int y, int width, int height);
/// Draw ellipse without redrawing the screen.
/// @param x - x coordinate.
/// @param y - y coordinate.
/// @param width - width of ellipse.
/// @param height - height of ellipse.
void drawEllipse(int x, int y, int width, int height);
/// Draw arc on the widget without redrawing it.
/// @param x - x coordinate.
/// @param y - y coordinate.
/// @param width - width rect forming an arc.
/// @param height - height rect forming an arc.
/// @param startAngle - start angle.
/// @param spanAngle - end andle.
void drawArc(int x, int y, int width, int height, int startAngle, int spanAngle);
/// Initializes widget. Shall be called when widget is moved to correct thread. Not supposed to be called from .qts.
void init();
/// Updates painted picture on the robot`s screen.
/// @warning This operation is pretty slow, so it shouldn`t be called without need.
void redraw();
private:
void resetBackground();
void repaintGraphicsWidget();
static QColor colorByName(const QString &name);
QScopedPointer<GraphicsWidget> mImageWidget;
QHash<QString, QPixmap> mImagesCache;
};
}
|
/*
============================================================================
Name : CallBackDialog.h
Author : Usanov-Kornilov Nikolay (aka Kolay)
Version : 1.0
Copyright :
Contacts:
kolayuk@mail.ru
http://kolaysoft.ru
(c) KolaySoft, 2010
Description : CCallBackDialog declaration
============================================================================
*/
#ifndef CALLBACKDIALOG_H
#define CALLBACKDIALOG_H
// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <akndialog.h>
#include <eiklabel.h>
#include <eikedwin.h>
// CLASS DECLARATION
class CCallBackDialog : public CAknDialog
{
public:
~CCallBackDialog();
static CCallBackDialog* NewL(TInt aResource,HBufC* aText);
static CCallBackDialog* NewLC(TInt aResource,HBufC* aText);
void PostLayoutDynInitL();
TBool OkToExitL(TInt aCommand);
private:
CCallBackDialog();
void ConstructL(TInt aResource,HBufC* aText);
CEikLabel* iLabel;
CEikEdwin* iEdwin;
HBufC* iText;
};
#endif // CALLBACKDIALOG_H
|
/*
Copyright (c) 2005-2019 Intel Corporation
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 _itt_shared_malloc_MapMemory_H
#define _itt_shared_malloc_MapMemory_H
#include <stdlib.h>
void *ErrnoPreservingMalloc(size_t bytes)
{
int prevErrno = errno;
void *ret = malloc( bytes );
if (!ret)
errno = prevErrno;
return ret;
}
#if __linux__ || __APPLE__ || __sun || __FreeBSD__
#if __sun && !defined(_XPG4_2)
// To have void* as mmap's 1st argument
#define _XPG4_2 1
#define XPG4_WAS_DEFINED 1
#endif
#include <sys/mman.h>
#if __linux__
/* __TBB_MAP_HUGETLB is MAP_HUGETLB from system header linux/mman.h.
The header is not included here, as on some Linux flavors inclusion of
linux/mman.h leads to compilation error,
while changing of MAP_HUGETLB is highly unexpected.
*/
#define __TBB_MAP_HUGETLB 0x40000
#else
#define __TBB_MAP_HUGETLB 0
#endif
#if XPG4_WAS_DEFINED
#undef _XPG4_2
#undef XPG4_WAS_DEFINED
#endif
inline void* mmap_impl(size_t map_size, void* map_hint = NULL, int map_flags = 0) {
#ifndef MAP_ANONYMOUS
// macOS* defines MAP_ANON, which is deprecated in Linux*.
#define MAP_ANONYMOUS MAP_ANON
#endif /* MAP_ANONYMOUS */
return mmap(map_hint, map_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | map_flags, -1, 0);
}
inline void* mmapTHP(size_t bytes) {
// Initializes in zero-initialized data section
static void* hint;
// Optimistically try to use a last huge page aligned region end
// as a hint for mmap.
hint = hint ? (void*)((uintptr_t)hint - bytes) : hint;
void* result = mmap_impl(bytes, hint);
// Something went wrong
if (result == MAP_FAILED) {
hint = NULL;
return MAP_FAILED;
}
// Otherwise, fall back to the slow path - map oversized region
// and trim excess parts.
if (!isAligned(result, HUGE_PAGE_SIZE)) {
// Undo previous try
munmap(result, bytes);
// Map oversized on huge page size region
result = mmap_impl(bytes + HUGE_PAGE_SIZE);
// Something went wrong
if (result == MAP_FAILED) {
hint = NULL;
return MAP_FAILED;
}
// Misalignment offset
uintptr_t offset = 0;
if (!isAligned(result, HUGE_PAGE_SIZE)) {
// Trim excess head of a region if it is no aligned
offset = HUGE_PAGE_SIZE - ((uintptr_t)result & (HUGE_PAGE_SIZE - 1));
munmap(result, offset);
// New region begining
result = (void*)((uintptr_t)result + offset);
}
// Trim excess tail of a region
munmap((void*)((uintptr_t)result + bytes), HUGE_PAGE_SIZE - offset);
}
// Assume, that mmap virtual addresses grow down by default
// So, set a hint as a result of a last successfull allocation
// and then use it minus requested size as a new mapping point.
// TODO: Atomic store is meant here, fence not needed, but
// currently we don't have such function.
hint = result;
MALLOC_ASSERT(isAligned(result, HUGE_PAGE_SIZE), "Mapped address is not aligned on huge page size.");
return result;
}
#define MEMORY_MAPPING_USES_MALLOC 0
void* MapMemory (size_t bytes, PageType pageType)
{
void* result = 0;
int prevErrno = errno;
switch (pageType) {
case REGULAR:
{
result = mmap_impl(bytes);
break;
}
case PREALLOCATED_HUGE_PAGE:
{
MALLOC_ASSERT((bytes % HUGE_PAGE_SIZE) == 0, "Mapping size should be divisible by huge page size");
result = mmap_impl(bytes, NULL, __TBB_MAP_HUGETLB);
break;
}
case TRANSPARENT_HUGE_PAGE:
{
MALLOC_ASSERT((bytes % HUGE_PAGE_SIZE) == 0, "Mapping size should be divisible by huge page size");
result = mmapTHP(bytes);
break;
}
default:
{
MALLOC_ASSERT(false, "Unknown page type");
}
}
if (result == MAP_FAILED) {
errno = prevErrno;
return 0;
}
return result;
}
int UnmapMemory(void *area, size_t bytes)
{
int prevErrno = errno;
int ret = munmap(area, bytes);
if (-1 == ret)
errno = prevErrno;
return ret;
}
#elif (_WIN32 || _WIN64) && !__TBB_WIN8UI_SUPPORT
#include <windows.h>
#define MEMORY_MAPPING_USES_MALLOC 0
void* MapMemory (size_t bytes, PageType)
{
/* Is VirtualAlloc thread safe? */
return VirtualAlloc(NULL, bytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
}
int UnmapMemory(void *area, size_t /*bytes*/)
{
BOOL result = VirtualFree(area, 0, MEM_RELEASE);
return !result;
}
#else
#define MEMORY_MAPPING_USES_MALLOC 1
void* MapMemory (size_t bytes, PageType)
{
return ErrnoPreservingMalloc( bytes );
}
int UnmapMemory(void *area, size_t /*bytes*/)
{
free( area );
return 0;
}
#endif /* OS dependent */
#if MALLOC_CHECK_RECURSION && MEMORY_MAPPING_USES_MALLOC
#error Impossible to protect against malloc recursion when memory mapping uses malloc.
#endif
#endif /* _itt_shared_malloc_MapMemory_H */
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/finspace-data/FinSpaceData_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace FinSpaceData
{
namespace Model
{
enum class DatasetKind
{
NOT_SET,
TABULAR,
NON_TABULAR
};
namespace DatasetKindMapper
{
AWS_FINSPACEDATA_API DatasetKind GetDatasetKindForName(const Aws::String& name);
AWS_FINSPACEDATA_API Aws::String GetNameForDatasetKind(DatasetKind value);
} // namespace DatasetKindMapper
} // namespace Model
} // namespace FinSpaceData
} // namespace Aws
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <libcouchstore/couch_db.h>
#include <snappy-c.h>
#include <getopt.h>
#include "internal.h"
#include "util.h"
#include "bitfield.h"
static char *size_str(double size)
{
static char rfs[256];
int i = 0;
const char *units[] = {"bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (size > 1024) {
size /= 1024;
i++;
}
snprintf(rfs, sizeof(rfs), "%.*f %s", i, size, units[i]);
return rfs;
}
static void print_db_info(Db* db)
{
DbInfo info;
couchstore_db_info(db, &info);
if (info.doc_count == 0) {
printf(" no documents\n");
return;
}
printf(" doc count: %"PRIu64"\n", info.doc_count);
printf(" deleted doc count: %"PRIu64"\n", info.deleted_count);
printf(" data size: %s\n", size_str(info.space_used));
}
static int process_file(const char *file, int iterate_headers)
{
Db *db;
couchstore_error_t errcode;
uint64_t btreesize = 0;
errcode = couchstore_open_db(file, COUCHSTORE_OPEN_FLAG_RDONLY, &db);
if (errcode != COUCHSTORE_SUCCESS) {
fprintf(stderr, "Failed to open \"%s\": %s\n",
file, couchstore_strerror(errcode));
return -1;
}
next_header:
printf("DB Info (%s) - header at %"PRIu64"\n", file, db->header.position);
printf(" file format version: %"PRIu64"\n", db->header.disk_version);
printf(" update_seq: %"PRIu64"\n", db->header.update_seq);
print_db_info(db);
if (db->header.by_id_root) {
btreesize += db->header.by_id_root->subtreesize;
}
if (db->header.by_seq_root) {
btreesize += db->header.by_seq_root->subtreesize;
}
printf(" B-tree size: %s\n", size_str(btreesize));
printf(" total disk size: %s\n", size_str(db->file.pos));
if (iterate_headers) {
if (couchstore_rewind_db_header(db) == COUCHSTORE_SUCCESS) {
printf("\n");
goto next_header;
}
} else {
couchstore_close_db(db);
}
return 0;
}
static void usage(const char *name)
{
fprintf(stderr, "USAGE: %s [-i] <file.couch>\n", name);
fprintf(stderr, "\t-i Iterate through all headers\n");
exit(EXIT_FAILURE);
}
int main(int argc, char **argv)
{
int error = 0;
int ii;
int iterate_headers = getenv("ITERATE_HEADERS") != NULL;
int cmd;
while ((cmd = getopt(argc, argv, "i")) != -1) {
switch (cmd) {
case 'i':
iterate_headers = 1;
break;
default:
usage(argv[0]);
/* NOTREACHED */
}
}
if (optind == argc) {
usage(argv[0]);
}
for (ii = optind; ii < argc; ++ii) {
error += process_file(argv[ii], iterate_headers);
}
if (error) {
exit(EXIT_FAILURE);
} else {
exit(EXIT_SUCCESS);
}
}
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 __itkContourMeanDistanceImageFilter_h
#define __itkContourMeanDistanceImageFilter_h
#include "itkImageToImageFilter.h"
#include "itkNumericTraits.h"
namespace itk
{
/** \class ContourMeanDistanceImageFilter
* \brief Computes the Mean distance between the boundaries of
* non-zero regions of two images.
*
*
* ContourMeanDistanceImageFilter computes the distance between the
* set non-zero pixels of two images using the following formula:
* \f[ H(A,B) = \max(h(A,B),h(B,A)) \f]
* where
* \f[ h(A,B) = \max_{a \in A} \min_{b \in B} \| a - b\| \f] is the directed
* Mean distance
* and \f$A\f$ and \f$B\f$ are respectively the set of non-zero pixels
* in the first and second input images.
*
* In particular, this filter uses the ContourDirectedMeanImageFilter
* inside to compute the two directed distances and then select the
* largest of the two.
*
* The Mean distance measures the degree of mismatch between two sets
* and behaves like a metric over the set of all closed bounded sets -
* with properties of identity, symmetry and triangle inequality.
*
* This filter requires the largest possible region of the first image
* and the same corresponding region in the second image.
* It behaves as filter with
* two input and one output. Thus it can be inserted in a pipeline with
* other filters. The filter passes the first input through unmodified.
*
* This filter is templated over the two input image type. It assume
* both image have the same number of dimensions.
*
* \sa ContourDirectedMeanDistanceImageFilter
*
* \ingroup MultiThreaded
*
* \author Teo Popa, ISIS Center, Georgetown University
*
* \ingroup ITK-DistanceMap
* \wikiexample{Curves/ContourMeanDistanceImageFilter,Compute the mean distance between all points of two curves}
*/
template< class TInputImage1, class TInputImage2 >
class ITK_EXPORT ContourMeanDistanceImageFilter:
public ImageToImageFilter< TInputImage1, TInputImage1 >
{
public:
/** Standard Self typedef */
typedef ContourMeanDistanceImageFilter Self;
typedef ImageToImageFilter< TInputImage1, TInputImage1 > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(ContourMeanDistanceImageFilter, ImageToImageFilter);
/** Image related typedefs. */
typedef TInputImage1 InputImage1Type;
typedef TInputImage2 InputImage2Type;
typedef typename TInputImage1::Pointer InputImage1Pointer;
typedef typename TInputImage2::Pointer InputImage2Pointer;
typedef typename TInputImage1::ConstPointer InputImage1ConstPointer;
typedef typename TInputImage2::ConstPointer InputImage2ConstPointer;
typedef typename TInputImage1::RegionType RegionType;
typedef typename TInputImage1::SizeType SizeType;
typedef typename TInputImage1::IndexType IndexType;
typedef typename TInputImage1::PixelType InputImage1PixelType;
typedef typename TInputImage2::PixelType InputImage2PixelType;
/** Image related typedefs. */
itkStaticConstMacro(ImageDimension, unsigned int,
TInputImage1::ImageDimension);
/** Type to use form computations. */
typedef typename NumericTraits< InputImage1PixelType >::RealType RealType;
/** Set the first input. */
void SetInput1(const InputImage1Type *image)
{
this->SetInput(image);
}
/** Set the second input. */
void SetInput2(const InputImage2Type *image);
/** Get the first input. */
const InputImage1Type * GetInput1(void)
{
return this->GetInput(); \
}
/** Get the second input. */
const InputImage2Type * GetInput2(void);
/** Return the computed Mean distance. */
itkGetConstMacro(MeanDistance, RealType);
#ifdef ITK_USE_CONCEPT_CHECKING
/** Begin concept checking */
itkConceptMacro( InputHasNumericTraitsCheck,
( Concept::HasNumericTraits< InputImage1PixelType > ) );
/** End concept checking */
#endif
protected:
ContourMeanDistanceImageFilter();
~ContourMeanDistanceImageFilter(){}
void PrintSelf(std::ostream & os, Indent indent) const;
/** GenerateData. */
void GenerateData();
// Override since the filter needs all the data for the algorithm
void GenerateInputRequestedRegion();
// Override since the filter produces all of its output
void EnlargeOutputRequestedRegion(DataObject *data);
private:
ContourMeanDistanceImageFilter(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
RealType m_MeanDistance;
}; // end of class
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkContourMeanDistanceImageFilter.txx"
#endif
#endif
|
//
// TCPServerTestSuite.h
//
// Definition of the TCPServerTestSuite class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef TCPServerTestSuite_INCLUDED
#define TCPServerTestSuite_INCLUDED
#include "CppUnit/TestSuite.h"
class TCPServerTestSuite
{
public:
static CppUnit::Test* suite();
};
#endif // TCPServerTestSuite_INCLUDED
|
//
// PhotoTableViewController.h
// DemoStoryboard
//
// Created by Tekhne on 10/19/13.
// Copyright (c) 2013 Tekhne. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Photo.h"
#import "DisplayViewController.h"
@interface PhotoTableViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate>
@end
|
// Copyright (C) 2008-2011 JWmicro. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the JWmicro nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/// @defgroup geWizES_inf_pactuator egwPActuator
/// @ingroup geWizES_inf
/// Actuator Protocol.
/// @{
/// @file egwPActuator.h
/// Actuator Protocol.
#import "egwTypes.h"
#import "../inf/egwPCoreObject.h"
#import "../math/egwMathTypes.h"
/// Actuator Jump Table.
/// Contains function pointers to class methods for faster invocation in low tier sections.
typedef struct {
id (*fpRetain)(id, SEL); ///< FP to retain.
void (*fpRelease)(id, SEL); ///< FP to release.
void (*fpUpdate)(id, SEL, EGWtime, EGWuint);///< FP to update:withFlags:.
id<NSObject> (*fpABase)(id, SEL); ///< FP to assetBase (may be NULL).
EGWuint32 (*fpAFlags)(id, SEL); ///< FP to actuatorFlags.
BOOL (*fpActuating)(id, SEL); ///< FP to isActuating.
BOOL (*fpFinished)(id, SEL); ///< FP to isFinished.
} egwActuatorJumpTable;
/// Actuator Protocol.
/// Defines interactions for physical actuators.
@protocol egwPActuator <NSObject>
/// Start Actuating Method.
/// Starts actuating object by adding itself into the currently active physical actuator.
- (void)startActuating;
/// Stop Actuating Method.
/// Stops actuating object by removing itself from the currently active physical actuator.
- (void)stopActuating;
/// Actuate With Flags Method.
/// Updates actuator over the provided @a deltaT time slice with provided actuator @a flags.
/// @note Do not call this method directly - this method is called automatically by the system.
/// @param [in] deltaT Delta time slice (seconds).
/// @param [in] flags Bit-wise flag settings.
- (void)update:(EGWtime)deltaT withFlags:(EGWuint)flags;
/// Actuator Flags Accessor.
/// Returns the actuator flags for subsequent update calls.
/// @return Bit-wise flag settings.
- (EGWuint16)actuatorFlags;
/// Actuator Jump Table Accessor.
/// Returns the actuator object's jump table for subsequent low tier calls.
/// @return Actuator jump table.
- (const egwActuatorJumpTable*)actuatorJumpTable;
/// Actuator Flags Mutator.
/// Sets the actuator interaction @a flags for subsequent update calls.
/// @param [in] flags Bit-wise flag settings.
- (void)setActuatorFlags:(EGWuint16)flags;
/// IsActuating Poller.
/// Polls the object to determine status.
/// @return YES if actuator is actuating, otherwise NO.
- (BOOL)isActuating;
/// IsFinished Poller.
/// Polls the object to determine status.
/// @return YES if actuator is finished from actuating, otherwise NO.
- (BOOL)isFinished;
/// IsPaused Poller.
/// Polls the object to determine status.
/// @return YES if actuator is paused from actuating, otherwise NO.
- (BOOL)isPaused;
@end
/// @}
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
class AWS_EC2_API ModifyPrivateDnsNameOptionsResponse
{
public:
ModifyPrivateDnsNameOptionsResponse();
ModifyPrivateDnsNameOptionsResponse(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
ModifyPrivateDnsNameOptionsResponse& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>Returns <code>true</code> if the request succeeds; otherwise, it returns an
* error.</p>
*/
inline bool GetReturn() const{ return m_return; }
/**
* <p>Returns <code>true</code> if the request succeeds; otherwise, it returns an
* error.</p>
*/
inline void SetReturn(bool value) { m_return = value; }
/**
* <p>Returns <code>true</code> if the request succeeds; otherwise, it returns an
* error.</p>
*/
inline ModifyPrivateDnsNameOptionsResponse& WithReturn(bool value) { SetReturn(value); return *this;}
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline ModifyPrivateDnsNameOptionsResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline ModifyPrivateDnsNameOptionsResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
bool m_return;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace EC2
} // namespace Aws
|
//================================================================================
//
// (c) Copyright China Digital Video (Beijing) Limited, 2016. All rights reserved.
//
// This code and information is provided "as is" without warranty of any kind,
// either expressed or implied, including but not limited to the implied
// warranties of merchantability and/or fitness for a particular purpose.
//
//--------------------------------------------------------------------------------
// Birth Date: Dec 29. 2016
// Author: NewAuto video team
//================================================================================
#pragma once
#import "NvsClip.h"
@class NvsAudioFx;
/*!
* \brief 音频片段,对音频文件的描述
*
* 音频片段既可以修改其裁剪入点和出点,播放速度等,还可以添加、插入、移除以及获取多个音频特效(Audio Fx)。
* \warning NvsAudioClip类中,所有public API都在UI线程使用!!!
*/
NVS_EXPORT @interface NvsAudioClip: NvsClip
@property (nonatomic) int64_t fadeInDuration; //!< 淡入时长(单位微秒)\since 1.16.0
@property (nonatomic) int64_t fadeOutDuration; //!< 淡出时长(单位微秒)\since 1.16.0
/*!
* \brief 在片段尾部追加特效
* \param fxName 特效名称。获取特效名称,请参照[getAllBuiltinAudioFxNames()](@ref NvsStreamingContext::getAllBuiltinAudioFxNames)或[内建特效名称列表] (\ref FxNameList.md)
* \return 返回追加的音频特效对象
* \warning 此接口会引发流媒体引擎状态跳转到引擎停止状态,具体情况请参见[引擎变化专题] (\ref EngineChange.md)。
* \sa insertFx:fxIndex:
* \sa removeFx:
* \sa getFxWithIndex:
*/
- (NvsAudioFx *)appendFx:(NSString *)fxName;
/*!
* \brief 在片段上指定特效索引处插入特效
* \param fxName 特效名称。获取特效名称,请参照[getAllBuiltinAudioFxNames()](@ref NvsStreamingContext::getAllBuiltinAudioFxNames)或[内建特效名称列表] (\ref FxNameList.md)
* \param fxIndex 插入特效索引
* \return 返回插入的音频特效对象
* \warning 此接口会引发流媒体引擎状态跳转到引擎停止状态,具体情况请参见[引擎变化专题] (\ref EngineChange.md)。
* \sa appendFx:
* \sa removeFx:
* \sa getFxWithIndex:
*/
- (NvsAudioFx *)insertFx:(NSString *)fxName fxIndex:(unsigned int)fxIndex;
/*!
* \brief 移除指定索引的特效
* \param fxIndex 特效索引
* \return 返回BOOL值。值为YES则移除成功,NO则移除失败。
* \warning 此接口会引发流媒体引擎状态跳转到引擎停止状态,具体情况请参见[引擎变化专题] (\ref EngineChange.md)。
* \sa appendFx:
* \sa insertFx:fxIndex:
* \sa getFxWithIndex:
*/
- (BOOL)removeFx:(unsigned int)fxIndex;
/*!
* \brief 通过索引获取特效
* \param fxIndex 特效索引
* \return 返回获取的音频特效对象
* \sa appendFx:
* \sa insertFx:fxIndex:
* \sa removeFx:
*/
- (NvsAudioFx *)getFxWithIndex:(unsigned int)fxIndex;
@end
|
//
// XZAccountTool.h
// Cube
//
// Created by ZengChanghuan on 16/4/5.
// Copyright © 2016年 ZengChanghuan. All rights reserved.
// 处理所有账号相关的操作:存储账号 取出账号 验证账号
#import <Foundation/Foundation.h>
#import "XZAccount.h"
@interface XZAccountTool : NSObject
/**
* 存储账号信息
*
* @param account 账号模型
*/
+ (void)saveAccount:(XZAccount *)account;
/**
* 返回账号信息
*
* @return 账号模型 (如果账号过期,返回Nil)
*/
+ (XZAccount *)account;
@end
|
#pragma once
#if _MSC_VER
#define MSG_NOSIGNAL 1
#endif
/**
* No MSG_NOSIGNAL on OS X.
* Avoid SIGPIPE by using sockopt call.
*/
#ifdef MSG_NOSIGNAL
# define AMQP_CPP_MSG_NOSIGNAL MSG_NOSIGNAL
#else
# define AMQP_CPP_MSG_NOSIGNAL 0
# ifdef SO_NOSIGPIPE
# define AMQP_CPP_USE_SO_NOSIGPIPE
# else
# error "Cannot block SIGPIPE!"
# endif
#endif
#ifdef AMQP_CPP_USE_SO_NOSIGPIPE
/**
* Ignore SIGPIPE when there is no MSG_NOSIGNAL.
*/
inline void set_sockopt_nosigpipe(int socket)
{
int optval = 1;
setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval));
}
#endif
|
// REQUIRES: solver
// RUN: %clang -Xclang -load -Xclang %pass -O2 -mllvm %solver -emit-llvm -S -o - %s -mllvm -print-after-all 2>&1 | FileCheck %s
// Check that peephole passes are registered at least twice.
// CHECK: IR Dump After Souper super-optimizer pass
// CHECK: IR Dump After Souper super-optimizer pass
void foo() {}
|
#ifndef CATALANTREE_NODE_H
#define CATALANTREE_NODE_H
#include <gmpxx.h>
/**
* @class Binary tree node
*/
class Node {
public:
typedef size_t size_type;
Node();
Node(const Node* other);
Node(const Node& other);
virtual ~Node();
Node& operator=(const Node& rhs);
bool operator==(const Node& rhs) const;
bool operator!=(const Node& rhs) const;
//! left subtree
Node* llink() const;
//! right subtree
Node* rlink() const;
//! parent node
Node* plink() const;
//! find root node
const Node* root() const;
//! set right subtree (this node will become parent of "n")
void setRlink(Node* n);
//! set left subtree (this node will become parent of "n")
void setLlink(Node* n);
//! set n as parent node
void setPlink(Node* n);
/**
* @brief Tree nodes count (including root node)
*/
size_type size() const;
/**
* @brief Maximum tree depth
*/
size_type depth() const;
/**
* @brief Width of left subtree
*/
size_type lwidth() const;
/**
* @brief Width of right subtree
*/
size_type rwidth() const;
/**
* @brief Width of tree
*/
size_type width() const;
/**
* @brief Decode index "I" into binary tree with "N" nodes and return pointer to root node
*/
static Node* decode(mpz_class I, size_type N);
/**
* @brief Encode tree "root" and return its index
*/
static mpz_class encode(Node* root);
/**
* @brief Search next node in DFS order
*/
Node* dfs_next() const;
protected:
//! Left subtree
Node* llink_;
//! Right subtree
Node* rlink_;
//! Parent node
Node* plink_;
};
#endif //CATALANTREE_NODE_H
|
/**
* @file : grid2d.h
* @brief : 2-dim. grid with spins "sitting" or "living" on top of it, header file, in C++11/14,
* @details : struct with smart ptrs, unique ptrs
*
* @author : Ernest Yeung <ernestyalumni@gmail.com>
* @date : 20171229
* @ref : M. Hjorth-Jensen, Computational Physics, University of Oslo (2015)
*
* https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ernestsaveschristmas%2bpaypal%40gmail%2ecom&lc=US&item_name=ernestyalumni¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
*
* which won't go through a 3rd. party such as indiegogo, kickstarter, patreon.
* Otherwise, I receive emails and messages on how all my (free) material on
* physics, math, and engineering have helped students with their studies,
* and I know what it's like to not have money as a student, but love physics
* (or math, sciences, etc.), so I am committed to keeping all my material
* open-source and free, whether or not
* sufficiently crowdfunded, under the open-source MIT license:
* feel free to copy, edit, paste, make your own versions, share, use as you wish.
* Just don't be an asshole and not give credit where credit is due.
* Peace out, never give up! -EY
*
* */
/*
* COMPILATION TIP
* g++ main.cpp ./structs/structs.cpp -o main
*
* */
#ifndef __GRID2D_H__
#define __GRID2D_H__
#include <memory> // std::unique_ptr std::make_unique
#include <array> // std::array
struct Spins2d {
// (data) members
// spin data
std::unique_ptr<int[]> S; // spins
// dimensions describing the data
std::array<size_t,2> L_is; // L_i = (L_x,L_y); use size_t instead of int because size_t is "bigger"
size_t L; // L = L_x*L_y
// constructors
Spins2d() = default; // default constructor
Spins2d(std::array<size_t,2> & L_is) ;
// getting functions
/** @fn entry
* @details ROW-major ordering based, i.e. it's the elements in a single row that are contiguous in memory,
* NOT the column entries
* */
int entry(int i, int j);
};
#endif // END of __GRID2D_H__
|
//
// main.c
// PBR
//
// Created by diguage on 14-5-24.
// Copyright (c) 2014年 D瓜哥,http://www.diguage.com/. All rights reserved.
//
#include <stdio.h>
#include <math.h>
void cartesianToPolar(float x, float y, double *rPtr, double *thetaPtr)
{
if (rPtr) {
// 将radius 存入传入函数的地址
*rPtr = sqrt(x * x + y * y);
}
// thetaPtr 是否为NULL?
if (!thetaPtr) {
// 跳过函数的剩余代码
return;
}
// 计算theta
float theta;
if (x == 0.0) {
if (y == 0.0) {
theta = 0.0; // 代表未定义
} else if (y > 0) {
theta = M_PI_2;
} else {
theta = -M_PI_2;
}
} else {
theta = atan(y / x);
}
// 将theta存入传入函数的地址
*thetaPtr = theta;
}
int main(int argc, const char * argv[])
{
double pi = 3.14;
double integerPart;
double fractionPart;
// 将integerPart的地址作为实参传入
fractionPart = modf(pi, &integerPart);
// 获取integer地址上的值
printf("integerPart = %.0f, fractionPart = %.2f.\n", integerPart, fractionPart);
double x = 3.0;
double y = 4.0;
double radius;
double angle;
cartesianToPolar(x, y, &radius, &angle);
printf("(%.2f, %.2f) becomes (%.2f radians, %.2f)\n", x, y, radius, angle);
return 0;
}
|
//===----------------------------------------------------------------------===//
//
// Peloton
//
// constant_translator.h
//
// Identification: src/include/codegen/constant_translator.h
//
// Copyright (c) 2015-17, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include "codegen/expression_translator.h"
namespace peloton {
namespace expression {
class ConstantValueExpression;
} // namespace planner
namespace codegen {
//===----------------------------------------------------------------------===//
// A const expression translator just produces the LLVM value version of the
// constant value within.
//===----------------------------------------------------------------------===//
class ConstantTranslator : public ExpressionTranslator {
public:
ConstantTranslator(const expression::ConstantValueExpression &exp,
CompilationContext &ctx);
// Produce the value that is the result of codegen-ing the expression
codegen::Value DeriveValue(CodeGen &codegen,
RowBatch::Row &row) const override;
};
} // namespace codegen
} // namespace peloton |
/* -------------------------------------------------------------------------- *
* OpenSim: WISCO_VTKFileAdapter.h *
* -------------------------------------------------------------------------- *
* The OpenSim API is a toolkit for musculoskeletal modeling and simulation. *
* OpenSim is developed at Stanford University and supported by the US *
* National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA *
* through the Warrior Web program. *
* *
* Copyright (c) 2005-2015 Stanford University and the 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 OPENSIM_VTK_FILE_ADAPTER_H_
#define OPENSIM_VTK_FILE_ADAPTER_H_
#include "OpenSim/Common/FileAdapter.h"
//#include "OpenSim\OpenSim.h"
#include "SimTKmath.h"
#include "osimPluginDLL.h"
namespace OpenSim {
class OSIMPLUGIN_API WISCO_VTKFileAdapter : public FileAdapter {
//class WISCO_VTKFileAdapter : public FileAdapter {
public:
WISCO_VTKFileAdapter();
WISCO_VTKFileAdapter(const WISCO_VTKFileAdapter&) = default;
WISCO_VTKFileAdapter(WISCO_VTKFileAdapter&&) = default;
WISCO_VTKFileAdapter& operator=(const WISCO_VTKFileAdapter&) = default;
WISCO_VTKFileAdapter& operator=(WISCO_VTKFileAdapter&&) = default;
~WISCO_VTKFileAdapter() = default;
WISCO_VTKFileAdapter* clone() const override;
/**
@param[in] vertices
A matrix [nVertices x nTimeSteps] containing Vec3 with the locations
of the contact mesh vertices in space.
@param[in] faces
A matrix [nFaces x nVerticesPerFace]
*/
void write(const std::string& fileName, const std::string& filePath,
const SimTK::Matrix_<SimTK::Vec3>& vertices, const SimTK::Matrix& faces,
const int nTimeSteps) const;
void write(const std::string& fileName, const std::string& filePath,
const SimTK::PolygonalMesh& mesh, const int nTimeSteps) const;
/**
@param[in] aFaceDataNames
@param[in] aFaceData
A vector [nDataField] of SimTK::Matrix [nTimeStep x nFaces]
containing data values for each face in the contact mesh
*/
void setFaceData(std::vector<std::string> aFaceDataNames, std::vector<SimTK::Matrix> aFaceData)
{
faceDataNames = aFaceDataNames;
faceData = aFaceData;
};
void setPointData(std::vector<std::string> aPointDataNames, std::vector<SimTK::Matrix> aPointData)
{
pointDataNames = aPointDataNames;
pointData = aPointData;
};
protected:
OutputTables extendRead(const std::string& fileName) const override;
void extendWrite(const InputTables& tables, const std::string& fileName) const override;
private:
void write_vertex_positions(std::ofstream& out_stream, const SimTK::Matrix_<SimTK::Vec3>& vertices, int nTimeStep) const;
void write_face_connectivity(std::ofstream& out_stream, const SimTK::Matrix& faces) const;
//Data
private:
std::vector<std::string> faceDataNames;
std::vector<SimTK::Matrix> faceData;
std::vector<std::string> pointDataNames;
std::vector<SimTK::Matrix> pointData;
};
} // namespace OpenSim
#endif // OPENSIM_VTK_FILE_ADAPTER_H_
|
/*
Copyright 2015 LE, Duc-Anh
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 CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_INT16_H
#define CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_INT16_H
#include "../NumericValue.h"
namespace CLDEPlus {
namespace Foundation {
namespace Data {
namespace Type {
class Int16 : public NumericValue {
int16_t _value = 0;
public:
explicit Int16(int16_t value);
Int16(Int16 const &rhs) = default;
Int16(Int16 &&) = default;
Int16 &operator=(Int16 const &) = default;
Int16 &operator=(Int16 &&) = default;
~Int16() = default;
// Value
virtual void *PointerToBuffer() override;
// IPrintable
virtual string ToString() const override;
// IComputable
virtual Value &operator+(Value const &rhs) override;
virtual Value &operator-(Value const &rhs) override;
virtual Value &operator*(Value const &rhs) override;
virtual Value &operator/(Value const &rhs) override;
virtual Value &operator%(Value const &rhs) override;
// IPrimitiveAssignable
virtual Value &operator=(bool value) override;
virtual Value &operator=(double value) override;
virtual Value &operator=(float value) override;
virtual Value &operator=(int16 value) override;
virtual Value &operator=(int32 value) override;
virtual Value &operator=(int64 value) override;
virtual Value &operator=(uint16 value) override;
virtual Value &operator=(uint32 value) override;
virtual Value &operator=(uint64 value) override;
};
}
}
}
}
#endif //CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_INT16_H
|
/**************************************************************************
* Copyright 2015 John Denholm *
* *
* 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. *
* *
* *
* log.h - defines log structures and macros *
* *
* Updates: *
**************************************************************************/
#ifndef SHARED_LOG_LOCAL_H
#define SHARED_LOG_LOCAL_H
#define DEFAULT_LOG_FILE "-" // log to stdout by default
#define DEFAULT_LOG_FAC LOG_LOCAL4
#define LOG_LINE_MAX 16384
#include "shared.h"
extern LOG_CTL *_logger;
struct log_facility
{
int facility;
char * name;
};
struct log_file
{
char * filename;
char * type;
int8_t level;
int8_t orig_level;
int ok_fd;
int err_fd;
int use_std;
int use_syslog;
int64_t size;
};
// file.c
int log_file_open( LOGFL *lf );
void log_file_close( LOGFL *lf );
void log_file_reopen( LOGFL *lf );
int log_file_start( LOGFL *lf );
int log_file_set_level( LOGFL *lf, int8_t level, int8_t both );
// conf.c
extern int log_syslog_levels[LOG_LEVEL_MAX];
extern struct log_facility log_facilities[];
extern const char *log_level_strings[LOG_LEVEL_MAX];
void log_set_force_stdout( int set );
int log_get_facility( char *str );
// log.c
int log_open_syslog( void );
int log_close_syslog( void );
#endif
|
//
// OrderPetCell.h
// Beautician
//
// Created by dengqiang on 4/7/15.
// Copyright (c) 2015 XuShi Technology Co.,Ltd. All rights reserved.
//
#import "BaseTableViewCell.h"
@class Order;
@interface OrderPetCell : BaseTableViewCell
@property (nonatomic, strong) Order *order;
+ (CGFloat)cellHeight;
@end
|
/* { dg-do run } */
/* PR middle-end/31448, this used to ICE during expand because
reduce_to_bit_field_precision was not ready to handle constants. */
typedef struct _st {
long int iIndex : 24;
long int iIndex1 : 24;
} st;
st *next;
void g(void)
{
st *next = 0;
int nIndx;
const static int constreg[] = { 0,};
nIndx = 0;
next->iIndex = constreg[nIndx];
}
void f(void)
{
int nIndx;
const static long int constreg[] = { 0xFEFEFEFE,};
nIndx = 0;
next->iIndex = constreg[nIndx];
next->iIndex1 = constreg[nIndx];
}
int main(void)
{
st a;
next = &a;
f();
if (next->iIndex != 0xFFFEFEFE)
__builtin_abort ();
if (next->iIndex1 != 0xFFFEFEFE)
__builtin_abort ();
return 0;
}
|
/*
* This source file is part of libRocket, the HTML/CSS Interface Middleware
*
* For the latest information, see http://www.librocket.com
*
* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
*
* 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 ROCKETCOREELEMENTDECORATION_H
#define ROCKETCOREELEMENTDECORATION_H
#include "../../Include/Rocket/Core/Types.h"
namespace Rocket {
namespace Core {
class Decorator;
class Element;
/**
Manages an elements decorator state
@author Lloyd Weehuizen
*/
class ElementDecoration {
public:
/// Constructor
/// @param element The element this decorator with acting on
ElementDecoration(Element* element);
~ElementDecoration();
// Releases existing decorators and loads all decorators required by the
// element's definition.
bool ReloadDecorators();
/// Renders all appropriate decorators.
void RenderDecorators();
/// Mark active decorators as dirty and force them to reset themselves
void DirtyDecorators();
/// Marks the decorators as dirty and force an reload
void DirtyDecoratorsOnPropertyChanged();
/// Iterates over all active decorators attached to the decoration's element.
/// @param[inout] index Index to fetch. This is incremented after the fetch.
/// @param[out] pseudo_classes The pseudo-classes the decorator required to be
/// active before it renders.
/// @param[out] name The name of the decorator at the specified index.
/// @param[out] decorator The decorator at the specified index.
/// @param[out] decorator_data This element's handle to any data is has stored
/// against the decorator.
/// @return True if a decorator was successfully fetched, false if not.
bool IterateDecorators(int& index, PseudoClassList& pseudo_classes,
String& name, Decorator*& decorator,
DecoratorDataHandle& decorator_data) const;
private:
// Loads a single decorator and adds it to the list of loaded decorators for
// this element.
int LoadDecorator(Decorator* decorator);
// Releases all existing decorators and frees their data.
void ReleaseDecorators();
// Updates the list of active decorators (if necessary)
void UpdateActiveDecorators();
struct DecoratorHandle {
Decorator* decorator;
DecoratorDataHandle decorator_data;
};
typedef std::vector<DecoratorHandle> DecoratorList;
typedef std::pair<PseudoClassList, int> PseudoClassDecoratorIndex;
typedef std::vector<PseudoClassDecoratorIndex> PseudoClassDecoratorIndexList;
typedef std::map<String, PseudoClassDecoratorIndexList> DecoratorIndex;
// The element this decorator belongs to
Element* element;
// The list of every decorator used by this element in every class.
DecoratorList decorators;
// The list of currently active decorators.
std::vector<int> active_decorators;
bool active_decorators_dirty;
bool decorators_dirty;
// For each unique decorator name, this stores (in order of specificity) the
// name of the pseudo-class that has
// a definition for it, and the index into the list of decorators.
DecoratorIndex decorator_index;
};
}
}
#endif
|
// Copyright (c) 2013, Juan R. García Blanco <juanrgar@gmail.com>
// All rights reserved.
// See LICENCE for more information.
#include "gopencl.h"
gint
main (gint argc, gchar **argv)
{
GopenclPlatform *plat = NULL;
gchar *str_buf;
GList *platforms = NULL;
GError *err = NULL;
gboolean fullProfile = FALSE;
gboolean embeddedProfile = FALSE;
gboolean ret = FALSE;
g_type_init();
ret = gopencl_platform_get_platforms(&platforms, NULL);
g_print("1. ret %d\n", ret);
g_list_free_full(platforms, g_object_unref);
platforms = NULL;
ret = gopencl_platform_get_platforms(NULL, NULL);
g_print("2. ret %d\n", ret);
ret = gopencl_platform_get_platforms(NULL, &err);
g_print("4. ret %d: %s\n", ret, err->message);
g_error_free(err);
err = NULL;
g_print("--------------\n\n\n");
ret = gopencl_platform_get_platforms(&platforms, NULL);
g_print("%d platforms found\n", g_list_length(platforms));
plat = GOPENCL_PLATFORM((g_list_first(platforms))->data);
g_object_get(plat, "profile", &str_buf, NULL);
g_print("\tPlatform profile %s\n", str_buf);
g_free(str_buf);
g_object_get(plat, "version", &str_buf, NULL);
g_print("\tPlatform version %s\n", str_buf);
g_free(str_buf);
g_object_get(plat, "name", &str_buf, NULL);
g_print("\tPlatform name %s\n", str_buf);
g_free(str_buf);
g_object_get(plat, "vendor", &str_buf, NULL);
g_print("\tPlatform vendor %s\n", str_buf);
g_free(str_buf);
g_object_get(plat, "extensions", &str_buf, NULL);
g_print("\tPlatform extensions %s\n", str_buf);
g_free(str_buf);
fullProfile = gopencl_platform_is_full_profile(plat);
g_print("\tPlatform has full profile %d\n", fullProfile);
embeddedProfile = gopencl_platform_is_embedded_profile(plat);
g_print("\tPlatform has embedded profile %d\n", embeddedProfile);
g_list_free_full(platforms, g_object_unref);
return 0;
}
|
// Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_
#include <absl/container/flat_hash_set.h>
#include <sys/types.h>
#include "OrbitBase/Result.h"
namespace orbit_user_space_instrumentation {
// Attaches to and stops all threads of the process `pid` using `PTRACE_ATTACH`. Being attached to a
// process using this function is a precondition for using any of the tooling provided here.
// Returns the set of thread ids of the threads that were stopped.
[[nodiscard]] ErrorMessageOr<absl::flat_hash_set<pid_t>> AttachAndStopProcess(pid_t pid);
// Attaches to and stops all threads of the process `pid` that are not already in
// `already_halted_tids`. It can be used to stop threads that spawned while already attached to a
// process.
// Returns the new set of thread ids of all halted threads (old and new).
[[nodiscard]] ErrorMessageOr<absl::flat_hash_set<pid_t>> AttachAndStopNewThreadsOfProcess(
pid_t pid, absl::flat_hash_set<pid_t> already_halted_tids);
// Detaches from all threads of the process `pid` and continues the execution.
[[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid);
} // namespace orbit_user_space_instrumentation
#endif // USER_SPACE_INSTRUMENTATION_ATTACH_H_ |
//
// PVFRequest.h
// PagueVelozFramework
//
// Created by João Paulo Ros on 28/06/15.
// Copyright (c) 2015 PremierSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PVFRequest : NSObject
@property (nonatomic, strong) NSString *apiVersion;
@property (nonatomic, strong) NSString *endpoint;
@property (nonatomic, strong) NSString *method;
@property (nonatomic, strong) NSData *data;
@property (nonatomic, assign) BOOL requiresSigning;
@property (nonatomic, strong) Class returnClass;
@end
|
/*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
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.
*/
/**
* @file AVR/adc_lld.h
* @brief ADC Driver subsystem low level driver source.
*
* @addtogroup ADC
* @{
*/
#ifndef _ADC_LLD_H_
#define _ADC_LLD_H_
#if HAL_USE_ADC || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define ANALOG_REFERENCE_AREF 0
#define ANALOG_REFERENCE_AVCC 1
#define ANALOG_REFERENCE_1V1 2
#define ANALOG_REFERENCE_2V56 3
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
#if !CH_CFG_USE_SEMAPHORES
#error "the ADC driver requires CH_CFG_USE_SEMAPHORES"
#endif
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief ADC sample data type.
*/
typedef uint16_t adcsample_t;
/**
* @brief Channels number in a conversion group.
*/
typedef uint16_t adc_channels_num_t;
/**
* @brief Type of a structure representing an ADC driver.
*/
typedef struct ADCDriver ADCDriver;
/**
* @brief ADC notification callback type.
*
* @param[in] adcp pointer to the @p ADCDriver object triggering the
* callback
* @param[in] buffer pointer to the most recent samples data
* @param[in] n number of buffer rows available starting from @p buffer
*/
typedef void (*adccallback_t)(ADCDriver *adcp, adcsample_t *buffer, size_t n);
/**
* @brief Conversion group configuration structure.
* @details This implementation-dependent structure describes a conversion
* operation.
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
typedef struct {
/**
* @brief Enables the circular buffer mode for the group.
*/
bool_t circular;
/**
* @brief Number of the analog channels belonging to the conversion group.
*/
adc_channels_num_t num_channels;
/**
* @brief Callback function associated to the group or @p NULL.
*/
adccallback_t end_cb;
/* End of the mandatory fields.*/
uint8_t channelsMask;
} ADCConversionGroup;
/**
* @brief Driver configuration structure.
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
* @note It could be empty on some architectures.
*/
typedef struct {
uint8_t analog_reference;
} ADCConfig;
/**
* @brief Structure representing an ADC driver.
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
struct ADCDriver {
/**
* @brief Driver state.
*/
adcstate_t state;
/**
* @brief Current configuration data.
*/
const ADCConfig *config;
/**
* @brief Current samples buffer pointer or @p NULL.
*/
adcsample_t *samples;
/**
* @brief Current samples buffer depth or @p 0.
*/
size_t depth;
/**
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *grpp;
#if ADC_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
Thread *thread;
#endif /* ADC_USE_WAIT */
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
Mutex mutex;
#elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore;
#endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */
#if defined(ADC_DRIVER_EXT_FIELDS)
ADC_DRIVER_EXT_FIELDS
#endif
/* End of the mandatory fields.*/
/**
* @brief Current position in the buffer.
*/
size_t currentBufferPosition;
};
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if AVR_ADC_USE_ADC1 && !defined(__DOXYGEN__)
extern ADCDriver ADCD1;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void adc_lld_init(void);
void adc_lld_start(ADCDriver *adcp);
void adc_lld_stop(ADCDriver *adcp);
void adc_lld_start_conversion(ADCDriver *adcp);
void adc_lld_stop_conversion(ADCDriver *adcp);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_ADC */
#endif /* _ADC_LLD_H_ */
/** @} */
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2017-2021 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#pragma once
#include <modules/fontrendering/fontrenderingmoduledefine.h>
#include <modules/fontrendering/datastructures/textboundingbox.h>
#include <inviwo/core/util/glm.h>
#include <string>
#include <vector>
namespace inviwo {
struct IVW_MODULE_FONTRENDERING_API TexAtlasEntry {
std::string value;
ivec2 texPos;
ivec2 texExtent;
vec4 color;
};
struct IVW_MODULE_FONTRENDERING_API TexAtlasRenderInfo {
std::vector<ivec2> size;
std::vector<mat4> texTransform;
std::vector<TextBoundingBox> boundingBoxes;
};
} // namespace inviwo
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*================================================================================
LightmapResRatioAdjust.h: Lightmap Resolution Ratio Adjustment helper
================================================================================*/
#ifndef __LightmapResRatioAdjust_h__
#define __LightmapResRatioAdjust_h__
#pragma once
/**
* LightmapResRatioAdjust settings
*/
class FLightmapResRatioAdjustSettings
{
public:
/** LightmapResRatioAdjust level options */
enum AdjustLevels
{
/** Current level only */
Current,
/** Selected levels only */
Selected,
/** All loaded levels */
AllLoaded
};
/** Static: Returns global lightmap resolution ratio adjust settings */
static FLightmapResRatioAdjustSettings& Get()
{
return LightmapResRatioAdjustSettings;
}
bool ApplyRatioAdjustment();
/**
* Add levels in a world to an array based on the LevelOptions setting
*
* @param InLevelOptions Level options used to decided whether to add levels to the array
* @param InWorld The world in which to get the levels from
* @param OutLevels The array to add any levels to (The array is NOT reset by this function)
*/
void AddRequiredLevels( AdjustLevels InLevelOptions, UWorld* World , TArray<ULevel*>& OutLevels );
protected:
/** Static: Global lightmap resolution ratio adjust settings */
static FLightmapResRatioAdjustSettings LightmapResRatioAdjustSettings;
public:
/** Constructor */
FLightmapResRatioAdjustSettings() :
Ratio(1.0f)
, Min_StaticMeshes(32)
, Max_StaticMeshes(256)
, Min_BSPSurfaces(1)
, Max_BSPSurfaces(512)
, bStaticMeshes(false)
, bBSPSurfaces(false)
, LevelOptions(AdjustLevels::Current)
, bSelectedObjectsOnly(false)
{
}
/** Ratio to apply */
float Ratio;
/** Min/Max values */
/** Static meshes */
int32 Min_StaticMeshes;
int32 Max_StaticMeshes;
/** BSP Surfaces */
int32 Min_BSPSurfaces;
int32 Max_BSPSurfaces;
/** If true, apply to static meshes */
bool bStaticMeshes;
/** If true, apply to BSP surfaces*/
bool bBSPSurfaces;
/** The primitives to apply the adjustment to */
uint8 PrimitiveFlags;
/** The level(s) to check */
AdjustLevels LevelOptions;
/** If true, then only do selected primitives in the level(s) */
bool bSelectedObjectsOnly;
};
#endif // __LightmapResRatioAdjust_h__
|
/*
| PC-LISP (C) 1984-1989 Peter J.Ashwood-Smith
*/
#include <stdio.h>
#include <math.h>
#include "lisp.h"
/***************************************************************************
** buconcat: (concat s1 s2 s3...sN) Make a new atom whose print name is **
** formed by concatenating the print names of s1...sN (or string values) **
** then return the new atom created. We use the buffer work to make the **
** new atoms print name. We scan s1,s2,...sN and copy them into the work **
** buffer after the last atoms print name, we back up once after each is **
** copied to copy over the '\0'. Then when we are done we make sure that **
** string is null terminated and create or find an atom equivalent to it.**
***************************************************************************/
struct conscell *buconcat(form)
struct conscell *form;
{ char work[MAXATOMSIZE],*d,*s; int len = 0;
if (form == NULL) return(NULL);
for(d = work; form != NULL; form = form->cdrp)
{ if (!GetNumberOrString(form->carp,&s)) goto ERR;
if ((len += strlen(s)) >= MAXATOMSIZE) gerror("atom too big");
while(*d++ = *s++);
d--;
};
*(d+1) = '\0';
return(LIST(CreateInternedAtom(work)));
ERR: ierror("concat"); /* doesn't return */
return NULL; /* keep compiler happy */
}
|
#pragma once
#include <ncs/spec/Generator.h>
#include <ncs/spec/GeometryGenerator.h>
namespace ncs {
namespace spec {
class BoxGenerator : public GeometryGenerator {
public:
BoxGenerator(Generator* x,
Generator* y,
Generator* z);
virtual Geometry generate(RNG* rng);
private:
Generator* x_;
Generator* y_;
Generator* z_;
};
} // namespace spec
} // namespace ncs
|
/***********************************************************************************
* Copyright (c) 2012, Sepehr Taghdisian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
***********************************************************************************/
#ifndef __HWINFO_H__
#define __HWINFO_H__
#include "types.h"
#include "core-api.h"
enum hwinfo_flags
{
HWINFO_MEMORY = (1<<0),
HWINFO_CPU = (1<<2),
HWINFO_OS = (1<<3),
HWINFO_ALL = 0xFFFFFFFF
};
/**
* CPU Type
* @ingroup eng
*/
enum hwinfo_cpu_type
{
HWINFO_CPU_UNKNOWN,
HWINFO_CPU_INTEL,
HWINFO_CPU_AMD
};
/**
* OS Type
* @ingroup eng
*/
enum hwinfo_os_type
{
HWINFO_OS_UNKNOWN,
HWINFO_OS_WIN9X,
HWINFO_OS_WINNT,
HWINFO_OS_LINUX,
HWINFO_OS_WIN2K,
HWINFO_OS_WINXP,
HWINFO_OS_WINVISTA,
HWINFO_OS_WIN7,
HWINFO_OS_WIN8,
HWINFO_OS_OSX
};
/**
* CPU Caps
* @ingroup eng
*/
enum hwinfo_cpu_ext
{
HWINFO_CPUEXT_MMX = (1<<0), /**< MMX Instructions support */
HWINFO_CPUEXT_SSE = (1<<1), /**< SSE Instructions support */
HWINFO_CPUEXT_SSE2 = (1<<2), /**< SSE2 Instructions support */
HWINFO_CPUEXT_SSE3 = (1<<3), /**< SSE3 Instructions support */
HWINFO_CPUEXT_SSE4 = (1<<4) /**< SSE4 Instructions support */
};
/**
* Hardware information structure
* @ingroup eng
*/
struct hwinfo
{
char cpu_name[128]; /**< CPU vendor name */
char cpu_feat[128]; /**< CPU Features string, each feature is separated with space */
char os_name[128]; /**< Running OS Name */
size_t sys_mem; /**< Available total system memory (in Kb) */
size_t sys_memfree; /**< Available free system memory (in Kb) */
uint cpu_clock; /**< CPU clock rate (in MHZ) */
uint cpu_cachesize; /**< CPU Cache size */
uint cpu_cacheline; /**< CPU Cache line size */
int cpu_core_cnt; /**< Total count of cpu cores (logical) */
int cpu_pcore_cnt; /**< Total count of physical cpu cores */
uint cpu_caps; /**< Combination of known CPU Caps (@see hwinfo_cpu_ext) */
enum hwinfo_cpu_type cpu_type; /**< CPU Type (@see hwinfo_cpu_type) */
enum hwinfo_os_type os_type; /**< OS Type (@see hwinfo_os_type) */
};
CORE_API void hw_getinfo(struct hwinfo* info, uint flags);
CORE_API void hw_printinfo(const struct hwinfo* info, uint flags);
#endif /* __HWINFO_H__ */
|
// Copyright (c) 2016, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
#include <math.h>
#include "VolumeTransformation.h"
/// <summary>
/// Transforms volume inputs to adjust for the system/hardware audio taper.
/// </summary>
class CurveTransformer : public VolumeTransformation {
public:
/// <summary>
/// Creates a new CurveTransformer with the given scale factor. The scale
/// determines the exponent used when reshaping the volume curve:
/// base = 2^scale
/// </summary>
CurveTransformer(float scale) {
base = pow(2.0f, scale);
logBase = log(base);
}
virtual float Apply(float vol) {
return (pow(base, vol) - 1) / (base - 1);
}
virtual float Revert(float vol) {
return log(vol * (base - 1) + 1) / logBase;
}
private:
float base;
float logBase;
};
|
/*
Stereo Vision Algorithm Framework, Copyright(c) 2016-2018, Peng Chao
*/
#pragma once
#include "Layer.h"
namespace svaf{
class CVPointLayer :
public Layer
{
public:
explicit CVPointLayer(LayerParameter& layer);
~CVPointLayer();
virtual bool Run(vector<Block>&, vector<Block>&, LayerParameter&, void*);
protected:
bool Fast(vector<Block>&, vector<Block>&);
bool FastX(vector<Block>&, vector<Block>&);
bool MSER(vector<Block>&, vector<Block>&);
bool ORB(vector<Block>&, vector<Block>&);
bool Brisk(vector<Block>&, vector<Block>&);
bool Freak(vector<Block>&, vector<Block>&);
bool Star(vector<Block>&, vector<Block>&);
bool Sift(vector<Block>&, vector<Block>&);
bool Surf(vector<Block>&, vector<Block>&);
bool GFTT(vector<Block>&, vector<Block>&);
bool Harris(vector<Block>&, vector<Block>&);
bool Dense(vector<Block>&, vector<Block>&);
bool SimpleBlob(vector<Block>&, vector<Block>&);
bool Grid(vector<Block>&, vector<Block>&);
bool Pyramid(vector<Block>&, vector<Block>&);
private:
string featname;
svaf::CVPointParameter layerparam;
svaf::CVPointParameter_PointType type;
bool(CVPointLayer::*ptr)(vector<Block>&, vector<Block>&);
};
}
|
/**************************************************************************
*
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/* Author:
* Brian Paul
* Keith Whitwell
*/
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "util/u_prim.h"
#include "lp_context.h"
#include "lp_state.h"
#include "lp_query.h"
#include "draw/draw_context.h"
/**
* Draw vertex arrays, with optional indexing, optional instancing.
* All the other drawing functions are implemented in terms of this function.
* Basically, map the vertex buffers (and drawing surfaces), then hand off
* the drawing to the 'draw' module.
*/
static void
llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
{
struct llvmpipe_context *lp = llvmpipe_context(pipe);
struct draw_context *draw = lp->draw;
void *mapped_indices = NULL;
unsigned i;
if (!llvmpipe_check_render_cond(lp))
return;
if (lp->dirty)
llvmpipe_update_derived( lp );
/*
* Map vertex buffers
*/
for (i = 0; i < lp->num_vertex_buffers; i++) {
void *buf = llvmpipe_resource_data(lp->vertex_buffer[i].buffer);
draw_set_mapped_vertex_buffer(draw, i, buf);
}
/* Map index buffer, if present */
if (info->indexed && lp->index_buffer.buffer)
mapped_indices = llvmpipe_resource_data(lp->index_buffer.buffer);
draw_set_mapped_index_buffer(draw, mapped_indices);
llvmpipe_prepare_vertex_sampling(lp,
lp->num_vertex_sampler_views,
lp->vertex_sampler_views);
/* draw! */
draw_vbo(draw, info);
/*
* unmap vertex/index buffers
*/
for (i = 0; i < lp->num_vertex_buffers; i++) {
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
if (mapped_indices) {
draw_set_mapped_index_buffer(draw, NULL);
}
llvmpipe_cleanup_vertex_sampling(lp);
/*
* TODO: Flush only when a user vertex/index buffer is present
* (or even better, modify draw module to do this
* internally when this condition is seen?)
*/
draw_flush(draw);
}
void
llvmpipe_init_draw_funcs(struct llvmpipe_context *llvmpipe)
{
llvmpipe->pipe.draw_vbo = llvmpipe_draw_vbo;
}
|
#include "backlight.h"
EINTERN void *
e_modapi_gadget_init(E_Module *m)
{
e_gadget_type_add("Backlight", backlight_gadget_create, NULL);
return m;
}
EINTERN int
e_modapi_gadget_shutdown(E_Module *m EINA_UNUSED)
{
e_gadget_type_del("Backlight");
return 1;
}
EINTERN int
e_modapi_gadget_save(E_Module *m EINA_UNUSED)
{
return 1;
}
|
/*
+--------------------------------------------------------------------+
| PECL :: pq |
+--------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
| Copyright (c) 2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#ifndef PHP_PQCONN_H
#define PHP_PQCONN_H
#define PHP_PQCONN_ASYNC 0x01
#define PHP_PQCONN_PERSISTENT 0x02
#include <ext/raphf/php_raphf.h>
#include "php_pq_object.h"
#include "php_pq_callback.h"
#include "php_pq_object.h"
#include "php_pq_params.h"
typedef struct php_pqconn {
PGconn *conn;
int (*poller)(PGconn *);
php_resource_factory_t factory;
HashTable listeners;
HashTable statements;
HashTable converters;
HashTable eventhandlers;
php_pq_callback_t onevent;
unsigned unbuffered:1;
unsigned default_fetch_type:2;
unsigned default_txn_isolation:2;
unsigned default_txn_readonly:1;
unsigned default_txn_deferrable:1;
unsigned default_auto_convert:16;
} php_pqconn_t;
typedef struct php_pqconn_object {
PHP_PQ_OBJ_DECL(php_pqconn_t *)
} php_pqconn_object_t;
typedef struct php_pqconn_resource_factory_data {
char *dsn;
unsigned long flags;
} php_pqconn_resource_factory_data_t;
extern php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void);
extern zend_class_entry *php_pqconn_class_entry;
extern php_pqconn_object_t *php_pqconn_create_object_ex(zend_class_entry *ce, php_pqconn_t *intern);
extern void php_pqconn_notify_listeners(php_pqconn_object_t *obj);
extern ZEND_RESULT_CODE php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params);
extern ZEND_RESULT_CODE php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params);
extern ZEND_RESULT_CODE php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable);
extern ZEND_RESULT_CODE php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable);
extern ZEND_RESULT_CODE php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl);
extern ZEND_RESULT_CODE php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl);
extern PHP_MINIT_FUNCTION(pqconn);
extern PHP_MSHUTDOWN_FUNCTION(pqconn);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
|
void lcdinit(int io_register, int pin_register, int device);
void write_pins(int value);
void write_pins_append(int value);
void write_pins_remove(int value);
void reset_all();
void write_4_bits(int bits, int char_mode);
void set_enable(int on);
void set_rs(int on);
void pulse_enable();
void write_char(char chr);
void write_string(char *str);
void clear_screen();
void cursor_off();
void cursor_on();
void screen_off();
void screen_on();
void cursor_blink_off();
void cursor_blink_on();
void write_display_mode_change(int change, int on);
void cursor_right(int num);
void cursor_left(int num);
void display_one_line();
void display_two_lines();
|
#include <stdio.h>
#include <stdint.h>
#include <SDL_ttf.h>
#include "fvm_shared.h"
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination);
// This is a shared object which is written in C.
// We'll call this from our VM!
SDL_Color textColor = { 255, 255, 255 };
uint32_t test_function(void* arg)
{
SDL_Surface* bmp;
struct SDL_Rect Temp;
VM_API.VM_set_resolution(1024, 768, 32);
SDL_Surface* VM_Screen = VM_API.VM_get_surface();
bmp = SDL_LoadBMP("./lol.bmp");
SDL_BlitSurface(bmp, NULL, VM_Screen, NULL);
VM_API.VM_printf("Test function!\n");
VM_API.VM_printf("Hey there! pi = %f", 3.14159265f);
TTF_Init();
TTF_Font* font = TTF_OpenFont( "/usr/share/fonts/myfonts/Minecraftia.ttf", 38 );
SDL_Surface* message = TTF_RenderText_Solid( font, "Hello Big World!", textColor );
apply_surface( 0, 150, message, VM_Screen );
font = TTF_OpenFont( "/usr/share/fonts/myfonts/Minecraftia.ttf", 26 );
message = TTF_RenderText_Solid( font, "Hello Small World!", textColor );
apply_surface( 0, 210, message, VM_Screen );
//Update Screen
SDL_Flip(VM_Screen);
return 0;
}
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination)
{
//Holds offsets
SDL_Rect offset;
//Get offsets
offset.x = x;
offset.y = y;
//Blit
SDL_BlitSurface( source, NULL, destination, &offset );
}
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "HardwareInfo.h"
#include "AutomationTest.h"
///////////////////////////////////////////////////////////////////////
// Common Latent commands which are used across test type. I.e. Engine, Network, etc...
DEFINE_LOG_CATEGORY_STATIC(LogEditorAutomationTests, Log, All);
DEFINE_LOG_CATEGORY_STATIC(LogEngineAutomationTests, Log, All);
DEFINE_LOG_CATEGORY_STATIC(LogAnalytics, Log, All);
/** Common automation functions */
namespace AutomationCommon
{
/** Get a string contains the render mode we are currently in */
static FString GetRenderDetailsString()
{
FString HardwareDetailsString;
// Create the folder name based on the hardware specs we have been provided
FString HardwareDetails = FHardwareInfo::GetHardwareDetailsString();
FString RHIString;
FString RHILookup = NAME_RHI.ToString() + TEXT( "=" );
if( FParse::Value( *HardwareDetails, *RHILookup, RHIString ) )
{
HardwareDetailsString = ( HardwareDetailsString + TEXT( "_" ) ) + RHIString;
}
FString TextureFormatString;
FString TextureFormatLookup = NAME_TextureFormat.ToString() + TEXT( "=" );
if( FParse::Value( *HardwareDetails, *TextureFormatLookup, TextureFormatString ) )
{
HardwareDetailsString = ( HardwareDetailsString + TEXT( "_" ) ) + TextureFormatString;
}
FString DeviceTypeString;
FString DeviceTypeLookup = NAME_DeviceType.ToString() + TEXT( "=" );
if( FParse::Value( *HardwareDetails, *DeviceTypeLookup, DeviceTypeString ) )
{
HardwareDetailsString = ( HardwareDetailsString + TEXT( "_" ) ) + DeviceTypeString;
}
FString FeatureLevelString;
GetFeatureLevelName(GMaxRHIFeatureLevel,FeatureLevelString);
{
HardwareDetailsString = ( HardwareDetailsString + TEXT( "_" ) ) + FeatureLevelString;
}
if(GEngine->StereoRenderingDevice.IsValid())
{
HardwareDetailsString = ( HardwareDetailsString + TEXT( "_" ) ) + TEXT("STEREO");
}
if( HardwareDetailsString.Len() > 0 )
{
//Get rid of the leading "_"
HardwareDetailsString = HardwareDetailsString.RightChop(1);
}
return HardwareDetailsString;
}
/** Gets a path used for automation testing (PNG sent to the AutomationTest folder) */
static void GetScreenshotPath(const FString& TestName, FString& OutScreenshotName, const bool bIncludeHardwareDetails)
{
FString PathName = FPaths::AutomationDir() + TestName / FPlatformProperties::PlatformName();
if( bIncludeHardwareDetails )
{
PathName = PathName + TEXT("_") + GetRenderDetailsString();
}
FPaths::MakePathRelativeTo(PathName, *FPaths::RootDir());
OutScreenshotName = FString::Printf(TEXT("%s/%d.png"), *PathName, GEngineVersion.GetChangelist());
}
}
/**
* Parameters to the Latent Automation command FTakeEditorScreenshotCommand
*/
struct WindowScreenshotParameters
{
FString ScreenshotName;
TSharedPtr<SWindow> CurrentWindow;
};
/**
* Wait for the given amount of time
*/
DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FWaitLatentCommand, float, Duration);
/**
* Take a screenshot of the active window
*/
DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FTakeActiveEditorScreenshotCommand, FString, ScreenshotName);
/**
* Take a screenshot of the active window
*/
DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FTakeEditorScreenshotCommand, WindowScreenshotParameters, ScreenshotParameters);
/**
* Latent command to load a map in game
*/
DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FLoadGameMapCommand, FString, MapName);
/**
* Latent command that requests exit
*/
DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND( FRequestExitCommand );
|
/*
Copyright (c) 2016-2017, Vlad Meșco
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PARSER_TYPES_H
#define PARSER_TYPES_H
#include <vector>
#include <map>
#include <memory>
#include <functional>
#include <stereo.h>
#include <string_utils.h>
struct IValue
{
typedef enum {
SCALAR, LIST, OPTION
} Type;
virtual IValue* Clone() = 0;
virtual Type GetType() const = 0;
virtual ~IValue() {}
};
struct List : IValue
{
IValue* Clone() override
{
List* clone = new List();
for(auto&& v: values) {
clone->values.push_back(v->Clone());
}
return clone;
}
IValue::Type GetType() const override { return IValue::LIST; }
std::vector<IValue*> values;
virtual ~List()
{
for(auto&& v : values) delete v;
}
};
struct Scalar : IValue
{
IValue* Clone() override { return new Scalar(value.c_str()); }
IValue::Type GetType() const override { return IValue::SCALAR; }
std::wstring value;
Scalar(wchar_t* s)
{
value.assign(s);
free(s);
}
Scalar(wchar_t const* s) { value.assign(s); }
};
struct Option : IValue
{
IValue* Clone() override { return new Option(name.c_str(), value->Clone()); }
IValue::Type GetType() const override { return IValue::OPTION; }
std::wstring name;
IValue* value;
Option(wchar_t* name_, IValue* value_)
{
name.assign(name_);
free(name_);
value = value_;
}
Option(wchar_t const* name_, IValue* value_)
{
name.assign(name_);
value = value_;
}
virtual ~Option()
{
delete value;
}
};
struct Section
{
std::wstring name;
std::vector<Option*> options;
void SetName(wchar_t* s)
{
name.assign(s);
free(s);
}
~Section()
{
for(auto&& o : options) {
delete o;
}
}
};
#endif
|
/*
* LimeSDR control interface
*/
#pragma once
#include <QtCore>
#include <QWidget>
#include "sdr_device_limesdr_api_defs.h"
typedef struct {
quint64 rx_frequency;
quint32 rx_sample_rate;
quint32 rx_bandwidth;
unsigned int rx_gain;
size_t rx_channel;
bool rx_lpf;
bool rx_gfir;
} limesdr_settings_t;
typedef struct {
int rx_channels;
int tx_channels;
lms_range_t rx_lo;
lms_range_t tx_lo;
lms_range_t rx_lpf;
lms_range_t tx_lpf;
lms_range_t rx_rate;
lms_range_t tx_rate;
} limesdr_info_t;
namespace Ui {
class SdrDeviceLimesdrRxctl;
}
class SdrDeviceLimesdrRxctl : public QWidget
{
Q_OBJECT
public:
explicit SdrDeviceLimesdrRxctl(QWidget *parent = nullptr);
~SdrDeviceLimesdrRxctl();
void readSettings(const limesdr_settings_t &settings);
signals:
void gainChanged(unsigned int gain);
void lpfToggled(bool lpf_on);
void gfirToggled(bool gfir_on);
void calibrate(void);
private slots:
void on_gainSlider_valueChanged(int value);
void on_lpfCheckBox_toggled(bool checked);
void on_gfirCheckBox_toggled(bool checked);
void on_calButton_clicked(bool checked);
private:
Ui::SdrDeviceLimesdrRxctl *ui;
};
|
/*
* sophia database
* sphia.org
*
* Copyright (c) Dmitry Simonenko
* BSD License
*/
#include <libss.h>
#include <libsf.h>
#include <libsr.h>
#include <libso.h>
#include <libsv.h>
#include <libsl.h>
#include <libsd.h>
#include <libsi.h>
#include <libsx.h>
#include <libsy.h>
#include <libse.h>
int se_recoverbegin(sedb *db)
{
/* open and recover repository */
se_statusset(&db->status, SE_RECOVER);
se *e = se_of(&db->o);
/* do not allow to recover existing databases
* during online (only create), since logpool
* reply is required. */
if (se_status(&e->status) == SE_ONLINE)
db->scheme.path_fail_on_exists = 1;
int rc = si_open(&db->index, &db->scheme);
if (ssunlikely(rc == -1))
goto error;
db->created = rc;
return 0;
error:
se_dbmalfunction(db);
return -1;
}
int se_recoverend(sedb *db)
{
se_statusset(&db->status, SE_ONLINE);
return 0;
}
static int
se_recoverlog(se *e, sl *log)
{
so *tx = NULL;
sedb *db = NULL;
ssiter i;
ss_iterinit(sl_iter, &i);
int rc = ss_iteropen(sl_iter, &i, &e->r, &log->file, 1);
if (ssunlikely(rc == -1))
return -1;
for (;;)
{
sv *v = ss_iteratorof(&i);
if (ssunlikely(v == NULL))
break;
/* reply transaction */
uint64_t lsn = sv_lsn(v);
tx = so_begin(&e->o);
if (ssunlikely(tx == NULL))
goto error;
while (ss_iteratorhas(&i)) {
v = ss_iteratorof(&i);
assert(sv_lsn(v) == lsn);
/* match a database */
uint32_t dsn = sl_vdsn(v);
if (db == NULL || db->scheme.id != dsn)
db = (sedb*)se_dbmatch_id(e, dsn);
if (ssunlikely(db == NULL)) {
sr_malfunction(&e->error, "%s",
"database id %" PRIu32 "is not declared", dsn);
goto rlb;
}
so *o = so_object(&db->o);
if (ssunlikely(o == NULL))
goto rlb;
so_setstring(o, "raw", sv_pointer(v), sv_size(v));
so_setstring(o, "log", log, 0);
int flags = sv_flags(v);
if (flags == SVDELETE) {
rc = so_delete(tx, o);
} else
if (flags == SVUPDATE) {
rc = so_update(tx, o);
} else {
assert(flags == 0);
rc = so_set(tx, o);
}
if (ssunlikely(rc == -1))
goto rlb;
ss_gcmark(&log->gc, 1);
ss_iteratornext(&i);
}
if (ssunlikely(sl_iter_error(&i)))
goto rlb;
so_setint(tx, "lsn", lsn);
rc = so_commit(tx);
if (ssunlikely(rc != 0))
goto error;
rc = sl_iter_continue(&i);
if (ssunlikely(rc == -1))
goto error;
if (rc == 0)
break;
}
ss_iteratorclose(&i);
return 0;
rlb:
so_destroy(tx);
error:
ss_iteratorclose(&i);
return -1;
}
static inline int
se_recoverlogpool(se *e)
{
sslist *i;
ss_listforeach(&e->lp.list, i) {
sl *log = sscast(i, sl, link);
int rc = se_recoverlog(e, log);
if (ssunlikely(rc == -1))
return -1;
ss_gccomplete(&log->gc);
}
return 0;
}
int se_recover(se *e)
{
slconf *lc = &e->lpconf;
lc->enable = e->meta.log_enable;
lc->path = e->meta.log_path;
lc->rotatewm = e->meta.log_rotate_wm;
lc->sync_on_rotate = e->meta.log_rotate_sync;
lc->sync_on_write = e->meta.log_sync;
int rc = sl_poolopen(&e->lp, lc);
if (ssunlikely(rc == -1))
return -1;
if (e->meta.two_phase_recover)
return 0;
/* recover log files */
rc = se_recoverlogpool(e);
if (ssunlikely(rc == -1))
goto error;
rc = sl_poolrotate(&e->lp);
if (ssunlikely(rc == -1))
goto error;
return 0;
error:
se_statusset(&e->status, SE_MALFUNCTION);
return -1;
}
int se_recover_repository(se *e)
{
syconf *rc = &e->repconf;
rc->path = e->meta.path;
rc->path_create = e->meta.path_create;
rc->path_backup = e->meta.backup_path;
rc->sync = 0;
return sy_open(&e->rep, &e->r, rc);
}
|
/*
* Copyright (C) 2009 by Comm5 Tecnologia Ltda. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY COMM5 TECNOLOGIA LTDA AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
* SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* For additional information see http://www.ethernut.de/
*
*/
#if !defined( __NUTCOMPONENTDELEGATE_H__ )
#define __NUTCOMPONENTDELEGATE_H__
#include <QItemDelegate>
class NutComponentModel;
class NutComponentDelegate : public QItemDelegate
{
Q_OBJECT
mutable bool paintRadio;
public:
explicit NutComponentDelegate(QObject* parent = 0);
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
void setEditorData(QWidget* editor, const QModelIndex& index) const;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
protected:
void drawCheck(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, Qt::CheckState state) const;
};
#endif // __NUTCOMPONENTDELEGATE_H__
|
/************************************************************************************
Filename : DebugLines.h
Content : Class that manages and renders debug lines.
Created : April 22, 2014
Authors : Jonathan E. Wright
Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved.
*************************************************************************************/
#if !defined( OVR_DebugLines_h )
#define OVR_DebugLines_h
#include "Kernel/OVR_Math.h"
namespace OVR {
//==============================================================
// OvrDebugLines
class OvrDebugLines
{
public:
virtual ~OvrDebugLines() { }
static OvrDebugLines * Create();
static void Free( OvrDebugLines * & debugLines );
virtual void Init() = 0;
virtual void Shutdown() = 0;
virtual void BeginFrame( const long long frameNum ) = 0;
virtual void Render( Matrix4f const & mvp ) const = 0;
virtual void AddLine( const Vector3f & start, const Vector3f & end,
const Vector4f & startColor, const Vector4f & endColor,
const long long endFrame, const bool depthTest ) = 0;
virtual void AddPoint( const Vector3f & pos, const float size,
const Vector4f & color, const long long endFrame,
const bool depthTest ) = 0;
// Add a debug point without a specified color. The axis lines will use default
// colors: X = red, Y = green, Z = blue (same as Maya).
virtual void AddPoint( const Vector3f & pos, const float size,
const long long endFrame, const bool depthTest ) = 0;
virtual void AddBounds( Posef const & pose, Bounds3f const & bounds, Vector4f const & color ) = 0;
};
} // namespace OVR
#endif // OVR_DebugLines_h
|
#ifndef MANAGED_PAGE_H_
#define MANAGED_PAGE_H_
#include "impl/managed_page.2.hpp"
#endif // MANAGED_PAGE_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.