text
stringlengths 4
6.14k
|
|---|
/*
* Copyright (c) 2004, 2006 Hyperic, 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.
*/
#ifndef SIGAR_PDH_H
#define SIGAR_PDH_H
/* performance data helpers */
#define PdhFirstObject(block) \
((PERF_OBJECT_TYPE *)((BYTE *) block + block->HeaderLength))
#define PdhNextObject(object) \
((PERF_OBJECT_TYPE *)((BYTE *) object + object->TotalByteLength))
#define PdhFirstCounter(object) \
((PERF_COUNTER_DEFINITION *)((BYTE *) object + object->HeaderLength))
#define PdhNextCounter(counter) \
((PERF_COUNTER_DEFINITION *)((BYTE *) counter + counter->ByteLength))
#define PdhGetCounterBlock(inst) \
((PERF_COUNTER_BLOCK *)((BYTE *) inst + inst->ByteLength))
#define PdhFirstInstance(object) \
((PERF_INSTANCE_DEFINITION *)((BYTE *) object + object->DefinitionLength))
#define PdhNextInstance(inst) \
((PERF_INSTANCE_DEFINITION *)((BYTE *)inst + inst->ByteLength + \
PdhGetCounterBlock(inst)->ByteLength))
#define PdhInstanceName(inst) \
((wchar_t *)((BYTE *)inst + inst->NameOffset))
#endif /* SIGAR_PDH_H */
|
/*
* imagen2.h
*
* Created on: Apr 18, 2012
* Author: hkr
*/
#ifndef IMAGEN2_H_
#define IMAGEN2_H_
class Imagen{
private:
int filas;
int columnas;
unsigned char** buffer;
public:
void crear(int,int);
int get_filas() const{ //Devuelve el número de filas de m
return filas;
}
inline int get_columnas() const{ //Devuelve el número de columnas de m
return columnas;
}
void set_buffer(int, int, unsigned char); //Hace img(i,j)=v
unsigned char get_buffer(int, int) const; //Devuelve img(i,j)
void destruir(); //Libera recursos de m
bool leer_imagen(const char[]); //Carga imagen en img
bool escribir_imagen(const char[]); //Salva img en un archivo
};
#endif /* IMAGEN2_H_ */
|
#pragma once
#include "definitions.h"
namespace nicp {
/**
* This method scales a depth image to the size specified.
* @param dest is where the resized depth image will be saved.
* @param src is the source depth image to resize.
* @param step is the resize factor. If step is greater than 1 the image will be smaller
* (for example in case it's 2 the size of the image will be half the size of the original one).
*/
void DepthImage_scale(DepthImage &dest, const DepthImage &src, int step, float maxDepthCov = 0.01f);
/**
* This method scales a depth image to the size specified.
* @param dest is where the resized depth image will be saved.
* @param src is the source depth image to resize.
* @param step is the resize factor. If step is greater than 1 the image will be smaller
* (for example in case it's 2 the size of the image will be half the size of the original one).
*/
void RGBImage_scale(RGBImage &dest, const RGBImage &src, int step);
/**
* This method converts a float cv::Mat to an unsigned char cv::Mat.
* @param dest is where the converted image will be saved.
* @param src is the source image to convert.
* @param scale is a parameter that for example in the case of a depth image lets to convert
* the depth values from a unit measure to another. Here it is assumed by default that the elements have
* to be converted from millimeters to meters and so the scale is 1000.
*/
void DepthImage_convert_32FC1_to_16UC1(cv::Mat &dest, const cv::Mat &src, float scale = 1000.0f);
/**
* This method converts an unsigned char cv::Mat to a float cv::Mat.
* @param dest is where the converted image will be saved.
* @param src is the source image to convert.
* @param scale is a parameter that for example in the case of a depth image lets to convert
* the depth values from a unit measure to another. Here it is assumed by default that the elements have
* to be converted from meters to millimeters and so the scale is 0.001.
*/
void DepthImage_convert_16UC1_to_32FC1(cv::Mat &dest, const cv::Mat &src, float scale = 0.001f);
}
|
#pragma once
#include "vfs_error.h"
#include <utility>
namespace vfs
{
template<typename ValueType>
class Result
{
public:
Result(ValueType value) :
mError(Error::Success),
mValue(std::move(value))
{
}
Result(Error error) :
mError(error)
{
}
Error error() const
{
return mError;
}
explicit operator bool() const
{
return mError == Error::Success;
}
ValueType &operator *()
{
return mValue;
}
const ValueType &operator *() const
{
return mValue;
}
ValueType *operator ->()
{
return &mValue;
}
const ValueType *operator ->() const
{
return &mValue;
}
private:
Error mError;
ValueType mValue;
};
} // namespace vfs
|
/*
* Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*******************************************************************************
* *
* File: fenv_private.h *
* *
* Contains: Defines for manipulating environmental settings directly. *
* *
*******************************************************************************/
#ifndef __FENV_PRIVATE__
#define __FENV_PRIVATE__
/* Pick up the publicly visible enums formerly sited here */
#include "fenv.h"
/* Macros to get or set environment flags doubleword */
#define FEGETENVD(x) ({ __label__ L1, L2; L1: (void)&&L1; \
asm volatile ("mffs %0" : "=f" (x)); \
L2: (void)&&L2; })
#define FESETENVD(x) ({ __label__ L1, L2; L1: (void)&&L1; \
asm volatile("mtfsf 255,%0" : : "f" (x)); \
L2: (void)&&L2; })
/* Macros to get or set environment flags doubleword in their own dispatch group */
#define FEGETENVD_GRP(x) ({ __label__ L1, L2; L1: (void)&&L1; \
asm volatile ("mffs %0" : "=f" (x)); \
L2: (void)&&L2; __NOOP; __NOOP; __NOOP; })
#define FESETENVD_GRP(x) ({ __label__ L1, L2; __NOOP; __NOOP; __NOOP; L1: (void)&&L1; \
asm volatile ("mtfsf 255,%0" : : "f" (x)); \
L2: (void)&&L2;})
/* exception flags */
#define FE_SET_FX 0x80000000 /* floating-point exception summary (FX) bit */
#define FE_CLR_FX 0x7fffffff
#define SET_INVALID 0x01000000
/* the bitwise negation (one's complement) of FE_ALL_EXCEPT */
#define FE_NO_EXCEPT 0xc1ffffff
/* the bitwise OR of all of the separate exception bits in the FPSCR */
#define FE_ALL_FLAGS 0xfff80300
/* the bitwise negation (one's complement) of the previous macro */
#define FE_NO_FLAGS 0x0007fcff
/* the bitwise OR of all of the separate invalid stickies in the FPSCR */
#define FE_ALL_INVALID 0x01f80300
/* the bitwise negation (one's complement) of the previous macro */
#define FE_NO_INVALID 0xfe07fcff
/* an AND mask to disable all floating-point exception enables in the FPSCR */
#define FE_NO_ENABLES 0xffffff07
/* rounding direction mode bits */
#define FE_ALL_RND 0x00000003
#define FE_NO_RND 0xfffffffc
#define EXCEPT_MASK 0x1ff80000
#endif /* __FENV_PRIVATE__ */
|
/*
Copyright (c) 2004-2016 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef PUBSUBEVENT_H__
#define PUBSUBEVENT_H__
#include "stanzaextension.h"
#include "pubsub.h"
#include "gloox.h"
namespace gloox
{
class Tag;
namespace PubSub
{
/**
* @brief This is an implementation of a PubSub Notification as a StanzaExtension.
*
* @author Vincent Thomasset <vthomasset@gmail.com>
* @since 1.0
*/
class GLOOX_API Event : public StanzaExtension
{
public:
/**
* Stores a retract or item notification.
*/
struct ItemOperation
{
/**
* Constructor.
*
* @param remove Whether this is a retract operation or not (ie item).
* @param itemid Item ID of this item.
* @param pld Payload for this object (in the case of a non transient
* item notification).
*/
ItemOperation( bool remove, const std::string& itemid, const Tag* pld = 0 )
: retract( remove ), item( itemid ), payload( pld )
{}
/**
* Copy constructor.
* @param right The ItemOperation to copy from.
*/
ItemOperation( const ItemOperation& right );
bool retract;
std::string item;
const Tag* payload;
};
/**
* A list of ItemOperations.
*/
typedef std::list<ItemOperation*> ItemOperationList;
/**
* PubSub event notification Stanza Extension.
* @param event A tag to parse.
*/
Event( const Tag* event );
/**
* PubSub event notification Stanza Extension.
* @param node The node's ID for which the notification is sent.
* @param type The event's type.
*/
Event( const std::string& node, PubSub::EventType type );
/**
* Virtual destructor.
*/
virtual ~Event();
/**
* Returns the event's type.
* @return The event's type.
*/
PubSub::EventType type() const { return m_type; }
/**
* Returns the list of subscription IDs for which this notification
* is valid.
* @return The list of subscription IDs.
*/
const StringList& subscriptions() const
{ return m_subscriptionIDs ? *m_subscriptionIDs : m_emptyStringList; }
/**
* Returns the list of ItemOperations for EventItems(Retract) notification.
* @return The list of ItemOperations.
*/
const ItemOperationList& items() const
{ return m_itemOperations ? *m_itemOperations : m_emptyOperationList; }
/**
* Add an item to the list of ItemOperations for EventItems(Retract) notification.
* After calling, the PubSub::Event object owns the ItemOperation and will free it.
* @param op An ItemOperation to add.
*/
void addItem( ItemOperation* op );
/**
* Returns the node's ID for which the notification is sent.
* @return The node's ID.
*/
const std::string& node() const { return m_node; }
/**
* Returns the subscribe/unsubscribed JID. Only set for subscription notifications
* (type() == EventSubscription).
* @return The affected JID.
*/
const JID& jid() { return m_jid; }
/**
* Returns the subscription state. Only set for subscription notifications
* (type() == EventSubscription).
* @return @b True if the subscription request was approved, @b false otherwise.
*/
bool subscription() { return m_subscription; }
// reimplemented from StanzaExtension
const std::string& filterString() const;
// reimplemented from StanzaExtension
StanzaExtension* newInstance( const Tag* tag ) const
{
return new Event( tag );
}
// reimplemented from StanzaExtension
Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const;
private:
Event& operator=( const Event& );
PubSub::EventType m_type;
std::string m_node;
StringList* m_subscriptionIDs;
JID m_jid;
Tag* m_config;
ItemOperationList* m_itemOperations;
std::string m_collection;
bool m_subscription;
const ItemOperationList m_emptyOperationList;
const StringList m_emptyStringList;
};
}
}
#endif // PUBSUBEVENT_H__
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "InformationElements"
* found in "../asn/InformationElements.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#include "HS-DSCH-DrxCellfach-info.h"
static asn_TYPE_member_t asn_MBR_HS_DSCH_DrxCellfach_info_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct HS_DSCH_DrxCellfach_info, t_321),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_T_321,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"t-321"
},
{ ATF_NOFLAGS, 0, offsetof(struct HS_DSCH_DrxCellfach_info, hs_dsch_DrxCycleFach),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_HS_DSCH_DrxCycleFach,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"hs-dsch-DrxCycleFach"
},
{ ATF_NOFLAGS, 0, offsetof(struct HS_DSCH_DrxCellfach_info, hs_dsch_DrxBurstFach),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_HS_DSCH_DrxBurstFach,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"hs-dsch-DrxBurstFach"
},
{ ATF_NOFLAGS, 0, offsetof(struct HS_DSCH_DrxCellfach_info, drxInterruption_hs_dsch),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_BOOLEAN,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"drxInterruption-hs-dsch"
},
};
static ber_tlv_tag_t asn_DEF_HS_DSCH_DrxCellfach_info_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_HS_DSCH_DrxCellfach_info_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* t-321 at 8805 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* hs-dsch-DrxCycleFach at 8806 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* hs-dsch-DrxBurstFach at 8807 */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* drxInterruption-hs-dsch at 8808 */
};
static asn_SEQUENCE_specifics_t asn_SPC_HS_DSCH_DrxCellfach_info_specs_1 = {
sizeof(struct HS_DSCH_DrxCellfach_info),
offsetof(struct HS_DSCH_DrxCellfach_info, _asn_ctx),
asn_MAP_HS_DSCH_DrxCellfach_info_tag2el_1,
4, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_HS_DSCH_DrxCellfach_info = {
"HS-DSCH-DrxCellfach-info",
"HS-DSCH-DrxCellfach-info",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
SEQUENCE_decode_uper,
SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_HS_DSCH_DrxCellfach_info_tags_1,
sizeof(asn_DEF_HS_DSCH_DrxCellfach_info_tags_1)
/sizeof(asn_DEF_HS_DSCH_DrxCellfach_info_tags_1[0]), /* 1 */
asn_DEF_HS_DSCH_DrxCellfach_info_tags_1, /* Same as above */
sizeof(asn_DEF_HS_DSCH_DrxCellfach_info_tags_1)
/sizeof(asn_DEF_HS_DSCH_DrxCellfach_info_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
asn_MBR_HS_DSCH_DrxCellfach_info_1,
4, /* Elements count */
&asn_SPC_HS_DSCH_DrxCellfach_info_specs_1 /* Additional specs */
};
|
/*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include <openrct2/common.h>
#include <openrct2/interface/Window.h>
enum
{
UITHEME_FLAG_PREDEFINED = 1 << 0,
UITHEME_FLAG_USE_LIGHTS_RIDE = 1 << 1,
UITHEME_FLAG_USE_LIGHTS_PARK = 1 << 2,
UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT = 1 << 3,
UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR = 1 << 4,
};
void colour_scheme_update(rct_window* window);
void colour_scheme_update_all();
void colour_scheme_update_by_class(rct_window* window, rct_windowclass classification);
void theme_manager_initialise();
void theme_manager_load_available_themes();
size_t theme_manager_get_num_available_themes();
const utf8* theme_manager_get_available_theme_path(size_t index);
const utf8* theme_manager_get_available_theme_config_name(size_t index);
const utf8* theme_manager_get_available_theme_name(size_t index);
size_t theme_manager_get_active_available_theme_index();
void theme_manager_set_active_available_theme(size_t index);
size_t theme_get_index_for_name(const utf8* name);
colour_t theme_get_colour(rct_windowclass wc, uint8_t index);
void theme_set_colour(rct_windowclass wc, uint8_t index, colour_t colour);
uint8_t theme_get_flags();
void theme_set_flags(uint8_t flags);
void theme_save();
void theme_rename(const utf8* name);
void theme_duplicate(const utf8* name);
void theme_delete();
uint8_t theme_desc_get_num_colours(rct_windowclass wc);
rct_string_id theme_desc_get_name(rct_windowclass wc);
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <Arduino.h>
class Servo {
static const int MIN_ANGLE = 0,
MAX_ANGLE = 180,
MIN_PULSE_WIDTH = 544, // Shortest pulse sent to a servo
MAX_PULSE_WIDTH = 2400, // Longest pulse sent to a servo
TAU_MSEC = 20,
TAU_USEC = (TAU_MSEC * 1000),
MAX_COMPARE = ((1 << 16) - 1), // 65535
CHANNEL_MAX_NUM = 16;
public:
Servo();
int8_t attach(const int pin); // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
void detach();
void write(int degrees); // set angle
void move(const int degrees); // attach the servo, then move to value
int read(); // returns current pulse width as an angle between 0 and 180 degrees
private:
static int channel_next_free;
int channel;
int pin;
int degrees;
};
|
/*
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS 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. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
#include <stdio.h>
#include <conio.h>
#include <string.h>
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo program include files. */
#include "fileio.h"
void vDisplayMessage( const char * const pcMessageToPrint )
{
#ifdef USE_STDIO
taskENTER_CRITICAL();
printf( "%s", pcMessageToPrint );
fflush( stdout );
taskEXIT_CRITICAL();
#else
/* Stop warnings. */
( void ) pcMessageToPrint;
#endif
}
/*-----------------------------------------------------------*/
void vWriteMessageToDisk( const char * const pcMessage )
{
#ifdef USE_STDIO
const char * const pcFileName = "c:\\RTOSlog.txt";
const char * const pcSeparator = "\r\n-----------------------\r\n";
FILE *pf;
taskENTER_CRITICAL();
{
pf = fopen( pcFileName, "a" );
if( pf != NULL )
{
fwrite( pcMessage, strlen( pcMessage ), ( unsigned short ) 1, pf );
fwrite( pcSeparator, strlen( pcSeparator ), ( unsigned short ) 1, pf );
fclose( pf );
}
}
taskEXIT_CRITICAL();
#else
/* Stop warnings. */
( void ) pcMessage;
#endif /*USE_STDIO*/
}
/*-----------------------------------------------------------*/
void vWriteBufferToDisk( const char * const pcBuffer, unsigned long ulBufferLength )
{
#ifdef USE_STDIO
const char * const pcFileName = "c:\\trace.bin";
FILE *pf;
taskENTER_CRITICAL();
{
pf = fopen( pcFileName, "wb" );
if( pf )
{
fwrite( pcBuffer, ( size_t ) ulBufferLength, ( unsigned short ) 1, pf );
fclose( pf );
}
}
taskEXIT_CRITICAL();
#else
/* Stop warnings. */
( void ) pcBuffer;
( void ) ulBufferLength;
#endif /*USE_STDIO*/
}
|
#include "extras.h"
#include "emu.h"
#include "mem.h"
#include "defines.h"
/* A few needed locations */
#define CE_kbdScanCode 0xD00587
#define CE_kbdFlags 0xD00080
#define CE_kbdSCR (1 << 3)
#define CE_kbdKey 0xD0058C
#define CE_keyExtend 0xD0058E
#define CE_graphFlags2 0xD0009F
#define CE_keyReady (1 << 5)
bool EMSCRIPTEN_KEEPALIVE sendCSC(uint8_t csc) {
uint8_t flags = mem_peek_byte(CE_kbdFlags);
if (flags & CE_kbdSCR) {
return false;
}
mem_poke_byte(CE_kbdScanCode, csc);
mem_poke_byte(CE_kbdFlags, flags | CE_kbdSCR);
return true;
}
bool EMSCRIPTEN_KEEPALIVE sendKey(uint16_t key) {
uint8_t flags = mem_peek_byte(CE_graphFlags2);
if (flags & CE_keyReady) {
return false;
}
if (key < 0x100) {
key <<= 8;
}
mem_poke_byte(CE_kbdKey, (uint8_t)(key >> 8));
mem_poke_byte(CE_keyExtend, (uint8_t)(key & 0xFF));
mem_poke_byte(CE_graphFlags2, flags | CE_keyReady);
return true;
}
bool EMSCRIPTEN_KEEPALIVE sendLetterKeyPress(char letter) {
uint16_t key;
if (letter >= '0' && letter <= '9') {
key = 0x8E + letter - '0';
} else if (letter >= 'A' && letter <= 'Z') {
key = 0x9A + letter - 'A';
} else if (letter == 'Z' + 1 || letter == '@') { /* [ or @ for theta (caller should replace it) */
key = 0xCC;
} else {
return true;
}
return sendKey(key);
}
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RETROARCH_ACCESSIBILITY_H
#define __RETROARCH_ACCESSIBILITY_H
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
|
/*
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Deviation 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 Deviation. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include "pages.h"
#include "gui/gui.h"
#include "config/model.h"
#include "config/ini.h"
#include <stdlib.h>
#include "../common/_model_loadsave.c"
static u8 list_selected = 0;
static void icon_notify_cb(guiObject_t *obj)
{
int idx = GUI_ScrollableGetObjRowOffset(&gui->scrollable, obj);
if (idx < 0)
return;
int absrow = (idx >> 8) + (idx & 0xff);
list_selected = absrow;
change_icon(absrow);
}
static void ok_cb(guiObject_t *obj, const void *data)
{
(void)obj;
(void)data;
press_cb(NULL, -1, (void *)(long)list_selected);
}
static void press1_cb(guiObject_t *obj, s8 press_type, const void *data)
{
list_selected = (long)data;
if (HAS_TOUCH && OBJ_IS_USED(&gui->image)) {
//differentiate between touch and button
static int is_touch = 0;
if (press_type >= 0) {
u32 buttons = ScanButtons();
is_touch = 0;
if(! CHAN_ButtonIsPressed(buttons, BUT_ENTER)) {
is_touch = 1;
}
return;
}
if (press_type == -1 && is_touch) {
is_touch = -1;
icon_notify_cb(obj);
return;
}
}
press_cb(obj, press_type, data);
}
static int row_cb(int absrow, int relrow, int y, void *data)
{
(void)data;
if (absrow >= mp->total_items) {
GUI_CreateLabelBox(&gui->label[relrow], 8 + ((LCD_WIDTH - 320) / 2), y,
200 - ARROW_WIDTH, 24, &LISTBOX_FONT, NULL, NULL, "");
} else {
GUI_CreateLabelBox(&gui->label[relrow], 8 + ((LCD_WIDTH - 320) / 2), y,
200 - ARROW_WIDTH, 24, &LISTBOX_FONT, name_cb, press1_cb, (void *)(long)absrow);
}
return 0;
}
void PAGE_LoadSaveInit(int page)
{
int num_models;
int selected;
const char * name = NULL;
enum loadSaveType menu_type = page;
memset(mp, 0, sizeof(struct model_page)); // Bug fix: must initialize this
mp->menu_type = page;
mp->modeltype = Model.type;
OBJ_SET_USED(&gui->image, 0);
selected = get_scroll_count(page);
switch(menu_type) {
case LOAD_MODEL: name = _tr_noop("Load Model"); break;
case SAVE_MODEL: name = _tr_noop("Save Model as..."); break;
case LOAD_TEMPLATE: name = _tr_noop("Load Model Template"); break;
case LOAD_ICON: name = _tr_noop("Select Icon"); break;
case LOAD_LAYOUT: name = _tr_noop("Load Layout"); break;
}
//PAGE_ShowHeader(name);
num_models = mp->total_items;
if (num_models < LISTBOX_ITEMS)
num_models = LISTBOX_ITEMS;
if (page != LOAD_TEMPLATE && page != LOAD_LAYOUT) {
PAGE_ShowHeaderWithSize(name, LCD_WIDTH - 88, 0);
u16 w = 0, h = 0;
char *img = mp->iconstr;
if(! fexists(img))
img = UNKNOWN_ICON;
LCD_ImageDimensions(img, &w, &h);
GUI_CreateImage(&gui->image, 212 + ((LCD_WIDTH - 320) / 2), 88, w, h, mp->iconstr);
PAGE_CreateOkButton(LCD_WIDTH - 48, 4, ok_cb);
GUI_SelectionNotify(icon_notify_cb);
}
else
PAGE_ShowHeader(name);
GUI_CreateScrollable(&gui->scrollable, 8 + ((LCD_WIDTH - 320) / 2), 40, 200, LISTBOX_ITEMS * 24,
24, num_models, row_cb, NULL, NULL, NULL);
GUI_SetSelected(GUI_ShowScrollableRowCol(&gui->scrollable, selected, 0));
list_selected = selected;
}
|
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define TARGET_BOARD_IDENTIFIER "ANY7"
#define USBD_PRODUCT_STRING "AnyFCF7"
#define LED0_PIN PB7
#define LED1_PIN PB6
#define BEEPER PB2 // Unused pin, can be mapped to elsewhere
#define BEEPER_INVERTED
#define MPU6000_CS_PIN PA4
#define MPU6000_SPI_INSTANCE SPI1
#define USE_ACC
#define USE_ACC_SPI_MPU6000
#define ACC_MPU6000_ALIGN CW270_DEG
#define USE_GYRO
#define USE_GYRO_SPI_MPU6000
#define GYRO_MPU6000_ALIGN CW270_DEG
// MPU6000 interrupts
#define USE_MPU_DATA_READY_SIGNAL
#define MPU_INT_EXTI PC4
#define USE_EXTI
#define USE_MAG
#define USE_MAG_HMC5883
#define MAG_I2C_INSTANCE (I2CDEV_2)
//#define MAG_HMC5883_ALIGN CW270_DEG_FLIP
//#define MAG_HMC5883_ALIGN CW90_DEG
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_BMP280
#define BARO_I2C_INSTANCE (I2CDEV_2)
#define USABLE_TIMER_CHANNEL_COUNT 16
#define USE_VCP
#define VBUS_SENSING_PIN PA8
#define USE_UART1
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA9
#define USE_UART2
#define UART2_RX_PIN PD6
#define UART2_TX_PIN PD5
#define USE_UART3
#define UART3_RX_PIN PD9
#define UART3_TX_PIN PD8
#define USE_UART4
#define UART4_RX_PIN PC11
#define UART4_TX_PIN PC10
#define USE_UART5
#define UART5_RX_PIN PD2
#define UART5_TX_PIN PC12
#define USE_UART6
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define USE_UART7
#define UART7_RX_PIN PE7
#define UART7_TX_PIN PE8
#define USE_UART8
#define UART8_RX_PIN PE0
#define UART8_TX_PIN PE1
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 11 //VCP, USART1, USART2, USART3, UART4, UART5, USART6, USART7, USART8, SOFTSERIAL x 2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PB14 // (Hardware=0, PPM)
#define USE_SPI
#define USE_SPI_DEVICE_1
#define USE_SPI_DEVICE_3
#define USE_SPI_DEVICE_4
#define SPI1_NSS_PIN PA4
#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PA7
#define SPI3_NSS_PIN PD2
#define SPI3_SCK_PIN PC10
#define SPI3_MISO_PIN PC11
#define SPI3_MOSI_PIN PC12
#define SPI4_NSS_PIN PE11
#define SPI4_SCK_PIN PE12
#define SPI4_MISO_PIN PE13
#define SPI4_MOSI_PIN PE14
#define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI3
#define MAX7456_SPI_CS_PIN SPI3_NSS_PIN
#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) // 10MHz
#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST)
#define USE_SDCARD
#define SDCARD_DETECT_INVERTED
#define SDCARD_DETECT_PIN PD3
#define SDCARD_SPI_INSTANCE SPI4
#define SDCARD_SPI_CS_PIN SPI4_NSS_PIN
#define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 422kHz
// Divide to under 25MHz for normal operation:
#define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 8 // 27MHz
#define SDCARD_DMA_STREAM_TX_FULL DMA2_Stream1
#define SDCARD_DMA_CHANNEL 4
#define USE_I2C
#define USE_I2C_DEVICE_2 // External I2C
#define USE_I2C_DEVICE_4 // Onboard I2C
#define I2C_DEVICE (I2CDEV_2)
#define USE_ADC
#define VBAT_ADC_PIN PC0
#define CURRENT_METER_ADC_PIN PC1
#define RSSI_ADC_GPIO_PIN PC2
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
#define SERIALRX_PROVIDER SERIALRX_SBUS
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD 0xffff
#define TARGET_IO_PORTE 0xffff
#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(12) | TIM_N(8) | TIM_N(9) | TIM_N(10) | TIM_N(11))
|
/*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
- 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.
*====================================================================*/
/*
* fmorphauto_reg.c
*
* Basic regression test for erosion & dilation: rasterops & dwa.
*
* Tests erosion and dilation from 58 structuring elements
* by comparing the full image rasterop results with the
* automatically generated dwa results.
*
* Results must be identical for all operations.
*/
#ifdef HAVE_CONFIG_H
#include <config_auto.h>
#endif /* HAVE_CONFIG_H */
#include "allheaders.h"
/* defined in morph.c */
LEPT_DLL extern l_int32 MORPH_BC;
int main(int argc,
char **argv)
{
l_int32 i, nsels, same, xorcount;
char *filein, *selname;
PIX *pixs, *pixs1, *pixt1, *pixt2, *pixt3, *pixt4;
SEL *sel;
SELA *sela;
static char mainName[] = "fmorphauto_reg";
if (argc != 2)
return ERROR_INT(" Syntax: fmorphauto_reg filein", mainName, 1);
filein = argv[1];
setLeptDebugOK(1);
if ((pixs = pixRead(filein)) == NULL)
return ERROR_INT("pix not made", mainName, 1);
sela = selaAddBasic(NULL);
nsels = selaGetCount(sela);
for (i = 0; i < nsels; i++)
{
sel = selaGetSel(sela, i);
selname = selGetName(sel);
/* --------- dilation ----------*/
pixt1 = pixDilate(NULL, pixs, sel);
pixs1 = pixAddBorder(pixs, 32, 0);
pixt2 = pixFMorphopGen_1(NULL, pixs1, L_MORPH_DILATE, selname);
pixt3 = pixRemoveBorder(pixt2, 32);
pixt4 = pixXor(NULL, pixt1, pixt3);
pixZero(pixt4, &same);
if (same == 1) {
lept_stderr("dilations are identical for sel %d (%s)\n",
i, selname);
} else {
lept_stderr("dilations differ for sel %d (%s)\n", i, selname);
pixCountPixels(pixt4, &xorcount, NULL);
lept_stderr("Number of pixels in XOR: %d\n", xorcount);
}
pixDestroy(&pixt1);
pixDestroy(&pixt2);
pixDestroy(&pixt3);
pixDestroy(&pixt4);
pixDestroy(&pixs1);
/* --------- erosion with asymmetric b.c ----------*/
resetMorphBoundaryCondition(ASYMMETRIC_MORPH_BC);
lept_stderr("MORPH_BC = %d ... ", MORPH_BC);
pixt1 = pixErode(NULL, pixs, sel);
if (MORPH_BC == ASYMMETRIC_MORPH_BC)
pixs1 = pixAddBorder(pixs, 32, 0); /* OFF border pixels */
else
pixs1 = pixAddBorder(pixs, 32, 1); /* ON border pixels */
pixt2 = pixFMorphopGen_1(NULL, pixs1, L_MORPH_ERODE, selname);
pixt3 = pixRemoveBorder(pixt2, 32);
pixt4 = pixXor(NULL, pixt1, pixt3);
pixZero(pixt4, &same);
if (same == 1) {
lept_stderr("erosions are identical for sel %d (%s)\n", i, selname);
} else {
lept_stderr("erosions differ for sel %d (%s)\n", i, selname);
pixCountPixels(pixt4, &xorcount, NULL);
lept_stderr("Number of pixels in XOR: %d\n", xorcount);
}
pixDestroy(&pixt1);
pixDestroy(&pixt2);
pixDestroy(&pixt3);
pixDestroy(&pixt4);
pixDestroy(&pixs1);
/* --------- erosion with symmetric b.c ----------*/
resetMorphBoundaryCondition(SYMMETRIC_MORPH_BC);
lept_stderr("MORPH_BC = %d ... ", MORPH_BC);
pixt1 = pixErode(NULL, pixs, sel);
if (MORPH_BC == ASYMMETRIC_MORPH_BC)
pixs1 = pixAddBorder(pixs, 32, 0); /* OFF border pixels */
else
pixs1 = pixAddBorder(pixs, 32, 1); /* ON border pixels */
pixt2 = pixFMorphopGen_1(NULL, pixs1, L_MORPH_ERODE, selname);
pixt3 = pixRemoveBorder(pixt2, 32);
pixt4 = pixXor(NULL, pixt1, pixt3);
pixZero(pixt4, &same);
if (same == 1) {
lept_stderr("erosions are identical for sel %d (%s)\n", i, selname);
} else {
lept_stderr("erosions differ for sel %d (%s)\n", i, selname);
pixCountPixels(pixt4, &xorcount, NULL);
lept_stderr("Number of pixels in XOR: %d\n", xorcount);
}
pixDestroy(&pixt1);
pixDestroy(&pixt2);
pixDestroy(&pixt3);
pixDestroy(&pixt4);
pixDestroy(&pixs1);
}
return 0;
}
|
/*
Copyright <SWGEmu>
See file COPYING for copying conditions.*/
#ifndef FORAGINGEVENT_H_
#define FORAGINGEVENT_H_
#include "server/zone/objects/creature/CreatureObject.h"
#include "server/zone/Zone.h"
#include "server/zone/managers/minigames/ForageManager.h"
namespace server {
namespace zone {
namespace managers {
namespace minigames {
namespace events {
class ForagingEvent : public Task {
ManagedReference<CreatureObject*> player;
int forageType;
float forageX;
float forageY;
String zoneName;
public:
ForagingEvent(CreatureObject* player, int type, float playerX, float playerY, const String& planet) : Task() {
this->player = player;
this->forageType = type;
this->forageX = playerX;
this->forageY = playerY;
this->zoneName = planet;
}
void run() {
ManagedReference<ForageManager*> forageManager = player->getZoneProcessServer()->getForageManager();
if (forageManager != NULL)
forageManager->finishForaging(player, forageType, forageX, forageY, zoneName);
}
};
}
}
}
}
}
using namespace server::zone::managers::minigames::events;
#endif /*FORAGINGEVENT_H_*/
|
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
/* This routine takes a pointer to a sgmnt_data struct with space for the BTs and
locks attached. The BTs and the lock space are initialized and then written
to disk to the file specified by channel.
*/
#include "mdef.h"
#include <rms.h>
#include "gdsroot.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsblk.h"
#include "gdsfhead.h"
#include <ssdef.h>
#include <iodef.h>
#include <efndef.h>
#include "mlk_shr_init.h"
#include "dbcx_ref.h"
int dbcx_ref(sgmnt_data *sd, int chan)
{
char *qio_ptr, *qio_top;
short iosb[4];
int block, status;
sgmnt_addrs sa;
sa.hdr = sd;
bt_malloc(&sa);
mlk_shr_init((char *)sd + (LOCK_BLOCK(sd) * DISK_BLOCK_SIZE), sd->lock_space_size, &sa, TRUE);
qio_ptr = (char *)sd;
qio_top = qio_ptr + (LOCK_BLOCK(sd) * DISK_BLOCK_SIZE) + LOCK_SPACE_SIZE(sd);
for ( block = 1; qio_ptr < qio_top; block++, qio_ptr += DISK_BLOCK_SIZE)
{
if (SS$_NORMAL != (status = sys$qiow(EFN$C_ENF, chan, IO$_WRITEVBLK, iosb,
0, 0, qio_ptr, DISK_BLOCK_SIZE, block, 0, 0, 0)))
return status;
if (!(iosb[0] & 1))
return iosb[0];
}
return SS$_NORMAL;
}
|
/* **********************************************************
* Copyright (c) 2012 Google, Inc. All rights reserved.
* Copyright (c) 2007-2009 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * 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 VMware, Inc. 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 VMWARE, INC. 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 _NUDGE_H_
#define _NUDGE_H_
#include "dr_config.h"
/* Tiggers a nudge targeting this process. nudge_action_mask should be drawn from the
* NUDGE_GENERIC(***) values. client_id is only relevant for client nudges. */
dr_config_status_t
nudge_internal(process_id_t pid, uint nudge_action_mask, uint64 client_arg,
client_id_t client_id, uint timeout_ms);
#ifdef WINDOWS /* only Windows uses threads for nudges */
/* The following are exported only so other routines can check their addresses for
* nudge threads. They are not meant to be called internally. */
void
generic_nudge_target(nudge_arg_t *arg);
bool
generic_nudge_handler(nudge_arg_t *arg);
/* exit_process is only honored if dcontext != NULL, and exit_code is only honored
* if exit_process is true
*/
bool
nudge_thread_cleanup(dcontext_t *dcontext, bool exit_process, uint exit_code);
#else
/* This routine may not return */
void
handle_nudge(dcontext_t *dcontext, nudge_arg_t *arg);
/* Only touches thread-private data and acquires no lock */
void
nudge_add_pending(dcontext_t *dcontext, nudge_arg_t *nudge_arg);
#endif
#endif /* _NUDGE_H_ */
|
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_scale_f16.c
* Description: Multiplies a floating-point vector by a scalar
*
* $Date: 23 April 2021
* $Revision: V1.9.0
*
* Target Processor: Cortex-M and Cortex-A cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dsp/basic_math_functions_f16.h"
/**
@ingroup groupMath
*/
/**
@defgroup BasicScale Vector Scale
Multiply a vector by a scalar value. For floating-point data, the algorithm used is:
<pre>
pDst[n] = pSrc[n] * scale, 0 <= n < blockSize.
</pre>
In the fixed-point Q7, Q15, and Q31 functions, <code>scale</code> is represented by
a fractional multiplication <code>scaleFract</code> and an arithmetic shift <code>shift</code>.
The shift allows the gain of the scaling operation to exceed 1.0.
The algorithm used with fixed-point data is:
<pre>
pDst[n] = (pSrc[n] * scaleFract) << shift, 0 <= n < blockSize.
</pre>
The overall scale factor applied to the fixed-point data is
<pre>
scale = scaleFract * 2^shift.
</pre>
The functions support in-place computation allowing the source and destination
pointers to reference the same memory buffer.
*/
/**
@addtogroup BasicScale
@{
*/
/**
@brief Multiplies a floating-point vector by a scalar.
@param[in] pSrc points to the input vector
@param[in] scale scale factor to be applied
@param[out] pDst points to the output vector
@param[in] blockSize number of samples in each vector
@return none
*/
#if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE)
#include "arm_helium_utils.h"
void arm_scale_f16(
const float16_t * pSrc,
float16_t scale,
float16_t * pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* Loop counter */
f16x8_t vec1;
f16x8_t res;
/* Compute 4 outputs at a time */
blkCnt = blockSize >> 3U;
while (blkCnt > 0U)
{
/* C = A + offset */
/* Add offset and then store the results in the destination buffer. */
vec1 = vld1q(pSrc);
res = vmulq(vec1,scale);
vst1q(pDst, res);
/* Increment pointers */
pSrc += 8;
pDst += 8;
/* Decrement the loop counter */
blkCnt--;
}
/* Tail */
blkCnt = blockSize & 0x7;
if (blkCnt > 0U)
{
mve_pred16_t p0 = vctp16q(blkCnt);
vec1 = vld1q((float16_t const *) pSrc);
vstrhq_p(pDst, vmulq(vec1, scale), p0);
}
}
#else
#if defined(ARM_FLOAT16_SUPPORTED)
void arm_scale_f16(
const float16_t *pSrc,
float16_t scale,
float16_t *pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* Loop counter */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = blockSize >> 2U;
while (blkCnt > 0U)
{
/* C = A * scale */
/* Scale input and store result in destination buffer. */
*pDst++ = (*pSrc++) * scale;
*pDst++ = (*pSrc++) * scale;
*pDst++ = (*pSrc++) * scale;
*pDst++ = (*pSrc++) * scale;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = blockSize % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C = A * scale */
/* Scale input and store result in destination buffer. */
*pDst++ = (*pSrc++) * scale;
/* Decrement loop counter */
blkCnt--;
}
}
#endif
#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */
/**
@} end of BasicScale group
*/
|
/*
* gnome-keyring
*
* Copyright (C) 2008 Stefan Walter
*
* 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; either version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EGG_PADDING_H_
#define EGG_PADDING_H_
#include <glib.h>
#ifndef HAVE_EGG_ALLOCATOR
typedef void* (*EggAllocator) (void* p, gsize);
#define HAVE_EGG_ALLOCATOR
#endif
typedef gboolean (*EggPadding) (EggAllocator alloc,
gsize n_block,
gconstpointer input,
gsize n_input,
gpointer *output,
gsize *n_output);
gboolean egg_padding_zero_pad (EggAllocator alloc,
gsize n_block,
gconstpointer raw,
gsize n_raw,
gpointer *padded,
gsize *n_padded);
gboolean egg_padding_pkcs1_pad_01 (EggAllocator alloc,
gsize n_block,
gconstpointer raw,
gsize n_raw,
gpointer *padded,
gsize *n_padded);
gboolean egg_padding_pkcs1_pad_02 (EggAllocator alloc,
gsize n_block,
gconstpointer raw,
gsize n_raw,
gpointer *padded,
gsize *n_padded);
gboolean egg_padding_pkcs1_unpad_01 (EggAllocator alloc,
gsize n_block,
gconstpointer padded,
gsize n_padded,
gpointer *raw,
gsize *n_raw);
gboolean egg_padding_pkcs1_unpad_02 (EggAllocator alloc,
gsize n_block,
gconstpointer padded,
gsize n_padded,
gpointer *raw,
gsize *n_raw);
gboolean egg_padding_pkcs7_pad (EggAllocator alloc,
gsize n_block,
gconstpointer raw,
gsize n_raw,
gpointer *padded,
gsize *n_padded);
gboolean egg_padding_pkcs7_unpad (EggAllocator alloc,
gsize n_block,
gconstpointer raw,
gsize n_raw,
gpointer *padded,
gsize *n_padded);
#endif /* EGG_PADDING_H_ */
|
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "MITMappedObject.h"
#import "MITManagedObject.h"
#import "CoreLocation+MITAdditions.h"
@class MITToursDirectionsToStop, MITToursImage, MITToursTour;
@interface MITToursStop : MITManagedObject <MITMappedObject>
@property (nonatomic, retain) NSString * bodyHTML;
@property (nonatomic, retain) id coordinates;
@property (nonatomic, retain) NSString * identifier;
@property (nonatomic, retain) NSString * stopType;
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) MITToursDirectionsToStop *directionsToNextStop;
@property (nonatomic, retain) NSOrderedSet *images;
@property (nonatomic, retain) MITToursTour *tour;
@property (nonatomic, readonly) CLLocation *locationForStop;
@property (nonatomic, readonly) BOOL isMainLoopStop;
- (NSString *)thumbnailURL;
- (NSString *)fullImageURL;
@end
@interface MITToursStop (CoreDataGeneratedAccessors)
- (void)insertObject:(MITToursImage *)value inImagesAtIndex:(NSUInteger)idx;
- (void)removeObjectFromImagesAtIndex:(NSUInteger)idx;
- (void)insertImages:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
- (void)removeImagesAtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectInImagesAtIndex:(NSUInteger)idx withObject:(MITToursImage *)value;
- (void)replaceImagesAtIndexes:(NSIndexSet *)indexes withImages:(NSArray *)values;
- (void)addImagesObject:(MITToursImage *)value;
- (void)removeImagesObject:(MITToursImage *)value;
- (void)addImages:(NSOrderedSet *)values;
- (void)removeImages:(NSOrderedSet *)values;
@end
|
/* Generated from ../../../git/cloog/test/forwardsub-3-1-2.cloog by CLooG 0.14.0-136-gb91ef26 gmp bits in 0.02s. */
S3(2,1) ;
S1(3,1) ;
S1(4,1) ;
S4(4,2) ;
for (i=5;i<=M+1;i++) {
S1(i,1) ;
for (j=2;j<=floord(i-1,2);j++) {
S2(i,j) ;
}
if (i%2 == 0) {
S4(i,i/2) ;
}
}
for (i=M+2;i<=2*M-1;i++) {
for (j=i-M;j<=floord(i-1,2);j++) {
S2(i,j) ;
}
if (i%2 == 0) {
S4(i,i/2) ;
}
}
S4(2*M,M) ;
|
/*
* Copyright (C) 2014-2015 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @defgroup boards_iotlab-m3 IoT-LAB M3 open node
* @ingroup boards
* @brief Support for the iotlab-m3 board
* @{
*
* @file
* @brief Board specific definitions for the iotlab-m3 board
*
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Define the interface for the L3G4200D gyroscope
* @{
*/
#define L3G4200D_I2C I2C_0
#define L3G4200D_ADDR 0x68
#define L3G4200D_DRDY GPIO_PIN(PORT_C,9)
#define L3G4200D_INT GPIO_PIN(PORT_C,6)
/** @} */
/**
* @name Define the interface to the LSM303DLHC accelerometer and magnetometer
* @{
*/
#define LSM303DLHC_I2C I2C_0
#define LSM303DLHC_ACC_ADDR (0x19)
#define LSM303DLHC_MAG_ADDR (0x1e)
#define LSM303DLHC_INT1 GPIO_PIN(PORT_B,12)
#define LSM303DLHC_INT2 GPIO_PIN(PORT_B,2)
#define LSM303DLHC_DRDY GPIO_PIN(PORT_A,11)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */
|
/* mpfr_signbit -- Signbit of a MPFR number
Copyright 2007-2016 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "mpfr-impl.h"
#undef mpfr_signbit
int
mpfr_signbit (mpfr_srcptr x)
{
return MPFR_SIGN (x) < 0;
}
|
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3D_QGEOMETRYCOLLIDER_P_H
#define QT3D_QGEOMETRYCOLLIDER_P_H
#include <Qt3DCollision/private/qabstractcollider_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3D {
class QGeometryCollider;
class QGeometryColliderPrivate : public QAbstractColliderPrivate
{
QGeometryColliderPrivate();
Q_DECLARE_PUBLIC(QGeometryCollider)
};
} // namespace Qt3D
QT_END_NAMESPACE
#endif // QT3D_QGEOMETRYCOLLIDER_P_H
|
/** \file
\brief Definition of basic types used by muParserX
<pre>
__________ ____ ___
_____ __ _\______ \_____ _______ ______ __________\ \/ /
/ \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ /
| Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \
|__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \
\/ \/ \/ \/ \_/
muParserX - A C++ math parser library with array and string support
Copyright 2010 Ingo Berg
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, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see http://www.gnu.org/licenses.
</pre>
*/
#ifndef MUP_SCRIPT_TOKENS_H
#define MUP_SCRIPT_TOKENS_H
#include "mpIToken.h"
MUP_NAMESPACE_START
//---------------------------------------------------------------------------
/** \brief A class for encapsulation a newline token. */
class TokenNewline : public IToken
{
public:
TokenNewline();
//---------------------------------------------
// IToken interface
//---------------------------------------------
virtual IToken* Clone() const;
virtual string_type AsciiDump() const;
int GetStackOffset() const;
void SetStackOffset(int nOffset);
private:
int m_nOffset;
};
MUP_NAMESPACE_END
#endif
|
/*
_____ __ ___ __ ____ _ __
/ ___/__ ___ _ ___ / |/ /__ ___ / /_____ __ __/ __/_______(_)__ / /_
/ (_ / _ `/ ' \/ -_) /|_/ / _ \/ _ \/ '_/ -_) // /\ \/ __/ __/ / _ \/ __/
\___/\_,_/_/_/_/\__/_/ /_/\___/_//_/_/\_\\__/\_, /___/\__/_/ /_/ .__/\__/
/___/ /_/
See Copyright Notice in gmMachine.h
*/
#ifndef _GMBYTECODE_H_
#define _GMBYTECODE_H_
#include "gmConfig.h"
/// \enum gmByteCode
/// \brief gmByteCode are the op codes for the game monkey scripting. The first byte codes MUST match the gmOperator
/// enum.
enum gmByteCode
{
// BC_GETDOT to BC_NOP MUST MATCH ENUM GMOPERATOR
BC_GETDOT = 0, // tos '.' opptr, push result
BC_SETDOT, // tos-1 '.' opptr = tos, tos -= 2
BC_GETIND, // tos-1 = tos-1 [tos], --tos
BC_SETIND, // tos-2 [tos-1] = tos, tos -= 3
// math
BC_OP_ADD,
BC_OP_SUB,
BC_OP_MUL,
BC_OP_DIV,
BC_OP_REM,
#if GM_USE_INCDECOPERATORS
BC_OP_INC,
BC_OP_DEC,
#endif //GM_USE_INCDECOPERATORS
// bit
BC_BIT_OR,
BC_BIT_XOR,
BC_BIT_AND,
BC_BIT_SHL,
BC_BIT_SHR,
BC_BIT_INV,
// compare
BC_OP_LT,
BC_OP_GT,
BC_OP_LTE,
BC_OP_GTE,
BC_OP_EQ,
BC_OP_NEQ,
// unary
BC_OP_NEG,
BC_OP_POS,
BC_OP_NOT,
BC_NOP,
BC_LINE, // indicates instruction is on a new code line to the last executed instruction. used in debug mode
// branch
BC_BRA, // branch always
BC_BRZ, // branch tos equal to zero, --tos
BC_BRNZ, // branch tos not equal to zero, --tos
BC_BRZK, // branch tos equal to zero keep value on stack
BC_BRNZK, // branch tos not equal to zero keep value on stack
BC_CALL, // call op16 num parameters
BC_RET, // return null, ++tos
BC_RETV, // return tos
BC_FOREACH, // op16 op16, table, iterator, leave loop complete bool on stack.
// stack
BC_POP, // --tos
BC_POP2, // tos -=2
BC_DUP, // tos + 1 = tos, ++tos
BC_DUP2, // tos + 1 = tos -1, tos + 2 = tos, tos += 2
BC_SWAP, //
BC_PUSHNULL, // push null,
BC_PUSHINT, // push int opptr
BC_PUSHINT0, // push 0
BC_PUSHINT1, // push 1
BC_PUSHFP, // push floating point op32
BC_PUSHSTR, // push string opptr
BC_PUSHTBL, // push table
BC_PUSHFN, // push function opptr
BC_PUSHTHIS, // push this
// get set
BC_GETLOCAL, // get local op16 (stack offset) ++tos
BC_SETLOCAL, // set local op16 (stack offset) --tos
BC_GETGLOBAL, // get global opptr (symbol id) ++tos
BC_SETGLOBAL, // set global opptr (symbol id) --tos
BC_GETTHIS, // get this opptr (symbol id) ++tos
BC_SETTHIS, // set this opptr (symbol id) --tos
#if GM_USE_FORK
BC_FORK, // Fork
#endif //GM_USE_FORK
};
#if GM_COMPILE_DEBUG
void gmByteCodePrint(FILE * a_fp, const void * a_byteCode, int a_byteCodeLength);
#endif // GM_COMPILE_DEBUG
#endif
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__B8C4E1DD_5404_4CDD_B748_AFC934CC44BC__INCLUDED_)
#define AFX_STDAFX_H__B8C4E1DD_5404_4CDD_B748_AFC934CC44BC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__B8C4E1DD_5404_4CDD_B748_AFC934CC44BC__INCLUDED_)
|
#ifndef BWA_H_
#define BWA_H_
#include <stdint.h>
#include "bntseq.h"
#include "bwt.h"
#define BWA_IDX_BWT 0x1
#define BWA_IDX_BNS 0x2
#define BWA_IDX_PAC 0x4
#define BWA_IDX_ALL 0x7
typedef struct {
bwt_t *bwt; // FM-index
bntseq_t *bns; // information on the reference sequences
uint8_t *pac; // the actual 2-bit encoded reference sequences with 'N' converted to a random base
} bwaidx_t;
typedef struct {
int l_seq;
char *name, *comment, *seq, *qual, *sam;
} bseq1_t;
extern int bwa_verbose;
extern char bwa_rg_id[256];
#ifdef __cplusplus
extern "C" {
#endif
bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_);
void bwa_fill_scmat(int a, int b, int8_t mat[25]);
uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM);
uint32_t *bwa_gen_cigar2(const int8_t mat[25], int o_del, int e_del, int o_ins, int e_ins, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM);
int bwa_fix_xref(const int8_t mat[25], int q, int r, int w, const bntseq_t *bns, const uint8_t *pac, uint8_t *query, int *qb, int *qe, int64_t *rb, int64_t *re);
int bwa_fix_xref2(const int8_t mat[25], int o_del, int e_del, int o_ins, int e_ins, int w, const bntseq_t *bns, const uint8_t *pac, uint8_t *query, int *qb, int *qe, int64_t *rb, int64_t *re);
char *bwa_idx_infer_prefix(const char *hint);
bwt_t *bwa_idx_load_bwt(const char *hint);
bwaidx_t *bwa_idx_load(const char *hint, int which);
void bwa_idx_destroy(bwaidx_t *idx);
void bwa_print_sam_hdr(const bntseq_t *bns, const char *rg_line);
char *bwa_set_rg(const char *s);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
/*!
@category NSURLConnection (Apigee)
@discussion This category provides methods that capture network performance
metrics on built-in NSURLConnection methods that perform network calls.
*/
typedef void (^NSURLConnectionAsyncRequestCompletionHandler)(NSURLResponse* response, NSData* data, NSError* connectionError);
@interface NSURLConnection (Apigee)
/*!
@abstract Creates and returns an initialized URL connection and begins to load
the data for the URL request.
@param request The URL request to load.
@param delegate The delegate object for the connection.
@return The URL connection for the URL request. Returns nil if a connection
can't be created.
@discussion This method simply calls the NSURLConnection class method
connectionWithRequest:delegate: while capturing the network performance
metrics for that call.
*/
+ (NSURLConnection*) timedConnectionWithRequest:(NSURLRequest *) request
delegate:(id < NSURLConnectionDelegate >) delegate;
/*!
@abstract Performs a synchronous load of the specified URL request.
@param request The URL request to load.
@param response Out parameter for the URL response returned by the server.
@param error Out parameter used if an error occurs while processing the
request. May be NULL.
@return The downloaded data for the URL request. Returns nil if a connection
could not be created or if the download fails.
@discussion This method simply calls the NSURLConnection class method
sendSynchronousRequest:returningResponse:error: while capturing the network
performance metrics for that call.
*/
+ (NSData *) timedSendSynchronousRequest:(NSURLRequest *) request
returningResponse:(NSURLResponse **)response
error:(NSError **)error;
/*!
@abstract Loads the data for a URL request and executes a handler block on an
operation queue when the request completes or fails.
@param request The URL request to load.
@param queue The operation queue to which the handler block is dispatched when
the request completes or failed.
@param handler The handler block to execute.
@discussion This method simply calls the NSURLConnection class method
sendAsynchronousRequest:queue:completionHandler: while capturing the network
performance metrics for that call.
*/
+ (void) timedSendAsynchronousRequest:(NSURLRequest *)request
queue:(NSOperationQueue *)queue
completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler;
/*!
@abstract Returns an initialized URL connection and begins to load the data
for the URL request.
@param request The URL request to load.
@param delegate The delegate object for the connection.
@return The URL connection for the URL request. Returns nil if a connection
can't be initialized.
@discussion This method simply calls the NSURLConnection instance method
initWithRequest:delegate: while capturing the network performance metrics
for that call.
*/
- (id) initTimedConnectionWithRequest:(NSURLRequest *)request
delegate:(id < NSURLConnectionDelegate >)delegate;
/*!
@abstract Returns an initialized URL connection and begins to load the data
for the URL request, if specified.
@param request The URL request to load.
@param delegate The delegate object for the connection.
@param startImmediately YES if the connection should being loading data
immediately, otherwise NO.
@return The URL connection for the URL request. Returns nil if a connection
can't be initialized.
@discussion This method simply calls the NSURLConnection instance method
initWithRequest:delegate:startImmediately: while capturing the network
performance metrics for that call.
*/
- (id) initTimedConnectionWithRequest:(NSURLRequest *)request
delegate:(id < NSURLConnectionDelegate >) delegate
startImmediately:(BOOL) startImmediately;
// ****** swizzling *******
+ (BOOL)apigeeSwizzlingSetup;
@end
|
/*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WORKLOAD_STENCIL_APPLICATION_H_
#define WORKLOAD_STENCIL_APPLICATION_H_
#include <json/json.h>
#include <prim/prim.h>
#include <string>
#include <vector>
#include "event/Component.h"
#include "workload/Application.h"
#include "workload/Workload.h"
class MetadataHandler;
namespace Stencil {
class Application : public ::Application {
public:
Application(const std::string& _name, const Component* _parent, u32 _id,
Workload* _workload, MetadataHandler* _metadataHandler,
Json::Value _settings);
~Application();
f64 percentComplete() const override;
void start() override;
void stop() override;
void kill() override;
void terminalComplete(u32 _id);
void processEvent(void* _event, s32 _type) override;
private:
u32 completedTerminals_;
u32 doneTerminals_;
std::vector<u32> termToProc_;
std::vector<u32> procToTerm_;
};
} // namespace Stencil
#endif // WORKLOAD_STENCIL_APPLICATION_H_
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/machinelearning/MachineLearning_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/machinelearning/model/BatchPrediction.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace MachineLearning
{
namespace Model
{
/**
* <p>Represents the output of a <code>DescribeBatchPredictions</code> operation.
* The content is essentially a list of
* <code>BatchPrediction</code>s.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/machinelearning-2014-12-12/DescribeBatchPredictionsOutput">AWS
* API Reference</a></p>
*/
class AWS_MACHINELEARNING_API DescribeBatchPredictionsResult
{
public:
DescribeBatchPredictionsResult();
DescribeBatchPredictionsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DescribeBatchPredictionsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline const Aws::Vector<BatchPrediction>& GetResults() const{ return m_results; }
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline void SetResults(const Aws::Vector<BatchPrediction>& value) { m_results = value; }
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline void SetResults(Aws::Vector<BatchPrediction>&& value) { m_results = std::move(value); }
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline DescribeBatchPredictionsResult& WithResults(const Aws::Vector<BatchPrediction>& value) { SetResults(value); return *this;}
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline DescribeBatchPredictionsResult& WithResults(Aws::Vector<BatchPrediction>&& value) { SetResults(std::move(value)); return *this;}
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline DescribeBatchPredictionsResult& AddResults(const BatchPrediction& value) { m_results.push_back(value); return *this; }
/**
* <p>A list of <code>BatchPrediction</code> objects that meet the search criteria.
* </p>
*/
inline DescribeBatchPredictionsResult& AddResults(BatchPrediction&& value) { m_results.push_back(std::move(value)); return *this; }
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline void SetNextToken(const char* value) { m_nextToken.assign(value); }
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline DescribeBatchPredictionsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline DescribeBatchPredictionsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>The ID of the next page in the paginated results that indicates at least one
* more page follows.</p>
*/
inline DescribeBatchPredictionsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
Aws::Vector<BatchPrediction> m_results;
Aws::String m_nextToken;
};
} // namespace Model
} // namespace MachineLearning
} // namespace Aws
|
/*------------------------------------------------------------------------------
*
* cdbappendonlyblockdirectory.h
*
* Copyright (c) 2009, Greenplum Inc.
*
*------------------------------------------------------------------------------
*/
#ifndef CDBAPPENDONLYBLOCKDIRECTORY_H
#define CDBAPPENDONLYBLOCKDIRECTORY_H
#include "access/aosegfiles.h"
#include "access/aocssegfiles.h"
#include "access/appendonlytid.h"
#include "access/skey.h"
extern int gp_blockdirectory_entry_min_range;
extern int gp_blockdirectory_minipage_size;
typedef struct AppendOnlyBlockDirectoryEntry
{
/*
* The range of blocks covered by the Block Directory entry.
*/
struct range
{
int64 fileOffset;
int64 firstRowNum;
int64 afterFileOffset;
int64 lastRowNum;
} range;
} AppendOnlyBlockDirectoryEntry;
/*
* The entry in the minipage.
*/
typedef struct MinipageEntry
{
int64 firstRowNum;
int64 fileOffset;
int64 rowCount;
} MinipageEntry;
/*
* Define a varlena type for a minipage.
*/
typedef struct Minipage
{
/* Total length. Must be the first. */
int32 _len;
int32 version;
uint32 nEntry;
/* Varlena array */
MinipageEntry entry[1];
} Minipage;
/*
* Define the relevant info for a minipage for each
* column group.
*/
typedef struct MinipagePerColumnGroup
{
Minipage *minipage;
uint32 numMinipageEntries;
ItemPointerData tupleTid;
} MinipagePerColumnGroup;
/*
* I don't know the ideal value here. But let us put approximate
* 8 minipages per heap page.
*/
#define NUM_MINIPAGE_ENTRIES (((MaxHeapTupleSize)/8 - sizeof(HeapTupleHeaderData) - 64 * 3)\
/ sizeof(MinipageEntry))
/*
* Define a structure for the append-only relation block directory.
*/
typedef struct AppendOnlyBlockDirectory
{
Relation aoRel;
Snapshot appendOnlyMetaDataSnapshot;
Relation blkdirRel;
Relation blkdirIdx;
int numColumnGroups;
bool isAOCol;
bool *proj; /* projected columns, used only if isAOCol = TRUE */
MemoryContext memoryContext;
int totalSegfiles;
FileSegInfo **segmentFileInfo;
/*
* Current segment file number.
*/
int currentSegmentFileNum;
FileSegInfo *currentSegmentFileInfo;
/*
* Last minipage that contains an array of MinipageEntries.
*/
MinipagePerColumnGroup *minipages;
/*
* Some temporary space to help form tuples to be inserted into
* the block directory, and to help the index scan.
*/
Datum *values;
bool *nulls;
int numScanKeys;
ScanKey scanKeys;
StrategyNumber *strategyNumbers;
} AppendOnlyBlockDirectory;
typedef struct CurrentBlock
{
AppendOnlyBlockDirectoryEntry blockDirectoryEntry;
bool have;
int64 fileOffset;
int32 overallBlockLen;
int64 firstRowNum;
int64 lastRowNum;
bool isCompressed;
bool isLargeContent;
bool gotContents;
} CurrentBlock;
typedef struct CurrentSegmentFile
{
bool isOpen;
int num;
int64 logicalEof;
} CurrentSegmentFile;
extern void AppendOnlyBlockDirectoryEntry_GetBeginRange(
AppendOnlyBlockDirectoryEntry *directoryEntry,
int64 *fileOffset,
int64 *firstRowNum);
extern void AppendOnlyBlockDirectoryEntry_GetEndRange(
AppendOnlyBlockDirectoryEntry *directoryEntry,
int64 *afterFileOffset,
int64 *lastRowNum);
extern bool AppendOnlyBlockDirectoryEntry_RangeHasRow(
AppendOnlyBlockDirectoryEntry *directoryEntry,
int64 checkRowNum);
extern bool AppendOnlyBlockDirectory_GetEntry(
AppendOnlyBlockDirectory *blockDirectory,
AOTupleId *aoTupleId,
int columnGroupNo,
AppendOnlyBlockDirectoryEntry *directoryEntry);
extern void AppendOnlyBlockDirectory_Init_forInsert(
AppendOnlyBlockDirectory *blockDirectory,
Snapshot appendOnlyMetaDataSnapshot,
FileSegInfo *segmentFileInfo,
int64 lastSequence,
Relation aoRel,
int segno,
int numColumnGroups,
bool isAOCol);
extern void AppendOnlyBlockDirectory_Init_forSearch(
AppendOnlyBlockDirectory *blockDirectory,
Snapshot appendOnlyMetaDataSnapshot,
FileSegInfo **segmentFileInfo,
int totalSegfiles,
Relation aoRel,
int numColumnGroups,
bool isAOCol,
bool *proj);
extern void AppendOnlyBlockDirectory_Init_addCol(
AppendOnlyBlockDirectory *blockDirectory,
Snapshot appendOnlyMetaDataSnapshot,
FileSegInfo *segmentFileInfo,
Relation aoRel,
int segno,
int numColumnGroups,
bool isAOCol);
extern bool AppendOnlyBlockDirectory_InsertEntry(
AppendOnlyBlockDirectory *blockDirectory,
int columnGroupNo,
int64 firstRowNum,
int64 fileOffset,
int64 rowCount,
bool addColAction);
extern bool AppendOnlyBlockDirectory_addCol_InsertEntry(
AppendOnlyBlockDirectory *blockDirectory,
int columnGroupNo,
int64 firstRowNum,
int64 fileOffset,
int64 rowCount);
extern bool AppendOnlyBlockDirectory_DeleteEntry(
AppendOnlyBlockDirectory *blockDirectory,
AOTupleId *aoTupleId);
extern bool AppendOnlyBlockDirectory_DeleteEntryForUpdate(
AppendOnlyBlockDirectory *visibilityBlockDirectory,
AppendOnlyBlockDirectory *insertBlockDirectory,
AOTupleId* aoTupleId);
extern void AppendOnlyBlockDirectory_End_forInsert(
AppendOnlyBlockDirectory *blockDirectory);
extern void AppendOnlyBlockDirectory_End_forSearch(
AppendOnlyBlockDirectory *blockDirectory);
extern void AppendOnlyBlockDirectory_End_addCol(
AppendOnlyBlockDirectory *blockDirectory);
extern void AppendOnlyBlockDirectory_DeleteSegmentFile(
Relation aoRel,
Snapshot snapshot,
int segno,
int columnGroupNo);
#endif
|
/***********************************************************************\
|* *|
|* Copyright (c) 1995-2008 by NVIDIA Corp. All rights reserved. *|
|* *|
|* This material constitutes the trade secrets and confidential, *|
|* proprietary information of NVIDIA, Corp. This material is not to *|
|* be disclosed, reproduced, copied, or used in any manner not *|
|* permitted under license from NVIDIA, Corp. *|
|* *|
\***********************************************************************/
#ifndef NVENCODERAPI_H
#define NVENCODERAPI_H
#include "NVEncodeDataTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#define NVENCAPI __stdcall
#else
#define NVENCAPI
#endif
typedef unsigned char *(NVENCAPI *PFNACQUIREBITSTREAM)(int *pBufferSize, void *pUserdata);
typedef void (NVENCAPI *PFNRELEASEBITSTREAM)(int nBytesInBuffer, unsigned char *cb, void *pUserdata);
typedef void (NVENCAPI *PFNONBEGINFRAME)(const NVVE_BeginFrameInfo *pbfi, void *pUserdata);
typedef void (NVENCAPI *PFNONENDFRAME)(const NVVE_EndFrameInfo *pefi, void *pUserdata);
typedef struct _NVVE_CallbackParams
{
PFNACQUIREBITSTREAM pfnacquirebitstream;
PFNRELEASEBITSTREAM pfnreleasebitstream;
PFNONBEGINFRAME pfnonbeginframe;
PFNONENDFRAME pfnonendframe;
} NVVE_CallbackParams;
typedef void *NVEncoder;
int NVENCAPI NVCreateEncoder(NVEncoder *pNVEncoder);
int NVENCAPI NVDestroyEncoder(NVEncoder hNVEncoder);
int NVENCAPI NVIsSupportedCodec(NVEncoder hNVEncoder, unsigned long dwCodecType);
int NVENCAPI NVIsSupportedCodecProfile(NVEncoder hNVEncoder, unsigned long dwCodecType, unsigned long dwProfileType);
int NVENCAPI NVSetCodec(NVEncoder hNVEncoder, unsigned long dwCodecType);
int NVENCAPI NVGetCodec(NVEncoder hNVEncoder, unsigned long *pdwCodecType);
int NVENCAPI NVIsSupportedParam(NVEncoder hNVEncoder, unsigned long dwParamType);
int NVENCAPI NVSetParamValue(NVEncoder hNVEncoder, unsigned long dwParamType, void *pData);
int NVENCAPI NVGetParamValue(NVEncoder hNVEncoder, unsigned long dwParamType, void *pData);
int NVENCAPI NVSetDefaultParam(NVEncoder hNVEncoder);
int NVENCAPI NVCreateHWEncoder(NVEncoder hNVEncoder);
int NVENCAPI NVGetSPSPPS(NVEncoder hNVEncoder, unsigned char *pSPSPPSbfr, int nSizeSPSPPSbfr, int *pDatasize);
int NVENCAPI NVEncodeFrame(NVEncoder hNVEncoder, NVVE_EncodeFrameParams *pFrmIn, unsigned long flag, void *pData);
int NVENCAPI NVGetHWEncodeCaps(void);
void NVENCAPI NVRegisterCB(NVEncoder hNVEncoder, NVVE_CallbackParams cb, void *pUserdata);
#ifdef __cplusplus
}
#endif
#endif
|
//
// Copyright 2012 Alin Dobra and Christopher Jermaine
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef _FILESCANNER_H_
#define _FILESCANNER_H_
#include "ID.h"
#include "EventProcessor.h"
// include the base class definition
#include "EventProcessor.h"
// include the implementation definition
#include "FileScannerImp.h"
/** Class to provide an interface to FileScannerImp class.
See FileScannerImp.h for a description of the functions
and behavior of the class
*/
class FileScanner : public EventProcessor {
public:
// constructor (creates the implementation object)
FileScanner(const char * _metadataFile, const char* _scannerName, EventProcessor& _concurencyCorntroller, EventProcessor& _scheduler){
evProc = new FileScannerImp(_metadataFile, _scannerName, _concurencyCorntroller, _scheduler);
}
// default constructor
FileScanner(void){
evProc = NULL;
}
TableScanID GetID(void){
FileScannerImp& obj = dynamic_cast<FileScannerImp&>(*evProc);
return obj.GetID();
}
// the virtual destructor
virtual ~FileScanner(){}
};
#endif // _FILESCANNER_H_
|
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* CC/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __THREADPOOL_H_
#define __THREADPOOL_H_
#include <vector>
#include <bgcc.h>
#include "session_thread.h"
#include "singleton.h"
namespace ims {
class threadpool_t : public bgcc::Shareable {
public:
threadpool_t():
_size(20),
_timeout(2000),
_isstart(false) {
}
threadpool_t(int32_t size, int32_t task_timeout);
~threadpool_t();
void start();
void stop();
session_thread_ptr get_prefer_thread();
void set(int32_t size, int32_t timeout) {
_size = size;
_timeout = timeout;
}
int32_t size() {
return _size;
}
private:
int32_t _size;
int32_t _timeout;
std::vector<session_thread_ptr> _threads;
bgcc::Mutex _mutex;
bool _isstart;
};
typedef singleton_t<threadpool_t> session_thrd_mgr;
}
#endif //__THREADPOOL_H_
/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
|
//---------------------------------------------------------------------------
#ifndef du_boxH
#define du_boxH
//---------------------------------------------------------------------------
#define DU_BOX_NUMVERTEX 8
#define DU_BOX_NUMFACES 12
#define DU_BOX_NUMLINES 12
#define DU_BOX_NUMVERTEX2 36
extern ECORE_API Fvector du_box_vertices[];
extern ECORE_API WORD du_box_faces[];
extern ECORE_API WORD du_box_lines[];
extern ECORE_API Fvector du_box_vertices2[];
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class InstanceMetadataEndpointState
{
NOT_SET,
disabled,
enabled
};
namespace InstanceMetadataEndpointStateMapper
{
AWS_EC2_API InstanceMetadataEndpointState GetInstanceMetadataEndpointStateForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForInstanceMetadataEndpointState(InstanceMetadataEndpointState value);
} // namespace InstanceMetadataEndpointStateMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
// 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 COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
#define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
#include "components/arc/common/bluetooth.mojom.h"
#include "device/bluetooth/bluetooth_advertisement.h"
#include "device/bluetooth/bluetooth_common.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h"
namespace mojo {
template <>
struct EnumTraits<arc::mojom::BluetoothDeviceType,
device::BluetoothTransport> {
static arc::mojom::BluetoothDeviceType ToMojom(
device::BluetoothTransport type) {
switch (type) {
case device::BLUETOOTH_TRANSPORT_CLASSIC:
return arc::mojom::BluetoothDeviceType::BREDR;
case device::BLUETOOTH_TRANSPORT_LE:
return arc::mojom::BluetoothDeviceType::BLE;
case device::BLUETOOTH_TRANSPORT_DUAL:
return arc::mojom::BluetoothDeviceType::DUAL;
default:
NOTREACHED() << "Invalid type: " << static_cast<uint8_t>(type);
// XXX: is there a better value to return here?
return arc::mojom::BluetoothDeviceType::DUAL;
}
}
static bool FromMojom(arc::mojom::BluetoothDeviceType mojom_type,
device::BluetoothTransport* type) {
switch (mojom_type) {
case arc::mojom::BluetoothDeviceType::BREDR:
*type = device::BLUETOOTH_TRANSPORT_CLASSIC;
break;
case arc::mojom::BluetoothDeviceType::BLE:
*type = device::BLUETOOTH_TRANSPORT_LE;
break;
case arc::mojom::BluetoothDeviceType::DUAL:
*type = device::BLUETOOTH_TRANSPORT_DUAL;
break;
default:
NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(mojom_type);
return false;
}
return true;
}
};
template <>
struct EnumTraits<arc::mojom::BluetoothSdpAttributeType,
bluez::BluetoothServiceAttributeValueBlueZ::Type> {
static arc::mojom::BluetoothSdpAttributeType ToMojom(
bluez::BluetoothServiceAttributeValueBlueZ::Type input) {
switch (input) {
case bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE:
case bluez::BluetoothServiceAttributeValueBlueZ::UINT:
case bluez::BluetoothServiceAttributeValueBlueZ::INT:
case bluez::BluetoothServiceAttributeValueBlueZ::UUID:
case bluez::BluetoothServiceAttributeValueBlueZ::STRING:
case bluez::BluetoothServiceAttributeValueBlueZ::BOOL:
case bluez::BluetoothServiceAttributeValueBlueZ::SEQUENCE:
case bluez::BluetoothServiceAttributeValueBlueZ::URL:
return static_cast<arc::mojom::BluetoothSdpAttributeType>(input);
default:
NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(input);
return arc::mojom::BluetoothSdpAttributeType::NULLTYPE;
}
}
static bool FromMojom(
arc::mojom::BluetoothSdpAttributeType input,
bluez::BluetoothServiceAttributeValueBlueZ::Type* output) {
switch (input) {
case arc::mojom::BluetoothSdpAttributeType::NULLTYPE:
case arc::mojom::BluetoothSdpAttributeType::UINT:
case arc::mojom::BluetoothSdpAttributeType::INT:
case arc::mojom::BluetoothSdpAttributeType::UUID:
case arc::mojom::BluetoothSdpAttributeType::STRING:
case arc::mojom::BluetoothSdpAttributeType::BOOL:
case arc::mojom::BluetoothSdpAttributeType::SEQUENCE:
case arc::mojom::BluetoothSdpAttributeType::URL:
*output = static_cast<bluez::BluetoothServiceAttributeValueBlueZ::Type>(
input);
return true;
default:
NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(input);
return false;
}
}
};
template <>
struct StructTraits<arc::mojom::BluetoothUUIDDataView, device::BluetoothUUID> {
static std::vector<uint8_t> uuid(const device::BluetoothUUID& input);
static bool Read(arc::mojom::BluetoothUUIDDataView data,
device::BluetoothUUID* output);
};
template <>
struct StructTraits<arc::mojom::BluetoothAdvertisementDataView,
std::unique_ptr<device::BluetoothAdvertisement::Data>> {
static bool Read(
arc::mojom::BluetoothAdvertisementDataView advertisement,
std::unique_ptr<device::BluetoothAdvertisement::Data>* output);
// Dummy methods.
static arc::mojom::BluetoothAdvertisementType type(
std::unique_ptr<device::BluetoothAdvertisement::Data>& input) {
NOTREACHED();
return arc::mojom::BluetoothAdvertisementType::ADV_TYPE_NON_CONNECTABLE;
}
static bool include_tx_power(
std::unique_ptr<device::BluetoothAdvertisement::Data>& input) {
NOTREACHED();
return false;
}
static mojo::Array<arc::mojom::BluetoothAdvertisingDataPtr> data(
std::unique_ptr<device::BluetoothAdvertisement::Data>& input) {
NOTREACHED();
return mojo::Array<arc::mojom::BluetoothAdvertisingDataPtr>();
}
};
} // namespace mojo
#endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
|
/*
Copyright (c) 2014, Alexey Frunze
2-clause BSD license.
*/
#include "istdio.h"
int fscanf(FILE* f, char* fmt, ...)
{
return __doscan(f, fmt, (char*)&fmt + sizeof(char*));
}
|
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
#define PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
#include <stdlib.h>
#define CHECK(condition) \
if (!(condition)) { \
abort(); \
*(reinterpret_cast<volatile char*>(NULL) + 42) = 0x42; \
}
#define NOTREACHED() abort()
#endif // PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
|
/*****************************************************************************
Copyright (c) 2015, Intel Corp.
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 Intel Corporation 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.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function zgghd3
* Author: Intel Corporation
* Generated January, 2015
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_zgghd3( int matrix_layout, char compq, char compz,
lapack_int n, lapack_int ilo, lapack_int ihi,
lapack_complex_double* a, lapack_int lda,
lapack_complex_double* b, lapack_int ldb,
lapack_complex_double* q, lapack_int ldq,
lapack_complex_double* z, lapack_int ldz )
{
lapack_int info = 0;
lapack_int lwork = -1;
lapack_complex_double* work = NULL;
lapack_complex_double work_query;
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_zgghd3", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_zge_nancheck( matrix_layout, n, n, a, lda ) ) {
return -7;
}
if( LAPACKE_zge_nancheck( matrix_layout, n, n, b, ldb ) ) {
return -9;
}
if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, 'v' ) ) {
if( LAPACKE_zge_nancheck( matrix_layout, n, n, q, ldq ) ) {
return -11;
}
}
if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
if( LAPACKE_zge_nancheck( matrix_layout, n, n, z, ldz ) ) {
return -13;
}
}
#endif
/* Query optimal working array(s) size */
info = LAPACKE_zgghd3_work( matrix_layout, compq, compz, n, ilo, ihi,
a, lda, b, ldb, q, ldq, z, ldz, &work_query,
lwork );
if( info != 0 ) {
goto exit_level_0;
}
lwork = LAPACK_C2INT( work_query );
/* Allocate memory for work arrays */
work = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
/* Call middle-level interface */
info = LAPACKE_zgghd3_work( matrix_layout, compq, compz, n, ilo, ihi,
a, lda, b, ldb, q, ldq, z, ldz, work,
lwork );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zgghd3", info );
}
return info;
}
|
/*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved. Released under a BSD (revised)
license as described in the file LICENSE.
*/
#pragma once
#include "vw_clr.h"
#include "vw_base.h"
#include "vw_example.h"
#include "vowpalwabbit.h"
namespace VW
{
/// <summary>
/// Helper class to ease construction of native vowpal wabbit namespace data structure.
/// </summary>
public ref class VowpalWabbitNamespaceBuilder
{
private:
/// <summary>
/// Features.
/// </summary>
features* m_features;
/// <summary>
/// The namespace index.
/// </summary>
unsigned char m_index;
/// <summary>
/// The native example.
/// </summary>
example* m_example;
// float(*m_sum_of_squares)(float*, float*);
!VowpalWabbitNamespaceBuilder();
internal:
/// <summary>
/// Initializes a new <see cref="VowpalWabbitNamespaceBuilder"/> instance.
/// </summary>
/// <param name="features">Pointer into features owned by <see cref="VowpalWabbitExample"/>.</param>
/// <param name="index">The namespace index.</param>
/// <param name="example">The native example to build up.</param>
VowpalWabbitNamespaceBuilder(features* features, unsigned char index, example* example);
public:
~VowpalWabbitNamespaceBuilder();
/// <summary>
/// Add feature entry.
/// </summary>
/// <param name="weight_index">The weight index.</param>
/// <param name="x">The value.</param>
void AddFeature(uint64_t weight_index, float x);
/// <summary>
/// Adds a dense array to the example.
/// </summary>
/// <param name="weight_index_base">The base weight index. Each element is then placed relative to this index.</param>
/// <param name="begin">The start pointer of the float array.</param>
/// <param name="end">The end pointer of the float array.</param>
void AddFeaturesUnchecked(uint64_t weight_index_base, float* begin, float* end);
/// <summary>
/// Pre-allocate features of <paramref name="size"/>.
/// </summary>
/// <param name="size">The number of features to pre-allocate.</param>
void PreAllocate(int size);
};
/// <summary>
/// Helper class to ease construction of native vowpal wabbit example data structure.
/// </summary>
public ref class VowpalWabbitExampleBuilder
{
private:
IVowpalWabbitExamplePool^ m_vw;
/// <summary>
/// The produced CLR example data structure.
/// </summary>
VowpalWabbitExample^ m_example;
protected:
/// <summary>
/// Cleanup.
/// </summary>
!VowpalWabbitExampleBuilder();
public:
/// <summary>
/// Initializes a new <see cref="VowpalWabbitExampleBuilder"/> instance.
/// </summary>
/// <param name="vw">The parent vowpal wabbit instance.</param>
VowpalWabbitExampleBuilder(IVowpalWabbitExamplePool^ vw);
/// <summary>
/// Cleanup.
/// </summary>
~VowpalWabbitExampleBuilder();
/// <summary>
/// Creates the managed example representation.
/// </summary>
/// <returns>Creates the managed example.</returns>
VowpalWabbitExample^ CreateExample();
/// <summary>
/// Sets the label for the resulting example.
/// </summary>
/// <param name="value">The label value to be parsed.</param>
void ParseLabel(String^ value);
/// <summary>
/// Creates and adds a new namespace to this example.
/// </summary>
VowpalWabbitNamespaceBuilder^ AddNamespace(Byte featureGroup);
/// <summary>
/// Creates and adds a new namespace to this example.
/// </summary>
/// <param name="featureGroup">The feature group of the new namespace.</param>
/// <remarks>Casts to System::Byte.</remarks>
VowpalWabbitNamespaceBuilder^ AddNamespace(Char featureGroup);
};
}
|
/*
* Copyright (c) 2012, Michael Lehn, Klaus Pototzky
*
* 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 FLENS development group 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.
*/
#ifndef CXXLAPACK_INTERFACE_LAGTM_H
#define CXXLAPACK_INTERFACE_LAGTM_H 1
#include <cxxstd/complex.h>
namespace cxxlapack {
template <typename IndexType>
IndexType
lagtm(char trans,
IndexType n,
IndexType nRhs,
float alpha,
const float *dl,
const float *d,
const float *du,
const float *X,
IndexType ldX,
float beta,
float *B,
IndexType ldB);
template <typename IndexType>
IndexType
lagtm(char trans,
IndexType n,
IndexType nRhs,
double alpha,
const double *dl,
const double *d,
const double *du,
const double *X,
IndexType ldX,
double beta,
double *B,
IndexType ldB);
template <typename IndexType>
IndexType
lagtm(char trans,
IndexType n,
IndexType nRhs,
float alpha,
const std::complex<float > *dl,
const std::complex<float > *d,
const std::complex<float > *du,
const std::complex<float > *X,
IndexType ldX,
float beta,
std::complex<float > *B,
IndexType ldB);
template <typename IndexType>
IndexType
lagtm(char trans,
IndexType n,
IndexType nRhs,
double alpha,
const std::complex<double> *dl,
const std::complex<double> *d,
const std::complex<double> *du,
const std::complex<double> *X,
IndexType ldX,
double beta,
std::complex<double> *B,
IndexType ldB);
} // namespace cxxlapack
#endif // CXXLAPACK_INTERFACE_LAGTM_H
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * 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 John Haddon nor the names of
// any other contributors to this software 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.
//
//////////////////////////////////////////////////////////////////////////
#ifndef GAFFERIMAGE_GRADE_H
#define GAFFERIMAGE_GRADE_H
#include "Gaffer/CompoundNumericPlug.h"
#include "GafferImage/ChannelDataProcessor.h"
namespace GafferImage
{
/// The grade node implements the common grade operation to the RGB channels of the input.
/// The computation performed is:
/// A = multiply * (gain - lift) / (whitePoint - blackPoint)
/// B = offset + lift - A * blackPoint
/// output = pow( A * input + B, 1/gamma )
//
class Grade : public ChannelDataProcessor
{
public :
Grade( const std::string &name=defaultName<Grade>() );
virtual ~Grade();
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( GafferImage::Grade, GradeTypeId, ChannelDataProcessor );
//! @name Plug Accessors
/// Returns a pointer to the node's plugs.
//////////////////////////////////////////////////////////////
//@{
Gaffer::Color3fPlug *blackPointPlug();
const Gaffer::Color3fPlug *blackPointPlug() const;
Gaffer::Color3fPlug *whitePointPlug();
const Gaffer::Color3fPlug *whitePointPlug() const;
Gaffer::Color3fPlug *liftPlug();
const Gaffer::Color3fPlug *liftPlug() const;
Gaffer::Color3fPlug *gainPlug();
const Gaffer::Color3fPlug *gainPlug() const;
Gaffer::Color3fPlug *multiplyPlug();
const Gaffer::Color3fPlug *multiplyPlug() const;
Gaffer::Color3fPlug *offsetPlug();
const Gaffer::Color3fPlug *offsetPlug() const;
Gaffer::Color3fPlug *gammaPlug();
const Gaffer::Color3fPlug *gammaPlug() const;
Gaffer::BoolPlug *blackClampPlug();
const Gaffer::BoolPlug *blackClampPlug() const;
Gaffer::BoolPlug *whiteClampPlug();
const Gaffer::BoolPlug *whiteClampPlug() const;
//@}
virtual void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const;
protected :
virtual bool channelEnabled( const std::string &channel ) const;
virtual void hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
virtual void processChannelData( const Gaffer::Context *context, const ImagePlug *parent, const std::string &channelIndex, IECore::FloatVectorDataPtr outData ) const;
private :
void parameters( size_t channelIndex, float &a, float &b, float &gamma ) const;
static size_t g_firstPlugIndex;
};
IE_CORE_DECLAREPTR( Grade );
} // namespace GafferImage
#endif // GAFFERIMAGE_GRADE_H
|
// SDLECallInfo.h
//
#import "SDLRPCMessage.h"
@class SDLVehicleDataNotificationStatus;
@class SDLECallConfirmationStatus;
@interface SDLECallInfo : SDLRPCStruct {
}
- (instancetype)init;
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;
@property (strong) SDLVehicleDataNotificationStatus *eCallNotificationStatus;
@property (strong) SDLVehicleDataNotificationStatus *auxECallNotificationStatus;
@property (strong) SDLECallConfirmationStatus *eCallConfirmationStatus;
@end
|
//
// AboutWISTViewController.h
// WIST SDK Version 1.0.0
//
// Portions contributed by Retronyms (www.retronyms.com).
// Copyright 2011 KORG INC. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AboutWISTViewController : UIViewController <UIWebViewDelegate>
{
@private
NSString* pageUrl_;
UIWebView* webview_;
UIActivityIndicatorView* indicatorView_;
}
@end
|
// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Rainer Gericke
// =============================================================================
//
// Marder single-pin track assembly subsystem.
//
// =============================================================================
#ifndef MARDER_TRACK_ASSEMBLY_SINGLE_PIN_H
#define MARDER_TRACK_ASSEMBLY_SINGLE_PIN_H
#include <string>
#include "chrono_vehicle/tracked_vehicle/track_assembly/ChTrackAssemblySinglePin.h"
#include "chrono_models/ChApiModels.h"
namespace chrono {
namespace vehicle {
namespace marder {
/// @addtogroup vehicle_models_marder
/// @{
/// Marder track assembly using single-pin track shoes.
class CH_MODELS_API Marder_TrackAssemblySinglePin : public ChTrackAssemblySinglePin {
public:
Marder_TrackAssemblySinglePin(VehicleSide side, BrakeType brake_type);
virtual const ChVector<> GetSprocketLocation() const override;
virtual const ChVector<> GetIdlerLocation() const override;
virtual const ChVector<> GetRoadWhelAssemblyLocation(int which) const override;
virtual const ChVector<> GetRollerLocation(int which) const override;
private:
static const ChVector<> m_sprocket_loc;
static const ChVector<> m_idler_loc;
static const ChVector<> m_susp_locs_L[6];
static const ChVector<> m_susp_locs_R[6];
static const ChVector<> m_supp_locs_L[3];
static const ChVector<> m_supp_locs_R[3];
static const double m_right_x_offset;
};
/// @} vehicle_models_marder
} // namespace marder
} // end namespace vehicle
} // end namespace chrono
#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 THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_TEXT_DETECTOR_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_TEXT_DETECTOR_H_
#include "services/shape_detection/public/mojom/textdetection.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/shapedetection/shape_detector.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h"
namespace blink {
class ExecutionContext;
class MODULES_EXPORT TextDetector final : public ShapeDetector {
DEFINE_WRAPPERTYPEINFO();
public:
static TextDetector* Create(ExecutionContext*);
explicit TextDetector(ExecutionContext*);
~TextDetector() override = default;
void Trace(Visitor*) const override;
private:
ScriptPromise DoDetect(ScriptPromiseResolver*, SkBitmap) override;
void OnDetectText(
ScriptPromiseResolver*,
Vector<shape_detection::mojom::blink::TextDetectionResultPtr>);
void OnTextServiceConnectionError();
HeapMojoRemote<shape_detection::mojom::blink::TextDetection> text_service_;
HeapHashSet<Member<ScriptPromiseResolver>> text_service_requests_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_TEXT_DETECTOR_H_
|
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Neither the name of Google Inc. 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.
*/
#ifndef EventPath_h
#define EventPath_h
#include "core/CoreExport.h"
#include "core/events/NodeEventContext.h"
#include "core/events/TreeScopeEventContext.h"
#include "core/events/WindowEventContext.h"
#include "platform/heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
namespace blink {
class Event;
class EventTarget;
class Node;
class TouchEvent;
class TouchList;
class TreeScope;
class CORE_EXPORT EventPath final : public GarbageCollected<EventPath> {
WTF_MAKE_NONCOPYABLE(EventPath);
public:
explicit EventPath(Node&, Event* = nullptr);
void initializeWith(Node&, Event*);
NodeEventContext& operator[](size_t index) { return m_nodeEventContexts[index]; }
const NodeEventContext& operator[](size_t index) const { return m_nodeEventContexts[index]; }
NodeEventContext& at(size_t index) { return m_nodeEventContexts[index]; }
NodeEventContext& last() { return m_nodeEventContexts[size() - 1]; }
WindowEventContext& windowEventContext() { ASSERT(m_windowEventContext); return *m_windowEventContext; }
void ensureWindowEventContext();
bool isEmpty() const { return m_nodeEventContexts.isEmpty(); }
size_t size() const { return m_nodeEventContexts.size(); }
void adjustForRelatedTarget(Node&, EventTarget* relatedTarget);
void adjustForTouchEvent(TouchEvent&);
static EventTarget* eventTargetRespectingTargetRules(Node&);
DECLARE_TRACE();
void clear()
{
m_nodeEventContexts.clear();
m_treeScopeEventContexts.clear();
}
private:
EventPath();
void initialize();
void calculatePath();
void calculateAdjustedTargets();
void calculateTreeOrderAndSetNearestAncestorClosedTree();
void shrink(size_t newSize) { ASSERT(!m_windowEventContext); m_nodeEventContexts.shrink(newSize); }
void shrinkIfNeeded(const Node& target, const EventTarget& relatedTarget);
void adjustTouchList(const TouchList*, HeapVector<Member<TouchList>> adjustedTouchList, const HeapVector<Member<TreeScope>>& treeScopes);
using TreeScopeEventContextMap = HeapHashMap<Member<TreeScope>, Member<TreeScopeEventContext>>;
TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, TreeScope*, TreeScopeEventContextMap&);
using RelatedTargetMap = HeapHashMap<Member<TreeScope>, Member<EventTarget>>;
static void buildRelatedNodeMap(const Node&, RelatedTargetMap&);
static EventTarget* findRelatedNode(TreeScope&, RelatedTargetMap&);
#if ENABLE(ASSERT)
static void checkReachability(TreeScope&, TouchList&);
#endif
const NodeEventContext& topNodeEventContext();
HeapVector<NodeEventContext> m_nodeEventContexts;
Member<Node> m_node;
Member<Event> m_event;
HeapVector<Member<TreeScopeEventContext>> m_treeScopeEventContexts;
Member<WindowEventContext> m_windowEventContext;
};
} // namespace blink
#endif
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_PEPPER_PEPPER_WEBPLUGIN_IMPL_H_
#define CONTENT_RENDERER_PEPPER_PEPPER_WEBPLUGIN_IMPL_H_
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
#include "ppapi/c/pp_var.h"
#include "third_party/WebKit/public/web/WebPlugin.h"
#include "ui/gfx/geometry/rect.h"
struct _NPP;
namespace blink {
struct WebPluginParams;
struct WebPrintParams;
}
namespace content {
class PepperPluginInstanceImpl;
class PluginInstanceThrottlerImpl;
class PluginModule;
class PPB_URLLoader_Impl;
class RenderFrameImpl;
class PepperWebPluginImpl : public blink::WebPlugin {
public:
PepperWebPluginImpl(PluginModule* module,
const blink::WebPluginParams& params,
RenderFrameImpl* render_frame,
scoped_ptr<PluginInstanceThrottlerImpl> throttler);
PepperPluginInstanceImpl* instance() { return instance_.get(); }
// blink::WebPlugin implementation.
virtual blink::WebPluginContainer* container() const;
virtual bool initialize(blink::WebPluginContainer* container);
virtual void destroy();
virtual v8::Local<v8::Object> v8ScriptableObject(
v8::Isolate* isolate) override;
virtual bool getFormValue(blink::WebString& value);
virtual void paint(blink::WebCanvas* canvas, const blink::WebRect& rect);
virtual void updateGeometry(
const blink::WebRect& window_rect,
const blink::WebRect& clip_rect,
const blink::WebRect& unobscured_rect,
const blink::WebVector<blink::WebRect>& cut_outs_rects,
bool is_visible);
virtual void updateFocus(bool focused, blink::WebFocusType focus_type);
virtual void updateVisibility(bool visible);
virtual bool acceptsInputEvents();
virtual bool handleInputEvent(const blink::WebInputEvent& event,
blink::WebCursorInfo& cursor_info);
virtual void didReceiveResponse(const blink::WebURLResponse& response);
virtual void didReceiveData(const char* data, int data_length);
virtual void didFinishLoading();
virtual void didFailLoading(const blink::WebURLError&);
virtual void didFinishLoadingFrameRequest(const blink::WebURL& url,
void* notify_data);
virtual void didFailLoadingFrameRequest(const blink::WebURL& url,
void* notify_data,
const blink::WebURLError& error);
virtual bool hasSelection() const;
virtual blink::WebString selectionAsText() const;
virtual blink::WebString selectionAsMarkup() const;
virtual blink::WebURL linkAtPosition(const blink::WebPoint& position) const;
virtual bool getPrintPresetOptionsFromDocument(
blink::WebPrintPresetOptions* preset_options);
virtual void setZoomLevel(double level, bool text_only);
virtual bool startFind(const blink::WebString& search_text,
bool case_sensitive,
int identifier);
virtual void selectFindResult(bool forward);
virtual void stopFind();
virtual bool supportsPaginatedPrint() override;
virtual bool isPrintScalingDisabled() override;
virtual int printBegin(const blink::WebPrintParams& print_params) override;
virtual bool printPage(int page_number, blink::WebCanvas* canvas) override;
virtual void printEnd() override;
virtual bool canRotateView() override;
virtual void rotateView(RotationType type) override;
virtual bool isPlaceholder() override;
private:
friend class base::DeleteHelper<PepperWebPluginImpl>;
virtual ~PepperWebPluginImpl();
struct InitData;
scoped_ptr<InitData> init_data_; // Cleared upon successful initialization.
// True if the instance represents the entire document in a frame instead of
// being an embedded resource.
bool full_frame_;
scoped_ptr<PluginInstanceThrottlerImpl> throttler_;
scoped_refptr<PepperPluginInstanceImpl> instance_;
gfx::Rect plugin_rect_;
PP_Var instance_object_;
blink::WebPluginContainer* container_;
DISALLOW_COPY_AND_ASSIGN(PepperWebPluginImpl);
};
} // namespace content
#endif // CONTENT_RENDERER_PEPPER_PEPPER_WEBPLUGIN_IMPL_H_
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef SUPPORT_CHARCONV_TEST_HELPERS_H
#define SUPPORT_CHARCONV_TEST_HELPERS_H
#include <charconv>
#include <cassert>
#include <limits>
#include <string.h>
#include <stdlib.h>
#include "test_macros.h"
#if TEST_STD_VER <= 11
#error This file requires C++14
#endif
using std::false_type;
using std::true_type;
template <typename To, typename From>
constexpr auto
is_non_narrowing(From a) -> decltype(To{a}, true_type())
{
return {};
}
template <typename To>
constexpr auto
is_non_narrowing(...) -> false_type
{
return {};
}
template <typename X, typename T>
constexpr bool
_fits_in(T, true_type /* non-narrowing*/, ...)
{
return true;
}
template <typename X, typename T, typename xl = std::numeric_limits<X>>
constexpr bool
_fits_in(T v, false_type, true_type /* T signed*/, true_type /* X signed */)
{
return xl::lowest() <= v && v <= (xl::max)();
}
template <typename X, typename T, typename xl = std::numeric_limits<X>>
constexpr bool
_fits_in(T v, false_type, true_type /* T signed */, false_type /* X unsigned*/)
{
return 0 <= v && std::make_unsigned_t<T>(v) <= (xl::max)();
}
template <typename X, typename T, typename xl = std::numeric_limits<X>>
constexpr bool
_fits_in(T v, false_type, false_type /* T unsigned */, ...)
{
return v <= std::make_unsigned_t<X>((xl::max)());
}
template <typename X, typename T>
constexpr bool
fits_in(T v)
{
return _fits_in<X>(v, is_non_narrowing<X>(v), std::is_signed<T>(),
std::is_signed<X>());
}
template <typename X>
struct to_chars_test_base
{
template <typename T, size_t N, typename... Ts>
void test(T v, char const (&expect)[N], Ts... args)
{
using std::to_chars;
std::to_chars_result r;
constexpr size_t len = N - 1;
static_assert(len > 0, "expected output won't be empty");
if (!fits_in<X>(v))
return;
r = to_chars(buf, buf + len - 1, X(v), args...);
assert(r.ptr == buf + len - 1);
assert(r.ec == std::errc::value_too_large);
r = to_chars(buf, buf + sizeof(buf), X(v), args...);
assert(r.ptr == buf + len);
assert(r.ec == std::errc{});
assert(memcmp(buf, expect, len) == 0);
}
template <typename... Ts>
void test_value(X v, Ts... args)
{
using std::to_chars;
std::to_chars_result r;
r = to_chars(buf, buf + sizeof(buf), v, args...);
assert(r.ec == std::errc{});
*r.ptr = '\0';
auto a = fromchars(buf, r.ptr, args...);
assert(v == a);
auto ep = r.ptr - 1;
r = to_chars(buf, ep, v, args...);
assert(r.ptr == ep);
assert(r.ec == std::errc::value_too_large);
}
private:
static auto fromchars(char const* p, char const* ep, int base, true_type)
{
char* last;
auto r = strtoll(p, &last, base);
assert(last == ep);
return r;
}
static auto fromchars(char const* p, char const* ep, int base, false_type)
{
char* last;
auto r = strtoull(p, &last, base);
assert(last == ep);
return r;
}
static auto fromchars(char const* p, char const* ep, int base = 10)
{
return fromchars(p, ep, base, std::is_signed<X>());
}
char buf[100];
};
template <typename X>
struct roundtrip_test_base
{
template <typename T, typename... Ts>
void test(T v, Ts... args)
{
using std::from_chars;
using std::to_chars;
std::from_chars_result r2;
std::to_chars_result r;
X x = 0xc;
if (fits_in<X>(v))
{
r = to_chars(buf, buf + sizeof(buf), v, args...);
assert(r.ec == std::errc{});
r2 = from_chars(buf, r.ptr, x, args...);
assert(r2.ptr == r.ptr);
assert(x == X(v));
}
else
{
r = to_chars(buf, buf + sizeof(buf), v, args...);
assert(r.ec == std::errc{});
r2 = from_chars(buf, r.ptr, x, args...);
if (std::is_signed<T>::value && v < 0 && std::is_unsigned<X>::value)
{
assert(x == 0xc);
assert(r2.ptr == buf);
assert(r2.ec == std::errc::invalid_argument);
}
else
{
assert(x == 0xc);
assert(r2.ptr == r.ptr);
assert(r2.ec == std::errc::result_out_of_range);
}
}
}
private:
char buf[100];
};
template <typename... T>
struct type_list
{
};
template <typename L1, typename L2>
struct type_concat;
template <typename... Xs, typename... Ys>
struct type_concat<type_list<Xs...>, type_list<Ys...>>
{
using type = type_list<Xs..., Ys...>;
};
template <typename L1, typename L2>
using concat_t = typename type_concat<L1, L2>::type;
template <typename L1, typename L2>
constexpr auto concat(L1, L2) -> concat_t<L1, L2>
{
return {};
}
auto all_signed = type_list<char, signed char, short, int, long, long long>();
auto all_unsigned = type_list<unsigned char, unsigned short, unsigned int,
unsigned long, unsigned long long>();
auto integrals = concat(all_signed, all_unsigned);
template <template <typename> class Fn, typename... Ts>
void
run(type_list<Ts...>)
{
int ls[sizeof...(Ts)] = {(Fn<Ts>{}(), 0)...};
(void)ls;
}
#endif // SUPPORT_CHARCONV_TEST_HELPERS_H
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2010-2015, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * 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 Image Engine Design nor the names of any
// other contributors to this software 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.
//
//////////////////////////////////////////////////////////////////////////
#ifndef IECOREHOUDINI_TOHOUDINIQUATATTRIBCONVERTER_H
#define IECOREHOUDINI_TOHOUDINIQUATATTRIBCONVERTER_H
#include "IECore/VectorTypedParameter.h"
#include "IECoreHoudini/TypeIds.h"
#include "IECoreHoudini/ToHoudiniAttribConverter.h"
namespace IECoreHoudini
{
IE_CORE_FORWARDDECLARE( ToHoudiniQuatVectorAttribConverter );
/// A ToHoudiniQuatVectorAttribConverter can convert from IECore::QuatfVectorData
/// to a Houdini GA_Attribute on the provided GU_Detail.
class ToHoudiniQuatVectorAttribConverter : public ToHoudiniAttribConverter
{
public :
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( ToHoudiniQuatVectorAttribConverter, ToHoudiniQuatVectorAttribConverterTypeId, ToHoudiniAttribConverter );
ToHoudiniQuatVectorAttribConverter( const IECore::Data *data );
virtual ~ToHoudiniQuatVectorAttribConverter();
protected :
virtual GA_RWAttributeRef doConversion( const IECore::Data *data, std::string name, GU_Detail *geo ) const;
virtual GA_RWAttributeRef doConversion( const IECore::Data *data, std::string name, GU_Detail *geo, const GA_Range &range ) const;
private :
static ToHoudiniAttribConverter::Description<ToHoudiniQuatVectorAttribConverter> m_description;
};
} // namespace IECoreHoudini
#endif // IECOREHOUDINI_TOHOUDINIQUATATTRIBCONVERTER_H
|
#include <math.h>
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/* Variables */
int n, s,s1,s2,n1,n2,e, yInd,
nNodes, nEdges, maxState, sizeEdgeBel[3], sizeLogZ[2],
*y,
*edgeEnds, *nStates;
double pot,Z,
*nodePot, *edgePot, *nodeBel, *edgeBel, *logZ;
/* Input */
nodePot = mxGetPr(prhs[0]);
edgePot = mxGetPr(prhs[1]);
edgeEnds = (int*)mxGetPr(prhs[2]);
nStates = (int*)mxGetPr(prhs[3]);
if (!mxIsClass(prhs[2],"int32")||!mxIsClass(prhs[3],"int32"))
mexErrMsgTxt("edgeEnds and nStates must be int32");
/* Compute Sizes */
nNodes = mxGetDimensions(prhs[0])[0];
maxState = mxGetDimensions(prhs[0])[1];
nEdges = mxGetDimensions(prhs[2])[0];
/* Output */
sizeEdgeBel[0] = maxState;
sizeEdgeBel[1] = maxState;
sizeEdgeBel[2] = nEdges;
sizeLogZ[0] = 1;
sizeLogZ[1] = 1;
plhs[0] = mxCreateNumericArray(2,mxGetDimensions(prhs[0]),mxDOUBLE_CLASS,mxREAL);
plhs[1] = mxCreateNumericArray(3,sizeEdgeBel,mxDOUBLE_CLASS,mxREAL);
plhs[2] = mxCreateNumericArray(2,sizeLogZ,mxDOUBLE_CLASS,mxREAL);
nodeBel = mxGetPr(plhs[0]);
edgeBel = mxGetPr(plhs[1]);
logZ = mxGetPr(plhs[2]);
/* Initialize */
y = mxCalloc(nNodes,sizeof(int));
Z = 0;
while(1)
{
pot = 1;
/* Node */
for(n = 0; n < nNodes; n++)
{
pot *= nodePot[n + nNodes*y[n]];
}
/* Edges */
for(e = 0; e < nEdges; e++)
{
n1 = edgeEnds[e]-1;
n2 = edgeEnds[e+nEdges]-1;
pot *= edgePot[y[n1] + maxState*(y[n2] + maxState*e)];
}
/* Update nodeBel */
for(n = 0; n < nNodes; n++)
{
nodeBel[n + nNodes*y[n]] += pot;
}
/* Update edgeBel */
for (e = 0; e < nEdges; e++)
{
n1 = edgeEnds[e]-1;
n2 = edgeEnds[e+nEdges]-1;
edgeBel[y[n1] + maxState*(y[n2] + maxState*e)] += pot;
}
/* Update Z */
Z += pot;
/* Go to next y */
for(yInd = 0; yInd < nNodes; yInd++)
{
y[yInd] += 1;
if(y[yInd] < nStates[yInd])
{
break;
}
else
{
y[yInd] = 0;
}
}
/* Stop when we are done all y combinations */
if(yInd == nNodes)
{
break;
}
}
/* Normalize by Z */
for(n = 0; n < nNodes; n++)
{
for(s = 0; s < nStates[n];s++)
{
nodeBel[n + nNodes*s] /= Z;
}
}
for(e = 0; e < nEdges; e++)
{
n1 = edgeEnds[e]-1;
n2 = edgeEnds[e+nEdges]-1;
for(s1 = 0; s1 < nStates[n1]; s1++)
{
for(s2 = 0; s2 < nStates[n2]; s2++)
{
edgeBel[s1 + maxState*(s2 + maxState*e)] /= Z;
}
}
}
*logZ = log(Z);
/* Free memory */
mxFree(y);
}
|
// Copyright (c) 2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_VERSION_H
#define BITCOIN_VERSION_H
#include "clientversion.h"
#include <string>
//
// client versioning
//
static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD;
extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD;
extern const std::string CLIENT_DATE;
//
// network protocol versioning
//
static const int PROTOCOL_VERSION = 3000000;
// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 60001;
// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this
static const int CADDR_TIME_VERSION = 31402;
// only request blocks from nodes outside this range of versions
static const int NOBLKS_VERSION_START = 50000;
static const int NOBLKS_VERSION_END = 50002;
// BIP 0031, pong message, is enabled for all versions AFTER this one
static const int BIP0031_VERSION = 60000;
// "mempool" command, enhanced "getdata" behavior starts with this version:
static const int MEMPOOL_GD_VERSION = 60002;
#endif
|
//
// IXCollection.h
// Ignite Engine
//
// Created by Robert Walsh on 12/31/13.
//
/****************************************************************************
The MIT License (MIT)
Copyright (c) 2015 Apigee Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
//
#import "IXCellBasedControl.h"
@interface IXCollection : IXCellBasedControl
@end
|
//
// RootViewController.h
// Sample
//
// Created by Kirby Turner on 2/8/10.
// Copyright 2010 White Peak Software Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KTThumbsViewController.h"
#import "PhotoPickerController.h"
#import "Photos.h"
@class Photos;
@interface LocalImageRootViewController : KTThumbsViewController <PhotoPickerControllerDelegate, PhotosDelegate> {
PhotoPickerController *photoPicker_;
Photos *myPhotos_;
UIActivityIndicatorView *activityIndicatorView_;
UIWindow *window_;
}
- (id)initWithWindow:(UIWindow *)window;
@end
|
/*
* 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.
*/
/******************************************************************
iLBC Speech Coder ANSI-C Source Code
iLBC_test.c
******************************************************************/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "ilbc.h"
//#define JUNK_DATA
#ifdef JUNK_DATA
#define SEED_FILE "randseed.txt"
#endif
/*----------------------------------------------------------------*
* Main program to test iLBC encoding and decoding
*
* Usage:
* exefile_name.exe <infile> <bytefile> <outfile>
*
*---------------------------------------------------------------*/
int main(int argc, char* argv[])
{
FILE *ifileid,*efileid,*ofileid, *chfileid;
short encoded_data[55], data[240], speechType;
int len_int, mode;
short pli;
size_t len, readlen;
int blockcount = 0;
IlbcEncoderInstance *Enc_Inst;
IlbcDecoderInstance *Dec_Inst;
#ifdef JUNK_DATA
size_t i;
FILE *seedfile;
unsigned int random_seed = (unsigned int) time(NULL);//1196764538
#endif
/* Create structs */
WebRtcIlbcfix_EncoderCreate(&Enc_Inst);
WebRtcIlbcfix_DecoderCreate(&Dec_Inst);
/* get arguments and open files */
if (argc != 6 ) {
fprintf(stderr, "%s mode inputfile bytefile outputfile channelfile\n",
argv[0]);
fprintf(stderr, "Example:\n");
fprintf(stderr, "%s <30,20> in.pcm byte.dat out.pcm T30.0.dat\n", argv[0]);
exit(1);
}
mode=atoi(argv[1]);
if (mode != 20 && mode != 30) {
fprintf(stderr,"Wrong mode %s, must be 20, or 30\n", argv[1]);
exit(2);
}
if ( (ifileid=fopen(argv[2],"rb")) == NULL) {
fprintf(stderr,"Cannot open input file %s\n", argv[2]);
exit(2);}
if ( (efileid=fopen(argv[3],"wb")) == NULL) {
fprintf(stderr, "Cannot open channelfile file %s\n",
argv[3]); exit(3);}
if( (ofileid=fopen(argv[4],"wb")) == NULL) {
fprintf(stderr, "Cannot open output file %s\n",
argv[4]); exit(3);}
if ( (chfileid=fopen(argv[5],"rb")) == NULL) {
fprintf(stderr,"Cannot open channel file file %s\n", argv[5]);
exit(2);
}
/* print info */
fprintf(stderr, "\n");
fprintf(stderr,
"*---------------------------------------------------*\n");
fprintf(stderr,
"* *\n");
fprintf(stderr,
"* iLBCtest *\n");
fprintf(stderr,
"* *\n");
fprintf(stderr,
"* *\n");
fprintf(stderr,
"*---------------------------------------------------*\n");
#ifdef SPLIT_10MS
fprintf(stderr,"\n10ms split with raw mode: %2d ms\n", mode);
#else
fprintf(stderr,"\nMode : %2d ms\n", mode);
#endif
fprintf(stderr,"\nInput file : %s\n", argv[2]);
fprintf(stderr,"Coded file : %s\n", argv[3]);
fprintf(stderr,"Output file : %s\n\n", argv[4]);
fprintf(stderr,"Channel file : %s\n\n", argv[5]);
#ifdef JUNK_DATA
srand(random_seed);
if ( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL ) {
fprintf(stderr, "Error: Could not open file %s\n", SEED_FILE);
}
else {
fprintf(seedfile, "%u\n", random_seed);
fclose(seedfile);
}
#endif
/* Initialization */
WebRtcIlbcfix_EncoderInit(Enc_Inst, mode);
WebRtcIlbcfix_DecoderInit(Dec_Inst, mode);
/* loop over input blocks */
#ifdef SPLIT_10MS
readlen = 80;
#else
readlen = (size_t)(mode << 3);
#endif
while(fread(data, sizeof(short), readlen, ifileid) == readlen) {
blockcount++;
/* encoding */
fprintf(stderr, "--- Encoding block %i --- ",blockcount);
len_int=WebRtcIlbcfix_Encode(Enc_Inst, data, readlen, encoded_data);
if (len_int < 0) {
fprintf(stderr, "Error encoding\n");
exit(0);
}
len = (size_t)len_int;
fprintf(stderr, "\r");
#ifdef JUNK_DATA
for ( i = 0; i < len; i++) {
encoded_data[i] = (short) (encoded_data[i] + (short) rand());
}
#endif
/* write byte file */
if(len != 0){ //len may be 0 in 10ms split case
fwrite(encoded_data,1,len,efileid);
/* get channel data if provided */
if (argc==6) {
if (fread(&pli, sizeof(int16_t), 1, chfileid)) {
if ((pli!=0)&&(pli!=1)) {
fprintf(stderr, "Error in channel file\n");
exit(0);
}
if (pli==0) {
/* Packet loss -> remove info from frame */
memset(encoded_data, 0, sizeof(int16_t)*25);
}
} else {
fprintf(stderr, "Error. Channel file too short\n");
exit(0);
}
} else {
pli=1;
}
/* decoding */
fprintf(stderr, "--- Decoding block %i --- ",blockcount);
if (pli==1) {
len_int = WebRtcIlbcfix_Decode(Dec_Inst, encoded_data, len, data,
&speechType);
if (len_int < 0) {
fprintf(stderr, "Error decoding\n");
exit(0);
}
len = (size_t)len_int;
} else {
len=WebRtcIlbcfix_DecodePlc(Dec_Inst, data, 1);
}
fprintf(stderr, "\r");
/* write output file */
fwrite(data,sizeof(short),len,ofileid);
}
}
#ifdef JUNK_DATA
if ( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL ) {
fprintf(stderr, "Error: Could not open file %s\n", SEED_FILE);
}
else {
fprintf(seedfile, "ok\n\n");
fclose(seedfile);
}
#endif
/* free structs */
WebRtcIlbcfix_EncoderFree(Enc_Inst);
WebRtcIlbcfix_DecoderFree(Dec_Inst);
/* close files */
fclose(ifileid);
fclose(efileid);
fclose(ofileid);
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGEOSHAPE_P_H
#define QGEOSHAPE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/QSharedData>
#include "qgeoshape.h"
QT_BEGIN_NAMESPACE
class QGeoShapePrivate : public QSharedData
{
public:
explicit QGeoShapePrivate(QGeoShape::ShapeType type);
virtual ~QGeoShapePrivate();
virtual bool isValid() const = 0;
virtual bool isEmpty() const = 0;
virtual bool contains(const QGeoCoordinate &coordinate) const = 0;
virtual void extendShape(const QGeoCoordinate &coordinate) = 0;
virtual QGeoShapePrivate *clone() const = 0;
virtual bool operator==(const QGeoShapePrivate &other) const;
QGeoShape::ShapeType type;
};
// don't use the copy constructor when detaching from a QSharedDataPointer, use virtual clone()
// call instead.
template <>
Q_INLINE_TEMPLATE QGeoShapePrivate *QSharedDataPointer<QGeoShapePrivate>::clone()
{
return d->clone();
}
QT_END_NAMESPACE
#endif
|
/* Copyright (c) 2013-2022 Mahmoud Fayed <msfclipper@yahoo.com> */
#include "ring.h"
/* Jump Functions */
void ring_vm_jump ( VM *pVM )
{
RING_VM_JUMP ;
}
void ring_vm_jumpzero ( VM *pVM )
{
List *pList ;
Item *pItem ;
if ( RING_VM_STACK_ISNUMBER ) {
if ( RING_VM_STACK_READN == 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_ISSTRING ) {
if ( strcmp(RING_VM_STACK_READC,"") == 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_ISPOINTER ) {
if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_VARIABLE ) {
pList = (List *) RING_VM_STACK_READP ;
pList = ring_list_getlist(pList,RING_VAR_VALUE) ;
if ( ring_list_getsize(pList) == 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_LISTITEM ) {
pItem = (Item *) RING_VM_STACK_READP ;
pList = ring_item_getlist(pItem) ;
if ( ring_list_getsize(pList) == 0 ) {
ring_vm_jump(pVM);
}
}
}
RING_VM_STACK_POP ;
}
void ring_vm_jumpfor ( VM *pVM )
{
double nNum1,nNum2,nNum3 ;
/* Check Data */
if ( RING_VM_STACK_ISNUMBER ) {
nNum1 = RING_VM_STACK_READN ;
RING_VM_STACK_POP ;
}
else if ( RING_VM_STACK_ISSTRING ) {
nNum1 = ring_vm_stringtonum(pVM,RING_VM_STACK_READC);
RING_VM_STACK_POP ;
}
else {
ring_vm_error(pVM,RING_VM_ERROR_FORLOOPDATATYPE);
return ;
}
nNum2 = ring_list_getdouble(pVM->aForStep,ring_list_getsize(pVM->aForStep));
/* Check Data */
if ( RING_VM_STACK_ISNUMBER ) {
nNum3 = RING_VM_STACK_READN ;
RING_VM_STACK_POP ;
}
else if ( RING_VM_STACK_ISSTRING ) {
nNum3 = ring_vm_stringtonum(pVM,RING_VM_STACK_READC);
RING_VM_STACK_POP ;
}
else {
ring_vm_error(pVM,RING_VM_ERROR_FORLOOPDATATYPE);
return ;
}
/*
** nNum2 = Step value that can be positive or negative
** nNum1 = Items Count , nNum3 = Index
*/
if ( nNum2 < 0 ) {
if ( ! ( nNum3 >= nNum1 ) ) {
ring_vm_jump(pVM);
}
}
else {
if ( ! ( nNum3 <= nNum1 ) ) {
ring_vm_jump(pVM);
}
}
}
void ring_vm_jumpone ( VM *pVM )
{
List *pList ;
Item *pItem ;
if ( RING_VM_STACK_ISNUMBER ) {
if ( RING_VM_STACK_READN != 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_ISSTRING ) {
if ( strcmp(RING_VM_STACK_READC,"") != 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_ISPOINTER ) {
if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_VARIABLE ) {
pList = (List *) RING_VM_STACK_READP ;
pList = ring_list_getlist(pList,RING_VAR_VALUE) ;
if ( ring_list_getsize(pList) != 0 ) {
ring_vm_jump(pVM);
}
}
else if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_LISTITEM ) {
pItem = (Item *) RING_VM_STACK_READP ;
pList = ring_item_getlist(pItem) ;
if ( ring_list_getsize(pList) != 0 ) {
ring_vm_jump(pVM);
}
}
}
RING_VM_STACK_POP ;
}
void ring_vm_jumpone2 ( VM *pVM )
{
List *pList ;
Item *pItem ;
/* Add 1, required for jump in many 'OR' in conditions */
if ( RING_VM_STACK_ISNUMBER ) {
if ( RING_VM_STACK_READN != 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_ISSTRING ) {
if ( strcmp(RING_VM_STACK_READC,"") != 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_ISPOINTER ) {
if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_VARIABLE ) {
pList = (List *) RING_VM_STACK_READP ;
pList = ring_list_getlist(pList,RING_VAR_VALUE) ;
if ( ring_list_getsize(pList) != 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_LISTITEM ) {
pItem = (Item *) RING_VM_STACK_READP ;
pList = ring_item_getlist(pItem) ;
if ( ring_list_getsize(pList) != 0 ) {
ring_vm_jump(pVM);
return ;
}
}
}
RING_VM_STACK_POP ;
RING_VM_STACK_PUSHNVALUE(0);
}
void ring_vm_jumpzero2 ( VM *pVM )
{
List *pList ;
Item *pItem ;
/* Add 1, required for jump in many 'AND' in conditions */
if ( RING_VM_STACK_ISNUMBER ) {
if ( RING_VM_STACK_READN == 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_ISSTRING ) {
if ( strcmp(RING_VM_STACK_READC,"") == 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_ISPOINTER ) {
if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_VARIABLE ) {
pList = (List *) RING_VM_STACK_READP ;
pList = ring_list_getlist(pList,RING_VAR_VALUE) ;
if ( ring_list_getsize(pList) == 0 ) {
ring_vm_jump(pVM);
return ;
}
}
else if ( RING_VM_STACK_OBJTYPE == RING_OBJTYPE_LISTITEM ) {
pItem = (Item *) RING_VM_STACK_READP ;
pList = ring_item_getlist(pItem) ;
if ( ring_list_getsize(pList) == 0 ) {
ring_vm_jump(pVM);
return ;
}
}
}
RING_VM_STACK_POP ;
RING_VM_STACK_PUSHNVALUE(1);
}
|
//
// TKDataFormNamePhoneEditor.h
// TelerikUI
//
// Copyright © 2015 Telerik. All rights reserved.
//
#import "TKDataFormTextFieldEditor.h"
@interface TKDataFormNamePhoneEditor : TKDataFormTextFieldEditor
@end
|
#include "builtin.h"
#include "cache.h"
#include "refs.h"
#include "parse-options.h"
static const char * const git_symbolic_ref_usage[] = {
N_("git symbolic-ref [<options>] <name> [<ref>]"),
N_("git symbolic-ref -d [-q] <name>"),
NULL
};
static int check_symref(const char *HEAD, int quiet, int shorten, int print)
{
unsigned char sha1[20];
int flag;
const char *refname = resolve_ref_unsafe(HEAD, 0, sha1, &flag);
if (!refname)
die("No such ref: %s", HEAD);
else if (!(flag & REF_ISSYMREF)) {
if (!quiet)
die("ref %s is not a symbolic ref", HEAD);
else
return 1;
}
if (print) {
if (shorten)
refname = shorten_unambiguous_ref(refname, 0);
puts(refname);
}
return 0;
}
int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
{
int quiet = 0, delete = 0, shorten = 0, ret = 0;
const char *msg = NULL;
struct option options[] = {
OPT__QUIET(&quiet,
N_("suppress error message for non-symbolic (detached) refs")),
OPT_BOOL('d', "delete", &delete, N_("delete symbolic ref")),
OPT_BOOL(0, "short", &shorten, N_("shorten ref output")),
OPT_STRING('m', NULL, &msg, N_("reason"), N_("reason of the update")),
OPT_END(),
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_symbolic_ref_usage, 0);
if (msg && !*msg)
die("Refusing to perform update with empty message");
if (delete) {
if (argc != 1)
usage_with_options(git_symbolic_ref_usage, options);
ret = check_symref(argv[0], 1, 0, 0);
if (ret)
die("Cannot delete %s, not a symbolic ref", argv[0]);
if (!strcmp(argv[0], "HEAD"))
die("deleting '%s' is not allowed", argv[0]);
return delete_ref(argv[0], NULL, REF_NODEREF);
}
switch (argc) {
case 1:
ret = check_symref(argv[0], quiet, shorten, 1);
break;
case 2:
if (!strcmp(argv[0], "HEAD") &&
!starts_with(argv[1], "refs/"))
die("Refusing to point HEAD outside of refs/");
ret = !!create_symref(argv[0], argv[1], msg);
break;
default:
usage_with_options(git_symbolic_ref_usage, options);
}
return ret;
}
|
/*
* This file is part of the OregonCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OREGON_FORMULAS_H
#define OREGON_FORMULAS_H
#include "World.h"
namespace Oregon
{
namespace Honor
{
inline uint32 hk_honor_at_level(uint32 level, uint32 count = 1)
{
return (uint32)ceil(count * (-0.53177f + 0.59357f * exp((level + 23.54042f) / 26.07859f)));
}
}
namespace XP
{
enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY };
inline uint32 GetGrayLevel(uint32 pl_level)
{
if (pl_level <= 5)
return 0;
else if (pl_level <= 39)
return pl_level - 5 - pl_level / 10;
else if (pl_level <= 59)
return pl_level - 1 - pl_level / 5;
else
return pl_level - 9;
}
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
{
if (mob_level >= pl_level + 5)
return RED;
else if (mob_level >= pl_level + 3)
return ORANGE;
else if (mob_level >= pl_level - 2)
return YELLOW;
else if (mob_level > GetGrayLevel(pl_level))
return GREEN;
else
return GRAY;
}
inline uint32 GetZeroDifference(uint32 pl_level)
{
if (pl_level < 8) return 5;
if (pl_level < 10) return 6;
if (pl_level < 12) return 7;
if (pl_level < 16) return 8;
if (pl_level < 20) return 9;
if (pl_level < 30) return 11;
if (pl_level < 40) return 12;
if (pl_level < 45) return 13;
if (pl_level < 50) return 14;
if (pl_level < 55) return 15;
if (pl_level < 60) return 16;
return 17;
}
inline uint32 BaseGain(uint32 pl_level, uint32 mob_level, ContentLevels content)
{
const uint32 nBaseExp = content == CONTENT_1_60 ? 45 : 235;
if (mob_level >= pl_level)
{
uint32 nLevelDiff = mob_level - pl_level;
if (nLevelDiff > 4)
nLevelDiff = 4;
return ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2;
}
else
{
uint32 gray_level = GetGrayLevel(pl_level);
if (mob_level > gray_level)
{
uint32 ZD = GetZeroDifference(pl_level);
return (pl_level * 5 + nBaseExp) * (ZD + mob_level - pl_level) / ZD;
}
return 0;
}
}
inline uint32 Gain(Player* pl, Unit* u)
{
if (u->GetTypeId() == TYPEID_UNIT && (
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
(((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ||
((Creature*)u)->GetCreatureTemplate()->type == CREATURE_TYPE_CRITTER))
return 0;
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
if (xp_gain == 0)
return 0;
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
xp_gain *= 2;
return (uint32)(xp_gain * sWorld.getRate(RATE_XP_KILL));
}
inline uint32 Gain(Pet* pet, Unit* u)
{
if (u->GetTypeId() == TYPEID_UNIT && (
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
(((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)))
return 0;
uint32 xp_gain = BaseGain(pet->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
if (xp_gain == 0)
return 0;
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
xp_gain *= 2;
return (uint32)(xp_gain * sWorld.getRate(RATE_XP_KILL));
}
inline uint32 xp_Diff(uint32 lvl)
{
if (lvl < 29)
return 0;
if (lvl == 29)
return 1;
if (lvl == 30)
return 3;
if (lvl == 31)
return 6;
else
return (5 * (lvl - 30));
}
inline uint32 mxp(uint32 lvl)
{
if (lvl < 60)
return (45 + (5 * lvl));
else
return (235 + (5 * lvl));
}
inline uint32 xp_to_level(uint32 lvl)
{
uint32 xp = 0;
if (lvl < 60)
xp = (8 * lvl + xp_Diff(lvl)) * mxp(lvl);
else if (lvl == 60)
xp = (155 + mxp(lvl) * (1344 - 70 - ((69 - lvl) * (7 + (69 - lvl) * 8 - 1) / 2)));
else if (lvl < 70)
xp = (155 + mxp(lvl) * (1344 - ((69 - lvl) * (7 + (69 - lvl) * 8 - 1) / 2)));
else
{
// level higher than 70 is not supported
xp = (uint32)(779700 * (pow(sWorld.getRate(RATE_XP_PAST_70), (int32)lvl - 69)));
return ((xp < 0x7fffffff) ? xp : 0x7fffffff);
}
// The XP to Level is always rounded to the nearest 100 points (50 rounded to high).
xp = ((xp + 50) / 100) * 100; // use additional () for prevent free association operations in C++
if ((lvl > 10) && (lvl < 60)) // compute discount added in 2.3.x
{
uint32 discount = (lvl < 28) ? (lvl - 10) : 18;
xp = (xp * (100 - discount)) / 100; // apply discount
xp = (xp / 100) * 100; // floor to hundreds
}
return xp;
}
inline float xp_in_group_rate(uint32 count, bool isRaid)
{
if (isRaid)
{
// FIX ME: must apply decrease modifiers dependent from raid size
return 1.0f;
}
else
{
switch (count)
{
case 0:
case 1:
case 2:
return 1.0f;
case 3:
return 1.166f;
case 4:
return 1.3f;
case 5:
default:
return 1.4f;
}
}
}
}
}
#endif
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef ANGLE_CLASS
AngleStyle(quartic,AngleQuartic)
#else
#ifndef LMP_ANGLE_QUARTIC_H
#define LMP_ANGLE_QUARTIC_H
#include "angle.h"
namespace LAMMPS_NS {
class AngleQuartic : public Angle {
public:
AngleQuartic(class LAMMPS *);
virtual ~AngleQuartic();
virtual void compute(int, int);
void coeff(int, char **);
double equilibrium_angle(int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, int, int, int);
protected:
double *k2, *k3, *k4, *theta0;
void allocate();
};
}
#endif
#endif
|
/* C type extensions */
typedef unsigned char uint8_t;
typedef char int8_t;
typedef unsigned short int uint16_t;
typedef short int int16_t;
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef unsigned long size_t;
typedef void (*funcptr)();
/* disable interrupts, return previous int status / enable interrupts */
#define _di() _interrupt_set(0)
#define _ei(S) _interrupt_set(S)
/* configure, read and write board pins */
#define _port_setup(a, opts) *(volatile uint32_t *)(a) = (opts)
#define _port_read(a) (*(volatile uint32_t *)(a))
#define _port_write(a, v) *(volatile uint32_t *)(a) = (v)
/* memory address map */
#define ADDR_ROM_BASE 0x00000000
#define ADDR_RAM_BASE 0x40000000
#define ADDR_RESERVED_BASE 0x80000000
/* peripheral addresses and irq lines */
#define PERIPHERALS_BASE 0xf0000000
#define IRQ_VECTOR (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x000))
#define IRQ_CAUSE (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x010))
#define IRQ_MASK (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x020))
#define IRQ_STATUS (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x030))
#define IRQ_EPC (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x040))
#define COUNTER (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x050))
#define COMPARE (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x060))
#define COMPARE2 (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x070))
#define EXTIO_IN (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x080))
#define EXTIO_OUT (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x090))
#define EXTIO_DIR (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0a0))
#define DEBUG_ADDR (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0d0))
#define UART (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0e0))
#define UART_DIVISOR (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0f0))
#define IRQ_COUNTER 0x00000001
#define IRQ_COUNTER_NOT 0x00000002
#define IRQ_COUNTER2 0x00000004
#define IRQ_COUNTER2_NOT 0x00000008
#define IRQ_COMPARE 0x00000010
#define IRQ_COMPARE2 0x00000020
#define IRQ_UART_READ_AVAILABLE 0x00000040
#define IRQ_UART_WRITE_AVAILABLE 0x00000080
#define EXT_IRQ0 0x00010000
#define EXT_IRQ1 0x00020000
#define EXT_IRQ2 0x00040000
#define EXT_IRQ3 0x00080000
#define EXT_IRQ4 0x00100000
#define EXT_IRQ5 0x00200000
#define EXT_IRQ6 0x00400000
#define EXT_IRQ7 0x00800000
#define EXT_IRQ0_NOT 0x01000000
#define EXT_IRQ1_NOT 0x02000000
#define EXT_IRQ2_NOT 0x04000000
#define EXT_IRQ3_NOT 0x08000000
#define EXT_IRQ4_NOT 0x10000000
#define EXT_IRQ5_NOT 0x20000000
#define EXT_IRQ6_NOT 0x40000000
#define EXT_IRQ7_NOT 0x80000000
/* SPI read / write ports */
#define SPI_INPORT 0xf0000080
#define SPI_OUTPORT 0xf0000090
/* SPI interface - EXTIO_OUT */
#define SPI_SCK 0x01
#define SPI_MOSI 0x02
#define SPI_CS0 0x04
#define SPI_CS1 0x08
#define SPI_CS2 0x10
#define SPI_CS3 0x20
/* SPI interface - EXTIO_IN */
#define SPI_MISO 0x02
#define SPI_IRQ0 0x04
#define SPI_IRQ1 0x08
#define SPI_IRQ2 0x10
#define SPI_IRQ3 0x20
/* hardware dependent stuff */
#define STACK_MAGIC 0xb00bb00b
typedef uint32_t context[20];
int32_t _interrupt_set(int32_t s);
void _irq_mask_set(uint32_t mask);
uint32_t _irq_mask_clr(uint32_t mask);
void _restoreexec(context env, int32_t val, int32_t ctask);
/* hardware dependent C library stuff */
int32_t setjmp(context env);
void longjmp(context env, int32_t val);
void putchar(int32_t value);
int32_t kbhit(void);
int32_t getchar(void);
void dputchar(int32_t value);
/* hardware dependent stuff */
void delay_ms(uint32_t msec);
void delay_us(uint32_t usec);
void led_set(uint16_t led, uint8_t val);
uint8_t button_get(uint16_t btn);
uint8_t switch_get(uint16_t sw);
/* hardware dependent basic kernel stuff */
void _hardware_init(void);
void _vm_init(void);
void _task_init(void);
void _sched_init(void);
void _timer_init(void);
void _irq_init(void);
void _device_init(void);
void _set_task_sp(uint16_t task, size_t stack);
size_t _get_task_sp(uint16_t task);
void _set_task_tp(uint16_t task, void (*entry)());
void *_get_task_tp(uint16_t task);
void _timer_reset(void);
void _cpu_idle(void);
uint32_t _readcounter(void);
uint64_t _read_us(void);
void _panic(void);
|
/*
* Renamed dm_getopt because MySQL keeps putting things in my_ space.
*
* getopt.h - cpp wrapper for dm_getopt to make it look like getopt.
* Copyright 1997, 2000, 2001, 2002, Benjamin Sittler
*
* 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 USE_DM_GETOPT
# include <getopt.h>
#endif
#ifdef USE_DM_GETOPT
# ifndef DM_GETOPT_H
/* Our include guard first. */
# define DM_GETOPT_H
/* Try to kill the system getopt.h */
# define _GETOPT_DECLARED
# define _GETOPT_H
# define GETOPT_H
# undef getopt
# define getopt dm_getopt
# undef getopt_long
# define getopt_long dm_getopt_long
# undef getopt_long_only
# define getopt_long_only dm_getopt_long_only
# undef _getopt_internal
# define _getopt_internal _dm_getopt_internal
# undef opterr
# define opterr dm_opterr
# undef optind
# define optind dm_optind
# undef optopt
# define optopt dm_optopt
# undef optarg
# define optarg dm_optarg
# ifdef __cplusplus
extern "C" {
# endif
/* UNIX-style short-argument parser */
extern int dm_getopt(int argc, char * argv[], const char *opts);
extern int dm_optind, dm_opterr, dm_optopt;
extern char *dm_optarg;
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
/* human-readable values for has_arg */
# undef no_argument
# define no_argument 0
# undef required_argument
# define required_argument 1
# undef optional_argument
# define optional_argument 2
/* GNU-style long-argument parsers */
extern int dm_getopt_long(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind);
extern int dm_getopt_long_only(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind);
extern int _dm_getopt_internal(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
# ifdef __cplusplus
}
# endif
# endif /* DM_GETOPT_H */
#endif /* USE_DM_GETOPT */
|
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
*
* Copyright (C) 2009-2010 TrinityZero <http://www.trinityzero.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_SINGLETON_H
#define TRINITY_SINGLETON_H
/**
* @brief class Singleton
*/
#include "CreationPolicy.h"
#include "ThreadingModel.h"
#include "ObjectLifeTime.h"
namespace Trinity
{
template
<
typename T,
class ThreadingModel = Trinity::SingleThreaded<T>,
class CreatePolicy = Trinity::OperatorNew<T>,
class LifeTimePolicy = Trinity::ObjectLifeTime<T>
>
class TRINITY_DLL_DECL Singleton
{
public:
static T& Instance();
protected:
Singleton() {};
private:
// Prohibited actions...this does not prevent hijacking.
Singleton(const Singleton &);
Singleton& operator=(const Singleton &);
// Singleton Helpers
static void DestroySingleton();
// data structure
typedef typename ThreadingModel::Lock Guard;
static T *si_instance;
static bool si_destroyed;
};
}
#endif
|
/* Copyright (C) 2005-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
/* Consider moving to syscalls.list. */
/* Read the contents of the symbolic link PATH relative to FD into no
more than LEN bytes of BUF. */
ssize_t
readlinkat (fd, path, buf, len)
int fd;
const char *path;
char *buf;
size_t len;
{
return INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
}
libc_hidden_def (readlinkat)
|
/*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*
* The MSM peripherals are spread all over across 768MB of physical
* space, which makes just having a simple IO_ADDRESS macro to slide
* them into the right virtual location rough. Instead, we will
* provide a master phys->virt mapping for peripherals here.
*
*/
#ifndef __ASM_ARCH_MSM_IOMAP_8X50_H
#define __ASM_ARCH_MSM_IOMAP_8X50_H
/* Physical base address and size of peripherals.
* Ordered by the virtual base addresses they will be mapped at.
*
* MSM_VIC_BASE must be an value that can be loaded via a "mov"
* instruction, otherwise entry-macro.S will not compile.
*
* If you add or remove entries here, you'll want to edit the
* msm_io_desc array in arch/arm/mach-msm/io.c to reflect your
* changes.
*
*/
#define MSM_VIC_BASE IOMEM(0xF8000000)
#define MSM_VIC_PHYS 0xAC000000
#define MSM_VIC_SIZE SZ_4K
#define MSM_CSR_BASE IOMEM(0xF8001000)
#define MSM_CSR_PHYS 0xAC100000
#define MSM_CSR_SIZE SZ_4K
#define MSM_TMR_PHYS MSM_CSR_PHYS
#define MSM_TMR_BASE MSM_CSR_BASE
#define MSM_TMR_SIZE SZ_4K
#define MSM_GPIO1_BASE IOMEM(0xF8003000)
#define MSM_GPIO1_PHYS 0xA9000000
#define MSM_GPIO1_SIZE SZ_4K
#define MSM_GPIO2_BASE IOMEM(0xF8004000)
#define MSM_GPIO2_PHYS 0xA9100000
#define MSM_GPIO2_SIZE SZ_4K
#define MSM_CLK_CTL_BASE IOMEM(0xF8005000)
#define MSM_CLK_CTL_PHYS 0xA8600000
#define MSM_CLK_CTL_SIZE SZ_4K
#define MSM_SIRC_BASE IOMEM(0xF8006000)
#define MSM_SIRC_PHYS 0xAC200000
#define MSM_SIRC_SIZE SZ_4K
#define MSM_SCPLL_BASE IOMEM(0xF8007000)
#define MSM_SCPLL_PHYS 0xA8800000
#define MSM_SCPLL_SIZE SZ_4K
#define MSM_TCSR_BASE IOMEM(0xF8008000)
#define MSM_TCSR_PHYS 0xA8700000
#define MSM_TCSR_SIZE SZ_4K
#define MSM_SHARED_RAM_BASE IOMEM(0xF8100000)
#define MSM_SHARED_RAM_PHYS 0x00100000
#define MSM_SHARED_RAM_SIZE SZ_1M
#define MSM_UART1_PHYS 0xA9A00000
#define MSM_UART1_SIZE SZ_4K
#define MSM_UART2_PHYS 0xA9B00000
#define MSM_UART2_SIZE SZ_4K
#define MSM_UART3_PHYS 0xA9C00000
#define MSM_UART3_SIZE SZ_4K
#define MSM_HSUSB_PHYS 0xA0800000
#define MSM_HSUSB_SIZE SZ_4K
#define MSM_VFE_PHYS 0xA0F00000
#define MSM_VFE_SIZE SZ_1M
#define MSM_MDC_BASE IOMEM(0xF8200000)
#define MSM_MDC_PHYS 0xAA500000
#define MSM_MDC_SIZE SZ_1M
#define MSM_AD5_BASE IOMEM(0xF8300000)
#define MSM_AD5_PHYS 0xAC000000
#define MSM_AD5_SIZE (SZ_1M*13)
#define MSM_GPIOCFG2_BASE IOMEM(0xF9005000)
#define MSM_GPIOCFG2_PHYS 0xA8F00000
#define MSM_GPIOCFG2_SIZE SZ_4K
#define MSM_RAM_CONSOLE_BASE IOMEM(0xF9100000)
#define MSM_RAM_CONSOLE_PHYS 0x2FFC0000
#define MSM_RAM_CONSOLE_SIZE 0x00040000
#endif
|
/* COVERAGE: unshare */
#define _GNU_SOURCE
#include <sched.h>
int main()
{
unshare(CLONE_FILES);
//staptest// unshare (CLONE_FILES) = 0
unshare(-1);
//staptest// unshare (CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_PTRACE|CLONE_VFORK|CLONE_PARENT|CLONE_THREAD|CLONE_NEWNS|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID[^)]+) = -NNNN
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QFUNCTIONS_VXWORKS_H
#define QFUNCTIONS_VXWORKS_H
#ifdef Q_OS_VXWORKS
#include <unistd.h>
#include <pthread.h>
#include <dirent.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/times.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <netinet/in.h>
#ifndef QT_NO_IPV6IFNAME
#include <net/if.h>
#endif
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_CORE_LIB
QT_MODULE(Core)
#endif
QT_END_NAMESPACE
QT_END_HEADER
#ifndef RTLD_LOCAL
#define RTLD_LOCAL 0
#endif
#ifndef NSIG
#define NSIG _NSIGS
#endif
#ifdef __cplusplus
extern "C" {
#endif
// isascii is missing (sometimes!!)
#ifndef isascii
inline int isascii(int c) { return (c & 0x7f); }
#endif
// no lfind() - used by the TIF image format
void *lfind(const void* key, const void* base, size_t* elements, size_t size,
int (*compare)(const void*, const void*));
// no rand_r(), but rand()
// NOTE: this implementation is wrong for multi threaded applications,
// but there is no way to get it right on VxWorks (in kernel mode)
int rand_r(unsigned int * /*seedp*/);
// no usleep() support
int usleep(unsigned int);
// gettimeofday() is declared, but is missing from the library.
// It IS however defined in the Curtis-Wright X11 libraries, so
// we have to make the symbol 'weak'
int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak));
// neither getpagesize() or sysconf(_SC_PAGESIZE) are available
int getpagesize();
// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h)
int symlink(const char *, const char *);
ssize_t readlink(const char *, char *, size_t);
// there's no truncate(), but ftruncate() support...
int truncate(const char *path, off_t length);
// VxWorks doesn't know about passwd & friends.
// in order to avoid patching the unix fs path everywhere
// we introduce some dummy functions that simulate a single
// 'root' user on the system.
uid_t getuid();
gid_t getgid();
uid_t geteuid();
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user ID */
gid_t pw_gid; /* group ID */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
};
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
};
struct passwd *getpwuid(uid_t uid);
struct group *getgrgid(gid_t gid);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // Q_OS_VXWORKS
#endif // QFUNCTIONS_VXWORKS_H
|
#ifndef UNCALI_ACCHUB_H
#define UNCALI_ACCHUB_H
#include <linux/ioctl.h>
#endif
|
#ifndef __INPUT_FORMATTER_LOCAL_H_INCLUDED__
#define __INPUT_FORMATTER_LOCAL_H_INCLUDED__
#include "input_formatter_global.h"
#include "isp.h" /* ISP_VEC_ALIGN */
typedef struct input_formatter_state_s input_formatter_state_t;
#define HIVE_IF_FSM_SYNC_STATUS 0x100
#define HIVE_IF_FSM_SYNC_COUNTER 0x104
#define HIVE_IF_FSM_CROP_STATUS 0x108
#define HIVE_IF_FSM_CROP_LINE_COUNTER 0x10C
#define HIVE_IF_FSM_CROP_PIXEL_COUNTER 0x110
#define HIVE_IF_FSM_DEINTERLEAVING_IDX 0x114
#define HIVE_IF_FSM_DECIMATION_H_COUNTER 0x118
#define HIVE_IF_FSM_DECIMATION_V_COUNTER 0x11C
#define HIVE_IF_FSM_DECIMATION_BLOCK_V_COUNTER 0x120
#define HIVE_IF_FSM_PADDING_STATUS 0x124
#define HIVE_IF_FSM_PADDING_ELEMENT_COUNTER 0x128
#define HIVE_IF_FSM_VECTOR_SUPPORT_ERROR 0x12C
#define HIVE_IF_FSM_VECTOR_SUPPORT_BUFF_FULL 0x130
#define HIVE_IF_FSM_VECTOR_SUPPORT 0x134
#define HIVE_IF_FIFO_SENSOR_STATUS 0x138
struct input_formatter_state_s {
/* int reset; */
int start_line;
int start_column;
int cropped_height;
int cropped_width;
int ver_decimation;
int hor_decimation;
int deinterleaving;
int left_padding;
int eol_offset;
int vmem_start_address;
int vmem_end_address;
int vmem_increment;
int is_yuv420;
int vsync_active_low;
int hsync_active_low;
int allow_fifo_overflow;
int fsm_sync_status;
int fsm_sync_counter;
int fsm_crop_status;
int fsm_crop_line_counter;
int fsm_crop_pixel_counter;
int fsm_deinterleaving_index;
int fsm_dec_h_counter;
int fsm_dec_v_counter;
int fsm_dec_block_v_counter;
int fsm_padding_status;
int fsm_padding_elem_counter;
int fsm_vector_support_error;
int fsm_vector_buffer_full;
int vector_support;
int sensor_data_lost;
};
static const unsigned int input_formatter_alignment[N_INPUT_FORMATTER_ID] = {
ISP_VEC_ALIGN, ISP_VEC_ALIGN, HIVE_ISP_CTRL_DATA_BYTES};
#endif /* __INPUT_FORMATTER_LOCAL_H_INCLUDED__ */
|
/***************************************************************************
*
* $Id: lexer.h 152 2010-10-10 14:17:37Z Michael.McTernan $
*
* Extra lexer/scanner API functions.
* Copyright (C) 2010 Michael C McTernan, Michael.McTernan.2001@cs.bris.ac.uk
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
***************************************************************************/
#ifndef MSCGEN_LEXER_H
#define MSCGEN_LEXER_H
/*****************************************************************************
* Header Files
*****************************************************************************/
#include "mscgen_bool.h"
/*****************************************************************************
* Preprocessor Macros & Constants
*****************************************************************************/
/*****************************************************************************
* Typedefs
*****************************************************************************/
/*****************************************************************************
* Global Variable Declarations
*****************************************************************************/
/*****************************************************************************
* Global Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Boolean lex_getutf8(void);
#ifdef __cplusplus
}
#endif
unsigned long lex_getlinenum(void);
char *lex_getline(void);
void lex_destroy(void);
void lex_resetparser(void);
#endif /* MSCGEN_LEXER_H */
/* END OF FILE */
|
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/string.h>
#include "../gpio/gpio.h"
#include "base_gpio_8972b.h"
#ifdef CONFIG_RTK_VOIP_GPIO_IPP_8972B_V00
#define IPPHONE_PIN_HOOK GPIO_ID(GPIO_PORT_E,6) //input
#define INTERRUPT_HOOK
#else
#define IPPHONE_PIN_HOOK GPIO_ID(GPIO_PORT_B,4) //input
//#define INTERRUPT_HOOK
#endif
/************************* IP phone hook detection ****************************************/
void ipphone_hook_interrupt( int enable )
{
#if defined( IPPHONE_PIN_HOOK ) && defined( INTERRUPT_HOOK )
const enum GPIO_INTERRUPT_TYPE int_type = ( enable ? GPIO_INT_BOTH_EDGE : GPIO_INT_DISABLE );
_rtl8972B_initGpioPin( IPPHONE_PIN_HOOK, GPIO_CONT_GPIO, GPIO_DIR_IN, int_type );
#endif
}
void init_ipphone_hook_detect( void )
{
#ifdef IPPHONE_PIN_HOOK
#ifdef INTERRUPT_HOOK
ipphone_hook_interrupt( 1 );
#else
_rtl8972B_initGpioPin( IPPHONE_PIN_HOOK, GPIO_CONT_GPIO, GPIO_DIR_IN, GPIO_INT_DISABLE );
#endif
#endif
}
//return value 0->on-hook, 1->off-hook
unsigned char iphone_hook_detect( void )
{
uint32 data;
#ifdef CONFIG_RTK_VOIP_GPIO_IPP_8972B_V00
#ifdef IPPHONE_PIN_HOOK
_rtl8972B_getGpioDataBit( IPPHONE_PIN_HOOK, &data );
#else
extern unsigned char ALC5621_GetGpioStatus( void );
data = ( ALC5621_GetGpioStatus() ? 1 : 0 );
#endif
#else
_rtl8972B_getGpioDataBit( IPPHONE_PIN_HOOK, &data );
#endif
//printk( "HOOK:%d\n", data );
#if 0 // debug use only
return ( unsigned char )data;
#else
return ( unsigned char )( !data );
#endif
}
|
/* Copyright (c) 2000, 2001, 2005-2007 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
#include "myisamdef.h"
/* Read first row through a specfic key */
int mi_rfirst(MI_INFO *info, uchar *buf, int inx)
{
DBUG_ENTER("mi_rfirst");
info->lastpos= HA_OFFSET_ERROR;
info->update|= HA_STATE_PREV_FOUND;
DBUG_RETURN(mi_rnext(info,buf,inx));
} /* mi_rfirst */
|
/*
* linux/arch/arm/mach-pxa/leds-trizeps4.c
*
* Author: Jürgen Schindele
* Created: 20 02, 2006
* Copyright: Jürgen Schindele
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/init.h>
#include <asm/hardware.h>
#include <asm/system.h>
#include <asm/types.h>
#include <asm/leds.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/pxa2xx-gpio.h>
#include <asm/arch/trizeps4.h>
#include "leds.h"
#define LED_STATE_ENABLED 1
#define LED_STATE_CLAIMED 2
#define SYS_BUSY 0x01
#define HEARTBEAT 0x02
#define BLINK 0x04
static unsigned int led_state;
static unsigned int hw_led_state;
void trizeps4_leds_event(led_event_t evt)
{
unsigned long flags;
local_irq_save(flags);
switch (evt) {
case led_start:
hw_led_state = 0;
pxa_gpio_mode( GPIO_SYS_BUSY_LED | GPIO_OUT); /* LED1 */
pxa_gpio_mode( GPIO_HEARTBEAT_LED | GPIO_OUT); /* LED2 */
led_state = LED_STATE_ENABLED;
break;
case led_stop:
led_state &= ~LED_STATE_ENABLED;
break;
case led_claim:
led_state |= LED_STATE_CLAIMED;
hw_led_state = 0;
break;
case led_release:
led_state &= ~LED_STATE_CLAIMED;
hw_led_state = 0;
break;
#ifdef CONFIG_LEDS_TIMER
case led_timer:
hw_led_state ^= HEARTBEAT;
break;
#endif
#ifdef CONFIG_LEDS_CPU
case led_idle_start:
hw_led_state &= ~SYS_BUSY;
break;
case led_idle_end:
hw_led_state |= SYS_BUSY;
break;
#endif
case led_halted:
break;
case led_green_on:
hw_led_state |= BLINK;
break;
case led_green_off:
hw_led_state &= ~BLINK;
break;
case led_amber_on:
break;
case led_amber_off:
break;
case led_red_on:
break;
case led_red_off:
break;
default:
break;
}
if (led_state & LED_STATE_ENABLED) {
switch (hw_led_state) {
case 0:
GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
break;
case 1:
GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
break;
case 2:
GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
break;
case 3:
GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
break;
}
}
else {
/* turn all off */
GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
}
local_irq_restore(flags);
}
|
/* $Id: optimN_mex.c 2644 2009-01-23 13:01:50Z john $ */
/* (c) John Ashburner (2007) */
#include "mex.h"
#include <math.h>
#include "optimN.h"
static void fmg_mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
int nd, i;
int dm[4];
int cyc=1, nit=1, rtype=0;
float *A, *b, *x, *scratch;
static double param[6] = {1.0, 1.0, 1.0, 1.0, 0.0, 0.0};
double scal[256];
if ((nrhs!=3 && nrhs!=4) || nlhs>1)
mexErrMsgTxt("Incorrect usage");
if (!mxIsNumeric(prhs[0]) || mxIsComplex(prhs[0]) || mxIsSparse(prhs[0]) || !mxIsSingle(prhs[0]))
mexErrMsgTxt("Data must be numeric, real, full and single");
if (!mxIsNumeric(prhs[1]) || mxIsComplex(prhs[1]) || mxIsSparse(prhs[1]) || !mxIsSingle(prhs[1]))
mexErrMsgTxt("Data must be numeric, real, full and single");
nd = mxGetNumberOfDimensions(prhs[1]);
if (nd>4) mexErrMsgTxt("Wrong number of dimensions.");
for(i=0; i<nd; i++) dm[i] = mxGetDimensions(prhs[1])[i];
for(i=nd; i<4; i++) dm[i] = 1;
nd = mxGetNumberOfDimensions(prhs[0]);
if (nd>4) mexErrMsgTxt("Wrong number of dimensions.");
if ((nd==4) && (mxGetDimensions(prhs[0])[3] != (dm[3]*(dm[3]+1))/2))
mexErrMsgTxt("Incompatible 4th dimension (must be (n*(n+1))/2).");
if (nd>3) nd=3;
for(i=0; i<nd; i++) if (mxGetDimensions(prhs[0])[i] != dm[i]) mexErrMsgTxt("Incompatible dimensions.");
for(i=nd; i<3; i++) if (dm[i] != 1) mexErrMsgTxt("Incompatible dimensions.");
if (!mxIsNumeric(prhs[2]) || mxIsComplex(prhs[2]) || mxIsSparse(prhs[2]) || !mxIsDouble(prhs[2]))
mexErrMsgTxt("Data must be numeric, real, full and double");
if (mxGetNumberOfElements(prhs[2]) != 9)
mexErrMsgTxt("Third argument should contain rtype, vox1, vox2, vox3, param1, param2, param3, ncycles and relax-its.");
rtype = (int)(mxGetPr(prhs[2])[0]);
param[0] = 1/mxGetPr(prhs[2])[1];
param[1] = 1/mxGetPr(prhs[2])[2];
param[2] = 1/mxGetPr(prhs[2])[3];
param[3] = mxGetPr(prhs[2])[4];
param[4] = mxGetPr(prhs[2])[5];
param[5] = mxGetPr(prhs[2])[6];
cyc = mxGetPr(prhs[2])[7];
nit = (int)(mxGetPr(prhs[2])[8]);
if (nrhs==4)
{
double *s;
if (!mxIsNumeric(prhs[3]) || mxIsComplex(prhs[3]) || mxIsSparse(prhs[3]) || !mxIsDouble(prhs[3]))
mexErrMsgTxt("Data must be numeric, real, full and double");
if (mxGetNumberOfElements(prhs[3]) != dm[3])
mexErrMsgTxt("Incompatible number of scales.");
s = (double *)mxGetPr(prhs[3]);
for(i=0; i< dm[3]; i++)
scal[i] = s[i];
}
else
{
for(i=0; i<dm[3]; i++)
scal[i] = 1.0;
}
plhs[0] = mxCreateNumericArray(4,(unsigned int *)dm, mxSINGLE_CLASS, mxREAL);
A = (float *)mxGetPr(prhs[0]);
b = (float *)mxGetPr(prhs[1]);
x = (float *)mxGetPr(plhs[0]);
scratch = (float *)mxCalloc(fmg_scratchsize((int *)dm),sizeof(float));
fmg((int *)dm, A, b, rtype, param, scal, cyc, nit, x, scratch);
mxFree((void *)scratch);
}
static void vel2mom_mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
int nd, i;
int dm[4];
int rtype = 0;
static double param[] = {1.0, 1.0, 1.0, 1.0, 0.0, 0.0};
double scal[256];
if ((nrhs!=2 && nrhs!=3) || nlhs>1)
mexErrMsgTxt("Incorrect usage");
if (!mxIsNumeric(prhs[0]) || mxIsComplex(prhs[0]) || mxIsSparse(prhs[0]) || !mxIsSingle(prhs[0]))
mexErrMsgTxt("Data must be numeric, real, full and single");
nd = mxGetNumberOfDimensions(prhs[0]);
if (nd>4) mexErrMsgTxt("Wrong number of dimensions.");
for(i=0; i<nd; i++) dm[i] = mxGetDimensions(prhs[0])[i];
for(i=nd; i<4; i++) dm[i] = 1;
if (mxGetNumberOfElements(prhs[1]) != 7)
mexErrMsgTxt("Parameters should contain rtype, vox1, vox2, vox3, param1, param2 and param3.");
rtype = (int)(mxGetPr(prhs[1])[0]);
param[0] = 1/mxGetPr(prhs[1])[1];
param[1] = 1/mxGetPr(prhs[1])[2];
param[2] = 1/mxGetPr(prhs[1])[3];
param[3] = mxGetPr(prhs[1])[4];
param[4] = mxGetPr(prhs[1])[5];
param[5] = mxGetPr(prhs[1])[6];
if (nrhs==3)
{
double *s;
if (!mxIsNumeric(prhs[2]) || mxIsComplex(prhs[2]) || mxIsSparse(prhs[2]) || !mxIsDouble(prhs[2]))
mexErrMsgTxt("Data must be numeric, real, full and double");
if (mxGetNumberOfElements(prhs[2]) != dm[3])
mexErrMsgTxt("Incompatible number of scales.");
s = (double *)mxGetPr(prhs[2]);
for(i=0; i< dm[3]; i++)
scal[i] = s[i];
}
else
{
for(i=0; i<dm[3]; i++)
scal[i] = 1.0;
}
plhs[0] = mxCreateNumericArray(nd, (unsigned int *)dm, mxSINGLE_CLASS, mxREAL);
if (rtype==1)
LtLf_me((int *)dm, (float *)mxGetPr(prhs[0]), param, scal, (float *)mxGetPr(plhs[0]));
else if (rtype==2)
LtLf_be((int *)dm, (float *)mxGetPr(prhs[0]), param, scal, (float *)mxGetPr(plhs[0]));
else
mexErrMsgTxt("Regularisation type not recognised.");
}
#include<string.h>
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
if ((nrhs>=1) && mxIsChar(prhs[0]))
{
int buflen;
char *fnc_str;
buflen = mxGetNumberOfElements(prhs[0]);
fnc_str = (char *)mxCalloc(buflen+1,sizeof(mxChar));
mxGetString(prhs[0],fnc_str,buflen+1);
if (!strcmp(fnc_str,"vel2mom"))
{
mxFree(fnc_str);
vel2mom_mexFunction(nlhs, plhs, nrhs-1, &prhs[1]);
}
else if (!strcmp(fnc_str,"fmg") || !strcmp(fnc_str,"FMG"))
{
mxFree(fnc_str);
fmg_mexFunction(nlhs, plhs, nrhs-1, &prhs[1]);
}
else
{
mxFree(fnc_str);
mexErrMsgTxt("Option not recognised.");
}
}
else
{
fmg_mexFunction(nlhs, plhs, nrhs, prhs);
}
}
|
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef __RTL8188E_CMD_H__
#define __RTL8188E_CMD_H__
#if 0
enum cmd_msg_element_id
{
NONE_CMDMSG_EID,
AP_OFFLOAD_EID = 0,
SET_PWRMODE_EID = 1,
JOINBSS_RPT_EID = 2,
RSVD_PAGE_EID = 3,
RSSI_4_EID = 4,
RSSI_SETTING_EID = 5,
MACID_CONFIG_EID = 6,
MACID_PS_MODE_EID = 7,
P2P_PS_OFFLOAD_EID = 8,
SELECTIVE_SUSPEND_ROF_CMD = 9,
P2P_PS_CTW_CMD_EID = 32,
MAX_CMDMSG_EID
};
#else
typedef enum _RTL8188E_H2C_CMD_ID
{
//Class Common
H2C_COM_RSVD_PAGE =0x00,
H2C_COM_MEDIA_STATUS_RPT =0x01,
H2C_COM_SCAN =0x02,
H2C_COM_KEEP_ALIVE =0x03,
H2C_COM_DISCNT_DECISION =0x04,
#ifndef CONFIG_WOWLAN
H2C_COM_WWLAN =0x05,
#endif
H2C_COM_INIT_OFFLOAD =0x06,
H2C_COM_REMOTE_WAKE_CTL =0x07,
H2C_COM_AP_OFFLOAD =0x08,
H2C_COM_BCN_RSVD_PAGE =0x09,
H2C_COM_PROB_RSP_RSVD_PAGE =0x0A,
//Class PS
H2C_PS_PWR_MODE =0x20,
H2C_PS_TUNE_PARA =0x21,
H2C_PS_TUNE_PARA_2 =0x22,
H2C_PS_LPS_PARA =0x23,
H2C_PS_P2P_OFFLOAD =0x24,
//Class DM
H2C_DM_MACID_CFG =0x40,
H2C_DM_TXBF =0x41,
//Class BT
H2C_BT_COEX_MASK =0x60,
H2C_BT_COEX_GPIO_MODE =0x61,
H2C_BT_DAC_SWING_VAL =0x62,
H2C_BT_PSD_RST =0x63,
//Class Remote WakeUp
#ifdef CONFIG_WOWLAN
H2C_COM_WWLAN =0x80,
H2C_COM_REMOTE_WAKE_CTRL =0x81,
#endif
//Class
H2C_RESET_TSF =0xc0,
}RTL8188E_H2C_CMD_ID;
#endif
struct cmd_msg_parm {
u8 eid; //element id
u8 sz; // sz
u8 buf[6];
};
enum{
PWRS
};
typedef struct _SETPWRMODE_PARM {
u8 Mode;//0:Active,1:LPS,2:WMMPS
//u8 RLBM:4;//0:Min,1:Max,2: User define
u8 SmartPS_RLBM;//LPS=0:PS_Poll,1:PS_Poll,2:NullData,WMM=0:PS_Poll,1:NullData
u8 AwakeInterval; // unit: beacon interval
u8 bAllQueueUAPSD;
u8 PwrState;//AllON(0x0c),RFON(0x04),RFOFF(0x00)
} SETPWRMODE_PARM, *PSETPWRMODE_PARM;
struct H2C_SS_RFOFF_PARAM{
u8 ROFOn; // 1: on, 0:off
u16 gpio_period; // unit: 1024 us
}__attribute__ ((packed));
typedef struct JOINBSSRPT_PARM_88E{
u8 OpMode; // RT_MEDIA_STATUS
#ifdef CONFIG_WOWLAN
u8 MacID; // MACID
#endif //CONFIG_WOWLAN
}JOINBSSRPT_PARM_88E, *PJOINBSSRPT_PARM_88E;
typedef struct _RSVDPAGE_LOC_88E {
u8 LocProbeRsp;
u8 LocPsPoll;
u8 LocNullData;
u8 LocQosNull;
u8 LocBTQosNull;
} RSVDPAGE_LOC_88E, *PRSVDPAGE_LOC_88E;
// host message to firmware cmd
void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode);
void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus);
u8 rtl8188e_set_rssi_cmd(PADAPTER padapter, u8 *param);
u8 rtl8188e_set_raid_cmd(PADAPTER padapter, u32 mask);
void rtl8188e_Add_RateATid(PADAPTER padapter, u32 bitmap, u8* arg, u8 rssi_level);
//u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period);
#ifdef CONFIG_P2P
void rtl8188e_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state);
#endif //CONFIG_P2P
void CheckFwRsvdPageContent(PADAPTER padapter);
void rtl8188e_set_FwMediaStatus_cmd(PADAPTER padapter, u16 mstatus_rpt );
#ifdef CONFIG_TSF_RESET_OFFLOAD
//u8 rtl8188e_reset_tsf(_adapter *padapter, u8 reset_port);
int reset_tsf(PADAPTER Adapter, u8 reset_port );
#endif // CONFIG_TSF_RESET_OFFLOAD
#ifdef CONFIG_WOWLAN
typedef struct _SETWOWLAN_PARM{
u8 mode;
u8 gpio_index;
u8 gpio_duration;
u8 second_mode;
u8 reserve;
}SETWOWLAN_PARM, *PSETWOWLAN_PARM;
#define FW_WOWLAN_FUN_EN BIT(0)
#define FW_WOWLAN_PATTERN_MATCH BIT(1)
#define FW_WOWLAN_MAGIC_PKT BIT(2)
#define FW_WOWLAN_UNICAST BIT(3)
#define FW_WOWLAN_ALL_PKT_DROP BIT(4)
#define FW_WOWLAN_GPIO_ACTIVE BIT(5)
#define FW_WOWLAN_REKEY_WAKEUP BIT(6)
#define FW_WOWLAN_DEAUTH_WAKEUP BIT(7)
#define FW_WOWLAN_GPIO_WAKEUP_EN BIT(0)
#define FW_FW_PARSE_MAGIC_PKT BIT(1)
#define FW_REMOTE_WAKE_CTRL_EN BIT(0)
#define FW_REALWOWLAN_EN BIT(5)
void rtl8188es_set_wowlan_cmd(_adapter* padapter, u8 enable);
void SetFwRelatedForWoWLAN8188ES(_adapter* padapter, u8 bHostIsGoingtoSleep);
#endif//CONFIG_WOWLAN
#endif//__RTL8188E_CMD_H__
|
/*
pins_arduino.h - Pin definition functions for Arduino
Part of Arduino - http://www.arduino.cc/
Copyright (c) 2007 David A. Mellis
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
*/
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <avr/pgmspace.h>
#define NUM_DIGITAL_PINS 20
#define NUM_ANALOG_INPUTS 6
#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1)
#if defined(__AVR_ATmega8__)
#define digitalPinHasPWM(p) ((p) == 9 || (p) == 10 || (p) == 11)
#else
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)
#endif
static const uint8_t SS = 10;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 12;
static const uint8_t SCK = 13;
static const uint8_t SDA = 18;
static const uint8_t SCL = 19;
static const uint8_t LED_BUILTIN = 13;
static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A6 = 20;
static const uint8_t A7 = 21;
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))
#ifdef ARDUINO_MAIN
// On the Arduino board, digital pins are also used
// for the analog output (software PWM). Analog input
// pins are a separate set.
// ATMEL ATMEGA8 & 168 / ARDUINO
//
// +-\/-+
// PC6 1| |28 PC5 (AI 5)
// (D 0) PD0 2| |27 PC4 (AI 4)
// (D 1) PD1 3| |26 PC3 (AI 3)
// (D 2) PD2 4| |25 PC2 (AI 2)
// PWM+ (D 3) PD3 5| |24 PC1 (AI 1)
// (D 4) PD4 6| |23 PC0 (AI 0)
// VCC 7| |22 GND
// GND 8| |21 AREF
// PB6 9| |20 AVCC
// PB7 10| |19 PB5 (D 13)
// PWM+ (D 5) PD5 11| |18 PB4 (D 12)
// PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM
// (D 7) PD7 13| |16 PB2 (D 10) PWM
// (D 8) PB0 14| |15 PB1 (D 9) PWM
// +----+
//
// (PWM+ indicates the additional PWM pins on the ATmega168.)
// ATMEL ATMEGA1280 / ARDUINO
//
// 0-7 PE0-PE7 works
// 8-13 PB0-PB5 works
// 14-21 PA0-PA7 works
// 22-29 PH0-PH7 works
// 30-35 PG5-PG0 works
// 36-43 PC7-PC0 works
// 44-51 PJ7-PJ0 works
// 52-59 PL7-PL0 works
// 60-67 PD7-PD0 works
// A0-A7 PF0-PF7
// A8-A15 PK0-PK7
// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)
const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t) &DDRB,
(uint16_t) &DDRC,
(uint16_t) &DDRD,
};
const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t) &PORTB,
(uint16_t) &PORTC,
(uint16_t) &PORTD,
};
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t) &PINB,
(uint16_t) &PINC,
(uint16_t) &PIND,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PD, /* 0 */
PD,
PD,
PD,
PD,
PD,
PD,
PD,
PB, /* 8 */
PB,
PB,
PB,
PB,
PB,
PC, /* 14 */
PC,
PC,
PC,
PC,
PC,
PB, /* 20 */
PB /* 21 */
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(0), /* 0, port D */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6),
_BV(7),
_BV(0), /* 8, port B */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(0), /* 14, port C */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6), /* 20 */
_BV(7), /* 21 */
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER, /* 0 - port D */
NOT_ON_TIMER,
NOT_ON_TIMER,
// on the ATmega168, digital pin 3 has hardware pwm
#if defined(__AVR_ATmega8__)
NOT_ON_TIMER,
#else
TIMER2B,
#endif
NOT_ON_TIMER,
// on the ATmega168, digital pins 5 and 6 have hardware pwm
#if defined(__AVR_ATmega8__)
NOT_ON_TIMER,
NOT_ON_TIMER,
#else
TIMER0B,
TIMER0A,
#endif
NOT_ON_TIMER,
NOT_ON_TIMER, /* 8 - port B */
TIMER1A,
TIMER1B,
#if defined(__AVR_ATmega8__)
TIMER2,
#else
TIMER2A,
#endif
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER, /* 14 - port C */
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
};
#endif
#endif
|
/*
* This file is part of wxSmith plugin for Code::Blocks Studio
* Copyright (C) 2006-2007 Bartlomiej Swiecki
*
* wxSmith is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wxSmith 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 wxSmith. If not, see <http://www.gnu.org/licenses/>.
*
* $Revision$
* $Id$
* $HeadURL$
*/
#ifndef WXSCOLOURPROPERTY_H
#define WXSCOLOURPROPERTY_H
#include "../../properties/wxsproperties.h"
#include "../wxscodercontext.h"
#include <wx/dialog.h>
#if wxCHECK_VERSION(2, 9, 0)
#include <wx/propgrid/editors.h>
#else
#include <wx/propgrid/propdev.h>
#endif
#include <wx/propgrid/advprops.h>
#define wxsCOLOUR_DEFAULT (wxPG_COLOUR_CUSTOM - 1)
/** \brief Class handling colour data for wxSmith */
class wxsColourData: public wxColourPropertyValue
{
public:
wxsColourData(wxUint32 type, const wxColour &colour): wxColourPropertyValue(type,colour) {}
wxsColourData(wxUint32 type = wxsCOLOUR_DEFAULT): wxColourPropertyValue(type) {}
wxsColourData(const wxColour &colour): wxColourPropertyValue(colour) {}
wxsColourData(const wxColourPropertyValue& cp): wxColourPropertyValue(cp) {}
/** \brief Getting wxColour object from wxColourPropertyValue
* \return wxColour class, if wxColour.Ok() will return false, default colour was used
*/
wxColour GetColour();
/** \brief Getting code building colour
* \return code with colour or empty string if there's default colour
*/
wxString BuildCode(wxsCoderContext* Context);
};
/** \brief Colour property - property used for handling wxColour property
*
* This property uses wxColourPropertyValue to keep data
*
*/
class wxsColourProperty: public wxsProperty
{
public:
/** \brief Ctor
* \param PGName name of property in Property Grid
* \param DataName name of property in data stuctures
* \param ValueOffset offset of wxColourPropertyValue member (taken from wxsOFFSET macro)
* \param Priority priority of this property
*/
wxsColourProperty(
const wxString& PGName,
const wxString& DataName,
long ValueOffset,
int Priority=100);
/** \brief Returning type name */
virtual const wxString GetTypeName() { return _T("wxsColour"); }
/** \brief Getting wxColour object from wxColourPropertyValue
* \return wxColour class, if wxColour.Ok() will return false, default colour was used
*/
static wxColour GetColour(const wxColourPropertyValue& value);
/** \brief Getting code building colour
* \return code with colour or empty string if there's default colour
*/
static wxString GetColourCode(const wxColourPropertyValue& value,wxsCodingLang Language);
protected:
virtual void PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent);
virtual bool PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
virtual bool PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
private:
long ValueOffset;
};
/** \addtogroup ext_properties_macros
* \{ */
/** \brief Macro automatically declaring colour property
* \param ClassName name of class holding this property
* \param VarName name of wxsColourData variable inside class
* \param PGName name used in property grid
* \param DataName name used in Xml / Data Streams
*/
#define WXS_COLOUR(ClassName,VarName,PGName,DataName) \
{ static wxsColourProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName)); \
Property(_Property); }
/** \brief Macro automatically declaring colour property with custom priority
* \param ClassName name of class holding this property
* \param VarName name of wxsColourData variable inside class
* \param PGName name used in property grid
* \param DataName name used in Xml / Data Streams
* \param Priority priority of this property
*/
#define WXS_COLOUR_P(ClassName,VarName,PGName,DataName,Priority) \
{ static wxsColourProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Priority); \
Property(_Property); }
/** \} */
#endif
|
#pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#include <stdint.h>
#include <AP_HAL/AP_HAL_Macros.h>
#include <AP_HAL/Semaphores.h>
#include "AP_HAL_VRBRAIN_Namespace.h"
#include <pthread.h>
class VRBRAIN::Semaphore : public AP_HAL::Semaphore {
public:
Semaphore() {
pthread_mutex_init(&_lock, nullptr);
}
bool give();
bool take(uint32_t timeout_ms);
bool take_nonblocking();
private:
pthread_mutex_t _lock;
};
|
#ifndef _TIF_CONFIG_H_
#define _TIF_CONFIG_H_
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define as 0 or 1 according to the floating point format suported by the
machine */
#define HAVE_IEEEFP 1
/* Define to 1 if you have the `jbg_newlen' function. */
#define HAVE_JBG_NEWLEN 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
#define HAVE_IO_H 1
/* Define to 1 if you have the <search.h> header file. */
#define HAVE_SEARCH_H 1
/* Define to 1 if you have the `setmode' function. */
#define HAVE_SETMODE 1
/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */
#define HAVE_DECL_OPTARG 0
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* Signed 64-bit type formatter */
#define TIFF_INT64_FORMAT "%I64d"
/* Signed 64-bit type */
#define TIFF_INT64_T signed __int64
/* Unsigned 64-bit type formatter */
#define TIFF_UINT64_FORMAT "%I64u"
/* Unsigned 64-bit type */
#define TIFF_UINT64_T unsigned __int64
#if _WIN64
/*
Windows 64-bit build
*/
/* Pointer difference type */
# define TIFF_PTRDIFF_T TIFF_INT64_T
/* The size of `size_t', as computed by sizeof. */
# define SIZEOF_SIZE_T 8
/* Size type formatter */
# define TIFF_SIZE_FORMAT TIFF_INT64_FORMAT
/* Unsigned size type */
# define TIFF_SIZE_T TIFF_UINT64_T
/* Signed size type formatter */
# define TIFF_SSIZE_FORMAT TIFF_INT64_FORMAT
/* Signed size type */
# define TIFF_SSIZE_T TIFF_INT64_T
#else
/*
Windows 32-bit build
*/
/* Pointer difference type */
# define TIFF_PTRDIFF_T signed int
/* The size of `size_t', as computed by sizeof. */
# define SIZEOF_SIZE_T 4
/* Size type formatter */
# define TIFF_SIZE_FORMAT "%u"
/* Size type formatter */
# define TIFF_SIZE_FORMAT "%u"
/* Unsigned size type */
# define TIFF_SIZE_T unsigned int
/* Signed size type formatter */
# define TIFF_SSIZE_FORMAT "%d"
/* Signed size type */
# define TIFF_SSIZE_T signed int
#endif
/* Set the native cpu bit order */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Visual Studio 2015 / VC 14 / MSVC 19.00 finally has snprintf() */
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#else
#define HAVE_SNPRINTF 1
#endif
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
# ifndef inline
# define inline __inline
# endif
#endif
#define lfind _lfind
#pragma warning(disable : 4996) /* function deprecation warnings */
#endif /* _TIF_CONFIG_H_ */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
|
/**
* NUM2STR - Functions to handle the conversion of numeric vales to strings.
*
* @created 2014-12-18
* @author Neven Boyanov
* @version 2016-04-17 (last modified)
*
* This is part of the Tinusaur/TinyAVRLib project.
*
* Copyright (c) 2016 Neven Boyanov, Tinusaur Team. All Rights Reserved.
* Distributed as open source software under MIT License, see LICENSE.txt file.
* Please, as a favor, retain the link http://tinusaur.org to The Tinusaur Project.
*
* Source code available at: https://bitbucket.org/tinusaur/tinyavrlib
*
*/
// ============================================================================
#include "num2str.h"
// ----------------------------------------------------------------------------
// NOTE: This implementation is borrowed from the LCDDDD library.
// Original source code at: https://bitbucket.org/boyanov/avr/src/default/lcdddd/src/lcdddd/lcdddd.h
uint8_t usint2decascii(uint16_t num, char *buffer)
{
const unsigned short powers[] = { 10000u, 1000u, 100u, 10u, 1u }; // The "const unsigned short" combination gives shortest code.
char digit; // "digit" is stored in a char array, so it should be of type char.
uint8_t digits = USINT2DECASCII_MAX_DIGITS - 1;
for (uint8_t pos = 0; pos < 5; pos++) // "pos" is index in array, so should be of type int.
{
digit = 0;
while (num >= powers[pos])
{
digit++;
num -= powers[pos];
}
// ---- CHOOSE (1), (2) or (3) ----
// CHOICE (1) Fixed width, zero padded result.
/*
buffer[pos] = digit + '0'; // Convert to ASCII
*/
// CHOICE (2) Fixed width, zero padded result, digits offset.
/*
buffer[pos] = digit + '0'; // Convert to ASCII
// Note: Determines the offset of the first significant digit.
if (digits == -1 && digit != 0) digits = pos;
// Note: Could be used for variable width, not padded, left aligned result.
*/
// CHOICE (3) Fixed width, space (or anything else) padded result, digits offset.
// Note: Determines the offset of the first significant digit.
// Note: Could be used for variable width, not padded, left aligned result.
if (digits == USINT2DECASCII_MAX_DIGITS - 1)
{
if (digit == 0)
{
if (pos < USINT2DECASCII_MAX_DIGITS - 1) // Check position, so single "0" will be handled properly.
digit = -16; // Use: "-16" for space (' '), "-3" for dash/minus ('-'), "0" for zero ('0'), etc. ...
}
else
{
digits = pos;
}
}
buffer[pos] = digit + '0'; // Convert to ASCII
}
// NOTE: The resulting ascii text should not be terminated with '\0' here.
// The provided buffer maybe part of a larger text in both directions.
return digits;
}
// ----------------------------------------------------------------------------
// NOTE: The buffer should be always at least MAX_DIGITS in length - the function works with 16-bit numbers.
uint8_t usint2binascii(uint16_t num, char *buffer) {
uint16_t power = 0x8000; // This is the 1000 0000 0000 0000 binary number.
char digit; // "digit" is stored in a char array, so it should be of type char.
uint8_t digits = USINT2BINASCII_MAX_DIGITS - 1;
for (uint8_t pos = 0; pos < USINT2BINASCII_MAX_DIGITS; pos++) { // "pos" is index in an array.
digit = 0;
if (num >= power) {
digit++;
num -= power;
}
// Fixed width, space ('0', or anything else) padded result, digits offset.
// Note: Determines the offset of the first significant digit.
// Note: Could be used for variable width, not padded, left aligned result.
if (digits == USINT2BINASCII_MAX_DIGITS - 1) {
if (digit == 0) {
if (pos < USINT2BINASCII_MAX_DIGITS - 1) // Check position, so single "0" will be handled properly.
digit = 0; // Use: "-16" for space (' '), "-3" for dash/minus ('-'), "0" for zero ('0'), etc.
} else {
digits = pos;
}
}
buffer[pos] = digit + '0'; // Convert to ASCII
power = power >> 1;
}
// NOTE: The resulting ascii text should not be terminated with '\0' here.
// The provided buffer maybe part of a larger text in both directions.
return digits;
}
// ============================================================================
|
#ifndef OFFSET_TEST_H
#define OFFSET_TEST_H
#include <test/UnitTest.h>
#include <test/UnitTestRunner.h>
#include <util/misc/Offset.h>
#include <util/global.h>
using namespace Util;
class OffsetTest : public UnitTest
{
public:
class A
{
public:
int x;
bool f;
virtual void action()
{}
void outputOffsets(std::ostream& out)
{
A a;
out << "x " << memberOffset<A>(a, &A::x) << std::endl;
out << "f " << memberOffset<A>(a, &A::f) << std::endl;
}
};
class B : public A
{
public:
int y;
virtual void action() {}
void outputOffsets(std::ostream& out)
{
B b;
out << "x " << memberOffset<A>(b, &A::x) << std::endl;
out << "f " << memberOffset<A>(b, &A::f) << std::endl;
out << "y " << memberOffset<B>(b, &B::y) << std::endl;
out << "z " << memberOffset<B>(b, &B::w) << std::endl;
}
private:
int w;
};
class C : public B
{
public:
int z;
virtual void action() {}
};
void setUp()
{};
void tearDown()
{};
void testMemberOffset1()
{
printMethod(TEST_FUNC);
B b;
std::cout << std::endl;
std::cout << memberOffset<B>(b, &B::y) << std::endl;
b.outputOffsets(std::cout);
}
void testMemberOffset2()
{
printMethod(TEST_FUNC);
B b;
std::cout << std::endl;
std::cout << memberOffset<B>(b, &A::x) << std::endl;
}
void testBaseOffset()
{
printMethod(TEST_FUNC);
B b;
std::cout << std::endl;
std::cout << baseOffset<B, A>(b) << std::endl;
C c;
std::cout << std::endl;
std::cout << baseOffset<C, B>(c) << std::endl;
}
};
TEST_BEGIN(OffsetTest)
TEST_ADD(OffsetTest, testMemberOffset1)
TEST_ADD(OffsetTest, testMemberOffset2)
TEST_ADD(OffsetTest, testBaseOffset)
TEST_END(OffsetTest)
#endif
|
#include "pta.h"
#include "asf_complex.h"
#include "asf.h"
fcpx *forward_fft(complexFloat *image, int line_count, int sample_count)
{
int i;
// Allocate memory
int size = line_count * sample_count;
fcpx *in_cpx = (fcpx *) fftwf_malloc(sizeof(fcpx)*size);
fcpx *fft_cpx = (fcpx *) fftwf_malloc(sizeof(fcpx)*size);
// Fill in the values from internal complexFloat format
for (i=0; i<size; i++) {
in_cpx[i][0] = image[i].real;
in_cpx[i][1] = image[i].imag;
}
// Do the forward FFT
int flags = FFTW_DESTROY_INPUT + FFTW_ESTIMATE;
fftwf_plan fw_plan = fftwf_plan_dft_2d(line_count, sample_count, in_cpx, fft_cpx,
FFTW_FORWARD, flags);
fftwf_execute(fw_plan);
fftwf_destroy_plan(fw_plan);
fftwf_free(in_cpx);
return fft_cpx;
}
complexFloat *inverse_fft(fftwf_complex *fft_cpx, int line_count, int sample_count)
{
int i;
// Allocate memory
int size = line_count * sample_count;
fcpx *out_cpx = (fcpx *) fftwf_malloc(sizeof(fcpx)*size);
complexFloat *image = (complexFloat *) MALLOC(sizeof(complexFloat)*size);
// Do the inverse FFT
int flags = FFTW_DESTROY_INPUT + FFTW_ESTIMATE;
fftwf_plan bw_plan = fftwf_plan_dft_2d(line_count, sample_count, fft_cpx, out_cpx,
FFTW_BACKWARD, flags);
fftwf_execute(bw_plan);
fftwf_destroy_plan(bw_plan);
fftwf_free(fft_cpx);
// Fill in the values into internal complexFloat format
for (i=0; i<size; i++) {
image[i].real = out_cpx[i][0] / size;
image[i].imag = out_cpx[i][1] / size;
}
return image;
}
fcpx *oversample(fcpx *in, int srcSize, int oversampling_factor)
{
int i, k;
// Allocate memory for oversampled image
int bigSize = srcSize * oversampling_factor;
fcpx *out = (fcpx *) fftwf_malloc(sizeof(fcpx)*bigSize*bigSize);
// Oversample
// uppler left corner
for (i=0; i<srcSize/2; i++) {
for (k=0; k<srcSize/2; k++)
out[i*bigSize+k][0] = in[i*srcSize+k][0];
out[i*bigSize+k][1] = in[i*srcSize+k][1];
}
// upper right corner
for (i=0; i<srcSize/2; i++)
for (k=srcSize/2; k<srcSize; k++) {
out[i*bigSize+bigSize-srcSize+k][0] = in[i*srcSize+k][0];
out[i*bigSize+bigSize-srcSize+k][1] = in[i*srcSize+k][1];
}
// lower left corner
for (i=srcSize/2; i<srcSize; i++)
for (k=0; k<srcSize/2; k++) {
out[(bigSize-srcSize+i)*bigSize+k][0] = in[i*srcSize+k][0];
out[(bigSize-srcSize+i)*bigSize+k][1] = in[i*srcSize+k][1];
}
// lower right corner
for (i=srcSize/2; i<srcSize; i++) {
for (k=srcSize/2; k<srcSize; k++)
out[(bigSize-srcSize+i)*bigSize+bigSize-srcSize+k][0] = in[i*srcSize+k][0];
out[(bigSize-srcSize+i)*bigSize+bigSize-srcSize+k][1] = in[i*srcSize+k][1];
}
return(out);
}
void my_complex2polar(complexFloat *in, int line_count, int sample_count,
float *amplitude, float *phase)
{
int i, k, index;
for (i=0; i<line_count; i++)
for (k=0; k<sample_count; k++) {
index = i*sample_count+k;
if (in[index].real!=0.0 || in[index].imag!=0.0) {
amplitude[index] = sqrt(in[index].real*in[index].real +
in[index].imag*in[index].imag);
phase[index] = atan2(in[index].imag, in[index].real);
}
else {
amplitude[index] = 0.0;
phase[index] = 0.0;
}
}
}
|
/*
* uhub - A tiny ADC p2p connection hub
* Copyright (C) 2007-2014, Jan Vidar Krey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef HAVE_UHUB_CONFIG_TOKEN_H
#define HAVE_UHUB_CONFIG_TOKEN_H
struct cfg_tokens;
struct cfg_tokens* cfg_tokenize(const char* line);
void cfg_tokens_free(struct cfg_tokens*);
int cfg_token_add(struct cfg_tokens*, char* new_token);
size_t cfg_token_count(struct cfg_tokens*);
char* cfg_token_get(struct cfg_tokens*, size_t offset);
char* cfg_token_get_first(struct cfg_tokens*);
char* cfg_token_get_next(struct cfg_tokens*);
struct cfg_settings;
struct cfg_settings* cfg_settings_split(const char* line);
const char* cfg_settings_get_key(struct cfg_settings*);
const char* cfg_settings_get_value(struct cfg_settings*);
void cfg_settings_free(struct cfg_settings*);
#endif /* HAVE_UHUB_CONFIG_TOKEN_H */
|
/*
Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in unzip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
unzipstb.c
Simple stub function for UnZip DLL (or shared library, whatever); does
exactly the same thing as normal UnZip, except for additional printf()s
of various version numbers, solely as a demonstration of what can/should
be checked when using the DLL. (If major version numbers ever differ,
assume program is incompatible with DLL--especially if DLL version is
older. This is not likely to be a problem with *this* simple program,
but most user programs will be much more complex.)
---------------------------------------------------------------------------*/
#include <stdio.h>
#include "unzip.h"
#include "unzvers.h"
int main(int argc, char *argv[])
{
static UzpVer *pVersion; /* no pervert jokes, please... */
pVersion = UzpVersion();
printf("UnZip stub: checking version numbers (DLL is dated %s)\n",
pVersion->date);
printf(" UnZip versions: expecting %d.%d%d, using %d.%d%d%s\n",
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, pVersion->unzip.major,
pVersion->unzip.minor, pVersion->unzip.patchlevel, pVersion->betalevel);
printf(" ZipInfo versions: expecting %d.%d%d, using %d.%d%d\n",
ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, pVersion->zipinfo.major,
pVersion->zipinfo.minor, pVersion->zipinfo.patchlevel);
/*
D2_M*VER and os2dll.* are obsolete, though retained for compatibility:
printf(" OS2 DLL versions: expecting %d.%d%d, using %d.%d%d\n",
D2_MAJORVER, D2_MINORVER, D2_PATCHLEVEL, pVersion->os2dll.major,
pVersion->os2dll.minor, pVersion->os2dll.patchlevel);
*/
if (pVersion->flag & 2)
printf(" using zlib version %s\n", pVersion->zlib_version);
printf("\n");
/* call the actual UnZip routine (string-arguments version) */
return UzpMain(argc, argv);
}
const char *BOINC_RCSID_0df1c7c635 = "$Id: unzipstb.c 4979 2005-01-02 18:29:53Z ballen $";
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/*
* AP_EPM.h
*
* Created on: DEC 06, 2013
* Author: Andreas Jochum
*
* Set-up Wiki: http://copter.ardupilot.com/wiki/common-electro-permanent-magnet-gripper/
*/
/// @file AP_EPM.h
/// @brief AP_EPM control class
#pragma once
#include <AP_Math/AP_Math.h>
#include <AP_Common/AP_Common.h>
#include <RC_Channel/RC_Channel.h>
// EPM PWM definitions
#define EPM_GRAB_PWM_DEFAULT 1900
#define EPM_RELEASE_PWM_DEFAULT 1100
#define EPM_NEUTRAL_PWM_DEFAULT 1500
#define EPM_RETURN_TO_NEUTRAL_MS 500 // EPM PWM returns to neutral position this many milliseconds after grab or release
#define EPM_REGRAB_DEFAULT 0 // default re-grab interval (in seconds) to ensure cargo is securely held
/// @class AP_EPM
/// @brief Class to manage the EPM_CargoGripper
class AP_EPM {
public:
AP_EPM();
// initialise the EPM
void init();
// enabled - true if the EPM is enabled
bool enabled() { return _enabled; }
// grab - move the EPM pwm output to the grab position
void grab();
// release - move the EPM pwm output to the release position
void release();
// update - moves the pwm back to neutral after the timeout has passed
// should be called at at least 10hz
void update();
static const struct AP_Param::GroupInfo var_info[];
private:
// neutral - return the EPM pwm output to the neutral position
void neutral();
// EPM flags
struct EPM_Flags {
uint8_t grab : 1; // true if we think we have grabbed onto cargo, false if we think we've released it
uint8_t active : 1; // true if we are actively sending grab or release PWM to EPM to activate grabbing or releasing, false if we are sending neutral pwm
} _flags;
// parameters
AP_Int8 _enabled; // EPM enable/disable
AP_Int16 _grab_pwm; // PWM value sent to EPM to initiate grabbing the cargo
AP_Int16 _release_pwm; // PWM value sent to EPM to release the cargo
AP_Int16 _neutral_pwm; // PWM value sent to EPM when not grabbing or releasing
AP_Int8 _regrab_interval; // Time in seconds that gripper will regrab the cargo to ensure grip has not weakend
// internal variables
uint32_t _last_grab_or_release;
};
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Copyright 2013, Schmidt and Chen
#include "pblas.h"
// R.h and Rinternals.h needs to be included after Rconfig.h
#include "pbdBASE.h"
#include <RNACI.h>
// Transpose
SEXP R_PDTRAN(SEXP M, SEXP N, SEXP A, SEXP DESCA, SEXP CLDIM, SEXP DESCC)
{
R_INIT;
int IJ = 1;
double one = 1.0;
double zero = 0.0;
SEXP C;
newRmat(C, INT(CLDIM, 0), INT(CLDIM, 1), "dbl");
pdtran_(INTP(M), INTP(N), &one,
DBLP(A), &IJ, &IJ, INTP(DESCA), &zero,
DBLP(C), &IJ, &IJ, INTP(DESCC));
R_END;
return C;
}
// Mat-Mat-Mult
SEXP R_PDGEMM(SEXP TRANSA, SEXP TRANSB, SEXP M, SEXP N, SEXP K,
SEXP A, SEXP DESCA, SEXP B, SEXP DESCB, SEXP CLDIM, SEXP DESCC)
{
R_INIT;
double alpha = 1.0;
double beta = 0.0;
int IJ = 1;
SEXP C;
newRmat(C, INT(CLDIM, 0), INT(CLDIM, 1), "dbl");
#ifdef FC_LEN_T
pdgemm_(STR(TRANSA, 0), STR(TRANSB, 0),
INTP(M), INTP(N), INTP(K), &alpha,
DBLP(A), &IJ, &IJ, INTP(DESCA),
DBLP(B), &IJ, &IJ, INTP(DESCB), &beta,
DBLP(C), &IJ, &IJ, INTP(DESCC),
(FC_LEN_T) strlen(STR(TRANSA, 0)), (FC_LEN_T) strlen(STR(TRANSB, 0)));
#else
pdgemm_(STR(TRANSA, 0), STR(TRANSB, 0),
INTP(M), INTP(N), INTP(K), &alpha,
DBLP(A), &IJ, &IJ, INTP(DESCA),
DBLP(B), &IJ, &IJ, INTP(DESCB), &beta,
DBLP(C), &IJ, &IJ, INTP(DESCC));
#endif
R_END;
return C;
}
|
// Sifer Aseph
// Empty
|
/* Create sockets for use in tests (client side).
Copyright (C) 2011-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2011. */
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/* Creates a client socket, by connecting to a server on the given port. */
static int
create_client_socket (int port)
{
int client_socket;
/* Create a client socket. */
client_socket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
ASSERT (client_socket >= 0);
/* Connect to the server process at the specified port. */
{
struct sockaddr_in addr;
memset (&addr, 0, sizeof (addr)); /* needed on AIX and OSF/1 */
addr.sin_family = AF_INET;
#if 0 /* Unoptimized */
inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
#elif 0 /* Nearly optimized */
addr.sin_addr.s_addr = htonl (0x7F000001); /* 127.0.0.1 */
#else /* Fully optimized */
{
unsigned char dotted[4] = { 127, 0, 0, 1 }; /* 127.0.0.1 */
memcpy (&addr.sin_addr.s_addr, dotted, 4);
}
#endif
addr.sin_port = htons (port);
ASSERT (connect (client_socket,
(const struct sockaddr *) &addr, sizeof (addr))
== 0);
}
return client_socket;
}
|
/* Clear given exceptions in current floating-point environment.
Copyright (C) 2013 Imagination Technologies Ltd.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, see <http://www.gnu.org/licenses/>. */
#include <fenv.h>
#include <unistd.h>
#include "internal.h"
int
feclearexcept (int excepts)
{
unsigned int temp;
/* Get the current exceptions. */
__asm__ ("MOV %0,TXDEFR" : "=r" (temp));
/* Mask out unsupported bits/exceptions. */
excepts &= FE_ALL_EXCEPT;
excepts <<= 16;
temp &= ~excepts;
metag_set_fpu_flags(temp);
/* Success. */
return 0;
}
|
/*
* Copyright © 1999/2000 by Henning Zabel <henning@uni-paderborn.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* gphoto driver for the Mustek MDC800 Digital Camera. The driver
* supports rs232 and USB.
*/
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-result.h>
#include "print.h"
#include "rs232.h"
#include "mdc800_spec.h"
#include "io.h"
#include <fcntl.h>
#include <termios.h>
#include <sys/time.h>
/*
* sends a command and receives the answer to this
* buffer: Strores the answer
* length: length of answer or null
*/
int mdc800_rs232_sendCommand(GPPort *port,unsigned char* command, unsigned char* buffer, int length)
{
char answer;
int fault=0,ret;
int i;
printFnkCall ("(mdc800_rs232_sendCommand) id:%i (%i,%i,%i),answer:%i\n",command[1],command[2],command[3],command[4],length);
usleep(MDC800_DEFAULT_COMMAND_DELAY*1000);
gp_port_set_timeout (port, MDC800_DEFAULT_TIMEOUT );
/* Send command */
for (i=0; i<6; i++)
{
if (gp_port_write (port, (char*)&command[i] ,1) < GP_OK)
{
printCError ("(mdc800_rs232_sendCommand) sending Byte %i fails!\n",i);
fault=1;
}
ret = gp_port_read (port,&answer,1);
if ( ret != 1)
{
printCError ("(mdc800_rs232_sendCommand) receiving resend of Byte %i fails.\n",i);
fault=1;
}
if (command [i] != answer)
{
printCError ("(mdc800_rs232_sendCommand) Byte %i differs : send %i, received %i \n",i,command[i],answer);
fault=1;
}
}
if (fault)
return GP_ERROR_IO;
/* Receive answer */
if (length)
{
/* Some Commands needs a download. */
switch (command[1])
{
case COMMAND_GET_IMAGE:
case COMMAND_GET_THUMBNAIL:
if (!mdc800_rs232_download(port,buffer,length))
{
printCError ("(mdc800_rs232_sendCommand) download of %i Bytes fails.\n",length);
fault=1;
}
break;
default:
if (!mdc800_rs232_receive(port,buffer,length))
{
printCError ("(mdc800_rs232_sendCommand) receiving %i Bytes fails.\n",length);
fault=1;
}
}
}
if (fault)
return GP_ERROR_IO;
/* commit */
if (!(command[1] == COMMAND_CHANGE_RS232_BAUD_RATE)) {
if (!mdc800_rs232_waitForCommit(port,command[1]))
{
printCError ("(mdc800_rs232_sendCommand) receiving commit fails.\n");
fault=1;
}
}
if (fault)
return GP_ERROR_IO;
return GP_OK;
}
/*
* waits for the Commit value
* The function expects the commandid of the corresponding command
* to determine whether a long timeout is needed or not. (Take Photo)
*/
int mdc800_rs232_waitForCommit (GPPort *port,char commandid)
{
unsigned char ch[1];
int ret;
gp_port_set_timeout(port,mdc800_io_getCommandTimeout(commandid));
ret = gp_port_read(port,ch,1);
if (ret!=1)
{
printCError ("(mdc800_rs232_waitForCommit) Error receiving commit !\n");
return GP_ERROR_IO;
}
if (ch[0] != ANSWER_COMMIT )
{
printCError ("(mdc800_rs232_waitForCommit) Byte \"%i\" was not the commit !\n",ch[0]);
return GP_ERROR_IO;
}
return GP_OK;
}
/*
* receive Bytes from camera
*/
int mdc800_rs232_receive (GPPort *port,unsigned char* buffer, int b)
{
int ret;
gp_port_set_timeout (port,MDC800_DEFAULT_TIMEOUT );
ret=gp_port_read(port,(char*)buffer,b);
if (ret!=b)
{
printCError ("(mdc800_rs232_receive) can't read %i Bytes !\n",b);
return GP_ERROR_IO;
}
return GP_OK;
}
/*
* downloads data from camera and send
* a checksum every 512 bytes.
*/
int mdc800_rs232_download (GPPort *port,unsigned char* buffer, int size)
{
int readen=0,i,j;
unsigned char checksum;
unsigned char DSC_checksum;
int numtries=0;
gp_port_set_timeout(port, MDC800_DEFAULT_TIMEOUT );
while (readen < size)
{
if (!mdc800_rs232_receive (port,&buffer[readen],512))
return readen;
checksum=0;
for (i=0; i<512; i++)
checksum=(checksum+buffer[readen+i])%256;
if (gp_port_write (port,(char*) &checksum,1) < GP_OK)
return readen;
if (!mdc800_rs232_receive (port,&DSC_checksum,1))
return readen;
if (checksum != DSC_checksum)
{
numtries++;
printCError ("(mdc800_rs232_download) checksum: software %i, DSC %i , reload block! (%i) \n",checksum,DSC_checksum,numtries);
if (numtries > 10)
{
printCError ("(mdc800_rs232_download) to many retries, giving up..");
return 0;
}
}
else
{
readen+=512;
numtries=0;
}
}
for (i=0; i<4; i++)
{
printCError ("%i: ",i);
for (j=0; j<8; j++)
printCError (" %i", buffer[i*8+j]);
printCError ("\n");
}
return readen;
}
|
/*
Copyright (C) 1998-2001 by Jorrit Tyberghein
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __BOT_H__
#define __BOT_H__
#include "csgeom/math3d.h"
#include "iengine/mesh.h"
#include "csutil/parray.h"
class WalkTest;
struct iMeshObject;
struct iSector;
struct iLight;
struct iEngine;
class csEngine;
/**
* A bot which moves randomly through the dungeon.
*/
class Bot
{
private:
/// Engine handle.
iEngine *engine;
/// Current movement vector (unit vector).
csVector3 d;
/// Position that is followed.
csVector3 follow;
/// Corresponding sector.
iSector* f_sector;
csRef<iMeshWrapper> mesh;
public:
/// Optional dynamic light.
csRef<iLight> light;
public:
/// Constructor.
Bot (iEngine *Engine, iMeshWrapper* botmesh);
/// Destructor.
virtual ~Bot ();
/// Time-base move.
void Move (csTicks elapsed_time);
/// Set movement vector.
void SetBotMove (const csVector3& v);
/// Set bot's sector.
void SetBotSector (iSector* s) { f_sector = s; }
};
/**
* Bot manager.
*/
class BotManager
{
private:
WalkTest* walktest;
csPDelArray<Bot> bots;
csPDelArray<Bot> manual_bots;
public:
BotManager (WalkTest* walktest);
/// Create a bot.
Bot* CreateBot (iSector* where, const csVector3& pos, float dyn_radius, bool manual);
/// Delete the oldest bot.
void DeleteOldestBot (bool manual);
/// Move the bots.
void MoveBots (csTicks elapsed_time);
};
#endif // __BOT_H__
|
/* XMMS2 - X Music Multiplexer System
* Copyright (C) 2003-2012 XMMS2 Team
*
* PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef __XMMSCLIENT_GLIB_H__
#define __XMMSCLIENT_GLIB_H__
#include <glib.h>
#include "xmmsclient/xmmsclient.h"
#ifdef __cplusplus
extern "C" {
#endif
void *xmmsc_mainloop_gmain_init (xmmsc_connection_t *connection);
void xmmsc_mainloop_gmain_shutdown (xmmsc_connection_t *connection, void *udata);
#ifdef __cplusplus
}
#endif
#endif
|
/* permutation/gsl_permute_vector_double.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_PERMUTE_VECTOR_DOUBLE_H__
#define __GSL_PERMUTE_VECTOR_DOUBLE_H__
#include <stdlib.h>
#include "gsl_errno.h"
#include "gsl_permutation.h"
#include "gsl_vector_double.h"
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_permute_vector (const gsl_permutation * p, gsl_vector * v);
int gsl_permute_vector_inverse (const gsl_permutation * p, gsl_vector * v);
__END_DECLS
#endif /* __GSL_PERMUTE_VECTOR_DOUBLE_H__ */
|
/*
* Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEDisplacementMapElement_h
#define SVGFEDisplacementMapElement_h
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "FEDisplacementMap.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedNumber.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
template<>
struct SVGPropertyTraits<ChannelSelectorType> {
static unsigned highestEnumValue() { return CHANNEL_A; }
static String toString(ChannelSelectorType type)
{
switch (type) {
case CHANNEL_UNKNOWN:
return emptyString();
case CHANNEL_R:
return "R";
case CHANNEL_G:
return "G";
case CHANNEL_B:
return "B";
case CHANNEL_A:
return "A";
}
ASSERT_NOT_REACHED();
return emptyString();
}
static ChannelSelectorType fromString(const String& value)
{
if (value == "R")
return CHANNEL_R;
if (value == "G")
return CHANNEL_G;
if (value == "B")
return CHANNEL_B;
if (value == "A")
return CHANNEL_A;
return CHANNEL_UNKNOWN;
}
};
class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
public:
static PassRefPtr<SVGFEDisplacementMapElement> create(const QualifiedName&, Document*);
static ChannelSelectorType stringToChannel(const String&);
private:
SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*);
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
virtual void svgAttributeChanged(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement)
DECLARE_ANIMATED_STRING(In1, in1)
DECLARE_ANIMATED_STRING(In2, in2)
DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType)
DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType)
DECLARE_ANIMATED_NUMBER(Scale, scale)
END_DECLARE_ANIMATED_PROPERTIES
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGFEDisplacementMapElement_h
|
/*
Integrate.c
integrate over the unit hypercube
this file is part of Vegas
last modified 23 May 14 th
*/
typedef struct {
signature_t signature;
count niter;
number nsamples, neval;
Cumulants cumul[];
} State;
static int Integrate(This *t, real *integral, real *error, real *prob)
{
bin_t *bins;
count dim, comp;
int fail;
StateDecl;
csize_t statesize = sizeof(State) +
NCOMP*sizeof(Cumulants) + NDIM*sizeof(Grid);
Sized(State, state, statesize);
Cumulants *c, *C = state->cumul + t->ncomp;
Grid *state_grid = (Grid *)C;
Array(Grid, margsum, NCOMP, NDIM);
Vector(char, out, 128*NCOMP + 256);
if( VERBOSE > 1 ) {
sprintf(out, "Vegas input parameters:\n"
" ndim " COUNT "\n ncomp " COUNT "\n"
ML_NOT(" nvec " NUMBER "\n")
" epsrel " REAL "\n epsabs " REAL "\n"
" flags %d\n seed %d\n"
" mineval " NUMBER "\n maxeval " NUMBER "\n"
" nstart " NUMBER "\n nincrease " NUMBER "\n"
" nbatch " NUMBER "\n gridno %d\n"
" statefile \"%s\"",
t->ndim, t->ncomp,
ML_NOT(t->nvec,)
t->epsrel, t->epsabs,
t->flags, t->seed,
t->mineval, t->maxeval,
t->nstart, t->nincrease, t->nbatch,
t->gridno, t->statefile);
Print(out);
}
if( BadComponent(t) ) return -2;
if( BadDimension(t) ) return -1;
FrameAlloc(t, Master);
ForkCores(t);
Alloc(bins, t->nbatch*t->ndim);
if( (fail = setjmp(t->abort)) ) goto abort;
IniRandom(t);
StateSetup(t);
if( StateReadTest(t) ) {
StateReadOpen(t, fd) {
if( read(fd, state, statesize) != statesize ||
state->signature != StateSignature(t, 1) ) break;
} StateReadClose(t, fd);
t->neval = state->neval;
t->rng.skiprandom(t, t->neval);
}
if( ini ) {
state->niter = 0;
state->nsamples = t->nstart;
FClear(state->cumul);
GetGrid(t, state_grid);
t->neval = 0;
}
/* main iteration loop */
for( ; ; ) {
number nsamples = state->nsamples;
creal jacobian = 1./nsamples;
FClear(margsum);
for( ; nsamples > 0; nsamples -= t->nbatch ) {
cnumber n = IMin(t->nbatch, nsamples);
real *w = t->frame;
real *x = w + n;
real *f = x + n*t->ndim;
real *lastf = f + n*t->ncomp;
bin_t *bin = bins;
while( x < f ) {
real weight = jacobian;
t->rng.getrandom(t, x);
for( dim = 0; dim < t->ndim; ++dim ) {
creal pos = *x*NBINS;
ccount ipos = (count)pos;
creal prev = (ipos == 0) ? 0 : state_grid[dim][ipos - 1];
creal diff = state_grid[dim][ipos] - prev;
*x++ = prev + (pos - ipos)*diff;
*bin++ = ipos;
weight *= diff*NBINS;
}
*w++ = weight;
}
DoSample(t, n, w, f, t->frame, state->niter + 1);
bin = bins;
w = t->frame;
while( f < lastf ) {
creal weight = *w++;
Grid *m = &margsum[0][0];
for( c = state->cumul; c < C; ++c ) {
real wfun = weight*(*f++);
if( wfun ) {
c->sum += wfun;
c->sqsum += wfun *= wfun;
for( dim = 0; dim < t->ndim; ++dim )
m[dim][bin[dim]] += wfun;
}
m += t->ndim;
}
bin += t->ndim;
}
}
fail = 0;
/* compute the integral and error values */
for( c = state->cumul; c < C; ++c ) {
real w = Weight(c->sum, c->sqsum, state->nsamples);
real sigsq = 1/(c->weightsum += w);
real avg = sigsq*(c->avgsum += w*c->sum);
c->avg = LAST ? (sigsq = 1/w, c->sum) : avg;
c->err = sqrt(sigsq);
fail |= (c->err > MaxErr(c->avg));
if( state->niter == 0 ) c->guess = c->sum;
else {
c->chisum += w *= c->sum - c->guess;
c->chisqsum += w*c->sum;
}
c->chisq = c->chisqsum - avg*c->chisum;
c->sum = c->sqsum = 0;
}
if( VERBOSE ) {
char *oe = out + sprintf(out, "\n"
"Iteration " COUNT ": " NUMBER " integrand evaluations so far",
state->niter + 1, t->neval);
for( c = state->cumul, comp = 0; c < C; ++c )
oe += sprintf(oe, "\n[" COUNT "] "
REAL " +- " REAL " \tchisq " REAL " (" COUNT " df)",
++comp, c->avg, c->err, c->chisq, state->niter);
Print(out);
}
if( fail == 0 && t->neval >= t->mineval ) break;
if( t->neval >= t->maxeval && !StateWriteTest(t) ) break;
if( t->ncomp == 1 )
for( dim = 0; dim < t->ndim; ++dim )
RefineGrid(t, state_grid[dim], margsum[0][dim]);
else {
for( dim = 0; dim < t->ndim; ++dim ) {
Grid wmargsum;
Zap(wmargsum);
for( comp = 0; comp < t->ncomp; ++comp ) {
real w = state->cumul[comp].avg;
if( w != 0 ) {
creal *m = margsum[comp][dim];
count bin;
w = 1/Sq(w);
for( bin = 0; bin < NBINS; ++bin )
wmargsum[bin] += w*m[bin];
}
}
RefineGrid(t, state_grid[dim], wmargsum);
}
}
++state->niter;
state->nsamples += t->nincrease;
if( StateWriteTest(t) ) {
state->signature = StateSignature(t, 1);
state->neval = t->neval;
StateWriteOpen(t, fd) {
StateWrite(fd, state, statesize);
} StateWriteClose(t, fd);
if( t->neval >= t->maxeval ) break;
}
}
for( comp = 0; comp < t->ncomp; ++comp ) {
cCumulants *c = &state->cumul[comp];
integral[comp] = c->avg;
error[comp] = c->err;
prob[comp] = ChiSquare(c->chisq, state->niter);
}
abort:
PutGrid(t, state_grid);
free(bins);
FrameFree(t, Master);
StateRemove(t);
return fail;
}
|
/// @author Alexander Rykovanov 2013
/// @email rykovanov.as@gmail.com
/// @brief Opc binary cnnection channel.
/// @license GNU LGPL
///
/// Distributed under the GNU LGPL License
/// (See accompanying file LICENSE or copy at
/// http://www.gnu.org/licenses/lgpl.html)
///
#ifndef __OPC_UA_BINARY_MESSAGE_IdENTIFIERS
#define __OPC_UA_BINARY_MESSAGE_IdENTIFIERS
namespace OpcUa
{
enum MessageId
{
INVALID = 0,
ACTIVATE_SESSION_REQUEST = 0x1d3, //467;
ACTIVATE_SESSION_RESPONSE = 0x1d6, //470;
BROWSE_REQUEST = 0x20f, // 527;
BROWSE_RESPONSE = 0x212, //530;
BROWSE_NEXT_REQUEST = 0x215, // 533
BROWSE_NEXT_RESPONSE = 0x218, // 536
CLOSE_SECURE_CHANNEL_REQUEST = 0x1c4, // 452
CLOSE_SESSION_REQUEST = 0x1d9, // 473;
CLOSE_SESSION_RESPONSE = 0x1dc, // 476;
// Session services
CREATE_SESSION_REQUEST = 0x1cd, // 461;
CREATE_SESSION_RESPONSE = 0x1d0, // 464;
// Endpoints services
FIND_ServerS_REQUEST = 0x1A6, // 422
FIND_ServerS_RESPONSE = 0x1A9, // 425
GET_ENDPOINTS_REQUEST = 0x1ac, // 428
GET_ENDPOINTS_RESPONSE = 0x1af, // 431
// Secure channel services
OPEN_SECURE_CHANNEL_REQUEST = 0x1be, // 446
OPEN_SECURE_CHANNEL_RESPONSE = 0x1c1, // 449
TRANSLATE_BROWSE_PATHS_TO_NODE_IdS_REQUEST = 0x22A, // 554
TRANSLATE_BROWSE_PATHS_TO_NODE_IdS_RESPONSE = 0x22D, // 557
REGISTER_NODES_REQUEST = 0x230, // 560
REGISTER_NODES_RESPONSE = 0x233, // 563
UNREGISTER_NODES_REQUEST = 0x234, // 564
UNREGISTER_NODES_RESPONSE = 0x237, // 567
READ_REQUEST = 0x277, // 631
READ_RESPONSE = 0x27A, // 634
WRITE_REQUEST = 0x2A1, //673
WRITE_RESPONSE = 0x2A4, // 676
CALL_REQUEST = 712,
CALL_RESPONSE = 715, // 754
CREATE_MONITORED_ITEMS_REQUEST = 0x2EF, // 751
CREATE_MONITORED_ITEMS_RESPONSE = 0x2F2, // 754
DELETE_MONITORED_ITEMS_REQUEST = 0x30d, // 781
DELETE_MONITORED_ITEMS_RESPONSE = 0x310, // 784
CREATE_SUBSCRIPTION_REQUEST = 0x313, //787
CREATE_SUBSCRIPTION_RESPONSE = 0x316, //790
DELETE_SUBSCRIPTION_REQUEST = 0x34f, //847
DELETE_SUBSCRIPTION_RESPONSE = 0x352, //850
MODIFY_SUBSCRIPTION_REQUEST = 0x319, //793
MODIFY_SUBSCRIPTION_RESPONSE = 0x31c, //796
PUBLISH_REQUEST = 0x33A, // 826
PUBLISH_RESPONSE = 0x33D, // 829
REPUBLISH_REQUEST = 832,
REPUBLISH_RESPONSE = 835,
SET_PUBLISHING_MODE_REQUEST = 0x31F, // 799
SET_PUBLISHING_MODE_RESPONSE = 0x322, // 802
ADD_NODES_REQUEST = 0x1e8, //488;
ADD_NODES_RESPONSE = 0x1eb, //491;
DELETE_NODES_REQUEST = 0x1f4, //500;
DELETE_NODES_RESPONSE = 0x1f7, //503;
ADD_REFERENCES_REQUEST = 0x1ee, //494;
ADD_REFERENCES_RESPONSE = 0x1f1, //497;
DELETE_REFERENCES_REQUEST = 0x1fa, //506;
DELETE_REFERENCES_RESPONSE = 0x1fd, //509;
SERVICE_FAULT = 0x18d, //397;
};
struct NodeId;
MessageId GetMessageId(const NodeId & id);
}
#endif // __OPC_UA_BINARY_MESSAGE_IdENTIFIERS
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.