text stringlengths 4 6.14k |
|---|
/** @file
*
* The header file for the Multiply class.
*
* @author Nicolas Bock <nicolas.bock@freeon.org>
* @author Matt Challacombe <matt.challacombe@freeon.org>
*/
#ifndef __MULTIPLY_H
#define __MULTIPLY_H
#include "multiply.decl.h"
/** A multiplication. */
class Multiply : public CBase_Multiply
{
private:
/** Matrix A. */
CProxy_Matrix A;
/** Matrix B. */
CProxy_Matrix B;
/** Matrix C. */
CProxy_Matrix C;
/** The tree depth of the matrix. */
int depth;
/** The convolution. There is a convolution for each tier. */
CProxy_MultiplyElement *convolution;
#ifdef PRUNE_CONVOLUTION
/** A map to indicate which convolution element is currently active. */
bool **convolutionMap;
#endif
/** A callback. */
CkCallback cb;
/** The PEMap, updated by calling updatePEMap(). */
int *PEMap;
/** The norms of the PEMap. */
double *PEMap_norm;
/** The complexity of this Multiply. */
double complexity;
public:
Multiply (CProxy_Matrix A, CProxy_Matrix B, CProxy_Matrix C);
~Multiply (void);
void init (int initialPE, bool alignPEs, CkCallback &cb);
void multiply (double tolerance, double alpha, double beta, bool symbolic_only, CkCallback &cb);
void updatePEMap (CkCallback &cb);
void donePEMap (CkReductionMsg *data);
PEMapMsg * getPEMap (void);
void updateComplexity (CkCallback &cb);
void doneComplexity (double complexity);
DoubleMsg * getComplexity (void);
};
#endif
|
/* /////////////////////////////////////////////////////////////////////////
* File: pantheios/implicit_link/bel.WindowsSyslog.WithCallback.h
*
* Purpose: Implicitly links in the Pantheios Windows-syslog Local Back-End Library
*
* Created: 25th August 2006
* Updated: 29th June 2016
*
* Home: http://pantheios.org/
*
* Copyright (c) 2006-2016, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name(s) of Matthew Wilson and Synesis Software nor the
* names of any 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 OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ////////////////////////////////////////////////////////////////////// */
/** \file pantheios/implicit_link/bel.WindowsSyslog.WithCallback.h
*
* [C, C++] Implicitly links in the \ref page__backend__callbacks "callback" version of the
* \ref group__backend__stock_backends__WindowsSyslog "Pantheios Windows-syslog Local Back-End Library"
* as the local back-end for the given link-unit.
*/
#ifndef PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK
#define PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK
/* /////////////////////////////////////////////////////////////////////////
* version information
*/
#ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
# define PANTHEIOS_VER_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK_MAJOR 2
# define PANTHEIOS_VER_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK_MINOR 0
# define PANTHEIOS_VER_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK_REVISION 1
# define PANTHEIOS_VER_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK_EDIT 8
#endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* includes
*/
#ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
# include <pantheios/pantheios.h>
#endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
#ifndef PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_IMPLICIT_LINK_BASE_
# include <pantheios/implicit_link/implicit_link_base_.h>
#endif /* !PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_IMPLICIT_LINK_BASE_ */
#ifndef PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_BEC_WINDOWSSYSLOG_CALLBACK
# include <pantheios/implicit_link/bec.WindowsSyslog.WithCallback.h>
#endif /* !PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_BEC_WINDOWSSYSLOG_CALLBACK */
/* /////////////////////////////////////////////////////////////////////////
* implicit-linking directives
*/
#ifdef PANTHEIOS_IMPLICIT_LINK_SUPPORT
# if defined(__BORLANDC__)
# elif defined(__COMO__)
# elif defined(__DMC__)
# elif defined(__GNUC__)
# elif defined(__INTEL_COMPILER)
# pragma comment(lib, PANTHEIOS_IMPL_LINK_LIBRARY_NAME_("bel.WindowsSyslog"))
# pragma message(" " PANTHEIOS_IMPL_LINK_LIBRARY_NAME_("bel.WindowsSyslog"))
# elif defined(__MWERKS__)
# elif defined(__WATCOMC__)
# elif defined(_MSC_VER)
# pragma comment(lib, PANTHEIOS_IMPL_LINK_LIBRARY_NAME_("bel.WindowsSyslog"))
# pragma message(" " PANTHEIOS_IMPL_LINK_LIBRARY_NAME_("bel.WindowsSyslog"))
# else /* ? compiler */
# error Compiler not recognised
# endif /* compiler */
#endif /* PANTHEIOS_IMPLICIT_LINK_SUPPORT */
/* ////////////////////////////////////////////////////////////////////// */
#endif /* !PANTHEIOS_INCL_PANTHEIOS_IMPLICIT_LINK_H_BEL_WINDOWSSYSLOG_CALLBACK */
/* ///////////////////////////// end of file //////////////////////////// */
|
//=============================================================================================================
/**
* @file sensorwidget.h
* @author Christoph Dinh <chdinh@nmr.mgh.harvard.edu>;
* Matti Hamalainen <msh@nmr.mgh.harvard.edu>
* @version 1.0
* @date May, 2014
*
* @section LICENSE
*
* Copyright (C) 2014, Christoph Dinh and Matti Hamalainen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that
* the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of MNE-CPP authors 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* @brief Declaration of the SensorWidget Class.
*
*/
#ifndef SENSORWIDGET_H
#define SENSORWIDGET_H
//*************************************************************************************************************
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "sensormodel.h"
//*************************************************************************************************************
//=============================================================================================================
// QT INCLUDES
//=============================================================================================================
#include <QWidget>
#include <QGraphicsView>
#include <QGraphicsScene>
//*************************************************************************************************************
//=============================================================================================================
// DEFINE NAMESPACE XDISPLIB
//=============================================================================================================
namespace XDISPLIB
{
//=============================================================================================================
/**
* DECLARE CLASS SensorWidget
*
* @brief The SensorWidget class provides the sensor selection widget
*/
class SensorWidget : public QWidget
{
Q_OBJECT
public:
//=========================================================================================================
/**
* Constructs a SensorWidget which is a child of parent.
*
* @param [in] parent parent of widget
* @param [in] f widget flags
*/
SensorWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
//=========================================================================================================
/**
* Create the user interface
*/
void createUI();
//=========================================================================================================
/**
* draw the channels
*/
void drawChannels();
//=========================================================================================================
/**
* Sets the SensorModel to display
*
* @param [in] model Model to set
*/
void setModel(SensorModel *model);
//=========================================================================================================
/**
* Repaint the sensor widget with given parameters
*
* @param [in] topLeft Index of upper left corner which has to be updated
* @param [in] bottomRight Index of bottom right corner which has to be updated
* @param [in] roles Role which has been updated
*/
void contextUpdate(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles = QVector<int> ());
//=========================================================================================================
/**
* Repaint the sensor widget
*/
void contextUpdate();
private:
SensorModel* m_pSensorModel; /**< Connected sensor model */
QGraphicsView* m_pGraphicsView; /**< View where channel items are displayed */
QGraphicsScene* m_pGraphicsScene; /**< Scene holding the channel items */
};
} // NAMESPACE
#endif // SENSORWIDGET_H
|
#pragma once
#include <boost/signals2.hpp>
namespace q
{
namespace util
{
//signal/slots
typedef boost::signals2::connection Connection;
typedef boost::signals2::shared_connection_block Shared_Connection_Block;
template <class Signature>
class Signal : util::Noncopyable
{
public:
typedef boost::signals2::signal<Signature> signal_t;
signal_t& get_signal()
{
if (!m_signal)
{
m_signal.reset(new signal_t());
}
return *m_signal;
}
template<class SlotType>
Connection connect(SlotType const& slot)
{
return get_signal().connect(slot);
}
void execute()
{
if (m_signal)
{
(*m_signal)();
}
}
template<class P0>
void execute(P0&& p0)
{
if (m_signal)
{
(*m_signal)(std::forward<P0>(p0));
}
}
template<class P0, class P1>
void execute(P0&& p0, P1&& p1)
{
if (m_signal)
{
(*m_signal)(std::forward<P0>(p0), std::forward<P1>(p1));
}
}
template<class P0, class P1, class P2>
void execute(P0&& p0, P1&& p1, P2&& p2)
{
if (m_signal)
{
(*m_signal)(std::forward<P0>(p0), std::forward<P1>(p1), std::forward<P2>(p2));
}
}
template<class P0, class P1, class P2, class P3>
void execute(P0&& p0, P1&& p1, P2&& p2, P3&& p3)
{
if (m_signal)
{
(*m_signal)(std::forward<P0>(p0), std::forward<P1>(p1), std::forward<P2>(p2), std::forward<P3>(p3));
}
}
private:
std::unique_ptr<boost::signals2::signal<Signature>> m_signal;
};
class Scoped_Connection : public boost::noncopyable
{
public:
Scoped_Connection()
: m_ptr(std::unique_ptr<Connection, decltype(&disconnect_and_delete)>(nullptr, &disconnect_and_delete))
{
}
Scoped_Connection(Connection const& c)
: m_ptr(std::unique_ptr<Connection, decltype(&disconnect_and_delete)>(new Connection(c), &disconnect_and_delete))
{
}
Scoped_Connection(Scoped_Connection&& c)
: m_ptr(std::move(c.m_ptr))
{
}
Scoped_Connection& operator=(Scoped_Connection&& c)
{
m_ptr = std::move(c.m_ptr);
return *this;
}
Connection& get()
{
return *m_ptr;
}
void reset()
{
m_ptr.reset(nullptr);
}
void disconnect()
{
m_ptr.reset(nullptr);
}
private:
static void disconnect_and_delete(Connection* c)
{
if (c)
{
c->disconnect();
delete c;
}
}
std::unique_ptr<Connection, decltype(&disconnect_and_delete)> m_ptr;
};
}
}
|
#ifndef _UEVENT_H
#define _UEVENT_H
struct uevent;
typedef int (*uevent_callback_t)(struct uevent *uevent, int sd, int mask,
void *userdata);
struct uevent
{
int max_slots;
int curr_slot;
int used_slots;
struct
{
uevent_callback_t callback;
void *userdata;
} fdmap[__FD_SETSIZE];
fd_set readfds;
fd_set writefds;
int max_fd;
};
enum { UEVENT_WRITE = 1 << 0, UEVENT_READ = 1 << 1 };
struct uevent *uevent_new(struct uevent *uevent);
int uevent_loop(struct uevent *uevent);
int uevent_select(struct uevent *uevent, struct timeval *timeout);
int uevent_yield(struct uevent *uevent, int fd, int mask,
uevent_callback_t callback, void *userdata);
void uevent_clear(struct uevent *uevent, int fd);
#endif // _UEVENT_H
|
/**/
#include<stdio.h>
int main(void) {
int a, b, c, median, temp;
median = 0;
temp = 0;
printf("Please enter 3 numbers separated by spaces > ");
scanf ("%d%d%d", &a, &b, &c);
if (a>=b) {
temp = b;
b = a;
a = temp;
}
if (c>b)
median = b;
else if (c<b && c>a)
median = c;
else
median = a;
printf("%d is the median\n", median);
return(0);
}
|
#ifndef RESULT_HANDLER_H
#define RESULT_HANDLER_H
// Public class ...
template<class T>
class ResultHandler {
public:
struct FinalFunctor {
virtual void __call(std::vector<T>* userList) = 0;
};
static void rowHandler(void* objects, int fieldCount, const char* row[])
{
T obj(fieldCount, row);
static_cast< std::vector<T>* >(objects)->push_back(obj);
}
static void finalHandler(void* callback, void* objects)
{
FinalFunctor* func = static_cast< ResultHandler<T>::FinalFunctor* >(callback);
func->__call(static_cast< std::vector<T>* >(objects) );
}
};
#endif |
/* Copyright (C) 2010 Mikkel Krautz <mikkel@krautz.dk>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the Mumble Developers 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 FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
@interface NSInvocation (MumbleKitAdditions)
+ (NSInvocation *) invocationWithTarget:(id)target selector:(SEL)selector;
+ (void **) nilPointerLocation;
- (void) invokeOnMainThread;
- (void) invokeOnMainThreadAndWait;
@end |
#ifndef PARAM_H
#define PARAM_H
#define GAP 20
#define ALPHABET_SIZE 20
#endif
|
// Copyright 2017 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_ASH_TPM_FIRMWARE_UPDATE_H_
#define CHROME_BROWSER_ASH_TPM_FIRMWARE_UPDATE_H_
#include <memory>
#include <set>
#include "base/callback_forward.h"
#include "base/time/time.h"
namespace base {
class DictionaryValue;
}
namespace enterprise_management {
class TPMFirmwareUpdateSettingsProto;
}
namespace chromeos {
namespace tpm_firmware_update {
// Constants to identify the TPM firmware update modes that are supported. Do
// not re-assign constants, the numbers appear in local_state pref values.
enum class Mode : int {
// No update should take place. Used as a default in contexts where there is
// no proper value.
kNone = 0,
// Update TPM firmware via powerwash.
kPowerwash = 1,
// Device-state preserving update flow. Destroys all user data.
kPreserveDeviceState = 2,
// Force clear TPM after successful update, useful to flush out vulnerable
// SRK that might be left behind.
kCleanup = 3,
};
// Settings dictionary key constants.
extern const char kSettingsKeyAllowPowerwash[];
extern const char kSettingsKeyAllowPreserveDeviceState[];
extern const char kSettingsKeyAutoUpdateMode[];
// Decodes the TPM firmware update settings into base::Value representation.
std::unique_ptr<base::DictionaryValue> DecodeSettingsProto(
const enterprise_management::TPMFirmwareUpdateSettingsProto& settings);
// Check what update modes are allowed. The |timeout| parameter determines how
// long to wait in case the decision whether an update is available is still
// pending.
void GetAvailableUpdateModes(
base::OnceCallback<void(const std::set<Mode>&)> completion,
base::TimeDelta timeout);
// Checks if there's a TPM firmware update available. Calls the callback
// |completion| with the result. Result is true if there's an update available
// and the SRK (Storage Root Key) is vulnerable, false otherwise. More
// information: https://www.chromium.org/chromium-os/tpm_firmware_update Note:
// This method doesn't check if policy allows TPM firmware updates. Note: This
// method doesn't consider the case where the firmware is updated but the SRK is
// still vulnerable.
void UpdateAvailable(base::OnceCallback<void(bool)> completion,
base::TimeDelta timeout);
} // namespace tpm_firmware_update
} // namespace chromeos
// TODO(https://crbug.com/1164001): remove when Chrome OS code migration is
// done.
namespace ash {
namespace tpm_firmware_update {
using ::chromeos::tpm_firmware_update::DecodeSettingsProto;
using ::chromeos::tpm_firmware_update::GetAvailableUpdateModes;
using ::chromeos::tpm_firmware_update::Mode;
} // namespace tpm_firmware_update
} // namespace ash
#endif // CHROME_BROWSER_ASH_TPM_FIRMWARE_UPDATE_H_
|
/**
* @file
*
* @brief Headers for dbusrecv plugin
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*
*/
#ifndef ELEKTRA_PLUGIN_DBUS_H
#define ELEKTRA_PLUGIN_DBUS_H
#include <kdbassert.h>
#include <kdbioplugin.h>
#include <kdbnotificationinternal.h>
#include <kdbplugin.h>
#include <dbus/dbus.h>
#include <string.h>
// elektraIoDbus*()
#include <kdbio/adapters/dbus.h>
/**
* @internal
* Private plugin data
*/
typedef struct
{
// I/O binding (may be NULL)
ElektraIoInterface * ioBinding;
// Notification callback (may be NULL)
ElektraNotificationCallback notificationCallback;
void * notificationContext;
// Indicates whether D-Bus connections are initialized
int dbusInitialized;
// D-Bus connections (may be NULL)
DBusConnection * systemBus;
DBusConnection * sessionBus;
// D-Bus I/O adapter handles
ElektraIoAdapterDbusHandle * systemBusAdapter;
ElektraIoAdapterDbusHandle * sessionBusAdapter;
} ElektraDbusRecvPluginData;
int elektraDbusRecvSetupReceive (ElektraDbusRecvPluginData * pluginData, DBusBusType type, DBusHandleMessageFunction filter_func);
int elektraDbusRecvTeardownReceive (ElektraDbusRecvPluginData * pluginData, DBusBusType type, DBusHandleMessageFunction filter_func);
DBusHandlerResult elektraDbusRecvMessageHandler (DBusConnection * connection, DBusMessage * message, void * data);
void elektraDbusRecvSetIoBinding (Plugin * handle, KeySet * parameters);
void elektraDbusRecvOpenNotification (Plugin * handle, KeySet * parameters);
void elektraDbusRecvCloseNotification (Plugin * handle, KeySet * parameters);
int elektraDbusRecvOpen (Plugin * handle, Key * errorKey);
int elektraDbusRecvClose (Plugin * handle, Key * errorKey);
int elektraDbusRecvGet (Plugin * handle, KeySet * ks, Key * parentKey);
Plugin * ELEKTRA_PLUGIN_EXPORT;
#endif
|
#ifndef HASKELL_HPX_H
#define HASKELL_HPX_H
#include <hpx/hpx.h>
#include <stdint.h>
int haskell_hpx_trampoline(const hpx_action_t);
#endif
|
#ifndef __ConvertBuffer_h
#define __ConvertBuffer_h
#include "TypeInfo.h"
#include <cassert>
template <typename T>
inline void flipEndianness(T &val)
{
int mid = sizeof(T)/2;
char *data = reinterpret_cast<char*>(&val);
for (int i = 0; i < mid; ++i)
{
std::swap(data[i], data[sizeof(T) - i - 1]);
}
}
template <typename SrcT, typename DstT>
void convertBuffer(const SrcT *in, size_t nelms, DstT *out)
{
for (size_t i = 0; i < nelms; ++i)
{
SrcT val = *in++;
flipEndianness(val);
*out++ = static_cast<DstT>(val);
}
}
template <typename T>
void convertBufferWithTypeInfo(const char *in, const TypeInfo &ti,
size_t nelms, T *out)
{
switch (ti.getId())
{
case TypeInfo::ID_CHAR:
convertBuffer(in, nelms, out);
break;
case TypeInfo::ID_SHORT:
convertBuffer(reinterpret_cast<const short*>(in), nelms, out);
break;
case TypeInfo::ID_USHORT:
convertBuffer(reinterpret_cast<const unsigned short*>(in), nelms, out);
break;
case TypeInfo::ID_INT:
convertBuffer(reinterpret_cast<const int*>(in), nelms, out);
break;
case TypeInfo::ID_FLOAT:
convertBuffer(reinterpret_cast<const float*>(in), nelms, out);
break;
case TypeInfo::ID_DOUBLE:
convertBuffer(reinterpret_cast<const double*>(in), nelms, out);
break;
default:
assert(false);
break;
}
}
#endif
|
// Copyright (c) 2009, Whispersoft s.r.l.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Whispersoft s.r.l. 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
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Bridge for callbacks
#ifndef __WHISPERLIB_BASE_CALLBACK_H__
#define __WHISPERLIB_BASE_CALLBACK_H__
#include "whisperlib/base/callback/closure.h"
#include "whisperlib/base/callback/callback.h"
#include "whisperlib/base/callback/callback1.h"
#include "whisperlib/base/callback/callback2.h"
#include "whisperlib/base/callback/callback3.h"
#include "whisperlib/base/callback/result_closure.h"
#include "whisperlib/base/callback/result_callback1.h"
#include "whisperlib/base/callback/result_callback2.h"
#include "whisperlib/base/callback/result_callback3.h"
#include "whisperlib/base/callback/callback4.h"
#endif // __WHISPERLIB_BASE_CALLBACK_H__
|
// Copyright 2018 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.
// This file defines the browser-specific base::FeatureList features that are
// not shared with other process types.
#ifndef CHROME_BROWSER_BROWSER_FEATURES_H_
#define CHROME_BROWSER_BROWSER_FEATURES_H_
#include "base/feature_list.h"
#include "build/build_config.h"
namespace features {
// All features in alphabetical order. The features should be documented
// alongside the definition of their values in the .cc file.
#if defined(OS_CHROMEOS)
extern const base::Feature kDoubleTapToZoomInTabletMode;
#endif
#if !defined(OS_ANDROID)
extern const base::Feature kNearbySharing;
#endif
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
extern const base::Feature kUserDataSnapshot;
#endif
} // namespace features
#endif // CHROME_BROWSER_BROWSER_FEATURES_H_
|
#pragma once
extern int b;
|
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "common_tools.h"
#include "opengles.h"
typedef void (APIENTRY *glBlendBarrierKHRPROC) (void);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_KHRBlendEquationAdvanced_glBlendBarrierKHR(JNIEnv *__env, jclass clazz) {
glBlendBarrierKHRPROC glBlendBarrierKHR = (glBlendBarrierKHRPROC)tlsGetFunction(574);
UNUSED_PARAM(clazz)
glBlendBarrierKHR();
}
EXTERN_C_EXIT
|
#ifndef __KERN_CPU_H__
#define __KERN_CPU_H__
#include <kern/conf.h>
#if (defined(__i386__) || defined(__i486__) \
|| defined(__i586__) || defined(__i686__) \
|| defined(__x86_64__) || defined(__amd64__))
#include <kern/unit/x86/cpuid.h>
#endif
//#define NCPUWORD 6 /* cpu, proc, task, pdir, pid, info */
/* CPU flg-values */
#define CPUSTARTED (1L << 0)
#define CPURESCHED (1L << 1)
#define CPUINITBIT (1L << 2)
#define CPUHASINFO (1L << 3)
struct cpu {
/* cpu-local variables */
struct cpu *cpu; // first item for k_getcurcpu/k_setcurcpu
long unit; // system processor unit ID
struct task *task; // current task data
long pid; // ID of current process
struct proc *proc; // current process data
uintptr_t pdir; // page directory page address
long flg; // flags as listed above
volatile uint32_t *apic; // local APIC base address
/* scheduler parameters */
uintmax_t ntick; // tick count
long nicemin; // minimum nice in effect
long loaduser; // user/timeshare load
long load; // load
/* info about cpu cache and features */
struct m_cpuinfo info;
};
extern volatile struct cpu k_cputab[CPUSMAX];
#endif /* __KERN_CPU_H__ */
|
// RUN: jlang-cc -include %S/file_to_include.h -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 1
// PR3464
|
/*
* Copyright (c) 2014, PocketCampus.Org
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of PocketCampus.Org 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Created by Loïc Gardiol on 20.07.14.
@class MoodleFolder2;
@interface MoodleFolderViewController : UITableViewController
- (instancetype)initWithFolder:(MoodleFolder2*)folder;
@property (nonatomic, strong, readonly) MoodleFolder2* folder;
@end
|
/* $NetBSD: kcore.h,v 1.2 1998/08/31 14:43:40 tsubai Exp $ */
/*-
* Copyright (C) 1996 Wolfgang Solfrank.
* Copyright (C) 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MACHINE_KCORE_H_
#define _MACHINE_KCORE_H_
#define NPHYS_RAM_SEGS 4
typedef struct cpu_kcore_hdr {
paddr_t ptable; /* Phys address of page table */
paddr_t potable; /* Phys address of page overflow table */
phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
} cpu_kcore_hdr_t;
#endif /* _MACHINE_KCORE_H_ */
|
#pragma once
#include <QtWidgets/qmainwindow.h>
#include <QtWidgets/QLabel>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QSpinBox>
#include <QtCore/QString>
#include "widgets.h"
namespace ccnt {
class Window : public QMainWindow {
public:
Window();
virtual ~Window();
void loadImage(const QString& file);
private:
QString file;
CounterWidget* counterWidget = nullptr;
QScrollArea* scrollArea = nullptr;
QSpinBox* minAreaBox;
QSpinBox* maxAreaBox;
QSpinBox* minThresholdBox;
QSpinBox* maxThresholdBox;
QSpinBox* thresholdStepBox;
QSpinBox* manualSelectionBox;
bool maybeSave();
void openFile();
Q_OBJECT
private slots:
void findColonies();
bool save();
void open();
void openDataFile();
void updateManualSelection(int);
};
} // namespace ccnt
|
/*
Author: Ralph Drake
Class: CSI-140-05
Assignment: Final Project
Date Assigned: November 29th, 2016
Due Date: 17:00 EST, December 9th, 2016
Description:
A text-based exploration game
Certification of Authenticity:
I certify that this is entirely my own work, except where I have given
fully-documented references to the work of others. I understand the
definition and consequences of plagiarism and acknowledge that the assessor
of this assignment may, for the purpose of assessing this assignment:
- Reproduce this assignment and provide a copy to another member of
academic staff; and/or
- Communicate a copy of this assignment to a plagiarism checking
service (which may then retain a copy of this assignment on its
database for the purpose of future plagiarism checking)
*/
#pragma once
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include "settings.h"
#include "room.h"
#include "player.h"
namespace interpreter
{
enum class intention{
UNDEFINED, // Undefined input
HELP, // User asked for info about available commands
QUIT, // User wants to quit
LOOK, // User wants a description of the room they're in
ITEM, // User wants to pick up an item
MOVE, // User wants to move to another room
ASCEND // Climb the staircase to win the game
};
enum class grabbedItem {
UNDEFINED,
TORCH
};
std::string toLowerCasePBV(std::string);
void toLowerCasePBR(std::string&);
std::string userInput();
void splitSentence(std::string, std::string[]);
intention interpret(std::string);
grabbedItem getItem(std::string);
bool isNextRoomTooDark(bool, room);
bool isValidRoom(room);
std::string printExits(room);
} |
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
#include <time.h>
#include "system.h"
long sys_time()
{
return time((long *) 0);
}
|
/* Copyright 2013 Yahoo! Inc. */
/* See LICENSE in the root of the distribution for licensing details. */
#ifndef DONT_MULTI_INCLUDE_MDBM_ATOMIC_H
#define DONT_MULTI_INCLUDE_MDBM_ATOMIC_H
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
#include <sys/types.h>
#include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Atomically decrement 'var'. Returns old value. */
static inline uint32_t atomic_dec32u(uint32_t* var) {
return __sync_fetch_and_sub(var, 1);
}
static inline int32_t atomic_dec32s(int32_t* var) {
return __sync_fetch_and_sub(var, 1);
}
static inline sig_atomic_t atomic_decsa(sig_atomic_t* var) {
return __sync_fetch_and_sub(var, 1);
}
/* Atomically increment 'var'. Returns old value. */
static inline uint32_t atomic_inc32u(uint32_t* var) {
return __sync_fetch_and_add(var, 1);
}
static inline int32_t atomic_inc32s(int32_t* var) {
return __sync_fetch_and_add(var, 1);
}
static inline sig_atomic_t atomic_incsa(sig_atomic_t* var) {
return __sync_fetch_and_add(var, 1);
}
/* Atomically adjust 'var' by 'delta'. Returns old value. */
static inline uint32_t atomic_add32u(uint32_t* var, uint32_t delta) {
return __sync_fetch_and_add(var, delta);
}
static inline int32_t atomic_add32s(int32_t* var, int32_t delta) {
return __sync_fetch_and_add(var, delta);
}
/* Atomically replace 'var' by 'to' if it is 'from'. Returns old value. */
static inline uint32_t atomic_cas32u(uint32_t* var, uint32_t from, uint32_t to) {
return __sync_val_compare_and_swap(var, from, to);
}
static inline int32_t atomic_cas32s(int32_t* var, int32_t from, int32_t to) {
return __sync_val_compare_and_swap(var, from, to);
}
/* returns true if the swap completed. */
static inline int atomic_cmp_and_set_32_bool (volatile void *ptr, uint32_t oldval, uint32_t newval)
{
return __sync_bool_compare_and_swap((uint32_t*)ptr, oldval, newval);
}
/* returns true if the swap completed. */
static inline int atomic_cmp_and_set_64_bool (volatile void *ptr, uint64_t oldval, uint64_t newval)
{
return __sync_bool_compare_and_swap((uint32_t*)ptr, oldval, newval);
}
static inline void atomic_barrier() {
__sync_synchronize();
}
static inline void atomic_read_barrier() {
#ifdef __x86_64__
__asm__ __volatile__ ("lfence" : : : "memory");
#else
__asm__ __volatile__ ("lock addl $0,0(%%esp)" : : : "memory");
#endif
}
static inline void atomic_pause() {
__asm__ __volatile__ ("pause");
}
/* returns (linux-specific) thread-id (for single-thread processes it's just PID) */
static inline uint32_t gettid() {
/* AUTO_TSC("gettid()"); */
return syscall(SYS_gettid);
}
#ifdef __cplusplus
}
#endif
#endif /* DONT_MULTI_INCLUDE_MDBM_ATOMIC_H */
|
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
#define ANY_REGVAR 0x1
#define SL_REGVAR 0x2
#define DL_REGVAR 0x4
extern int rvused;
extern int nregvar[4];
extern int rvsize[4];
extern int rvnumbers[4][MAXREGVAR];
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <ABI42_0_0React/ABI42_0_0RCTBridgeModule.h>
@interface ABI42_0_0RCTImageEditingManager : NSObject <ABI42_0_0RCTBridgeModule>
@end
|
/* Generated by re2c */
#line 1 "unicode_group_Sc.u--encoding-policy(ignore).re"
#include <stdio.h>
#define YYCTYPE unsigned int
bool scan(const YYCTYPE * start, const YYCTYPE * const limit)
{
__attribute__((unused)) const YYCTYPE * YYMARKER; // silence compiler warnings when YYMARKER is not used
# define YYCURSOR start
Sc:
#line 13 "<stdout>"
{
YYCTYPE yych;
yych = *YYCURSOR;
if (yych <= 0x00000E3F) {
if (yych <= 0x000009F3) {
if (yych <= 0x000000A5) {
if (yych == '$') goto yy4;
if (yych >= 0x000000A2) goto yy4;
} else {
if (yych == 0x0000060B) goto yy4;
if (yych >= 0x000009F2) goto yy4;
}
} else {
if (yych <= 0x00000AF1) {
if (yych == 0x000009FB) goto yy4;
if (yych >= 0x00000AF1) goto yy4;
} else {
if (yych == 0x00000BF9) goto yy4;
if (yych >= 0x00000E3F) goto yy4;
}
}
} else {
if (yych <= 0x0000FDFC) {
if (yych <= 0x000020B9) {
if (yych == 0x000017DB) goto yy4;
if (yych >= 0x000020A0) goto yy4;
} else {
if (yych == 0x0000A838) goto yy4;
if (yych >= 0x0000FDFC) goto yy4;
}
} else {
if (yych <= 0x0000FF04) {
if (yych == 0x0000FE69) goto yy4;
if (yych >= 0x0000FF04) goto yy4;
} else {
if (yych <= 0x0000FFE1) {
if (yych >= 0x0000FFE0) goto yy4;
} else {
if (yych <= 0x0000FFE4) goto yy2;
if (yych <= 0x0000FFE6) goto yy4;
}
}
}
}
yy2:
++YYCURSOR;
#line 13 "unicode_group_Sc.u--encoding-policy(ignore).re"
{ return YYCURSOR == limit; }
#line 63 "<stdout>"
yy4:
++YYCURSOR;
#line 12 "unicode_group_Sc.u--encoding-policy(ignore).re"
{ goto Sc; }
#line 68 "<stdout>"
}
#line 14 "unicode_group_Sc.u--encoding-policy(ignore).re"
}
static const unsigned int chars_Sc [] = {0x24,0x24, 0xa2,0xa5, 0x60b,0x60b, 0x9f2,0x9f3, 0x9fb,0x9fb, 0xaf1,0xaf1, 0xbf9,0xbf9, 0xe3f,0xe3f, 0x17db,0x17db, 0x20a0,0x20b9, 0xa838,0xa838, 0xfdfc,0xfdfc, 0xfe69,0xfe69, 0xff04,0xff04, 0xffe0,0xffe1, 0xffe5,0xffe6, 0x0,0x0};
static unsigned int encode_utf32 (const unsigned int * ranges, unsigned int ranges_count, unsigned int * s)
{
unsigned int * const s_start = s;
for (unsigned int i = 0; i < ranges_count; i += 2)
for (unsigned int j = ranges[i]; j <= ranges[i + 1]; ++j)
*s++ = j;
return s - s_start;
}
int main ()
{
YYCTYPE * buffer_Sc = new YYCTYPE [48];
unsigned int buffer_len = encode_utf32 (chars_Sc, sizeof (chars_Sc) / sizeof (unsigned int), buffer_Sc);
if (!scan (reinterpret_cast<const YYCTYPE *> (buffer_Sc), reinterpret_cast<const YYCTYPE *> (buffer_Sc + buffer_len)))
printf("test 'Sc' failed\n");
delete [] buffer_Sc;
return 0;
}
|
/* $NetBSD: pchb.c,v 1.1 2000/02/29 15:21:46 nonaka Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 REGENTS 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.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/bus.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
int pchbmatch __P((struct device *, struct cfdata *, void *));
void pchbattach __P((struct device *, struct device *, void *));
struct cfattach pchb_ca = {
sizeof(struct device), pchbmatch, pchbattach
};
int
pchbmatch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct pci_attach_args *pa = aux;
/*
* Match all known PCI host chipsets.
*/
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) {
return (1);
}
return (0);
}
void
pchbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct pci_attach_args *pa = aux;
char devinfo[256];
printf("\n");
/*
* All we do is print out a description. Eventually, we
* might want to add code that does something that's
* possibly chipset-specific.
*/
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
PCI_REVISION(pa->pa_class));
}
|
//
//
// Created by rene on 08.01.14.
// Copyright 2014 . All rights reserved.
//
//
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface OBBaseTestCase : XCTestCase
- (NSString *)screenshotWithName:(NSString *)name;
@end |
/**
* @brief Barnes-Hut T-SNE implementation O(Nlog(N))
*
* @file bh_tsne.h
* @author David Chan
* @date 2018-04-15
*/
#ifndef BH_TSNE_H
#define BH_TSNE_H
#include "common.h"
#include "include/options.h"
#include "include/util/cuda_utils.h"
#include "include/util/math_utils.h"
#include "include/util/matrix_broadcast_utils.h"
#include "include/util/reduce_utils.h"
#include "include/util/distance_utils.h"
#include "include/util/random_utils.h"
#include "include/util/thrust_utils.h"
#include "include/util/thrust_transform_functions.h"
#include "include/kernels/apply_forces.h"
#include "include/kernels/attr_forces.h"
#include "include/kernels/perplexity_search.h"
#include "include/kernels/nbodyfft.h"
#include "include/kernels/rep_forces.h"
#ifndef NO_ZMQ
#include <zmq.hpp>
#endif
namespace tsnecuda {
void RunTsne(tsnecuda::Options &opt, tsnecuda::GpuOptions &gpu_opt);
}
#endif
|
/// @file
/// @version 3.2
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
///
/// @section DESCRIPTION
///
/// Represents an audio category.
#ifndef XAL_CATEGORY_H
#define XAL_CATEGORY_H
#include <hltypes/hltypesUtil.h>
#include <hltypes/hstring.h>
#include "AudioManager.h"
#include "xalExport.h"
namespace xal
{
/// @brief Defines an audio category which makes audio file organization easier.
class xalExport Category
{
public:
/// @brief Constructor.
/// @param[in] name Category name.
/// @param[in] bufferMode How to handle the intermediate Buffer of the Sound.
/// @param[in] sourceMode How to handle the Source of the Sound.
Category(chstr name, BufferMode bufferMode, SourceMode sourceMode);
/// @brief Destructor.
~Category();
HL_DEFINE_GET(hstr, name, Name);
HL_DEFINE_GET(float, gain, Gain);
void setGain(float value);
HL_DEFINE_GET(BufferMode, bufferMode, BufferMode);
HL_DEFINE_GET(SourceMode, sourceMode, SourceMode);
/// @return True if Sounds in this Category are streamed.
bool isStreamed();
/// @return True if Sounds in this Category have their data managed by the system.
bool isMemoryManaged();
protected:
/// @brief Category name.
hstr name;
/// @brief Category gain.
float gain;
/// @brief How to handle the intermediate Buffer of the Sound.
BufferMode bufferMode;
/// @brief sourceMode How to handle the Source of the Sound.
SourceMode sourceMode;
};
}
#endif
|
// 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 CHROME_BROWSER_OFFLINE_PAGES_ANDROID_DOWNLOADS_OFFLINE_PAGE_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_OFFLINE_PAGES_ANDROID_DOWNLOADS_OFFLINE_PAGE_INFOBAR_DELEGATE_H_
#include "base/callback.h"
#include "chrome/browser/download/android/duplicate_download_infobar_delegate.h"
#include "components/infobars/core/infobar_delegate.h"
#include "url/gurl.h"
namespace content {
class WebContents;
}
namespace offline_pages {
// An InfoBarDelegate that appears when a user attempt to save offline pages for
// a URL that is already saved. This piggy-backs off the Download infobar,
// since the UI should be the same between Downloads and Offline Pages in this
// case. There are two actions: Create New, and Overwrite. Since Overwrite is
// not straightforward for offline pages, the behavior is to delete ALL other
// pages that are saved for the given URL, then save the newly requested page.
class OfflinePageInfoBarDelegate
: public ::android::DuplicateDownloadInfoBarDelegate {
public:
// Creates an offline page infobar and a delegate and adds the infobar to the
// InfoBarService associated with |web_contents|. |page_name| is the name
// shown for this file in the infobar text.
static void Create(const base::Closure& confirm_continuation,
const GURL& page_to_download,
bool exists_duplicate_request,
content::WebContents* web_contents);
~OfflinePageInfoBarDelegate() override;
private:
OfflinePageInfoBarDelegate(const base::Closure& confirm_continuation,
const std::string& page_name,
const GURL& page_to_download,
bool duplicate_request_exists);
// DuplicateDownloadInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
bool EqualsDelegate(InfoBarDelegate* delegate) const override;
bool Accept() override;
bool Cancel() override;
std::string GetFilePath() const override;
bool IsOfflinePage() const override;
std::string GetPageURL() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
bool DuplicateRequestExists() const override;
OfflinePageInfoBarDelegate* AsOfflinePageInfoBarDelegate() override;
// Continuation called when the user chooses to create a new file.
base::Closure confirm_continuation_;
std::string page_name_;
GURL page_to_download_;
bool duplicate_request_exists_;
DISALLOW_COPY_AND_ASSIGN(OfflinePageInfoBarDelegate);
};
} // namespace offline_pages
#endif // CHROME_BROWSER_OFFLINE_PAGES_ANDROID_DOWNLOADS_OFFLINE_PAGE_INFOBAR_DELEGATE_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_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_TEST_HARNESS_H_
#define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_TEST_HARNESS_H_
#include <memory>
#include <string>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "content/browser/background_sync/background_sync_context_impl.h"
#include "content/browser/service_worker/embedded_worker_test_helper.h"
#include "content/browser/storage_partition_impl.h"
#include "content/public/test/browser_task_environment.h"
#include "content/test/fake_mojo_message_dispatch_context.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h"
namespace content {
class BackgroundSyncServiceImplTestHarness : public testing::Test {
public:
static void RegisterServiceWorkerCallback(
bool* called,
int64_t* store_registration_id,
blink::ServiceWorkerStatusCode status,
const std::string& status_message,
int64_t registration_id);
static void FindServiceWorkerRegistrationCallback(
scoped_refptr<ServiceWorkerRegistration>* out_registration,
blink::ServiceWorkerStatusCode status,
scoped_refptr<ServiceWorkerRegistration> registration);
static void ErrorAndRegistrationCallback(
bool* called,
blink::mojom::BackgroundSyncError* out_error,
blink::mojom::SyncRegistrationOptionsPtr* out_registration,
blink::mojom::BackgroundSyncError error,
blink::mojom::SyncRegistrationOptionsPtr registration);
static void ErrorAndRegistrationListCallback(
bool* called,
blink::mojom::BackgroundSyncError* out_error,
unsigned long* out_array_size,
blink::mojom::BackgroundSyncError error,
std::vector<blink::mojom::SyncRegistrationOptionsPtr> registrations);
static void ErrorCallback(bool* called,
blink::mojom::BackgroundSyncError* out_error,
blink::mojom::BackgroundSyncError error);
BackgroundSyncServiceImplTestHarness();
~BackgroundSyncServiceImplTestHarness() override;
void SetUp() override;
void TearDown() override;
protected:
scoped_refptr<BackgroundSyncContextImpl> background_sync_context_;
blink::mojom::SyncRegistrationOptionsPtr default_sync_registration_;
std::vector<std::string> mojo_bad_messages_;
int64_t sw_registration_id_;
private:
// SetUp helper methods
void CreateTestHelper();
void CreateStoragePartition();
void CreateBackgroundSyncContext();
void CreateServiceWorkerRegistration();
void CollectMojoError(const std::string& message);
// Helpers for testing *BackgroundSyncServiceImpl methods
void RegisterOneShotSync(
blink::mojom::SyncRegistrationOptionsPtr sync,
blink::mojom::OneShotBackgroundSyncService::RegisterCallback callback);
void GetOneShotSyncRegistrations(
blink::mojom::OneShotBackgroundSyncService::GetRegistrationsCallback
callback);
BrowserTaskEnvironment task_environment_;
std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_;
std::unique_ptr<StoragePartitionImpl> storage_partition_impl_;
scoped_refptr<ServiceWorkerRegistration> sw_registration_;
DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImplTestHarness);
};
} // namespace content
#endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_TEST_HARNESS_H_
|
/* HTTPIF.H - One line description.
* Copyright (C) 2001 Rob Fahrni. All rights reserved.
*
*/
#ifndef _HTTPIF_H
#define _HTTPIF_H
typedef long HTTPRC;
#define STR_PostVerb "POST\0"
#define STR_HttpVersion "HTTP/1.0\0"
enum eHTTP
{
eHTTPNOERROR = 0,
eHTTPCONNECTIONFAIL = 2,
};
class CHttpBase
{
public:
CHttpBase() {}
virtual ~CHttpBase() {}
virtual HTTPRC Open(void) = 0;
virtual void Close(void) = 0;
virtual HTTPRC SendRequest(IN ConstString verb, IN ConstString fullUrl, IN ConstString request, IN Int requestLen, IN ConstString version) = 0;
virtual HTTPRC PostRequest(IN ConstString fullUrl, IN ConstString request, IN Int requestLen, IN ConstString version) = 0;
virtual DWord GetStatusCode(void) = 0;
virtual ConstString GetStatusText(void) = 0;
virtual ConstString GetResponse(void) = 0;
}; // CHttpBase
typedef CHttpBase* PCHttpBase;
#endif // _HTTPIF_H |
/**
* Compile-time flags for defining application specific feature preferences.
*
* @file appFeatures.h
* @author Martin Turon
*
* @version 2004/8/8 mturon Initial version
*
* $Id: appFeatures.h,v 1.3 2005/01/27 07:10:43 husq Exp $
*/
/// FEATURE_LEDS -- powers up the LEDs for debugging purposes
#ifndef FEATURE_LEDS
#define FEATURE_LEDS 1
#endif
/// FEAUTRE_DELUGE -- enables over-the-air reprogramming
#ifndef FEATURE_DELUGE
#define FEATURE_DELUGE 0
#endif
/// FEATURE_XEE_PARAMS -- enables changing nodeid, group, and other params
#ifndef FEATURE_XEE_PARAMS
#define FEATURE_XEE_PARAMS 0
#endif
/// FEATURE_UART_SEND -- enable serial port debugging of a node
#ifndef FEATURE_UART_SEND
#define FEATURE_UART_SEND 0
#endif
/// FEATURE_SOUNDER -- enable test of speaker output
#ifndef FEATURE_SOUNDER
#define FEATURE_SOUNDER 0
#endif
#define SENSOR_BOARD_ID 0x81 //MDA300 sensor board id
#ifdef TEN_X
#define XSENSOR_SAMPLE_RATE (1843 - (TOS_LOCAL_ADDRESS << 2))
//#define XSENSOR_SAMPLE_RATE (18432 - (TOS_LOCAL_ADDRESS << 2))
#else
#define XSENSOR_SAMPLE_RATE (184320 - (TOS_LOCAL_ADDRESS << 7))
#endif
/**
* Define wiring macros for various application features.
*/
/** FEATURE_LEDS will enable debugging Leds when set to 1. */
#if FEATURE_LEDS
#define LEDS_COMPONENT LedsC,
#define LEDS_WIRING(X) X.Leds -> LedsC;
#else
#define LEDS_COMPONENT NoLeds,
#define LEDS_WIRING(X) X.Leds -> NoLeds;
#endif
/** FEATURE_DELUGE will enable over-the-air programming when set to 1. */
#if FEATURE_DELUGE
#define DELUGE_COMPONENT DelugeC,
#define DELUGE_WIRING() Main.StdControl->DelugeC;
#else
#define DELUGE_COMPONENT
#define DELUGE_WIRING()
#endif
/**
* FEATURE_XEE_PARAMS enables dynamic setting of various parameters when set.
* Params include: nodeid, group, radio power, radio freq/band.
*/
#if FEATURE_XEE_PARAMS
#define XEE_PARAMS_COMPONENT RecoverParamsC,
#define XEE_PARAMS_WIRING() Main.StdControl->RecoverParamsC.ParamControl;RecoverParamsC.CommControl -> Comm;
#else
#define XEE_PARAMS_COMPONENT
#define XEE_PARAMS_WIRING()
#endif
#ifndef MULTIHOPROUTER
#define MULTIHOPROUTER EWMAMultiHopRouter
#endif
|
#ifndef _I810_STATE_H
#define _I810_STATE_H
#include "i810context.h"
extern void i810InitState( struct gl_context *ctx );
extern void i810InitStateFuncs( struct gl_context *ctx );
extern void i810PrintDirty( const char *msg, GLuint state );
extern void i810DrawBuffer(struct gl_context *ctx, GLenum mode );
extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode );
#define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode )
#endif
|
// 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 CONTENT_PUBLIC_BROWSER_PROFILING_UTILS_H_
#define CONTENT_PUBLIC_BROWSER_PROFILING_UTILS_H_
#include "content/common/content_export.h"
namespace content {
// Ask all the child processes to dump their profiling data to disk and block
// until this is done.
CONTENT_EXPORT void WaitForAllChildrenToDumpProfilingData();
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_PROFILING_UTILS_H_
|
//
// AgentsMapViewController.h
// mlcontroller
//
// Created by Francois Vessaz on 3/16/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <MapKit/MapKit.h>
#import "MainViewController.h"
@interface AgentsMapViewController : NSViewController <MKMapViewDelegate, MainViewDelegate> {
MKMapView* mapView;
BOOL isAnnotationSelected;
}
@property (readonly) IBOutlet MKMapView* mapView;
@end
|
#ifndef EM_HEADER_1
#define EM_HEADER_1
//! simple declarations
void em_void_func_void(void);
void em_void_func_int(int a);
void em_void_func_int_int(int a, int b);
void em_void_func_voidptr(void* p);
int em_int_func_int(int a);
int em_int_func_int_int(int a, int b);
int em_int_func_voidptr(void* p);
//! function pointers
typedef void (*fn_ptr1)(void);
typedef void* (*fn_ptr2)(int, void*);
int em_func_funcptr1(fn_ptr1 fcb1, fn_ptr2 fcb2);
int em_func_funcptr2(fn_ptr1 fcb);
int em_func_funcptr3(void* (*fcb)(int, void*));
//! union
//union UnionX;
//int em_func_union_x(union UnionX u);
union Union1 { int x; char a[4]; };
int em_func_union_1(union Union1 u);
int em_func_union_1_ptr(union Union1* u);
union Union2 { int x; char a[4]; };
typedef union Union2 Union2T;
int em_func_union_2(Union2T u);
int em_func_union_2_ptr(Union2T* u);
//! enum
//enum EnumX;
//int em_func_enum_x(enum EnumX e);
enum Enum1 { Enum1_A, Enum1_B };
int em_func_enum_1(enum Enum1 e);
int em_func_enum_1_ptr(enum Enum1* e);
enum Enum2 { Enum2_A, Enum2_B };
typedef enum Enum2 Enum2T;
int em_func_enum_2(Enum2T e);
int em_func_enum_2_ptr(Enum2T* e);
//! struct parameters
//struct StructX;
//int em_func_struct_x(struct StructX s);
struct Struct1 { int x; };
int em_func_struct_1(struct Struct1* ptr);
typedef struct { int x; } Struct2;
int em_func_struct_2_ptr(Struct2* ptr);
int em_func_struct_2_ptr_const(const Struct2* ptr);
struct Struct3 { int x; };
typedef struct Struct3 Struct3;
int em_func_struct_3(Struct3* ptr);
struct Struct4 { int x; };
typedef struct Struct4 Struct4T;
int em_func_struct_4_ptr(Struct4T* ptr);
int em_func_struct_4_ptr_const(const Struct4T* ptr);
struct Struct5 { int x; };
typedef struct Struct5* Struct5Ptr;
int em_func_struct_5_ptr(Struct5Ptr ptr);
int em_func_struct_5_ptr_const(const Struct5Ptr ptr);
typedef struct Struct6 Struct6T;
int em_func_struct_6_struct_ptr(struct Struct6* ptr);
int em_func_struct_6_struct_ptr_const(const struct Struct6* ptr);
int em_func_struct_6_typedef_ptr(Struct6T* ptr);
int em_func_struct_6_typedef_ptr_const(const Struct6T* ptr);
struct Struct6 { int x; };
struct HiddenStruct1;
int em_func_opaque_1_ptr(struct HiddenStruct1* ptr);
int em_func_opaque_1_ptr_const(const struct HiddenStruct1* ptr);
typedef struct HiddenStruct2Tag HiddenStruct2;
int em_func_opaque_2_ptr(HiddenStruct2* ptr);
int em_func_opaque_2_ptr_const(const HiddenStruct2* ptr);
struct HiddenStruct3;
typedef struct HiddenStruct3 HiddenStruct3;
int em_func_opaque_3_ptr(HiddenStruct3* ptr);
int em_func_opaque_3_ptr_const(const HiddenStruct3* ptr);
struct HiddenStruct4;
typedef struct HiddenStruct4 HiddenStruct4T;
int em_func_opaque_4_ptr(HiddenStruct4T* ptr);
int em_func_opaque_4_ptr_const(const HiddenStruct4T* ptr);
struct HiddenStruct5;
typedef struct HiddenStruct5* HiddenStruct5Ptr;
int em_func_opaque_5_ptr(HiddenStruct5Ptr ptr);
int em_func_opaque_5_ptr_const(const HiddenStruct5Ptr ptr);
typedef struct HiddenStruct6 HiddenStruct6T;
int em_func_opaque_6_struct_ptr(struct HiddenStruct6* ptr);
int em_func_opaque_6_struct_ptr_const(const struct HiddenStruct6* ptr);
int em_func_opaque_6_typedef_ptr(HiddenStruct6T* ptr);
int em_func_opaque_6_typedef_ptr_const(const HiddenStruct6T* ptr);
//! typedefed parameters
typedef unsigned char em_uint8_t;
int em_func_uint8(em_uint8_t n);
int em_func_uint8_const(const em_uint8_t n);
int em_func_uint8_ptr(em_uint8_t* n);
typedef em_uint8_t em_bool_t;
int em_func_bool(em_bool_t flag);
int em_func_bool_const(const em_bool_t flag);
int em_func_bool_ptr(em_bool_t* flag);
typedef char* em_string_t;
int em_func_string(em_string_t msg);
int em_func_string_const(const em_string_t msg);
int em_func_string_ptr(em_string_t* msg);
typedef const char* em_conststring_t;
int em_func_conststring(em_conststring_t msg);
int em_func_conststring_const(const em_conststring_t msg);
int em_func_conststring_ptr(em_conststring_t* msg);
typedef unsigned int em_size_t;
int em_func_size(em_size_t size);
int em_func_size_const(const em_size_t size);
int em_func_size_ptr(em_size_t* size);
typedef unsigned long int em_pthread_t;
int em_func_pthread(em_pthread_t tid);
int em_func_pthread_const(const em_pthread_t tid);
int em_func_pthread_ptr(em_pthread_t* tid);
//! extra
#define EMTYPER unsigned short
#define EMTYPE1 int
#define EMTYPE2 char*
#define EMTYPE3 const char*
#define EMTYPE4 char* const
EMTYPER em_typer_func_type1(
EMTYPE1 param1);
EMTYPER em_typer_func_type12(
EMTYPE1 param1, EMTYPE2 param2);
EMTYPER em_typer_func_type123(
EMTYPE1 param1, EMTYPE2 param2, EMTYPE3 param3);
EMTYPER em_typer_func_type1234(
EMTYPE1 param1, EMTYPE2 param2, EMTYPE3 param3, EMTYPE4 param4);
#endif
|
/*
* Copyright (C) 2006-2009 Vincent Hanquez <tab@snarc.org>
*
* This program 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; version 2.1 or version 3.0 only.
*
* 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.
*
* Sha224 implementation
*/
#include <unistd.h>
#include <fcntl.h>
#include "sha256.h"
static inline int sha224_file(char *filename, uint8_t *digest)
{
#define BLKSIZE 4096
unsigned char buf[BLKSIZE];
int fd; ssize_t n;
struct sha224_ctx ctx;
fd = open(filename, O_RDONLY);
if (fd == -1)
return 1;
sha224_init(&ctx);
while ((n = read(fd, buf, BLKSIZE)) > 0)
sha224_update(&ctx, buf, n);
if (n == 0)
sha224_finalize(&ctx, digest);
close(fd);
return n < 0;
#undef BLKSIZE
}
/* this part implement the OCaml binding */
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/custom.h>
#include <caml/fail.h>
#define GET_CTX_STRUCT(a) ((struct sha224_ctx *) a)
CAMLexport value stub_sha224_init(value unit)
{
CAMLparam1(unit);
CAMLlocal1(result);
result = caml_alloc(sizeof(struct sha224_ctx), Abstract_tag);
sha224_init(GET_CTX_STRUCT(result));
CAMLreturn(result);
}
CAMLprim value stub_sha224_update(value ctx, value data, value ofs, value len)
{
CAMLparam4(ctx, data, ofs, len);
sha224_update(GET_CTX_STRUCT(ctx), String_val(data) + Int_val(ofs), Int_val(len));
CAMLreturn(Val_unit);
}
CAMLprim value stub_sha224_finalize(value ctx)
{
CAMLparam1(ctx);
CAMLlocal1(result);
result = caml_alloc_string(28);
sha224_finalize(GET_CTX_STRUCT(ctx), String_val(result));
CAMLreturn(result);
}
CAMLprim value stub_sha224_file(value name)
{
CAMLparam1(name);
CAMLlocal1(result);
result = caml_alloc_string(28);
if (sha224_file(String_val(name), String_val(result)))
caml_failwith("file error");
CAMLreturn(result);
}
CAMLprim value stub_sha224_to_hex(value digest)
{
CAMLparam1(digest);
CAMLlocal1(result);
char *s, r;
int i;
result = caml_alloc_string(56);
s = String_val(digest);
r = String_val(result);
for (i = 0; i < 28; i++, r += 2)
snprintf(r, 2, "%02x", s[i]);
CAMLreturn(result);
}
|
#include <stdio.h>
void main(void)
{
int count = 0;
int ratio = 5;
int limit = 40;
while (count < limit) {
int rem = count % ratio;
if (rem) {
printf("Ratio hit! [%d]\n", count);
} else {
printf("No hit! [%d]\n", count);
}
count++;
}
}
|
#include "rr_array.h"
#include "rr_malloc.h"
array_t *
array_create(unsigned long n, size_t s) {
array_t *a;
unsigned long initial_number; /* initial number of elements in array, 1 by default */
a = rr_malloc(sizeof(array_t));
if (a == NULL) {
return NULL;
}
initial_number = n==0 ? 1 : n;
a->elm = rr_malloc(initial_number * s);
if (a->elm == NULL) {
rr_free(a);
return NULL;
}
a->nelm = 0;
a->nrest = initial_number;
a->size = s;
return a;
}
void
array_free(array_t *array) {
rr_free(array->elm);
rr_free(array);
}
void *
array_push(array_t *array) {
void *ret, *elm;
if (array->nrest > 0) {
ret = ARRAY_AT(array, array->nelm);
array->nrest--;
array->nelm++;
return ret;
}
/* double array's size, if failed, return NULL */
if ((elm=rr_realloc(array->elm, 2*array->size*array->nelm)) == NULL) {
return NULL;
} else {
array->elm = elm;
ret = ARRAY_AT(array, array->nelm);
array->nrest = array->nelm - 1;
array->nelm++;
}
return ret;
}
void *
array_push_n(array_t *array, unsigned long n) {
void *ret, *elm;
if (n == 0) return NULL;
if (array->nrest >= n) {
ret = ARRAY_AT(array, array->nelm);
array->nrest -= n;
array->nelm += n;
return ret;
}
/* expand array's size, if failed, return NULL */
size_t nslots;
nslots = (2*array->nelm > n) ? 2*array->nelm: array->nelm+array->nrest+n;
if ((elm=rr_realloc(array->elm, nslots*array->size)) == NULL) {
return NULL;
} else {
array->elm = elm;
ret = ARRAY_AT(array, array->nelm);
array->nelm += n;
array->nrest = nslots - array->nelm;
}
return ret;
}
unsigned long
array_len(array_t *array) {
return array->nelm;
}
void *
array_at(array_t *array, long i) {
if (i >= (int)ARRAY_LEN(array) || (i < 0 && -i > (int)ARRAY_LEN(array))) return NULL;
return i >= 0 ? ARRAY_AT(array, i): ARRAY_AT(array, ARRAY_LEN(array)+i);
}
|
/**
* 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."
*
* @file socket_address.h
* @author rdb
* @date 2014-10-19
*/
#ifndef SOCKET_ADDRESS_H
#define SOCKET_ADDRESS_H
#include "pandabase.h"
#include "numeric_types.h"
#include "socket_portable.h"
/**
* A simple place to store and munipulate tcp and port address for
* communication layer
*/
class EXPCL_PANDA_NATIVENET Socket_Address {
public:
typedef struct sockaddr_in AddressType;
Socket_Address(const AddressType &inaddr);
AddressType &GetAddressInfo() { return _addr; }
const AddressType &GetAddressInfo() const { return _addr; }
PUBLISHED:
INLINE Socket_Address(unsigned short port = 0);
INLINE Socket_Address(const Socket_Address &inaddr);
INLINE virtual ~Socket_Address();
INLINE bool set_any_IP(unsigned short port);
INLINE bool set_port(unsigned short port);
INLINE bool set_broadcast(unsigned short port);
INLINE bool set_host(const std::string &hostname, unsigned short port) ;
INLINE bool set_host(const std::string &hostname) ;
INLINE bool set_host(unsigned int ip4adr, unsigned short port);
INLINE void clear();
INLINE unsigned short get_port() const;
INLINE std::string get_ip() const ;
INLINE std::string get_ip_port() const;
INLINE unsigned long GetIPAddressRaw() const;
INLINE bool operator ==(const Socket_Address &in) const;
INLINE bool operator !=(const Socket_Address &in) const;
INLINE bool operator < (const Socket_Address &in) const;
INLINE bool is_mcast_range() const;
private:
AddressType _addr;
};
#include "socket_address.I"
#endif // SOCKET_ADDRESS_H
|
#pragma once
#include "CGUIContextWidget.h"
#include <ionScene.h>
#include <Gwen/Controls/WindowControl.h>
#include <Gwen/Controls/HorizontalSlider.h>
class CMainState;
class CTerrainNodeManager;
class CGUITerrainControlWidget : public CGUIContextWidget
{
CTerrainNodeManager * Terrain;
CSceneNode * Water;
CMainState & MainState;
Gwen::Controls::WindowControl * Window;
Gwen::Controls::Button * TerrainButton, * WaterButton;
public:
CGUITerrainControlWidget();
void OnToggleTerrain(Gwen::Controls::Base * Control);
void OnToggleWater(Gwen::Controls::Base * Control);
void OnSelectElevation(Gwen::Controls::Base * Control);
void OnSelectColor(Gwen::Controls::Base * Control);
void OnModeSelect(Gwen::Controls::Base * Control);
void OnInterpolationModeSelect(Gwen::Controls::Base * Control);
void toggle();
};
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// 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 "UNIX_AllocatedFromStoragePool.h"
#define UNIX_PROVIDER UNIX_AllocatedFromStoragePoolProvider
#define CLASS_IMPLEMENTATION UNIX_AllocatedFromStoragePool
#define CLASS_IMPLEMENTATION_NAME "UNIX_AllocatedFromStoragePool"
#define BASE_CLASS_NAME "CIM_AllocatedFromStoragePool"
#define NUMKEYS_CLASS_IMPLEMENTATION 0
#include "UNIXProviderBase.h"
#undef UNIX_PROVIDER
#undef CLASS_IMPLEMENTATION
#undef CLASS_IMPLEMENTATION_NAME
#undef BASE_CLASS_NAME
#undef NUMKEYS_CLASS_IMPLEMENTATION
|
/**
* \file
* \brief ARM execution and miscellany
*/
/*
* Copyright (c) 2007-2009, ETH Zurich.
* Copyright (c) 2015, Hewlett Packard Enterprise Development LP.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
*/
#include <kernel.h>
#include <dispatch.h>
#include <init.h>
#include <arch/arm/arm.h>
#include <arm_hal.h>
#include <exec.h>
#include <exceptions.h>
#include <misc.h>
#include <sysreg.h> // for invalidating tlb and cache
static arch_registers_state_t upcall_state;
STATIC_ASSERT(X0_REG == 0, "");
STATIC_ASSERT(PC_REG == 32, "");
STATIC_ASSERT(SPSR_REG == 33, "");
extern uint32_t ctr;
void __attribute__((noreturn)) do_resume(uint64_t *regs);
/// Ensure context is for user-mode with interrupts enabled.
static inline void
ensure_user_mode_policy(arch_registers_state_t *state)
{
uintptr_t cpsr_if_mode = CPSR_F_MASK | AARCH64_MODE_USR;
if ((state->named.spsr & (CPSR_IF_MASK | AARCH64_MODE_MASK)) != cpsr_if_mode) {
assert(0 == (state->named.spsr & AARCH64_MODE_PRIV));
state->named.spsr &= CPSR_IF_MASK | AARCH64_MODE_MASK;
state->named.spsr |= cpsr_if_mode;
}
}
/**
* \brief Go to user-space at entry point 'entry'.
*
* This function goes to user-space and starts executing the program at
* its entry point at virtual address 'entry'.
*
* \param entry Entry point address of program to execute.
*/
void __attribute__ ((noreturn))
execute(lvaddr_t entry)
{
dispatcher_handle_t handle = dcb_current->disp;
struct dispatcher_shared_aarch64 *disp_aarch64 =
get_dispatcher_shared_aarch64(handle);
arch_registers_state_t *state = &upcall_state;
assert(0 != disp_aarch64->got_base);
/* XXX - why is this here? */
state->named.x10 = disp_aarch64->got_base;
struct dispatcher_shared_generic *disp_gen
= get_dispatcher_shared_generic(handle);
state->named.x0 = disp_gen->udisp;
state->named.pc = entry;
ensure_user_mode_policy(state);
do_resume(state->regs);
}
/**
* \brief Resume the given user-space snapshot.
*
* This function resumes user-space execution by restoring the CPU
* registers with the ones given in the array, pointed to by 'state'.
*/
uint32_t ctr=0;
void __attribute__ ((noreturn)) resume(arch_registers_state_t *state)
{
ctr++;
ensure_user_mode_policy(state);
//printf("thread reg..%p\n",state->named.rtls);
/*
This function succeeds the first time executed, i.e.
when init is started for the first time.
If we hold the execution here after the first execption, we are still good
*/
// while(ctr>1);
do_resume(state->regs);
}
void wait_for_interrupt(void)
{
// Load magic and enable interrupts.
__asm volatile(
"mov w0, #" XTR(WAIT_FOR_INTERRUPT_MAGIC) " \n\t"
"0: \n\t"
#if defined(__ARM_ARCH_8A__)
"msr daifclr, #2 \n\t"
"wfi \n\t"
#else
// If no WFI functionality exists on system, just
// spinning here is okay.
#error "Unknown platform for wait_for_interrupt"
#endif //
"b 0b \n\t" ::: "r0");
panic("wfi returned");
}
|
//
// AssetLibraryMultiSelect
//
// Copyright (c) 2013 Alexander Belliotti. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ADBMovieScrollView;
@protocol ADBMovieDetailViewDelegate <NSObject>
- (void)playMovieInDetailView:(ADBMovieScrollView *)view;
@end
|
/*
*******************************************************************************
*
* Purpose: Keeps version information.
*
*******************************************************************************
* Copyright Monstrenyatko 2015.
*
* Distributed under the MIT License.
* (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
*******************************************************************************
*/
#ifndef VERSION_H_
#define VERSION_H_
struct Version {
static const char* value;
};
#endif /* VERSION_H_ */
|
// ----------------------------------------------------------------------------
// OpenGL Anti-Grain Geometry (GL-AGG) - Version 0.1
// A high quality OpenGL rendering engine for C
// Copyright (C) 2012 Nicolas P. Rougier. All rights reserved.
// Contact: Nicolas.Rougier@gmail.com
// https://github.com/rougier/freetype-gl
//
// 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 NICOLAS P. ROUGIER ''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 NICOLAS P. ROUGIER 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.
//
// The views and conclusions contained in the software and documentation are
// those of the authors and should not be interpreted as representing official
// policies, either expressed or implied, of Nicolas P. Rougier.
// ----------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "opengl.h"
#include "shader.h"
// ------------------------------------------------------------ shader_read ---
char *
shader_read( const char *filename )
{
FILE * file;
char * buffer;
size_t size;
file = fopen( filename, "rb" );
if( !file )
{
fprintf( stderr, "Unable to open file \"%s\".\n", filename );
return 0;
}
fseek( file, 0, SEEK_END );
size = ftell( file );
fseek(file, 0, SEEK_SET );
buffer = (char *) malloc( (size+1) * sizeof( char *) );
fread( buffer, sizeof(char), size, file );
buffer[size] = 0;
fclose( file );
return buffer;
}
// --------------------------------------------------------- shader_compile ---
GLuint
shader_compile( const char* source,
const GLenum type )
{
GLint compile_status;
GLuint handle = glCreateShader( type );
glShaderSource( handle, 1, &source, 0 );
glCompileShader( handle );
glGetShaderiv( handle, GL_COMPILE_STATUS, &compile_status );
if( compile_status == GL_FALSE )
{
GLchar messages[256];
glGetShaderInfoLog( handle, sizeof(messages), 0, &messages[0] );
fprintf( stderr, "%s\n", messages );
exit( EXIT_FAILURE );
}
return handle;
}
// ------------------------------------------------------------ shader_load ---
GLuint
shader_load( const char * vert_filename,
const char * frag_filename )
{
GLuint handle = glCreateProgram( );
GLint link_status;
if( vert_filename && strlen( vert_filename ) )
{
char *vert_source = shader_read( vert_filename );
GLuint vert_shader = shader_compile( vert_source, GL_VERTEX_SHADER);
glAttachShader( handle, vert_shader);
glDeleteShader( vert_shader );
free( vert_source );
}
if( frag_filename && strlen( frag_filename ) )
{
char *frag_source = shader_read( frag_filename );
GLuint frag_shader = shader_compile( frag_source, GL_FRAGMENT_SHADER);
glAttachShader( handle, frag_shader);
glDeleteShader( frag_shader );
free( frag_source );
}
glLinkProgram( handle );
glGetProgramiv( handle, GL_LINK_STATUS, &link_status );
if (link_status == GL_FALSE)
{
GLchar messages[256];
glGetProgramInfoLog( handle, sizeof(messages), 0, &messages[0] );
fprintf( stderr, "%s\n", messages );
exit(1);
}
return handle;
}
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2016 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __OGRE_POSE_H
#define __OGRE_POSE_H
#include "OgrePrerequisites.h"
#include "OgreCommon.h"
#include "OgreHardwareVertexBuffer.h"
#include "OgreIteratorWrappers.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Animation
* @{
*/
/** A pose is a linked set of vertex offsets applying to one set of vertex
data.
@remarks
The target index referred to by the pose has a meaning set by the user
of this class; but for example when used by Mesh it refers to either the
Mesh shared geometry (0) or a SubMesh dedicated geometry (1+).
Pose instances can be referred to by keyframes in VertexAnimationTrack in
order to animate based on blending poses together.
*/
class _OgreExport Pose : public AnimationAlloc
{
public:
/** Constructor
@param target The target vertexdata index (0 for shared, 1+ for
dedicated at the submesh index + 1)
@param name Optional name
*/
Pose(ushort target, const String& name = BLANKSTRING);
virtual ~Pose();
/// Return the name of the pose (may be blank)
const String& getName(void) const { return mName; }
/// Return the target geometry index of the pose
ushort getTarget(void) const { return mTarget; }
/// A collection of vertex offsets based on the vertex index
typedef map<size_t, Vector3>::type VertexOffsetMap;
/// An iterator over the vertex offsets
typedef MapIterator<VertexOffsetMap> VertexOffsetIterator;
/// An iterator over the vertex offsets
typedef ConstMapIterator<VertexOffsetMap> ConstVertexOffsetIterator;
/// A collection of normals based on the vertex index
typedef map<size_t, Vector3>::type NormalsMap;
/// An iterator over the vertex offsets
typedef MapIterator<NormalsMap> NormalsIterator;
/// An iterator over the vertex offsets
typedef ConstMapIterator<NormalsMap> ConstNormalsIterator;
/// Return whether the pose vertices include normals
bool getIncludesNormals() const { return !mNormalsMap.empty(); }
/** Adds an offset to a vertex for this pose.
@param index The vertex index
@param offset The position offset for this pose
*/
void addVertex(size_t index, const Vector3& offset);
/** Adds an offset to a vertex and a new normal for this pose.
@param index The vertex index
@param offset The position offset for this pose
*/
void addVertex(size_t index, const Vector3& offset, const Vector3& normal);
/** Remove a vertex offset. */
void removeVertex(size_t index);
/** Clear all vertices. */
void clearVertices(void);
/** Gets an iterator over all the vertex offsets. */
ConstVertexOffsetIterator getVertexOffsetIterator(void) const;
/** Gets an iterator over all the vertex offsets. */
VertexOffsetIterator getVertexOffsetIterator(void);
/** Gets a const reference to the vertex offsets. */
const VertexOffsetMap& getVertexOffsets(void) const { return mVertexOffsetMap; }
/** Gets an iterator over all the vertex offsets. */
ConstNormalsIterator getNormalsIterator(void) const;
/** Gets an iterator over all the vertex offsets. */
NormalsIterator getNormalsIterator(void);
/** Gets a const reference to the vertex offsets. */
const NormalsMap& getNormals(void) const { return mNormalsMap; }
/** Get a hardware vertex buffer version of the vertex offsets. */
const HardwareVertexBufferSharedPtr& _getHardwareVertexBuffer(const VertexData* origData) const;
/** Clone this pose and create another one configured exactly the same
way (only really useful for cloning holders of this class).
*/
Pose* clone(void) const;
protected:
/// Target geometry index
ushort mTarget;
/// Optional name
String mName;
/// Primary storage, sparse vertex use
VertexOffsetMap mVertexOffsetMap;
/// Primary storage, sparse vertex use
NormalsMap mNormalsMap;
/// Derived hardware buffer, covers all vertices
mutable HardwareVertexBufferSharedPtr mBuffer;
};
typedef vector<Pose*>::type PoseList;
/** @} */
/** @} */
}
#include "OgreHeaderSuffix.h"
#endif
|
/*
* Author: Noel Eck <noel.eck@intel.com>
* Copyright (c) 2015 Intel Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "upm.h"
#include "mraa/aio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file vdiv.h
* @library vdiv
* @brief C API for Voltage Dividers
*
* @include vdiv.c
*/
/**
* device context
*/
typedef struct _vdiv_context {
/* mraa aio pin context */
mraa_aio_context aio;
/* ADC voltage reference */
float m_aRef;
/* Scale */
float m_scale;
/* Offset in sensor units */
float m_offset;
/* Offset in sensor units */
int m_vdiv_sw;
} *vdiv_context;
/**
* Initialize analog sensor
* @param pin is Analog pin
* @return sensor context as void pointer
*/
vdiv_context vdiv_init(int16_t pin, float voltage_ref);
/**
* Analog sensor destructor
* @param sensor context pointer deallocate memory
*/
void vdiv_close(vdiv_context dev);
/**
* Set sensor scale. This scale is applied to the return value:
* counts = counts * scale
* @param dev sensor context pointer
* @param scale count scale value used
* @return Function result code
*/
upm_result_t vdiv_set_scale(const vdiv_context dev, float scale);
/**
* Set sensor offset. This offset is applied to the return value:
* counts = counts + offset
* @param dev sensor context pointer
* @param offset count offset value used
* @return Function result code
*/
upm_result_t vdiv_set_offset(const vdiv_context dev, float offset);
/**
* Get sensor scale
* @param dev sensor context pointer
* @return Sensor scale
*/
float vdiv_get_scale(const vdiv_context dev);
/**
* Get sensor offset
* @param dev sensor context pointer
* @return Sensor offset
*/
float vdiv_get_offset(const vdiv_context dev);
/**
* Set sensor divide switch value
* @param dev sensor context pointer
* @param vdiv_sw Divide switch value
* @return Function result code
*/
upm_result_t vdiv_set_divsw(const vdiv_context dev, int vdiv_sw);
/**
* Get divide switch value
* @param dev sensor context pointer
* @return Sensor divide switch value
*/
int vdiv_get_divsw(const vdiv_context dev);
/**
* Read raw voltage from the sensor
* @param dev sensor context pointer
* @param *value Raw sensor voltage
* @return Function result code
*/
upm_result_t vdiv_get_raw_volts(const vdiv_context dev, float *value);
/**
* Gets the true voltage value from the sensor. Voltage divides by 3 or 10,
* depending on the toggle switch on the board. The dynamic range of the
* vdiv sensor is listed below.
*
* ADC Ref SW max VOL in
* ------- --- ----------
* 3.3v 3 8.5v
* 3.3v 10 28.4v
* 5.0v 3 12.9v
* 5.0v 10 43.0v
*
* @param dev sensor context pointer
* @param *value Voltage (v)
* @return Function result code
*/
upm_result_t vdiv_get_computed_volts(const vdiv_context dev, float *value);
#ifdef __cplusplus
}
#endif
|
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
namespace Js
{
// This is an unordered type handler (enumeration order of properties is nondeterministic). It is used when an object using
// a SimpleDictionaryTypeHandler is determined to be used like a hashtable, to prevent unbounded memory growth.
//
// An object that is used as a hashtable will typically have a number of property adds and deletes, where the added
// properties often don't have the same property name as a previously deleted property. Since SimpleDictionaryTypeHandler
// does not remove deleted properties from its property map, and preserves the slot in the object (to preserve
// enumeration order if a deleted property is added back), the property map and object continue to grow in size as the
// script continues to add more property IDs to the object, even if there are corresponding deletes on different property
// IDs to make room.
//
// At some point, SimpleDictionaryTypeHandler determines that it needs to stop the unbounded growth and start to reuse
// property indexes from deleted properties for new properties, even if the property ID is different. That is when it
// transitions into this unordered type handler.
template<class TPropertyIndex, class TMapKey, bool IsNotExtensibleSupported>
class SimpleDictionaryUnorderedTypeHandler sealed : public SimpleDictionaryTypeHandlerBase<TPropertyIndex, TMapKey, IsNotExtensibleSupported>
{
template <typename _TPropertyIndex, typename _TMapKey, bool _IsNotExtensibleSupported> friend class SimpleDictionaryUnorderedTypeHandler;
template <typename _TPropertyIndex, typename _TMapKey, bool _IsNotExtensibleSupported> friend class SimpleDictionaryTypeHandlerBase;
private:
// A deleted property ID that will be reused for the next property add. The object's slot corresponding to this property
// ID will have a tagged int that is the next deleted property ID in the chain.
TPropertyIndex deletedPropertyIndex;
public:
DEFINE_GETCPPNAME();
public:
SimpleDictionaryUnorderedTypeHandler(Recycler * recycler, int slotCapacity, uint16 inlineSlotCapacity, uint16 offsetOfInlineSlots);
SimpleDictionaryUnorderedTypeHandler(ScriptContext * scriptContext, SimplePropertyDescriptor* propertyDescriptors, int propertyCount, int slotCapacity, uint16 inlineSlotCapacity, uint16 offsetOfInlineSlots);
SimpleDictionaryUnorderedTypeHandler(Recycler* recycler, int slotCapacity, int propertyCapacity, uint16 inlineSlotCapacity, uint16 offsetOfInlineSlots);
typedef SimpleDictionaryTypeHandlerBase<TPropertyIndex, TMapKey, IsNotExtensibleSupported> Base;
DEFINE_VTABLE_CTOR_NO_REGISTER(SimpleDictionaryUnorderedTypeHandler, Base);
private:
template<class OtherTPropertyIndex, class OtherTMapKey, bool OtherIsNotExtensibleSupported>
void CopyUnorderedStateFrom(const SimpleDictionaryUnorderedTypeHandler<OtherTPropertyIndex, OtherTMapKey, OtherIsNotExtensibleSupported> &other,
DynamicObject *const object)
{
CompileAssert(sizeof(TPropertyIndex) >= sizeof(OtherTPropertyIndex));
if (other.deletedPropertyIndex != PropertyIndexRanges<OtherTPropertyIndex>::NoSlots)
{
deletedPropertyIndex = other.deletedPropertyIndex;
// If terminator values are different, walk to end of chain and update terminator value
if ((int)PropertyIndexRanges<TPropertyIndex>::NoSlots != (int)PropertyIndexRanges<OtherTPropertyIndex>::NoSlots)
{
OtherTPropertyIndex cur = other.deletedPropertyIndex;
for (;;)
{
OtherTPropertyIndex next = static_cast<OtherTPropertyIndex>(TaggedInt::ToInt32(object->GetSlot(cur)));
if (next == PropertyIndexRanges<OtherTPropertyIndex>::NoSlots)
{
this->SetSlotUnchecked(object, cur, TaggedInt::ToVarUnchecked(PropertyIndexRanges<TPropertyIndex>::NoSlots));
break;
}
cur = next;
}
}
}
}
bool IsReusablePropertyIndex(const TPropertyIndex propertyIndex);
bool TryRegisterDeletedPropertyIndex(DynamicObject *const object, const TPropertyIndex propertyIndex);
bool TryReuseDeletedPropertyIndex(DynamicObject *const object, TPropertyIndex *const propertyIndex);
bool TryUndeleteProperty(
DynamicObject *const object,
const TPropertyIndex existingPropertyIndex,
TPropertyIndex *const propertyIndex);
};
}
|
/*
* Copyright (c) 2005, Swedish Institute of Computer Science.
* 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.
*
*/
/**
* \file
* Routing tables for the micro implementation of the AODV ad hoc routing protocol
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __UAODV_RT_H__
#define __UAODV_RT_H__
#include "contiki-net.h"
struct uaodv_rt_entry {
struct uaodv_rt_entry *next;
uip_ipaddr_t dest;
uip_ipaddr_t nexthop;
uint32_t hseqno; /* In host byte order! */
uint8_t hop_count;
uint8_t is_bad; /* Only one bit is used. */
};
struct uaodv_rt_entry *
uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop,
unsigned hop_count, const uint32_t *seqno);
struct uaodv_rt_entry *uaodv_rt_lookup_any(uip_ipaddr_t *dest);
struct uaodv_rt_entry *uaodv_rt_lookup(uip_ipaddr_t *dest);
void uaodv_rt_remove(struct uaodv_rt_entry *e);
void uaodv_rt_lru(struct uaodv_rt_entry *e);
void uaodv_rt_flush_all(void);
#endif /* __UAODV_RT_H__ */
|
/*
** my_putchar.c for 42sh in /u/all/jorge_d/svn/VSHsvn/trunk/lib
**
** Made by dimitri jorge
** Login <jorge_d@epitech.net>
**
** Started on Wed Apr 7 14:42:31 2010 dimitri jorge
** Last update Tue May 18 16:37:14 2010 julien di-marco
*/
#include <unistd.h>
#include <stdlib.h>
#include "lib.h"
void my_putchar(char c)
{
xwrite(STDOUT_FILENO, &c, 1);
}
void my_putfd(int fd, char c)
{
xwrite(fd, &c, 1);
}
int my_fdstr(int fd, char *str)
{
return (xwrite(fd, str, my_strlen(str)));
}
|
#ifndef WSOCKBAS_H
#define WSOCKBAS_H
#ifdef _WIN32
#include <windows.h>
VOID WINAPI WSBStartup(VOID);
VOID WINAPI WSBCleanup(VOID);
LONG WINAPI WSBOpenServer(LONG nPort);
VOID WINAPI WSBCloseServer(LONG nSocket);
LONG WINAPI WSBAccept(LONG nSocket);
LONG WINAPI WSBConnect(LPCSTR lpszHost, LONG nPort);
VOID WINAPI WSBDisconnect(LONG nSocket);
LONG WINAPI WSBRecv(LONG nSocket, LPSTR lpBuffer, LONG nLen);
LONG WINAPI WSBSend(LONG nSocket, LPCSTR lpBuffer, LONG nLen);
#else
const int INVALID_SOCKET = -1;
inline void WSBStartup(void) {};
inline void WSBCleanup(void) {};
int WSBOpenServer(int nPort);
void WSBCloseServer(int nSocket);
int WSBAccept(int nSocket);
int WSBConnect(const char *lpszHost, int nPort);
void WSBDisconnect(int nSocket);
int WSBRecv(int nSocket, char *lpBuffer, int nLen);
int WSBSend(int nSocket, const char *lpBuffer, int nLen);
#endif
#endif
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2017 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_TXDB_H
#define BITCOIN_TXDB_H
#include "txdb-leveldb.h"
#endif // BITCOIN_TXDB_H
|
#ifndef __REDIS_RIO_H
#define __REDIS_RIO_H
#include <stdio.h>
#include <stdint.h>
#include "sds.h"
/*
* RIO API 接口和状态
*/
struct _rio { /* 这个玩意非常类似于cpp中的类,所以一门语言什么的,关键还是看你怎么去使用它啦. */
/* Backend functions.
* Since this functions do not tolerate short writes or reads the return
* value is simplified to: zero on error, non zero on complete success. */
size_t(*read)(struct _rio *, void *buf, size_t len);
size_t(*write)(struct _rio *, const void *buf, size_t len);
off_t(*tell)(struct _rio *);
/* The update_cksum method if not NULL is used to compute the checksum of
* all the data that was read or written so far. The method should be
* designed so that can be called with the current checksum, and the buf
* and len fields pointing to the new block of data to add to the checksum
* computation. */
/* 校验和计算函数,每次有写入/读取新数据时都要计算一次 */
void(*update_cksum)(struct _rio *, const void *buf, size_t len);
/* 当前校验和 */
uint64_t cksum;
/* number of bytes read or written */
size_t processed_bytes;
size_t max_processing_chunk; /* 单次读或者写一个块最大的大小 */
/* Backend-specific vars. */
union {
struct {
/* 缓存指针 */
sds ptr;
/* 偏移量 */
off_t pos;
} buffer;
struct {
/* 被打开文件的指针 */
FILE *fp;
/* 最近一次 fsync() 以来,写入的字节量 */
off_t buffered;
/* 写入多少字节之后,才会自动执行一次 fsync() */
off_t autosync;
} file;
} io;
};
typedef struct _rio rio;
/*
* 将 buf 中的 len 字节写入到 r 中。
*
* 写入成功返回实际写入的字节数,写入失败返回 -1 。
*/
static inline size_t rioWrite(rio *r, const void *buf, size_t len) {
while (len) {
size_t bytes_to_write = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len; /* 一次要写入的数据大小 */
if (r->update_cksum) r->update_cksum(r, buf, bytes_to_write);
if (r->write(r, buf, bytes_to_write) == 0) /* 开始写入 */
return 0;
buf = (char*)buf + bytes_to_write; /* 指针后移 */
len -= bytes_to_write;
r->processed_bytes += bytes_to_write;
}
return 1; /* 如果写入成功的话,就返回1是吧. */
}
/*
* 从 r 中读取 len 字节,并将内容保存到 buf 中。
*
* 读取成功返回 1 ,失败返回 0 。
*/
static inline size_t rioRead(rio *r, void *buf, size_t len) {
while (len) {
size_t bytes_to_read = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len;
if (r->read(r, buf, bytes_to_read) == 0)
return 0;
if (r->update_cksum) r->update_cksum(r, buf, bytes_to_read);
buf = (char*)buf + bytes_to_read;
len -= bytes_to_read;
r->processed_bytes += bytes_to_read;
}
return 1;
}
/*
* 返回 r 的当前偏移量。
*/
static inline off_t rioTell(rio *r) {
return r->tell(r);
}
void rioInitWithFile(rio *r, FILE *fp);
void rioInitWithBuffer(rio *r, sds s);
size_t rioWriteBulkCount(rio *r, char prefix, int count);
size_t rioWriteBulkString(rio *r, const char *buf, size_t len);
size_t rioWriteBulkLongLong(rio *r, long long l);
size_t rioWriteBulkDouble(rio *r, double d);
void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len);
void rioSetAutoSync(rio *r, off_t bytes);
#endif
|
// Copyright (c) 2017 The Brave 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 BRAVE_COMMON_EXTENSIONS_URL_BINDINGS_H_
#define BRAVE_COMMON_EXTENSIONS_URL_BINDINGS_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "extensions/renderer/object_backed_native_handler.h"
#include "v8/include/v8.h"
namespace brave {
class URLBindings : public extensions::ObjectBackedNativeHandler {
public:
explicit URLBindings(extensions::ScriptContext* context);
~URLBindings() override;
// ObjectBackedNativeHandler:
void AddRoutes() override;
static v8::Local<v8::Object> API(extensions::ScriptContext* context);
private:
void New(const v8::FunctionCallbackInfo<v8::Value>& args);
void Parse(const v8::FunctionCallbackInfo<v8::Value>& args);
void FormatForDisplay(const v8::FunctionCallbackInfo<v8::Value>& args);
DISALLOW_COPY_AND_ASSIGN(URLBindings);
};
} // namespace brave
#endif // BRAVE_COMMON_EXTENSIONS_URL_BINDINGS_H_
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import <IDEKit/IDEMediaResourceFoldingStrategy.h>
@interface IDEIOSMediaResourceFoldingStrategy : IDEMediaResourceFoldingStrategy
{
}
+ (id)sharedInstance;
- (id)defaultVariantForMatching;
- (id)mostToLeastSpecificVariablesForMediaType:(id)arg1;
- (BOOL)namesForFilesOfTypeIncludeFileExtensions:(id)arg1;
@end
|
#ifndef ULIST_H
#define ULIST_H
#endif |
//
// CDODataImporter.h
//
//
// Created by Luke Stringer on 28/07/2014.
//
//
#import <Foundation/Foundation.h>
@interface CDODataImporter : NSObject
@property (nonatomic, readonly) NSManagedObjectContext *managedObjectContext;
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
/**
* Must override.
*
* @param JSON JSON to import.
*/
- (void)importJSON:(NSArray *)JSON;
@end
|
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Destructor. Does nothing.
*/
virtual ~Visitor() { }
/**
* Does nothing. Should be overridden by child.
*/
virtual void visit() { }
};
}
#endif
|
//
// Piece.h
// CGFLib-1
//
// Created by José Ricardo de Sousa Coutinho on 28/11/13.
// Copyright (c) 2013 me. All rights reserved.
//
#ifndef __CGFLib_1__Piece__
#define __CGFLib_1__Piece__
#define FREE 0
#define PLAYER1 1
#define PLAYER2 2
#include <iostream>
#include "PieceModel.h"
#include "TileModel.h"
#include "Texture.h"
using namespace std;
class Piece{
static PieceModel* piece_model;
public:
static Texture* white;
static Texture* black;
GLint angle;
GLfloat pos;
GLint dir;
bool end;
bool ani;
GLfloat a[3];
GLfloat b[3];
GLfloat inc[3];
int player;
int p1stack;
int p2stack;
int picked;
int possible;
Piece(int player, int p1stack, int p2stack);
int getPlayer();
int getP1Stack();
int getP2Stack();
void setPlayer(int player);
void setP1Stack(int p1stack);
void setP2Stack(int p2stack);
void setPicked(GLint value);
void setPossible(GLint value);
void incP1Stack(int inc);
void incP2Stack(int inc);
void transferStacks(Piece* captured);
void print();
void draw();
Piece* copy();
};
#endif /* defined(__CGFLib_1__Piece__) */
|
#include<stdio.h>
void main()
{
int i,j,a[10],max;
printf("Please enter Integer data:\n");
for(i=0;i<10;i++)
{
printf("a[%i]=",i);
scanf("%d",&a[i]);
}
printf("\nThe original numbers:\n");
for(i=0;i<10;i++)
printf("%5d",a[i]);
for(i=0;i<10;i++)
{
for(j=i+1;j<10;j++)
{
if(a[i]>a[j])
{
max=a[i];
a[i]=a[j];
a[j]=max;
}
}
}
printf("\nThe sorted numbers:\n");
for(i=0;i<10;i++)
printf("%5d",a[i]);
printf("\n");
} |
/* Copyright (c) 2017 Nguyen Viet Giang. All rights reserved. */
#pragma once
#include <any/rt_types.h>
#include <any/actor.h>
#ifdef __cplusplus
extern "C" {
#endif
/// Add std-buffer library.
ANY_API void
astd_lib_add_string(
aloader_t* l);
/// Utility function to calculate the hash and length of string `s`.
ANY_API ahash_and_length_t
ahash_and_length(
const char* s);
/// Get NULL terminated string pointer.
static inline const char*
agc_string_to_cstr(
aactor_t* a, avalue_t* v)
{
agc_string_t* s = AGC_CAST(agc_string_t, &a->gc, v->v.heap_idx);
return (const char*)(s + 1);
}
/// Create a new string.
ANY_API aint_t
agc_string_new(
aactor_t* a, const char* s, avalue_t* v);
/// Compare two strings.
static inline aint_t
agc_string_compare(
aactor_t* a, avalue_t* lhs, avalue_t* rhs)
{
agc_string_t* ls = AGC_CAST(agc_string_t, &a->gc, lhs->v.heap_idx);
agc_string_t* rs = AGC_CAST(agc_string_t, &a->gc, rhs->v.heap_idx);
if (ls->hal.hash != rs->hal.hash) {
return ls->hal.hash < rs->hal.hash ? -1 : 1;
} else {
return strcmp((const char*)(ls + 1), (const char*)(rs + 1));
}
}
/// Push new string onto the stack.
static inline void
any_push_string(
aactor_t* a, const char* s)
{
avalue_t v;
aint_t ec = agc_string_new(a, s, &v);
if (ec != AERR_NONE) any_error(a, AERR_RUNTIME, "out of memory");
aactor_push(a, &v);
}
/// Get NULL terminated string pointer.
static inline const char*
any_to_string(
aactor_t* a, aint_t idx)
{
avalue_t* v = a->stack.v + idx;
agc_string_t* s = AGC_CAST(agc_string_t, &a->gc, v->v.heap_idx);
return (const char*)(s + 1);
}
/// Get NULL terminated string pointer.
static inline const char*
any_check_string(
aactor_t* a, aint_t idx)
{
agc_string_t* s;
avalue_t* v = a->stack.v + idx;
if (v->tag.type != AVT_STRING) {
any_error(a, AERR_RUNTIME, "not string");
}
s = AGC_CAST(agc_string_t, &a->gc, v->v.heap_idx);
return (const char*)(s + 1);
}
/// Returns number of characters.
static inline aint_t
any_string_length(
aactor_t* a, aint_t idx)
{
avalue_t* v = a->stack.v + idx;
agc_string_t* s = AGC_CAST(agc_string_t, &a->gc, v->v.heap_idx);
return s->hal.length;
}
/// Returns the hashed value.
static inline aint_t
any_string_hash(
aactor_t* a, aint_t idx)
{
avalue_t* v = a->stack.v + idx;
agc_string_t* s = AGC_CAST(agc_string_t, &a->gc, v->v.heap_idx);
return (aint_t)s->hal.hash;
}
#ifdef __cplusplus
} // extern "C"
#endif
|
// Copyright (c) 2019 The Gulden developers
// Authored by: Willem de Jonge (willem@isnapp.nl)
// Distributed under the GULDEN software license, see the accompanying
// file COPYING
#ifndef WITNESS_REWARD_TEMPLATE_H
#define WITNESS_REWARD_TEMPLATE_H
#include "base58.h"
#include "amount.h"
#include <vector>
struct CWitnessRewardDestination {
enum class DestType: uint16_t {
Compound,
Account,
Address
};
DestType type;
CNativeAddress address;
CAmount amount;
double percent;
bool takesRemainder;
bool takesCompoundOverflow;
CWitnessRewardDestination(): type(DestType::Account), amount(0), percent(0), takesRemainder(false), takesCompoundOverflow(false) {}
CWitnessRewardDestination(const DestType _type, const CNativeAddress& _address, const CAmount _amount, const double _percent, const bool _takesRemainder, const bool _takesCompoundOverflow)
: type(_type), address(_address), amount(_amount), percent(_percent), takesRemainder(_takesRemainder), takesCompoundOverflow(_takesCompoundOverflow) {}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action)
{
READWRITE(type);
READWRITE(address);
READWRITE(amount);
READWRITE(percent);
READWRITE(takesRemainder);
READWRITE(takesCompoundOverflow);
}
};
class CWitnessRewardTemplate {
public:
bool empty() const;
std::vector<CWitnessRewardDestination> destinations;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action)
{
READWRITECOMPACTSIZEVECTOR(destinations);
}
CAmount fixedAmountsSum() const;
double percentagesSum() const;
//! Basic sanity checks on the template (like total % < 100 etc), throws if there are issues
void validate(const CAmount witnessBlockSubsidy);
};
#endif
|
//////////////////////////////////////////////////////////////////////////
// stdafx.h
//
// Precompiled header for the XTools Common library
//
// Copyright (C) 2015 Microsoft Corp. All Rights Reserved
//////////////////////////////////////////////////////////////////////////
#pragma once
#if defined(_WIN32)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
# endif
# ifndef NOMINMAX
# define NOMINMAX // Using std::min and std::max
# endif
#include <windows.h>
#endif
#include <string>
#include <stddef.h>
#include "Common.h"
#include "CommonPrivate.h"
|
struct {
int x, y;
} wat = {1, 2};
int main(void) {
int p = *(&wat.y);
return p;
}
|
//
// yas_audio_mac_io_core.h
//
#pragma once
#include <TargetConditionals.h>
#if (TARGET_OS_MAC && !TARGET_OS_IPHONE)
#include "yas_audio_io_core.h"
namespace yas::audio {
struct mac_io_core final : io_core {
~mac_io_core();
void set_render_handler(std::optional<io_render_f>) override;
void set_maximum_frames_per_slice(uint32_t const) override;
bool start() override;
void stop() override;
[[nodiscard]] static mac_io_core_ptr make_shared(mac_device_ptr const &);
private:
mac_device_ptr _device;
std::optional<AudioDeviceIOProcID> _io_proc_id = std::nullopt;
std::optional<io_render_f> _render_handler = std::nullopt;
uint32_t _maximum_frames = 4096;
bool _is_started = false;
mac_io_core(mac_device_ptr const &);
[[nodiscard]] io_kernel_ptr _make_kernel() const;
void _create_io_proc();
void _destroy_io_proc();
void _reload_if_needed();
};
} // namespace yas::audio
#endif
|
////////////////////////////////////////////////////
// Copyright (c) 2012 ICRL
// See the file LICENSE.txt for copying permission.
//
// Original Author: Randy Gaul
// Date: 7/20/2012
// Contact: r.gaul@digipen.edu
////////////////////////////////////////////////////
#ifndef CAMERAH
#define CAMERAH
#include "GlobalDefines.h"
#include "Shapes.h"
#include "Entity.h"
#include "EntityManager.h"
#define CAM_SCROLL_BOUND 5.0f
typedef struct _PLAYER_CAMERA
{
VECTOR2D center;
ENTITY *followThis;
} CAMERA;
//
// GlobalCamInit
// Purpose: Initializes the camera's various data members.
// Notes : The followMe param can be NULL if you don't wish the camera to
// follow any object.
//
RETURN_TYPE GlobalCamInit( float xoffset, float yoffset, ENTITY *followMe );
//
// GlobalCamUpdate
// Purpose: Updates the camera, for use when following a game entity.
//
void GlobalCamUpdate( float dt );
//
// GlobalCamDisable
// Purpose: Clears the data members for the next state, to be used during free.
//
void GlobalCamDisable( void );
extern CAMERA GLOBAL_CAM;
#endif CAMERAH |
/* Copyright (c) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// GDataEntryFinanceTransaction.h
//
#import "GDataEntryBase.h"
@class GDataFinanceTransactionData;
@interface GDataEntryFinanceTransaction : GDataEntryBase
+ (GDataEntryFinanceTransaction *)transactionEntry;
// extensions
- (void)setTransactionData:(GDataFinanceTransactionData *)obj;
- (GDataFinanceTransactionData *)transactionData;
@end
|
// ExtObject.h
// This file is part of the EScript programming language (https://github.com/EScript)
//
// Copyright (C) 2011-2013 Claudius Jähn <ClaudiusJ@live.de>
// Copyright (C) 2012 Benjamin Eikel <benjamin@eikel.org>
//
// Licensed under the MIT License. See LICENSE file for details.
// ---------------------------------------------------------------------------------
#ifndef ES_ExtObject_H
#define ES_ExtObject_H
#include "Type.h"
#include "../Utils/AttributeContainer.h"
namespace EScript {
//! [ExtObject] ---|> [Object]
class ExtObject : public Object {
ES_PROVIDES_TYPE_NAME(ExtObject)
//! @name Initialization
// @{
public:
static Type* getTypeObject();
static void init(EScript::Namespace & globals);
// @}
// -----
//! @name Main
// @{
protected:
ExtObject(const ExtObject & other);
public:
static ExtObject * create();
ExtObject();
ExtObject(Type * type);
virtual ~ExtObject() { }
//! ---|> [Object]
Object * clone() const override;
// @}
// -----
//! @name Attributes
// @{
public:
using Object::_accessAttribute;
using Object::setAttribute;
//! ---|> [Object]
Attribute * _accessAttribute(const StringId & id,bool localOnly) override;
//! ---|> [Object]
void _initAttributes(Runtime & rt) override;
//! ---|> [Object]
bool setAttribute(const StringId & id,const Attribute & attr) override;
//! ---|> [Object]
void collectLocalAttributes(std::unordered_map<StringId,Object *> & attrs) override;
void cloneAttributesFrom(const ExtObject * obj);
private:
AttributeContainer objAttributes;
// @}
};
}
#endif // ES_ExtObject_H
|
#pragma once
#include "gtest/gtest.h"
class TestMathFunctions :
public ::testing::Test
{
public:
TestMathFunctions();
virtual ~TestMathFunctions();
};
|
/*
* Copyright (C) 2018 Microhip / Atmel Corporation
* Wenyou.Yang <wenyou.yang@microchip.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <clk-uclass.h>
#include <dm/device.h>
#include <linux/io.h>
#include <mach/at91_pmc.h>
#include "pmc.h"
DECLARE_GLOBAL_DATA_PTR;
static int at91_plladiv_clk_enable(struct clk *clk)
{
return 0;
}
static ulong at91_plladiv_clk_get_rate(struct clk *clk)
{
struct pmc_platdata *plat = dev_get_platdata(clk->dev);
struct at91_pmc *pmc = plat->reg_base;
struct clk source;
ulong clk_rate;
int ret;
ret = clk_get_by_index(clk->dev, 0, &source);
if (ret)
return -EINVAL;
clk_rate = clk_get_rate(&source);
if (readl(&pmc->mckr) & AT91_PMC_MCKR_PLLADIV_2)
clk_rate /= 2;
return clk_rate;
}
static ulong at91_plladiv_clk_set_rate(struct clk *clk, ulong rate)
{
struct pmc_platdata *plat = dev_get_platdata(clk->dev);
struct at91_pmc *pmc = plat->reg_base;
struct clk source;
ulong parent_rate;
int ret;
ret = clk_get_by_index(clk->dev, 0, &source);
if (ret)
return -EINVAL;
parent_rate = clk_get_rate(&source);
if ((parent_rate != rate) && ((parent_rate) / 2 != rate))
return -EINVAL;
if (parent_rate != rate) {
writel((readl(&pmc->mckr) | AT91_PMC_MCKR_PLLADIV_2),
&pmc->mckr);
}
return 0;
}
static struct clk_ops at91_plladiv_clk_ops = {
.enable = at91_plladiv_clk_enable,
.get_rate = at91_plladiv_clk_get_rate,
.set_rate = at91_plladiv_clk_set_rate,
};
static int at91_plladiv_clk_probe(struct udevice *dev)
{
return at91_pmc_core_probe(dev);
}
static const struct udevice_id at91_plladiv_clk_match[] = {
{ .compatible = "atmel,at91sam9x5-clk-plldiv" },
{}
};
U_BOOT_DRIVER(at91_plladiv_clk) = {
.name = "at91-plladiv-clk",
.id = UCLASS_CLK,
.of_match = at91_plladiv_clk_match,
.probe = at91_plladiv_clk_probe,
.platdata_auto_alloc_size = sizeof(struct pmc_platdata),
.ops = &at91_plladiv_clk_ops,
};
|
/* 26oct14abu
* (c) Software Lab. Alexander Burger
*/
#include "pico.h"
static void mark(any);
/* Mark data */
static void markTail(any x) {
while (isCell(x)) {
if (!(num(cdr(x)) & 1))
return;
*(long*)&cdr(x) &= ~1;
mark(cdr(x)), x = car(x);
}
if (!isTxt(x))
do {
if (!(num(val(x)) & 1))
return;
*(long*)&val(x) &= ~1;
} while (!isNum(x = val(x)));
}
static void mark(any x) {
while (isCell(x)) {
if (!(num(cdr(x)) & 1))
return;
*(long*)&cdr(x) &= ~1;
mark(car(x)), x = cdr(x);
}
if (!isNum(x) && num(val(x)) & 1) {
*(long*)&val(x) &= ~1;
mark(val(x));
markTail(tail(x));
}
}
/* Garbage collector */
static void gc(long c) {
any p;
heap *h;
int i;
h = Heaps;
do {
p = h->cells + CELLS-1;
do
*(long*)&cdr(p) |= 1;
while (--p >= h->cells);
} while (h = h->next);
/* Mark */
for (i = 0; i < RAMS; i += 2) {
markTail(Ram[i]);
mark(Ram[i+1]);
}
mark(Intern[0]), mark(Intern[1]);
mark(Transient[0]), mark(Transient[1]);
mark(ApplyArgs), mark(ApplyBody);
for (p = Env.stack; p; p = cdr(p))
mark(car(p));
for (p = (any)Env.bind; p; p = (any)((bindFrame*)p)->link)
for (i = ((bindFrame*)p)->cnt; --i >= 0;) {
mark(((bindFrame*)p)->bnd[i].sym);
mark(((bindFrame*)p)->bnd[i].val);
}
for (p = (any)CatchPtr; p; p = (any)((catchFrame*)p)->link) {
if (((catchFrame*)p)->tag)
mark(((catchFrame*)p)->tag);
mark(((catchFrame*)p)->fin);
}
/* Sweep */
Avail = NULL;
h = Heaps;
if (c) {
do {
p = h->cells + CELLS-1;
do
if (num(p->cdr) & 1)
Free(p), --c;
while (--p >= h->cells);
} while (h = h->next);
while (c >= 0)
heapAlloc(), c -= CELLS;
}
else {
heap **hp = &Heaps;
cell *av;
do {
c = CELLS;
av = Avail;
p = h->cells + CELLS-1;
do
if (num(p->cdr) & 1)
Free(p), --c;
while (--p >= h->cells);
if (c)
hp = &h->next, h = h->next;
else
Avail = av, h = h->next, free(*hp), *hp = h;
} while (h);
}
}
// (gc ['num]) -> num | NIL
any doGc(any x) {
x = cdr(x), x = EVAL(car(x));
val(At) = val(At2) = Nil;
gc(isNum(x)? unBox(x) * 1024 / sizeof(cell) : CELLS); // kB
return x;
}
/* Construct a cell */
any cons(any x, any y) {
cell *p;
if (!(p = Avail)) {
cell c1, c2;
Push(c1,x);
Push(c2,y);
gc(CELLS);
drop(c1);
p = Avail;
}
Avail = p->car;
p->car = x;
p->cdr = y;
return p;
}
/* Construct a symbol */
any consSym(any val, word w) {
cell *p;
if (!(p = Avail)) {
cell c1;
if (!val)
gc(CELLS);
else {
Push(c1,val);
gc(CELLS);
drop(c1);
}
p = Avail;
}
Avail = p->car;
p = symPtr(p);
val(p) = val ?: p;
tail(p) = txt(w);
return p;
}
/* Construct a name cell */
any consName(word w, any n) {
cell *p;
if (!(p = Avail)) {
gc(CELLS);
p = Avail;
}
Avail = p->car;
p = symPtr(p);
val(p) = n;
tail(p) = (any)w;
return p;
}
|
//
// ImageDetailModel.h
// Hey!XuanWu
//
// Created by Cao JianRong on 14-3-5.
// Copyright (c) 2014年 Cao JianRong. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ImageDetailModel : NSObject
{
NSString *idImg;//照片id
NSString *nameImg;//照片名
NSString *fileImgName;//照片物理路径文件名
NSString *describeImg;//照片描述
NSString *addAccountId;//照片添加人账号id
NSString *addTime;//照片添加时间
NSString *accountName;//照片添加人账户名
NSString *goodCount;//该照片的点赞数
}
@property (nonatomic, retain) NSString *idImg;
@property (nonatomic, retain) NSString *nameImg;
@property (nonatomic, retain) NSString *fileImgName;
@property (nonatomic, retain) NSString *describeImg;
@property (nonatomic, retain) NSString *addAccountId;
@property (nonatomic, retain) NSString *addTime;
@property (nonatomic, retain) NSString *accountName;
@property (nonatomic, retain) NSString *goodCount;
@end
|
// This file is part of the HandwritingTextField package.
//
// For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
// https://github.com/eelretep/HandwritingTextField
//
// FakeTouch.h
// HandwritingTextFieldTests
//
// Created by Peter Lee on 1/29/14.
// Copyright (c) 2014 Peter Lee <eelretep@gmail.com>. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FakeTouch : UITouch
@property (nonatomic)CGPoint location;
@property (nonatomic)CGPoint previousLocation;
@property (nonatomic)NSDate *time;
@property (nonatomic)BOOL endingTouch;
- (instancetype)initWithLocation:(CGPoint)location previousLocation:(CGPoint)previousLocation time:(NSDate *)time;
- (CGPoint)previousLocationInView:(UIView *)view;
- (CGPoint)locationInView:(UIView *)view;
@end
|
//
// TestWindowViewController.h
// test_jobQuestions
//
// Created by 张净南 on 2018/9/19.
// Copyright © 2018年 Jingnan Zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TestWindowViewController : UIViewController
@end
|
//
// zh_KeyboardView.h
// zhPopupController
//
// Created by zhanghao on 2017/9/13.
// Copyright © 2017年 snail-z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface zhUnderlineTextField : UITextField
@property (nonatomic, strong) UIColor *underlineColor;
@end
@interface zh_KeyboardView : UIView
@property (nonatomic, copy) void (^nextClickedBlock)(zh_KeyboardView *keyboardView, UIButton *button);
@property (nonatomic, copy) void (^loginClickedBlock)(zh_KeyboardView *keyboardView);
@property (nonatomic, strong) zhUnderlineTextField *numberField;
@property (nonatomic, strong) zhUnderlineTextField *passwordField;
@property (nonatomic, strong) UIButton *loginButton;
@property (nonatomic, strong) UIButton *registerButton;
@property (nonatomic, strong) NSArray<UIButton *> *buttons;
@end
@interface zh_KeyboardView2 : UIView
@property (nonatomic, copy) void (^gobackClickedBlock)(zh_KeyboardView2 *keyboardView, UIButton *button);
@property (nonatomic, copy) void (^nextClickedBlock)(zh_KeyboardView2 *keyboardView, UIButton *button);
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) zhUnderlineTextField *numberField;
@property (nonatomic, strong) zhUnderlineTextField *codeField;
@property (nonatomic, strong) UIButton *codeButton;
@property (nonatomic, strong) UIButton *nextButton;
@property (nonatomic, strong) UIButton *gobackButton;
@end
@interface zh_KeyboardView3 : UIView
@property (nonatomic, copy) void (^senderClickedBlock)(zh_KeyboardView3 *keyboardView, UIButton *button);
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UITextField *textField;
@property (nonatomic, strong) UIButton *senderButton;
@end
|
//
// GJGCCreateGroupMemberCountSheetViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "BTActionSheetViewController.h"
@interface GJGCCreateGroupMemberCountSheetViewController : BTActionSheetViewController
@end
|
#include <avr/pgmspace.h>
#include "config.h"
#include "memstrings.h"
#ifdef TAPUINO_LANGUAGE_IT
const char S_DEFAULT_RECORD_DIR[] PROGMEM = "/salvataggi";
const char S_RECORDING[] PROGMEM = "Recording";
const char S_SELECT_RECORD_MODE[] PROGMEM = "Nome file:";
const char S_REC_MODE_MANUAL[] PROGMEM = "Manuale";
const char S_REC_MODE_AUTO[] PROGMEM = "Automatico";
const char S_ENTER_FILENAME[] PROGMEM = "Inserisci nome";
const char S_INIT[] PROGMEM = "Avvio in corso..";
const char S_INIT_FAILED[] PROGMEM = "Avvio fallito!";
const char S_INIT_OK[] PROGMEM = "Avvio OK!";
const char S_NO_FILES_FOUND[] PROGMEM = "Nessun file!";
const char S_SELECT_FILE[] PROGMEM = "Scegli file:";
const char S_SELECT_MODE[] PROGMEM = "Scegli modo:";
const char S_MODE_PLAY[] PROGMEM = "Play";
const char S_MODE_RECORD[] PROGMEM = "Record";
const char S_READY_RECORD[] PROGMEM = "Pronto...";
const char S_PRESS_START[] PROGMEM = "Premi START";
const char S_MODE_OPTIONS[] PROGMEM = "Opzioni";
const char S_OPTION_SIGNAL[] PROGMEM = "Inverti";
const char S_OPTION_KEY_REPEAT[] PROGMEM = "Velocita' scorr.";
const char S_OPTION_TICKER_SPEED[] PROGMEM = "Velocita' scroll";
const char S_OPTION_TICKER_HOLD[] PROGMEM = "Pausa scroll";
const char S_OPTION_REC_FINALIZE[] PROGMEM = "Pausa a fine REC";
const char S_OPTION_REC_AUTO_FINALIZE[] PROGMEM = "Auto finalizza";
const char S_MKDIR_FAILED[] PROGMEM = "Errore MKDIR!";
const char S_CHDIR_FAILED[] PROGMEM = "Errore CHDIR!";
const char S_READ_FAILED[] PROGMEM = "READ fallito!";
const char S_OPEN_FAILED[] PROGMEM = "OPEN fallito!";
const char S_INVALID_TAP[] PROGMEM = "TAP Invalido!";
const char S_INVALID_SIZE[] PROGMEM = "Dimens. invalida";
const char S_LOADING[] PROGMEM = "Loading:";
const char S_OPERATION_COMPLETE[] PROGMEM = "Completato!";
const char S_OPERATION_ABORTED[] PROGMEM = "Annullato!";
const char S_OPTION_MACHINE_TYPE[] PROGMEM = "Macchina";
const char S_OPTION_VIDEO_MODE[] PROGMEM = "Video";
#endif
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "DVTImageAndTextLayer.h"
@interface IDENavigationHUDImageAndTextLayer : DVTImageAndTextLayer
{
}
+ (id)defaultAttributes;
+ (struct CGColor *)defaultTextShadowColor;
@end
|
//
// NUPurchaseItem.h
// NextUserKit
//
// Created by NextUser on 11/18/15.
// Copyright © 2015 NextUser. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* This class represents a purchase item and is being used by NUPurchase factory methods when
* creating new purchase. Each purchase can contain multiple purchase items.
*
* Each purchase item should have at least productName and SKU set so use itemWithProductName:SKU:
* method when creating new item.
*/
@interface NUPurchaseItem : NSObject
#pragma mark - Purchase Item Factory
/**
* @name Purchase Item Factory
*/
/**
* Creates an instance of purchase item.
*
* @param name Product name.
* @param SKU Product SKU.
*
* @return Instance of NUPurchaseItem object.
*/
+ (instancetype)itemWithProductName:(NSString *)name SKU:(NSString *)SKU;
#pragma mark - Purchase Item Properties
/**
* @name Purchase Item Properties
*/
/**
* Name of the product.
*/
@property (nonatomic, readonly) NSString *productName;
/**
* Product SKU.
*/
@property (nonatomic, readonly) NSString *SKU;
/**
* Product category.
*/
@property (nonatomic) NSString *category;
/**
* Product price.
*/
@property (nonatomic) double price;
/**
* Indicates how many products are inside this purchase item. Defaults to 1.
*/
@property (nonatomic) NSUInteger quantity;
/**
* Product description.
*/
@property (nonatomic) NSString *productDescription;
@end
|
#ifndef PHENO_H
#define PHENO_H
#include <string>
#include <vector>
struct Phenotype
{
std::vector<std::string> ind;
std::vector<std::string> phe;
std::vector<std::string> env;
std::vector<std::string> blk;
std::vector< std::vector<double> > dat;
};
struct Covariate
{
std::vector<std::string> ind;
std::vector<std::string> phe;
std::vector< std::vector<double> > dat;
};
struct SquareData
{
std::vector<std::string> ind;
std::vector< std::vector<double> > dat;
};
struct QtlEffect
{
std::vector<std::string> phe;
std::vector<std::string> qtl;
std::vector<std::string> allele;
std::vector<double> effect;
};
struct GeneticMap
{
std::vector<std::string> loc;
std::vector<std::string> chr;
std::vector<double> pos; // cM
};
int read_pheno(const std::string &filename, Phenotype &pt);
int write_pheno(const Phenotype &pt, const std::string &filename);
int read_covar(const std::string &filename, Covariate &ct);
int write_covar(const Covariate &ct, const std::string &filename);
int read_square(const std::string &filename, SquareData &sd);
int write_square(const SquareData &sd, const std::string &filename);
int read_qtl_effect(const std::string &filename, QtlEffect &qe);
int read_map(const std::string &filename, GeneticMap &gm);
#endif // PHENO_H
|
// ProjectileCrashGrenade.h: interface for the ProjectileCrashGrenade class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_PROJECTILECRASHGRENADE_H__F8FC58D4_6DB9_4A30_9561_46570398EA0F__INCLUDED_)
#define AFX_PROJECTILECRASHGRENADE_H__F8FC58D4_6DB9_4A30_9561_46570398EA0F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Projectile.h"
//#include "hptlist.h"
#include<list>
class ProjectileCrashGrenade : public Projectile
{
public:
ProjectileCrashGrenade(bool bDirection, int xPos, int yPos,std::list<Projectile*> *projectile_list, bool TYPE);
virtual ~ProjectileCrashGrenade();
HPTRect &GetWeaponBounds();
virtual void Update();
virtual void DeActivate();
void Explode();
bool IS_EXPLODING;
bool TYPE;
std::list<Projectile*> *projectile_list;
};
#endif // !defined(AFX_PROJECTILECRASHGRENADE_H__F8FC58D4_6DB9_4A30_9561_46570398EA0F__INCLUDED_)
|
#ifndef DALI_LAYERS_GRU_H
#define DALI_LAYERS_GRU_H
#include <vector>
#include "dali/tensor/tensor.h"
#include "dali/layers/layers.h"
class GRU : public AbstractLayer {
typedef StackedInputLayer layer_type;
public:
int input_size;
int hidden_size;
StackedInputLayer reset_layer;
StackedInputLayer memory_interpolation_layer;
StackedInputLayer memory_to_memory_layer;
typedef Tensor activation_t;
GRU();
GRU(int _input_size,
int _hidden_size,
DType dtype=DTYPE_FLOAT,
memory::Device device=memory::default_preferred_device);
GRU(const GRU& other, bool copy_w, bool copy_dw);
GRU shallow_copy() const;
Tensor activate(Tensor input_vector, Tensor previous_state) const;
Tensor activate_sequence(const std::vector<Tensor>& input_sequence) const;
Tensor activate_sequence(Tensor initial_state, const std::vector<Tensor>& input_sequence) const;
std::vector<Tensor> parameters() const;
Tensor initial_states() const;
};
#endif // DALI_LAYERS_GRU_H
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_STM32_BOARDCTRL_H
#define MICROPY_INCLUDED_STM32_BOARDCTRL_H
#include "py/mpconfig.h"
#ifndef MICROPY_BOARD_STARTUP
#define MICROPY_BOARD_STARTUP powerctrl_check_enter_bootloader
#endif
#ifndef MICROPY_BOARD_EARLY_INIT
#define MICROPY_BOARD_EARLY_INIT()
#endif
#ifndef MICROPY_BOARD_BEFORE_SOFT_RESET_LOOP
#define MICROPY_BOARD_BEFORE_SOFT_RESET_LOOP boardctrl_before_soft_reset_loop
#endif
#ifndef MICROPY_BOARD_TOP_SOFT_RESET_LOOP
#define MICROPY_BOARD_TOP_SOFT_RESET_LOOP boardctrl_top_soft_reset_loop
#endif
#ifndef MICROPY_BOARD_RUN_BOOT_PY
#define MICROPY_BOARD_RUN_BOOT_PY boardctrl_run_boot_py
#endif
#ifndef MICROPY_BOARD_RUN_MAIN_PY
#define MICROPY_BOARD_RUN_MAIN_PY boardctrl_run_main_py
#endif
#ifndef MICROPY_BOARD_START_SOFT_RESET
#define MICROPY_BOARD_START_SOFT_RESET boardctrl_start_soft_reset
#endif
#ifndef MICROPY_BOARD_END_SOFT_RESET
#define MICROPY_BOARD_END_SOFT_RESET boardctrl_end_soft_reset
#endif
// Constants to return from boardctrl_run_boot_py, boardctrl_run_main_py.
enum {
BOARDCTRL_CONTINUE,
BOARDCTRL_GOTO_SOFT_RESET_EXIT,
};
// Constants for boardctrl_state_t.reset_mode.
enum {
BOARDCTRL_RESET_MODE_NORMAL = 1,
BOARDCTRL_RESET_MODE_SAFE_MODE = 2,
BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM = 3,
BOARDCTRL_RESET_MODE_BOOTLOADER = 4,
};
typedef struct _boardctrl_state_t {
uint8_t reset_mode;
bool log_soft_reset;
} boardctrl_state_t;
void boardctrl_before_soft_reset_loop(boardctrl_state_t *state);
void boardctrl_top_soft_reset_loop(boardctrl_state_t *state);
int boardctrl_run_boot_py(boardctrl_state_t *state);
int boardctrl_run_main_py(boardctrl_state_t *state);
void boardctrl_start_soft_reset(boardctrl_state_t *state);
void boardctrl_end_soft_reset(boardctrl_state_t *state);
#endif // MICROPY_INCLUDED_STM32_BOARDCTRL_H
|
/* $NetBSD: multibyte.h,v 1.6 2013/08/18 20:03:48 joerg Exp $ */
/*-
* Copyright (c)2002 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _MULTIBYTE_H_
#define _MULTIBYTE_H_
/* mbstate_t private */
#ifdef _BSD_MBSTATE_T_
typedef _BSD_MBSTATE_T_ mbstate_t;
#undef _BSD_MBSTATE_T_
#endif
typedef struct _RuneStatePriv {
_RuneLocale *__runelocale;
char __private __attribute__((__aligned__));
} _RuneStatePriv;
typedef union _RuneState {
mbstate_t __pad;
struct _RuneStatePriv __priv;
#define rs_runelocale __priv.__runelocale
#define rs_private __priv.__private
} _RuneState;
#define _PRIVSIZE (sizeof(mbstate_t) - offsetof(_RuneStatePriv, __private))
#define _RUNE_LOCALE(loc) ((_RuneLocale *)((loc)->part_impl[(size_t)LC_CTYPE]))
#define _CITRUS_CTYPE(loc) \
(((_RuneLocale *)((loc)->part_impl[(size_t)LC_CTYPE]))->rl_citrus_ctype)
/* */
static __inline _RuneState *_ps_to_runestate(mbstate_t *ps) {
return (_RuneState *)(void *)ps;
}
static __inline _RuneState const *_ps_to_runestate_const(mbstate_t const *ps) {
return (_RuneState const *)(void const *)ps;
}
static __inline _RuneLocale *_ps_to_runelocale(mbstate_t const *ps) {
return _ps_to_runestate_const(ps)->rs_runelocale;
}
static __inline _citrus_ctype_t _ps_to_ctype(mbstate_t const *ps,
locale_t loc) {
if (!ps)
return _CITRUS_CTYPE(loc);
_DIAGASSERT(_ps_to_runelocale(ps) != NULL);
return _ps_to_runelocale(ps)->rl_citrus_ctype;
}
static __inline void *_ps_to_private(mbstate_t *ps) {
if (ps == NULL)
return NULL;
return (void *)&_ps_to_runestate(ps)->rs_private;
}
static __inline void const *_ps_to_private_const(mbstate_t const *ps) {
if (ps == NULL)
return NULL;
return (void const *)&_ps_to_runestate_const(ps)->rs_private;
}
static __inline void _init_ps(_RuneLocale *rl, mbstate_t *ps) {
size_t dum;
_ps_to_runestate(ps)->rs_runelocale = rl;
_citrus_ctype_mbrtowc(rl->rl_citrus_ctype, NULL, NULL, 0, _ps_to_private(ps),
&dum);
}
static __inline void _fixup_ps(_RuneLocale *rl, mbstate_t *ps, int forceinit) {
/* for future multi-locale facility */
_DIAGASSERT(rl != NULL);
if (ps != NULL && (_ps_to_runelocale(ps) == NULL || forceinit)) {
_init_ps(rl, ps);
}
}
#endif /*_MULTIBYTE_H_*/
|
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
#ifndef _VT_VNETSTATE_H_
#define _VT_VNETSTATE_H_
#ifndef _NETCONNECTION_H_
#include "sim/netConnection.h"
#endif
#ifndef _TVECTOR_H_
#include "core/util/tVector.h"
#endif
//-----------------------------------------------------------------------------
struct VNetStateInfo
{
SimObjectPtr<NetConnection> Connection;
U32 Mask;
VNetStateInfo( void ) :
Connection( NULL ),
Mask( 0 )
{
// Void.
};
VNetStateInfo( NetConnection *pConnection, U32 pMask )
{
Connection = pConnection;
Mask = pMask;
};
};
//-----------------------------------------------------------------------------
class VNetState : public Vector<VNetStateInfo*>
{
protected:
static U32 gInvalidMask;
U32 mMask;
public:
VNetState( void );
virtual ~VNetState( void );
// Connection Methods.
bool isConnection( NetConnection *pConnection );
void addConnection( NetConnection *pConnection );
void clearConnection( NetConnection *pConnection );
// Property Methods.
VNetStateInfo *getState( NetConnection *pConnection );
void setMaskBits( const U32 &pMask );
void clearMaskBits( const U32 &pMask );
};
#endif // _VT_VNETSTATE_H_ |
/*
The MIT License (MIT)
Copyright (c) 2013 Marcel Pursche
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _ASC_FILE_LOADER_H
#define _ASC_FILE_LOADER_H
#include <string>
namespace osgExample
{
class ASCFileLoader
{
public:
ASCFileLoader();
~ASCFileLoader();
void loadFromFile(const std::string& fileName);
float getNearestHeight(float x, float y) const;
inline unsigned int getWidth() const { return m_width; }
inline unsigned int getHeight() const { return m_height; }
private:
float* m_heightMap;
unsigned int m_width;
unsigned int m_height;
};
}
#endif |
#import <Foundation/Foundation.h>
@interface RenderTreeImageItem : NSObject {
UIImage *image;
CGRect rect;
}
@property (nonatomic, retain) UIImage *image;
@property CGRect rect;
@end
|
//
// IMControlPhotoLibraryCollectionViewCell.h
// iMessageAttachment
//
// Created by Mark Prutskiy on 4/3/17.
// Copyright © 2017 HealthJoy. All rights reserved.
//
#import "IMControlCollectionViewCell.h"
@interface IMControlPhotoLibraryCollectionViewCell : IMControlCollectionViewCell
@end
|
//
// MHSingleton.h
// MHDevLibExample
//
// Created by apple on 16/5/16.
// Copyright © 2016年 Mike_He. All rights reserved.
//
/**
* Mike_He
* 用来快速单例化一个对象
*/
#ifndef MHSingleton_h
#define MHSingleton_h
// .h文件
#define MHSingletonH(name) + (instancetype)shared##name;
// .m文件
#if __has_feature(objc_arc)
#define MHSingletonM(name) \
static id _instace; \
\
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [super allocWithZone:zone]; \
}); \
return _instace; \
} \
\
+ (instancetype)shared##name \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [[self alloc] init]; \
}); \
return _instace; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
return _instace; \
}
#else
#define MHSingletonM(name) \
static id _instace; \
\
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [super allocWithZone:zone]; \
}); \
return _instace; \
} \
\
+ (instancetype)shared##name \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [[self alloc] init]; \
}); \
return _instace; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
return _instace; \
} \
\
- (oneway void)release { } \
- (id)retain { return self; } \
- (NSUInteger)retainCount { return 1;} \
- (id)autorelease { return self;}
#endif
#endif
|
#include <stdio.h>
//#include <stdbool.h>
#define TRUE 1
#define FALSE 0
#define printf_debug //printf
char *solution(const char *str, char target_c, const char *replace_c)
{
if( str == NULL || replace_c == NULL ){
return NULL;
}
printf("%s\n", str);
int rep_len = 0;
for(char *r = replace_c; *r != '\0'; r++){
rep_len++;
}
printf_debug("rep len:%d\n", rep_len);
int space_add = rep_len - 1;
int target_c_num = 0, str_len = 0;
for(char *s = str; *s != '\0'; s++){
if( *s == target_c ){
target_c_num++;
}
str_len++;
}
printf_debug("str len: %d, target char num:%d\n", str_len, target_c_num);
int res_len = str_len + target_c_num*space_add + 1;
char *res = (char*) malloc(sizeof(char)*res_len);
char *res_p = res;
for(int i=0; i<str_len; i++){
if( str[i] == target_c ){
for(char *p = replace_c; *p != '\0'; p++){
*res_p = *p;
res_p++;
}
}
else{
*res_p = str[i];
res_p++;
}
}
*res_p = '\0';
printf("%s\n", res);
}
int main(void)
{
char *str = "We are happy.";
char target_c = ' ';
char *replace_c = "%20";
char *res;
res = solution(str, target_c, replace_c);
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ncurses.h>
int getUsSetpoint(){
float cm;
char key;
int us;
timeout(100);// 0.5sec.
printw("Press Enter for setup setpoint\n\r");
do{
us=readHcsr04();
cm=(float)us/58;
printw("%0.1f cm \r",cm); //do not insert \n, it give problems. Why?
refresh();
key=getch(); //getch from ncurses; getchar is blocking !!, no pressed return 255.
}while(key!=10);
printw("Selected setpoint is %0.1f cm, %d us\n\n\r",(float)us/58,us);
return us;
}
void printBanner(){
printw("\n\n\rTest programs for HC-SR04\n\n\r");
}
int getRange(){
int cmRange;
char str[80];
timeout(-1);
printw("Insert tolerance in cm without decimal part; es.: 10 for 10,0 cm\n\r");
getstr(str);
cmRange=atoi(str);
printw("You have set : %d\n\r",cmRange);
return (cmRange*58);
}
void run(int usSet, int usDelta){
int key;
int usNow,i;
long usTmp;
printw("Ceck distance from setpoint\n\r");
timeout(100);
printw("\n\rPress Enter for exit\n\r");
do{
usTmp=0;
for(i=0;i<10;i++ ){ usTmp+=readHcsr04(); usleep(1000);}
usNow=usTmp/10;
if (usNow>(usSet+usDelta)) printw(" You are too far \r");
else if (usNow<(usSet-usDelta)) printw("You are too close \r");
else printw("You are in range \r");
refresh();
key=getch();
}while(key!=10);
}
void waitExit(){
int key;
timeout(200);
printw("\n\rPress Enter for exit\n\r");
do{
key=getch();
}while(key!=10);
} |
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// This sub-API supports the following functionalities:
// - Specify render destinations for incoming video streams, capture devices
// and files.
// - Configuring render streams.
#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_
#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_
#include "common_types.h"
namespace webrtc {
class VideoEngine;
class VideoRender;
// This class declares an abstract interface to be used for external renderers.
// The user implemented derived class is registered using AddRenderer().
class WEBRTC_DLLEXPORT ExternalRenderer {
public:
// This method will be called when the stream to be rendered changes in
// resolution or number of streams mixed in the image.
virtual int FrameSizeChange(unsigned int width,
unsigned int height,
unsigned int number_of_streams) = 0;
// This method is called when a new frame should be rendered.
virtual int DeliverFrame(unsigned char* buffer,
int buffer_size,
unsigned int time_stamp) = 0;
protected:
virtual ~ExternalRenderer() {}
};
class WEBRTC_DLLEXPORT ViERender {
public:
// Factory for the ViERender sub‐API and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViERender* GetInterface(VideoEngine* video_engine);
// Releases the ViERender sub-API and decreases an internal reference
// counter. Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Registers render module.
virtual int RegisterVideoRenderModule(VideoRender& render_module) = 0;
// Deregisters render module.
virtual int DeRegisterVideoRenderModule(VideoRender& render_module) = 0;
// Sets the render destination for a given render ID.
virtual int AddRenderer(const int render_id,
void* window,
const unsigned int z_order,
const float left,
const float top,
const float right,
const float bottom) = 0;
// Removes the renderer for a stream.
virtual int RemoveRenderer(const int render_id) = 0;
// Starts rendering a render stream.
virtual int StartRender(const int render_id) = 0;
// Stops rendering a render stream.
virtual int StopRender(const int render_id) = 0;
// Configures an already added render stream.
virtual int ConfigureRender(int render_id,
const unsigned int z_order,
const float left,
const float top,
const float right,
const float bottom) = 0;
// This function mirrors the rendered stream left and right or up and down.
virtual int MirrorRenderStream(const int render_id,
const bool enable,
const bool mirror_xaxis,
const bool mirror_yaxis) = 0;
// External render.
virtual int AddRenderer(const int render_id,
RawVideoType video_input_format,
ExternalRenderer* renderer) = 0;
protected:
ViERender() {}
virtual ~ViERender() {}
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_
|
/*
* ircd-ratbox: A slightly useful ircd.
* m_webirc.c: Makes CGI:IRC users appear as coming from their real host
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2006 ircd-ratbox development team
*
* 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
*
* $Id: m_webirc.c 26401 2009-01-15 23:15:55Z androsyn $
*/
/* Usage:
* auth {
* user = "webirc@<cgiirc ip>"; # if identd used, put ident username instead
* password = "<password>"; # encryption possible
* spoof = "webirc."
* class = "users";
* };
* Possible flags:
* encrypted - password is encrypted (recommended)
* kline_exempt - k/g lines on the cgiirc ip are ignored
* gline_exempt - glines on the cgiirc ip are ignored
* dlines are checked on the cgiirc ip (of course).
* k/d/g/x lines, auth blocks, user limits, etc are checked using the
* real host/ip.
* The password should be specified unencrypted in webirc_password in
* cgiirc.config
*/
#include "stdinc.h"
#include "ratbox_lib.h"
#include "struct.h"
#include "client.h" /* client struct */
#include "hostmask.h"
#include "reject.h"
#include "send.h" /* sendto_one */
#include "numeric.h" /* ERR_xxx */
#include "ircd.h" /* me */
#include "parse.h"
#include "match.h"
#include "modules.h"
#include "s_serv.h"
#include "hash.h"
#include "s_conf.h"
static int mr_webirc(struct Client *, struct Client *, int, const char **);
struct Message webirc_msgtab = {
"WEBIRC", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
{{mr_webirc, 5}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
};
mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
DECLARE_MODULE_AV1(webirc, NULL, NULL, webirc_clist, NULL, NULL, "$Revision: 26401 $");
/*
* mr_webirc - webirc message handler
* parv[0] = sender prefix
* parv[1] = password
* parv[2] = fake username (we ignore this)
* parv[3] = fake hostname
* parv[4] = fake ip
*/
static int
mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct ConfItem *aconf;
const char *encr;
if(!strchr(parv[4], '.') && !strchr(parv[4], ':'))
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
}
aconf = find_address_conf(client_p->host, client_p->sockhost,
IsGotId(client_p) ? client_p->username : "webirc",
(struct sockaddr *)&client_p->localClient->ip,
client_p->localClient->ip.ss_family);
if(aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0;
if(!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{
/* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0;
}
if(EmptyString(aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0;
}
if(EmptyString(parv[1]))
encr = "";
else if(IsConfEncrypted(aconf))
encr = crypt(parv[1], aconf->passwd);
else
encr = parv[1];
if(strcmp(encr, aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0;
}
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
if(strlen(parv[3]) <= HOSTLEN)
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
else
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
rb_inet_pton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);
/* Check dlines now, k/glines will be checked on registration */
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip)))
{
if(!(aconf->status & CONF_EXEMPTDLINE))
{
exit_client(client_p, source_p, &me, "D-lined");
return 0;
}
}
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
}
|
#include "command.h"
#include "device.h"
#include "firmware.h"
#include "profile.h"
#include "usb.h"
int hwload_mode = 1;
// Device list
usbdevice keyboard[DEV_MAX];
pthread_mutex_t devlistmutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t devmutex[DEV_MAX] = { [0 ... DEV_MAX-1] = PTHREAD_MUTEX_INITIALIZER };
pthread_mutex_t inputmutex[DEV_MAX] = { [0 ... DEV_MAX-1] = PTHREAD_MUTEX_INITIALIZER };
int _start_dev(usbdevice* kb, int makeactive){
// Get the firmware version from the device
if(kb->pollrate == 0){
if(!hwload_mode || (HAS_FEATURES(kb, FEAT_HWLOAD) && getfwversion(kb))){
if(hwload_mode == 2)
// hwload=always. Report setup failure.
return -1;
else if(hwload_mode){
// hwload=once. Log failure, prevent trying again, and continue.
ckb_warn("Unable to load firmware version/poll rate\n");
kb->features &= ~FEAT_HWLOAD;
}
kb->pollrate = 0;
kb->features &= ~(FEAT_POLLRATE | FEAT_ADJRATE);
if(kb->fwversion == 0)
kb->features &= ~(FEAT_FWVERSION | FEAT_FWUPDATE);
}
}
if(NEEDS_FW_UPDATE(kb)){
// Device needs a firmware update. Finish setting up but don't do anything.
ckb_info("Device needs a firmware update. Please issue a fwupdate command.\n");
kb->features = FEAT_RGB | FEAT_FWVERSION | FEAT_FWUPDATE;
kb->active = 1;
return 0;
}
// Load profile from device
if(!kb->hw && hwload_mode && HAS_FEATURES(kb, FEAT_HWLOAD)){
if(hwloadprofile(kb, 1)){
if(hwload_mode == 2)
return -1;
ckb_warn("Unable to load hardware profile\n");
kb->features &= ~FEAT_HWLOAD;
}
}
// Active software mode if requested
if(makeactive)
return setactive(kb, 1);
return 0;
}
int start_dev(usbdevice* kb, int makeactive){
// Force USB interval to 10ms during initial setup phase; return to nominal 5ms after setup completes.
kb->usbdelay = 10;
int res = _start_dev(kb, makeactive);
kb->usbdelay = USB_DELAY_DEFAULT;
return res;
}
|
/*
* pic18f4510.c - device specific definitions
*/
#include "pic18f4610.c"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.