text stringlengths 4 6.14k |
|---|
// Copyright 2016 The Chromium 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 PRINTING_BACKEND_CUPS_PRINTER_H_
#define PRINTING_BACKEND_CUPS_PRINTER_H_
#include <cups/cups.h>
#include <memory>
#include <string>
#include <vector>
#include "printing/backend/cups_deleters.h"
#include "printing/printing_export.h"
#include "url/gurl.h"
namespace base {
class FilePath;
}
namespace printing {
struct PrinterBasicInfo;
// Provides information regarding cups options.
class PRINTING_EXPORT CupsOptionProvider {
public:
virtual ~CupsOptionProvider() = default;
// Returns the supported ipp attributes for the given |option_name|.
// ipp_attribute_t* is owned by CupsOptionProvider.
virtual ipp_attribute_t* GetSupportedOptionValues(
base::StringPiece option_name) const = 0;
// Returns supported attribute values for |option_name| where the value can be
// convered to a string.
virtual std::vector<base::StringPiece> GetSupportedOptionValueStrings(
base::StringPiece option_name) const = 0;
// Returns the default ipp attributes for the given |option_name|.
// ipp_attribute_t* is owned by CupsOptionProvider.
virtual ipp_attribute_t* GetDefaultOptionValue(
base::StringPiece option_name) const = 0;
// Returns true if the |value| is supported by option |name|.
virtual bool CheckOptionSupported(base::StringPiece name,
base::StringPiece value) const = 0;
};
// Represents a CUPS printer.
// Retrieves information from CUPS printer objects as requested. This class
// is only valid as long as the CupsConnection which created it exists as they
// share an http connection which the CupsConnection closes on destruction.
class PRINTING_EXPORT CupsPrinter : public CupsOptionProvider {
public:
// Create a printer with a connection defined by |http| and |dest|. |info|
// can be null and will be lazily initialized when needed.
CupsPrinter(http_t* http,
std::unique_ptr<cups_dest_t, DestinationDeleter> dest,
std::unique_ptr<cups_dinfo_t, DestInfoDeleter> info);
CupsPrinter(CupsPrinter&& printer);
~CupsPrinter() override;
// Returns true if this is the default printer
bool is_default() const;
// CupsOptionProvider
ipp_attribute_t* GetSupportedOptionValues(
base::StringPiece option_name) const override;
std::vector<base::StringPiece> GetSupportedOptionValueStrings(
base::StringPiece option_name) const override;
ipp_attribute_t* GetDefaultOptionValue(
base::StringPiece option_name) const override;
bool CheckOptionSupported(base::StringPiece name,
base::StringPiece value) const override;
// Returns the file name for the PPD retrieved from the print server.
base::FilePath GetPPD() const;
// Returns the name of the printer as configured in CUPS
std::string GetName() const;
std::string GetMakeAndModel() const;
// Returns true if the printer is currently reachable and working.
bool IsAvailable() const;
// Populates |basic_info| with the relevant information about the printer
bool ToPrinterInfo(PrinterBasicInfo* basic_info) const;
// Start a print job. Writes the id of the started job to |job_id|. |job_id|
// is 0 if there is an error. Check availability before using this operation.
// Usage on an unavailable printer is undefined.
ipp_status_t CreateJob(int* job_id,
base::StringPiece job_title,
const std::vector<cups_option_t>& options);
// Add a document to a print job. |job_id| must be non-zero and refer to a
// job started with CreateJob. |document_name| will be displayed in print
// status. |last_doc| should be true if this is the last document for this
// print job. |options| should be IPP key value pairs for the Send-Document
// operation.
bool StartDocument(int job_id,
base::StringPiece document_name,
bool last_doc,
const std::vector<cups_option_t>& options);
// Add data to the current document started by StartDocument. Calling this
// without a started document will fail.
bool StreamData(const std::vector<char>& buffer);
// Finish the current document. Another document can be added or the job can
// be closed to complete printing.
bool FinishDocument();
// Close the job. If the job is not closed, the documents will not be
// printed. |job_id| should match the id from CreateJob.
ipp_status_t CloseJob(int job_id);
private:
// Lazily initialize dest info as it can require a network call
bool InitializeDestInfo() const;
// http connection owned by the CupsConnection which created this object
http_t* const cups_http_;
// information to identify a printer
std::unique_ptr<cups_dest_t, DestinationDeleter> destination_;
// opaque object containing printer attributes and options
mutable std::unique_ptr<cups_dinfo_t, DestInfoDeleter> dest_info_;
DISALLOW_COPY_AND_ASSIGN(CupsPrinter);
};
} // namespace printing
#endif // PRINTING_BACKEND_CUPS_PRINTER_H_
|
// Copyright 2014 The Chromium 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 CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_
#define CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_member.h"
namespace devtools_http_handler {
class DevToolsHttpHandler;
}
namespace chromecast {
namespace shell {
class CastDevToolsManagerDelegate;
class RemoteDebuggingServer {
public:
explicit RemoteDebuggingServer(bool start_immediately);
~RemoteDebuggingServer();
private:
// Called when pref_enabled_ is changed.
void OnEnabledChanged();
scoped_ptr<devtools_http_handler::DevToolsHttpHandler> devtools_http_handler_;
BooleanPrefMember pref_enabled_;
uint16_t port_;
DISALLOW_COPY_AND_ASSIGN(RemoteDebuggingServer);
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_
|
// Copyright 2015 The Chromium 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 IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__
#define IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/sync_driver/sync_client.h"
namespace autofill {
class AutofillWebDataService;
}
namespace ios {
class ChromeBrowserState;
}
namespace password_manager {
class PasswordStore;
}
namespace sync_driver {
class SyncApiComponentFactory;
class SyncService;
}
class IOSChromeSyncClient : public sync_driver::SyncClient {
public:
explicit IOSChromeSyncClient(ios::ChromeBrowserState* browser_state);
~IOSChromeSyncClient() override;
// SyncClient implementation.
void Initialize() override;
sync_driver::SyncService* GetSyncService() override;
PrefService* GetPrefService() override;
bookmarks::BookmarkModel* GetBookmarkModel() override;
favicon::FaviconService* GetFaviconService() override;
history::HistoryService* GetHistoryService() override;
sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback()
override;
base::Closure GetPasswordStateChangedCallback() override;
sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod
GetRegisterPlatformTypesCallback() override;
autofill::PersonalDataManager* GetPersonalDataManager() override;
invalidation::InvalidationService* GetInvalidationService() override;
BookmarkUndoService* GetBookmarkUndoServiceIfExists() override;
scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() override;
sync_sessions::SyncSessionsClient* GetSyncSessionsClient() override;
base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
syncer::ModelType type) override;
scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup(
syncer::ModelSafeGroup group,
syncer::WorkerLoopDestructionObserver* observer) override;
sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override;
void SetSyncApiComponentFactoryForTesting(
scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory);
private:
void ClearBrowsingData(base::Time start, base::Time end);
ios::ChromeBrowserState* const browser_state_;
// The sync api component factory in use by this client.
scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory_;
// Members that must be fetched on the UI thread but accessed on their
// respective backend threads.
scoped_refptr<autofill::AutofillWebDataService> web_data_service_;
scoped_refptr<password_manager::PasswordStore> password_store_;
scoped_ptr<sync_sessions::SyncSessionsClient> sync_sessions_client_;
const scoped_refptr<syncer::ExtensionsActivity> dummy_extensions_activity_;
base::WeakPtrFactory<IOSChromeSyncClient> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(IOSChromeSyncClient);
};
#endif // IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__
|
/* Write a Program detab,which replaces tabs in the input with a proper
number of blanks to spaces */
#include<stdio.h>
#define TABINC 8
int main(void)
{
int nb,pos,c;
nb = 0;
pos = 1;
while((c=getchar())!=EOF)
{
if( c == '\t')
{
nb = TABINC - (( pos - 1) % TABINC);
while( nb > 0)
{
putchar('#');
++pos;
--nb;
}
}
else if( c == '\n')
{
putchar(c);
pos = 1;
}
else
{
putchar(c);
++pos;
}
}
return 0;
}
|
#ifndef ERBGENERATOR_H
#define ERBGENERATOR_H
#include <QStringList>
#include <QDir>
#include <QPair>
#include <QVariant>
class ErbGenerator
{
public:
ErbGenerator(const QString &view, const QList<QPair<QString, QVariant::Type>> &fields, int pkIdx, int autoValIdx);
bool generate(const QString &dstDir) const;
private:
QString viewName;
QList<QPair<QString, QVariant::Type>> fieldList;
int primaryKeyIndex;
int autoValueIndex;
};
#endif // ERBGENERATOR_H
|
// Copyright 2021 The Chromium 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 CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TEST_HELPER_H_
#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TEST_HELPER_H_
#include <memory>
#include <string>
#include <vector>
class KeyedService;
class Profile;
namespace base {
struct Feature;
} // namespace base
namespace content {
class BrowserContext;
class FakeSpeechRecognitionManager;
} // namespace content
namespace speech {
class FakeSpeechRecognitionService;
enum class SpeechRecognitionType;
} // namespace speech
// This class provides on-device and network speech recognition test
// infrastructure. Test classes can use this one to easily interact with
// speech recognizers. For example:
//
// SpeechRecognitionTestHelper* test_helper_ = ...;
// SpeechRecognizer* recognizer->Start();
// test_helper_->WaitForRecognitionStarted();
// ... Continue with test ...
//
// For examples, please see SpeechRecognitionPrivateBaseTest or
// DictationBaseTest.
class SpeechRecognitionTestHelper {
public:
explicit SpeechRecognitionTestHelper(speech::SpeechRecognitionType type);
~SpeechRecognitionTestHelper();
SpeechRecognitionTestHelper(const SpeechRecognitionTestHelper&) = delete;
SpeechRecognitionTestHelper& operator=(const SpeechRecognitionTestHelper&) =
delete;
// Sets up either on-device or network speech recognition.
void SetUp(Profile* profile);
// Waits for the speech recognition service to start.
void WaitForRecognitionStarted();
// Waits for the speech recognition service to stop.
void WaitForRecognitionStopped();
// Sends a fake speech result and waits for tasks to finish.
void SendFakeSpeechResultAndWait(const std::string& transcript,
bool is_final);
// Similar to above, but ensures that `is_final` is true.
void SendFinalFakeSpeechResultAndWait(const std::string& transcript);
// Sends a fake speech recognition error and waits for tasks to finish.
void SendFakeSpeechRecognitionErrorAndWait();
// Returns a list of features that should be enabled.
std::vector<base::Feature> GetEnabledFeatures();
// Returns a list of features that should be disabled.
std::vector<base::Feature> GetDisabledFeatures();
private:
// Methods for setup.
void SetUpNetworkRecognition();
void SetUpOnDeviceRecognition(Profile* profile);
std::unique_ptr<KeyedService> CreateTestOnDeviceSpeechRecognitionService(
content::BrowserContext* context);
speech::SpeechRecognitionType type_;
// For network recognition.
std::unique_ptr<content::FakeSpeechRecognitionManager>
fake_speech_recognition_manager_;
// For on-device recognition. KeyedService owned by the test profile.
speech::FakeSpeechRecognitionService* fake_service_;
};
#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TEST_HELPER_H_
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_
#define V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_
#include <deque>
#include "src/compiler/instruction-selector.h"
#include "src/compiler/raw-machine-assembler.h"
#include "test/compiler-unittests/compiler-unittests.h"
namespace v8 {
namespace internal {
namespace compiler {
class InstructionSelectorTest : public CompilerTest {
public:
InstructionSelectorTest() {}
virtual ~InstructionSelectorTest() {}
protected:
class Stream;
enum StreamBuilderMode { kAllInstructions, kTargetInstructions };
class StreamBuilder V8_FINAL : public RawMachineAssembler {
public:
StreamBuilder(InstructionSelectorTest* test, MachineType return_type)
: RawMachineAssembler(new (test->zone()) Graph(test->zone()),
CallDescriptorBuilder(test->zone(), return_type)),
test_(test) {}
StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
MachineType parameter0_type)
: RawMachineAssembler(new (test->zone()) Graph(test->zone()),
CallDescriptorBuilder(test->zone(), return_type,
parameter0_type)),
test_(test) {}
StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
MachineType parameter0_type, MachineType parameter1_type)
: RawMachineAssembler(
new (test->zone()) Graph(test->zone()),
CallDescriptorBuilder(test->zone(), return_type, parameter0_type,
parameter1_type)),
test_(test) {}
Stream Build(CpuFeature feature) {
return Build(InstructionSelector::Features(feature));
}
Stream Build(CpuFeature feature1, CpuFeature feature2) {
return Build(InstructionSelector::Features(feature1, feature2));
}
Stream Build(StreamBuilderMode mode = kTargetInstructions) {
return Build(InstructionSelector::Features(), mode);
}
Stream Build(InstructionSelector::Features features,
StreamBuilderMode mode = kTargetInstructions);
private:
MachineCallDescriptorBuilder* CallDescriptorBuilder(
Zone* zone, MachineType return_type) {
return new (zone) MachineCallDescriptorBuilder(return_type, 0, NULL);
}
MachineCallDescriptorBuilder* CallDescriptorBuilder(
Zone* zone, MachineType return_type, MachineType parameter0_type) {
MachineType* parameter_types = zone->NewArray<MachineType>(1);
parameter_types[0] = parameter0_type;
return new (zone)
MachineCallDescriptorBuilder(return_type, 1, parameter_types);
}
MachineCallDescriptorBuilder* CallDescriptorBuilder(
Zone* zone, MachineType return_type, MachineType parameter0_type,
MachineType parameter1_type) {
MachineType* parameter_types = zone->NewArray<MachineType>(2);
parameter_types[0] = parameter0_type;
parameter_types[1] = parameter1_type;
return new (zone)
MachineCallDescriptorBuilder(return_type, 2, parameter_types);
}
private:
InstructionSelectorTest* test_;
};
class Stream V8_FINAL {
public:
size_t size() const { return instructions_.size(); }
const Instruction* operator[](size_t index) const {
EXPECT_LT(index, size());
return instructions_[index];
}
int32_t ToInt32(const InstructionOperand* operand) const {
return ToConstant(operand).ToInt32();
}
private:
Constant ToConstant(const InstructionOperand* operand) const {
ConstantMap::const_iterator i;
if (operand->IsConstant()) {
i = constants_.find(operand->index());
EXPECT_NE(constants_.end(), i);
} else {
EXPECT_EQ(InstructionOperand::IMMEDIATE, operand->kind());
i = immediates_.find(operand->index());
EXPECT_NE(immediates_.end(), i);
}
EXPECT_EQ(operand->index(), i->first);
return i->second;
}
friend class StreamBuilder;
typedef std::map<int, Constant> ConstantMap;
ConstantMap constants_;
ConstantMap immediates_;
std::deque<Instruction*> instructions_;
};
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_
|
/*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2013-2014 Cocos2D Authors
*
* 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 "../../ccMacros.h"
#ifdef __CC_PLATFORM_IOS
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CCDirectorIOS.h"
NSString* const CCSetupPixelFormat;
NSString* const CCSetupScreenMode;
NSString* const CCSetupScreenOrientation;
NSString* const CCSetupAnimationInterval;
NSString* const CCSetupFixedUpdateInterval;
NSString* const CCSetupShowDebugStats;
NSString* const CCSetupTabletScale2X;
// Landscape screen orientation. Used with CCSetupScreenOrientation.
NSString* const CCScreenOrientationLandscape;
// Portrait screen orientation. Used with CCSetupScreenOrientation.
NSString* const CCScreenOrientationPortrait;
// The flexible screen mode is Cocos2d's default. It will give you an area that can vary slightly in size. In landscape mode the height will be 320 points for mobiles and 384 points for tablets. The width of the area can vary from 480 to 568 points.
NSString* const CCScreenModeFlexible;
// The fixed screen mode will setup the working area to be 568 x 384 points. Depending on the device, the outer edges may be cropped. The safe area, that will be displayed on all sorts of devices, is 480 x 320 points and placed in the center of the working area.
NSString* const CCScreenModeFixed;
@class CCAppDelegate;
@class CCScene;
@interface CCNavigationController : UINavigationController <CCDirectorDelegate> {
}
@end
/**
* Most Cocos2d apps should override the CCAppDelegate, it serves as the apps starting point. By the very least, the startScene method should be overridden to return the first scene the app should display. To further customize the behavior of Cocos2d, such as the screen mode of pixel format, override the applicaton:didFinishLaunchingWithOptions: method.
*/
@interface CCAppDelegate : NSObject <UIApplicationDelegate, CCDirectorDelegate>
{
UIWindow *window_;
CCNavigationController *navController_;
}
// -----------------------------------------------------------------------
/** @name Accessing Window and Navigation Controller */
// -----------------------------------------------------------------------
/**
* The window used to display the Cocos2d content.
*/
@property (nonatomic, strong) UIWindow *window;
/**
* The navigation controller that Cocos2d is using.
*/
@property (atomic, readonly) CCNavigationController *navController;
// -----------------------------------------------------------------------
/** @name Setting Up the Start Scene */
// -----------------------------------------------------------------------
/**
* Override this method to return the first scene that Cocos2d should display.
*
* @return Starting scene for your app.
*/
- (CCScene*) startScene;
// -----------------------------------------------------------------------
/** @name Cocos2d Configuration */
// -----------------------------------------------------------------------
/**
* This method is normally called from the applicaton:didFinishLaunchingWithOptions: method. It will configure Cocos2d with the options that you provide. You can leave out any of the options and Cocos2d will use the default values.
*
* Currently supported keys for the configuration dictionary are:
*
* - CCSetupPixelFormat NSString with the pixel format, normally kEAGLColorFormatRGBA8 or kEAGLColorFormatRGB565. The RGB565 option is faster, but will allow less colors.
* - CCSetupScreenMode NSString value that accepts either CCScreenModeFlexible or CCScreenModeFixed.
* - CCSetupScreenOrientation NSString value that accepts either CCScreenOrientationLandscape or CCScreenOrientationPortrait.
* - CCSetupAnimationInterval NSNumber with double. Specifies the desired interval between animation frames. Supported values are 1.0/60.0 (default) and 1.0/30.0.
* - CCSetupFixedUpdateInterval NSNumber with double. Specifies the desired interval between fixed updates.Should be smaller than CCSetupAnimationInterval. Defaults to 1/60.0.
* - CCSetupShowDebugStats NSNumber with bool. Specifies if the stats (FPS, frame time and draw call count) should be shown. Defaults to NO.
* - CCSetupTabletScale2X NSNumber with bool. If true, the iPad will be setup to act like it has a 512x384 "retina" screen. This makes it much easier to make universal iOS games. This value is ignored when using the fixed screen mode.
*
* @param config Dictionary with options for configuring Cocos2d.
*/
- (void) setupCocos2dWithOptions:(NSDictionary*)config;
@end
#endif
|
/// \file
/// \brief A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet.
///
/// This file is part of RakNet Copyright 2003 Jenkins Software LLC
///
/// Usage of RakNet is subject to the appropriate license agreement.
#include "NativeFeatureIncludes.h"
#if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
#ifndef __PACKETIZED_TCP
#define __PACKETIZED_TCP
#include "TCPInterface.h"
#include "DS_ByteQueue.h"
#include "DS_Map.h"
namespace RakNet
{
class RAK_DLL_EXPORT PacketizedTCP : public TCPInterface
{
public:
// GetInstance() and DestroyInstance(instance*)
STATIC_FACTORY_DECLARATIONS(PacketizedTCP)
PacketizedTCP();
virtual ~PacketizedTCP();
/// Stops the TCP server
void Stop(void);
/// Sends a byte stream
void Send( const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast );
// Sends a concatenated list of byte streams
bool SendList( const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast );
/// Returns data received
Packet* Receive( void );
/// Disconnects a player/address
void CloseConnection( SystemAddress systemAddress );
/// Has a previous call to connect succeeded?
/// \return UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress HasCompletedConnectionAttempt(void);
/// Has a previous call to connect failed?
/// \return UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress HasFailedConnectionAttempt(void);
/// Queued events of new incoming connections
SystemAddress HasNewIncomingConnection(void);
/// Queued events of lost connections
SystemAddress HasLostConnection(void);
protected:
void ClearAllConnections(void);
void RemoveFromConnectionList(const SystemAddress &sa);
void AddToConnectionList(const SystemAddress &sa);
void PushNotificationsToQueues(void);
Packet *ReturnOutgoingPacket(void);
// A single TCP recieve may generate multiple split packets. They are stored in the waitingPackets list until Receive is called
DataStructures::Queue<Packet*> waitingPackets;
DataStructures::Map<SystemAddress, DataStructures::ByteQueue *> connections;
// Mirrors single producer / consumer, but processes them in Receive() before returning to user
DataStructures::Queue<SystemAddress> _newIncomingConnections, _lostConnections, _failedConnectionAttempts, _completedConnectionAttempts;
};
} // namespace RakNet
#endif
#endif // _RAKNET_SUPPORT_*
|
/* This file is part of the KDE project
@@COPYRIGHT@@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KCHART_TESTLOADING_H_ME07_PERCENTAGE_STACKED_BAR_CHART
#define KCHART_TESTLOADING_H_ME07_PERCENTAGE_STACKED_BAR_CHART
#include "../TestLoadingBase.h"
#include <QStandardItemModel>
namespace KChart {
class TestLoading : public TestLoadingBase
{
Q_OBJECT
public:
TestLoading();
private slots:
void initTestCase();
void testInternalTable();
void testDataSets();
void testLegend();
private:
/// Faked data model of sheet embedding this chart
QStandardItemModel m_sheet;
};
} // namespace KChart
#endif // KCHART_TESTLOADING_H_ME07_PERCENTAGE_STACKED_BAR_CHART
|
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
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 Street, Fifth Floor, Boston, MA 02110-1335 USA
*/
#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
#include <mruby/class.h>
#include <mruby/data.h>
#include <mruby/variable.h>
#include <mruby/string.h>
#include "../grn_mrb.h"
#include "mrb_query_logger.h"
static mrb_value
query_logger_need_log_p(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
mrb_int flag;
mrb_get_args(mrb, "i", &flag);
return mrb_bool_value(grn_query_logger_pass(ctx, flag));
}
static mrb_value
query_logger_log_raw(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
mrb_int flag;
char *mark;
char *message;
mrb_int message_size;
mrb_get_args(mrb, "izs", &flag, &mark, &message, &message_size);
grn_query_logger_put(ctx, flag, mark,
"%.*s", (int)message_size, message);
return self;
}
void
grn_mrb_query_logger_init(grn_ctx *ctx)
{
grn_mrb_data *data = &(ctx->impl->mrb);
mrb_state *mrb = data->state;
struct RClass *module = data->module;
struct RClass *klass;
klass = mrb_define_class_under(mrb, module, "QueryLogger", mrb->object_class);
mrb_define_method(mrb, klass, "need_log?", query_logger_need_log_p,
MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "log_raw", query_logger_log_raw,
MRB_ARGS_REQ(3));
grn_mrb_load(ctx, "query_logger/flag.rb");
grn_mrb_load(ctx, "query_logger.rb");
}
#endif
|
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#ifndef MT9V113_H
#define MT9V113_H
#include <linux/types.h>
#include <mach/camera.h>
/* Enum Type for different ISO Mode supported */
enum mt9v113_iso_value {
CAMERA_ISO_AUTO = 0,
CAMERA_ISO_DEBLUR,
CAMERA_ISO_100,
CAMERA_ISO_200,
CAMERA_ISO_400,
CAMERA_ISO_MAX
};
extern struct mt9v113_reg mt9v113_regs;
enum mt9v113_width {
BYTE_LEN,
WORD_LEN,
};
struct mt9v113_i2c_reg_conf {
unsigned short waddr;
unsigned short wdata;
};
struct mt9v113_reg {
struct mt9v113_i2c_reg_conf const *init_tbl;
uint16_t inittbl_size;
struct mt9v113_i2c_reg_conf const *init_tbl1;
uint16_t inittbl1_size;
struct mt9v113_i2c_reg_conf const *init_tbl2;
uint16_t inittbl2_size;
// Effect
struct mt9v113_i2c_reg_conf const *effect_default_tbl;
uint16_t effect_default_tbl_size;
struct mt9v113_i2c_reg_conf const *effect_mono_tbl;
uint16_t effect_mono_tbl_size;
struct mt9v113_i2c_reg_conf const *effect_sepia_tbl;
uint16_t effect_sepia_tbl_size;
struct mt9v113_i2c_reg_conf const *effect_aqua_tbl;
uint16_t effect_aqua_tbl_size;
struct mt9v113_i2c_reg_conf const *effect_negative_tbl;
uint16_t effect_negative_tbl_size;
struct mt9v113_i2c_reg_conf const *effect_solarization_tbl;
uint16_t effect_solarization_tbl_size;
// White balance
struct mt9v113_i2c_reg_conf const *wb_default_tbl;
uint16_t wb_default_tbl_size;
struct mt9v113_i2c_reg_conf const *wb_sunny_tbl;
uint16_t wb_sunny_tbl_size;
struct mt9v113_i2c_reg_conf const *wb_cloudy_tbl;
uint16_t wb_cloudy_tbl_size;
struct mt9v113_i2c_reg_conf const *wb_fluorescent_tbl;
uint16_t wb_fluorescent_tbl_size;
struct mt9v113_i2c_reg_conf const *wb_incandescent_tbl;
uint16_t wb_incandescent_tbl_size;
// ISO
struct mt9v113_i2c_reg_conf const *iso_default_tbl;
uint16_t iso_default_tbl_size;
struct mt9v113_i2c_reg_conf const *iso_160_tbl;
uint16_t iso_160_tbl_size;
struct mt9v113_i2c_reg_conf const *iso_200_tbl;
uint16_t iso_200_tbl_size;
struct mt9v113_i2c_reg_conf const *iso_400_tbl;
uint16_t iso_400_tbl_size;
// FPS
struct mt9v113_i2c_reg_conf const *fps_fixed_15_tbl;
uint16_t fps_fixed_15_tbl_size;
struct mt9v113_i2c_reg_conf const *fps_fixed_30_tbl;
uint16_t fps_fixed_30_tbl_size;
struct mt9v113_i2c_reg_conf const *fps_auto_1030_tbl;
uint16_t fps_auto_1030_tbl_size;
struct mt9v113_i2c_reg_conf const *fps_auto_730_tbl;
uint16_t fps_auto_730_tbl_size;
// Change-config
struct mt9v113_i2c_reg_conf const *change_config_tbl;
uint16_t change_config_tbl_size;
};
#endif /* MT9V113_H */
|
/*-------------------------------------------------------------------------
SDCCsystem - SDCC system & pipe functions
Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
#ifndef SDCCSYSTEM_H
#define SDCCSYSTEM_H
#include <stdio.h>
#include "SDCCset.h"
extern set *binPathSet; /* set of binary paths */
int sdcc_system (const char *cmd);
FILE *sdcc_popen (const char *cmd);
int sdcc_pclose (FILE *fp);
#endif
|
/*
* ADI-AIM ADC Interface Module
*
* Copyright 2012 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include "../iio.h"
#include "../sysfs.h"
#include "../buffer.h"
#include "../ring_hw.h"
#include "cf_ad9467.h"
#include "cf_fft_core.h"
static int aim_read_first_n_hw_rb(struct iio_buffer *r,
size_t count, char __user *buf)
{
struct iio_hw_buffer *hw_ring = iio_to_hw_buf(r);
struct iio_dev *indio_dev = hw_ring->private;
struct aim_state *st = iio_priv(indio_dev);
int ret;
unsigned stat, dma_stat;
mutex_lock(&st->lock);
ret = wait_for_completion_interruptible_timeout(&st->dma_complete,
4 * HZ);
stat = aim_read(st, AD9467_PCORE_ADC_STAT);
dma_stat = aim_read(st, AD9467_PCORE_DMA_STAT);
if (st->compl_stat < 0) {
ret = st->compl_stat;
goto error_ret;
} else if (ret == 0) {
ret = -ETIMEDOUT;
dev_err(indio_dev->dev.parent,
"timeout: DMA_STAT 0x%X, ADC_STAT 0x%X\n",
dma_stat, stat);
goto error_ret;
} else if (ret < 0) {
goto error_ret;
}
#if defined(CONFIG_CF_FFT)
if (st->fftcount) {
ret = fft_calculate(st->buf_phys, st->buf_phys + st->fftcount, st->fftcount / 4);
}
#endif
if (copy_to_user(buf, st->buf_virt + st->fftcount, count))
ret = -EFAULT;
if ((stat & AD9467_PCORE_ADC_STAT_OVR) || dma_stat)
dev_warn(indio_dev->dev.parent,
"STATUS: DMA_STAT 0x%X, ADC_STAT 0x%X\n",
dma_stat, stat);
error_ret:
r->stufftoread = 0;
mutex_unlock(&st->lock);
return ret < 0 ? ret : count;
}
static int aim_ring_get_length(struct iio_buffer *r)
{
struct iio_hw_buffer *hw_ring = iio_to_hw_buf(r);
struct iio_dev *indio_dev = hw_ring->private;
struct aim_state *st = iio_priv(indio_dev);
return st->ring_lenght;
}
static int aim_ring_set_length(struct iio_buffer *r, int lenght)
{
struct iio_hw_buffer *hw_ring = iio_to_hw_buf(r);
struct aim_state *st = iio_priv(hw_ring->private);
st->ring_lenght = lenght;
return 0;
}
static int aim_ring_get_bytes_per_datum(struct iio_buffer *r)
{
struct iio_hw_buffer *hw_ring = iio_to_hw_buf(r);
struct aim_state *st = iio_priv(hw_ring->private);
return st->bytes_per_datum;
}
static IIO_BUFFER_ENABLE_ATTR;
static IIO_BUFFER_LENGTH_ATTR;
static struct attribute *aim_ring_attributes[] = {
&dev_attr_length.attr,
&dev_attr_enable.attr,
NULL,
};
static struct attribute_group aim_ring_attr = {
.attrs = aim_ring_attributes,
.name = "buffer",
};
static struct iio_buffer *aim_rb_allocate(struct iio_dev *indio_dev)
{
struct iio_buffer *buf;
struct iio_hw_buffer *ring;
ring = kzalloc(sizeof *ring, GFP_KERNEL);
if (!ring)
return NULL;
ring->private = indio_dev;
buf = &ring->buf;
buf->attrs = &aim_ring_attr;
iio_buffer_init(buf);
return buf;
}
static inline void aim_rb_free(struct iio_buffer *r)
{
kfree(iio_to_hw_buf(r));
}
static const struct iio_buffer_access_funcs aim_ring_access_funcs = {
.read_first_n = &aim_read_first_n_hw_rb,
.get_length = &aim_ring_get_length,
.set_length = &aim_ring_set_length,
.get_bytes_per_datum = &aim_ring_get_bytes_per_datum,
};
static int __aim_hw_ring_state_set(struct iio_dev *indio_dev, bool state)
{
struct aim_state *st = iio_priv(indio_dev);
struct dma_async_tx_descriptor *desc;
dma_cookie_t cookie;
int ret = 0;
if (!state) {
if (!completion_done(&st->dma_complete)) {
st->compl_stat = -EPERM;
dmaengine_terminate_all(st->rx_chan);
complete(&st->dma_complete);
}
dma_free_coherent(indio_dev->dev.parent,
PAGE_ALIGN(st->rcount + st->fftcount),
st->buf_virt, st->buf_phys);
return 0;
}
st->compl_stat = 0;
if (st->ring_lenght == 0) {
ret = -EINVAL;
goto error_ret;
}
if (st->ring_lenght % 8)
st->rcount = (st->ring_lenght + 8) & 0xFFFFFFF8;
else
st->rcount = st->ring_lenght;
#if defined(CONFIG_CF_FFT)
st->fftcount = st->rcount;
#else
st->fftcount = 0;
#endif
st->buf_virt = dma_alloc_coherent(indio_dev->dev.parent,
PAGE_ALIGN(st->rcount + st->fftcount), &st->buf_phys,
GFP_KERNEL);
if (st->buf_virt == NULL) {
ret = -ENOMEM;
goto error_ret;
}
desc = dmaengine_prep_slave_single(st->rx_chan, st->buf_phys, st->rcount,
DMA_FROM_DEVICE, DMA_PREP_INTERRUPT);
if (!desc) {
dev_err(indio_dev->dev.parent,
"Failed to allocate a dma descriptor\n");
ret = -ENOMEM;
goto error_free;
}
desc->callback = (dma_async_tx_callback) complete;
desc->callback_param = &st->dma_complete;
cookie = dmaengine_submit(desc);
if (cookie < 0) {
dev_err(indio_dev->dev.parent,
"Failed to submit a dma transfer\n");
ret = cookie;
goto error_free;
}
INIT_COMPLETION(st->dma_complete);
dma_async_issue_pending(st->rx_chan);
aim_write(st, AD9467_PCORE_DMA_CTRL, 0);
aim_write(st, AD9467_PCORE_ADC_STAT, 0xFF);
aim_write(st, AD9467_PCORE_DMA_STAT, 0xFF);
aim_write(st, AD9467_PCORE_DMA_CTRL,
AD9647_DMA_CAP_EN | AD9647_DMA_CNT((st->rcount / 8) - 1));
return 0;
error_free:
dma_free_coherent(indio_dev->dev.parent, PAGE_ALIGN(st->rcount),
st->buf_virt, st->buf_phys);
error_ret:
return ret;
}
static int aim_hw_ring_preenable(struct iio_dev *indio_dev)
{
return __aim_hw_ring_state_set(indio_dev, 1);
}
static int aim_hw_ring_postdisable(struct iio_dev *indio_dev)
{
return __aim_hw_ring_state_set(indio_dev, 0);
}
static const struct iio_buffer_setup_ops aim_ring_setup_ops = {
.preenable = &aim_hw_ring_preenable,
.postdisable = &aim_hw_ring_postdisable,
};
int aim_configure_ring(struct iio_dev *indio_dev)
{
indio_dev->buffer = aim_rb_allocate(indio_dev);
if (indio_dev->buffer == NULL)
return -ENOMEM;
indio_dev->modes |= INDIO_BUFFER_HARDWARE;
indio_dev->buffer->access = &aim_ring_access_funcs;
indio_dev->setup_ops = &aim_ring_setup_ops;
return 0;
}
void aim_unconfigure_ring(struct iio_dev *indio_dev)
{
aim_rb_free(indio_dev->buffer);
}
|
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific LED driver header for the Tempusdictum Benito.
* \copydetails Group_LEDs_BENITO
*
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
*/
/** \ingroup Group_LEDs
* \defgroup Group_LEDs_BENITO BENITO
* \brief Board specific LED driver header for the Tempusdictum Benito.
*
* Board specific LED driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito).
*
* @{
*/
#ifndef __LEDS_BENITO_H__
#define __LEDS_BENITO_H__
/* Includes: */
#include "../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 (1 << 7)
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 6)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2)
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
DDRC |= LEDS_ALL_LEDS;
PORTC |= LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTC &= ~LEDMask;
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
PORTC |= LEDMask;
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
PORTC = ((PORTC | LEDS_ALL_LEDS) & ~LEDMask);
}
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTC = ((PORTC | LEDMask) & ~ActiveMask);
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTC ^= LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return (PORTC & LEDS_ALL_LEDS);
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */
|
/*
*
* Copyright 2009-2016, LabN Consulting, L.L.C.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_
#define _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_
#include "lib/zebra.h"
#include "lib/prefix.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
#define VALID_INTERIOR_TYPE(type) \
(((type) == ZEBRA_ROUTE_BGP) || ((type) == ZEBRA_ROUTE_BGP_DIRECT))
extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer);
extern int vnc_prefix_cmp(const void *pfx1, const void *pfx2);
extern void vnc_import_bgp_add_route(struct bgp *bgp,
const struct prefix *prefix,
struct bgp_path_info *info);
extern void vnc_import_bgp_del_route(struct bgp *bgp,
const struct prefix *prefix,
struct bgp_path_info *info);
extern void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_exterior_redist_enable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_exterior_add_route(
struct bgp *bgp, /* exterior instance, we hope */
const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info); /* unicast info */
extern void vnc_import_bgp_exterior_del_route(
struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info); /* unicast info */
extern void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi); /* new VPN host route */
extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi); /* old VPN host route */
#endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */
|
/*
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _WIN32
#ifndef _WIN32_SERVICE_
#define _WIN32_SERVICE_
bool WinServiceInstall();
bool WinServiceUninstall();
bool WinServiceRun();
#endif // _WIN32_SERVICE_
#endif // _WIN32
|
/* $Id: exitcodes.h,v 1.7 2005/08/31 17:36:11 kloczek Exp $ */
/*
* Exit codes used by shadow programs
*/
#define E_SUCCESS 0 /* success */
#define E_NOPERM 1 /* permission denied */
#define E_USAGE 2 /* invalid command syntax */
#define E_BAD_ARG 3 /* invalid argument to option */
#define E_PASSWD_NOTFOUND 14 /* not found password file */
#define E_SHADOW_NOTFOUND 15 /* not found shadow password file */
#define E_GROUP_NOTFOUND 16 /* not found group file */
#define E_GSHADOW_NOTFOUND 17 /* not found shadow group file */
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SCUMM_IMUSE_INSTRUMENT_H
#define SCUMM_IMUSE_INSTRUMENT_H
#include "common/scummsys.h"
class MidiChannel;
namespace Scumm {
class Serializer;
class Instrument;
class InstrumentInternal {
public:
virtual ~InstrumentInternal() {}
virtual void saveOrLoad(Serializer *s) = 0;
virtual void send(MidiChannel *mc) = 0;
virtual void copy_to(Instrument *dest) = 0;
virtual bool is_valid() = 0;
};
class Instrument {
private:
byte _type;
InstrumentInternal *_instrument;
public:
enum {
itNone = 0,
itProgram = 1,
itAdLib = 2,
itRoland = 3,
itPcSpk = 4,
itMacSfx = 5
};
Instrument() : _type(0), _instrument(0) { }
~Instrument() { delete _instrument; }
static void nativeMT32(bool native);
static const byte _gmRhythmMap[35];
void clear();
void copy_to(Instrument *dest) {
if (_instrument)
_instrument->copy_to(dest);
else
dest->clear();
}
void program(byte program, bool mt32);
void adlib(const byte *instrument);
void roland(const byte *instrument);
void pcspk(const byte *instrument);
void macSfx(byte program);
byte getType() { return _type; }
bool isValid() { return (_instrument ? _instrument->is_valid() : false); }
void saveOrLoad(Serializer *s);
void send(MidiChannel *mc) {
if (_instrument)
_instrument->send(mc);
}
};
} // End of namespace Scumm
#endif
|
/*
* linux/arch/arm/mach-at91/board-csb337.c
*
* Copyright (C) 2005 SAN People
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/mtd/physmap.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h"
/*
* Serial port configuration.
* 0 .. 3 = USART0 .. USART3
* 4 = DBGU
*/
static struct at91_uart_config __initdata csb337_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init csb337_map_io(void)
{
/* Initialize processor: 3.6864 MHz crystal */
at91rm9200_initialize(3686400, AT91RM9200_BGA);
/* Setup the LEDs */
at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
/* Setup the serial ports and console */
at91_init_serial(&csb337_uart_config);
}
static void __init csb337_init_irq(void)
{
at91rm9200_init_interrupts(NULL);
}
static struct at91_eth_data __initdata csb337_eth_data = {
.phy_irq_pin = AT91_PIN_PC2,
.is_rmii = 0,
};
static struct at91_usbh_data __initdata csb337_usbh_data = {
.ports = 2,
};
static struct at91_udc_data __initdata csb337_udc_data = {
// this has no VBUS sensing pin
.pullup_pin = AT91_PIN_PA24,
};
static struct i2c_board_info __initdata csb337_i2c_devices[] = {
{ I2C_BOARD_INFO("rtc-ds1307", 0x68),
.type = "ds1307",
},
};
static struct at91_cf_data __initdata csb337_cf_data = {
/*
* connector P4 on the CSB 337 mates to
* connector P8 on the CSB 300CF
*/
/* CSB337 specific */
.det_pin = AT91_PIN_PC3,
/* CSB300CF specific */
.irq_pin = AT91_PIN_PA19,
.vcc_pin = AT91_PIN_PD0,
.rst_pin = AT91_PIN_PD2,
};
static struct at91_mmc_data __initdata csb337_mmc_data = {
.det_pin = AT91_PIN_PD5,
.slot_b = 0,
.wire4 = 1,
.wp_pin = AT91_PIN_PD6,
};
static struct spi_board_info csb337_spi_devices[] = {
{ /* CAN controller */
.modalias = "sak82c900",
.chip_select = 0,
.max_speed_hz = 6 * 1000 * 1000,
},
};
#define CSB_FLASH_BASE AT91_CHIPSELECT_0
#define CSB_FLASH_SIZE 0x800000
static struct mtd_partition csb_flash_partitions[] = {
{
.name = "uMON flash",
.offset = 0,
.size = MTDPART_SIZ_FULL,
.mask_flags = MTD_WRITEABLE, /* read only */
}
};
static struct physmap_flash_data csb_flash_data = {
.width = 2,
.parts = csb_flash_partitions,
.nr_parts = ARRAY_SIZE(csb_flash_partitions),
};
static struct resource csb_flash_resources[] = {
{
.start = CSB_FLASH_BASE,
.end = CSB_FLASH_BASE + CSB_FLASH_SIZE - 1,
.flags = IORESOURCE_MEM,
}
};
static struct platform_device csb_flash = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &csb_flash_data,
},
.resource = csb_flash_resources,
.num_resources = ARRAY_SIZE(csb_flash_resources),
};
static void __init csb337_board_init(void)
{
/* Serial */
at91_add_device_serial();
/* Ethernet */
at91_add_device_eth(&csb337_eth_data);
/* USB Host */
at91_add_device_usbh(&csb337_usbh_data);
/* USB Device */
at91_add_device_udc(&csb337_udc_data);
/* I2C */
at91_add_device_i2c();
i2c_register_board_info(0, csb337_i2c_devices,
ARRAY_SIZE(csb337_i2c_devices));
/* Compact Flash */
at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
at91_add_device_cf(&csb337_cf_data);
/* SPI */
at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
/* MMC */
at91_add_device_mmc(0, &csb337_mmc_data);
/* NOR flash */
platform_device_register(&csb_flash);
}
MACHINE_START(CSB337, "Cogent CSB337")
/* Maintainer: Bill Gatliff */
.phys_io = AT91_BASE_SYS,
.io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
.boot_params = AT91_SDRAM_BASE + 0x100,
.timer = &at91rm9200_timer,
.map_io = csb337_map_io,
.init_irq = csb337_init_irq,
.init_machine = csb337_board_init,
MACHINE_END
|
/*
* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#define CONFIG_SYS_NS16550_COM1 NV_ADDRESS_MAP_APB_UARTB_BASE
|
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* 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 disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* \par Purpose
*
* Configuration and handling of interrupts on PIO status changes. The API
* provided here have several advantages over the traditional PIO interrupt
* configuration approach:
* - It is highly portable
* - It automatically demultiplexes interrupts when multiples pins have been
* configured on a single PIO controller
* - It allows a group of pins to share the same interrupt
*
* However, it also has several minor drawbacks that may prevent from using it
* in particular applications:
* - It enables the clocks of all PIO controllers
* - PIO controllers all share the same interrupt handler, which does the
* demultiplexing and can be slower than direct configuration
* - It reserves space for a fixed number of interrupts, which can be
* increased by modifying the appropriate constant in pio_it.c.
*
* \par Usage
*
* -# Initialize the PIO interrupt mechanism using PIO_InitializeInterrupts()
* with the desired priority (0 ... 7).
* -# Configure a status change interrupt on one or more pin(s) with
* PIO_ConfigureIt().
* -# Enable & disable interrupts on pins using PIO_EnableIt() and
* PIO_DisableIt().
*/
#ifndef _PIO_IT_
#define _PIO_IT_
/*
* Headers
*/
#include "pio.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Global functions
*/
extern void PIO_InitializeInterrupts( uint32_t dwPriority ) ;
extern void PIO_ConfigureIt( const Pin *pPin, void (*handler)( const Pin* ) ) ;
extern void PIO_EnableIt( const Pin *pPin ) ;
extern void PIO_DisableIt( const Pin *pPin ) ;
extern void PIO_IT_InterruptHandler( void ) ;
extern void PioInterruptHandler( uint32_t id, Pio *pPio ) ;
extern void PIO_CaptureHandler( void ) ;
#ifdef __cplusplus
}
#endif
#endif /* #ifndef _PIO_IT_ */
|
/*
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* 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 ImageDocument_h
#define ImageDocument_h
#include "HTMLDocument.h"
namespace WebCore {
class CachedImage;
class ImageDocumentElement;
class ImageDocument : public HTMLDocument {
public:
static PassRefPtr<ImageDocument> create(Frame* frame, const KURL& url)
{
return adoptRef(new ImageDocument(frame, url));
}
CachedImage* cachedImage();
ImageDocumentElement* imageElement() const { return m_imageElement; }
void disconnectImageElement() { m_imageElement = 0; }
void windowSizeChanged();
void imageUpdated();
void imageClicked(int x, int y);
private:
ImageDocument(Frame*, const KURL&);
virtual PassRefPtr<DocumentParser> createParser();
virtual bool isImageDocument() const { return true; }
void createDocumentStructure();
void resizeImageToFit();
void restoreImageSize();
bool imageFitsInWindow() const;
bool shouldShrinkToFit() const;
float scale() const;
ImageDocumentElement* m_imageElement;
// Whether enough of the image has been loaded to determine its size
bool m_imageSizeIsKnown;
// Whether the image is shrunk to fit or not
bool m_didShrinkImage;
// Whether the image should be shrunk or not
bool m_shouldShrinkImage;
};
}
#endif // ImageDocument_h
|
/***************************************************************************//**
* \file cy_crypto_core_mem_v2.h
* \version 2.30.1
*
* \brief
* This file provides the headers for the string management API
* in the Crypto driver.
*
********************************************************************************
* Copyright 2016-2019 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*******************************************************************************/
#if !defined(CY_CRYPTO_CORE_MEM_V2_H)
#define CY_CRYPTO_CORE_MEM_V2_H
#include "cy_crypto_common.h"
#if defined(CY_IP_MXCRYPTO)
#if defined(__cplusplus)
extern "C" {
#endif
void Cy_Crypto_Core_V2_MemCpy(CRYPTO_Type *base,
void* dst, void const *src, uint16_t size);
void Cy_Crypto_Core_V2_MemSet(CRYPTO_Type *base,
void* dst, uint8_t data, uint16_t size);
uint32_t Cy_Crypto_Core_V2_MemCmp(CRYPTO_Type *base,
void const *src0, void const *src1, uint16_t size);
void Cy_Crypto_Core_V2_MemXor(CRYPTO_Type *base, void* dst,
void const *src0, void const *src1, uint16_t size);
#if defined(__cplusplus)
}
#endif
#endif /* CY_IP_MXCRYPTO */
#endif /* #if !defined(CY_CRYPTO_CORE_MEM_V2_H) */
/* [] END OF FILE */
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-7-1 NU-LL first version
*/
#include "board.h"
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
/** Configure the main internal regulator output voltage
*/
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
RCC_OscInitStruct.PLL.PLLN = 8;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{
Error_Handler();
}
/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2
|RCC_PERIPHCLK_ADC;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1;
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_SYSCLK;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
}
|
#pragma once
#include "Event.h"
#include "TaskQueue.h"
#include "PlotWindowOpenedBitmapType.h"
#include "ChannelOpenedLineType.h"
#include "ChannelOpenedText.h"
#include "GridAlg.h"
class PlotWindowOpenedLineType : public PlotWindowOpenedBitmapType
{
public:
PlotWindowOpenedLineType(std::shared_ptr<ProcessOpened>);
virtual std::shared_ptr<BaseProperty> CreatePropertyPage();
public:
struct MaxValueEvent
{
double Max;
double Min;
};
SoraDbgPlot::Event::Event<MaxValueEvent> EventMaxValueChanged;
void SetMaxValue(double maxValue);
void SetMinValue(double maxValue);
void UpdatePropertyMaxMin(double max, double min);
void UpdatePropertyAutoScale(bool bAutoScale);
void UpdatePropertyDataRange(size_t dataCount);
virtual std::shared_ptr<SoraDbgPlot::Task::TaskSimple> TaskUpdate();
private:
struct UpdateOperation
{
UpdateOperation()
{
param = std::make_shared<DrawLineParam>();
dataSize = std::make_shared<size_t>(0);
bmp = 0;
}
~UpdateOperation()
{
if (bmp)
delete bmp;
}
Bitmap * bmp;
std::vector<std::shared_ptr<ChannelOpened> > _vecChUpdate;
std::vector<std::shared_ptr<ChannelOpenedLineType> > _vecChLineType;
std::vector<std::shared_ptr<ChannelOpenedText> > _vecChText;
std::shared_ptr<DrawLineParam> param;
std::shared_ptr<size_t> dataSize;
bool _applyAutoScale;
};
std::shared_ptr<UpdateOperation> _operationUpdate;
protected:
double _maxValue;
double _minValue;
double _maxValueAfterAutoScale;
double _minValueAfterAutoScale;
protected:
void DrawGrid(Graphics * g, const CRect &clientRect, double dispMax, double dispMin);
virtual HRESULT AppendXmlProperty(IXMLDOMDocument *pDom, IXMLDOMElement *pParent);
virtual HRESULT LoadXmlElement(MSXML2::IXMLDOMNodePtr pElement);
virtual void OnCoordinateChanged();
virtual bool IsRangeSettingEnabled();
private:
GridSolutionSolver gridSolutionSolver;
void DrawGridLine(Graphics * g, double resolution, double yData, const CRect & clientRect, double dispMax, double dispMin);
Gdiplus::REAL GetClientY(double y, const CRect & clientRect, double dispMax, double dispMin);
};
|
/*
* Copyright (c) 2016, Zolertia <http://www.zolertia.com>
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
*
* This file is part of the Contiki operating system.
*
*/
/**
* \addtogroup zoul-examples
* @{
*
* \defgroup zoul-ac-dimmer-test Krida Electronics AC light dimmer test example
*
* Demonstrates the use of an AC dimmer with zero-crossing, connected to the
* ADC1 and ADC2 pins (PA5 and PA4 respectively), powered over the D+5.1 pin
*
* @{
*
* \file
* A quick program to test an AC dimmer
* \author
* Antonio Lignan <alinan@zolertia.com>
*/
/*---------------------------------------------------------------------------*/
#include <stdio.h>
#include "contiki.h"
#include "dev/ac-dimmer.h"
#include "lib/sensors.h"
/*---------------------------------------------------------------------------*/
PROCESS(remote_ac_dimmer_process, "AC light dimmer test");
AUTOSTART_PROCESSES(&remote_ac_dimmer_process);
/*---------------------------------------------------------------------------*/
static uint8_t dimming;
static struct etimer et;
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(remote_ac_dimmer_process, ev, data)
{
PROCESS_BEGIN();
dimming = 0;
SENSORS_ACTIVATE(ac_dimmer);
printf("AC dimmer: min %u%% max %u%%\n", DIMMER_DEFAULT_MIN_DIMM_VALUE,
DIMMER_DEFAULT_MAX_DIMM_VALUE);
/* Set the lamp to 10% and wait a few seconds */
ac_dimmer.value(DIMMER_DEFAULT_MIN_DIMM_VALUE);
etimer_set(&et, CLOCK_SECOND * 5);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
/* Upon testing for duty cycles lower than 10% there was noise (probably from
* the triac), causing the driver to skip a beat, and from time to time made
* the test lamp blink. This is easily reproducible by setting the dimmer to
* 5% and using a logic analyzer on the SYNC and GATE pins. The noise was
* picked-up also by the non-connected test probes of the logic analyser.
* Nevertheless the difference between 10% and 2% bright-wise is almost
* negligible
*/
while(1) {
dimming += DIMMER_DEFAULT_MIN_DIMM_VALUE;
if(dimming > DIMMER_DEFAULT_MAX_DIMM_VALUE) {
dimming = DIMMER_DEFAULT_MIN_DIMM_VALUE;
}
ac_dimmer.value(dimming);
printf("AC dimmer: light is now --> %u\n", ac_dimmer.status(SENSORS_ACTIVE));
etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/
|
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
//
//
///
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Sampler sampler NA NA 0 1
// TextureF texture float4 3d 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
// TEXCOORD 0 xyz 2 NONE float xyz
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_sampler s0, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 1
sample r0.xyzw, v2.xyzx, t0.xyzw, s0
mov o0.xyz, r0.xxxx
mov o0.w, l(1.000000)
ret
// Approximately 4 instruction slots used
#endif
const BYTE g_PS_PassthroughLum3D[] =
{
68, 88, 66, 67, 139, 183,
126, 70, 59, 171, 117, 78,
58, 168, 253, 206, 241, 67,
236, 117, 1, 0, 0, 0,
176, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
220, 0, 0, 0, 100, 1,
0, 0, 152, 1, 0, 0,
52, 2, 0, 0, 82, 68,
69, 70, 160, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
109, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0,
100, 0, 0, 0, 2, 0,
0, 0, 5, 0, 0, 0,
8, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
1, 0, 0, 0, 13, 0,
0, 0, 83, 97, 109, 112,
108, 101, 114, 0, 84, 101,
120, 116, 117, 114, 101, 70,
0, 77, 105, 99, 114, 111,
115, 111, 102, 116, 32, 40,
82, 41, 32, 72, 76, 83,
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
57, 46, 51, 48, 46, 57,
50, 48, 48, 46, 49, 54,
51, 56, 52, 0, 73, 83,
71, 78, 128, 0, 0, 0,
3, 0, 0, 0, 8, 0,
0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 15, 0,
0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 4, 0,
0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 1, 0,
0, 0, 118, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
2, 0, 0, 0, 7, 7,
0, 0, 83, 86, 95, 80,
79, 83, 73, 84, 73, 79,
78, 0, 83, 86, 95, 82,
69, 78, 68, 69, 82, 84,
65, 82, 71, 69, 84, 65,
82, 82, 65, 89, 73, 78,
68, 69, 88, 0, 84, 69,
88, 67, 79, 79, 82, 68,
0, 171, 79, 83, 71, 78,
44, 0, 0, 0, 1, 0,
0, 0, 8, 0, 0, 0,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0,
83, 86, 95, 84, 65, 82,
71, 69, 84, 0, 171, 171,
83, 72, 68, 82, 148, 0,
0, 0, 64, 0, 0, 0,
37, 0, 0, 0, 90, 0,
0, 3, 0, 96, 16, 0,
0, 0, 0, 0, 88, 40,
0, 4, 0, 112, 16, 0,
0, 0, 0, 0, 85, 85,
0, 0, 98, 16, 0, 3,
114, 16, 16, 0, 2, 0,
0, 0, 101, 0, 0, 3,
242, 32, 16, 0, 0, 0,
0, 0, 104, 0, 0, 2,
1, 0, 0, 0, 69, 0,
0, 9, 242, 0, 16, 0,
0, 0, 0, 0, 70, 18,
16, 0, 2, 0, 0, 0,
70, 126, 16, 0, 0, 0,
0, 0, 0, 96, 16, 0,
0, 0, 0, 0, 54, 0,
0, 5, 114, 32, 16, 0,
0, 0, 0, 0, 6, 0,
16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 130, 32,
16, 0, 0, 0, 0, 0,
1, 64, 0, 0, 0, 0,
128, 63, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0,
0, 0, 4, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
|
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build cgo
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
#include "libcgo.h"
// Releases the cgo traceback context.
void _cgo_release_context(uintptr_t ctxt) {
void (*pfn)(struct context_arg*);
pfn = _cgo_get_context_function();
if (ctxt != 0 && pfn != nil) {
struct context_arg arg;
arg.Context = ctxt;
(*pfn)(&arg);
}
}
|
// Copyright (c) 2012 The Chromium 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 ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
#define ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/animation/slide_animation.h"
namespace ash {
namespace internal {
// Delegate is notified any time the background changes.
class ASH_EXPORT BackgroundAnimatorDelegate {
public:
virtual void UpdateBackground(int alpha) = 0;
protected:
virtual ~BackgroundAnimatorDelegate() {}
};
// BackgroundAnimator is used by the launcher and system tray to animate the
// background (alpha).
class ASH_EXPORT BackgroundAnimator : public ui::AnimationDelegate {
public:
// How the background can be changed.
enum ChangeType {
CHANGE_ANIMATE,
CHANGE_IMMEDIATE
};
BackgroundAnimator(BackgroundAnimatorDelegate* delegate,
int min_alpha,
int max_alpha);
virtual ~BackgroundAnimator();
// Sets whether a background is rendered. Initial value is false. If |type|
// is |CHANGE_IMMEDIATE| and an animation is not in progress this notifies
// the delegate immediately (synchronously from this method).
void SetPaintsBackground(bool value, ChangeType type);
bool paints_background() const { return paints_background_; }
// Current alpha.
int alpha() const { return alpha_; }
// ui::AnimationDelegate overrides:
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
private:
BackgroundAnimatorDelegate* delegate_;
const int min_alpha_;
const int max_alpha_;
ui::SlideAnimation animation_;
// Whether the background is painted.
bool paints_background_;
// Current alpha value of the background.
int alpha_;
DISALLOW_COPY_AND_ASSIGN(BackgroundAnimator);
};
} // namespace internal
} // namespace ash
#endif // ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
|
// Copyright 2019 The Chromium 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 CONTENT_SHELL_BROWSER_SHELL_CONTENT_INDEX_PROVIDER_H_
#define CONTENT_SHELL_BROWSER_SHELL_CONTENT_INDEX_PROVIDER_H_
#include <map>
#include <string>
#include <vector>
#include "base/memory/weak_ptr.h"
#include "content/public/browser/content_index_provider.h"
#include "ui/gfx/geometry/size.h"
#include "url/origin.h"
namespace content {
// When using ShellContentIndexProvider, IDs need to be globally unique,
// instead of per Service Worker.
class ShellContentIndexProvider : public ContentIndexProvider {
public:
ShellContentIndexProvider();
ShellContentIndexProvider(const ShellContentIndexProvider&) = delete;
ShellContentIndexProvider& operator=(const ShellContentIndexProvider&) =
delete;
~ShellContentIndexProvider() override;
// ContentIndexProvider implementation.
std::vector<gfx::Size> GetIconSizes(
blink::mojom::ContentCategory category) override;
void OnContentAdded(ContentIndexEntry entry) override;
void OnContentDeleted(int64_t service_worker_registration_id,
const url::Origin& origin,
const std::string& description_id) override;
// Returns the Service Worker Registration ID and the origin of the Content
// Index entry registered with |id|. If |id| does not exist, invalid values
// are returned, which would cause DB tasks to fail.
std::pair<int64_t, url::Origin> GetRegistrationDataFromId(
const std::string& id);
void set_icon_sizes(std::vector<gfx::Size> icon_sizes) {
icon_sizes_ = std::move(icon_sizes);
}
private:
// Map from |description_id| to <|service_worker_registration_id|, |origin|>.
std::map<std::string, std::pair<int64_t, url::Origin>> entries_;
std::vector<gfx::Size> icon_sizes_;
};
} // namespace content
#endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_INDEX_PROVIDER_H_
|
/*
*/
#ifndef __ASMARM_SMP_PLAT_H
#define __ASMARM_SMP_PLAT_H
#include <asm/cputype.h>
/*
*/
static inline bool is_smp(void)
{
#ifndef CONFIG_SMP
return false;
#elif defined(CONFIG_SMP_ON_UP)
extern unsigned int smp_on_up;
return !!smp_on_up;
#else
return true;
#endif
}
/* */
static inline int tlb_ops_need_broadcast(void)
{
if (!is_smp())
return 0;
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
}
#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
#define cache_ops_need_broadcast() 0
#else
static inline int cache_ops_need_broadcast(void)
{
if (!is_smp())
return 0;
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
}
#endif
/*
*/
extern int __cpu_logical_map[];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
#endif
|
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <assert.h>
#include <errno.h>
#include <endian.h>
#include <unistd.h>
#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <kernel-features.h>
#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
# ifdef __NR_pread
# error "__NR_pread and __NR_pread64 both defined???"
# endif
# define __NR_pread __NR_pread64
#endif
static ssize_t
#ifdef NO_CANCELLATION
inline __attribute ((always_inline))
#endif
do_pread (int fd, void *buf, size_t count, off_t offset)
{
ssize_t result;
assert (sizeof (offset) == 4);
result = INLINE_SYSCALL (pread, 5, fd, buf, count,
__LONG_LONG_PAIR (offset >> 31, offset));
return result;
}
ssize_t
__libc_pread (fd, buf, count, offset)
int fd;
void *buf;
size_t count;
off_t offset;
{
if (SINGLE_THREAD_P)
return do_pread (fd, buf, count, offset);
int oldtype = LIBC_CANCEL_ASYNC ();
ssize_t result = do_pread (fd, buf, count, offset);
LIBC_CANCEL_RESET (oldtype);
return result;
}
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
|
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _UTMP_H
#define _UTMP_H 1
#include <features.h>
#include <sys/types.h>
__BEGIN_DECLS
/* Get system dependent values and data structures. */
#include <bits/utmp.h>
/* Compatibility names for the strings of the canonical file names. */
#define UTMP_FILE _PATH_UTMP
#define UTMP_FILENAME _PATH_UTMP
#define WTMP_FILE _PATH_WTMP
#define WTMP_FILENAME _PATH_WTMP
#ifdef __UCLIBC_HAS_LIBUTIL__
/* Make FD be the controlling terminal, stdin, stdout, and stderr;
then close FD. Returns 0 on success, nonzero on error. */
extern int login_tty (int __fd) __THROW;
/* Write the given entry into utmp and wtmp. */
extern void login (__const struct utmp *__entry) __THROW;
/* Write the utmp entry to say the user on UT_LINE has logged out. */
extern int logout (__const char *__ut_line) __THROW;
/* Append to wtmp an entry for the current time and the given info. */
extern void logwtmp (__const char *__ut_line, __const char *__ut_name,
__const char *__ut_host) __THROW;
#endif
/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp)
__THROW;
libc_hidden_proto(updwtmp)
/* Change name of the utmp file to be examined. */
extern int utmpname (__const char *__file) __THROW;
libc_hidden_proto(utmpname)
/* Read next entry from a utmp-like file. */
extern struct utmp *getutent (void) __THROW;
libc_hidden_proto(getutent)
/* Reset the input stream to the beginning of the file. */
extern void setutent (void) __THROW;
libc_hidden_proto(setutent)
/* Close the current open file. */
extern void endutent (void) __THROW;
libc_hidden_proto(endutent)
/* Search forward from the current point in the utmp file until the
next entry with a ut_type matching ID->ut_type. */
extern struct utmp *getutid (__const struct utmp *__id) __THROW;
libc_hidden_proto(getutid)
/* Search forward from the current point in the utmp file until the
next entry with a ut_line matching LINE->ut_line. */
extern struct utmp *getutline (__const struct utmp *__line) __THROW;
libc_hidden_proto(getutline)
/* Write out entry pointed to by UTMP_PTR into the utmp file. */
extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW;
libc_hidden_proto(pututline)
#if 0 /* def __USE_MISC */
/* Reentrant versions of the file for handling utmp files. */
extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer,
struct utmp **__result) __THROW;
extern int getutline_r (__const struct utmp *__line,
struct utmp *__buffer, struct utmp **__result) __THROW;
#endif /* Use misc. */
__END_DECLS
#endif /* utmp.h */
|
/*
* Copyright(c) 2009 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FCOE_H_
#define _FCOE_H_
#include <linux/skbuff.h>
#include <linux/kthread.h>
#define FCOE_MAX_QUEUE_DEPTH 256
#define FCOE_MIN_QUEUE_DEPTH 32
#define FCOE_WORD_TO_BYTE 4
#define FCOE_VERSION "0.1"
#define FCOE_NAME "fcoe"
#define FCOE_VENDOR "Open-FCoE.org"
#define FCOE_MAX_LUN 0xFFFF
#define FCOE_MAX_FCP_TARGET 256
#define FCOE_MAX_OUTSTANDING_COMMANDS 1024
#define FCOE_MIN_XID 0x0000 /* */
#define FCOE_MAX_XID 0x0FFF /* */
extern unsigned int fcoe_debug_logging;
#define FCOE_LOGGING 0x01 /* */
#define FCOE_NETDEV_LOGGING 0x02 /* */
#define FCOE_CHECK_LOGGING(LEVEL, CMD) \
do { \
if (unlikely(fcoe_debug_logging & LEVEL)) \
do { \
CMD; \
} while (0); \
} while (0)
#define FCOE_DBG(fmt, args...) \
FCOE_CHECK_LOGGING(FCOE_LOGGING, \
printk(KERN_INFO "fcoe: " fmt, ##args);)
#define FCOE_NETDEV_DBG(netdev, fmt, args...) \
FCOE_CHECK_LOGGING(FCOE_NETDEV_LOGGING, \
printk(KERN_INFO "fcoe: %s: " fmt, \
netdev->name, ##args);)
/*
*/
struct fcoe_interface {
struct list_head list;
struct net_device *netdev;
struct net_device *realdev;
struct packet_type fcoe_packet_type;
struct packet_type fip_packet_type;
struct fcoe_ctlr ctlr;
struct fc_exch_mgr *oem;
};
#define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_interface, ctlr)
/*
*/
static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
{
return ((struct fcoe_interface *)
((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
}
#endif /* */
|
/****************************************************************************
**
** This file is part of the Qt Extended Opensource Package.
**
** Copyright (C) 2009 Trolltech ASA.
**
** Contact: Qt Extended Information (info@qtextended.org)
**
** This file may be used under the terms of the GNU General Public License
** version 2.0 as published by the Free Software Foundation and appearing
** in the file LICENSE.GPL included in the packaging of this file.
**
** Please review the following information to ensure GNU General Public
** Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html.
**
**
****************************************************************************/
#ifndef SLIDEINMESSAGEBOX_H
#define SLIDEINMESSAGEBOX_H
#include <QWidget>
#include "qabstractmessagebox.h"
class QString;
class SlideInMessageBoxPrivate;
class SlideInMessageBox : public QAbstractMessageBox
{
Q_OBJECT
public:
SlideInMessageBox(QWidget *parent = 0, Qt::WFlags flags = 0);
virtual ~SlideInMessageBox();
virtual void setButtons(Button button1, Button button2);
virtual void setButtons(const QString &button0Text, const QString &button1Text, const QString &button2Text,
int defaultButtonNumber, int escapeButtonNumber);
virtual Icon icon() const;
virtual void setIcon(Icon);
virtual void setIconPixmap(const QPixmap&);
virtual QString title() const;
virtual void setTitle(const QString &);
virtual QString text() const;
virtual void setText(const QString &);
virtual QSize sizeHint() const;
virtual QPixmap pixmap() const;
protected:
virtual void showEvent(QShowEvent *);
virtual void paintEvent(QPaintEvent *);
virtual void keyPressEvent(QKeyEvent *);
private slots:
void valueChanged(qreal);
private:
void renderBox();
void animate();
void drawFrame(QPainter *painter, const QRect &r, const QString &title);
SlideInMessageBoxPrivate *d;
};
#endif
|
/*********************************************************************
*
* Filename: ircomm_tty_attach.h
* Version:
* Description:
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Wed Jun 9 15:55:18 1999
* Modified at: Fri Dec 10 21:04:55 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
********************************************************************/
#ifndef IRCOMM_TTY_ATTACH_H
#define IRCOMM_TTY_ATTACH_H
#include <net/irda/ircomm_tty.h>
typedef enum {
IRCOMM_TTY_IDLE,
IRCOMM_TTY_SEARCH,
IRCOMM_TTY_QUERY_PARAMETERS,
IRCOMM_TTY_QUERY_LSAP_SEL,
IRCOMM_TTY_SETUP,
IRCOMM_TTY_READY,
} IRCOMM_TTY_STATE;
/* IrCOMM TTY Events */
typedef enum {
IRCOMM_TTY_ATTACH_CABLE,
IRCOMM_TTY_DETACH_CABLE,
IRCOMM_TTY_DATA_REQUEST,
IRCOMM_TTY_DATA_INDICATION,
IRCOMM_TTY_DISCOVERY_REQUEST,
IRCOMM_TTY_DISCOVERY_INDICATION,
IRCOMM_TTY_CONNECT_CONFIRM,
IRCOMM_TTY_CONNECT_INDICATION,
IRCOMM_TTY_DISCONNECT_REQUEST,
IRCOMM_TTY_DISCONNECT_INDICATION,
IRCOMM_TTY_WD_TIMER_EXPIRED,
IRCOMM_TTY_GOT_PARAMETERS,
IRCOMM_TTY_GOT_LSAPSEL,
} IRCOMM_TTY_EVENT;
/* Used for passing information through the state-machine */
struct ircomm_tty_info {
__u32 saddr; /* Source device address */
__u32 daddr; /* Destination device address */
__u8 dlsap_sel;
};
extern const char *const ircomm_state[];
extern const char *const ircomm_tty_state[];
int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
struct sk_buff *skb, struct ircomm_tty_info *info);
int ircomm_tty_attach_cable(struct ircomm_tty_cb *self);
void ircomm_tty_detach_cable(struct ircomm_tty_cb *self);
void ircomm_tty_connect_confirm(void *instance, void *sap,
struct qos_info *qos,
__u32 max_sdu_size,
__u8 max_header_size,
struct sk_buff *skb);
void ircomm_tty_disconnect_indication(void *instance, void *sap,
LM_REASON reason,
struct sk_buff *skb);
void ircomm_tty_connect_indication(void *instance, void *sap,
struct qos_info *qos,
__u32 max_sdu_size,
__u8 max_header_size,
struct sk_buff *skb);
int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self);
void ircomm_tty_link_established(struct ircomm_tty_cb *self);
#endif /* IRCOMM_TTY_ATTACH_H */
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ConnectionService_h__
#define ConnectionService_h__
#include "Common.h"
#include "Service.h"
#include "connection_service.pb.h"
namespace Battlenet
{
class Session;
namespace Services
{
class Connection : public Service<connection::v1::ConnectionService>
{
typedef Service<connection::v1::ConnectionService> ConnectionService;
public:
Connection(Session* session);
uint32 HandleConnect(connection::v1::ConnectRequest const* request, connection::v1::ConnectResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
uint32 HandleKeepAlive(NoData const* request) override;
uint32 HandleRequestDisconnect(connection::v1::DisconnectRequest const* request) override;
};
}
}
#endif // ConnectionService_h__
|
#ifndef _ASM_WORD_AT_A_TIME_H
#define _ASM_WORD_AT_A_TIME_H
/*
*/
#ifdef CONFIG_64BIT
/*
*/
static inline long count_masked_bytes(unsigned long mask)
{
return mask*0x0001020304050608ul >> 56;
}
#else /* */
/* */
static inline long count_masked_bytes(long mask)
{
/* */
long a = (0x0ff0001+mask) >> 23;
/* */
return a & mask;
}
#endif
#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
/* */
static inline unsigned long has_zero(unsigned long a)
{
return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80);
}
/*
*/
static inline unsigned long load_unaligned_zeropad(const void *addr)
{
unsigned long ret, dummy;
asm(
"1:\tmov %2,%0\n"
"2:\n"
".section .fixup,\"ax\"\n"
"3:\t"
"lea %2,%1\n\t"
"and %3,%1\n\t"
"mov (%1),%0\n\t"
"leal %2,%%ecx\n\t"
"andl %4,%%ecx\n\t"
"shll $3,%%ecx\n\t"
"shr %%cl,%0\n\t"
"jmp 2b\n"
".previous\n"
_ASM_EXTABLE(1b, 3b)
:"=&r" (ret),"=&c" (dummy)
:"m" (*(unsigned long *)addr),
"i" (-sizeof(unsigned long)),
"i" (sizeof(unsigned long)-1));
return ret;
}
#endif /* */
|
/*
* drivers/input/touchscreen/zt8031.h
*
* (C) Copyright 2007-2012
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __LINUX_ZT_TS_H__
#define __LINUX_ZT_TS_H__
#include <mach/sys_config.h>
#include <mach/irqs.h>
#include <linux/i2c.h>
#include <linux/i2c/tsc2007.h>
// gpio base address
#define PIO_BASE_ADDRESS (0x01c20800)
#define PIO_RANGE_SIZE (0x400)
#define IRQ_EINT21 (21)
#define IRQ_EINT29 (29)
#define IRQ_EINT25 (25)
#define TS_POLL_DELAY 10/* ms delay between samples */
#define TS_POLL_PERIOD 10 /* ms delay between samples */
#define GPIO_ENABLE
#define SYSCONFIG_GPIO_ENABLE
#define PIO_INT_STAT_OFFSET (0x214)
#define PIO_INT_CTRL_OFFSET (0x210)
#define PIO_INT_CFG2_OFFSET (0x208)
#define PIO_INT_CFG3_OFFSET (0x20c)
#define PIO_PN_DAT_OFFSET(n) ((n)*0x24 + 0x10)
//#define PIOI_DATA (0x130)
#define PIOH_DATA (0x10c)
#define PIOI_CFG3_OFFSET (0x12c)
#define PRESS_DOWN 1
#define FREE_UP 0
#define TS_RESET_LOW_PERIOD (1)
#define TS_INITIAL_HIGH_PERIOD (100)
#define TS_WAKEUP_LOW_PERIOD (10)
#define TS_WAKEUP_HIGH_PERIOD (10)
#define IRQ_NO (IRQ_EINT25)
struct aw_platform_ops{
int irq;
bool pendown;
int (*get_pendown_state)(void);
void (*clear_penirq)(void);
int (*set_irq_mode)(void);
int (*set_gpio_mode)(void);
int (*judge_int_occur)(void);
int (*init_platform_resource)(void);
void (*free_platform_resource)(void);
int (*fetch_sysconfig_para)(void);
void (*ts_reset)(void);
void (*ts_wakeup)(void);
};
#define ZT_NAME "zt8031"
struct zt_ts_platform_data{
u16 intr; /* irq number */
};
#define PIOA_CFG1_REG (gpio_addr+0x4)
#define PIOA_DATA (gpio_addr+0x10)
#define PIOI_DATA (gpio_addr+0x130)
#define POINT_DELAY (1)
#define ZT8031_ADDR (0x90>>1)
#define ZT8031_MEASURE_TEMP0 (0x0 << 4)
#define ZT8031_MEASURE_AUX (0x2 << 4)
#define ZT8031_MEASURE_TEMP1 (0x4 << 4)
#define ZT8031_ACTIVATE_XN (0x8 << 4)
#define ZT8031_ACTIVATE_YN (0x9 << 4)
#define ZT8031_ACTIVATE_YP_XN (0xa << 4)
#define ZT8031_SETUP (0xb << 4)
#define ZT8031_MEASURE_X (0xc << 4)
#define ZT8031_MEASURE_Y (0xd << 4)
#define ZT8031_MEASURE_Z1 (0xe << 4)
#define ZT8031_MEASURE_Z2 (0xf << 4)
#define ZT8031_POWER_OFF_IRQ_EN (0x0 << 2)
#define ZT8031_ADC_ON_IRQ_DIS0 (0x1 << 2)
#define ZT8031_ADC_OFF_IRQ_EN (0x2 << 2)
#define ZT8031_ADC_ON_IRQ_DIS1 (0x3 << 2)
#define ZT8031_12BIT (0x0 << 1)
#define ZT8031_8BIT (0x1 << 1)
#define MAX_12BIT ((1 << 12) - 1)
#define ADC_ON_12BIT (ZT8031_12BIT | ZT8031_ADC_ON_IRQ_DIS1)
#define READ_Y (ADC_ON_12BIT | ZT8031_MEASURE_Y)
#define READ_Z1 (ADC_ON_12BIT | ZT8031_MEASURE_Z1)
#define READ_Z2 (ADC_ON_12BIT | ZT8031_MEASURE_Z2)
#define READ_X (ADC_ON_12BIT | ZT8031_MEASURE_X)
#define PWRDOWN (ZT8031_12BIT | ZT8031_POWER_OFF_IRQ_EN)
#define PWRUP (ZT8031_12BIT|ZT8031_ADC_ON_IRQ_DIS1)
#define POINT_DELAY (1)
#endif
|
/* Measure bcopy functions.
Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#define TEST_BCOPY
#include "bench-memmove.c"
|
/* BGP Extended Communities Attribute.
Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
This file is part of GNU Zebra.
GNU Zebra is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
GNU Zebra is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* High-order octet of the Extended Communities type field. */
#define ECOMMUNITY_ENCODE_AS 0x00
#define ECOMMUNITY_ENCODE_IP 0x01
/* Low-order octet of the Extended Communityes type field. */
#define ECOMMUNITY_ROUTE_TARGET 0x02
#define ECOMMUNITY_SITE_ORIGIN 0x03
/* Extended communities attribute string format. */
#define ECOMMUNITY_FORMAT_ROUTE_MAP 0
#define ECOMMUNITY_FORMAT_COMMUNITY_LIST 1
#define ECOMMUNITY_FORMAT_DISPLAY 2
/* Extended Communities value is eight octet long. */
#define ECOMMUNITY_SIZE 8
/* Extended Communities attribute. */
struct ecommunity
{
/* Reference counter. */
unsigned long refcnt;
/* Size of Extended Communities attribute. */
int size;
/* Extended Communities value. */
u_char *val;
/* Human readable format string. */
char *str;
};
/* Extended community value is eight octet. */
struct ecommunity_val
{
char val[ECOMMUNITY_SIZE];
};
#define ecom_length(X) ((X)->size * ECOMMUNITY_SIZE)
void ecommunity_init (void);
void ecommunity_free (struct ecommunity *);
struct ecommunity *ecommunity_new (void);
struct ecommunity *ecommunity_parse (char *, u_short);
struct ecommunity *ecommunity_dup (struct ecommunity *);
struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
struct ecommunity *ecommunity_intern (struct ecommunity *);
int ecommunity_cmp (struct ecommunity *, struct ecommunity *);
void ecommunity_unintern (struct ecommunity *);
unsigned int ecommunity_hash_make (struct ecommunity *);
struct ecommunity *ecommunity_str2com (char *, int, int);
char *ecommunity_ecom2str (struct ecommunity *, int);
int ecommunity_match (struct ecommunity *, struct ecommunity *);
char *ecommunity_str (struct ecommunity *);
|
/* This file is part of GEGL
*
* GEGL 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 3 of the License, or (at your option) any later version.
*
* GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2003 Calvin Williamson
* 2005-2008 Øyvind Kolås
*/
#ifndef __GEGL_OPERATIONS_H__
#define __GEGL_OPERATIONS_H__
#include <glib-object.h>
/* Used to look up the gtype when changing the type of operation associated
* a GeglNode using just a string with the registered name.
*/
GType gegl_operation_gtype_from_name (const gchar *name);
gchar ** gegl_list_operations (guint *n_operations_p);
void gegl_operation_gtype_cleanup (void);
#endif
|
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMOUSELINUXINPUT_QWS_H
#define QMOUSELINUXINPUT_QWS_H
#include <QtGui/QWSCalibratedMouseHandler>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
class QWSLinuxInputMousePrivate;
class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler
{
public:
QWSLinuxInputMouseHandler(const QString &);
~QWSLinuxInputMouseHandler();
void suspend();
void resume();
private:
QWSLinuxInputMousePrivate *d;
friend class QWSLinuxInputMousePrivate;
};
#endif // QT_NO_QWS_MOUSE_LINUXINPUT
QT_END_NAMESPACE
QT_END_HEADER
#endif // QMOUSELINUXINPUT_QWS_H
|
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(gr, blocks, __VA_ARGS__)
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char* __doc_gr_blocks_keep_one_in_n = R"doc()doc";
static const char* __doc_gr_blocks_keep_one_in_n_keep_one_in_n_0 = R"doc()doc";
static const char* __doc_gr_blocks_keep_one_in_n_keep_one_in_n_1 = R"doc()doc";
static const char* __doc_gr_blocks_keep_one_in_n_make = R"doc()doc";
static const char* __doc_gr_blocks_keep_one_in_n_set_n = R"doc()doc";
|
/*
* Copyright (c) 1997 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2009 Aconex. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef _STACKMOD_H_
#define _STACKMOD_H_
#include <QVector>
#include "modulate.h"
class SoBaseColor;
class SoTranslation;
class SoScale;
class SoNode;
class SoSwitch;
class Launch;
struct StackBlock {
SoSeparator *_sep;
SoBaseColor *_color;
SoScale *_scale;
SoTranslation *_tran;
Modulate::State _state;
bool _selected;
};
typedef QVector<StackBlock> StackBlockList;
class StackMod : public Modulate
{
public:
enum Height { unfixed, fixed, util };
private:
static const float theDefFillColor[];
static const char theStackId;
StackBlockList _blocks;
SoSwitch *_switch;
Height _height;
QString _text;
int _selectCount;
int _infoValue;
int _infoMetric;
int _infoInst;
public:
virtual ~StackMod();
StackMod(MetricList *metrics,
SoNode *obj,
Height height = unfixed);
void setFillColor(const SbColor &col);
void setFillColor(int packedcol);
void setFillText(const char *str)
{ _text = str; }
virtual void refresh(bool fetchFlag);
virtual void selectAll();
virtual int select(SoPath *);
virtual int remove(SoPath *);
virtual void selectInfo(SoPath *);
virtual void removeInfo(SoPath *);
virtual void infoText(QString &str, bool) const;
virtual void launch(Launch &launch, bool all) const;
virtual void dump(QTextStream &) const;
private:
StackMod();
StackMod(const StackMod &);
const StackMod &operator=(const StackMod &);
// Never defined
void findBlock(SoPath *path, int &metric, int &inst,
int &value, bool idMetric = true);
};
#endif /* _STACKMOD_H_ */
|
/*This file is generated by luagen.*/
#include "lua_ftk_file.h"
#include "lua_ftk_callbacks.h"
static void tolua_reg_types (lua_State* L)
{
tolua_usertype(L, "FtkFile");
}
static int lua_ftk_file_get_info(lua_State* L)
{
tolua_Error err = {0};
Ret retv;
const char* file_name;
FtkFileInfo* info;
int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isusertype(L, 2, "FtkFileInfo", 0, &err);
return_val_if_fail(param_ok, 0);
file_name = tolua_tostring(L, 1, 0);
info = tolua_tousertype(L, 2, 0);
retv = ftk_file_get_info(file_name, info);
tolua_pushnumber(L, (lua_Number)retv);
return 1;
}
static int lua_ftk_file_get_mime_type(lua_State* L)
{
tolua_Error err = {0};
const char* retv;
const char* file_name;
int param_ok = tolua_isstring(L, 1, 0, &err);
return_val_if_fail(param_ok, 0);
file_name = tolua_tostring(L, 1, 0);
retv = ftk_file_get_mime_type(file_name);
tolua_pushstring(L, (const char*)retv);
return 1;
}
int tolua_ftk_file_init(lua_State* L)
{
tolua_open(L);
tolua_reg_types(L);
tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL);
tolua_cclass(L,"FtkFile", "FtkFile", "", NULL);
tolua_beginmodule(L, "FtkFile");
tolua_function(L, "GetInfo", lua_ftk_file_get_info);
tolua_function(L, "GetMimeType", lua_ftk_file_get_mime_type);
tolua_endmodule(L);
tolua_endmodule(L);
return 1;
}
|
/**
******************************************************************************
* @file stm32f3xx_hal_pcd_ex.h
* @author MCD Application Team
* @brief Header file of PCD HAL Extension module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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 OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F3xx_HAL_PCD_EX_H
#define __STM32F3xx_HAL_PCD_EX_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(STM32F302xE) || defined(STM32F303xE) || \
defined(STM32F302xC) || defined(STM32F303xC) || \
defined(STM32F302x8) || \
defined(STM32F373xC)
/* Includes ------------------------------------------------------------------*/
#include "stm32f3xx_hal_def.h"
/** @addtogroup STM32F3xx_HAL_Driver
* @{
*/
/** @addtogroup PCDEx
* @{
*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/** @defgroup PCDEx_Exported_Macros PCD Extended Exported Macros
* @{
*/
/**
* @brief Gets address in an endpoint register.
* @param USBx USB peripheral instance register address.
* @param bEpNum Endpoint Number.
* @retval None
*/
#if defined(STM32F302xC) || defined(STM32F303xC) || \
defined(STM32F373xC)
#define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8)*2+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_TX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+2)*2+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+4)*2+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_RX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+6)*2+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount) {\
uint16_t *pdwReg =PCD_EP_RX_CNT((USBx),(bEpNum)); \
PCD_SET_EP_CNT_RX_REG((pdwReg), (wCount))\
}
#endif /* STM32F302xC || STM32F303xC || */
/* STM32F373xC */
#if defined(STM32F302xE) || defined(STM32F303xE) || \
defined(STM32F302x8)
#define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8)+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_TX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+2)+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+4)+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_EP_RX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+6)+ ((uint32_t)(USBx) + 0x400U)))))
#define PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount) {\
uint16_t *pdwReg = PCD_EP_RX_CNT((USBx), (bEpNum));\
PCD_SET_EP_CNT_RX_REG((pdwReg), (wCount))\
}
#endif /* STM32F302xE || STM32F303xE || */
/* STM32F302x8 */
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
* @{
*/
/** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
* @{
*/
HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
uint16_t ep_addr,
uint16_t ep_kind,
uint32_t pmaadress);
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* STM32F302xE || STM32F303xE || */
/* STM32F302xC || STM32F303xC || */
/* STM32F302x8 || */
/* STM32F373xC */
#ifdef __cplusplus
}
#endif
#endif /* __STM32F3xx_HAL_PCD_EX_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 <memory>
#include <vector>
#include "gandiva/arrow.h"
#include "gandiva/function_signature.h"
#include "gandiva/gandiva_aliases.h"
#include "gandiva/visibility.h"
namespace gandiva {
class NativeFunction;
class FunctionRegistry;
/// \brief Exports types supported by Gandiva for processing.
///
/// Has helper methods for clients to programmatically discover
/// data types and functions supported by Gandiva.
class GANDIVA_EXPORT ExpressionRegistry {
public:
using native_func_iterator_type = const NativeFunction*;
using func_sig_iterator_type = const FunctionSignature*;
ExpressionRegistry();
~ExpressionRegistry();
static DataTypeVector supported_types() { return supported_types_; }
class GANDIVA_EXPORT FunctionSignatureIterator {
public:
explicit FunctionSignatureIterator(native_func_iterator_type nf_it,
native_func_iterator_type nf_it_end_);
explicit FunctionSignatureIterator(func_sig_iterator_type fs_it);
bool operator!=(const FunctionSignatureIterator& func_sign_it);
FunctionSignature operator*();
func_sig_iterator_type operator++(int);
private:
native_func_iterator_type native_func_it_;
const native_func_iterator_type native_func_it_end_;
func_sig_iterator_type func_sig_it_;
};
const FunctionSignatureIterator function_signature_begin();
const FunctionSignatureIterator function_signature_end() const;
private:
static DataTypeVector supported_types_;
std::unique_ptr<FunctionRegistry> function_registry_;
};
GANDIVA_EXPORT
std::vector<std::shared_ptr<FunctionSignature>> GetRegisteredFunctionSignatures();
} // namespace gandiva
|
// Copyright (c) 2015 Cesanta Software Limited
// All rights reserved
#include "mongoose.h"
static const char *s_http_port = "8000";
static struct mg_serve_http_opts s_http_server_opts;
static void ev_handler(struct mg_connection *nc, int ev, void *p) {
if (ev == MG_EV_HTTP_REQUEST) {
mg_serve_http(nc, p, s_http_server_opts); // Serves static content
}
}
int main(void) {
struct mg_mgr mgr;
struct mg_connection *nc;
cs_stat_t st;
mg_mgr_init(&mgr, NULL);
nc = mg_bind(&mgr, s_http_port, ev_handler);
if (nc == NULL) {
fprintf(stderr, "Cannot bind to %s\n", s_http_port);
exit(1);
}
// Set up HTTP server parameters
mg_set_protocol_http_websocket(nc);
s_http_server_opts.document_root = "web_root"; // Set up web root directory
if (mg_stat(s_http_server_opts.document_root, &st) != 0) {
fprintf(stderr, "%s", "Cannot find web_root directory, exiting\n");
exit(1);
}
printf("Starting web server on port %s\n", s_http_port);
for (;;) {
mg_mgr_poll(&mgr, 1000);
}
mg_mgr_free(&mgr);
return 0;
}
|
// Copyright 2015 The Chromium 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 CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_
#define CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controller.h"
#import "chrome/browser/ui/cocoa/passwords/credential_item_view.h"
@class AccountAvatarFetcherManager;
@class BubbleCombobox;
class ManagePasswordsBubbleModel;
@class ManagePasswordCredentialItemViewController;
// A custom cell that displays a credential item in an NSTableView.
@interface CredentialItemCell : NSCell
- (id)initWithView:(CredentialItemView*)view;
@property(nonatomic, readonly) CredentialItemView* view;
@end
// Manages a view that shows a list of credentials that can be used for
// authentication to a site.
@interface ManagePasswordsBubbleAccountChooserViewController
: ManagePasswordsBubbleContentViewController<CredentialItemDelegate,
NSTableViewDataSource,
NSTableViewDelegate> {
@private
ManagePasswordsBubbleModel* model_; // Weak.
NSButton* cancelButton_; // Weak.
BubbleCombobox* moreButton_; // Weak.
NSTableView* credentialsView_; // Weak.
base::scoped_nsobject<NSArray> credentialItems_;
base::scoped_nsobject<AccountAvatarFetcherManager> avatarManager_;
}
// Initializes a new account chooser and populates it with the credentials
// stored in |model|. Designated initializer.
- (id)initWithModel:(ManagePasswordsBubbleModel*)model
delegate:(id<ManagePasswordsBubbleContentViewDelegate>)delegate;
@end
#endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_
|
/* $OpenBSD: getentropy_freebsd.c,v 1.3 2016/08/07 03:27:21 tb Exp $ */
/*
* Copyright (c) 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* Copyright (c) 2014 Brent Cook <bcook@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Emulation of getentropy(2) as documented at:
* http://man.openbsd.org/getentropy.2
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include <errno.h>
#include <stddef.h>
/*
* Derived from lib/libc/gen/arc4random.c from FreeBSD.
*/
static size_t
getentropy_sysctl(u_char *buf, size_t size)
{
int mib[2];
size_t len, done;
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
done = 0;
do {
len = size;
if (sysctl(mib, 2, buf, &len, NULL, 0) == -1)
return (done);
done += len;
buf += len;
size -= len;
} while (size > 0);
return (done);
}
int
getentropy(void *buf, size_t len)
{
if (len <= 256 && getentropy_sysctl(buf, len) == len)
return (0);
errno = EIO;
return (-1);
}
|
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef XWALK_RUNTIME_RENDERER_XWALK_CONTENT_RENDERER_CLIENT_H_
#define XWALK_RUNTIME_RENDERER_XWALK_CONTENT_RENDERER_CLIENT_H_
#include <string>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/files/file.h"
#include "base/strings/string16.h"
#include "content/public/renderer/content_renderer_client.h"
#include "ui/base/page_transition_types.h"
#include "xwalk/extensions/renderer/xwalk_extension_renderer_controller.h"
#if defined(OS_ANDROID)
#include "xwalk/runtime/renderer/android/xwalk_render_process_observer.h"
#else
#include "xwalk/runtime/renderer/xwalk_render_process_observer_generic.h"
#endif
namespace visitedlink {
class VisitedLinkSlave;
}
namespace xwalk {
class XWalkRenderProcessObserver;
// When implementing a derived class, make sure to update
// `in_process_browser_test.cc` and `xwalk_main_delegate.cc`.
class XWalkContentRendererClient
: public content::ContentRendererClient,
public extensions::XWalkExtensionRendererController::Delegate {
public:
static XWalkContentRendererClient* Get();
XWalkContentRendererClient();
~XWalkContentRendererClient() override;
// ContentRendererClient implementation.
void RenderThreadStarted() override;
void RenderFrameCreated(content::RenderFrame* render_frame) override;
void RenderViewCreated(content::RenderView* render_view) override;
bool IsExternalPepperPlugin(const std::string& module_name) override;
const void* CreatePPAPIInterface(
const std::string& interface_name) override;
#if defined(OS_ANDROID)
unsigned long long VisitedLinkHash(const char* canonical_url, // NOLINT
size_t length) override;
bool IsLinkVisited(unsigned long long link_hash) override; // NOLINT
#endif
bool WillSendRequest(blink::WebFrame* frame,
ui::PageTransition transition_type,
const GURL& url,
const GURL& first_party_for_cookies,
GURL* new_url) override;
protected:
scoped_ptr<XWalkRenderProcessObserver> xwalk_render_process_observer_;
private:
// XWalkExtensionRendererController::Delegate implementation.
void DidCreateModuleSystem(
extensions::XWalkModuleSystem* module_system) override;
scoped_ptr<extensions::XWalkExtensionRendererController>
extension_controller_;
#if defined(OS_ANDROID)
scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
#endif
void GetNavigationErrorStrings(
content::RenderView* render_view,
blink::WebFrame* frame,
const blink::WebURLRequest& failed_request,
const blink::WebURLError& error,
std::string* error_html,
base::string16* error_description) override;
DISALLOW_COPY_AND_ASSIGN(XWalkContentRendererClient);
};
} // namespace xwalk
#endif // XWALK_RUNTIME_RENDERER_XWALK_CONTENT_RENDERER_CLIENT_H_
|
// Copyright (c) 2012 The Chromium 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 TOOLS_ANDROID_FORWARDER2_SOCKET_H_
#define TOOLS_ANDROID_FORWARDER2_SOCKET_H_
#include <fcntl.h>
#include <netinet/in.h>
#include <stddef.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <string>
#include <vector>
namespace forwarder2 {
// Wrapper class around unix socket api. Can be used to create, bind or
// connect to both Unix domain sockets and TCP sockets.
// TODO(pliard): Split this class into TCPSocket and UnixDomainSocket.
class Socket {
public:
Socket();
Socket(const Socket&) = delete;
Socket& operator=(const Socket&) = delete;
~Socket();
bool BindUnix(const std::string& path);
bool BindTcp(const std::string& host, int port);
bool ConnectUnix(const std::string& path);
bool ConnectTcp(const std::string& host, int port);
// Just a wrapper around unix socket shutdown(), see man 2 shutdown.
void Shutdown();
// Just a wrapper around unix socket close(), see man 2 close.
void Close();
bool IsClosed() const { return socket_ < 0; }
int fd() const { return socket_; }
bool Accept(Socket* new_socket);
// Returns the port allocated to this socket or zero on error.
int GetPort();
// Just a wrapper around unix read() function.
// Reads up to buffer_size, but may read less than buffer_size.
// Returns the number of bytes read.
int Read(void* buffer, size_t buffer_size);
// Same as Read() but with a timeout.
int ReadWithTimeout(void* buffer, size_t buffer_size, int timeout_secs);
// Non-blocking version of Read() above. This must be called after a
// successful call to select(). The socket must also be in non-blocking mode
// before calling this method.
int NonBlockingRead(void* buffer, size_t buffer_size);
// Wrapper around send().
int Write(const void* buffer, size_t count);
// Same as NonBlockingRead() but for writing.
int NonBlockingWrite(const void* buffer, size_t count);
// Calls Read() multiple times until num_bytes is written to the provided
// buffer. No bounds checking is performed.
// Returns number of bytes read, which can be different from num_bytes in case
// of errror.
int ReadNumBytes(void* buffer, size_t num_bytes);
// Same as ReadNumBytes() but with a timeout.
int ReadNumBytesWithTimeout(void* buffer, size_t num_bytes, int timeout_secs);
// Calls Write() multiple times until num_bytes is written. No bounds checking
// is performed. Returns number of bytes written, which can be different from
// num_bytes in case of errror.
int WriteNumBytes(const void* buffer, size_t num_bytes);
// Calls WriteNumBytes for the given std::string. Note that the null
// terminator is not written to the socket.
int WriteString(const std::string& buffer);
bool has_error() const { return socket_error_; }
// |event_fd| must be a valid pipe file descriptor created from the
// PipeNotifier and must live (not be closed) at least as long as this socket
// is alive.
void AddEventFd(int event_fd);
// Returns whether Accept() or Connect() was interrupted because the socket
// received an external event fired through the provided fd.
bool DidReceiveEventOnFd(int fd) const;
bool DidReceiveEvent() const;
static pid_t GetUnixDomainSocketProcessOwner(const std::string& path);
private:
enum EventType {
READ,
WRITE
};
union SockAddr {
// IPv4 sockaddr
sockaddr_in addr4;
// IPv6 sockaddr
sockaddr_in6 addr6;
// Unix Domain sockaddr
sockaddr_un addr_un;
};
struct Event {
int fd;
bool was_fired;
};
bool SetNonBlocking();
// If |host| is empty, use localhost.
bool InitTcpSocket(const std::string& host, int port);
bool InitUnixSocket(const std::string& path);
bool BindAndListen();
bool Connect();
bool Resolve(const std::string& host);
bool InitSocketInternal();
void SetSocketError();
// Waits until a read or write i/o event has happened.
bool WaitForEvent(EventType type, int timeout_secs);
int socket_;
int port_;
bool socket_error_;
// Family of the socket (AF_INET, AF_INET6 or PF_UNIX).
int family_;
SockAddr addr_;
// Points to one of the members of the above union depending on the family.
sockaddr* addr_ptr_;
// Length of one of the members of the above union depending on the family.
socklen_t addr_len_;
// Used to listen for external events (e.g. process received a SIGTERM) while
// blocking on I/O operations.
std::vector<Event> events_;
};
} // namespace forwarder
#endif // TOOLS_ANDROID_FORWARDER2_SOCKET_H_
|
// Copyright (c) 2012 The Chromium 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 CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_REQUESTOR_MOCK_H_
#define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_REQUESTOR_MOCK_H_
#include <memory>
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace content {
class ClientCertificateDelegate;
}
namespace net {
class SSLCertRequestInfo;
class SSLPrivateKey;
class X509Certificate;
}
class SSLClientAuthRequestorMock
: public base::RefCountedThreadSafe<SSLClientAuthRequestorMock> {
public:
explicit SSLClientAuthRequestorMock(
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info);
std::unique_ptr<content::ClientCertificateDelegate> CreateDelegate();
void WaitForCompletion();
MOCK_METHOD2(CertificateSelected,
void(net::X509Certificate* cert, net::SSLPrivateKey* key));
MOCK_METHOD0(CancelCertificateSelection, void());
scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
protected:
friend class base::RefCountedThreadSafe<SSLClientAuthRequestorMock>;
virtual ~SSLClientAuthRequestorMock();
private:
base::RunLoop run_loop_;
};
#endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_REQUESTOR_MOCK_H_
|
//
// SPDatabaseData.h
// sequel-pro
//
// Created by Stuart Connolly (stuconnolly.com) on May 20, 2009.
// Copyright (c) 2009 Stuart Connolly. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// More info at <https://github.com/sequelpro/sequelpro>
@class SPServerSupport;
@class SPMySQLConnection;
/**
* @class SPDatabaseData SPDatabaseData.h
*
* @author Stuart Connolly http://stuconnolly.com/
*
* This class provides various convenience methods for obtaining data associated with the current database,
* if available. This includes available encodings, collations, etc.
*/
@interface SPDatabaseData : NSObject
{
NSString *characterSetEncoding;
NSString *defaultCharacterSetEncoding;
NSString *defaultCollation;
NSString *serverDefaultCharacterSetEncoding;
NSString *serverDefaultCollation;
NSString *defaultStorageEngine;
NSMutableArray *collations;
NSMutableArray *characterSetCollations;
NSMutableArray *storageEngines;
NSMutableArray *characterSetEncodings;
NSMutableDictionary *cachedCollationsByEncoding;
SPMySQLConnection *connection;
SPServerSupport *serverSupport;
}
/**
* @property connection The current database connection
*/
@property (readwrite, assign) SPMySQLConnection *connection;
/**
* @property serverSupport The connection's associated SPServerSupport instance
*/
@property (readwrite, assign) SPServerSupport *serverSupport;
- (void)resetAllData;
- (NSArray *)getDatabaseCollations;
- (NSArray *)getDatabaseCollationsForEncoding:(NSString *)encoding;
- (NSArray *)getDatabaseStorageEngines;
- (NSArray *)getDatabaseCharacterSetEncodings;
- (NSString *)getDatabaseDefaultCharacterSet;
- (NSString *)getDatabaseDefaultCollation;
- (NSString *)getDatabaseDefaultStorageEngine;
- (NSString *)getServerDefaultCharacterSet;
- (NSString *)getServerDefaultCollation;
@end
|
#include <stdio.h>
extern FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern void path_getstr(char *result, size_t len, const char *path, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern int path_writestr(const char *str, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int path_getnum(const char *path, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
extern int path_exist(const char *path, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
extern cpu_set_t *path_cpuset(int, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern cpu_set_t *path_cpulist(int, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void path_setprefix(const char *);
|
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "config.h"
#include "client.h"
#include <freerdp/freerdp.h>
#include <freerdp/client/disp.h>
#include <guacamole/client.h>
#include <guacamole/timestamp.h>
guac_rdp_disp* guac_rdp_disp_alloc() {
guac_rdp_disp* disp = malloc(sizeof(guac_rdp_disp));
/* Not yet connected */
disp->disp = NULL;
/* No requests have been made */
disp->last_request = 0;
disp->requested_width = 0;
disp->requested_height = 0;
return disp;
}
void guac_rdp_disp_free(guac_rdp_disp* disp) {
free(disp);
}
void guac_rdp_disp_load_plugin(rdpContext* context) {
#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
context->settings->SupportDisplayControl = TRUE;
#endif
/* Add "disp" channel */
ADDIN_ARGV* args = malloc(sizeof(ADDIN_ARGV));
args->argc = 1;
args->argv = malloc(sizeof(char**) * 1);
args->argv[0] = strdup("disp");
freerdp_dynamic_channel_collection_add(context->settings, args);
}
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp) {
guac_disp->disp = disp;
}
/**
* Fits a given dimension within the allowed bounds for Display Update
* messages, adjusting the other dimension such that aspect ratio is
* maintained.
*
* @param a The dimension to fit within allowed bounds.
*
* @param b
* The other dimension to adjust if and only if necessary to preserve
* aspect ratio.
*/
static void guac_rdp_disp_fit(int* a, int* b) {
int a_value = *a;
int b_value = *b;
/* Ensure first dimension is within allowed range */
if (a_value < GUAC_RDP_DISP_MIN_SIZE) {
/* Adjust other dimension to maintain aspect ratio */
int adjusted_b = b_value * GUAC_RDP_DISP_MIN_SIZE / a_value;
if (adjusted_b > GUAC_RDP_DISP_MAX_SIZE)
adjusted_b = GUAC_RDP_DISP_MAX_SIZE;
*a = GUAC_RDP_DISP_MIN_SIZE;
*b = adjusted_b;
}
else if (a_value > GUAC_RDP_DISP_MAX_SIZE) {
/* Adjust other dimension to maintain aspect ratio */
int adjusted_b = b_value * GUAC_RDP_DISP_MAX_SIZE / a_value;
if (adjusted_b < GUAC_RDP_DISP_MIN_SIZE)
adjusted_b = GUAC_RDP_DISP_MIN_SIZE;
*a = GUAC_RDP_DISP_MAX_SIZE;
*b = adjusted_b;
}
}
void guac_rdp_disp_set_size(guac_rdp_disp* disp, rdpContext* context,
int width, int height) {
/* Fit width within bounds, adjusting height to maintain aspect ratio */
guac_rdp_disp_fit(&width, &height);
/* Fit height within bounds, adjusting width to maintain aspect ratio */
guac_rdp_disp_fit(&height, &width);
/* Width must be even */
if (width % 2 == 1)
width -= 1;
/* Store deferred size */
disp->requested_width = width;
disp->requested_height = height;
/* Send display update notification if possible */
guac_rdp_disp_update_size(disp, context);
}
void guac_rdp_disp_update_size(guac_rdp_disp* disp, rdpContext* context) {
guac_client* client = ((rdp_freerdp_context*) context)->client;
/* Send display update notification if display channel is connected */
if (disp->disp == NULL)
return;
int width = disp->requested_width;
int height = disp->requested_height;
DISPLAY_CONTROL_MONITOR_LAYOUT monitors[1] = {{
.Flags = 0x1, /* DISPLAYCONTROL_MONITOR_PRIMARY */
.Left = 0,
.Top = 0,
.Width = width,
.Height = height,
.PhysicalWidth = 0,
.PhysicalHeight = 0,
.Orientation = 0,
.DesktopScaleFactor = 0,
.DeviceScaleFactor = 0
}};
guac_timestamp now = guac_timestamp_current();
/* Limit display update frequency */
if (disp->last_request != 0
&& now - disp->last_request <= GUAC_RDP_DISP_UPDATE_INTERVAL)
return;
/* Do NOT send requests unless the size will change */
if (width == guac_rdp_get_width(context->instance)
&& height == guac_rdp_get_height(context->instance))
return;
guac_client_log(client, GUAC_LOG_DEBUG,
"Resizing remote display to %ix%i",
width, height);
disp->last_request = now;
disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
}
|
/* lzo1b_xx.c -- LZO1B compression public entry point
This file is part of the LZO real-time data compression library.
Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The LZO 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
#include "config1b.h"
/***********************************************************************
//
************************************************************************/
static const lzo_compress_t * const c_funcs [9] =
{
&_lzo1b_1_compress_func,
&_lzo1b_2_compress_func,
&_lzo1b_3_compress_func,
&_lzo1b_4_compress_func,
&_lzo1b_5_compress_func,
&_lzo1b_6_compress_func,
&_lzo1b_7_compress_func,
&_lzo1b_8_compress_func,
&_lzo1b_9_compress_func
};
lzo_compress_t _lzo1b_get_compress_func(int clevel)
{
const lzo_compress_t *f;
if (clevel < LZO1B_BEST_SPEED || clevel > LZO1B_BEST_COMPRESSION)
{
if (clevel == LZO1B_DEFAULT_COMPRESSION)
clevel = LZO1B_BEST_SPEED;
else
return 0;
}
f = c_funcs[clevel-1];
assert(f && *f);
return *f;
}
LZO_PUBLIC(int)
lzo1b_compress ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem,
int clevel )
{
lzo_compress_t f;
f = _lzo1b_get_compress_func(clevel);
if (!f)
return LZO_E_ERROR;
return _lzo1b_do_compress(src,src_len,dst,dst_len,wrkmem,f);
}
/*
vi:ts=4:et
*/
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2005 Novell, Inc.
*
* Nemo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* Nemo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; see the file COPYING. If not,
* write to the Free Software Foundation, Inc., 51 Franklin Street - Suite 500,
* Boston, MA 02110-1335, USA.
*
* Author: Anders Carlsson <andersca@imendio.com>
*
*/
#ifndef NEMO_SEARCH_ENGINE_H
#define NEMO_SEARCH_ENGINE_H
#include <glib-object.h>
#include <libnemo-private/nemo-query.h>
#define NEMO_TYPE_SEARCH_ENGINE (nemo_search_engine_get_type ())
#define NEMO_SEARCH_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NEMO_TYPE_SEARCH_ENGINE, NemoSearchEngine))
#define NEMO_SEARCH_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NEMO_TYPE_SEARCH_ENGINE, NemoSearchEngineClass))
#define NEMO_IS_SEARCH_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NEMO_TYPE_SEARCH_ENGINE))
#define NEMO_IS_SEARCH_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NEMO_TYPE_SEARCH_ENGINE))
#define NEMO_SEARCH_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NEMO_TYPE_SEARCH_ENGINE, NemoSearchEngineClass))
typedef struct NemoSearchEngineDetails NemoSearchEngineDetails;
typedef struct NemoSearchEngine {
GObject parent;
NemoSearchEngineDetails *details;
} NemoSearchEngine;
typedef struct {
GObjectClass parent_class;
/* VTable */
void (*set_query) (NemoSearchEngine *engine, NemoQuery *query);
void (*start) (NemoSearchEngine *engine);
void (*stop) (NemoSearchEngine *engine);
/* Signals */
void (*hits_added) (NemoSearchEngine *engine, GList *hits);
void (*hits_subtracted) (NemoSearchEngine *engine, GList *hits);
void (*finished) (NemoSearchEngine *engine);
void (*error) (NemoSearchEngine *engine, const char *error_message);
} NemoSearchEngineClass;
GType nemo_search_engine_get_type (void);
gboolean nemo_search_engine_enabled (void);
NemoSearchEngine* nemo_search_engine_new (void);
void nemo_search_engine_set_query (NemoSearchEngine *engine, NemoQuery *query);
void nemo_search_engine_start (NemoSearchEngine *engine);
void nemo_search_engine_stop (NemoSearchEngine *engine);
void nemo_search_engine_hits_added (NemoSearchEngine *engine, GList *hits);
void nemo_search_engine_hits_subtracted (NemoSearchEngine *engine, GList *hits);
void nemo_search_engine_finished (NemoSearchEngine *engine);
void nemo_search_engine_error (NemoSearchEngine *engine, const char *error_message);
#endif /* NEMO_SEARCH_ENGINE_H */
|
/*
* test-svn-fe: Code to exercise the svn import lib
*/
#include "git-compat-util.h"
#include "vcs-svn/svndump.h"
#include "vcs-svn/svndiff.h"
#include "vcs-svn/sliding_window.h"
#include "vcs-svn/line_buffer.h"
static const char test_svnfe_usage[] =
"test-svn-fe (<dumpfile> | [-d] <preimage> <delta> <len>)";
static int apply_delta(int argc, char *argv[])
{
struct line_buffer preimage = LINE_BUFFER_INIT;
struct line_buffer delta = LINE_BUFFER_INIT;
struct sliding_view preimage_view = SLIDING_VIEW_INIT(&preimage, -1);
if (argc != 5)
usage(test_svnfe_usage);
if (buffer_init(&preimage, argv[2]))
die_errno("cannot open preimage");
if (buffer_init(&delta, argv[3]))
die_errno("cannot open delta");
if (svndiff0_apply(&delta, (off_t) strtoull(argv[4], NULL, 0),
&preimage_view, stdout))
return 1;
if (buffer_deinit(&preimage))
die_errno("cannot close preimage");
if (buffer_deinit(&delta))
die_errno("cannot close delta");
buffer_reset(&preimage);
strbuf_release(&preimage_view.buf);
buffer_reset(&delta);
return 0;
}
int main(int argc, char *argv[])
{
if (argc == 2) {
if (svndump_init(argv[1]))
return 1;
svndump_read(NULL);
svndump_deinit();
svndump_reset();
return 0;
}
if (argc >= 2 && !strcmp(argv[1], "-d"))
return apply_delta(argc, argv);
usage(test_svnfe_usage);
}
|
/*
** Bytecode dump definitions.
** Copyright (C) 2005-2021 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_BCDUMP_H
#define _LJ_BCDUMP_H
#include "lj_obj.h"
#include "lj_lex.h"
/* -- Bytecode dump format ------------------------------------------------ */
/*
** dump = header proto+ 0U
** header = ESC 'L' 'J' versionB flagsU [namelenU nameB*]
** proto = lengthU pdata
** pdata = phead bcinsW* uvdataH* kgc* knum* [debugB*]
** phead = flagsB numparamsB framesizeB numuvB numkgcU numknU numbcU
** [debuglenU [firstlineU numlineU]]
** kgc = kgctypeU { ktab | (loU hiU) | (rloU rhiU iloU ihiU) | strB* }
** knum = intU0 | (loU1 hiU)
** ktab = narrayU nhashU karray* khash*
** karray = ktabk
** khash = ktabk ktabk
** ktabk = ktabtypeU { intU | (loU hiU) | strB* }
**
** B = 8 bit, H = 16 bit, W = 32 bit, U = ULEB128 of W, U0/U1 = ULEB128 of W+1
*/
/* Bytecode dump header. */
#define BCDUMP_HEAD1 0x1b
#define BCDUMP_HEAD2 0x4c
#define BCDUMP_HEAD3 0x4a
/* If you perform *any* kind of private modifications to the bytecode itself
** or to the dump format, you *must* set BCDUMP_VERSION to 0x80 or higher.
*/
#define BCDUMP_VERSION 2
/* Compatibility flags. */
#define BCDUMP_F_BE 0x01
#define BCDUMP_F_STRIP 0x02
#define BCDUMP_F_FFI 0x04
#define BCDUMP_F_FR2 0x08
#define BCDUMP_F_KNOWN (BCDUMP_F_FR2*2-1)
/* Type codes for the GC constants of a prototype. Plus length for strings. */
enum {
BCDUMP_KGC_CHILD, BCDUMP_KGC_TAB, BCDUMP_KGC_I64, BCDUMP_KGC_U64,
BCDUMP_KGC_COMPLEX, BCDUMP_KGC_STR
};
/* Type codes for the keys/values of a constant table. */
enum {
BCDUMP_KTAB_NIL, BCDUMP_KTAB_FALSE, BCDUMP_KTAB_TRUE,
BCDUMP_KTAB_INT, BCDUMP_KTAB_NUM, BCDUMP_KTAB_STR
};
/* -- Bytecode reader/writer ---------------------------------------------- */
LJ_FUNC int lj_bcwrite(lua_State *L, GCproto *pt, lua_Writer writer,
void *data, int strip);
LJ_FUNC GCproto *lj_bcread_proto(LexState *ls);
LJ_FUNC GCproto *lj_bcread(LexState *ls);
#endif
|
#ifndef TAI_H
#define TAI_H
#ifdef _MSC_VER
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <inttypes.h> /* more portable than stdint.h */
#endif
#ifdef _MSC_VER
#define LL(x) x ## i64
#define ULL(x) x ## ui64
#else
#define LL(x) x ## LL
#define ULL(x) x ## ULL
#endif
struct tai {
uint64_t x;
} ;
extern void tai_now(struct tai *t);
/* JW: MSVC cannot convert unsigned to double :-( */
#define tai_approx(t) ((double) ((int64_t)(t)->x))
extern void tai_add(struct tai *t, struct tai *u, struct tai *v);
extern void tai_sub(struct tai *t, struct tai *u, struct tai *v);
#define tai_less(t,u) ((t)->x < (u)->x)
#define TAI_PACK 8
extern void tai_pack(char *s, struct tai *t);
extern void tai_unpack(char *s, struct tai *t);
#endif
|
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef JOULEHEATING_H
#define JOULEHEATING_H
#include "Kernel.h"
//Forward Declarations
class JouleHeating;
class Function;
template<>
InputParameters validParams<JouleHeating>();
class JouleHeating : public Kernel
{
public:
JouleHeating(const std::string & name, InputParameters parameters);
protected:
virtual Real computeQpResidual();
VariableGradient& _grad_potential;
MaterialProperty<Real> & _thermal_conductivity;
};
#endif
|
//===--- UnownedTypeInfo.h - Supplemental API for [unowned] -----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines UnownedTypeInfo, which supplements the FixedTypeInfo
// interface for types that implement [unowned] references.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IRGEN_UNOWNEDTYPEINFO_H
#define SWIFT_IRGEN_UNOWNEDTYPEINFO_H
#include "LoadableTypeInfo.h"
namespace swift {
namespace irgen {
/// \brief An abstract class designed for use when implementing a
/// ReferenceStorageType with [unowned] ownership.
class UnownedTypeInfo : public LoadableTypeInfo {
protected:
UnownedTypeInfo(llvm::Type *type, Size size,
const SpareBitVector &spareBits, Alignment align)
: LoadableTypeInfo(type, size, spareBits, align,
IsNotPOD, IsFixedSize, STIK_Unowned) {}
UnownedTypeInfo(llvm::Type *type, Size size,
SpareBitVector &&spareBits, Alignment align)
: LoadableTypeInfo(type, size, std::move(spareBits), align,
IsNotPOD, IsFixedSize, STIK_Unowned) {}
public:
// No API yet.
static bool classof(const UnownedTypeInfo *type) { return true; }
static bool classof(const TypeInfo *type) {
return type->getSpecialTypeInfoKind() == STIK_Unowned;
}
};
}
}
#endif
|
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include "blake2.h"
#include "crypto_generichash_blake2b.h"
#include "private/common.h"
#include "private/implementations.h"
int
crypto_generichash_blake2b(unsigned char *out, size_t outlen,
const unsigned char *in, unsigned long long inlen,
const unsigned char *key, size_t keylen)
{
if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
return -1;
}
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
return blake2b((uint8_t *) out, in, key, (uint8_t) outlen, (uint64_t) inlen,
(uint8_t) keylen);
}
int
crypto_generichash_blake2b_salt_personal(
unsigned char *out, size_t outlen, const unsigned char *in,
unsigned long long inlen, const unsigned char *key, size_t keylen,
const unsigned char *salt, const unsigned char *personal)
{
if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
return -1;
}
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
return blake2b_salt_personal((uint8_t *) out, in, key, (uint8_t) outlen,
(uint64_t) inlen, (uint8_t) keylen, salt,
personal);
}
int
crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
const unsigned char *key, const size_t keylen,
const size_t outlen)
{
if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
keylen > BLAKE2B_KEYBYTES) {
return -1;
}
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
COMPILER_ASSERT(sizeof(blake2b_state) <= sizeof *state);
if (key == NULL || keylen <= 0U) {
if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
} else if (blake2b_init_key((blake2b_state *) (void *) state, (uint8_t) outlen, key,
(uint8_t) keylen) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
return 0;
}
int
crypto_generichash_blake2b_init_salt_personal(
crypto_generichash_blake2b_state *state, const unsigned char *key,
const size_t keylen, const size_t outlen, const unsigned char *salt,
const unsigned char *personal)
{
if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
keylen > BLAKE2B_KEYBYTES) {
return -1;
}
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
if (key == NULL || keylen <= 0U) {
if (blake2b_init_salt_personal((blake2b_state *) (void *) state,
(uint8_t) outlen, salt, personal) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
} else if (blake2b_init_key_salt_personal((blake2b_state *) (void *) state,
(uint8_t) outlen, key,
(uint8_t) keylen, salt,
personal) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
return 0;
}
int
crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
const unsigned char *in,
unsigned long long inlen)
{
return blake2b_update((blake2b_state *) (void *) state,
(const uint8_t *) in, (uint64_t) inlen);
}
int
crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
unsigned char *out, const size_t outlen)
{
assert(outlen <= UINT8_MAX);
return blake2b_final((blake2b_state *) (void *) state,
(uint8_t *) out, (uint8_t) outlen);
}
int
_crypto_generichash_blake2b_pick_best_implementation(void)
{
return blake2b_pick_best_implementation();
}
|
/*-------------------------------------------------------------------------
*
* discard.h
* prototypes for discard.c.
*
*
* Copyright (c) 1996-2019, PostgreSQL Global Development Group
*
* src/include/commands/discard.h
*
*-------------------------------------------------------------------------
*/
#ifndef DISCARD_H
#define DISCARD_H
#include "nodes/parsenodes.h"
extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel);
#endif /* DISCARD_H */
|
// Copyright 2014 The Chromium 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 NetworkInformation_h
#define NetworkInformation_h
#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventTarget.h"
#include "core/page/NetworkStateNotifier.h"
#include "public/platform/WebConnectionType.h"
namespace blink {
class ExecutionContext;
class NetworkInformation FINAL
: public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<NetworkInformation>
, public ActiveDOMObject
, public EventTargetWithInlineData
, public NetworkStateNotifier::NetworkStateObserver {
DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<NetworkInformation>);
DEFINE_WRAPPERTYPEINFO();
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation);
public:
static NetworkInformation* create(ExecutionContext*);
virtual ~NetworkInformation();
String type() const;
virtual void connectionTypeChange(WebConnectionType) OVERRIDE;
// EventTarget overrides.
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ExecutionContext* executionContext() const OVERRIDE;
virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false) OVERRIDE;
virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false) OVERRIDE;
virtual void removeAllEventListeners() OVERRIDE;
// ActiveDOMObject overrides.
virtual bool hasPendingActivity() const OVERRIDE;
virtual void stop() OVERRIDE;
DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange);
private:
explicit NetworkInformation(ExecutionContext*);
void startObserving();
void stopObserving();
// Touched only on context thread.
WebConnectionType m_type;
// Whether this object is listening for events from NetworkStateNotifier.
bool m_observing;
// Whether ActiveDOMObject::stop has been called.
bool m_contextStopped;
};
} // namespace blink
#endif // NetworkInformation_h
|
// Copyright (c) 2012 The Chromium 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 UI_AURA_CLIENT_VISIBILITY_CLIENT_H_
#define UI_AURA_CLIENT_VISIBILITY_CLIENT_H_
#include "ui/aura/aura_export.h"
namespace aura {
class Window;
namespace client {
// An interface implemented by an object that manages the visibility of Windows'
// layers as Window visibility changes.
class AURA_EXPORT VisibilityClient {
public:
// Called when |window|'s visibility is changing to |visible|. The implementor
// can perform additional actions before reflecting the visibility change on
// the underlying layer.
virtual void UpdateLayerVisibility(Window* window, bool visible) = 0;
protected:
virtual ~VisibilityClient() {}
};
// Sets the VisibilityClient on the Window.
AURA_EXPORT void SetVisibilityClient(Window* window, VisibilityClient* client);
// Gets the VisibilityClient for the window. This will crawl up |window|'s
// hierarchy until it finds one.
AURA_EXPORT VisibilityClient* GetVisibilityClient(Window* window);
} // namespace clients
} // namespace aura
#endif // UI_AURA_CLIENT_VISIBILITY_CLIENT_H_
|
// Filename: pnmimage_base.h
// Created by: drose (14Jun00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef PNMIMAGE_BASE_H
#define PNMIMAGE_BASE_H
// This header file make a few typedefs and other definitions
// essential to everything in the PNMImage package.
#include "pandabase.h"
#include "pnotify.h"
// Since we no longer include pnm.h directly, we have to provide our
// own definitions for xel and xelval.
// For now, we have PGM_BIGGRAYS defined, which gives us 16-bit
// channels. Undefine this if you have memory problems and need to
// use 8-bit channels instead.
#define PGM_BIGGRAYS
#ifdef PGM_BIGGRAYS
typedef unsigned short gray;
#define PGM_MAXMAXVAL 65535
#else // PGM_BIGGRAYS
typedef unsigned char gray;
#define PGM_MAXMAXVAL 255
#endif // PGM_BIGGRAYS
#define PNM_MAXMAXVAL PGM_MAXMAXVAL
struct pixel {
PUBLISHED:
pixel() { }
pixel(gray fill) : r(fill), g(fill), b(fill) { }
pixel(gray r, gray g, gray b) : r(r), g(g), b(b) { }
gray operator [](int i) const { nassertr(i >= 0 && i < 3, 0); return *(&r + i); }
gray &operator [](int i) { nassertr(i >= 0 && i < 3, r); return *(&r + i); }
pixel operator + (const pixel &other) const
{ return pixel(r + other.r, g + other.g, b + other.b); }
pixel operator - (const pixel &other) const
{ return pixel(r - other.r, g - other.g, b - other.b); }
pixel operator * (const double mult) const
{ return pixel(r * mult, g * mult, b * mult); }
void operator += (const pixel &other)
{ r += other.r; g += other.g; b += other.b; }
void operator -= (const pixel &other)
{ r -= other.r; g -= other.g; b -= other.b; }
void operator *= (const double mult)
{ r *= mult; g *= mult; b *= mult; }
#ifdef HAVE_PYTHON
static int size() { return 3; }
void output(ostream &out) {
out << "pixel(r=" << r << ", g=" << g << ", b=" << b << ")";
}
#endif
gray r, g, b;
};
typedef gray pixval;
typedef pixel xel;
typedef gray xelval;
// These macros are borrowed from ppm.h.
#define PPM_GETR(p) ((p).r)
#define PPM_GETG(p) ((p).g)
#define PPM_GETB(p) ((p).b)
#define PPM_PUTR(p,red) ((p).r = (red))
#define PPM_PUTG(p,grn) ((p).g = (grn))
#define PPM_PUTB(p,blu) ((p).b = (blu))
#define PPM_ASSIGN(p,red,grn,blu) { (p).r = (red); (p).g = (grn); (p).b = (blu); }
#define PPM_EQUAL(p,q) ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b )
#define PNM_ASSIGN1(x,v) PPM_ASSIGN(x,0,0,v)
#define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \
PPM_ASSIGN( (newp), \
( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) )
// pnm defines these functions, and it's easier to emulate them than
// to rewrite the code that calls them.
EXPCL_PANDA_PNMIMAGE void pm_message(const char *format, ...);
EXPCL_PANDA_PNMIMAGE void pm_error(const char *format, ...); // doesn't return.
EXPCL_PANDA_PNMIMAGE int pm_maxvaltobits(int maxval);
EXPCL_PANDA_PNMIMAGE int pm_bitstomaxval(int bits);
EXPCL_PANDA_PNMIMAGE char *pm_allocrow(int cols, int size);
EXPCL_PANDA_PNMIMAGE void pm_freerow(char *itrow);
EXPCL_PANDA_PNMIMAGE int pm_readbigshort(istream *in, short *sP);
EXPCL_PANDA_PNMIMAGE int pm_writebigshort(ostream *out, short s);
EXPCL_PANDA_PNMIMAGE int pm_readbiglong(istream *in, long *lP);
EXPCL_PANDA_PNMIMAGE int pm_writebiglong(ostream *out, long l);
EXPCL_PANDA_PNMIMAGE int pm_readlittleshort(istream *in, short *sP);
EXPCL_PANDA_PNMIMAGE int pm_writelittleshort(ostream *out, short s);
EXPCL_PANDA_PNMIMAGE int pm_readlittlelong(istream *in, long *lP);
EXPCL_PANDA_PNMIMAGE int pm_writelittlelong(ostream *out, long l);
// These ratios are used to compute the brightness of a colored pixel; they
// define the relative contributions of each of the components.
static const float lumin_red = 0.299f;
static const float lumin_grn = 0.587f;
static const float lumin_blu = 0.114f;
#endif
|
//
// DGActivityIndicatorTripleRingsPulseAnimation.h
// DGActivityIndicatorExample
//
// Created by tripleCC on 15/6/28.
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
//
#import "DGActivityIndicatorAnimation.h"
@interface DGActivityIndicatorTripleRingsAnimation: DGActivityIndicatorAnimation
@end
|
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2015 Google Inc. http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BASIC_EXAMPLE_H
#define BASIC_EXAMPLE_H
class CommonExampleInterface* BasicExampleCreateFunc(struct CommonExampleOptions& options);
#endif //BASIC_DEMO_PHYSICS_SETUP_H
|
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
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>
@class NSFont, NSFontDescriptor, NSFontPanel;
typedef unsigned NSFontTraitMask;
typedef enum {
NSNoFontChangeAction = 0,
NSViaPanelFontAction = 1,
NSAddTraitFontAction = 2,
NSSizeUpFontAction = 3,
NSSizeDownFontAction = 4,
NSHeavierFontAction = 5,
NSLighterFontAction = 6,
NSRemoveTraitFontAction = 7,
} NSFontAction;
enum {
NSItalicFontMask = 0x00000001,
NSBoldFontMask = 0x00000002,
NSUnboldFontMask = 0x00000004,
NSNonStandardCharacterSetFontMask = 0x00000008,
NSNarrowFontMask = 0x00000010,
NSExpandedFontMask = 0x00000020,
NSCondensedFontMask = 0x00000040,
NSSmallCapsFontMask = 0x00000080,
NSPosterFontMask = 0x00000100,
NSCompressedFontMask = 0x00000200,
NSFixedPitchFontMask = 0x00000400,
NSUnitalicFontMask = 0x01000000,
};
@interface NSFontManager : NSObject {
NSFontPanel *_panel;
id _delegate;
SEL _action;
NSFont *_selectedFont;
BOOL _isMultiple;
NSFontAction _currentFontAction;
int _currentTrait;
}
+ (NSFontManager *)sharedFontManager;
+ (void)setFontManagerFactory:(Class)value;
+ (void)setFontPanelFactory:(Class)value;
- delegate;
- (SEL)action;
- (void)setDelegate:delegate;
- (void)setAction:(SEL)value;
- (NSFontAction)currentFontAction;
- (NSArray *)collectionNames;
- (BOOL)addCollection:(NSString *)name options:(int)options;
- (void)addFontDescriptors:(NSArray *)descriptors toCollection:(NSString *)name;
- (BOOL)removeCollection:(NSString *)name;
- (NSArray *)fontDescriptorsInCollection:(NSString *)name;
- (NSArray *)availableFonts;
- (NSArray *)availableFontFamilies;
- (NSArray *)availableMembersOfFontFamily:(NSString *)name;
- (NSArray *)availableFontNamesMatchingFontDescriptor:(NSFontDescriptor *)descriptor;
- (NSArray *)availableFontNamesWithTraits:(NSFontTraitMask)traits;
- (BOOL)fontNamed:(NSString *)name hasTraits:(NSFontTraitMask)traits;
- (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits weight:(int)weight size:(float)size;
- (int)weightOfFont:(NSFont *)font;
- (NSFontTraitMask)traitsOfFont:(NSFont *)font;
- (NSString *)localizedNameForFamily:(NSString *)family face:(NSString *)face;
- (NSFontPanel *)fontPanel:(BOOL)create;
- (BOOL)sendAction;
- (BOOL)isEnabled;
- (BOOL)isMultiple;
- (NSFont *)selectedFont;
- (void)setSelectedFont:(NSFont *)font isMultiple:(BOOL)isMultiple;
- (NSFont *)convertFont:(NSFont *)font;
- (NSFont *)convertFont:(NSFont *)font toSize:(float)size;
- (NSFont *)convertFont:(NSFont *)font toHaveTrait:(NSFontTraitMask)trait;
- (NSFont *)convertFont:(NSFont *)font toNotHaveTrait:(NSFontTraitMask)trait;
- (NSFont *)convertFont:(NSFont *)font toFace:(NSString *)typeface;
- (NSFont *)convertFont:(NSFont *)font toFamily:(NSString *)family;
- (NSFont *)convertWeight:(BOOL)heavierNotLighter ofFont:(NSFont *)font;
- (NSDictionary *)convertAttributes:(NSDictionary *)attributes;
- (void)addFontTrait:sender;
- (void)modifyFont:sender;
- (void)modifyFontViaPanel:sender;
- (void)removeFontTrait:sender;
- (void)orderFrontFontPanel:sender;
- (void)orderFrontStylesPanel:sender;
@end
@interface NSObject (NSFontManager_delegate)
- (BOOL)fontManager:sender willIncludeFont:(NSString *)fontName;
@end
|
#ifndef CYGONCE_PLF_CACHE_H
#define CYGONCE_PLF_CACHE_H
//=============================================================================
//
// plf_cache.h
//
// HAL cache control API
//
//=============================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later
// version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License
// along with eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg
// Contributors: nickg
// Date: 1998-02-17
// Purpose: Cache control API
// Description: The macros defined here provide the HAL APIs for handling
// cache control operations.
// Usage:
// #include <cyg/hal/plf_cache.h>
// ...
//
//
//####DESCRIPTIONEND####
//
//=============================================================================
//=============================================================================
// Nothing here at present.
//-----------------------------------------------------------------------------
#endif // ifndef CYGONCE_PLF_CACHE_H
// End of plf_cache.h
|
/*
*
* Copyright (c) Matthew Wilcox for Hewlett Packard 2003
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**********************************************************
*
* TEST IDENTIFIER : flock06
*
* EXECUTED BY : anyone
*
* TEST TITLE : Error condition test for flock(2)
*
* TEST CASE TOTAL : 1
*
* AUTHOR : Matthew Wilcox <willy@debian.org>
*
* SIGNALS
* Uses SIGUSR1 to pause before test if option set.
* (See the parse_opts(3) man page).
*
* DESCRIPTION
* This test verifies that flock locks held on one fd conflict with
* flock locks held on a different fd.
*
* Test:
* The process opens two file descriptors on the same file.
* It acquires an exclusive flock on the first descriptor,
* checks that attempting to acquire an flock on the second
* descriptor fails. Then it removes the first descriptor's
* lock and attempts to acquire an exclusive lock on the
* second descriptor.
*
* USAGE: <for command-line>
* flock06 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
* where, -c n : Run n copies concurrently
* -f : Turn off functional testing
* -e : Turn on errno logging
* -h : Show help screen
* -i n : Execute test n times
* -I x : Execute test for x seconds
* -p : Pause for SIGUSR1 before starting
* -P x : Pause for x seconds between iterations
* -t : Turn on syscall timing
*
****************************************************************/
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/wait.h>
#include "test.h"
void setup(void);
void cleanup(void);
char *TCID = "flock06";
int TST_TOTAL = 3;
char filename[100];
int main(int argc, char **argv)
{
int lc;
tst_parse_opts(argc, argv, NULL, NULL);
setup();
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
int fd1, fd2;
/* reset tst_count in case we are looping */
tst_count = 0;
fd1 = open(filename, O_RDWR);
if (fd1 == -1)
tst_brkm(TFAIL, cleanup, "failed to open the"
"file, errno %d", errno);
TEST(flock(fd1, LOCK_EX | LOCK_NB));
if (TEST_RETURN != 0)
tst_resm(TFAIL, "First attempt to flock() failed, "
"errno %d", TEST_ERRNO);
else
tst_resm(TPASS, "First attempt to flock() passed");
fd2 = open(filename, O_RDWR);
if (fd2 == -1)
tst_brkm(TFAIL, cleanup, "failed to open the"
"file, errno %d", errno);
TEST(flock(fd2, LOCK_EX | LOCK_NB));
if (TEST_RETURN == -1)
tst_resm(TPASS, "Second attempt to flock() denied");
else
tst_resm(TFAIL, "Second attempt to flock() succeeded!");
TEST(flock(fd1, LOCK_UN));
if (TEST_RETURN == -1)
tst_resm(TFAIL, "Failed to unlock fd1, errno %d",
TEST_ERRNO);
else
tst_resm(TPASS, "Unlocked fd1");
TEST(flock(fd2, LOCK_EX | LOCK_NB));
if (TEST_RETURN == -1)
tst_resm(TFAIL, "Third attempt to flock() denied!");
else
tst_resm(TPASS, "Third attempt to flock() succeeded");
close(fd1);
close(fd2);
}
cleanup();
tst_exit();
}
/*
* setup()
* performs all ONE TIME setup for this test
*/
void setup(void)
{
int fd;
tst_sig(FORK, DEF_HANDLER, cleanup);
/* Pause if that option was specified
* TEST_PAUSE contains the code to fork the test with the -i option.
* You want to make sure you do this before you create your temporary
* directory.
*/
TEST_PAUSE;
/* Create a unique temporary directory and chdir() to it. */
tst_tmpdir();
sprintf(filename, "flock06.%d", getpid());
/* creating temporary file */
fd = creat(filename, 0666);
if (fd < 0)
tst_brkm(TBROK, tst_rmdir, "creating a new file failed");
close(fd);
}
/*
* cleanup()
* performs all ONE TIME cleanup for this test at
* completion or premature exit
*/
void cleanup(void)
{
unlink(filename);
tst_rmdir();
}
|
#include "keycodes.h"
typedef struct {
qboolean down;
int repeats; // if > 1, it is autorepeating
char *binding;
} qkey_t;
#define MAX_EDIT_LINE 256
#define COMMAND_HISTORY 32
typedef struct {
int cursor;
int scroll;
int widthInChars;
char buffer[MAX_EDIT_LINE];
} field_t;
typedef struct keyGlobals_s
{
field_t historyEditLines[COMMAND_HISTORY];
int nextHistoryLine; // the last line in the history buffer, not masked
int historyLine; // the line being displayed from history buffer
// will be <= nextHistoryLine
field_t g_consoleField;
qboolean anykeydown;
qboolean key_overstrikeMode;
int keyDownCount;
qkey_t keys[MAX_KEYS];
} keyGlobals_t;
typedef struct
{
word upper;
word lower;
char *name;
int keynum;
bool menukey;
} keyname_t;
extern keyGlobals_t kg;
extern keyname_t keynames[MAX_KEYS];
void Field_Clear( field_t *edit );
void Field_KeyDownEvent( field_t *edit, int key );
void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor );
void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor );
extern field_t chatField;
void Key_WriteBindings( fileHandle_t f );
void Key_SetBinding( int keynum, const char *binding );
char *Key_GetBinding( int keynum );
qboolean Key_IsDown( int keynum );
qboolean Key_GetOverstrikeMode( void );
void Key_SetOverstrikeMode( qboolean state );
void Key_ClearStates( void );
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <packagekit-glib2/pk-enum.h>
#include <packagekit-glib2/pk-results.h>
#include <packagekit-glib2/pk-package-id.h>
#include "pk-task-wrapper.h"
static void pk_task_wrapper_finalize (GObject *object);
#define PK_TASK_WRAPPER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_TASK_WRAPPER, PkTaskWrapperPrivate))
/**
* PkTaskWrapperPrivate:
*
* Private #PkTaskWrapper data
**/
struct _PkTaskWrapperPrivate
{
gpointer user_data;
};
G_DEFINE_TYPE (PkTaskWrapper, pk_task_wrapper, PK_TYPE_TASK)
/**
* pk_task_wrapper_untrusted_question:
**/
static void
pk_task_wrapper_untrusted_question (PkTask *task, guint request, PkResults *results)
{
PkTaskWrapperPrivate *priv = PK_TASK_WRAPPER(task)->priv;
/* set some user data, for no reason */
priv->user_data = NULL;
g_print ("UNTRUSTED\n");
/* just accept without asking */
pk_task_user_accepted (task, request);
}
/**
* pk_task_wrapper_key_question:
**/
static void
pk_task_wrapper_key_question (PkTask *task, guint request, PkResults *results)
{
PkTaskWrapperPrivate *priv = PK_TASK_WRAPPER(task)->priv;
/* set some user data, for no reason */
priv->user_data = NULL;
/* just accept without asking */
pk_task_user_accepted (task, request);
}
/**
* pk_task_wrapper_eula_question:
**/
static void
pk_task_wrapper_eula_question (PkTask *task, guint request, PkResults *results)
{
PkTaskWrapperPrivate *priv = PK_TASK_WRAPPER(task)->priv;
/* set some user data, for no reason */
priv->user_data = NULL;
/* just accept without asking */
pk_task_user_accepted (task, request);
}
/**
* pk_task_wrapper_media_change_question:
**/
static void
pk_task_wrapper_media_change_question (PkTask *task, guint request, PkResults *results)
{
PkTaskWrapperPrivate *priv = PK_TASK_WRAPPER(task)->priv;
/* set some user data, for no reason */
priv->user_data = NULL;
/* just accept without asking */
pk_task_user_accepted (task, request);
}
/**
* pk_task_wrapper_simulate_question:
**/
static void
pk_task_wrapper_simulate_question (PkTask *task, guint request, PkResults *results)
{
guint i;
GPtrArray *array;
const gchar *package_id;
gchar *printable;
gchar *summary;
PkPackage *package;
PkPackageSack *sack;
PkInfoEnum info;
PkTaskWrapperPrivate *priv = PK_TASK_WRAPPER(task)->priv;
/* set some user data, for no reason */
priv->user_data = NULL;
/* get data */
sack = pk_results_get_package_sack (results);
/* print data */
array = pk_package_sack_get_array (sack);
for (i=0; i<array->len; i++) {
package = g_ptr_array_index (array, i);
g_object_get (package,
"info", &info,
"summary", &summary,
NULL);
package_id = pk_package_get_id (package);
printable = pk_package_id_to_printable (package_id);
g_print ("%s\t%s\t%s\n", pk_info_enum_to_string (info), printable, summary);
g_free (summary);
g_free (printable);
}
/* just accept without asking */
pk_task_user_accepted (task, request);
g_object_unref (sack);
g_ptr_array_unref (array);
}
/**
* pk_task_wrapper_class_init:
**/
static void
pk_task_wrapper_class_init (PkTaskWrapperClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
PkTaskClass *task_class = PK_TASK_CLASS (klass);
object_class->finalize = pk_task_wrapper_finalize;
task_class->untrusted_question = pk_task_wrapper_untrusted_question;
task_class->key_question = pk_task_wrapper_key_question;
task_class->eula_question = pk_task_wrapper_eula_question;
task_class->media_change_question = pk_task_wrapper_media_change_question;
task_class->simulate_question = pk_task_wrapper_simulate_question;
g_type_class_add_private (klass, sizeof (PkTaskWrapperPrivate));
}
/**
* pk_task_wrapper_init:
* @task_wrapper: This class instance
**/
static void
pk_task_wrapper_init (PkTaskWrapper *task)
{
task->priv = PK_TASK_WRAPPER_GET_PRIVATE (task);
task->priv->user_data = NULL;
}
/**
* pk_task_wrapper_finalize:
* @object: The object to finalize
**/
static void
pk_task_wrapper_finalize (GObject *object)
{
PkTaskWrapper *task = PK_TASK_WRAPPER (object);
task->priv->user_data = NULL;
G_OBJECT_CLASS (pk_task_wrapper_parent_class)->finalize (object);
}
/**
* pk_task_wrapper_new:
*
* Return value: a new PkTaskWrapper object.
**/
PkTaskWrapper *
pk_task_wrapper_new (void)
{
PkTaskWrapper *task;
task = g_object_new (PK_TYPE_TASK_WRAPPER, NULL);
return PK_TASK_WRAPPER (task);
}
|
/* See http://python-ldap.sourceforge.net for details.
* $Id: ldapmodule.c,v 1.8 2008/03/20 12:24:56 stroeder Exp $ */
#include "common.h"
#include "version.h"
#include "constants.h"
#include "errors.h"
#include "functions.h"
#include "schema.h"
#include "ldapcontrol.h"
#include "LDAPObject.h"
DL_EXPORT(void) init_ldap(void);
/* dummy module methods */
static PyMethodDef methods[] = {
{ NULL, NULL }
};
/* module initialisation */
DL_EXPORT(void)
init_ldap()
{
PyObject *m, *d;
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
LDAP_Type.ob_type = &PyType_Type;
#endif
/* Create the module and add the functions */
m = Py_InitModule("_ldap", methods);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
LDAPinit_version(d);
LDAPinit_constants(d);
LDAPinit_errors(d);
LDAPinit_functions(d);
LDAPinit_schema(d);
LDAPinit_control(d);
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module _ldap");
}
|
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
/* { dg-additional-options "-O2" } */
#include "arm_mve.h"
int16x8_t
foo (int16_t const * base, uint16x8_t offset, mve_pred16_t p)
{
return vldrhq_gather_shifted_offset_z_s16 (base, offset, p);
}
/* { dg-final { scan-assembler "vldrht.u16" } } */
int16x8_t
foo1 (int16_t const * base, uint16x8_t offset, mve_pred16_t p)
{
return vldrhq_gather_shifted_offset_z (base, offset, p);
}
/* { dg-final { scan-assembler "vldrht.u16" } } */
|
#pragma once
#include <QDialog>
#include <QLineEdit>
#include <QTextEdit>
#include <QComboBox>
#include <QVBoxLayout>
#include <QPushButton>
#include <QSpinBox>
#include <QGroupBox>
#include <QFontDatabase>
#include <QLabel>
#include <QFont>
#include <QScrollBar>
#include <QPainter>
#include <QMouseEvent>
class memory_viewer_panel : public QDialog
{
u32 m_addr;
u32 m_colcount;
u32 m_rowcount;
QLineEdit* m_addr_line;
QLabel* m_mem_addr;
QLabel* m_mem_hex;
QLabel* m_mem_ascii;
QFontMetrics* m_fontMetrics;
public:
bool exit;
memory_viewer_panel(QWidget* parent);
~memory_viewer_panel();
virtual void wheelEvent(QWheelEvent *event);
virtual void ShowMemory();
void SetPC(const uint pc);
//Static methods
static void ShowImage(QWidget* parent, u32 addr, int mode, u32 sizex, u32 sizey, bool flipv);
};
|
/* Tasks_Periodic
*
* This routine serves as a test task for the CBS scheduler
* implementation.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "system.h"
rtems_task Task_Periodic(
rtems_task_argument argument
)
{
rtems_id rmid;
rtems_status_code status;
time_t approved_budget, exec_time, abs_time, remaining_budget;
int start, stop, now;
rtems_cbs_server_id server_id = 0, tsid;
rtems_cbs_parameters params, tparams;
params.deadline = Period;
params.budget = Execution+1;
/* Taks 1 will be attached to a server, task 2 not. */
if ( argument == 1 ) {
printf( "Periodic task: Create server and Attach thread\n" );
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
printf( "ERROR: CREATE SERVER FAILED\n" );
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
printf( "ERROR: ATTACH THREAD FAILED\n" );
printf( "Periodic task: ID and Get parameters\n" );
if ( rtems_cbs_get_server_id( Task_id, &tsid ) )
printf( "ERROR: GET SERVER ID FAILED\n" );
if ( tsid != server_id )
printf( "ERROR: SERVER ID MISMATCH\n" );
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
printf( "ERROR: GET PARAMETERS FAILED\n" );
if ( params.deadline != tparams.deadline ||
params.budget != tparams.budget )
printf( "ERROR: PARAMETERS MISMATCH\n" );
printf( "Periodic task: Detach thread and Destroy server\n" );
if ( rtems_cbs_detach_thread( server_id, Task_id ) )
printf( "ERROR: DETACH THREAD FAILED\n" );
if ( rtems_cbs_destroy_server( server_id ) )
printf( "ERROR: DESTROY SERVER FAILED\n" );
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
printf( "ERROR: CREATE SERVER FAILED\n" );
printf( "Periodic task: Remaining budget and Execution time\n" );
if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) )
printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
if ( remaining_budget != params.budget )
printf( "ERROR: REMAINING BUDGET MISMATCH\n" );
if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
printf( "ERROR: GET EXECUTION TIME FAILED\n" );
printf( "Periodic task: Set parameters\n" );
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
printf( "ERROR: ATTACH THREAD FAILED\n" );
params.deadline = Period * 2;
params.budget = Execution * 2 +1;
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
printf( "ERROR: SET PARAMS FAILED\n" );
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
printf( "ERROR: GET PARAMS FAILED\n" );
if ( params.deadline != tparams.deadline ||
params.budget != tparams.budget )
printf( "ERROR: PARAMS MISMATCH\n" );
params.deadline = Period;
params.budget = Execution+1;
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
printf( "ERROR: SET PARAMS FAILED\n" );
if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) )
printf( "ERROR: GET APPROVED BUDGET FAILED\n" );
printf( "Periodic task: Approved budget\n" );
if ( approved_budget != params.budget )
printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
}
status = rtems_rate_monotonic_create( argument, &rmid );
directive_failed( status, "rtems_rate_monotonic_create" );
/* Starting periodic behavior of the task */
printf( "Periodic task: Starting periodic behavior\n" );
status = rtems_task_wake_after( 1 + Phase );
directive_failed( status, "rtems_task_wake_after" );
while ( FOREVER ) {
if ( rtems_rate_monotonic_period(rmid, Period) == RTEMS_TIMEOUT )
printf( "P%" PRIdPTR " - Deadline miss\n", argument );
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start );
printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start );
if ( start > 4*Period+Phase ) break; /* stop */
/* active computing */
while(FOREVER) {
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
if ( now >= start + Execution ) break;
if ( server_id != 0 ) {
if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
printf( "ERROR: GET EXECUTION TIME FAILED\n" );
if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget) )
printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
if ( (remaining_budget + exec_time) > (Execution + 1) ) {
printf( "ERROR: REMAINING BUDGET AND EXECUTION TIME MISMATCH\n" );
rtems_test_exit( 0 );
}
}
}
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop );
printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop );
}
/* delete period and SELF */
status = rtems_rate_monotonic_delete( rmid );
if ( status != RTEMS_SUCCESSFUL ) {
printf("rtems_rate_monotonic_delete failed with status of %d.\n", status);
rtems_test_exit( 0 );
}
printf( "Periodic task: Deleting self\n" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
|
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2012 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#ifndef D_NOTIFIER_H
#define D_NOTIFIER_H
#include "common.h"
#include <vector>
#include <memory>
#include <aria2/aria2.h>
namespace aria2 {
class RequestGroup;
struct DownloadEventListener {
virtual ~DownloadEventListener() {}
virtual void onEvent(DownloadEvent event, const RequestGroup* group) = 0;
};
class Notifier {
public:
Notifier();
~Notifier();
void addDownloadEventListener(DownloadEventListener* listener);
// Notifies the download event to all listeners.
void notifyDownloadEvent(DownloadEvent event, const RequestGroup* group);
void notifyDownloadEvent(DownloadEvent event,
const std::shared_ptr<RequestGroup>& group)
{
notifyDownloadEvent(event, group.get());
}
private:
std::vector<DownloadEventListener*> listeners_;
};
} // namespace aria2
#endif // D_NOTIFIER_H
|
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/lib/msun/src/s_llroundf.c,v 1.2 2005/04/08 00:52:27 das Exp $"); */
#define type float
#define roundit roundf
#define dtype long long
#define DTYPE_MIN LONGLONG_MIN
#define DTYPE_MAX LONGLONG_MAX
#define fn llroundf
#include "s_lround.c"
|
#ifndef _LINUX_PERCPU_RWSEM_H
#define _LINUX_PERCPU_RWSEM_H
#include <linux/mutex.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/delay.h>
struct percpu_rw_semaphore {
unsigned __percpu *counters;
bool locked;
struct mutex mtx;
};
static inline void percpu_down_read(struct percpu_rw_semaphore *p)
{
rcu_read_lock();
if (unlikely(p->locked)) {
rcu_read_unlock();
mutex_lock(&p->mtx);
this_cpu_inc(*p->counters);
mutex_unlock(&p->mtx);
return;
}
this_cpu_inc(*p->counters);
rcu_read_unlock();
}
static inline void percpu_up_read(struct percpu_rw_semaphore *p)
{
/*
* On X86, write operation in this_cpu_dec serves as a memory unlock
* barrier (i.e. memory accesses may be moved before the write, but
* no memory accesses are moved past the write).
* On other architectures this may not be the case, so we need smp_mb()
* there.
*/
#if defined(CONFIG_X86) && (!defined(CONFIG_X86_PPRO_FENCE) && !defined(CONFIG_X86_OOSTORE))
barrier();
#else
smp_mb();
#endif
this_cpu_dec(*p->counters);
}
static inline unsigned __percpu_count(unsigned __percpu *counters)
{
unsigned total = 0;
int cpu;
for_each_possible_cpu(cpu)
total += ACCESS_ONCE(*per_cpu_ptr(counters, cpu));
return total;
}
static inline void percpu_down_write(struct percpu_rw_semaphore *p)
{
mutex_lock(&p->mtx);
p->locked = true;
synchronize_rcu();
while (__percpu_count(p->counters))
msleep(1);
smp_rmb(); /* paired with smp_mb() in percpu_sem_up_read() */
}
static inline void percpu_up_write(struct percpu_rw_semaphore *p)
{
p->locked = false;
mutex_unlock(&p->mtx);
}
static inline int percpu_init_rwsem(struct percpu_rw_semaphore *p)
{
p->counters = alloc_percpu(unsigned);
if (unlikely(!p->counters))
return -ENOMEM;
p->locked = false;
mutex_init(&p->mtx);
return 0;
}
static inline void percpu_free_rwsem(struct percpu_rw_semaphore *p)
{
free_percpu(p->counters);
p->counters = NULL; /* catch use after free bugs */
}
#endif
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "alloc-util.h"
#include "build.h"
#include "env-file.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "hostname-util.h"
#include "log.h"
#include "macro.h"
#include "parse-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
int saved_argc = 0;
char **saved_argv = NULL;
static int saved_in_initrd = -1;
bool kexec_loaded(void) {
_cleanup_free_ char *s = NULL;
if (read_one_line_file("/sys/kernel/kexec_loaded", &s) < 0)
return false;
return s[0] == '1';
}
int prot_from_flags(int flags) {
switch (flags & O_ACCMODE) {
case O_RDONLY:
return PROT_READ;
case O_WRONLY:
return PROT_WRITE;
case O_RDWR:
return PROT_READ|PROT_WRITE;
default:
return -EINVAL;
}
}
bool in_initrd(void) {
int r;
const char *e;
bool lenient = false;
if (saved_in_initrd >= 0)
return saved_in_initrd;
/* We have two checks here:
*
* 1. the flag file /etc/initrd-release must exist
* 2. the root file system must be a memory file system
*
* The second check is extra paranoia, since misdetecting an
* initrd can have bad consequences due the initrd
* emptying when transititioning to the main systemd.
*
* If env var $SYSTEMD_IN_INITRD is not set or set to "auto",
* both checks are used. If it's set to "lenient", only check
* 1 is used. If set to a boolean value, then the boolean
* value is returned.
*/
e = secure_getenv("SYSTEMD_IN_INITRD");
if (e) {
if (streq(e, "lenient"))
lenient = true;
else if (!streq(e, "auto")) {
r = parse_boolean(e);
if (r >= 0) {
saved_in_initrd = r > 0;
return saved_in_initrd;
}
log_debug_errno(r, "Failed to parse $SYSTEMD_IN_INITRD, ignoring: %m");
}
}
if (!lenient) {
r = path_is_temporary_fs("/");
if (r < 0)
log_debug_errno(r, "Couldn't determine if / is a temporary file system: %m");
saved_in_initrd = r > 0;
}
r = access("/etc/initrd-release", F_OK);
if (r >= 0) {
if (saved_in_initrd == 0)
log_debug("/etc/initrd-release exists, but it's not an initrd.");
else
saved_in_initrd = 1;
} else {
if (errno != ENOENT)
log_debug_errno(errno, "Failed to test if /etc/initrd-release exists: %m");
saved_in_initrd = 0;
}
return saved_in_initrd;
}
void in_initrd_force(bool value) {
saved_in_initrd = value;
}
int container_get_leader(const char *machine, pid_t *pid) {
_cleanup_free_ char *s = NULL, *class = NULL;
const char *p;
pid_t leader;
int r;
assert(machine);
assert(pid);
if (streq(machine, ".host")) {
*pid = 1;
return 0;
}
if (!hostname_is_valid(machine, 0))
return -EINVAL;
p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(NULL, p,
"LEADER", &s,
"CLASS", &class);
if (r == -ENOENT)
return -EHOSTDOWN;
if (r < 0)
return r;
if (!s)
return -EIO;
if (!streq_ptr(class, "container"))
return -EIO;
r = parse_pid(s, &leader);
if (r < 0)
return r;
if (leader <= 1)
return -EIO;
*pid = leader;
return 0;
}
int version(void) {
printf("systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n%s\n",
systemd_features);
return 0;
}
/* Turn off core dumps but only if we're running outside of a container. */
void disable_coredumps(void) {
int r;
if (detect_container() > 0)
return;
r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_PROTOCOL_RTP
#ifndef _BASERTPAPPPROTOCOLHANDLER_H
#define _BASERTPAPPPROTOCOLHANDLER_H
#include "application/baseappprotocolhandler.h"
class DLLEXP BaseRTPAppProtocolHandler
: public BaseAppProtocolHandler {
public:
BaseRTPAppProtocolHandler(Variant &configuration);
virtual ~BaseRTPAppProtocolHandler();
virtual void RegisterProtocol(BaseProtocol *pProtocol);
virtual void UnRegisterProtocol(BaseProtocol *pProtocol);
};
#endif /* _BASERTPAPPPROTOCOLHANDLER_H */
#endif /* HAS_PROTOCOL_RTP */
|
/* Creation of autonomous subprocesses.
Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _EXECUTE_H
#define _EXECUTE_H
#include <stdbool.h>
/* Execute a command, optionally redirecting any of the three standard file
descriptors to /dev/null. Return its exit code.
If it didn't terminate correctly, exit if exit_on_error is true, otherwise
return 127.
If ignore_sigpipe is true, consider a subprocess termination due to SIGPIPE
as equivalent to a success. This is suitable for processes whose only
purpose is to write to standard output.
If slave_process is true, the child process will be terminated when its
creator receives a catchable fatal signal.
If termsigp is not NULL, *termsig will be set to the signal that terminated
the subprocess (if supported by the platform: not on native Windows
platforms), otherwise 0.
It is recommended that no signal is blocked or ignored while execute()
is called. See pipe.h for the reason. */
extern int execute (const char *progname,
const char *prog_path, char **prog_argv,
bool ignore_sigpipe,
bool null_stdin, bool null_stdout, bool null_stderr,
bool slave_process, bool exit_on_error,
int *termsigp);
#endif /* _EXECUTE_H */
|
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
/* see jconfig.doc for explanations */
// disable all the warnings under MSVC
#ifdef _MSC_VER
#pragma warning (disable: 4996 4267 4100 4127 4702 4244)
#endif
#ifdef __BORLANDC__
#pragma warn -8057
#pragma warn -8019
#pragma warn -8004
#pragma warn -8008
#endif
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
/* #define void char */
/* #define const */
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
#ifndef HAVE_STDLIB_H
#define HAVE_STDLIB_H
#endif
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
#undef NEED_SHORT_EXTERNAL_NAMES
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
#define TARGA_SUPPORTED /* Targa image file format */
#define TWO_FILE_COMMANDLINE /* optional */
#define USE_SETMODE /* Microsoft has setmode() */
#undef NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
#undef PROGRESS_REPORT /* optional */
#endif /* JPEG_CJPEG_DJPEG */
|
//===--------------- subtf3_test.c - Test __subtf3 ------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __subtf3 for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
#if __LDBL_MANT_DIG__ == 113
#include "fp_test.h"
// Returns: a - b
COMPILER_RT_ABI long double __subtf3(long double a, long double b);
int test__subtf3(long double a, long double b,
uint64_t expectedHi, uint64_t expectedLo)
{
long double x = __subtf3(a, b);
int ret = compareResultLD(x, expectedHi, expectedLo);
if (ret){
printf("error in test__subtf3(%.20Lf, %.20Lf) = %.20Lf, "
"expected %.20Lf\n", a, b, x,
fromRep128(expectedHi, expectedLo));
}
return ret;
}
char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};
#endif
int main()
{
#if __LDBL_MANT_DIG__ == 113
// qNaN - any = qNaN
if (test__subtf3(makeQNaN128(),
0x1.23456789abcdefp+5L,
UINT64_C(0x7fff800000000000),
UINT64_C(0x0)))
return 1;
// NaN - any = NaN
if (test__subtf3(makeNaN128(UINT64_C(0x800030000000)),
0x1.23456789abcdefp+5L,
UINT64_C(0x7fff800000000000),
UINT64_C(0x0)))
return 1;
// inf - any = inf
if (test__subtf3(makeInf128(),
0x1.23456789abcdefp+5L,
UINT64_C(0x7fff000000000000),
UINT64_C(0x0)))
return 1;
// any - any
if (test__subtf3(0x1.234567829a3bcdef5678ade36734p+5L,
0x1.ee9d7c52354a6936ab8d7654321fp-1L,
UINT64_C(0x40041b8af1915166),
UINT64_C(0xa44a7bca780a166c)))
return 1;
#else
printf("skipped\n");
#endif
return 0;
}
|
/**
* Copyright 2014 Google 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 __MR4C_RANDOM_ACCESS_FILE_H__
#define __MR4C_RANDOM_ACCESS_FILE_H__
namespace MR4C {
/**
* File that allows arbitrary movement of the file pointer. Implementations will most likely be local disk files
*/
class RandomAccessFile {
public:
/**
* Read up to the next num bytes into buf, returns the number of bytes read
*/
virtual size_t read(char* buf, size_t num) =0;
/**
* Returns the absolute location of the file pointer, in bytes
*/
virtual size_t getLocation() =0;
/**
* Set absolute location from file start
*/
virtual void setLocation(size_t loc) =0;
/**
* Set location in bytes back from end of file
*/
virtual void setLocationFromEnd(size_t loc) =0;
/**
* Skip num bytes forward from current location
*/
virtual void skipForward(size_t num) =0;
/**
* Skip num bytes backward from current location
*/
virtual void skipBackward(size_t num) =0;
virtual size_t getFileSize() =0;
virtual void close() =0;
virtual bool isClosed() const =0;
};
}
#endif
|
/*-------------------------------------------------------------------------
*
* openbsd.h
* port-specific prototypes for OpenBSD
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/port/dynloader/openbsd.h,v 1.17 2007/01/05 22:19:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
/*
* Dynamic Loader on NetBSD 1.0.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
*
* agc - I know this is all a bit crufty, but it does work, is fairly
* portable, and works (the stipulation that the d.l. function must
* begin with an underscore is fairly tricky, and some versions of
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/
/*
* In some older systems, the RTLD_NOW flag isn't defined and the mode
* argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
* if available, but it doesn't exist everywhere.
* If it doesn't exist, set it to 0 so it has no effect.
*/
#ifndef RTLD_NOW
#define RTLD_NOW 1
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym BSD44_derived_dlsym
#define pg_dlclose BSD44_derived_dlclose
#define pg_dlerror BSD44_derived_dlerror
char *BSD44_derived_dlerror(void);
void *BSD44_derived_dlopen(const char *filename, int num);
void *BSD44_derived_dlsym(void *handle, const char *name);
void BSD44_derived_dlclose(void *handle);
#endif /* PORT_PROTOS_H */
|
/****************************************************************************
*
* Copyright 2019 Samsung Electronics 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.
*
****************************************************************************/
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
//
// 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 "randombytes_default.h"
#include "esp_system.h"
static void randombytes_esp32_random_buf(void *const buf, const size_t size)
{
size_t i;
uint8_t *p = (uint8_t *)buf;
for (i = 0; i < size; i++) {
p[i] = esp_random();
}
}
static const char *randombytes_esp32_implementation_name(void)
{
return "esp32";
}
/*
Plug the ESP32 hardware RNG into libsodium's custom RNG support, as per
https://download.libsodium.org/doc/advanced/custom_rng.html
Note that this RNG is selected by default (see randombytes_default.h), so there
is no need to call randombytes_set_implementation().
*/
const struct randombytes_implementation randombytes_esp32_implementation = {
.implementation_name = randombytes_esp32_implementation_name,
.random = esp_random,
.stir = NULL,
.uniform = NULL,
.buf = randombytes_esp32_random_buf,
.close = NULL,
};
|
//
// UIDevice+ADJAdditions.h
// Adjust
//
// Created by Christian Wellenbrock on 23.07.12.
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ADJActivityHandler.h"
@interface UIDevice(ADJAdditions)
- (BOOL)adjTrackingEnabled;
- (NSString *)adjIdForAdvertisers;
- (NSString *)adjFbAttributionId;
- (NSString *)adjMacAddress;
- (NSString *)adjDeviceType;
- (NSString *)adjDeviceName;
- (NSString *)adjCreateUuid;
- (NSString *)adjVendorId;
- (void)adjSetIad:(ADJActivityHandler *)activityHandler;
@end
|
// Copyright (c) 2011 The Chromium 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 CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__
#define CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__
#pragma once
#include <set>
#include "chrome/browser/extensions/app_notification.h"
class FilePath;
// Represents storage for app notifications for a particular extension id.
//
// IMPORTANT NOTE: Instances of this class should only be used on the FILE
// thread.
class AppNotificationStorage {
public:
// Must be called on the FILE thread. The storage will be created at |path|.
static AppNotificationStorage* Create(const FilePath& path);
virtual ~AppNotificationStorage();
// Get the set of extension id's that have entries, putting them into
// |result|.
virtual bool GetExtensionIds(std::set<std::string>* result) = 0;
// Gets the list of stored notifications for extension_id. On success, writes
// results into |result|. On error, returns false.
virtual bool Get(const std::string& extension_id,
AppNotificationList* result) = 0;
// Writes the |list| for |extension_id| into storage.
virtual bool Set(const std::string& extension_id,
const AppNotificationList& list) = 0;
// Deletes all data for |extension_id|.
virtual bool Delete(const std::string& extension_id) = 0;
};
#endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__
|
// Copyright (c) 2006-2008 The Chromium 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 CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
#define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
#pragma once
#include <vector>
#include "base/basictypes.h"
class AutomationProvider;
// Stores a list of all AutomationProvider objects.
class AutomationProviderList {
public:
AutomationProviderList();
~AutomationProviderList();
typedef std::vector<AutomationProvider*> list_type;
typedef list_type::iterator iterator;
typedef list_type::const_iterator const_iterator;
// Adds and removes automation providers from the global list.
bool AddProvider(AutomationProvider* provider);
bool RemoveProvider(AutomationProvider* provider);
const_iterator begin() {
return automation_providers_.begin();
}
const_iterator end() {
return automation_providers_.end();
}
size_t size() {
return automation_providers_.size();
}
private:
void OnLastProviderRemoved();
list_type automation_providers_;
DISALLOW_COPY_AND_ASSIGN(AutomationProviderList);
};
#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
|
/*
* Copyright (c) 2013 Chun-Ying Huang
*
* This file is part of GamingAnywhere (GA).
*
* GA is free software; you can redistribute it and/or modify it
* under the terms of the 3-clause BSD License as published by the
* Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause
*
* GA 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.
*
* You should have received a copy of the 3-clause BSD License along with GA;
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __SDL12_AUDIO_H__
#define __SDL12_AUDIO_H__
struct SDL12_AudioSpec {
int freq; /**< DSP frequency -- samples per second */
uint16_t format; /**< Audio data format */
uint8_t channels; /**< Number of channels: 1 mono, 2 stereo */
uint8_t silence; /**< Audio buffer silence value (calculated) */
uint16_t samples; /**< Audio buffer size in samples (power of 2) */
uint16_t padding; /**< Necessary for some compile environments */
uint32_t size; /**< Audio buffer size in bytes (calculated) */
/**
* This function is called when the audio device needs more data.
*
* @param[out] stream A pointer to the audio data buffer
* @param[in] len The length of the audio buffer in bytes.
*
* Once the callback returns, the buffer will no longer be valid.
* Stereo samples are stored in a LRLRLR ordering.
*/
void (*callback)(void *userdata, uint8_t *stream, int len);
void *userdata;
};
#define SDL12_AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
#define SDL12_AUDIO_S8 0x8008 /**< Signed 8-bit samples */
#define SDL12_AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
#define SDL12_AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
#define SDL12_AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
#define SDL12_AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
#define SDL12_AUDIO_U16 SDL12_AUDIO_U16LSB
#define SDL12_AUDIO_S16 SDL12_AUDIO_S16LSB
#endif
|
// Copyright 2014 The Chromium 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 CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_
#define CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_
#include <map>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/power/origin_power_map_factory.h"
#include "url/gurl.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/power_manager_client.h"
#endif
class Profile;
namespace content {
class RenderProcessHost;
}
#if defined(OS_CHROMEOS)
namespace power_manager {
class PowerSupplyProperties;
}
#endif
// Manages regular updates of the profile power consumption.
class ProcessPowerCollector
#if defined(OS_CHROMEOS)
: public chromeos::PowerManagerClient::Observer
#endif
{
public:
class PerProcessData {
public:
PerProcessData(scoped_ptr<base::ProcessMetrics> metrics,
const GURL& origin,
Profile* profile);
PerProcessData();
~PerProcessData();
base::ProcessMetrics* metrics() const { return metrics_.get(); }
Profile* profile() const { return profile_; }
GURL last_origin() const { return last_origin_; }
int last_cpu_percent() const { return last_cpu_percent_; }
bool seen_this_cycle() const { return seen_this_cycle_; }
void set_last_cpu_percent(double new_cpu) { last_cpu_percent_ = new_cpu; }
void set_seen_this_cycle(bool seen) { seen_this_cycle_ = seen; }
private:
// |metrics_| holds the ProcessMetrics information for the given process.
scoped_ptr<base::ProcessMetrics> metrics_;
// |profile| is the profile that is visiting the |last_origin_|.
// It is not owned by PerProcessData.
Profile* profile_;
// |last_origin_| is the last origin visited by the process.
GURL last_origin_;
// |last_cpu_percent_| is the proportion of the CPU used since the last
// query.
double last_cpu_percent_;
// |seen_this_cycle| represents if the process still exists in this cycle.
// If it doesn't, we erase the PerProcessData.
bool seen_this_cycle_;
DISALLOW_COPY_AND_ASSIGN(PerProcessData);
};
// A map from all process handles to a metric.
typedef std::map<base::ProcessHandle, linked_ptr<PerProcessData> >
ProcessMetricsMap;
// A callback used to define mock CPU usage for testing.
typedef base::Callback<double(base::ProcessHandle)> CpuUsageCallback;
// On Chrome OS, can only be initialized after the DBusThreadManager has been
// initialized.
ProcessPowerCollector();
#if defined(OS_CHROMEOS)
// On Chrome OS, can only be destroyed before DBusThreadManager is.
~ProcessPowerCollector() override;
#else
virtual ~ProcessPowerCollector();
#endif
void set_cpu_usage_callback_for_testing(const CpuUsageCallback& callback) {
cpu_usage_callback_ = callback;
}
ProcessMetricsMap* metrics_map_for_testing() { return &metrics_map_; }
#if defined(OS_CHROMEOS)
// PowerManagerClient::Observer implementation:
void PowerChanged(const power_manager::PowerSupplyProperties& prop) override;
#endif
// Begin periodically updating the power consumption numbers by profile.
void Initialize();
// Calls UpdatePowerConsumption() and returns the total CPU percent.
double UpdatePowerConsumptionForTesting();
private:
// Starts the timer for updating the power consumption.
void StartTimer();
// Calls SynchronizerProcesses() and RecordCpuUsageByOrigin() to update the
// |metrics_map_| and attribute power consumption. Invoked by |timer_| and as
// a helper method for UpdatePowerConsumptionForTesting().
double UpdatePowerConsumption();
// Calls UpdatePowerConsumption(). Invoked by |timer_|.
void HandleUpdateTimeout();
// Synchronizes the currently active processes to the |metrics_map_| and
// returns the total amount of cpu usage in the cycle.
double SynchronizeProcesses();
// Attributes the power usage to the profiles and origins using the
// information from SynchronizeProcesses() given a total amount
// of CPU used in this cycle, |total_cpu_percent|.
void RecordCpuUsageByOrigin(double total_cpu_percent);
// Adds the information from a given RenderProcessHost to the |metrics_map_|
// for a given origin. Called by SynchronizeProcesses().
void UpdateProcessInMap(const content::RenderProcessHost* render_process,
const GURL& origin);
ProcessMetricsMap metrics_map_;
base::RepeatingTimer timer_;
// Callback to use to get CPU usage if set.
CpuUsageCallback cpu_usage_callback_;
// The factor to scale the CPU usage by.
double scale_factor_;
DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector);
};
#endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_
|
// Copyright 2020 The Chromium 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 BASE_TRACING_PERFETTO_PLATFORM_H_
#define BASE_TRACING_PERFETTO_PLATFORM_H_
#include "third_party/perfetto/include/perfetto/tracing/platform.h"
#include "base/base_export.h"
#include "base/memory/scoped_refptr.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/threading/thread_local_storage.h"
namespace base {
class DeferredSequencedTaskRunner;
namespace tracing {
class BASE_EXPORT PerfettoPlatform : public perfetto::Platform,
ThreadIdNameManager::Observer {
public:
// Specifies the type of task runner used by Perfetto.
// TODO(skyostil): Move all scenarios to use the default task runner to
// avoid problems with unexpected re-entrancy and IPC deadlocks.
enum class TaskRunnerType {
// Use Perfetto's own task runner which runs tasks on a dedicated (internal)
// thread.
kBuiltin,
// Use base::ThreadPool.
kThreadPool,
};
explicit PerfettoPlatform(TaskRunnerType = TaskRunnerType::kThreadPool);
~PerfettoPlatform() override;
SequencedTaskRunner* task_runner() const;
bool did_start_task_runner() const { return did_start_task_runner_; }
void StartTaskRunner(scoped_refptr<SequencedTaskRunner>);
// perfetto::Platform implementation:
ThreadLocalObject* GetOrCreateThreadLocalObject() override;
std::unique_ptr<perfetto::base::TaskRunner> CreateTaskRunner(
const CreateTaskRunnerArgs&) override;
std::string GetCurrentProcessName() override;
// ThreadIdNameManager::Observer implementation.
void OnThreadNameChanged(const char* name) override;
private:
const TaskRunnerType task_runner_type_;
scoped_refptr<DeferredSequencedTaskRunner> deferred_task_runner_;
bool did_start_task_runner_ = false;
ThreadLocalStorage::Slot thread_local_object_;
};
} // namespace tracing
} // namespace base
#endif // BASE_TRACING_PERFETTO_PLATFORM_H_
|
// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s
extern void foo_alias (void) __asm ("foo");
inline void foo (void) {
return foo_alias ();
}
extern int abs_alias (int) __asm ("abs");
inline __attribute__ ((__always_inline__)) int abs (int x) {
return abs_alias(x);
}
extern char *strrchr_foo (const char *__s, int __c) __asm ("strrchr");
extern inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) char * strrchr_foo (const char *__s, int __c) {
return __builtin_strrchr (__s, __c);
}
extern inline void __attribute__((always_inline, __gnu_inline__))
prefetch(void) {
__builtin_prefetch(0, 0, 1);
}
extern inline __attribute__((__always_inline__, __gnu_inline__)) void *memchr(void *__s, int __c, __SIZE_TYPE__ __n) {
return __builtin_memchr(__s, __c, __n);
}
void f(void) {
foo();
abs(0);
strrchr_foo("", '.');
prefetch();
memchr("", '.', 0);
}
// CHECK-LABEL: define void @f()
// CHECK: call void @foo()
// CHECK: call i32 @abs(i32 0)
// CHECK: call i8* @strrchr(
// CHECK: call void @llvm.prefetch.p0i8(
// CHECK: call i8* @memchr(
// CHECK: ret void
// CHECK: declare void @foo()
// CHECK: declare i32 @abs(i32
// CHECK: declare i8* @strrchr(i8*, i32)
// CHECK: declare i8* @memchr(
// CHECK: declare void @llvm.prefetch.p0i8(
|
/*
* Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
*
* This source code is licensed under the MIT-style license found in the
* license.txt file in the root directory of this source tree.
*
*
* Header file redirection to keep source compatibility with RakNet 4.082.
*/
#include "../include/slikenet/SendToThread.h"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.