text stringlengths 4 6.14k |
|---|
/* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 15. February 2012
* $Revision: V1.1.0
*
* Project: CMSIS DSP Library
* Title: arm_cmplx_conj_q15.c
*
* Description: Q15 complex conjugate.
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Version 1.1.0 2012/02/15
* Updated with more optimizations, bug fixes and minor API changes.
*
* Version 1.0.10 2011/7/15
* Big Endian support added and Merged M0 and M3/M4 Source code.
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.2 2010/11/11
* Documentation updated.
*
* Version 1.0.1 2010/10/05
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20
* Production release and review comments incorporated.
* ---------------------------------------------------------------------------- */
#include "arm_math.h"
/**
* @ingroup groupCmplxMath
*/
/**
* @addtogroup cmplx_conj
* @{
*/
/**
* @brief Q15 complex conjugate.
* @param *pSrc points to the input vector
* @param *pDst points to the output vector
* @param numSamples number of complex samples in each vector
* @return none.
*
* <b>Scaling and Overflow Behavior:</b>
* \par
* The function uses saturating arithmetic.
* The Q15 value -1 (0x8000) will be saturated to the maximum allowable positive value 0x7FFF.
*/
void arm_cmplx_conj_q15(
q15_t * pSrc,
q15_t * pDst,
uint32_t numSamples)
{
#ifndef ARM_MATH_CM0
/* Run the below code for Cortex-M4 and Cortex-M3 */
uint32_t blkCnt; /* loop counter */
q31_t in1, in2, in3, in4;
q31_t zero = 0;
/*loop Unrolling */
blkCnt = numSamples >> 2u;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
while(blkCnt > 0u)
{
/* C[0]+jC[1] = A[0]+ j (-1) A[1] */
/* Calculate Complex Conjugate and then store the results in the destination buffer. */
in1 = *__SIMD32(pSrc)++;
in2 = *__SIMD32(pSrc)++;
in3 = *__SIMD32(pSrc)++;
in4 = *__SIMD32(pSrc)++;
#ifndef ARM_MATH_BIG_ENDIAN
in1 = __QASX(zero, in1);
in2 = __QASX(zero, in2);
in3 = __QASX(zero, in3);
in4 = __QASX(zero, in4);
#else
in1 = __QSAX(zero, in1);
in2 = __QSAX(zero, in2);
in3 = __QSAX(zero, in3);
in4 = __QSAX(zero, in4);
#endif // #ifndef ARM_MATH_BIG_ENDIAN
in1 = ((uint32_t) in1 >> 16) | ((uint32_t) in1 << 16);
in2 = ((uint32_t) in2 >> 16) | ((uint32_t) in2 << 16);
in3 = ((uint32_t) in3 >> 16) | ((uint32_t) in3 << 16);
in4 = ((uint32_t) in4 >> 16) | ((uint32_t) in4 << 16);
*__SIMD32(pDst)++ = in1;
*__SIMD32(pDst)++ = in2;
*__SIMD32(pDst)++ = in3;
*__SIMD32(pDst)++ = in4;
/* Decrement the loop counter */
blkCnt--;
}
/* If the numSamples is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
blkCnt = numSamples % 0x4u;
while(blkCnt > 0u)
{
/* C[0]+jC[1] = A[0]+ j (-1) A[1] */
/* Calculate Complex Conjugate and then store the results in the destination buffer. */
*pDst++ = *pSrc++;
*pDst++ = __SSAT(-*pSrc++, 16);
/* Decrement the loop counter */
blkCnt--;
}
#else
q15_t in;
/* Run the below code for Cortex-M0 */
while(numSamples > 0u)
{
/* realOut + j (imagOut) = realIn+ j (-1) imagIn */
/* Calculate Complex Conjugate and then store the results in the destination buffer. */
*pDst++ = *pSrc++;
in = *pSrc++;
*pDst++ = (in == (q15_t) 0x8000) ? 0x7fff : -in;
/* Decrement the loop counter */
numSamples--;
}
#endif /* #ifndef ARM_MATH_CM0 */
}
/**
* @} end of cmplx_conj group
*/
|
#ifndef _WIN_INPUT_H_
#define _WIN_INPUT_H_
bool IN_ControllersChanged(int inserted[], int removed[]);
#if defined (_XBOX ) || defined (_GAMECUBE)
#define _USE_RUMBLE
#endif
bool IN_AnyButtonPressed(void);
void IN_enableRumble( void );
void IN_disableRumble( void );
bool IN_usingRumble( void );
int IN_CreateRumbleScript(int controller, int numStates, bool deleteWhenFinished);
void IN_DeleteRumbleScript(int whichScript);
void IN_KillRumbleScript(int whichScript);
void IN_ExecuteRumbleScript(int whichScript);
bool IN_AdvanceToNextState(int whichScript);
void IN_KillRumbleScripts(int controller);
void IN_KillRumbleScripts( void );
#define IN_CMD_GOTO_XTIMES -5
#define IN_CMD_GOTO -6
#define IN_CMD_DEC_ARG2 -7
#define IN_CMD_INC_ARG2 -8
#define IN_CMD_DEC_ARG1 -9
#define IN_CMD_INC_ARG1 -10
#ifdef _XBOX
#define IN_CMD_DEC_LEFT -70
#define IN_CMD_DEC_RIGHT -71
#define IN_CMD_INC_LEFT -72
#define IN_CMD_INC_RIGHT -73
#endif
#if defined (_XBOX) // ----- XBOX --------
int IN_AddRumbleState(int whichScript, int leftSpeed, int rightSpeed, int timeInMs);
int IN_AddEffectFade4(int whichScript, int startLeft, int startRight, int endLeft, int endRight, int timeInMs);
int IN_AddEffectFadeExp6(int whichScript, int startLeft, int startRight, int endLeft, int endRight, char factor, int timeInMs);
#elif defined (_GAMECUBE) // ---- GAME CUBE ----
#define IN_GCACTION_START 1
#define IN_GCACTION_STOP 2
#define IN_GCACTION_STOPHARD 3
int IN_AddRumbleState(int whichScript, int action, int timeInMs, int arg = 0);
#endif // ------END IF-------
int IN_AddRumbleStateSpecial(int whichScript, int action, int arg1, int arg2);
void IN_KillRumbleState(int whichScript, int index);
void IN_PauseRumbling(int controller);
void IN_PauseRumbling( void );
void IN_UnPauseRumbling(int controller);
void IN_UnPauseRumbling( void );
void IN_TogglePauseRumbling(int controller);
void IN_TogglePauseRumbling( void );
int IN_GetMainController();
void IN_SetMainController(int id);
void IN_PadUnplugged(int controller);
void IN_PadPlugged(int controller);
void IN_CommonJoyPress(int controller, fakeAscii_t button, bool pressed);
void IN_CommonUpdate(void);
#define IN_MAX_JOYSTICKS 2
// Stores gamepad joystick info
struct JoystickInfo
{
bool valid;
float x, y;
};
// Stores gamepad id and joysick info
struct PadInfo
{
JoystickInfo joyInfo[2];
int padId;
};
// Buffer for gamepad info
extern PadInfo _padInfo;
bool IN_RumbleAdjust(int controller, int left, int right);
void IN_RumbleInit (void);
void IN_RumbleShutdown (void);
void IN_RumbleFrame (void);
#endif // END _WIN_INPUT_H_
|
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Where is System V/SH ABI? */
#ifndef _SYS_UCONTEXT_H
#define _SYS_UCONTEXT_H 1
#include <features.h>
#include <signal.h>
/* We need the signal context definitions even if they are not used
included in <signal.h>. */
#include <bits/sigcontext.h>
typedef int greg_t;
/* Number of general registers. */
#define NFPREG 16
/* Container for all general registers. */
typedef greg_t gregset_t[NFPREG];
#ifdef __USE_GNU
/* Number of each register is the `gregset_t' array. */
enum
{
R0 = 0,
#define R0 R0
R1 = 1,
#define R1 R1
R2 = 2,
#define R2 R2
R3 = 3,
#define R3 R3
R4 = 4,
#define R4 R4
R5 = 5,
#define R5 R5
R6 = 6,
#define R6 R6
R7 = 7,
#define R7 R7
R8 = 8,
#define R8 R8
R9 = 9,
#define R9 R9
R10 = 10,
#define R10 R10
R11 = 11,
#define R11 R11
R12 = 12,
#define R12 R12
R13 = 13,
#define R13 R13
R14 = 14,
#define R14 R14
R15 = 15,
#define R15 R15
};
#endif
typedef int freg_t;
/* Number of FPU registers. */
#define NFPREG 16
/* Structure to describe FPU registers. */
typedef freg_t fpregset_t[NFPREG];
/* Context to describe whole processor state. */
typedef struct
{
unsigned int oldmask;
/* CPU registers */
gregset_t gregs;
unsigned int pc;
unsigned int pr;
unsigned int sr;
unsigned int gbr;
unsigned int mach;
unsigned int macl;
#ifdef __SH4__
/* FPU registers */
fpregset_t fpregs;
fpregset_t xfpregs;
unsigned int fpscr;
unsigned int fpul;
unsigned int ownedfp;
#endif
} mcontext_t;
/* Userlevel context. */
typedef struct ucontext
{
unsigned long int uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
__sigset_t uc_sigmask;
} ucontext_t;
#endif /* sys/ucontext.h */
|
#ifndef Py_CPYTHON_PYMEM_H
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize);
PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
/* Try to get the allocators name set by _PyMem_SetupAllocators(). */
PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
/* strdup() using PyMem_RawMalloc() */
PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
/* strdup() using PyMem_Malloc() */
PyAPI_FUNC(char *) _PyMem_Strdup(const char *str);
/* wcsdup() using PyMem_RawMalloc() */
PyAPI_FUNC(wchar_t*) _PyMem_RawWcsdup(const wchar_t *str);
typedef enum {
/* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */
PYMEM_DOMAIN_RAW,
/* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */
PYMEM_DOMAIN_MEM,
/* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */
PYMEM_DOMAIN_OBJ
} PyMemAllocatorDomain;
typedef enum {
PYMEM_ALLOCATOR_NOT_SET = 0,
PYMEM_ALLOCATOR_DEFAULT = 1,
PYMEM_ALLOCATOR_DEBUG = 2,
PYMEM_ALLOCATOR_MALLOC = 3,
PYMEM_ALLOCATOR_MALLOC_DEBUG = 4,
#ifdef WITH_PYMALLOC
PYMEM_ALLOCATOR_PYMALLOC = 5,
PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6,
#endif
} PyMemAllocatorName;
typedef struct {
/* user context passed as the first argument to the 4 functions */
void *ctx;
/* allocate a memory block */
void* (*malloc) (void *ctx, size_t size);
/* allocate a memory block initialized by zeros */
void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
/* allocate or resize a memory block */
void* (*realloc) (void *ctx, void *ptr, size_t new_size);
/* release a memory block */
void (*free) (void *ctx, void *ptr);
} PyMemAllocatorEx;
/* Get the memory block allocator of the specified domain. */
PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain,
PyMemAllocatorEx *allocator);
/* Set the memory block allocator of the specified domain.
The new allocator must return a distinct non-NULL pointer when requesting
zero bytes.
For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL
is not held when the allocator is called.
If the new allocator is not a hook (don't call the previous allocator), the
PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks
on top on the new allocator. */
PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
PyMemAllocatorEx *allocator);
/* Setup hooks to detect bugs in the following Python memory allocator
functions:
- PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
- PyMem_Malloc(), PyMem_Realloc(), PyMem_Free()
- PyObject_Malloc(), PyObject_Realloc() and PyObject_Free()
Newly allocated memory is filled with the byte 0xCB, freed memory is filled
with the byte 0xDB. Additional checks:
- detect API violations, ex: PyObject_Free() called on a buffer allocated
by PyMem_Malloc()
- detect write before the start of the buffer (buffer underflow)
- detect write after the end of the buffer (buffer overflow)
The function does nothing if Python is not compiled is debug mode. */
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
#ifdef __cplusplus
}
#endif
|
/*
* wrapper to call all the mib module initialization functions
*/
#include <net-snmp/agent/mib_module_config.h>
#include <net-snmp/net-snmp-config.h>
#if HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "m2m.h"
#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
#include <net-snmp/data_access/interface.h>
#endif
#include "mibgroup/struct.h"
#include <net-snmp/agent/mib_modules.h>
#include <net-snmp/agent/table.h>
#include <net-snmp/agent/table_iterator.h>
#include "mib_module_includes.h"
static int need_shutdown = 0;
static int
_shutdown_mib_modules(int majorID, int minorID, void *serve, void *client)
{
if (! need_shutdown) {
netsnmp_assert(need_shutdown == 1);
}
else {
#include "mib_module_shutdown.h"
need_shutdown = 0;
}
return SNMPERR_SUCCESS; /* callback rc ignored */
}
void
init_mib_modules(void)
{
static int once = 0;
#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
netsnmp_access_interface_init();
#endif
# include "mib_module_inits.h"
need_shutdown = 1;
if (once == 0) {
int rc;
once = 1;
rc = snmp_register_callback( SNMP_CALLBACK_LIBRARY,
SNMP_CALLBACK_SHUTDOWN,
_shutdown_mib_modules,
NULL);
if( rc != SNMP_ERR_NOERROR )
snmp_log(LOG_ERR, "error registering for SHUTDOWN callback "
"for mib modules\n");
}
}
|
/*
* Copyright (C) 2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
class TiXmlNode;
/*!
* \brief Interface for classes that can map buttons to Kodi actions
*/
class IButtonMapper
{
public:
virtual ~IButtonMapper() = default;
virtual void MapActions(int windowId, const TiXmlNode *pDevice) = 0;
virtual void Clear() = 0;
};
|
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef ctrlplane_boost_ssl_client_h
#define ctrlplane_boost_ssl_client_h
#include <boost/asio/buffer.hpp>
#include <boost/asio/detail/socket_option.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/placeholders.hpp>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include "boost/generator_iterator.hpp"
#include "boost/random.hpp"
#include <boost/system/error_code.hpp>
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
#include <boost/asio/ssl.hpp>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#include <boost/asio/streambuf.hpp>
#include <boost/function.hpp>
using namespace std;
using boost::system::error_code;
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SslStream;
class BoostSslClient {
public:
BoostSslClient(boost::asio::io_service &io_service);
void Start(const std::string &user, const std::string& passwd,
const std::string &host, const std::string &port);
void DoResolve();
void ReadResolveResponse(const boost::system::error_code& error,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
void ProcConnectResponse(const boost::system::error_code& error);
void ProcHandshakeResponse(const boost::system::error_code& error);
void SendPollRequest();
void ProcPollWrite(const boost::system::error_code& error,
size_t header_length);
void ProcResponse(const boost::system::error_code& error,
size_t header_length);
void ProcFullResponse(const boost::system::error_code& error,
size_t header_length);
bool ShouldSleep(int *sleeptime);
private:
void BuildPollRequest(std::ostringstream& poll_msg);
boost::asio::ip::tcp::resolver resolver_;
boost::asio::ssl::context context_;
SslStream socket_;
std::string username_;
std::string password_;
std::string host_;
std::string port_;
boost::asio::ip::tcp::endpoint endpoint_;
boost::asio::streambuf reply_;
std::ostringstream reply_ss_;
};
#endif // ctrlplane_boost_ssl_client_h
|
" \n\
#ifdef GL_ES \n\
precision lowp float; \n\
#endif \n\
\n\
varying vec4 v_fragmentColor; \n\
varying vec2 v_texCoord; \n\
uniform sampler2D CC_Texture0; \n\
uniform vec3 v_effectColor; \n\
uniform vec2 v_shadowOffset; \n\
\n\
void main() \n\
{ \n\
float dist = texture2D(CC_Texture0, v_texCoord).a; \n\
//todo:support for assign offset,but the shadow is limited by renderable area \n\
vec2 offset = vec2(-0.0015,-0.0015); \n\
float dist2 = texture2D(CC_Texture0, v_texCoord+offset).a; \n\
//todo:Implementation 'fwidth' for glsl 1.0 \n\
//float width = fwidth(dist); \n\
//assign width for constant will lead to a little bit fuzzy,it's temporary measure.\n\
float width = 0.04; \n\
// If v is 1 then it's inside the Glyph; if it's 0 then it's outside \n\
float v = smoothstep(0.5-width, 0.5+width, dist); \n\
// If s is 1 then it's inside the shadow; if it's 0 then it's outside \n\
float s = smoothstep(0.5-width, 0.5+width, dist2); \n\
if(v == 1.0) gl_FragColor = vec4(v_fragmentColor.rgb,1.0); \n\
else if(v == 0.0) gl_FragColor = vec4(v_effectColor,s); \n\
else \n\
{ \n\
vec3 color = v_fragmentColor.rgb*v + v_effectColor*s*(1.0-v); \n\
gl_FragColor = vec4(color,max(s,v)); \n\
} \n\
} \n\
";
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2011. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek Software")
* have been modified by MediaTek Inc. All revisions are subject to any receiver's
* applicable license agreements with MediaTek Inc.
*/
#ifndef _CIPHERIMG_H
#define _CIPHERIMG_H
/**************************************************************************
* AES
**************************************************************************/
typedef enum
{
AES_VER_LEGACY = 0,
AES_VER_SO
} AES_VER;
/**************************************************************************
* EXPORTED FUNCTIONS
**************************************************************************/
extern int sec_aes_init(void);
extern int lib_aes_enc(unsigned char* input_buf, unsigned int input_len, unsigned char* output_buf, unsigned int output_len);
extern int lib_aes_dec(unsigned char* input_buf, unsigned int input_len, unsigned char* output_buf, unsigned int output_len);
extern int lib_aes_init_key(unsigned char* key_buf, unsigned int key_len, AES_VER ver);
extern int lib_aes_init_vector(AES_VER ver);
#endif /*_CIPHERIMG_H*/
|
/**
* collectd - src/tests/common_test.c
* Copyright (C) 2013 Florian octo Forster
*
* 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.
*
* Authors:
* Florian octo Forster <octo at collectd.org>
*/
#include "tests/macros.h"
#include "common.h"
DEF_TEST(sstrncpy)
{
char buffer[16] = "";
char *ptr = &buffer[4];
char *ret;
buffer[0] = buffer[1] = buffer[2] = buffer[3] = 0xff;
buffer[12] = buffer[13] = buffer[14] = buffer[15] = 0xff;
ret = sstrncpy (ptr, "foobar", 8);
OK(ret == ptr);
STREQ ("foobar", ptr);
OK(buffer[3] == buffer[12]);
ret = sstrncpy (ptr, "abc", 8);
OK(ret == ptr);
STREQ ("abc", ptr);
OK(buffer[3] == buffer[12]);
ret = sstrncpy (ptr, "collectd", 8);
OK(ret == ptr);
OK(ptr[7] == 0);
STREQ ("collect", ptr);
OK(buffer[3] == buffer[12]);
return (0);
}
DEF_TEST(ssnprintf)
{
char buffer[16] = "";
char *ptr = &buffer[4];
int status;
buffer[0] = buffer[1] = buffer[2] = buffer[3] = 0xff;
buffer[12] = buffer[13] = buffer[14] = buffer[15] = 0xff;
status = ssnprintf (ptr, 8, "%i", 1337);
OK(status == 4);
STREQ ("1337", ptr);
status = ssnprintf (ptr, 8, "%s", "collectd");
OK(status == 8);
OK(ptr[7] == 0);
STREQ ("collect", ptr);
OK(buffer[3] == buffer[12]);
return (0);
}
DEF_TEST(sstrdup)
{
char *ptr;
ptr = sstrdup ("collectd");
OK(ptr != NULL);
STREQ ("collectd", ptr);
sfree(ptr);
OK(ptr == NULL);
ptr = sstrdup (NULL);
OK(ptr == NULL);
return (0);
}
DEF_TEST(strsplit)
{
char buffer[32];
char *fields[8];
int status;
strncpy (buffer, "foo bar", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 2);
STREQ ("foo", fields[0]);
STREQ ("bar", fields[1]);
strncpy (buffer, "foo \t bar", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 2);
STREQ ("foo", fields[0]);
STREQ ("bar", fields[1]);
strncpy (buffer, "one two\tthree\rfour\nfive", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 5);
STREQ ("one", fields[0]);
STREQ ("two", fields[1]);
STREQ ("three", fields[2]);
STREQ ("four", fields[3]);
STREQ ("five", fields[4]);
strncpy (buffer, "\twith trailing\n", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 2);
STREQ ("with", fields[0]);
STREQ ("trailing", fields[1]);
strncpy (buffer, "1 2 3 4 5 6 7 8 9 10 11 12 13", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 8);
STREQ ("7", fields[6]);
STREQ ("8", fields[7]);
strncpy (buffer, "single", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 1);
STREQ ("single", fields[0]);
strncpy (buffer, "", sizeof (buffer));
status = strsplit (buffer, fields, 8);
OK(status == 0);
return (0);
}
DEF_TEST(strjoin)
{
char buffer[16];
char *fields[4];
int status;
fields[0] = "foo";
fields[1] = "bar";
fields[2] = "baz";
fields[3] = "qux";
status = strjoin (buffer, sizeof (buffer), fields, 2, "!");
OK(status == 7);
STREQ ("foo!bar", buffer);
status = strjoin (buffer, sizeof (buffer), fields, 1, "!");
OK(status == 3);
STREQ ("foo", buffer);
status = strjoin (buffer, sizeof (buffer), fields, 0, "!");
OK(status < 0);
status = strjoin (buffer, sizeof (buffer), fields, 2, "rcht");
OK(status == 10);
STREQ ("foorchtbar", buffer);
status = strjoin (buffer, sizeof (buffer), fields, 4, "");
OK(status == 12);
STREQ ("foobarbazqux", buffer);
status = strjoin (buffer, sizeof (buffer), fields, 4, "!");
OK(status == 15);
STREQ ("foo!bar!baz!qux", buffer);
fields[0] = "0123";
fields[1] = "4567";
fields[2] = "8901";
fields[3] = "2345";
status = strjoin (buffer, sizeof (buffer), fields, 4, "-");
OK(status < 0);
return (0);
}
DEF_TEST(strunescape)
{
char buffer[16];
int status;
strncpy (buffer, "foo\\tbar", sizeof (buffer));
status = strunescape (buffer, sizeof (buffer));
OK(status == 0);
STREQ ("foo\tbar", buffer);
strncpy (buffer, "\\tfoo\\r\\n", sizeof (buffer));
status = strunescape (buffer, sizeof (buffer));
OK(status == 0);
STREQ ("\tfoo\r\n", buffer);
strncpy (buffer, "With \\\"quotes\\\"", sizeof (buffer));
status = strunescape (buffer, sizeof (buffer));
OK(status == 0);
STREQ ("With \"quotes\"", buffer);
/* Backslash before null byte */
strncpy (buffer, "\\tbackslash end\\", sizeof (buffer));
status = strunescape (buffer, sizeof (buffer));
OK(status != 0);
STREQ ("\tbackslash end", buffer);
return (0);
/* Backslash at buffer end */
strncpy (buffer, "\\t3\\56", sizeof (buffer));
status = strunescape (buffer, 4);
OK(status != 0);
OK(buffer[0] == '\t');
OK(buffer[1] == '3');
OK(buffer[2] == 0);
OK(buffer[3] == 0);
OK(buffer[4] == '5');
OK(buffer[5] == '6');
OK(buffer[6] == '7');
return (0);
}
int main (void)
{
RUN_TEST(sstrncpy);
RUN_TEST(ssnprintf);
RUN_TEST(sstrdup);
RUN_TEST(strsplit);
RUN_TEST(strjoin);
RUN_TEST(strunescape);
END_TEST;
}
/* vim: set sw=2 sts=2 et : */
|
/***************************************************************
* Name: ThreadSearchFindData
*
* Purpose: This class stores search data.
*
* Author: Jerome ANTOINE
* Created: 2007-10-08
* Copyright: Jerome ANTOINE
* License: GPL
**************************************************************/
#ifndef THREAD_SEARCH_FIND_DATA_H
#define THREAD_SEARCH_FIND_DATA_H
#include <wx/string.h>
// Possible search scopes.
enum eSearchScope
{
ScopeOpenFiles = 1,
ScopeSnippetFiles = 2,
ScopeWorkspaceFiles = 4,
ScopeDirectoryFiles = 8
};
// No comments, basic class
class ThreadSearchFindData
{
public:
ThreadSearchFindData();
ThreadSearchFindData(const ThreadSearchFindData& findData);
ThreadSearchFindData& operator= (const ThreadSearchFindData& findData);
~ThreadSearchFindData() {}
void UpdateSearchScope(eSearchScope scope, bool bValue);
bool MustSearchInOpenFiles() {return (m_Scope & ScopeOpenFiles) != 0;}
bool MustSearchInProject () {return (m_Scope & ScopeSnippetFiles) != 0;}
bool MustSearchInCodeSnippetsTree () {return (m_Scope & ScopeSnippetFiles) != 0;}
bool MustSearchInWorkspace() {return (m_Scope & ScopeWorkspaceFiles) != 0;}
bool MustSearchInDirectory() {return (m_Scope & ScopeDirectoryFiles) != 0;}
// Setters
void SetFindText (const wxString& findText) {m_FindText = findText;}
void SetMatchWord (bool matchWord) {m_MatchWord = matchWord;}
void SetStartWord (bool startWord) {m_StartWord = startWord;}
void SetMatchCase (bool matchCase) {m_MatchCase = matchCase;}
void SetRegEx (bool regEx) {m_RegEx = regEx;}
void SetScope (int scope) {m_Scope = scope;}
void SetSearchPath (const wxString& searchPath) {m_SearchPath = searchPath;}
void SetSearchMask (const wxString& searchMask) {m_SearchMask = searchMask;}
void SetRecursiveSearch(bool recursiveSearch) {m_RecursiveSearch = recursiveSearch;}
void SetHiddenSearch (bool hiddenSearch) {m_HiddenSearch = hiddenSearch;}
wxString GetFindText() const {return m_FindText;}
bool GetMatchWord() const {return m_MatchWord;}
bool GetStartWord() const {return m_StartWord;}
bool GetMatchCase() const {return m_MatchCase;}
bool GetRegEx() const {return m_RegEx;}
int GetScope() const {return m_Scope;}
wxString GetSearchPath() const {return m_SearchPath;}
wxString GetSearchMask() const {return m_SearchMask;}
bool GetRecursiveSearch() const {return m_RecursiveSearch;}
bool GetHiddenSearch() const {return m_HiddenSearch;}
private:
wxString m_FindText;
bool m_MatchWord;
bool m_StartWord;
bool m_MatchCase;
bool m_RegEx;
int m_Scope;
wxString m_SearchPath;
wxString m_SearchMask;
bool m_RecursiveSearch;
bool m_HiddenSearch;
};
#endif // THREAD_SEARCH_FIND_DATA_H
|
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** Very simple test code for the vcfiled locking
*/
#include "vcfiled_check.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
static void usage(const char *prog)
{
fprintf(stderr, "usage: %s lock|check <lockfile>\n", prog);
exit(1);
}
static void logmsg(int level, const char *fmt, ...)
{
(void)level;
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}
int main(int argc, const char **argv)
{
if (argc != 3)
{
usage(argv[0]);
}
const char *lockfile = argv[2];
if (strcmp(argv[1], "lock") == 0)
{
int rc = vcfiled_lock(lockfile, logmsg);
if (rc)
{
printf("failed to lock %s\n", lockfile);
exit(1);
}
sleep(300);
}
else if (strcmp(argv[1], "check") == 0)
{
printf("%s\n",
vcfiled_is_running(lockfile) ?
"running" : "not running");
}
else
{
usage(argv[0]);
}
return 0;
}
|
/* sdb - MIT - Copyright 2012-2017 - pancake */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rangstr.c"
#include "../types.h"
SDB_IPI void json_path_first(Rangstr *s) {
char *p;
if (!s->p) {
return;
}
p = strchr (s->p, '.');
s->f = 0;
s->t = p? (size_t)(p - s->p): strlen (s->p);
}
SDB_IPI int json_path_next(Rangstr *s) {
int stop = '.';
if (!s||!s->p||!s->p[s->t]) {
return 0;
}
if (!s->next) {
return 0;
}
if (s->p[s->t] == '"') {
s->t++;
}
rep:
if (s->p[s->t] == '[') {
s->type = '[';
stop = ']';
} else {
s->type = 0;
}
s->f = ++s->t;
if (s->p[s->t] == stop) {
s->f = ++s->t;
}
if (!s->p[s->t]) {
return 0;
}
while (s->p[s->t] != stop) {
if (!s->p[s->t]) {
s->next = 0;
return 1;
}
if (s->p[s->t] == '[') {
break;
}
s->t++;
}
if (s->f == s->t) {
goto rep;
}
if (s->p[s->f] == '"') {
s->f++;
s->t--;
}
return 1;
}
#if 0
typedef int (*JSONCallback)();
int json_foreach(const char *s, JSONCallback cb UNUSED) {
int i, len, ret;
unsigned short *res = NULL;
len = strlen (s);
res = malloc (len);
ret = sdb_js0n ((const unsigned char *)s, len, res);
if (!ret) return 0;
if (*s=='[') {
for (i=0; res[i]; i+=2) {
printf ("%d %.*s\n", i, res[i+1], s+res[i]);
}
} else {
for (i=0; res[i]; i+=4) {
printf ("%.*s = ", res[i+1], s+res[i]);
printf ("%.*s\n", res[i+3], s+res[i+2]);
}
}
return 1;
}
#endif
#if 0 // UNUSED
SDB_IPI int json_walk (const char *s) {
RangstrType *res;
int i, ret, len = strlen (s);
res = malloc (len+1);
ret = sdb_js0n ((const unsigned char *)s, len, res);
if (!ret) {
free (res);
return 0;
}
if (*s=='[' || *s=='{') {
for (i=0; res[i]; i+=2) {
printf ("%d %.*s\n", i, res[i+1], s+res[i]);
}
} else {
for (i=0; res[i]; i+=4) {
printf ("%.*s = ", res[i+1], s+res[i]);
printf ("%.*s\n", res[i+3], s+res[i+2]);
}
}
free (res);
return 1;
}
#endif
SDB_IPI Rangstr json_find (const char *s, Rangstr *rs) {
#define RESFIXSZ 1024
RangstrType resfix[RESFIXSZ] = {0};
RangstrType *res = resfix;
int i, j, n, len, ret;
Rangstr rsn;
if (!s) {
return rangstr_null ();
}
len = strlen (s);
if (len > RESFIXSZ) {
res = calloc (len + 1, sizeof (RangstrType));
if (!res) {
eprintf ("Cannot allocate %d byte%s\n",
len + 1, (len > 1)? "s": "");
return rangstr_null ();
}
}
ret = sdb_js0n ((const unsigned char *)s, len, res);
#define PFREE(x) if (x && x != resfix) free (x)
if (ret > 0) {
PFREE (res);
return rangstr_null ();
}
if (*s == '[') {
n = rangstr_int (rs);
if (n < 0) {
goto beach;
}
for (i = j = 0; res[i] && j < n; i += 2, j++);
if (!res[i]) {
goto beach;
}
rsn = rangstr_news (s, res, i);
PFREE (res);
return rsn;
} else {
for (i=0; res[i]; i+=4) {
Rangstr rsn = rangstr_news (s, res, i);
if (!rangstr_cmp (rs, &rsn)) {
rsn = rangstr_news (s, res, i+2);
PFREE (res);
return rsn;
}
}
}
beach:
PFREE (res);
return rangstr_null ();
}
SDB_IPI Rangstr json_get (const char *js, const char *p) {
int x, n = 0;
size_t rst;
Rangstr rj2, rj = rangstr_new (js);
Rangstr rs = rangstr_new (p);
json_path_first (&rs);
do {
rst = rs.t;
rs.f++;
x = rangstr_find (&rs, '[');
rs.f--;
if (x != -1)
rs.t = x;
#if 0
printf ("x = %d f = %d t = %d\n", x, rs.f, rs.t);
fprintf (stderr, "source (%s)\n", rangstr_dup (&rs));
fprintf (stderr, "onjson (%s)\n", rangstr_dup (&rj));
#endif
if (rst == rs.t && n && rj.p) // last key
break;
if (!rj.p) break;
do {
rj2 = json_find (rangstr_str (&rj), &rs);
//fprintf (stderr, "++ (%s)(%d vs %d)\n", rangstr_dup (&rs), x, rs.t);
//if (rj.p[rj.f]=='[') { break; }
//fprintf (stderr, "ee %c\n", rj.p[rj.f]);
if (!rj2.p) {
if (!rj.p[rj.t]) return rj2;
break;
}
rj = rj2;
#if 0
fprintf (stderr, "-- (%s)\n", rangstr_dup (&rj));
#endif
} while (json_path_next (&rs));
//if (!rj.p) return rj;
#if 0
printf ("x = %d\n", x); printf ("rsf = %d\n", rs.f);
fprintf (stderr, "xxx (%s)\n", rangstr_dup (&rj));
return rj;
#endif
if ((rst == rs.t && n && rj.p)) // last key
break;
rs.t = rst;
rs.f = x;
n++;
} while (x != -1);
return rj;
}
|
/*--------------------------------------------------------------------*/
/*--- Mach kernel interface module. pub_core_mach.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2005-2017 Apple Inc.
Greg Parker gparker@apple.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
#if defined(VGO_darwin)
#ifndef __PUB_CORE_MACH_H
#define __PUB_CORE_MACH_H
//--------------------------------------------------------------------
// PURPOSE: This module contains the Mach kernel interface,
// for operating systems like Darwin / Mac OS X that use it.
//--------------------------------------------------------------------
// Call this early in Valgrind's main(). It depends on nothing.
extern void VG_(mach_init)(void);
#endif // __PUB_CORE_MACH_H
#endif // defined(VGO_darwin)
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
|
/* Definitions used by event-top.c, for GDB, the GNU debugger.
Copyright (C) 1999-2013 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
This file is part of GDB.
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 EVENT_TOP_H
#define EVENT_TOP_H
struct cmd_list_element;
/* Exported functions from event-top.c.
FIXME: these should really go into top.h. */
extern void display_gdb_prompt (char *new_prompt);
void gdb_setup_readline (void);
void gdb_disable_readline (void);
extern void async_init_signals (void);
extern void set_async_editing_command (char *args, int from_tty,
struct cmd_list_element *c);
/* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */
#ifndef STOP_SIGNAL
#include <signal.h>
#ifdef SIGTSTP
#define STOP_SIGNAL SIGTSTP
extern void handle_stop_sig (int sig);
#endif
#endif
extern void handle_sigint (int sig);
extern void handle_sigterm (int sig);
extern void gdb_readline2 (void *client_data);
extern void async_request_quit (void *arg);
extern void stdin_event_handler (int error, void *client_data);
extern void async_disable_stdin (void);
extern void async_enable_stdin (void);
/* Exported variables from event-top.c.
FIXME: these should really go into top.h. */
extern int async_command_editing_p;
extern int exec_done_display_p;
extern char *async_annotation_suffix;
extern struct prompts the_prompts;
extern void (*call_readline) (void *);
extern void (*input_handler) (char *);
extern int input_fd;
extern void (*after_char_processing_hook) (void);
extern void cli_command_loop (void);
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2019-2020 Linaro Ltd.
*/
#ifndef _IPA_CMD_H_
#define _IPA_CMD_H_
#include <linux/types.h>
#include <linux/dma-direction.h>
struct sk_buff;
struct scatterlist;
struct ipa;
struct ipa_mem;
struct gsi_trans;
struct gsi_channel;
/**
* enum ipa_cmd_opcode: IPA immediate commands
*
* All immediate commands are issued using the AP command TX endpoint.
* The numeric values here are the opcodes for IPA v3.5.1 hardware.
*
* IPA_CMD_NONE is a special (invalid) value that's used to indicate
* a request is *not* an immediate command.
*/
enum ipa_cmd_opcode {
IPA_CMD_NONE = 0x0,
IPA_CMD_IP_V4_FILTER_INIT = 0x3,
IPA_CMD_IP_V6_FILTER_INIT = 0x4,
IPA_CMD_IP_V4_ROUTING_INIT = 0x7,
IPA_CMD_IP_V6_ROUTING_INIT = 0x8,
IPA_CMD_HDR_INIT_LOCAL = 0x9,
IPA_CMD_REGISTER_WRITE = 0xc,
IPA_CMD_IP_PACKET_INIT = 0x10,
IPA_CMD_DMA_SHARED_MEM = 0x13,
IPA_CMD_IP_PACKET_TAG_STATUS = 0x14,
};
/**
* struct ipa_cmd_info - information needed for an IPA immediate command
*
* @opcode: The command opcode.
* @direction: Direction of data transfer for DMA commands
*/
struct ipa_cmd_info {
enum ipa_cmd_opcode opcode;
enum dma_data_direction direction;
};
#ifdef IPA_VALIDATE
/**
* ipa_cmd_table_valid() - Validate a memory region holding a table
* @ipa: - IPA pointer
* @mem: - IPA memory region descriptor
* @route: - Whether the region holds a route or filter table
* @ipv6: - Whether the table is for IPv6 or IPv4
* @hashed: - Whether the table is hashed or non-hashed
*
* Return: true if region is valid, false otherwise
*/
bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem,
bool route, bool ipv6, bool hashed);
/**
* ipa_cmd_data_valid() - Validate command-realted configuration is valid
* @ipa: - IPA pointer
*
* Return: true if assumptions required for command are valid
*/
bool ipa_cmd_data_valid(struct ipa *ipa);
#else /* !IPA_VALIDATE */
static inline bool ipa_cmd_table_valid(struct ipa *ipa,
const struct ipa_mem *mem, bool route,
bool ipv6, bool hashed)
{
return true;
}
static inline bool ipa_cmd_data_valid(struct ipa *ipa)
{
return true;
}
#endif /* !IPA_VALIDATE */
/**
* ipa_cmd_pool_init() - initialize command channel pools
* @channel: AP->IPA command TX GSI channel pointer
* @tre_count: Number of pool elements to allocate
*
* Return: 0 if successful, or a negative error code
*/
int ipa_cmd_pool_init(struct gsi_channel *gsi_channel, u32 tre_count);
/**
* ipa_cmd_pool_exit() - Inverse of ipa_cmd_pool_init()
* @channel: AP->IPA command TX GSI channel pointer
*/
void ipa_cmd_pool_exit(struct gsi_channel *channel);
/**
* ipa_cmd_table_init_add() - Add table init command to a transaction
* @trans: GSI transaction
* @opcode: IPA immediate command opcode
* @size: Size of non-hashed routing table memory
* @offset: Offset in IPA shared memory of non-hashed routing table memory
* @addr: DMA address of non-hashed table data to write
* @hash_size: Size of hashed routing table memory
* @hash_offset: Offset in IPA shared memory of hashed routing table memory
* @hash_addr: DMA address of hashed table data to write
*
* If hash_size is 0, hash_offset and hash_addr are ignored.
*/
void ipa_cmd_table_init_add(struct gsi_trans *trans, enum ipa_cmd_opcode opcode,
u16 size, u32 offset, dma_addr_t addr,
u16 hash_size, u32 hash_offset,
dma_addr_t hash_addr);
/**
* ipa_cmd_hdr_init_local_add() - Add a header init command to a transaction
* @ipa: IPA structure
* @offset: Offset of header memory in IPA local space
* @size: Size of header memory
* @addr: DMA address of buffer to be written from
*
* Defines and fills the location in IPA memory to use for headers.
*/
void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size,
dma_addr_t addr);
/**
* ipa_cmd_register_write_add() - Add a register write command to a transaction
* @trans: GSI transaction
* @offset: Offset of register to be written
* @value: Value to be written
* @mask: Mask of bits in register to update with bits from value
* @clear_full: Pipeline clear option; true means full pipeline clear
*/
void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value,
u32 mask, bool clear_full);
/**
* ipa_cmd_dma_shared_mem_add() - Add a DMA memory command to a transaction
* @trans: GSI transaction
* @offset: Offset of IPA memory to be read or written
* @size: Number of bytes of memory to be transferred
* @addr: DMA address of buffer to be read into or written from
* @toward_ipa: true means write to IPA memory; false means read
*/
void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset,
u16 size, dma_addr_t addr, bool toward_ipa);
/**
* ipa_cmd_tag_process_add() - Add IPA tag process commands to a transaction
* @trans: GSI transaction
*/
void ipa_cmd_tag_process_add(struct gsi_trans *trans);
/**
* ipa_cmd_tag_process_add_count() - Number of commands in a tag process
*
* Return: The number of elements to allocate in a transaction
* to hold tag process commands
*/
u32 ipa_cmd_tag_process_count(void);
/**
* ipa_cmd_tag_process() - Perform a tag process
*
* @Return: The number of elements to allocate in a transaction
* to hold tag process commands
*/
void ipa_cmd_tag_process(struct ipa *ipa);
/**
* ipa_cmd_trans_alloc() - Allocate a transaction for the command TX endpoint
* @ipa: IPA pointer
* @tre_count: Number of elements in the transaction
*
* Return: A GSI transaction structure, or a null pointer if all
* available transactions are in use
*/
struct gsi_trans *ipa_cmd_trans_alloc(struct ipa *ipa, u32 tre_count);
#endif /* _IPA_CMD_H_ */
|
{
int n, dx, dy, sx, pp_inc_1, pp_inc_2;
int a;
PIXEL *pp;
#if defined(INTERP_RGB)
unsigned int r, g, b;
#endif
#ifdef INTERP_RGB
unsigned int rinc, ginc, binc;
#endif
#ifdef INTERP_Z
ZPOINT *pz;
int zinc;
int z, zz;
#endif
if (p1->y > p2->y || (p1->y == p2->y && p1->x > p2->x)) {
ZBufferPoint *tmp;
tmp = p1;
p1 = p2;
p2 = tmp;
}
sx = zb->xsize;
pp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p1->y + p1->x * PSZB);
#ifdef INTERP_Z
pz = zb->zbuf + (p1->y * sx + p1->x);
z = p1->z;
#endif
dx = p2->x - p1->x;
dy = p2->y - p1->y;
#ifdef INTERP_RGB
r = p2->r << 8;
g = p2->g << 8;
b = p2->b << 8;
#endif
#undef RGB /* from wingdi.h */
#ifdef INTERP_RGB
#define RGB(x) x
#define RGBPIXEL *pp = RGB_TO_PIXEL(r >> 8,g >> 8,b >> 8)
#else /* INTERP_RGB */
#define RGB(x)
#define RGBPIXEL *pp = color
#endif /* INTERP_RGB */
#ifdef INTERP_Z
#define ZZ(x) x
#define PUTPIXEL() \
{ \
zz=z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMP(zz,*pz)) { \
RGBPIXEL; \
*pz=zz; \
} \
}
#else /* INTERP_Z */
#define ZZ(x)
#define PUTPIXEL() RGBPIXEL
#endif /* INTERP_Z */
#define DRAWLINE(dx,dy,inc_1,inc_2) \
n=dx;\
ZZ(zinc=(p2->z-p1->z)/n);\
RGB(rinc=((p2->r-p1->r) << 8)/n;\
ginc=((p2->g-p1->g) << 8)/n;\
binc=((p2->b-p1->b) << 8)/n);\
a=2*dy-dx;\
dy=2*dy;\
dx=2*dx-dy;\
pp_inc_1 = (inc_1) * PSZB;\
pp_inc_2 = (inc_2) * PSZB;\
do {\
PUTPIXEL();\
ZZ(z+=zinc);\
RGB(r+=rinc;g+=ginc;b+=binc);\
if (a>0) { pp=(PIXEL *)((char *)pp + pp_inc_1); ZZ(pz+=(inc_1)); a-=dx; }\
else { pp=(PIXEL *)((char *)pp + pp_inc_2); ZZ(pz+=(inc_2)); a+=dy; }\
} while (--n >= 0);
/* fin macro */
if (dx == 0 && dy == 0) {
PUTPIXEL();
} else if (dx > 0) {
if (dx >= dy) {
DRAWLINE(dx, dy, sx + 1, 1);
} else {
DRAWLINE(dy, dx, sx + 1, sx);
}
} else {
dx = -dx;
if (dx >= dy) {
DRAWLINE(dx, dy, sx - 1, -1);
} else {
DRAWLINE(dy, dx, sx - 1, sx);
}
}
}
#undef INTERP_Z
#undef INTERP_RGB
/* internal defines */
#undef DRAWLINE
#undef PUTPIXEL
#undef ZZ
#undef RGB
#undef RGBPIXEL
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavcodec/mathops.h"
#include <stdlib.h>
int main(void)
{
unsigned u;
for(u=0; u<65536; u++) {
unsigned s = u*u;
unsigned root = ff_sqrt(s);
unsigned root_m1 = ff_sqrt(s-1);
if (s && root != u) {
fprintf(stderr, "ff_sqrt failed at %u with %u\n", s, root);
return 1;
}
if (u && root_m1 != u - 1) {
fprintf(stderr, "ff_sqrt failed at %u with %u\n", s, root);
return 1;
}
}
return 0;
}
|
/*************************************************************************/
/* spatial_stream_player.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 SPATIAL_STREAM_PLAYER_H
#define SPATIAL_STREAM_PLAYER_H
#include "scene/resources/audio_stream.h"
#include "scene/3d/spatial_player.h"
#include "servers/audio/audio_rb_resampler.h"
class SpatialStreamPlayer : public SpatialPlayer {
OBJ_TYPE(SpatialStreamPlayer,SpatialPlayer);
_THREAD_SAFE_CLASS_
struct InternalStream : public AudioServer::AudioStream {
SpatialStreamPlayer *player;
virtual int get_channel_count() const;
virtual void set_mix_rate(int p_rate); //notify the stream of the mix rate
virtual bool mix(int32_t *p_buffer,int p_frames);
virtual void update();
};
InternalStream internal_stream;
Ref<AudioStreamPlayback> playback;
Ref<AudioStream> stream;
int sp_get_channel_count() const;
void sp_set_mix_rate(int p_rate); //notify the stream of the mix rate
bool sp_mix(int32_t *p_buffer,int p_frames);
void sp_update();
int server_mix_rate;
RID stream_rid;
bool paused;
bool autoplay;
bool loops;
float volume;
float loop_point;
int buffering_ms;
AudioRBResampler resampler;
bool _play;
void _set_play(bool p_play);
bool _get_play() const;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void set_stream(const Ref<AudioStream> &p_stream);
Ref<AudioStream> get_stream() const;
void play(float p_from_offset=0);
void stop();
bool is_playing() const;
void set_paused(bool p_paused);
bool is_paused() const;
void set_loop(bool p_enable);
bool has_loop() const;
void set_volume(float p_vol);
float get_volume() const;
void set_loop_restart_time(float p_secs);
float get_loop_restart_time() const;
void set_volume_db(float p_db);
float get_volume_db() const;
String get_stream_name() const;
int get_loop_count() const;
float get_pos() const;
void seek_pos(float p_time);
float get_length() const;
void set_autoplay(bool p_vol);
bool has_autoplay() const;
void set_buffering_msec(int p_msec);
int get_buffering_msec() const;
SpatialStreamPlayer();
~SpatialStreamPlayer();
};
#endif // SPATIAL_STREAM_PLAYER_H
|
extern zend_class_entry *test_oo_extend_spl_directoryiterator_ce;
ZEPHIR_INIT_CLASS(Test_Oo_Extend_Spl_DirectoryIterator);
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
/* { dg-require-effective-target label_values } */
extern void foo(void *here);
extern inline void bar(void)
{
__label__ here;
foo(&&here);
here:
;
}
void baz(void)
{
bar();
}
|
/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
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 <setjmp.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
static inline uintptr_t __attribute__ ((unused))
_jmpbuf_sp (__jmp_buf regs)
{
void *sp = (void *) regs[0].__regs[7];
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (sp);
#endif
return (uintptr_t) sp;
}
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
|
/*
Copyright (C) 2010 Motorola, Inc.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
#ifndef __LINUX_RADIO_MDM6600_H__
#define __LINUX_RADIO_MDM6600_H__
#define MDM6600_STATUS_PANIC_NAME "panic"
#define MDM6600_STATUS_PANIC_BUSY_WAIT_NAME "panic busy wait"
#define MDM6600_STATUS_QC_DLOAD_NAME "qc dload"
#define MDM6600_STATUS_RAM_DOWNLOADER_NAME "ram downloader"
#define MDM6600_STATUS_PHONE_CODE_AWAKE_NAME "awake"
#define MDM6600_STATUS_PHONE_CODE_ASLEEP_NAME "asleep"
#define MDM6600_STATUS_SHUTDOWN_ACK_NAME "shutdown ack"
#define MDM6600_STATUS_UNDEFINED_NAME "undefined"
#ifdef __KERNEL__
#define MDM6600_GPIO_INVALID -1
#define MDM6600_CTRL_MODULE_NAME "mdm6600_ctrl"
extern bool mdm6600_ctrl_bp_is_shutdown;
static inline bool mdm6600_ctrl_is_bp_up(void)
{
return !mdm6600_ctrl_bp_is_shutdown;
}
enum {
MDM6600_CTRL_GPIO_AP_STATUS_0,
MDM6600_CTRL_GPIO_AP_STATUS_1,
MDM6600_CTRL_GPIO_AP_STATUS_2,
MDM6600_CTRL_GPIO_BP_STATUS_0,
MDM6600_CTRL_GPIO_BP_STATUS_1,
MDM6600_CTRL_GPIO_BP_STATUS_2,
MDM6600_CTRL_GPIO_BP_RESOUT,
MDM6600_CTRL_GPIO_BP_RESIN,
MDM6600_CTRL_GPIO_BP_PWRON,
MDM6600_CTRL_NUM_GPIOS,
};
enum {
MDM6600_GPIO_DIRECTION_IN,
MDM6600_GPIO_DIRECTION_OUT,
};
struct mdm6600_ctrl_gpio {
unsigned int number;
unsigned int direction;
unsigned int default_value;
unsigned int allocated;
char *name;
};
struct mdm6600_command_gpios {
unsigned int cmd1;
unsigned int cmd2;
};
struct mdm6600_ctrl_platform_data {
char *name;
int bootmode;
struct mdm6600_ctrl_gpio gpios[MDM6600_CTRL_NUM_GPIOS];
struct mdm6600_command_gpios cmd_gpios;
struct platform_device *mapphone_bpwake_device;
};
#endif /* __KERNEL__ */
#endif /* __LINUX_RADIO_MDM6600_H__ */
|
/* Copyright (C) 1991-2015 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 <unistd.h>
/* Return the current machine's Internet number. */
long int
gethostid (void)
{
__set_errno (ENOSYS);
return -1L;
}
stub_warning (gethostid)
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IoContext_h__
#define IoContext_h__
#include <boost/version.hpp>
#if BOOST_VERSION >= 106600
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#define IoContextBaseNamespace boost::asio
#define IoContextBase io_context
#else
#include <boost/asio/io_service.hpp>
#define IoContextBaseNamespace boost::asio
#define IoContextBase io_service
#endif
namespace Trinity
{
namespace Asio
{
class IoContext
{
public:
IoContext() : _impl() { }
explicit IoContext(int concurrency_hint) : _impl(concurrency_hint) { }
operator IoContextBaseNamespace::IoContextBase&() { return _impl; }
operator IoContextBaseNamespace::IoContextBase const&() const { return _impl; }
std::size_t run() { return _impl.run(); }
void stop() { _impl.stop(); }
#if BOOST_VERSION >= 106600
boost::asio::io_context::executor_type get_executor() noexcept { return _impl.get_executor(); }
#endif
private:
IoContextBaseNamespace::IoContextBase _impl;
};
template<typename T>
inline decltype(auto) post(IoContextBaseNamespace::IoContextBase& ioContext, T&& t)
{
#if BOOST_VERSION >= 106600
return boost::asio::post(ioContext, std::forward<T>(t));
#else
return ioContext.post(std::forward<T>(t));
#endif
}
template<typename T>
inline decltype(auto) get_io_context(T&& ioObject)
{
#if BOOST_VERSION >= 106600
return ioObject.get_executor().context();
#else
return ioObject.get_io_service();
#endif
}
}
}
#endif // IoContext_h__
|
/*
* Copyright (C) 2009 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.
* * 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 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 V8HTMLAudioElementConstructor_h
#define V8HTMLAudioElementConstructor_h
#include "WrapperTypeInfo.h"
#include <v8.h>
namespace WebCore {
class V8HTMLAudioElementConstructor {
public:
static v8::Persistent<v8::FunctionTemplate> GetTemplate();
static WrapperTypeInfo info;
};
}
#endif // V8HTMLAudioElementConstructor_h
|
// Copyright 2020 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_UTIL_WIN_TRAITS_H_
#define CRASHPAD_UTIL_WIN_TRAITS_H_
#include <stdint.h>
namespace crashpad {
struct Traits32 {
using Address = DWORD;
};
struct Traits64 {
using Address = DWORD64;
};
} // namespace crashpad
#endif // CRASHPAD_UTIL_WIN_TRAITS_H_
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_BROWSER_EXTENSION_DIALOG_AUTO_CONFIRM_H_
#define EXTENSIONS_BROWSER_EXTENSION_DIALOG_AUTO_CONFIRM_H_
#include "base/auto_reset.h"
#include "base/macros.h"
namespace extensions {
class ScopedTestDialogAutoConfirm {
public:
enum AutoConfirm {
NONE, // The prompt will show normally.
ACCEPT, // The prompt will always accept.
CANCEL, // The prompt will always cancel.
};
explicit ScopedTestDialogAutoConfirm(AutoConfirm override_value);
~ScopedTestDialogAutoConfirm();
static AutoConfirm GetAutoConfirmValue();
private:
AutoConfirm old_value_;
DISALLOW_COPY_AND_ASSIGN(ScopedTestDialogAutoConfirm);
};
} // namespace extensions
#endif // EXTENSIONS_BROWSER_EXTENSION_DIALOG_AUTO_CONFIRM_H_
|
/*******************************************************************************
Copyright (c) 2006-2015 Cadence Design Systems Inc.
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.
******************************************************************************/
/******************************************************************************
Xtensa-specific interrupt and exception functions for RTOS ports.
Also see xtensa_intr_asm.S.
******************************************************************************/
#include <stdlib.h>
#include <xtensa/config/core.h>
#include "xtensa_api.h"
#if XCHAL_HAVE_EXCEPTIONS
/* Handler table is in xtensa_intr_asm.S */
extern xt_exc_handler _xt_exception_table[XCHAL_EXCCAUSE_NUM];
/*
Default handler for unhandled exceptions.
*/
void xt_unhandled_exception(XtExcFrame *frame)
{
exit(-1);
}
/*
This function registers a handler for the specified exception.
The function returns the address of the previous handler.
On error, it returns 0.
*/
xt_exc_handler xt_set_exception_handler(int n, xt_exc_handler f)
{
xt_exc_handler old;
if( n < 0 || n >= XCHAL_EXCCAUSE_NUM )
return 0; /* invalid exception number */
old = _xt_exception_table[n];
if (f) {
_xt_exception_table[n] = f;
}
else {
_xt_exception_table[n] = &xt_unhandled_exception;
}
return ((old == &xt_unhandled_exception) ? 0 : old);
}
#endif
#if XCHAL_HAVE_INTERRUPTS
/* Handler table is in xtensa_intr_asm.S */
typedef struct xt_handler_table_entry {
void * handler;
void * arg;
} xt_handler_table_entry;
extern xt_handler_table_entry _xt_interrupt_table[XCHAL_NUM_INTERRUPTS];
/*
Default handler for unhandled interrupts.
*/
void xt_unhandled_interrupt(void * arg)
{
exit(-1);
}
/*
This function registers a handler for the specified interrupt. The "arg"
parameter specifies the argument to be passed to the handler when it is
invoked. The function returns the address of the previous handler.
On error, it returns 0.
*/
xt_handler xt_set_interrupt_handler(int n, xt_handler f, void * arg)
{
xt_handler_table_entry * entry;
xt_handler old;
if( n < 0 || n >= XCHAL_NUM_INTERRUPTS )
return 0; /* invalid interrupt number */
if( Xthal_intlevel[n] > XCHAL_EXCM_LEVEL )
return 0; /* priority level too high to safely handle in C */
entry = _xt_interrupt_table + n;
old = entry->handler;
if (f) {
entry->handler = f;
entry->arg = arg;
}
else {
entry->handler = &xt_unhandled_interrupt;
entry->arg = (void*)n;
}
return ((old == &xt_unhandled_interrupt) ? 0 : old);
}
#endif /* XCHAL_HAVE_INTERRUPTS */
|
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_EXAMPLES_ANDROID_JNI_OBJECT_TRACKING_JNI_UTILS_H_
#define TENSORFLOW_EXAMPLES_ANDROID_JNI_OBJECT_TRACKING_JNI_UTILS_H_
#include <stdint.h>
#include "tensorflow/examples/android/jni/object_tracking/utils.h"
// The JniLongField class is used to access Java fields from native code. This
// technique of hiding pointers to native objects in opaque Java fields is how
// the Android hardware libraries work. This reduces the amount of static
// native methods and makes it easier to manage the lifetime of native objects.
class JniLongField {
public:
JniLongField(const char* field_name)
: field_name_(field_name), field_ID_(0) {}
int64_t get(JNIEnv* env, jobject thiz) {
if (field_ID_ == 0) {
jclass cls = env->GetObjectClass(thiz);
CHECK_ALWAYS(cls != 0, "Unable to find class");
field_ID_ = env->GetFieldID(cls, field_name_, "J");
CHECK_ALWAYS(field_ID_ != 0,
"Unable to find field %s. (Check proguard cfg)", field_name_);
}
return env->GetLongField(thiz, field_ID_);
}
void set(JNIEnv* env, jobject thiz, int64_t value) {
if (field_ID_ == 0) {
jclass cls = env->GetObjectClass(thiz);
CHECK_ALWAYS(cls != 0, "Unable to find class");
field_ID_ = env->GetFieldID(cls, field_name_, "J");
CHECK_ALWAYS(field_ID_ != 0,
"Unable to find field %s (Check proguard cfg)", field_name_);
}
env->SetLongField(thiz, field_ID_, value);
}
private:
const char* const field_name_;
// This is just a cache
jfieldID field_ID_;
};
#endif
|
/* This test is part of GDB, the GNU debugger.
Copyright 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/>. */
volatile int v = 42;
__attribute__((__always_inline__)) static inline int
f (void)
{
/* Provide first stub line so that GDB understand the PC is already inside
the inlined function and does not expect a step into it. */
v++;
v++; /* break-here */
return v;
}
__attribute__((__noinline__)) static int
g (void)
{
volatile int l = v;
return f ();
}
int
main (void)
{
return g ();
}
|
/*
* nine_button_selector.h
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/yahoo/com>
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _NINE_BUTTON_SELECTOR_H
#define _NINE_BUTTON_SELECTOR_H
#include "PixmapButton.h"
class nineButtonSelector: public QWidget , public IntModelView
{
Q_OBJECT
public:
nineButtonSelector( QPixmap _button0_on,
QPixmap _button0_off,
QPixmap _button1_on,
QPixmap _button1_off,
QPixmap _button2_on,
QPixmap _button2_off,
QPixmap _button3_on,
QPixmap _button3_off,
QPixmap _button4_on,
QPixmap _button4_off,
QPixmap _button5_on,
QPixmap _button5_off,
QPixmap _button6_on,
QPixmap _button6_off,
QPixmap _button7_on,
QPixmap _button7_off,
QPixmap _button8_on,
QPixmap _button8_off,
int _default,
int _x, int _y,
QWidget * _parent);
virtual ~nineButtonSelector();
// inline int getSelected() {
// return( castModel<nineButtonSelectorModel>()->value() );
// };
protected:
void setSelected( int _new_button );
public slots:
void button0Clicked();
void button1Clicked();
void button2Clicked();
void button3Clicked();
void button4Clicked();
void button5Clicked();
void button6Clicked();
void button7Clicked();
void button8Clicked();
void contextMenuEvent( QContextMenuEvent * );
void displayHelp();
signals:
void nineButtonSelection( int );
private:
virtual void modelChanged();
void updateButton( int );
QList<PixmapButton *> m_buttons;
PixmapButton * m_button;
PixmapButton * m_lastBtn;
} ;
typedef IntModel nineButtonSelectorModel;
#endif
|
/* Copyright (c) 2002-2012 Croteam Ltd.
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-1301 USA. */
// Animation names
#define INVISIBLE_ANIM_DEFAULT_ANIMATION 0
// Color names
// Patch names
// Names of collision boxes
#define INVISIBLE_COLLISION_BOX_PART_NAME 0
// Attaching position names
// Sound names
|
/**
Copyright (C) 2008 NXP B.V., All Rights Reserved.
This source code and any compilation or derivative thereof is the proprietary
information of NXP B.V. and is confidential in nature. Under no circumstances
is this software to be exposed to or placed under an Open Source License of
any type without the expressed written permission of NXP B.V.
*
* \file tmdlScanXpress.h
*
*
* \date %date_modified%
*
* \brief Describe briefly the purpose of this file.
*
* REFERENCE DOCUMENTS :
*
* Detailled description may be added here.
*
* \section info Change Information
*
* \verbatim
Date Modified by CRPRNr TASKNr Maintenance description
-------------|-----------|-------|-------|-----------------------------------
18-DEC-2008 | X.RAZAVET | | | CREATION OF ARCHITECTURE 2.0.0
-------------|-----------|-------|-------|-----------------------------------
| | | |
-------------|-----------|-------|-------|-----------------------------------
\endverbatim
*
*/
#ifndef TMSYSSCANXPRESS_H
#define TMSYSSCANXPRESS_H
#ifdef __cplusplus
extern "C" {
#endif
/*============================================================================*/
/* INCLUDE FILES */
/*============================================================================*/
/************************************************************************/
/* */
/* Description: */
/* Describes the ScanXpress structure. */
/* */
/* Settings: */
/* bScanXpressMode - ScanXpress Mode (True/False). */
/* pFw_code - Table containing the firmware. */
/* Fw_code_size - Size of the firmware. */
/* */
/************************************************************************/
typedef struct _tmsysScanXpressConfig_t
{
Bool bScanXpressMode;
UInt8* puFw_code;
UInt32 uFw_code_size;
} tmsysScanXpressConfig_t, *ptmsysScanXpressConfig_t;
/************************************************************************/
/* */
/* Description: */
/* Describes the ScanXpress structure. */
/* */
/* Settings: */
/* uFrequency - Frequency of the ScanXpress Request. */
/* uCS - Channel bandwidth. */
/* uSpectralInversion - Spectral inversion. */
/* Confidence - Confidence threshold. */
/* ChannelType - Channel type. */
/* */
/************************************************************************/
typedef struct _tmsysScanXpressRequest_t
{
UInt32 uFrequency;
UInt32 uCS;
UInt32 uSpectralInversion;
tmFrontEndConfidence_t eConfidence; /* TODO: remove, not used anymore */
/* output value */
Int32 TunerStep;
tmFrontEndChannelType_t eChannelType;
UInt32 uAnlgFrequency;
tmbslFrontEndTVStandard_t eTVStandard;
UInt32 uDgtlFrequency;
UInt32 uDgtlBandwidth;
} tmsysScanXpressRequest_t, *ptmsysScanXpressRequest_t;
/************************************************************************/
/* */
/* Description: */
/* Describes the ScanXpressChannelFound structure. */
/* */
/* Settings: */
/* eChannelType - AChannel type. */
/* uAnlgFrequency - Frequency in Hz. */
/* uDgtlFrequency - Frequency in Hz. */
/* */
/************************************************************************/
typedef struct _tmsysScanXpressFoundChannel_t
{
tmFrontEndChannelType_t eChannelType;
UInt32 uAnlgFrequency;
tmbslFrontEndTVStandard_t eTVStandard;
UInt32 uDgtlFrequency;
UInt32 uDgtlBandwidth;
} tmsysScanXpressFoundChannel_t, *ptmsysScanXpressFoundChannel_t;
#ifdef __cplusplus
}
#endif
#endif /* TMDLSCANXPRESS_H */
/*============================================================================*/
/* END OF FILE */
/*============================================================================*/
|
//
// New Relic for Mobile -- iOS edition
//
// See:
// https://docs.newrelic.com/docs/mobile-apps for information
// https://docs.newrelic.com/docs/releases/ios for release notes
//
// Copyright (c) 2014 New Relic. All rights reserved.
// See https://docs.newrelic.com/docs/licenses/ios-agent-licenses for license details
//
#import <Foundation/Foundation.h>
/*!
NRMAFeatureFlags
These flags are used to identify New Relic features.
- NRFeatureFlag_NSURLSessionInstrumentation
Disabled by default. Flag for instrumentation of NSURLSessions.
Currently only instruments network activity dispatched with
NSURLSessionDataTasks and NSURLSessionUploadTasks.
- NRFeatureFlag_ExperimentalNetworkingInstrumentation
Disabled by default. Enables experimental networking instrumentation. This
feature may decrease the stability of applications.
- NRMAFeatureFlag_SwifterInteractionTracing
Beware: enabling this feature may cause your swift application to crash.
please read https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/getting-started/enabling-interaction-tracing-swift
before enabling this feature.
*/
typedef NS_OPTIONS(unsigned long long, NRMAFeatureFlags){
NRFeatureFlag_InteractionTracing = 1 << 1,
NRFeatureFlag_SwiftInteractionTracing = 1 << 2, //disabled by default
NRFeatureFlag_CrashReporting = 1 << 3,
NRFeatureFlag_NSURLSessionInstrumentation = 1 << 4,
NRFeatureFlag_HttpResponseBodyCapture = 1 << 5,
NRFeatureFlag_ExperimentalNetworkingInstrumentation = 1 << 13, //disabled by default
NRFeatureFlag_AllFeatures = ~0ULL //in 32-bit land the alignment is 4bytes
};
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FILE_REF_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FILE_REF_HOST_H_
#include <string>
#include "base/memory/weak_ptr.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
#include "webkit/browser/fileapi/file_system_url.h"
namespace content {
class PepperFileRefHost;
// Internal and external filesystems have very different codepaths for
// performing FileRef operations. The logic is split into separate classes
// to make it easier to read.
class PepperFileRefBackend {
public:
virtual ~PepperFileRefBackend();
virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context,
bool make_ancestors) = 0;
virtual int32_t Touch(ppapi::host::ReplyMessageContext context,
PP_Time last_accessed_time,
PP_Time last_modified_time) = 0;
virtual int32_t Delete(ppapi::host::ReplyMessageContext context) = 0;
virtual int32_t Rename(ppapi::host::ReplyMessageContext context,
PepperFileRefHost* new_file_ref) = 0;
virtual int32_t Query(ppapi::host::ReplyMessageContext context) = 0;
virtual int32_t ReadDirectoryEntries(
ppapi::host::ReplyMessageContext context) = 0;
virtual int32_t GetAbsolutePath(
ppapi::host::ReplyMessageContext context) = 0;
virtual fileapi::FileSystemURL GetFileSystemURL() const = 0;
virtual std::string GetFileSystemURLSpec() const = 0;
virtual base::FilePath GetExternalPath() const = 0;
// Returns an error from the pp_errors.h enum.
virtual int32_t CanRead() const = 0;
virtual int32_t CanWrite() const = 0;
virtual int32_t CanCreate() const = 0;
virtual int32_t CanReadWrite() const = 0;
};
class CONTENT_EXPORT PepperFileRefHost
: public ppapi::host::ResourceHost,
public base::SupportsWeakPtr<PepperFileRefHost> {
public:
PepperFileRefHost(BrowserPpapiHost* host,
PP_Instance instance,
PP_Resource resource,
PP_Resource file_system,
const std::string& internal_path);
PepperFileRefHost(BrowserPpapiHost* host,
PP_Instance instance,
PP_Resource resource,
const base::FilePath& external_path);
virtual ~PepperFileRefHost();
// ResourceHost overrides.
virtual int32_t OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) OVERRIDE;
virtual bool IsFileRefHost() OVERRIDE;
// Required to support Rename().
PP_FileSystemType GetFileSystemType() const;
fileapi::FileSystemURL GetFileSystemURL() const;
// Required to support FileIO.
std::string GetFileSystemURLSpec() const;
base::FilePath GetExternalPath() const;
int32_t CanRead() const;
int32_t CanWrite() const;
int32_t CanCreate() const;
int32_t CanReadWrite() const;
private:
int32_t OnMakeDirectory(ppapi::host::HostMessageContext* context,
bool make_ancestors);
int32_t OnTouch(ppapi::host::HostMessageContext* context,
PP_Time last_access_time,
PP_Time last_modified_time);
int32_t OnDelete(ppapi::host::HostMessageContext* context);
int32_t OnRename(ppapi::host::HostMessageContext* context,
PP_Resource new_file_ref);
int32_t OnQuery(ppapi::host::HostMessageContext* context);
int32_t OnReadDirectoryEntries(ppapi::host::HostMessageContext* context);
int32_t OnGetAbsolutePath(ppapi::host::HostMessageContext* context);
BrowserPpapiHost* host_;
scoped_ptr<PepperFileRefBackend> backend_;
PP_FileSystemType fs_type_;
DISALLOW_COPY_AND_ASSIGN(PepperFileRefHost);
};
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FILE_REF_HOST_H_
|
/*
utf.c (13.09.09)
exFAT file system implementation library.
Free exFAT implementation.
Copyright (C) 2010-2013 Andrew Nayenko
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "exfat.h"
#include <errno.h>
static char* wchar_to_utf8(char* output, wchar_t wc, size_t outsize)
{
if (wc <= 0x7f)
{
if (outsize < 1)
return NULL;
*output++ = (char) wc;
}
else if (wc <= 0x7ff)
{
if (outsize < 2)
return NULL;
*output++ = 0xc0 | (wc >> 6);
*output++ = 0x80 | (wc & 0x3f);
}
else if (wc <= 0xffff)
{
if (outsize < 3)
return NULL;
*output++ = 0xe0 | (wc >> 12);
*output++ = 0x80 | ((wc >> 6) & 0x3f);
*output++ = 0x80 | (wc & 0x3f);
}
else if (wc <= 0x1fffff)
{
if (outsize < 4)
return NULL;
*output++ = 0xf0 | (wc >> 18);
*output++ = 0x80 | ((wc >> 12) & 0x3f);
*output++ = 0x80 | ((wc >> 6) & 0x3f);
*output++ = 0x80 | (wc & 0x3f);
}
else if (wc <= 0x3ffffff)
{
if (outsize < 5)
return NULL;
*output++ = 0xf8 | (wc >> 24);
*output++ = 0x80 | ((wc >> 18) & 0x3f);
*output++ = 0x80 | ((wc >> 12) & 0x3f);
*output++ = 0x80 | ((wc >> 6) & 0x3f);
*output++ = 0x80 | (wc & 0x3f);
}
else if (wc <= 0x7fffffff)
{
if (outsize < 6)
return NULL;
*output++ = 0xfc | (wc >> 30);
*output++ = 0x80 | ((wc >> 24) & 0x3f);
*output++ = 0x80 | ((wc >> 18) & 0x3f);
*output++ = 0x80 | ((wc >> 12) & 0x3f);
*output++ = 0x80 | ((wc >> 6) & 0x3f);
*output++ = 0x80 | (wc & 0x3f);
}
else
return NULL;
return output;
}
static const le16_t* utf16_to_wchar(const le16_t* input, wchar_t* wc,
size_t insize)
{
if ((le16_to_cpu(input[0]) & 0xfc00) == 0xd800)
{
if (insize < 2 || (le16_to_cpu(input[1]) & 0xfc00) != 0xdc00)
return NULL;
*wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10);
*wc |= (le16_to_cpu(input[1]) & 0x3ff);
*wc += 0x10000;
return input + 2;
}
else
{
*wc = le16_to_cpu(*input);
return input + 1;
}
}
int utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
size_t insize)
{
const le16_t* inp = input;
char* outp = output;
wchar_t wc;
while (inp - input < insize && le16_to_cpu(*inp))
{
inp = utf16_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL)
{
exfat_error("illegal UTF-16 sequence");
return -EILSEQ;
}
outp = wchar_to_utf8(outp, wc, outsize - (outp - output));
if (outp == NULL)
{
exfat_error("name is too long");
return -ENAMETOOLONG;
}
}
*outp = '\0';
return 0;
}
static const char* utf8_to_wchar(const char* input, wchar_t* wc,
size_t insize)
{
if ((input[0] & 0x80) == 0 && insize >= 1)
{
*wc = (wchar_t) input[0];
return input + 1;
}
if ((input[0] & 0xe0) == 0xc0 && insize >= 2)
{
*wc = (((wchar_t) input[0] & 0x1f) << 6) |
((wchar_t) input[1] & 0x3f);
return input + 2;
}
if ((input[0] & 0xf0) == 0xe0 && insize >= 3)
{
*wc = (((wchar_t) input[0] & 0x0f) << 12) |
(((wchar_t) input[1] & 0x3f) << 6) |
((wchar_t) input[2] & 0x3f);
return input + 3;
}
if ((input[0] & 0xf8) == 0xf0 && insize >= 4)
{
*wc = (((wchar_t) input[0] & 0x07) << 18) |
(((wchar_t) input[1] & 0x3f) << 12) |
(((wchar_t) input[2] & 0x3f) << 6) |
((wchar_t) input[3] & 0x3f);
return input + 4;
}
if ((input[0] & 0xfc) == 0xf8 && insize >= 5)
{
*wc = (((wchar_t) input[0] & 0x03) << 24) |
(((wchar_t) input[1] & 0x3f) << 18) |
(((wchar_t) input[2] & 0x3f) << 12) |
(((wchar_t) input[3] & 0x3f) << 6) |
((wchar_t) input[4] & 0x3f);
return input + 5;
}
if ((input[0] & 0xfe) == 0xfc && insize >= 6)
{
*wc = (((wchar_t) input[0] & 0x01) << 30) |
(((wchar_t) input[1] & 0x3f) << 24) |
(((wchar_t) input[2] & 0x3f) << 18) |
(((wchar_t) input[3] & 0x3f) << 12) |
(((wchar_t) input[4] & 0x3f) << 6) |
((wchar_t) input[5] & 0x3f);
return input + 6;
}
return NULL;
}
static le16_t* wchar_to_utf16(le16_t* output, wchar_t wc, size_t outsize)
{
if (wc <= 0xffff) /* if character is from BMP */
{
if (outsize == 0)
return NULL;
output[0] = cpu_to_le16(wc);
return output + 1;
}
if (outsize < 2)
return NULL;
wc -= 0x10000;
output[0] = cpu_to_le16(0xd800 | ((wc >> 10) & 0x3ff));
output[1] = cpu_to_le16(0xdc00 | (wc & 0x3ff));
return output + 2;
}
int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
size_t insize)
{
const char* inp = input;
le16_t* outp = output;
wchar_t wc;
while (inp - input < insize && *inp)
{
inp = utf8_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL)
{
exfat_error("illegal UTF-8 sequence");
return -EILSEQ;
}
outp = wchar_to_utf16(outp, wc, outsize - (outp - output));
if (outp == NULL)
{
exfat_error("name is too long");
return -ENAMETOOLONG;
}
}
*outp = cpu_to_le16(0);
return 0;
}
size_t utf16_length(const le16_t* str)
{
size_t i = 0;
while (le16_to_cpu(str[i]))
i++;
return i;
}
|
/**************************************************************************
*
* Copyright (C) 2005 Steve Karg <skarg@users.sourceforge.net>
*
* 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 LSP_H
#define LSP_H
#include <stdbool.h>
#include <stdint.h>
#include "bacdef.h"
#include "bacerror.h"
#include "rp.h"
#include "wp.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void Life_Safety_Point_Property_Lists(
const int **pRequired,
const int **pOptional,
const int **pProprietary);
bool Life_Safety_Point_Valid_Instance(
uint32_t object_instance);
unsigned Life_Safety_Point_Count(
void);
uint32_t Life_Safety_Point_Index_To_Instance(
unsigned index);
unsigned Life_Safety_Point_Instance_To_Index(
uint32_t object_instance);
bool Life_Safety_Point_Object_Name(
uint32_t object_instance,
BACNET_CHARACTER_STRING * object_name);
void Life_Safety_Point_Init(
void);
int Life_Safety_Point_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata);
bool Life_Safety_Point_Write_Property(
BACNET_WRITE_PROPERTY_DATA * wp_data);
#ifdef TEST
#include "ctest.h"
void testLifeSafetyPoint(
Test * pTest);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1995-1997 Presto Studios, 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 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef PEGASUS_AI_AIRULE_H
#define PEGASUS_AI_AIRULE_H
#include "common/list.h"
#include "pegasus/ai/ai_action.h"
#include "pegasus/ai/ai_condition.h"
namespace Common {
class ReadStream;
class WriteStream;
}
namespace Pegasus {
class AICondition;
class AIAction;
class AIRule {
public:
AIRule(AICondition *condition, AIAction *rule) {
_ruleCondition = condition;
_ruleAction = rule;
_ruleActive = true;
}
~AIRule() {
if (_ruleCondition)
delete _ruleCondition;
if (_ruleAction)
delete _ruleAction;
}
bool fireRule();
void activateRule() { _ruleActive = true; }
void deactivateRule() { _ruleActive = false; }
bool isRuleActive() { return _ruleActive; }
void writeAIRule(Common::WriteStream *);
void readAIRule(Common::ReadStream *);
protected:
AICondition *_ruleCondition;
AIAction *_ruleAction;
bool _ruleActive;
};
class AIRuleList : public Common::List<AIRule *> {
public:
AIRuleList() {}
~AIRuleList() {}
void writeAIRules(Common::WriteStream *);
void readAIRules(Common::ReadStream *);
};
} // End of namespace Pegasus
#endif
|
/* vi: set sw=4 ts=4: */
/*
* rtm_map.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*
*/
#include "libbb.h"
#include "rt_names.h"
#include "utils.h"
const char* FAST_FUNC rtnl_rtntype_n2a(int id, char *buf)
{
switch (id) {
case RTN_UNSPEC:
return "none";
case RTN_UNICAST:
return "unicast";
case RTN_LOCAL:
return "local";
case RTN_BROADCAST:
return "broadcast";
case RTN_ANYCAST:
return "anycast";
case RTN_MULTICAST:
return "multicast";
case RTN_BLACKHOLE:
return "blackhole";
case RTN_UNREACHABLE:
return "unreachable";
case RTN_PROHIBIT:
return "prohibit";
case RTN_THROW:
return "throw";
case RTN_NAT:
return "nat";
case RTN_XRESOLVE:
return "xresolve";
default:
/* buf is SPRINT_BSIZE big */
sprintf(buf, "%d", id);
return buf;
}
}
int FAST_FUNC rtnl_rtntype_a2n(int *id, char *arg)
{
static const char keywords[] ALIGN1 =
"local\0""nat\0""broadcast\0""brd\0""anycast\0"
"multicast\0""prohibit\0""unreachable\0""blackhole\0"
"xresolve\0""unicast\0""throw\0";
enum {
ARG_local = 1, ARG_nat, ARG_broadcast, ARG_brd, ARG_anycast,
ARG_multicast, ARG_prohibit, ARG_unreachable, ARG_blackhole,
ARG_xresolve, ARG_unicast, ARG_throw
};
const smalluint key = index_in_substrings(keywords, arg) + 1;
char *end;
unsigned long res;
if (key == ARG_local)
res = RTN_LOCAL;
else if (key == ARG_nat)
res = RTN_NAT;
else if (key == ARG_broadcast || key == ARG_brd)
res = RTN_BROADCAST;
else if (key == ARG_anycast)
res = RTN_ANYCAST;
else if (key == ARG_multicast)
res = RTN_MULTICAST;
else if (key == ARG_prohibit)
res = RTN_PROHIBIT;
else if (key == ARG_unreachable)
res = RTN_UNREACHABLE;
else if (key == ARG_blackhole)
res = RTN_BLACKHOLE;
else if (key == ARG_xresolve)
res = RTN_XRESOLVE;
else if (key == ARG_unicast)
res = RTN_UNICAST;
else if (key == ARG_throw)
res = RTN_THROW;
else {
res = strtoul(arg, &end, 0);
if (end == arg || *end || res > 255)
return -1;
}
*id = res;
return 0;
}
int FAST_FUNC get_rt_realms(uint32_t *realms, char *arg)
{
uint32_t realm = 0;
char *p = strchr(arg, '/');
*realms = 0;
if (p) {
*p = 0;
if (rtnl_rtrealm_a2n(realms, arg)) {
*p = '/';
return -1;
}
*realms <<= 16;
*p = '/';
arg = p+1;
}
if (*arg && rtnl_rtrealm_a2n(&realm, arg))
return -1;
*realms |= realm;
return 0;
}
|
/***************************************************************************
* Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "compiler.h"
#include "interfaces.h"
#include "usbtoxxx.h"
#include "usbtoxxx_internal.h"
vsf_err_t usbtobdm_init(uint8_t index)
{
return usbtoxxx_init_command(USB_TO_BDM, index);
}
vsf_err_t usbtobdm_fini(uint8_t index)
{
return usbtoxxx_fini_command(USB_TO_BDM, index);
}
vsf_err_t usbtobdm_sync(uint8_t index, uint16_t *khz)
{
#if PARAM_CHECK
if (index > 7)
{
LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, index);
return VSFERR_FAIL;
}
#endif
return usbtoxxx_sync_command(USB_TO_BDM, index, NULL, 0, 2,
(uint8_t *)khz);
}
vsf_err_t usbtobdm_transact(uint8_t index, uint8_t *out,
uint8_t outlen, uint8_t *in, uint8_t inlen, uint8_t delay, uint8_t ack)
{
uint16_t token;
#if PARAM_CHECK
if (index > 7)
{
LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, index);
return VSFERR_FAIL;
}
if ((outlen > 0x0F) || (inlen > 0x0F) || (NULL == out) || (delay > 3))
{
return VSFERR_FAIL;
}
#endif
token = outlen | (inlen << 8) | (delay << 6) | (ack ? 0x8000 : 0x0000);
SET_LE_U16(&usbtoxxx_info->cmd_buff[0], token);
memcpy(&usbtoxxx_info->cmd_buff[2], out, outlen);
if (NULL == in)
{
return usbtoxxx_inout_command(USB_TO_BDM, index,
usbtoxxx_info->cmd_buff, 2 + outlen, inlen, NULL, 0, 0, 1);
}
else
{
return usbtoxxx_inout_command(USB_TO_BDM, index,
usbtoxxx_info->cmd_buff, 2 + outlen, inlen, in, 0, inlen, 1);
}
}
|
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2016 KBEngine.
KBEngine 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.
KBEngine 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 KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KBE_SHUTDOWN_HANDLER_H
#define KBE_SHUTDOWN_HANDLER_H
#include "common/common.h"
#include "common/timer.h"
#include "helper/debug_helper.h"
namespace KBEngine {
class ShutdownHandler
{
public:
enum SHUTDOWN_STATE
{
SHUTDOWN_STATE_STOP = COMPONENT_STATE_RUN,
SHUTDOWN_STATE_BEGIN = COMPONENT_STATE_SHUTTINGDOWN_BEGIN,
SHUTDOWN_STATE_RUNNING = COMPONENT_STATE_SHUTTINGDOWN_RUNNING,
SHUTDOWN_STATE_END = COMPONENT_STATE_STOP
};
ShutdownHandler():lastShutdownFailReason_("tasks"),
shuttingdown_(SHUTDOWN_STATE_STOP){
}
virtual ~ShutdownHandler(){}
virtual void onShutdownBegin() = 0;
virtual void onShutdown(bool first) = 0;
virtual void onShutdownEnd() = 0;
virtual bool canShutdown(){ return true; }
void setShuttingdown(SHUTDOWN_STATE state){ shuttingdown_ = state; }
bool isShuttingdown() const{ return shuttingdown_ != SHUTDOWN_STATE_STOP; }
SHUTDOWN_STATE shuttingdown() const{ return shuttingdown_; }
const std::string& lastShutdownFailReason(){ return lastShutdownFailReason_; }
protected:
std::string lastShutdownFailReason_; // ×îºóÒ»´Î¹Ø»úʧ°ÜµÄÔÒò
SHUTDOWN_STATE shuttingdown_;
};
}
#endif // KBE_SHUTDOWN_HANDLER_H
|
/*
* Copyright (c) 2015 ARM Limited. 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
*
* 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 LOWPANNDINTERFACE_H
#define LOWPANNDINTERFACE_H
#include "MeshInterfaceNanostack.h"
class LoWPANNDInterface : public MeshInterfaceNanostack {
public:
/** Create an uninitialized LoWPANNDInterface
*
* Must initialize to initialize the mesh on a phy.
*/
LoWPANNDInterface() : MeshInterfaceNanostack() { }
/** Create an initialized MeshInterface
*
*/
LoWPANNDInterface(NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) { }
nsapi_error_t initialize(NanostackRfPhy *phy);
int connect();
int disconnect();
bool getOwnIpAddress(char *address, int8_t len);
bool getRouterIpAddress(char *address, int8_t len);
private:
mesh_error_t init();
mesh_error_t mesh_connect();
mesh_error_t mesh_disconnect();
};
#endif
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
#define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
#include <string>
#include "base/platform_file.h"
namespace leveldb {
class Status;
}
namespace sync_file_system {
enum SyncStatusCode {
SYNC_STATUS_OK = 0,
SYNC_STATUS_UNKNOWN = -1000,
// Generic error code which is not specifically related to a specific
// submodule error code (yet).
SYNC_STATUS_FAILED = -1001,
// Basic ones that could be directly mapped to PlatformFileError.
SYNC_FILE_ERROR_FAILED = -1,
SYNC_FILE_ERROR_IN_USE = -2,
SYNC_FILE_ERROR_EXISTS = -3,
SYNC_FILE_ERROR_NOT_FOUND = -4,
SYNC_FILE_ERROR_ACCESS_DENIED = -5,
SYNC_FILE_ERROR_TOO_MANY_OPENED = -6,
SYNC_FILE_ERROR_NO_MEMORY = -7,
SYNC_FILE_ERROR_NO_SPACE = -8,
SYNC_FILE_ERROR_NOT_A_DIRECTORY = -9,
SYNC_FILE_ERROR_INVALID_OPERATION = -10,
SYNC_FILE_ERROR_SECURITY = -11,
SYNC_FILE_ERROR_ABORT = -12,
SYNC_FILE_ERROR_NOT_A_FILE = -13,
SYNC_FILE_ERROR_NOT_EMPTY = -14,
SYNC_FILE_ERROR_INVALID_URL = -15,
SYNC_FILE_ERROR_IO = -16,
// Database related errors.
SYNC_DATABASE_ERROR_NOT_FOUND = -50,
SYNC_DATABASE_ERROR_CORRUPTION = -51,
SYNC_DATABASE_ERROR_IO_ERROR = -52,
SYNC_DATABASE_ERROR_FAILED = -53,
// Sync specific status code.
SYNC_STATUS_FILE_BUSY = -100,
SYNC_STATUS_HAS_CONFLICT = -101,
SYNC_STATUS_NO_CONFLICT = -102,
SYNC_STATUS_ABORT = -103,
SYNC_STATUS_NO_CHANGE_TO_SYNC = -104,
SYNC_STATUS_SERVICE_TEMPORARILY_UNAVAILABLE = -105,
SYNC_STATUS_NETWORK_ERROR = -106,
SYNC_STATUS_AUTHENTICATION_FAILED = -107,
SYNC_STATUS_UNKNOWN_ORIGIN = -108,
SYNC_STATUS_NOT_MODIFIED = -109,
SYNC_STATUS_SYNC_DISABLED = -110,
SYNC_STATUS_ACCESS_FORBIDDEN = -111,
SYNC_STATUS_RETRY = -112,
};
const char* SyncStatusCodeToString(SyncStatusCode status);
SyncStatusCode LevelDBStatusToSyncStatusCode(const leveldb::Status& status);
SyncStatusCode PlatformFileErrorToSyncStatusCode(
base::PlatformFileError file_error);
base::PlatformFileError SyncStatusCodeToPlatformFileError(
SyncStatusCode status);
} // namespace sync_file_system
#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
|
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort ();
extern void exit (int);
int x;
foo()
{
static int count;
count++;
if (count > 1)
abort ();
}
static inline int
frob ()
{
int a;
__asm__ ("mov %1, %0\n\t" : "=r" (a) : "m" (x));
x++;
return a;
}
int
main ()
{
int i;
for (i = 0; i < 10 && frob () == 0; i++)
foo();
exit (0);
}
|
/*************************************************************************/ /*!
@File
@Title Services external synchronisation interface header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Defines synchronisation structures that are visible internally
and externally
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "img_types.h"
#ifndef _SYNC_EXTERNAL_
#define _SYNC_EXTERNAL_
typedef IMG_HANDLE SYNC_BRIDGE_HANDLE;
typedef struct _SYNC_PRIM_CONTEXT_ *PSYNC_PRIM_CONTEXT;
typedef struct _SYNC_OP_COOKIE_ *PSYNC_OP_COOKIE;
typedef struct _PVRSRV_CLIENT_SYNC_PRIM_
{
volatile IMG_UINT32 *pui32LinAddr; /*!< User pointer to the primitive */
} PVRSRV_CLIENT_SYNC_PRIM;
typedef IMG_HANDLE PVRSRV_CLIENT_SYNC_PRIM_HANDLE;
typedef struct _PVRSRV_CLIENT_SYNC_PRIM_OP_
{
IMG_UINT32 ui32Flags; /*!< Operation flags */
#define PVRSRV_CLIENT_SYNC_PRIM_OP_CHECK (1 << 0)
#define PVRSRV_CLIENT_SYNC_PRIM_OP_UPDATE (1 << 1)
PVRSRV_CLIENT_SYNC_PRIM *psSync; /*!< Pointer to the client sync */
IMG_UINT32 ui32FenceValue; /*!< The Fence value (only used if PVRSRV_CLIENT_SYNC_PRIM_OP_CHECK is set) */
IMG_UINT32 ui32UpdateValue; /*!< The Update value (only used if PVRSRV_CLIENT_SYNC_PRIM_OP_UPDATE is set) */
} PVRSRV_CLIENT_SYNC_PRIM_OP;
#endif /* _SYNC_EXTERNAL_ */
|
/* cpptrf.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Table of constant values */
static integer c__1 = 1;
static real c_b16 = -1.f;
/* Subroutine */ int cpptrf_(char *uplo, integer *n, complex *ap, integer *
info)
{
/* System generated locals */
integer i__1, i__2, i__3;
real r__1;
complex q__1, q__2;
/* Builtin functions */
double sqrt(doublereal);
/* Local variables */
integer j, jc, jj;
real ajj;
extern /* Subroutine */ int chpr_(char *, integer *, real *, complex *,
integer *, complex *);
extern /* Complex */ VOID cdotc_(complex *, integer *, complex *, integer
*, complex *, integer *);
extern logical lsame_(char *, char *);
logical upper;
extern /* Subroutine */ int ctpsv_(char *, char *, char *, integer *,
complex *, complex *, integer *), csscal_(
integer *, real *, complex *, integer *), xerbla_(char *, integer
*);
/* -- LAPACK routine (version 3.2) -- */
/* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
/* November 2006 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* CPPTRF computes the Cholesky factorization of a complex Hermitian */
/* positive definite matrix A stored in packed format. */
/* The factorization has the form */
/* A = U**H * U, if UPLO = 'U', or */
/* A = L * L**H, if UPLO = 'L', */
/* where U is an upper triangular matrix and L is lower triangular. */
/* Arguments */
/* ========= */
/* UPLO (input) CHARACTER*1 */
/* = 'U': Upper triangle of A is stored; */
/* = 'L': Lower triangle of A is stored. */
/* N (input) INTEGER */
/* The order of the matrix A. N >= 0. */
/* AP (input/output) COMPLEX array, dimension (N*(N+1)/2) */
/* On entry, the upper or lower triangle of the Hermitian matrix */
/* A, packed columnwise in a linear array. The j-th column of A */
/* is stored in the array AP as follows: */
/* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */
/* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. */
/* See below for further details. */
/* On exit, if INFO = 0, the triangular factor U or L from the */
/* Cholesky factorization A = U**H*U or A = L*L**H, in the same */
/* storage format as A. */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, the leading minor of order i is not */
/* positive definite, and the factorization could not be */
/* completed. */
/* Further Details */
/* =============== */
/* The packed storage scheme is illustrated by the following example */
/* when N = 4, UPLO = 'U': */
/* Two-dimensional storage of the Hermitian matrix A: */
/* a11 a12 a13 a14 */
/* a22 a23 a24 */
/* a33 a34 (aij = conjg(aji)) */
/* a44 */
/* Packed storage of the upper triangle of A: */
/* AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Test the input parameters. */
/* Parameter adjustments */
--ap;
/* Function Body */
*info = 0;
upper = lsame_(uplo, "U");
if (! upper && ! lsame_(uplo, "L")) {
*info = -1;
} else if (*n < 0) {
*info = -2;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("CPPTRF", &i__1);
return 0;
}
/* Quick return if possible */
if (*n == 0) {
return 0;
}
if (upper) {
/* Compute the Cholesky factorization A = U'*U. */
jj = 0;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
jc = jj + 1;
jj += j;
/* Compute elements 1:J-1 of column J. */
if (j > 1) {
i__2 = j - 1;
ctpsv_("Upper", "Conjugate transpose", "Non-unit", &i__2, &ap[
1], &ap[jc], &c__1);
}
/* Compute U(J,J) and test for non-positive-definiteness. */
i__2 = jj;
r__1 = ap[i__2].r;
i__3 = j - 1;
cdotc_(&q__2, &i__3, &ap[jc], &c__1, &ap[jc], &c__1);
q__1.r = r__1 - q__2.r, q__1.i = -q__2.i;
ajj = q__1.r;
if (ajj <= 0.f) {
i__2 = jj;
ap[i__2].r = ajj, ap[i__2].i = 0.f;
goto L30;
}
i__2 = jj;
r__1 = sqrt(ajj);
ap[i__2].r = r__1, ap[i__2].i = 0.f;
/* L10: */
}
} else {
/* Compute the Cholesky factorization A = L*L'. */
jj = 1;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
/* Compute L(J,J) and test for non-positive-definiteness. */
i__2 = jj;
ajj = ap[i__2].r;
if (ajj <= 0.f) {
i__2 = jj;
ap[i__2].r = ajj, ap[i__2].i = 0.f;
goto L30;
}
ajj = sqrt(ajj);
i__2 = jj;
ap[i__2].r = ajj, ap[i__2].i = 0.f;
/* Compute elements J+1:N of column J and update the trailing */
/* submatrix. */
if (j < *n) {
i__2 = *n - j;
r__1 = 1.f / ajj;
csscal_(&i__2, &r__1, &ap[jj + 1], &c__1);
i__2 = *n - j;
chpr_("Lower", &i__2, &c_b16, &ap[jj + 1], &c__1, &ap[jj + *n
- j + 1]);
jj = jj + *n - j + 1;
}
/* L20: */
}
}
goto L40;
L30:
*info = j;
L40:
return 0;
/* End of CPPTRF */
} /* cpptrf_ */
|
/*
* $Id$
*
* Oracle module result related functions
*
* Copyright (C) 2007,2008 TRUNK MOBILE
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio 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
*
* Kamailio 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 RES_H
#define RES_H
#include "../../lib/srdb1/db_res.h"
#include "../../lib/srdb1/db_con.h"
#define STATIC_BUF_LEN 65536
extern char st_buf[STATIC_BUF_LEN];
/*
* Read database answer and fill the structure
*/
int db_oracle_store_result(const db1_con_t* _h, db1_res_t** _r);
#endif /* RES_H */
|
#include <stdio.h>
#include <pcap.h>
#define LINE_LEN 16
void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *);
int main(int argc, char **argv)
{
pcap_t *fp;
char errbuf[PCAP_ERRBUF_SIZE];
if(argc != 2)
{
printf("usage: %s filename", argv[0]);
return -1;
}
/* Open the capture file */
if ((fp = pcap_open_offline(argv[1], // name of the device
errbuf // error buffer
)) == NULL)
{
fprintf(stderr,"\nUnable to open the file %s.\n", argv[1]);
return -1;
}
/* read and dispatch packets until EOF is reached */
pcap_loop(fp, 0, dispatcher_handler, NULL);
pcap_close(fp);
return 0;
}
void dispatcher_handler(u_char *temp1,
const struct pcap_pkthdr *header,
const u_char *pkt_data)
{
u_int i=0;
/*
* unused variable
*/
(VOID*)temp1;
/* print pkt timestamp and pkt len */
printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len);
/* Print the packet */
for (i=1; (i < header->caplen + 1 ) ; i++)
{
printf("%.2x ", pkt_data[i-1]);
if ( (i % LINE_LEN) == 0) printf("\n");
}
printf("\n\n");
}
|
//===--- magic-symbols-for-install-name.c - Magic linker directive symbols ===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// A file containing magic symbols that instruct the linker to use a
// different install name when targeting older OSes. This file gets
// compiled into all of the libraries that are embedded for backward
// deployment.
//
//===----------------------------------------------------------------------===//
#if defined(__APPLE__) && defined(__MACH__)
#include <Availability.h>
#include <TargetConditionals.h>
#include "../public/SwiftShims/Visibility.h"
#define RPATH_INSTALL_NAME_DIRECTIVE_IMPL2(name, major, minor) \
SWIFT_RUNTIME_EXPORT const char install_name_ ## major ## _ ## minor \
__asm("$ld$install_name$os" #major "." #minor "$@rpath/lib" #name ".dylib"); \
const char install_name_ ## major ## _ ## minor = 0;
#define RPATH_INSTALL_NAME_DIRECTIVE_IMPL(name, major, minor) \
RPATH_INSTALL_NAME_DIRECTIVE_IMPL2(name, major, minor)
#define RPATH_INSTALL_NAME_DIRECTIVE(major, minor) \
RPATH_INSTALL_NAME_DIRECTIVE_IMPL(SWIFT_TARGET_LIBRARY_NAME, major, minor)
#if TARGET_OS_WATCH
// Check watchOS first, because TARGET_OS_IPHONE includes watchOS.
RPATH_INSTALL_NAME_DIRECTIVE( 2, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 2, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 2, 2)
RPATH_INSTALL_NAME_DIRECTIVE( 3, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 3, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 3, 2)
RPATH_INSTALL_NAME_DIRECTIVE( 4, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 4, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 4, 2)
RPATH_INSTALL_NAME_DIRECTIVE( 4, 3)
RPATH_INSTALL_NAME_DIRECTIVE( 5, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 5, 1)
#elif TARGET_OS_IPHONE
RPATH_INSTALL_NAME_DIRECTIVE( 7, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 7, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 8, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 8, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 8, 2)
RPATH_INSTALL_NAME_DIRECTIVE( 8, 3)
RPATH_INSTALL_NAME_DIRECTIVE( 8, 4)
RPATH_INSTALL_NAME_DIRECTIVE( 9, 0)
RPATH_INSTALL_NAME_DIRECTIVE( 9, 1)
RPATH_INSTALL_NAME_DIRECTIVE( 9, 2)
RPATH_INSTALL_NAME_DIRECTIVE( 9, 3)
RPATH_INSTALL_NAME_DIRECTIVE(10, 0)
RPATH_INSTALL_NAME_DIRECTIVE(10, 1)
RPATH_INSTALL_NAME_DIRECTIVE(10, 2)
RPATH_INSTALL_NAME_DIRECTIVE(10, 3)
RPATH_INSTALL_NAME_DIRECTIVE(11, 0)
RPATH_INSTALL_NAME_DIRECTIVE(11, 1)
RPATH_INSTALL_NAME_DIRECTIVE(11, 2)
RPATH_INSTALL_NAME_DIRECTIVE(11, 3)
RPATH_INSTALL_NAME_DIRECTIVE(11, 4)
RPATH_INSTALL_NAME_DIRECTIVE(12, 0)
RPATH_INSTALL_NAME_DIRECTIVE(12, 1)
#elif TARGET_OS_OSX
RPATH_INSTALL_NAME_DIRECTIVE(10, 9)
RPATH_INSTALL_NAME_DIRECTIVE(10, 10)
RPATH_INSTALL_NAME_DIRECTIVE(10, 11)
RPATH_INSTALL_NAME_DIRECTIVE(10, 12)
RPATH_INSTALL_NAME_DIRECTIVE(10, 13)
// When building with a deployment target of < macOS 10.14,
// treat macOS 10.14 as an "older OS."
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_14
RPATH_INSTALL_NAME_DIRECTIVE(10, 14)
#endif
#else
#error Unknown target.
#endif
#endif // defined(__APPLE__) && defined(__MACH__)
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
#define MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
#include <string>
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
namespace mojo {
template<typename Interface>
class LazyInterfacePtr : public InterfacePtr<Interface> {
public:
LazyInterfacePtr() : service_provider_(NULL) {}
LazyInterfacePtr(ServiceProvider* service_provider)
: service_provider_(service_provider) {
}
void set_service_provider(ServiceProvider* service_provider) {
if (service_provider != service_provider_) {
InterfacePtr<Interface>::reset();
}
service_provider_ = service_provider;
}
Interface* get() const {
if (!InterfacePtr<Interface>::get()) {
mojo::ConnectToService<Interface>(
service_provider_,
const_cast<LazyInterfacePtr<Interface>*>(this));
}
return InterfacePtr<Interface>::get();
}
Interface* operator->() const { return get(); }
Interface& operator*() const { return *get(); }
private:
ServiceProvider* service_provider_;
};
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_
#define NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "net/base/network_config_watcher_mac.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_config_service.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace net {
class ProxyConfigServiceMac : public ProxyConfigService {
public:
// Constructs a ProxyConfigService that watches the Mac OS system settings.
// This instance is expected to be operated and deleted on the same thread
// (however it may be constructed from a different thread).
explicit ProxyConfigServiceMac(
const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_task_runner);
virtual ~ProxyConfigServiceMac();
public:
// ProxyConfigService implementation:
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE;
private:
class Helper;
// Forwarder just exists to keep the NetworkConfigWatcherMac API out of
// ProxyConfigServiceMac's public API.
class Forwarder : public NetworkConfigWatcherMac::Delegate {
public:
explicit Forwarder(ProxyConfigServiceMac* proxy_config_service)
: proxy_config_service_(proxy_config_service) {}
// NetworkConfigWatcherMac::Delegate implementation:
virtual void StartReachabilityNotifications() OVERRIDE {}
virtual void SetDynamicStoreNotificationKeys(
SCDynamicStoreRef store) OVERRIDE;
virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE;
private:
ProxyConfigServiceMac* const proxy_config_service_;
DISALLOW_COPY_AND_ASSIGN(Forwarder);
};
// Methods directly called by the NetworkConfigWatcherMac::Delegate:
void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store);
void OnNetworkConfigChange(CFArrayRef changed_keys);
// Called when the proxy configuration has changed, to notify the observers.
void OnProxyConfigChanged(const ProxyConfig& new_config);
Forwarder forwarder_;
scoped_ptr<const NetworkConfigWatcherMac> config_watcher_;
ObserverList<Observer> observers_;
// Holds the last system proxy settings that we fetched.
bool has_fetched_config_;
ProxyConfig last_config_fetched_;
scoped_refptr<Helper> helper_;
// The thread that we expect to be operated on.
const scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceMac);
};
} // namespace net
#endif // NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_
|
/*
* Copyright (c) 2007-2012 SlimDX Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "Enums.h"
namespace SlimDX
{
namespace XInput
{
/// <summary>
/// Describes keystroke data from a device.
/// </summary>
/// <unmanaged>XINPUT_KEYSTROKE</unmanaged>
public value class Keystroke : System::IEquatable<Keystroke>
{
private:
GamepadKeyCode m_VirtualKey;
KeystrokeFlags m_Flags;
XInput::UserIndex m_UserIndex;
int m_HidCode;
internal:
Keystroke( const XINPUT_KEYSTROKE& native );
public:
/// <summary>
/// Gets the virtual-key code of the key, button, or stick movement.
/// </summary>
property GamepadKeyCode VirtualKey
{
GamepadKeyCode get();
}
/// <summary>
/// Gets a combination of flags that indicate the keyboard state at the time of the input event.
/// </summary>
property KeystrokeFlags Flags
{
KeystrokeFlags get();
}
/// <summary>
/// Gets the index of the signed-in gamer associated with the device. Can be a value in the range 03.
/// </summary>
property XInput::UserIndex UserIndex
{
XInput::UserIndex get();
}
/// <summary>
/// Gets the HID code corresponding to the input. If there is no corresponding HID code, this value is zero.
/// </summary>
property int HidCode
{
int get();
}
/// <summary>
/// Tests for equality between two objects.
/// </summary>
/// <param name="left">The first value to compare.</param>
/// <param name="right">The second value to compare.</param>
/// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
static bool operator == ( Keystroke left, Keystroke right );
/// <summary>
/// Tests for inequality between two objects.
/// </summary>
/// <param name="left">The first value to compare.</param>
/// <param name="right">The second value to compare.</param>
/// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
static bool operator != ( Keystroke left, Keystroke right );
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>A 32-bit signed integer hash code.</returns>
virtual int GetHashCode() override;
/// <summary>
/// Returns a value that indicates whether the current instance is equal to a specified object.
/// </summary>
/// <param name="obj">Object to make the comparison with.</param>
/// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
virtual bool Equals( System::Object^ obj ) override;
/// <summary>
/// Returns a value that indicates whether the current instance is equal to the specified object.
/// </summary>
/// <param name="other">Object to make the comparison with.</param>
/// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
virtual bool Equals( Keystroke other );
/// <summary>
/// Determines whether the specified object instances are considered equal.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns><c>true</c> if <paramref name="value1"/> is the same instance as <paramref name="value2"/> or
/// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
static bool Equals( Keystroke% value1, Keystroke% value2 );
};
}
} |
/* Conversion from and to IBM904.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <stdint.h>
/* Get the conversion table. */
#include <ibm904.h>
#define CHARSET_NAME "IBM904//"
#define HAS_HOLES 1 /* Not all 256 character are defined. */
#include <8bit-generic.c>
|
/* RTEMS threads compatibility routines for libgcc2 and libobjc.
by: Rosimildo da Silva( rdasilva@connecttel.com ) */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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, or (at your option) any later
version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GTHR_RTEMS_H
#define GCC_GTHR_RTEMS_H
#ifdef __cplusplus
extern "C" {
#endif
#define __GTHREADS 1
#define __GTHREAD_ONCE_INIT 0
#define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION rtems_gxx_recursive_mutex_init
/* Avoid dependency on rtems specific headers. */
typedef void *__gthread_key_t;
typedef int __gthread_once_t;
typedef void *__gthread_mutex_t;
typedef void *__gthread_recursive_mutex_t;
/*
* External functions provided by RTEMS. They are very similar to their POSIX
* counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
* header files.
*/
/* generic per task variables */
extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void));
extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *));
extern int rtems_gxx_key_delete (__gthread_key_t __key);
extern void *rtems_gxx_getspecific (__gthread_key_t __key);
extern int rtems_gxx_setspecific (__gthread_key_t __key, const void *__ptr);
/* mutex support */
extern void rtems_gxx_mutex_init (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_lock (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *__mutex);
/* recursive mutex support */
extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex);
/* RTEMS threading is always active */
static inline int
__gthread_active_p (void)
{
return 1;
}
/* Wrapper calls */
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
return rtems_gxx_once( __once, __func );
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return rtems_gxx_key_create( __key, __dtor );
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return rtems_gxx_key_delete (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return rtems_gxx_getspecific (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return rtems_gxx_setspecific (__key, __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_destroy (__mutex);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_lock (__mutex);
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_trylock (__mutex);
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_unlock( __mutex );
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_unlock( __mutex );
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
/* This requires that recursive and non-recursive mutexes have the same
representation. */
return rtems_gxx_mutex_destroy (__mutex );
}
#ifdef __cplusplus
}
#endif
#endif /* ! GCC_GTHR_RTEMS_H */
|
#ifndef VEC3D_H
#define VEC3D_H
#include <iostream>
#include <cmath>
class Vec3D
{
public:
float x,y,z;
Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) {}
Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {}
Vec3D& operator= (const Vec3D &v) {
x = v.x;
y = v.y;
z = v.z;
return *this;
}
Vec3D operator+ (const Vec3D &v) const
{
Vec3D r(x+v.x,y+v.y,z+v.z);
return r;
}
Vec3D operator- (const Vec3D &v) const
{
Vec3D r(x-v.x,y-v.y,z-v.z);
return r;
}
float operator* (const Vec3D &v) const
{
return x*v.x + y*v.y + z*v.z;
}
Vec3D operator* (float d) const
{
Vec3D r(x*d,y*d,z*d);
return r;
}
friend Vec3D operator* (float d, const Vec3D& v)
{
return v * d;
}
Vec3D operator% (const Vec3D &v) const
{
Vec3D r(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
return r;
}
Vec3D& operator+= (const Vec3D &v)
{
x += v.x;
y += v.y;
z += v.z;
return *this;
}
Vec3D& operator-= (const Vec3D &v)
{
x -= v.x;
y -= v.y;
z -= v.z;
return *this;
}
Vec3D& operator*= (float d)
{
x *= d;
y *= d;
z *= d;
return *this;
}
float lengthSquared() const
{
return x*x+y*y+z*z;
}
float length() const
{
return sqrt(x*x+y*y+z*z);
}
Vec3D& normalize()
{
this->operator*= (1.0f/length());
return *this;
}
Vec3D operator~ () const
{
Vec3D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec3D& v)
{
in >> v.x >> v.y >> v.z;
return in;
}
operator float*()
{
return (float*)this;
}
};
class Vec2D
{
public:
float x,y;
Vec2D(float x0 = 0.0f, float y0 = 0.0f) : x(x0), y(y0) {}
Vec2D(const Vec2D& v) : x(v.x), y(v.y) {}
Vec2D& operator= (const Vec2D &v) {
x = v.x;
y = v.y;
return *this;
}
Vec2D operator+ (const Vec2D &v) const
{
Vec2D r(x+v.x,y+v.y);
return r;
}
Vec2D operator- (const Vec2D &v) const
{
Vec2D r(x-v.x,y-v.y);
return r;
}
float operator* (const Vec2D &v) const
{
return x*v.x + y*v.y;
}
Vec2D operator* (float d) const
{
Vec2D r(x*d,y*d);
return r;
}
friend Vec2D operator* (float d, const Vec2D& v)
{
return v * d;
}
Vec2D& operator+= (const Vec2D &v)
{
x += v.x;
y += v.y;
return *this;
}
Vec2D& operator-= (const Vec2D &v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vec2D& operator*= (float d)
{
x *= d;
y *= d;
return *this;
}
float lengthSquared() const
{
return x*x+y*y;
}
float length() const
{
return sqrt(x*x+y*y);
}
Vec2D& normalize()
{
this->operator*= (1.0f/length());
return *this;
}
Vec2D operator~ () const
{
Vec2D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec2D& v)
{
in >> v.x >> v.y;
return in;
}
operator float*()
{
return (float*)this;
}
};
inline void rotate(float x0, float y0, float *x, float *y, float angle)
{
float xa = *x - x0, ya = *y - y0;
*x = xa*cosf(angle) - ya*sinf(angle) + x0;
*y = xa*sinf(angle) + ya*cosf(angle) + y0;
}
#endif
|
/* PR c/77323 */
/* { dg-do compile { target ia32 } } */
/* { dg-options "" } */
__int128 a; /* { dg-error "not supported" } */
_Float128x b; /* { dg-error "not supported" } */
|
/****************************************************************************
**+-----------------------------------------------------------------------+**
**| |**
**| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
**| 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 Texas Instruments 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 _IPCKERNELAPI_H_
#define _IPCKERNELAPI_H_
#include "osTIType.h"
UINT32 IPCKernelInit (TI_HANDLE hAdapter,TI_HANDLE hIPCEv);
UINT32 IPCKernelDeInit (TI_HANDLE hAdapter);
INT32 IPC_EventSend (TI_HANDLE hAdapter, tiUINT8 *pEvData, tiUINT32 EvDataSize);
#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 UI_BASE_BASE_WINDOW_H_
#define UI_BASE_BASE_WINDOW_H_
#include "base/compiler_specific.h"
#include "ui/base/ui_base_types.h" // WindowShowState
#include "ui/gfx/native_widget_types.h"
namespace gfx {
class Rect;
}
class SkRegion;
namespace ui {
// Provides an interface to perform actions on windows, and query window
// state.
class BaseWindow {
public:
// Returns true if the window is currently the active/focused window.
virtual bool IsActive() const = 0;
// Returns true if the window is maximized (aka zoomed).
virtual bool IsMaximized() const = 0;
// Returns true if the window is minimized.
virtual bool IsMinimized() const = 0;
// Returns true if the window is full screen.
virtual bool IsFullscreen() const = 0;
// Return a platform dependent identifier for this window.
virtual gfx::NativeWindow GetNativeWindow() = 0;
// Returns the nonmaximized bounds of the window (even if the window is
// currently maximized or minimized) in terms of the screen coordinates.
virtual gfx::Rect GetRestoredBounds() const = 0;
// Returns the restore state for the window (platform dependent).
virtual ui::WindowShowState GetRestoredState() const = 0;
// Retrieves the window's current bounds, including its window.
// This will only differ from GetRestoredBounds() for maximized
// and minimized windows.
virtual gfx::Rect GetBounds() const = 0;
// Shows the window, or activates it if it's already visible.
virtual void Show() = 0;
// Hides the window.
virtual void Hide() = 0;
// Show the window, but do not activate it. Does nothing if window
// is already visible.
virtual void ShowInactive() = 0;
// Closes the window as soon as possible. The close action may be delayed
// if an operation is in progress (e.g. a drag operation).
virtual void Close() = 0;
// Activates (brings to front) the window. Restores the window from minimized
// state if necessary.
virtual void Activate() = 0;
// Deactivates the window, making the next window in the Z order the active
// window.
virtual void Deactivate() = 0;
// Maximizes/minimizes/restores the window.
virtual void Maximize() = 0;
virtual void Minimize() = 0;
virtual void Restore() = 0;
// Sets the window's size and position to the specified values.
virtual void SetBounds(const gfx::Rect& bounds) = 0;
// Flashes the taskbar item associated with this window.
// Set |flash| to true to initiate flashing, false to stop flashing.
virtual void FlashFrame(bool flash) = 0;
// Returns true if a window is set to be always on top.
virtual bool IsAlwaysOnTop() const = 0;
};
} // namespace ui
#endif // UI_BASE_BASE_WINDOW_H_
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.cstring,debug.ExprInspection -analyzer-store=region -verify %s
// RUN: %clang_analyze_cc1 -DUSE_BUILTINS -analyzer-checker=core,unix.cstring,debug.ExprInspection -analyzer-store=region -verify %s
// XFAIL: *
// This file is for tests that may eventually go into string.c, or may be
// deleted outright. At one point these tests passed, but only because we
// weren't correctly modelling the behavior of the relevant string functions.
// The tests aren't incorrect, but require the analyzer to be smarter about
// conjured values than it currently is.
//===----------------------------------------------------------------------===
// Declarations
//===----------------------------------------------------------------------===
// Some functions are so similar to each other that they follow the same code
// path, such as memcpy and __memcpy_chk, or memcmp and bcmp. If VARIANT is
// defined, make sure to use the variants instead to make sure they are still
// checked by the analyzer.
// Some functions are implemented as builtins. These should be #defined as
// BUILTIN(f), which will prepend "__builtin_" if USE_BUILTINS is defined.
// Functions that have variants and are also available as builtins should be
// declared carefully! See memcpy() for an example.
#ifdef USE_BUILTINS
# define BUILTIN(f) __builtin_ ## f
#else /* USE_BUILTINS */
# define BUILTIN(f) f
#endif /* USE_BUILTINS */
#define NULL 0
typedef typeof(sizeof(int)) size_t;
void clang_analyzer_eval(int);
//===----------------------------------------------------------------------===
// strnlen()
//===----------------------------------------------------------------------===
#define strnlen BUILTIN(strnlen)
size_t strnlen(const char *s, size_t maxlen);
void strnlen_liveness(const char *x) {
if (strnlen(x, 10) < 5)
return;
clang_analyzer_eval(strnlen(x, 10) < 5); // expected-warning{{FALSE}}
}
void strnlen_subregion() {
struct two_stringsn { char a[2], b[2]; };
extern void use_two_stringsn(struct two_stringsn *);
struct two_stringsn z;
use_two_stringsn(&z);
size_t a = strnlen(z.a, 10);
z.b[0] = 5;
size_t b = strnlen(z.a, 10);
if (a == 0)
clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
use_two_stringsn(&z);
size_t c = strnlen(z.a, 10);
if (a == 0)
clang_analyzer_eval(c == 0); // expected-warning{{UNKNOWN}}
}
extern void use_stringn(char *);
void strnlen_argument(char *x) {
size_t a = strnlen(x, 10);
size_t b = strnlen(x, 10);
if (a == 0)
clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
use_stringn(x);
size_t c = strnlen(x, 10);
if (a == 0)
clang_analyzer_eval(c == 0); // expected-warning{{UNKNOWN}}
}
extern char global_strn[];
void strnlen_global() {
size_t a = strnlen(global_strn, 10);
size_t b = strnlen(global_strn, 10);
if (a == 0)
clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
// Call a function with unknown effects, which should invalidate globals.
use_stringn(0);
size_t c = strnlen(global_strn, 10);
if (a == 0)
clang_analyzer_eval(c == 0); // expected-warning{{UNKNOWN}}
}
void strnlen_indirect(char *x) {
size_t a = strnlen(x, 10);
char *p = x;
char **p2 = &p;
size_t b = strnlen(x, 10);
if (a == 0)
clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
extern void use_stringn_ptr(char*const*);
use_stringn_ptr(p2);
size_t c = strnlen(x, 10);
if (a == 0)
clang_analyzer_eval(c == 0); // expected-warning{{UNKNOWN}}
}
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2003 by Ralf Baechle
*/
#ifndef __ASM_PREFETCH_H
#define __ASM_PREFETCH_H
/*
* R5000 and RM5200 implements pref and prefx instructions but they're nops, so
* rather than wasting time we pretend these processors don't support
* prefetching at all.
*
* R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
* StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
*
* Hell (and the book on my shelf I can't open ...) know what the R8000 does.
*
* RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
* Pref_PrepareForStore also.
*
* RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
* Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
* current versions due to erratum G105.
*
* VR5500 (including VR5701 and VR7701) only implement load prefetch.
*
* Finally MIPS32 and MIPS64 implement all of the following hints.
*/
#define Pref_Load 0
#define Pref_Store 1
/* 2 and 3 are reserved */
#define Pref_LoadStreamed 4
#define Pref_StoreStreamed 5
#define Pref_LoadRetained 6
#define Pref_StoreRetained 7
/* 8 ... 24 are reserved */
#define Pref_WriteBackInvalidate 25
#define Pref_PrepareForStore 30
#ifdef __ASSEMBLY__
.macro __pref hint addr
#ifdef CONFIG_CPU_HAS_PREFETCH
pref \hint, \addr
#endif
.endm
.macro pref_load addr
__pref Pref_Load, \addr
.endm
.macro pref_store addr
__pref Pref_Store, \addr
.endm
.macro pref_load_streamed addr
__pref Pref_LoadStreamed, \addr
.endm
.macro pref_store_streamed addr
__pref Pref_StoreStreamed, \addr
.endm
.macro pref_load_retained addr
__pref Pref_LoadRetained, \addr
.endm
.macro pref_store_retained addr
__pref Pref_StoreRetained, \addr
.endm
.macro pref_wback_inv addr
__pref Pref_WriteBackInvalidate, \addr
.endm
.macro pref_prepare_for_store addr
__pref Pref_PrepareForStore, \addr
.endm
#endif
#endif /* __ASM_PREFETCH_H */
|
// Package.h
//
// Copyright (c) 2013 Marin Usalj | mneorr.com
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
@class ATZInstaller;
@interface ATZPackage : NSObject
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSString *description;
@property (strong, nonatomic) NSString *type;
@property (strong, nonatomic) NSString *remotePath;
@property (strong, nonatomic) NSString *revision;
@property (strong, nonatomic) NSString *screenshotPath;
@property (strong, nonatomic) NSString *iconName;
@property (nonatomic, readonly) NSString *website;
@property (nonatomic, readonly) NSString *extension;
@property (nonatomic, readonly) BOOL isInstalled;
@property (nonatomic, assign) BOOL requiresRestart;
- (id)initWithDictionary:(NSDictionary *)dict;
- (void)installWithProgress:(void(^)(NSString *proggressMessage, CGFloat progress))progress
completion:(void(^)(NSError *failure))completion;
- (void)updateWithProgress:(void(^)(NSString *proggressMessage, CGFloat progress))progress
completion:(void(^)(NSError *failure))completion;
- (void)removeWithCompletion:(void(^)(NSError *failure))completion;
#pragma mark - Abstract
- (ATZInstaller *)installer;
@end
|
/*
* Copyright (C) 2005-2012 Junjiro R. Okajima
*
* This program, aufs 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
*/
/*
* support for loopback mount as a branch
*/
#ifndef __AUFS_LOOP_H__
#define __AUFS_LOOP_H__
#ifdef __KERNEL__
struct dentry;
struct super_block;
#ifdef CONFIG_AUFS_BDEV_LOOP
/* loop.c */
int au_test_loopback_overlap(struct super_block *sb, struct dentry *h_adding);
int au_test_loopback_kthread(void);
void au_warn_loopback(struct super_block *h_sb);
int au_loopback_init(void);
void au_loopback_fin(void);
#else
AuStubInt0(au_test_loopback_overlap, struct super_block *sb,
struct dentry *h_adding)
AuStubInt0(au_test_loopback_kthread, void)
AuStubVoid(au_warn_loopback, struct super_block *h_sb)
AuStubInt0(au_loopback_init, void)
AuStubVoid(au_loopback_fin, void)
#endif /* BLK_DEV_LOOP */
#endif /* __KERNEL__ */
#endif /* __AUFS_LOOP_H__ */
|
/*
* Generic advertisement service (GAS) (IEEE 802.11u)
* Copyright (c) 2009, Atheros Communications
* Copyright (c) 2011-2012, Qualcomm Atheros
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef GAS_H
#define GAS_H
struct wpabuf *gas_build_initial_req(u8 dialog_token, size_t size);
struct wpabuf *gas_build_comeback_req(u8 dialog_token);
struct wpabuf *gas_build_initial_resp(u8 dialog_token, u16 status_code, u16 comeback_delay, size_t size);
struct wpabuf *gas_anqp_build_initial_req(u8 dialog_token, size_t size);
struct wpabuf *gas_anqp_build_initial_resp(u8 dialog_token, u16 status_code, u16 comeback_delay, size_t size);
struct wpabuf *gas_anqp_build_initial_resp_buf(u8 dialog_token, u16 status_code, u16 comeback_delay, struct wpabuf *payload);
struct wpabuf *gas_anqp_build_comeback_resp(u8 dialog_token, u16 status_code, u8 frag_id, u8 more, u16 comeback_delay, size_t size);
struct wpabuf *gas_anqp_build_comeback_resp_buf(u8 dialog_token, u16 status_code, u8 frag_id, u8 more, u16 comeback_delay, struct wpabuf *payload);
void gas_anqp_set_len(struct wpabuf *buf);
u8 *gas_anqp_add_element(struct wpabuf *buf, u16 info_id);
void gas_anqp_set_element_len(struct wpabuf *buf, u8 *len_pos);
#endif /* GAS_H */
|
/*
*
* Copyright 2015, 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.
* * 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 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.
*
*/
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_POSIX_SOCKETUTILS
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include <fcntl.h>
#include <sys/socket.h>
#include <unistd.h>
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/sockaddr.h"
int grpc_accept4(int sockfd, grpc_resolved_address *resolved_addr, int nonblock,
int cloexec) {
int fd, flags;
GPR_ASSERT(sizeof(socklen_t) <= sizeof(size_t));
GPR_ASSERT(resolved_addr->len <= (socklen_t)-1);
fd = accept(sockfd, (struct sockaddr *)resolved_addr->addr,
(socklen_t *)&resolved_addr->len);
if (fd >= 0) {
if (nonblock) {
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0) goto close_and_error;
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) goto close_and_error;
}
if (cloexec) {
flags = fcntl(fd, F_GETFD, 0);
if (flags < 0) goto close_and_error;
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) != 0) goto close_and_error;
}
}
return fd;
close_and_error:
close(fd);
return -1;
}
#endif /* GRPC_POSIX_SOCKETUTILS */
|
//
// OCHamcrest - HCSubstringMatcher.h
// Copyright 2009 www.hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//
// Inherited
#import <OCHamcrest/HCBaseMatcher.h>
@interface HCSubstringMatcher : HCBaseMatcher
{
NSString* substring;
}
- (id) initWithSubstring:(NSString*)aSubstring;
@end
|
/*
===========================================================================
Copyright (C) 1999 - 2005, Id Software, Inc.
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK 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.
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 "qcommon/q_shared.h"
// this is only used for visualization tools in cm_ debug functions
typedef struct winding_s {
int numpoints;
vec3_t p[4]; // variable sized
} winding_t;
#define MAX_POINTS_ON_WINDING 64
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
#define SIDE_CROSS 3
#define CLIP_EPSILON 0.1f
#define MAX_MAP_BOUNDS 65535
// you can define on_epsilon in the makefile as tighter
#ifndef ON_EPSILON
#define ON_EPSILON 0.1f
#endif
winding_t *AllocWinding (int points);
winding_t *CopyWinding (winding_t *w);
winding_t *BaseWindingForPlane (vec3_t normal, float dist);
void FreeWinding (winding_t *w);
void WindingBounds (winding_t *w, vec3_t mins, vec3_t maxs);
void AddWindingToConvexHull( winding_t *w, winding_t **hull, vec3_t normal );
void ChopWindingInPlace (winding_t **w, vec3_t normal, float dist, float epsilon);
// frees the original if clipped
void pw(winding_t *w);
|
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* Routines for various UTF conversions */
#ifndef _UTF_H
#define _UTF_H
#include <stdio.h>
#include "jni.h"
#include "utf_md.h"
/* Use THIS_FILE when it is available. */
#ifndef THIS_FILE
#define THIS_FILE __FILE__
#endif
/* Error and assert macros */
#define UTF_ERROR(m) utfError(THIS_FILE, __LINE__, m)
#define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 )
void utfError(char *file, int line, char *message);
struct UtfInst* JNICALL utfInitialize
(char *options);
void JNICALL utfTerminate
(struct UtfInst *ui, char *options);
int JNICALL utf8ToPlatform
(struct UtfInst *ui, jbyte *utf8,
int len, char *output, int outputMaxLen);
int JNICALL utf8FromPlatform
(struct UtfInst *ui, char *str, int len,
jbyte *output, int outputMaxLen);
int JNICALL utf8ToUtf16
(struct UtfInst *ui, jbyte *utf8, int len,
jchar *output, int outputMaxLen);
int JNICALL utf16ToUtf8m
(struct UtfInst *ui, jchar *utf16, int len,
jbyte *output, int outputMaxLen);
int JNICALL utf16ToUtf8s
(struct UtfInst *ui, jchar *utf16, int len,
jbyte *output, int outputMaxLen);
int JNICALL utf8sToUtf8mLength
(struct UtfInst *ui, jbyte *string, int length);
void JNICALL utf8sToUtf8m
(struct UtfInst *ui, jbyte *string, int length,
jbyte *new_string, int new_length);
int JNICALL utf8mToUtf8sLength
(struct UtfInst *ui, jbyte *string, int length);
void JNICALL utf8mToUtf8s
(struct UtfInst *ui, jbyte *string, int length,
jbyte *new_string, int new_length);
#endif
|
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.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 __PJNATH_TEST_SERVER_H__
#define __PJNATH_TEST_SERVER_H__
#include <pjnath.h>
#include <pjlib-util.h>
#include <pjlib.h>
#define DNS_SERVER_PORT 55533
#define STUN_SERVER_PORT 33478
#define TURN_SERVER_PORT 33479
#define TURN_USERNAME "auser"
#define TURN_PASSWD "apass"
#define MAX_TURN_ALLOC 16
#define MAX_TURN_PERM 16
enum test_server_flags
{
CREATE_DNS_SERVER = (1 << 0),
CREATE_A_RECORD_FOR_DOMAIN = (1 << 1),
CREATE_STUN_SERVER = (1 << 5),
CREATE_STUN_SERVER_DNS_SRV = (1 << 6),
CREATE_TURN_SERVER = (1 << 10),
CREATE_TURN_SERVER_DNS_SRV = (1 << 11),
};
typedef struct test_server test_server;
/* TURN allocation */
typedef struct turn_allocation
{
test_server *test_srv;
pj_pool_t *pool;
pj_activesock_t *sock;
pj_ioqueue_op_key_t send_key;
pj_sockaddr client_addr;
pj_sockaddr alloc_addr;
unsigned perm_cnt;
pj_sockaddr perm[MAX_TURN_PERM];
unsigned chnum[MAX_TURN_PERM];
pj_stun_msg *data_ind;
} turn_allocation;
/*
* Server installation for testing.
* This comprises of DNS server, STUN server, and TURN server.
*/
struct test_server
{
pj_pool_t *pool;
pj_uint32_t flags;
pj_stun_config *stun_cfg;
pj_ioqueue_op_key_t send_key;
pj_dns_server *dns_server;
pj_activesock_t *stun_sock;
pj_activesock_t *turn_sock;
unsigned turn_alloc_cnt;
turn_allocation turn_alloc[MAX_TURN_ALLOC];
pj_bool_t turn_respond_allocate;
pj_bool_t turn_respond_refresh;
struct turn_stat {
unsigned rx_allocate_cnt;
unsigned rx_refresh_cnt;
unsigned rx_send_ind_cnt;
} turn_stat;
pj_str_t domain;
pj_str_t username;
pj_str_t passwd;
};
pj_status_t create_test_server(pj_stun_config *stun_cfg,
pj_uint32_t flags,
const char *domain,
test_server **p_test_srv);
void destroy_test_server(test_server *test_srv);
void test_server_poll_events(test_server *test_srv);
#endif /* __PJNATH_TEST_SERVER_H__ */
|
#include <linux/compiler.h>
#include <linux/mm.h>
#include <linux/signal.h>
#include <linux/smp.h>
#include <asm/asm.h>
#include <asm/bootinfo.h>
#include <asm/byteorder.h>
#include <asm/cpu.h>
#include <asm/inst.h>
#include <asm/processor.h>
#include <asm/uaccess.h>
#include <asm/branch.h>
#include <asm/mipsregs.h>
#include <asm/cacheflush.h>
#include <asm/fpu_emulator.h>
#include "ieee754.h"
#ifdef __mips
#undef __mips
#endif
#define __mips 4
struct emuframe {
mips_instruction emul;
mips_instruction badinst;
mips_instruction cookie;
unsigned long epc;
};
int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc)
{
extern asmlinkage void handle_dsemulret(void);
struct emuframe __user *fr;
int err;
if (ir == 0) {
regs->cp0_epc = cpc;
regs->cp0_cause &= ~CAUSEF_BD;
return 0;
}
#ifdef DSEMUL_TRACE
printk("dsemul %lx %lx\n", regs->cp0_epc, cpc);
#endif
fr = (struct emuframe __user *)
((regs->regs[29] - sizeof(struct emuframe)) & ~0x7);
if (unlikely(!access_ok(VERIFY_WRITE, fr, sizeof(struct emuframe))))
return SIGBUS;
err = __put_user(ir, &fr->emul);
err |= __put_user((mips_instruction)BREAK_MATH, &fr->badinst);
err |= __put_user((mips_instruction)BD_COOKIE, &fr->cookie);
err |= __put_user(cpc, &fr->epc);
if (unlikely(err)) {
MIPS_FPU_EMU_INC_STATS(errors);
return SIGBUS;
}
regs->cp0_epc = (unsigned long) &fr->emul;
flush_cache_sigtramp((unsigned long)&fr->badinst);
return SIGILL;
}
int do_dsemulret(struct pt_regs *xcp)
{
struct emuframe __user *fr;
unsigned long epc;
u32 insn, cookie;
int err = 0;
fr = (struct emuframe __user *)
(xcp->cp0_epc - sizeof(mips_instruction));
if (!access_ok(VERIFY_READ, fr, sizeof(struct emuframe)))
return 0;
err = __get_user(insn, &fr->badinst);
err |= __get_user(cookie, &fr->cookie);
if (unlikely(err || (insn != BREAK_MATH) || (cookie != BD_COOKIE))) {
MIPS_FPU_EMU_INC_STATS(errors);
return 0;
}
#ifdef DSEMUL_TRACE
printk("dsemulret\n");
#endif
if (__get_user(epc, &fr->epc)) {
force_sig(SIGBUS, current);
return 0;
}
xcp->cp0_epc = epc;
return 1;
}
|
/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __PMIC8XXX_VIBRATOR_H__
#define __PMIC8XXX_VIBRATOR_H__
#define PM8XXX_VIBRATOR_DEV_NAME "pm8xxx-vib"
enum pm8xxx_vib_en_mode {
PM8XXX_VIB_MANUAL,
PM8XXX_VIB_DTEST1,
PM8XXX_VIB_DTEST2,
PM8XXX_VIB_DTEST3
};
struct pm8xxx_vib_config {
u16 drive_mV;
u8 active_low;
enum pm8xxx_vib_en_mode enable_mode;
};
struct pm8xxx_vibrator_platform_data {
int initial_vibrate_ms;
int max_timeout_ms;
int level_mV;
};
int pm8xxx_vibrator_config(struct pm8xxx_vib_config *vib_config);
#endif
|
/*
* Apple Onboard Audio driver for Onyx codec (header)
*
* Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
*
* GPL v2, can be found in COPYING.
*/
#ifndef __SND_AOA_CODEC_ONYX_H
#define __SND_AOA_CODEC_ONYX_H
#include <stddef.h>
#include <linux/i2c.h>
#include <asm/pmac_low_i2c.h>
#include <asm/prom.h>
#define ONYX_REG_DAC_ATTEN_LEFT 65
#define FIRSTREGISTER ONYX_REG_DAC_ATTEN_LEFT
#define ONYX_REG_DAC_ATTEN_RIGHT 66
#define ONYX_REG_CONTROL 67
# define ONYX_MRST (1<<7)
# define ONYX_SRST (1<<6)
# define ONYX_ADPSV (1<<5)
# define ONYX_DAPSV (1<<4)
# define ONYX_SILICONVERSION (1<<0)
#define ONYX_REG_DAC_CONTROL 68
# define ONYX_OVR1 (1<<6)
# define ONYX_MUTE_RIGHT (1<<1)
# define ONYX_MUTE_LEFT (1<<0)
#define ONYX_REG_DAC_DEEMPH 69
# define ONYX_DIGDEEMPH_SHIFT 5
# define ONYX_DIGDEEMPH_MASK (3<<ONYX_DIGDEEMPH_SHIFT)
# define ONYX_DIGDEEMPH_CTRL (1<<4)
#define ONYX_REG_DAC_FILTER 70
# define ONYX_ROLLOFF_FAST (1<<5)
# define ONYX_DAC_FILTER_ALWAYS (1<<2)
#define ONYX_REG_DAC_OUTPHASE 71
# define ONYX_OUTPHASE_INVERTED (1<<0)
#define ONYX_REG_ADC_CONTROL 72
# define ONYX_ADC_INPUT_MIC (1<<5)
# define ONYX_ADC_PGA_GAIN_MASK 0x1f
#define ONYX_REG_ADC_HPF_BYPASS 75
# define ONYX_HPF_DISABLE (1<<3)
# define ONYX_ADC_HPF_ALWAYS (1<<2)
#define ONYX_REG_DIG_INFO1 77
# define ONYX_MASK_DIN_TO_BPZ (1<<7)
# define ONYX_DIGOUT_DISABLE (1<<0)
#define ONYX_REG_DIG_INFO2 78
#define ONYX_REG_DIG_INFO3 79
#define ONYX_REG_DIG_INFO4 80
# define ONYX_VALIDL (1<<7)
# define ONYX_VALIDR (1<<6)
# define ONYX_SPDIF_ENABLE (1<<5)
# define ONYX_WORDLEN_MASK (0xF)
#endif
|
#ifndef __ASM_CACHEFLUSH_H
#define __ASM_CACHEFLUSH_H
#include <linux/mm.h>
#define flush_cache_all() do { } while (0)
#define flush_cache_mm(mm) do { } while (0)
#define flush_cache_dup_mm(mm) do { } while (0)
#define flush_cache_range(vma, start, end) do { } while (0)
#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
#define flush_dcache_page(page) do { } while (0)
#define flush_dcache_mmap_lock(mapping) do { } while (0)
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
#define flush_icache_range(start, end) do { } while (0)
#define flush_icache_page(vma,pg) do { } while (0)
#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
#define flush_cache_vmap(start, end) do { } while (0)
#define flush_cache_vunmap(start, end) do { } while (0)
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { \
memcpy(dst, src, len); \
flush_icache_user_range(vma, page, vaddr, len); \
} while (0)
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
memcpy(dst, src, len)
#endif
|
/* Header describing `ar' archive file format.
Copyright (C) 1996 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/>. */
#ifndef _AR_H
#define _AR_H 1
#include <sys/cdefs.h>
/* Archive files start with the ARMAG identifying string. Then follows a
`struct ar_hdr', and as many bytes of member file data as its `ar_size'
member indicates, for each member file. */
#define ARMAG "!<arch>\n" /* String that begins an archive file. */
#define SARMAG 8 /* Size of that string. */
#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */
__BEGIN_DECLS
struct ar_hdr
{
char ar_name[16]; /* Member file name, sometimes / terminated. */
char ar_date[12]; /* File date, decimal seconds since Epoch. */
char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */
char ar_mode[8]; /* File mode, in ASCII octal. */
char ar_size[10]; /* File size, in ASCII decimal. */
char ar_fmag[2]; /* Always contains ARFMAG. */
};
__END_DECLS
#endif /* ar.h */
|
/*
* Copyright (C) 2008-2009 Advanced Micro Devices, Inc.
*
* 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 COPYRIGHT HOLDER(S) 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.
*/
/*
* Authors:
* Richard Li <RichardZ.Li@amd.com>, <richardradeon@gmail.com>
*/
#ifndef __R700_IOCTL_H__
#define __R700_IOCTL_H__
#include "r600_context.h"
#include "radeon_drm.h"
extern void r700InitIoctlFuncs(struct dd_function_table *functions);
#endif /* __R700_IOCTL_H__ */
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_HANDLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_HANDLER_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_resource_bundle_handler.h"
#include "include/capi/cef_resource_bundle_handler_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefResourceBundleHandlerCppToC
: public CefCppToC<CefResourceBundleHandlerCppToC, CefResourceBundleHandler,
cef_resource_bundle_handler_t> {
public:
explicit CefResourceBundleHandlerCppToC(CefResourceBundleHandler* cls);
virtual ~CefResourceBundleHandlerCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_HANDLER_CPPTOC_H_
|
/* Copyright (c) 2013 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.
*/
/* From extensions/dev/ppb_ext_events_dev.idl,
* modified Mon Mar 18 17:18:20 2013.
*/
#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_
#define PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
#define PPB_EXT_EVENTS_DEV_INTERFACE_0_1 "PPB_Ext_Events(Dev);0.1"
#define PPB_EXT_EVENTS_DEV_INTERFACE PPB_EXT_EVENTS_DEV_INTERFACE_0_1
/**
* @file
*/
/**
* @addtogroup Typedefs
* @{
*/
/**
* Used to represent arbitrary C function pointers. Please note that usually
* the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
* has a different signature than <code>void (*)()</code>.
*/
typedef void (*PP_Ext_GenericFuncType)(void);
/**
* @}
*/
/**
* @addtogroup Structs
* @{
*/
/**
* An event listener that can be registered with the browser and receive
* notifications via the callback function.
*
* A function is defined for each event type to return a properly-filled
* <code>PP_Ext_EventListener</code> struct, for example,
* <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
*/
struct PP_Ext_EventListener {
/**
* The name of the event to register to.
*/
const char* event_name;
/**
* A callback function whose signature is determined by
* <code>event_name</code>. All calls will happen on the same thread as the
* one on which <code>AddListener()</code> is called.
*/
PP_Ext_GenericFuncType func;
/**
* An opaque pointer that will be passed to <code>func</code>.
*/
void* user_data;
};
/**
* @}
*/
/**
* @addtogroup Interfaces
* @{
*/
struct PPB_Ext_Events_Dev_0_1 {
/**
* Registers a listener to an event.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
* @param[in] listener A <code>PP_Ext_EventListener</code> struct.
*
* @return An listener ID, or 0 if failed.
*/
uint32_t (*AddListener)(PP_Instance instance,
struct PP_Ext_EventListener listener);
/**
* Deregisters a listener.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
* @param[in] listener_id The ID returned by <code>AddListener()</code>.
*/
void (*RemoveListener)(PP_Instance instance, uint32_t listener_id);
};
typedef struct PPB_Ext_Events_Dev_0_1 PPB_Ext_Events_Dev;
/**
* @}
*/
/**
* Creates a <code>PP_Ext_EventListener</code> struct.
*
* Usually you should not call it directly. Instead you should call those
* functions that return a <code>PP_Ext_EventListener</code> struct for a
* specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
*/
PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
const char* event_name,
PP_Ext_GenericFuncType func,
void* user_data) {
struct PP_Ext_EventListener listener;
listener.event_name = event_name;
listener.func = func;
listener.user_data = user_data;
return listener;
}
#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_ */
|
/**************************************************************************
*
* Copyright 2009, VMware, Inc.
* All Rights Reserved.
* Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "pipe/p_compiler.h"
#include "util/u_memory.h"
#include "dri_sw_winsys.h"
#include "target-helpers/inline_debug_helper.h"
#include "target-helpers/inline_sw_helper.h"
struct pipe_screen *
drisw_create_screen(struct drisw_loader_funcs *lf)
{
struct sw_winsys *winsys = NULL;
struct pipe_screen *screen = NULL;
winsys = dri_create_sw_winsys(lf);
if (winsys == NULL)
return NULL;
screen = sw_screen_create(winsys);
if (!screen)
goto fail;
screen = debug_screen_wrap(screen);
return screen;
fail:
if (winsys)
winsys->destroy(winsys);
return NULL;
}
/* vim: set sw=3 ts=8 sts=3 expandtab: */
|
#ifndef _XFRM_HASH_H
#define _XFRM_HASH_H
#include <linux/xfrm.h>
#include <linux/socket.h>
static inline unsigned int __xfrm4_addr_hash(const xfrm_address_t *addr)
{
return ntohl(addr->a4);
}
static inline unsigned int __xfrm6_addr_hash(const xfrm_address_t *addr)
{
return ntohl(addr->a6[2] ^ addr->a6[3]);
}
static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr)
{
u32 sum = (__force u32)daddr->a4 + (__force u32)saddr->a4;
return ntohl((__force __be32)sum);
}
static inline unsigned int __xfrm6_daddr_saddr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr)
{
return ntohl(daddr->a6[2] ^ daddr->a6[3] ^
saddr->a6[2] ^ saddr->a6[3]);
}
static inline unsigned int __xfrm_dst_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
u32 reqid, unsigned short family,
unsigned int hmask)
{
unsigned int h = family ^ reqid;
switch (family) {
case AF_INET:
h ^= __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
h ^= __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
return (h ^ (h >> 16)) & hmask;
}
static inline unsigned int __xfrm_src_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family,
unsigned int hmask)
{
unsigned int h = family;
switch (family) {
case AF_INET:
h ^= __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
h ^= __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
return (h ^ (h >> 16)) & hmask;
}
static inline unsigned int
__xfrm_spi_hash(const xfrm_address_t *daddr, __be32 spi, u8 proto,
unsigned short family, unsigned int hmask)
{
unsigned int h = (__force u32)spi ^ proto;
switch (family) {
case AF_INET:
h ^= __xfrm4_addr_hash(daddr);
break;
case AF_INET6:
h ^= __xfrm6_addr_hash(daddr);
break;
}
return (h ^ (h >> 10) ^ (h >> 20)) & hmask;
}
static inline unsigned int __idx_hash(u32 index, unsigned int hmask)
{
return (index ^ (index >> 8)) & hmask;
}
static inline unsigned int __sel_hash(const struct xfrm_selector *sel,
unsigned short family, unsigned int hmask)
{
const xfrm_address_t *daddr = &sel->daddr;
const xfrm_address_t *saddr = &sel->saddr;
unsigned int h = 0;
switch (family) {
case AF_INET:
if (sel->prefixlen_d != 32 ||
sel->prefixlen_s != 32)
return hmask + 1;
h = __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
if (sel->prefixlen_d != 128 ||
sel->prefixlen_s != 128)
return hmask + 1;
h = __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
h ^= (h >> 16);
return h & hmask;
}
static inline unsigned int __addr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family, unsigned int hmask)
{
unsigned int h = 0;
switch (family) {
case AF_INET:
h = __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
h = __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
h ^= (h >> 16);
return h & hmask;
}
extern struct hlist_head *xfrm_hash_alloc(unsigned int sz);
extern void xfrm_hash_free(struct hlist_head *n, unsigned int sz);
#endif /* _XFRM_HASH_H */
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_PARISC_UNISTD_H_
#define _ASM_PARISC_UNISTD_H_
#include <uapi/asm/unistd.h>
#define __NR_Linux_syscalls __NR_syscalls
#ifndef __ASSEMBLY__
#define SYS_ify(syscall_name) __NR_##syscall_name
#define __IGNORE_fadvise64 /* fadvise64_64 */
#ifndef ASM_LINE_SEP
# define ASM_LINE_SEP ;
#endif
/* Definition taken from glibc 2.3.3
* sysdeps/unix/sysv/linux/hppa/sysdep.h
*/
#ifdef PIC
/* WARNING: CANNOT BE USED IN A NOP! */
# define K_STW_ASM_PIC " copy %%r19, %%r4\n"
# define K_LDW_ASM_PIC " copy %%r4, %%r19\n"
# define K_USING_GR4 "%r4",
#else
# define K_STW_ASM_PIC " \n"
# define K_LDW_ASM_PIC " \n"
# define K_USING_GR4
#endif
/* GCC has to be warned that a syscall may clobber all the ABI
registers listed as "caller-saves", see page 8, Table 2
in section 2.2.6 of the PA-RISC RUN-TIME architecture
document. However! r28 is the result and will conflict with
the clobber list so it is left out. Also the input arguments
registers r20 -> r26 will conflict with the list so they
are treated specially. Although r19 is clobbered by the syscall
we cannot say this because it would violate ABI, thus we say
r4 is clobbered and use that register to save/restore r19
across the syscall. */
#define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \
"%r20", "%r29", "%r31"
#undef K_INLINE_SYSCALL
#define K_INLINE_SYSCALL(name, nr, args...) ({ \
long __sys_res; \
{ \
register unsigned long __res __asm__("r28"); \
K_LOAD_ARGS_##nr(args) \
/* FIXME: HACK stw/ldw r19 around syscall */ \
__asm__ volatile( \
K_STW_ASM_PIC \
" ble 0x100(%%sr2, %%r0)\n" \
" ldi %1, %%r20\n" \
K_LDW_ASM_PIC \
: "=r" (__res) \
: "i" (SYS_ify(name)) K_ASM_ARGS_##nr \
: "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \
); \
__sys_res = (long)__res; \
} \
if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){ \
errno = -__sys_res; \
__sys_res = -1; \
} \
__sys_res; \
})
#define K_LOAD_ARGS_0()
#define K_LOAD_ARGS_1(r26) \
register unsigned long __r26 __asm__("r26") = (unsigned long)(r26); \
K_LOAD_ARGS_0()
#define K_LOAD_ARGS_2(r26,r25) \
register unsigned long __r25 __asm__("r25") = (unsigned long)(r25); \
K_LOAD_ARGS_1(r26)
#define K_LOAD_ARGS_3(r26,r25,r24) \
register unsigned long __r24 __asm__("r24") = (unsigned long)(r24); \
K_LOAD_ARGS_2(r26,r25)
#define K_LOAD_ARGS_4(r26,r25,r24,r23) \
register unsigned long __r23 __asm__("r23") = (unsigned long)(r23); \
K_LOAD_ARGS_3(r26,r25,r24)
#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22) \
register unsigned long __r22 __asm__("r22") = (unsigned long)(r22); \
K_LOAD_ARGS_4(r26,r25,r24,r23)
#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \
register unsigned long __r21 __asm__("r21") = (unsigned long)(r21); \
K_LOAD_ARGS_5(r26,r25,r24,r23,r22)
/* Even with zero args we use r20 for the syscall number */
#define K_ASM_ARGS_0
#define K_ASM_ARGS_1 K_ASM_ARGS_0, "r" (__r26)
#define K_ASM_ARGS_2 K_ASM_ARGS_1, "r" (__r25)
#define K_ASM_ARGS_3 K_ASM_ARGS_2, "r" (__r24)
#define K_ASM_ARGS_4 K_ASM_ARGS_3, "r" (__r23)
#define K_ASM_ARGS_5 K_ASM_ARGS_4, "r" (__r22)
#define K_ASM_ARGS_6 K_ASM_ARGS_5, "r" (__r21)
/* The registers not listed as inputs but clobbered */
#define K_CLOB_ARGS_6
#define K_CLOB_ARGS_5 K_CLOB_ARGS_6, "%r21"
#define K_CLOB_ARGS_4 K_CLOB_ARGS_5, "%r22"
#define K_CLOB_ARGS_3 K_CLOB_ARGS_4, "%r23"
#define K_CLOB_ARGS_2 K_CLOB_ARGS_3, "%r24"
#define K_CLOB_ARGS_1 K_CLOB_ARGS_2, "%r25"
#define K_CLOB_ARGS_0 K_CLOB_ARGS_1, "%r26"
#define _syscall0(type,name) \
type name(void) \
{ \
return K_INLINE_SYSCALL(name, 0); \
}
#define _syscall1(type,name,type1,arg1) \
type name(type1 arg1) \
{ \
return K_INLINE_SYSCALL(name, 1, arg1); \
}
#define _syscall2(type,name,type1,arg1,type2,arg2) \
type name(type1 arg1, type2 arg2) \
{ \
return K_INLINE_SYSCALL(name, 2, arg1, arg2); \
}
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
type name(type1 arg1, type2 arg2, type3 arg3) \
{ \
return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \
}
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
{ \
return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \
}
/* select takes 5 arguments */
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
{ \
return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \
}
#define __ARCH_WANT_NEW_STAT
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SYS_ALARM
#define __ARCH_WANT_SYS_GETHOSTNAME
#define __ARCH_WANT_SYS_PAUSE
#define __ARCH_WANT_SYS_SIGNAL
#define __ARCH_WANT_SYS_TIME32
#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
#define __ARCH_WANT_SYS_UTIME32
#define __ARCH_WANT_SYS_WAITPID
#define __ARCH_WANT_SYS_SOCKETCALL
#define __ARCH_WANT_SYS_FADVISE64
#define __ARCH_WANT_SYS_GETPGRP
#define __ARCH_WANT_SYS_NICE
#define __ARCH_WANT_SYS_OLDUMOUNT
#define __ARCH_WANT_SYS_SIGPENDING
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
#define __ARCH_WANT_SYS_CLONE3
#define __ARCH_WANT_COMPAT_SYS_SENDFILE
#ifdef CONFIG_64BIT
#define __ARCH_WANT_SYS_TIME
#define __ARCH_WANT_SYS_UTIME
#endif
#endif /* __ASSEMBLY__ */
#undef STR
#endif /* _ASM_PARISC_UNISTD_H_ */
|
/*
* jsflash.h: OS Flash SIMM support for JavaStations.
*
* Copyright (C) 1999 Pete Zaitcev
*/
#ifndef _SPARC_JSFLASH_H
#define _SPARC_JSFLASH_H
#ifndef _SPARC_TYPES_H
#include <linux/types.h>
#endif
/*
* Semantics of the offset is a full address.
* Hardcode it or get it from probe ioctl.
*
* We use full bus address, so that we would be
* automatically compatible with possible future systems.
*/
#define JSFLASH_IDENT (('F'<<8)|54)
struct jsflash_ident_arg {
__u64 off; /* 0x20000000 is included */
__u32 size;
char name[32]; /* With trailing zero */
};
#define JSFLASH_ERASE (('F'<<8)|55)
/* Put 0 as argument, may be flags or sector number... */
#define JSFLASH_PROGRAM (('F'<<8)|56)
struct jsflash_program_arg {
__u64 data; /* char* for sparc and sparc64 */
__u64 off;
__u32 size;
};
#endif /* _SPARC_JSFLASH_H */
|
#ifndef ASYNC_DNS_MEMPOOL_H
#define ASYNC_DNS_MEMPOOL_H
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#undef free
#undef calloc
#undef strdup
class AsyncDNSMemPool
{
private:
struct PoolChunk {
void * pool;
size_t pos;
size_t size;
PoolChunk(size_t _size);
~PoolChunk();
};
PoolChunk ** chunks;
size_t chunksCount;
size_t defaultSize;
size_t poolUsage;
size_t poolUsageCounter;
void addNewChunk(size_t size);
public:
AsyncDNSMemPool(size_t _defaultSize = 4096);
virtual ~AsyncDNSMemPool();
int initialize();
void free();
void * alloc(size_t size);
void * calloc(size_t size);
char * strdup(const char *str);
};
#endif
|
#pragma once
#include "quantum.h"
/* Clueboard matrix layout
* ,-----------------------------------------------------------. ,---.
* | 00| 01| 02| 03| 04| 05| 06| 07| 50| 51| 52| 53| 54| 56 | | 57|
* |-----------------------------------------------------------| |---|
* | 10| 11| 12| 13| 14| 15| 16| 17| 60| 61| 62| 63| 64| 65| | 67|
* |-----------------------------------------------------------| `---'
* | 20| 21| 22| 23| 24| 25| 26| 27| 70| 71| 72| 73| 74| 75|
* |------------------------------------------------------------.
* | 30| 31| 32| 33| 34| 35| 36| 37| 80| 81| 82| 83| 84| 85|86|
* |------------------------------------------------------------------.
* | 40| 41| 42| 43| 45| 46| 90| 92| 93| 94| 95| 96| 97|
* `------------------------------------------------------------------'
* ,-----------------------------------------------------------. ,---.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|
* |-----------------------------------------------------------| |---|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|
* |-----------------------------------------------------------| `---'
* |Caps | A| S| D| F| G| H| J| k| L| ;| '|Enter |
* |--------------------------------------------------------------.
* |Shift| \| Z| X| C| V| B| N| M| ,| .| /| \|Shift| Up|
* |------------------------------------------------------------------.
* |Ctrl|Alt|Gui | Space| Space|Gui |Alt |Fn |Ctrl|Left|Down|Rgt|
* `------------------------------------------------------------------'
*/
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define LAYOUT_all( \
k00, k01, k02, k03, k04, k05, k06, k07, k50, k51, k52, k53, k54, k56, k57, \
k10, k11, k12, k13, k14, k15, k16, k17, k60, k61, k62, k63, k64, k65, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k70, k71, k72, k73, k75, \
k30, k31, k32, k33, k34, k35, k36, k37, k80, k81, k82, k83, k84, k85, k86, \
k40, k41, k42, k45, k46, k90, k92, k93, k94, k95, k96, k97 \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07 }, \
{ k10, k11, k12, k13, k14, k15, k16, k17 }, \
{ k20, k21, k22, k23, k24, k25, k26, k27 }, \
{ k30, k31, k32, k33, k34, k35, k36, k37 }, \
{ k40, k41, k42, KC_NO, KC_NO, k45, k46, KC_NO }, \
{ k50, k51, k52, k53, k54, KC_NO, k56, k57 }, \
{ k60, k61, k62, k63, k64, k65, KC_NO, k67 }, \
{ k70, k71, k72, k73, KC_NO, k75, KC_NO, KC_NO }, \
{ k80, k81, k82, k83, k84, k85, k86, KC_NO }, \
{ k90, KC_NO, k92, k93, k94, k95, k96, k97 } \
}
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, k06, k07, k50, k51, k52, k53, k54, k56, k57, \
k10, k11, k12, k13, k14, k15, k16, k17, k60, k61, k62, k63, k64, k65, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k70, k71, k72, k73, k75, \
k30, k32, k33, k34, k35, k36, k37, k80, k81, k82, k83, k85, k86, \
k40, k41, k42, k45, k46, k90, k92, k93, k94, k95, k96, k97 \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07 }, \
{ k10, k11, k12, k13, k14, k15, k16, k17 }, \
{ k20, k21, k22, k23, k24, k25, k26, k27 }, \
{ k30, KC_NO, k32, k33, k34, k35, k36, k37 }, \
{ k40, k41, k42, KC_NO, KC_NO, k45, k46, KC_NO }, \
{ k50, k51, k52, k53, k54, KC_NO, k56, k57 }, \
{ k60, k61, k62, k63, k64, k65, KC_NO, k67 }, \
{ k70, k71, k72, k73, KC_NO, k75, KC_NO, KC_NO }, \
{ k80, k81, k82, k83, KC_NO, k85, k86, KC_NO }, \
{ k90, KC_NO, k92, k93, k94, k95, k96, k97 } \
}
#define LAYOUT_66_ansi( \
k00, k01, k02, k03, k04, k05, k06, k07, k50, k51, k52, k53, k54, k56, k57, \
k10, k11, k12, k13, k14, k15, k16, k17, k60, k61, k62, k63, k64, k65, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k70, k71, k72, k73, k75, \
k30, k32, k33, k34, k35, k36, k37, k80, k81, k82, k83, k85, k86, \
k40, k41, k42, k46, k92, k93, k94, k95, k96, k97 \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07 }, \
{ k10, k11, k12, k13, k14, k15, k16, k17 }, \
{ k20, k21, k22, k23, k24, k25, k26, k27 }, \
{ k30, KC_NO, k32, k33, k34, k35, k36, k37 }, \
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO }, \
{ k50, k51, k52, k53, k54, KC_NO, k56, k57 }, \
{ k60, k61, k62, k63, k64, k65, KC_NO, k67 }, \
{ k70, k71, k72, k73, KC_NO, k75, KC_NO, KC_NO }, \
{ k80, k81, k82, k83, KC_NO, k85, k86, KC_NO }, \
{ KC_NO, KC_NO, k92, k93, k94, k95, k96, k97 } \
}
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __MARTIAN_RESOURCES_H__
#define __MARTIAN_RESOURCES_H__
#include "common/scummsys.h"
namespace Martian {
#define MARTIAN_NUM_CURSORS 4
extern const byte *const CURSORS[MARTIAN_NUM_CURSORS];
extern const uint CURSOR_SIZES[MARTIAN_NUM_CURSORS];
extern const char *const ROOM_DESCR[48];
extern const char *const DEATH_TEXT_ENG[20];
extern const byte DEATH_SCREENS_ENG[20];
extern const char *const INVENTORY_NAMES_ENG[55];
extern const int COMBO_TABLE[85][4];
extern const char *const NO_HELP_MESSAGE_ENG;
extern const char *const NO_HINTS_MESSAGE_ENG;
extern const char *const RIVER_HIT1_ENG;
extern const char *const RIVER_HIT2_ENG;
extern const char *const BAR_MESSAGE_ENG;
extern const char *const HELPLVLTXT_ENG[3];
extern const char *const IQLABELS_ENG[9];
extern const char *const CANT_GET_THERE_ENG;
} // End of namespace Amazon
#endif
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* Based on powerpc version
*/
#ifndef __ASM_MICROBLAZE_PCI_H
#define __ASM_MICROBLAZE_PCI_H
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <linux/scatterlist.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
/* Values for the `which' argument to sys_pciconfig_iobase syscall. */
#define IOBASE_BRIDGE_NUMBER 0
#define IOBASE_MEMORY 1
#define IOBASE_IO 2
#define IOBASE_ISA_IO 3
#define IOBASE_ISA_MEM 4
#define pcibios_scan_all_fns(a, b) 0
/*
* Set this to 1 if you want the kernel to re-assign all PCI
* bus numbers (don't do that on ppc64 yet !)
*/
#define pcibios_assign_all_busses() 0
extern int pci_domain_nr(struct pci_bus *bus);
/* Decide whether to display the domain number in /proc */
extern int pci_proc_domain(struct pci_bus *bus);
struct vm_area_struct;
/* Tell PCI code what kind of PCI resource mappings we support */
#define HAVE_PCI_MMAP 1
#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
#define arch_can_pci_mmap_io() 1
extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
size_t count);
extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
size_t count);
extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
struct vm_area_struct *vma,
enum pci_mmap_state mmap_state);
#define HAVE_PCI_LEGACY 1
extern void pcibios_resource_survey(void);
struct file;
extern pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long pfn,
unsigned long size,
pgprot_t prot);
#define HAVE_ARCH_PCI_RESOURCE_TO_USER
/* This part of code was originally in xilinx-pci.h */
#ifdef CONFIG_PCI_XILINX
extern void __init xilinx_pci_init(void);
#else
static inline void __init xilinx_pci_init(void) { return; }
#endif
#endif /* __KERNEL__ */
#endif /* __ASM_MICROBLAZE_PCI_H */
|
/* ****************************************************************************** *\
INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or nondisclosure
agreement with Intel Corporation and may not be copied or disclosed except in
accordance with the terms of that agreement
Copyright(c) 2011 - 2012 Intel Corporation. All Rights Reserved.
\* ****************************************************************************** */
#pragma once
#include "sample_defs.h" // defines MFX_D3D11_SUPPORT
#if MFX_D3D11_SUPPORT
#include "hw_device.h"
#include <windows.h>
#include <d3d11.h>
#include "../../ComPtr.hpp"
#include <dxgi1_2.h>
class CD3D11Device: public CHWDevice
{
public:
CD3D11Device();
virtual ~CD3D11Device();
virtual mfxStatus Init(
mfxHDL hWindow,
mfxU16 nViews,
mfxU32 nAdapterNum);
virtual mfxStatus Reset();
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl);
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl);
virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc);
virtual void Close();
protected:
virtual mfxStatus FillSCD(mfxHDL hWindow, DXGI_SWAP_CHAIN_DESC& scd);
mfxStatus CreateVideoProcessor(mfxFrameSurface1 * pSrf);
ComPtr<ID3D11Device> m_pD3D11Device;
ComPtr<ID3D11DeviceContext> m_pD3D11Ctx;
ComPtr<ID3D11VideoDevice> m_pDX11VideoDevice; //QI
ComPtr<ID3D11VideoContext> m_pVideoContext; //QI
ComPtr<ID3D11VideoProcessorEnumerator> m_VideoProcessorEnum;
ComPtr<IDXGIDevice1> m_pDXGIDev;
ComPtr<IDXGIAdapter> m_pAdapter;
ComPtr<IDXGIFactory2> m_pDXGIFactory;
ComPtr<IDXGISwapChain1> m_pSwapChain;
ComPtr<ID3D11VideoProcessor> m_pVideoProcessor;
private:
ComPtr<ID3D11VideoProcessorInputView> m_pInputViewLeft;
ComPtr<ID3D11VideoProcessorInputView> m_pInputViewRight;
ComPtr<ID3D11VideoProcessorOutputView> m_pOutputView;
ComPtr<ID3D11Texture2D> m_pDXGIBackBuffer;
ComPtr<ID3D11Texture2D> m_pTempTexture;
ComPtr<IDXGIDisplayControl> m_pDisplayControl;
ComPtr<IDXGIOutput> m_pDXGIOutput;
mfxU16 m_nViews;
BOOL m_bDefaultStereoEnabled;
};
#endif //#if MFX_D3D11_SUPPORT
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PointerProperties_h
#define PointerProperties_h
namespace blink {
// Bit field values indicating available pointer types.
enum PointerType {
PointerTypeNone = 1 << 0,
PointerTypeCoarse = 1 << 1,
PointerTypeFine = 1 << 2
};
// Bit field values indicating available hover types.
enum HoverType {
HoverTypeNone = 1 << 0,
// Indicates that the primary pointing system can hover, but it requires
// a significant action on the user's part. e.g. hover on "long press".
HoverTypeOnDemand = 1 << 1,
HoverTypeHover = 1 << 2
};
}
#endif
|
/*
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
* 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.
*
* 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 __HDMI_CONNECTOR_H__
#define __HDMI_CONNECTOR_H__
#include <linux/i2c.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/hdmi.h>
#include "msm_drv.h"
#include "hdmi.xml.h"
struct hdmi_phy;
struct hdmi_platform_config;
struct hdmi_audio {
bool enabled;
struct hdmi_audio_infoframe infoframe;
int rate;
};
struct hdmi {
struct drm_device *dev;
struct platform_device *pdev;
const struct hdmi_platform_config *config;
/* audio state: */
struct hdmi_audio audio;
/* video state: */
bool power_on;
unsigned long int pixclock;
void __iomem *mmio;
struct regulator **hpd_regs;
struct regulator **pwr_regs;
struct clk **hpd_clks;
struct clk **pwr_clks;
struct hdmi_phy *phy;
struct i2c_adapter *i2c;
struct drm_connector *connector;
struct drm_bridge *bridge;
/* the encoder we are hooked to (outside of hdmi block) */
struct drm_encoder *encoder;
bool hdmi_mode; /* are we in hdmi mode? */
int irq;
};
/* platform config data (ie. from DT, or pdata) */
struct hdmi_platform_config {
struct hdmi_phy *(*phy_init)(struct hdmi *hdmi);
const char *mmio_name;
/* regulators that need to be on for hpd: */
const char **hpd_reg_names;
int hpd_reg_cnt;
/* regulators that need to be on for screen pwr: */
const char **pwr_reg_names;
int pwr_reg_cnt;
/* clks that need to be on for hpd: */
const char **hpd_clk_names;
const long unsigned *hpd_freq;
int hpd_clk_cnt;
/* clks that need to be on for screen pwr (ie pixel clk): */
const char **pwr_clk_names;
int pwr_clk_cnt;
/* gpio's: */
int ddc_clk_gpio, ddc_data_gpio, hpd_gpio, mux_en_gpio, mux_sel_gpio;
int mux_lpm_gpio;
};
void hdmi_set_mode(struct hdmi *hdmi, bool power_on);
static inline void hdmi_write(struct hdmi *hdmi, u32 reg, u32 data)
{
msm_writel(data, hdmi->mmio + reg);
}
static inline u32 hdmi_read(struct hdmi *hdmi, u32 reg)
{
return msm_readl(hdmi->mmio + reg);
}
/*
* The phy appears to be different, for example between 8960 and 8x60,
* so split the phy related functions out and load the correct one at
* runtime:
*/
struct hdmi_phy_funcs {
void (*destroy)(struct hdmi_phy *phy);
void (*reset)(struct hdmi_phy *phy);
void (*powerup)(struct hdmi_phy *phy, unsigned long int pixclock);
void (*powerdown)(struct hdmi_phy *phy);
};
struct hdmi_phy {
const struct hdmi_phy_funcs *funcs;
};
struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi);
struct hdmi_phy *hdmi_phy_8x60_init(struct hdmi *hdmi);
struct hdmi_phy *hdmi_phy_8x74_init(struct hdmi *hdmi);
/*
* audio:
*/
int hdmi_audio_update(struct hdmi *hdmi);
int hdmi_audio_info_setup(struct hdmi *hdmi, bool enabled,
uint32_t num_of_channels, uint32_t channel_allocation,
uint32_t level_shift, bool down_mix);
void hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate);
/*
* hdmi bridge:
*/
struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi);
void hdmi_bridge_destroy(struct drm_bridge *bridge);
/*
* hdmi connector:
*/
void hdmi_connector_irq(struct drm_connector *connector);
struct drm_connector *hdmi_connector_init(struct hdmi *hdmi);
/*
* i2c adapter for ddc:
*/
void hdmi_i2c_irq(struct i2c_adapter *i2c);
void hdmi_i2c_destroy(struct i2c_adapter *i2c);
struct i2c_adapter *hdmi_i2c_init(struct hdmi *hdmi);
#endif /* __HDMI_CONNECTOR_H__ */
|
/*
* (C) Copyright 2013
* David Feng <fenghua@phytium.com.cn>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <linux/compiler.h>
int interrupt_init(void)
{
return 0;
}
void enable_interrupts(void)
{
return;
}
int disable_interrupts(void)
{
return 0;
}
void show_regs(struct pt_regs *regs)
{
int i;
printf("ELR: %lx\n", regs->elr);
printf("LR: %lx\n", regs->regs[30]);
for (i = 0; i < 29; i += 2)
printf("x%-2d: %016lx x%-2d: %016lx\n",
i, regs->regs[i], i+1, regs->regs[i+1]);
printf("\n");
}
/*
* do_bad_sync handles the impossible case in the Synchronous Abort vector.
*/
void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
{
printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_bad_irq handles the impossible case in the Irq vector.
*/
void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
{
printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_bad_fiq handles the impossible case in the Fiq vector.
*/
void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
{
printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_bad_error handles the impossible case in the Error vector.
*/
void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
{
printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_sync handles the Synchronous Abort exception.
*/
void do_sync(struct pt_regs *pt_regs, unsigned int esr)
{
printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_irq handles the Irq exception.
*/
void do_irq(struct pt_regs *pt_regs, unsigned int esr)
{
printf("\"Irq\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_fiq handles the Fiq exception.
*/
void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
{
printf("\"Fiq\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
/*
* do_error handles the Error exception.
* Errors are more likely to be processor specific,
* it is defined with weak attribute and can be redefined
* in processor specific code.
*/
void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
{
printf("\"Error\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
panic("Resetting CPU ...\n");
}
|
/*
* U-boot - traps.c Routines related to interrupts and exceptions
*
* Copyright (c) 2005 blackfin.uclinux.org
*
* This file is based on
* No original Copyright holder listed,
* Probabily original (C) Roman Zippel (assigned DJD, 1999)
*
* Copyright 2003 Metrowerks - for Blackfin
* Copyright 2000-2001 Lineo, Inc. D. Jeff Dionne <jeff@lineo.ca>
* Copyright 1999-2000 D. Jeff Dionne, <jeff@uclinux.org>
*
* (C) Copyright 2000-2004
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <linux/types.h>
#include <asm/errno.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/traps.h>
#include <asm/page.h>
#include <asm/machdep.h>
#include "cpu.h"
void init_IRQ(void)
{
blackfin_init_IRQ();
return;
}
void process_int(unsigned long vec, struct pt_regs *fp)
{
return;
}
void dump(struct pt_regs *fp)
{
printf("PC: %08lx\n", fp->pc);
printf("SEQSTAT: %08lx SP: %08lx\n", (long) fp->seqstat,
(long) fp);
printf("R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n",
fp->r0, fp->r1, fp->r2, fp->r3);
printf("R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n",
fp->r4, fp->r5, fp->r6, fp->r7);
printf("P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n",
fp->p0, fp->p1, fp->p2, fp->p3);
printf("P4: %08lx P5: %08lx FP: %08lx\n", fp->p4, fp->p5,
fp->fp);
printf("A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
fp->a0w, fp->a0x, fp->a1w, fp->a1x);
printf("\n");
}
|
/* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 TARGET_FLASH_H
#define TARGET_FLASH_H
#include "target_flash_common.h"
#define FLASH_SECTOR_SIZE (1024)
#define TARGET_AUTO_INCREMENT_PAGE_SIZE (0x400)
#endif
|
/*
* linux/drivers/video/fb_defio.c
*
* Copyright (C) 2006 Jaya Kumar
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fb.h>
#include <linux/list.h>
/* to support deferred IO */
#include <linux/rmap.h>
#include <linux/pagemap.h>
/* this is to find and return the vmalloc-ed fb pages */
static int fb_deferred_io_fault(struct vm_area_struct *vma,
struct vm_fault *vmf)
{
unsigned long offset;
struct page *page;
struct fb_info *info = vma->vm_private_data;
/* info->screen_base is virtual memory */
void *screen_base = (void __force *) info->screen_base;
offset = vmf->pgoff << PAGE_SHIFT;
if (offset >= info->fix.smem_len)
return VM_FAULT_SIGBUS;
page = vmalloc_to_page(screen_base + offset);
if (!page)
return VM_FAULT_SIGBUS;
get_page(page);
if (vma->vm_file)
page->mapping = vma->vm_file->f_mapping;
else
printk(KERN_ERR "no mapping available\n");
BUG_ON(!page->mapping);
page->index = vmf->pgoff;
vmf->page = page;
return 0;
}
int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync)
{
struct fb_info *info = file->private_data;
/* Kill off the delayed work */
cancel_rearming_delayed_work(&info->deferred_work);
/* Run it immediately */
return schedule_delayed_work(&info->deferred_work, 0);
}
EXPORT_SYMBOL_GPL(fb_deferred_io_fsync);
/* vm_ops->page_mkwrite handler */
static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
struct page *page)
{
struct fb_info *info = vma->vm_private_data;
struct fb_deferred_io *fbdefio = info->fbdefio;
struct page *cur;
/* this is a callback we get when userspace first tries to
write to the page. we schedule a workqueue. that workqueue
will eventually mkclean the touched pages and execute the
deferred framebuffer IO. then if userspace touches a page
again, we repeat the same scheme */
/* protect against the workqueue changing the page list */
mutex_lock(&fbdefio->lock);
/* we loop through the pagelist before adding in order
to keep the pagelist sorted */
list_for_each_entry(cur, &fbdefio->pagelist, lru) {
/* this check is to catch the case where a new
process could start writing to the same page
through a new pte. this new access can cause the
mkwrite even when the original ps's pte is marked
writable */
if (unlikely(cur == page))
goto page_already_added;
else if (cur->index > page->index)
break;
}
list_add_tail(&page->lru, &cur->lru);
page_already_added:
mutex_unlock(&fbdefio->lock);
/* come back after delay to process the deferred IO */
schedule_delayed_work(&info->deferred_work, fbdefio->delay);
return 0;
}
static struct vm_operations_struct fb_deferred_io_vm_ops = {
.fault = fb_deferred_io_fault,
.page_mkwrite = fb_deferred_io_mkwrite,
};
static int fb_deferred_io_set_page_dirty(struct page *page)
{
if (!PageDirty(page))
SetPageDirty(page);
return 0;
}
static const struct address_space_operations fb_deferred_io_aops = {
.set_page_dirty = fb_deferred_io_set_page_dirty,
};
static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
vma->vm_ops = &fb_deferred_io_vm_ops;
vma->vm_flags |= ( VM_IO | VM_RESERVED | VM_DONTEXPAND );
vma->vm_private_data = info;
return 0;
}
/* workqueue callback */
static void fb_deferred_io_work(struct work_struct *work)
{
struct fb_info *info = container_of(work, struct fb_info,
deferred_work.work);
struct list_head *node, *next;
struct page *cur;
struct fb_deferred_io *fbdefio = info->fbdefio;
/* here we mkclean the pages, then do all deferred IO */
mutex_lock(&fbdefio->lock);
list_for_each_entry(cur, &fbdefio->pagelist, lru) {
lock_page(cur);
page_mkclean(cur);
unlock_page(cur);
}
/* driver's callback with pagelist */
fbdefio->deferred_io(info, &fbdefio->pagelist);
/* clear the list */
list_for_each_safe(node, next, &fbdefio->pagelist) {
list_del(node);
}
mutex_unlock(&fbdefio->lock);
}
void fb_deferred_io_init(struct fb_info *info)
{
struct fb_deferred_io *fbdefio = info->fbdefio;
BUG_ON(!fbdefio);
mutex_init(&fbdefio->lock);
info->fbops->fb_mmap = fb_deferred_io_mmap;
INIT_DELAYED_WORK(&info->deferred_work, fb_deferred_io_work);
INIT_LIST_HEAD(&fbdefio->pagelist);
if (fbdefio->delay == 0) /* set a default of 1 s */
fbdefio->delay = HZ;
}
EXPORT_SYMBOL_GPL(fb_deferred_io_init);
void fb_deferred_io_open(struct fb_info *info,
struct inode *inode,
struct file *file)
{
file->f_mapping->a_ops = &fb_deferred_io_aops;
}
EXPORT_SYMBOL_GPL(fb_deferred_io_open);
void fb_deferred_io_cleanup(struct fb_info *info)
{
void *screen_base = (void __force *) info->screen_base;
struct fb_deferred_io *fbdefio = info->fbdefio;
struct page *page;
int i;
BUG_ON(!fbdefio);
cancel_delayed_work(&info->deferred_work);
flush_scheduled_work();
/* clear out the mapping that we setup */
for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
page = vmalloc_to_page(screen_base + i);
page->mapping = NULL;
}
}
EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
MODULE_LICENSE("GPL");
|
// defstd.h -- define standard symbols for gold -*- C++ -*-
// Copyright (C) 2006-2014 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// 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 GOLD_DEFSTD_H
#define GOLD_DEFSTD_H
#include "symtab.h"
namespace gold
{
extern void
define_standard_symbols(Symbol_table*, const Layout*);
} // End namespace gold.
#endif // !defined(GOLD_DEFSTD_H)
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ACPI_BATTERY_H
#define __ACPI_BATTERY_H
#define ACPI_BATTERY_CLASS "battery"
#define ACPI_BATTERY_NOTIFY_STATUS 0x80
#define ACPI_BATTERY_NOTIFY_INFO 0x81
#define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82
struct acpi_battery_hook {
const char *name;
int (*add_battery)(struct power_supply *battery);
int (*remove_battery)(struct power_supply *battery);
struct list_head list;
};
void battery_hook_register(struct acpi_battery_hook *hook);
void battery_hook_unregister(struct acpi_battery_hook *hook);
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Common LSM logging functions
* Heavily borrowed from selinux/avc.h
*
* Author : Etienne BASSET <etienne.basset@ensta.org>
*
* All credits to : Stephen Smalley, <sds@tycho.nsa.gov>
* All BUGS to : Etienne BASSET <etienne.basset@ensta.org>
*/
#ifndef _LSM_COMMON_LOGGING_
#define _LSM_COMMON_LOGGING_
#include <linux/stddef.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/kdev_t.h>
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/audit.h>
#include <linux/in6.h>
#include <linux/path.h>
#include <linux/key.h>
#include <linux/skbuff.h>
#include <rdma/ib_verbs.h>
struct lsm_network_audit {
int netif;
struct sock *sk;
u16 family;
__be16 dport;
__be16 sport;
union {
struct {
__be32 daddr;
__be32 saddr;
} v4;
struct {
struct in6_addr daddr;
struct in6_addr saddr;
} v6;
} fam;
};
struct lsm_ioctlop_audit {
struct path path;
u16 cmd;
};
struct lsm_ibpkey_audit {
u64 subnet_prefix;
u16 pkey;
};
struct lsm_ibendport_audit {
char dev_name[IB_DEVICE_NAME_MAX];
u8 port;
};
/* Auxiliary data to use in generating the audit record. */
struct common_audit_data {
char type;
#define LSM_AUDIT_DATA_PATH 1
#define LSM_AUDIT_DATA_NET 2
#define LSM_AUDIT_DATA_CAP 3
#define LSM_AUDIT_DATA_IPC 4
#define LSM_AUDIT_DATA_TASK 5
#define LSM_AUDIT_DATA_KEY 6
#define LSM_AUDIT_DATA_NONE 7
#define LSM_AUDIT_DATA_KMOD 8
#define LSM_AUDIT_DATA_INODE 9
#define LSM_AUDIT_DATA_DENTRY 10
#define LSM_AUDIT_DATA_IOCTL_OP 11
#define LSM_AUDIT_DATA_FILE 12
#define LSM_AUDIT_DATA_IBPKEY 13
#define LSM_AUDIT_DATA_IBENDPORT 14
#define LSM_AUDIT_DATA_LOCKDOWN 15
union {
struct path path;
struct dentry *dentry;
struct inode *inode;
struct lsm_network_audit *net;
int cap;
int ipc_id;
struct task_struct *tsk;
#ifdef CONFIG_KEYS
struct {
key_serial_t key;
char *key_desc;
} key_struct;
#endif
char *kmod_name;
struct lsm_ioctlop_audit *op;
struct file *file;
struct lsm_ibpkey_audit *ibpkey;
struct lsm_ibendport_audit *ibendport;
int reason;
} u;
/* this union contains LSM specific data */
union {
#ifdef CONFIG_SECURITY_SMACK
struct smack_audit_data *smack_audit_data;
#endif
#ifdef CONFIG_SECURITY_SELINUX
struct selinux_audit_data *selinux_audit_data;
#endif
#ifdef CONFIG_SECURITY_APPARMOR
struct apparmor_audit_data *apparmor_audit_data;
#endif
}; /* per LSM data pointer union */
};
#define v4info fam.v4
#define v6info fam.v6
int ipv4_skb_to_auditdata(struct sk_buff *skb,
struct common_audit_data *ad, u8 *proto);
int ipv6_skb_to_auditdata(struct sk_buff *skb,
struct common_audit_data *ad, u8 *proto);
void common_lsm_audit(struct common_audit_data *a,
void (*pre_audit)(struct audit_buffer *, void *),
void (*post_audit)(struct audit_buffer *, void *));
#endif
|
/* $Id: tif_codec.c,v 1.17 2015-08-19 02:31:04 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library
*
* Builtin Compression Scheme Configuration Support.
*/
#include "tiffiop.h"
static int NotConfigured(TIFF*, int);
#ifndef LZW_SUPPORT
#define TIFFInitLZW NotConfigured
#endif
#ifndef PACKBITS_SUPPORT
#define TIFFInitPackBits NotConfigured
#endif
#ifndef THUNDER_SUPPORT
#define TIFFInitThunderScan NotConfigured
#endif
#ifndef NEXT_SUPPORT
#define TIFFInitNeXT NotConfigured
#endif
#ifndef JPEG_SUPPORT
#define TIFFInitJPEG NotConfigured
#endif
#ifndef OJPEG_SUPPORT
#define TIFFInitOJPEG NotConfigured
#endif
#ifndef CCITT_SUPPORT
#define TIFFInitCCITTRLE NotConfigured
#define TIFFInitCCITTRLEW NotConfigured
#define TIFFInitCCITTFax3 NotConfigured
#define TIFFInitCCITTFax4 NotConfigured
#endif
#ifndef JBIG_SUPPORT
#define TIFFInitJBIG NotConfigured
#endif
#ifndef ZIP_SUPPORT
#define TIFFInitZIP NotConfigured
#endif
#ifndef PIXARLOG_SUPPORT
#define TIFFInitPixarLog NotConfigured
#endif
#ifndef LOGLUV_SUPPORT
#define TIFFInitSGILog NotConfigured
#endif
#ifndef LZMA_SUPPORT
#define TIFFInitLZMA NotConfigured
#endif
/*
* Compression schemes statically built into the library.
*/
#ifdef VMS
const TIFFCodec _TIFFBuiltinCODECS[] = {
#else
TIFFCodec _TIFFBuiltinCODECS[] = {
#endif
{ "None", COMPRESSION_NONE, TIFFInitDumpMode },
{ "LZW", COMPRESSION_LZW, TIFFInitLZW },
{ "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
{ "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
{ "NeXT", COMPRESSION_NEXT, TIFFInitNeXT },
{ "JPEG", COMPRESSION_JPEG, TIFFInitJPEG },
{ "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG },
{ "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
{ "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
{ "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
{ "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
{ "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG },
{ "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
{ "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP },
{ "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog },
{ "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
{ "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
{ "LZMA", COMPRESSION_LZMA, TIFFInitLZMA },
{ NULL, 0, NULL }
};
static int
_notConfigured(TIFF* tif)
{
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
char compression_code[20];
sprintf(compression_code, "%d",tif->tif_dir.td_compression );
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%s compression support is not configured",
c ? c->name : compression_code );
return (0);
}
static int
NotConfigured(TIFF* tif, int scheme)
{
(void) scheme;
tif->tif_fixuptags = _notConfigured;
tif->tif_decodestatus = FALSE;
tif->tif_setupdecode = _notConfigured;
tif->tif_encodestatus = FALSE;
tif->tif_setupencode = _notConfigured;
return (1);
}
/************************************************************************/
/* TIFFIsCODECConfigured() */
/************************************************************************/
/**
* Check whether we have working codec for the specific coding scheme.
*
* @return returns 1 if the codec is configured and working. Otherwise
* 0 will be returned.
*/
int
TIFFIsCODECConfigured(uint16 scheme)
{
const TIFFCodec* codec = TIFFFindCODEC(scheme);
if(codec == NULL) {
return 0;
}
if(codec->init == NULL) {
return 0;
}
if(codec->init != NotConfigured){
return 1;
}
return 0;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_SERVER_LOG_ENTRY_HOST_H_
#define REMOTING_HOST_SERVER_LOG_ENTRY_HOST_H_
#include "remoting/protocol/transport.h"
namespace remoting {
class ServerLogEntry;
// Constructs a log entry for a session state change.
// Currently this is either connection or disconnection.
scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
bool connected);
// Constructs a log entry for a heartbeat.
scoped_ptr<ServerLogEntry> MakeLogEntryForHeartbeat();
// Adds fields describing the host to this log entry.
void AddHostFieldsToLogEntry(ServerLogEntry* entry);
// Adds a field describing connection type (direct/stun/relay).
void AddConnectionTypeToLogEntry(ServerLogEntry* entry,
protocol::TransportRoute::RouteType type);
} // namespace remoting
#endif // REMOTING_HOST_SERVER_LOG_ENTRY_HOST_H_
|
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
static void test_task_fd_query_tp_core(const char *probe_name,
const char *tp_name)
{
const char *file = "./test_tracepoint.o";
int err, bytes, efd, prog_fd, pmu_fd;
struct perf_event_attr attr = {};
__u64 probe_offset, probe_addr;
__u32 len, prog_id, fd_type;
struct bpf_object *obj = NULL;
__u32 duration = 0;
char buf[256];
err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd);
if (CHECK(err, "bpf_prog_load", "err %d errno %d\n", err, errno))
goto close_prog;
snprintf(buf, sizeof(buf),
"/sys/kernel/debug/tracing/events/%s/id", probe_name);
efd = open(buf, O_RDONLY, 0);
if (CHECK(efd < 0, "open", "err %d errno %d\n", efd, errno))
goto close_prog;
bytes = read(efd, buf, sizeof(buf));
close(efd);
if (CHECK(bytes <= 0 || bytes >= sizeof(buf), "read",
"bytes %d errno %d\n", bytes, errno))
goto close_prog;
attr.config = strtol(buf, NULL, 0);
attr.type = PERF_TYPE_TRACEPOINT;
attr.sample_type = PERF_SAMPLE_RAW;
attr.sample_period = 1;
attr.wakeup_events = 1;
pmu_fd = syscall(__NR_perf_event_open, &attr, -1 /* pid */,
0 /* cpu 0 */, -1 /* group id */,
0 /* flags */);
if (CHECK(err, "perf_event_open", "err %d errno %d\n", err, errno))
goto close_pmu;
err = ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0);
if (CHECK(err, "perf_event_ioc_enable", "err %d errno %d\n", err,
errno))
goto close_pmu;
err = ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd);
if (CHECK(err, "perf_event_ioc_set_bpf", "err %d errno %d\n", err,
errno))
goto close_pmu;
/* query (getpid(), pmu_fd) */
len = sizeof(buf);
err = bpf_task_fd_query(getpid(), pmu_fd, 0, buf, &len, &prog_id,
&fd_type, &probe_offset, &probe_addr);
if (CHECK(err < 0, "bpf_task_fd_query", "err %d errno %d\n", err,
errno))
goto close_pmu;
err = (fd_type == BPF_FD_TYPE_TRACEPOINT) && !strcmp(buf, tp_name);
if (CHECK(!err, "check_results", "fd_type %d tp_name %s\n",
fd_type, buf))
goto close_pmu;
close(pmu_fd);
goto close_prog_noerr;
close_pmu:
close(pmu_fd);
close_prog:
error_cnt++;
close_prog_noerr:
bpf_object__close(obj);
}
void test_task_fd_query_tp(void)
{
test_task_fd_query_tp_core("sched/sched_switch",
"sched_switch");
test_task_fd_query_tp_core("syscalls/sys_enter_read",
"sys_enter_read");
}
|
/* histogram/add.c
*
* 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.
*/
#include <config.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_histogram.h>
#include "find.c"
int
gsl_histogram_increment (gsl_histogram * h, double x)
{
int status = gsl_histogram_accumulate (h, x, 1.0);
return status;
}
int
gsl_histogram_accumulate (gsl_histogram * h, double x, double weight)
{
const size_t n = h->n;
size_t index = 0;
int status = find (h->n, h->range, x, &index);
if (status)
{
return GSL_EDOM;
}
if (index >= n)
{
GSL_ERROR ("index lies outside valid range of 0 .. n - 1",
GSL_ESANITY);
}
h->bin[index] += weight;
return GSL_SUCCESS;
}
|
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
static void test_global_data_number(struct bpf_object *obj, __u32 duration)
{
int i, err, map_fd;
uint64_t num;
map_fd = bpf_find_map(__func__, obj, "result_number");
if (map_fd < 0) {
error_cnt++;
return;
}
struct {
char *name;
uint32_t key;
uint64_t num;
} tests[] = {
{ "relocate .bss reference", 0, 0 },
{ "relocate .data reference", 1, 42 },
{ "relocate .rodata reference", 2, 24 },
{ "relocate .bss reference", 3, 0 },
{ "relocate .data reference", 4, 0xffeeff },
{ "relocate .rodata reference", 5, 0xabab },
{ "relocate .bss reference", 6, 1234 },
{ "relocate .bss reference", 7, 0 },
{ "relocate .rodata reference", 8, 0xab },
{ "relocate .rodata reference", 9, 0x1111111111111111 },
{ "relocate .rodata reference", 10, ~0 },
};
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
err = bpf_map_lookup_elem(map_fd, &tests[i].key, &num);
CHECK(err || num != tests[i].num, tests[i].name,
"err %d result %lx expected %lx\n",
err, num, tests[i].num);
}
}
static void test_global_data_string(struct bpf_object *obj, __u32 duration)
{
int i, err, map_fd;
char str[32];
map_fd = bpf_find_map(__func__, obj, "result_string");
if (map_fd < 0) {
error_cnt++;
return;
}
struct {
char *name;
uint32_t key;
char str[32];
} tests[] = {
{ "relocate .rodata reference", 0, "abcdefghijklmnopqrstuvwxyz" },
{ "relocate .data reference", 1, "abcdefghijklmnopqrstuvwxyz" },
{ "relocate .bss reference", 2, "" },
{ "relocate .data reference", 3, "abcdexghijklmnopqrstuvwxyz" },
{ "relocate .bss reference", 4, "\0\0hello" },
};
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
err = bpf_map_lookup_elem(map_fd, &tests[i].key, str);
CHECK(err || memcmp(str, tests[i].str, sizeof(str)),
tests[i].name, "err %d result \'%s\' expected \'%s\'\n",
err, str, tests[i].str);
}
}
struct foo {
__u8 a;
__u32 b;
__u64 c;
};
static void test_global_data_struct(struct bpf_object *obj, __u32 duration)
{
int i, err, map_fd;
struct foo val;
map_fd = bpf_find_map(__func__, obj, "result_struct");
if (map_fd < 0) {
error_cnt++;
return;
}
struct {
char *name;
uint32_t key;
struct foo val;
} tests[] = {
{ "relocate .rodata reference", 0, { 42, 0xfefeefef, 0x1111111111111111ULL, } },
{ "relocate .bss reference", 1, { } },
{ "relocate .rodata reference", 2, { } },
{ "relocate .data reference", 3, { 41, 0xeeeeefef, 0x2111111111111111ULL, } },
};
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
err = bpf_map_lookup_elem(map_fd, &tests[i].key, &val);
CHECK(err || memcmp(&val, &tests[i].val, sizeof(val)),
tests[i].name, "err %d result { %u, %u, %llu } expected { %u, %u, %llu }\n",
err, val.a, val.b, val.c, tests[i].val.a, tests[i].val.b, tests[i].val.c);
}
}
static void test_global_data_rdonly(struct bpf_object *obj, __u32 duration)
{
int err = -ENOMEM, map_fd, zero = 0;
struct bpf_map *map;
__u8 *buff;
map = bpf_object__find_map_by_name(obj, "test_glo.rodata");
if (!map || !bpf_map__is_internal(map)) {
error_cnt++;
return;
}
map_fd = bpf_map__fd(map);
if (map_fd < 0) {
error_cnt++;
return;
}
buff = malloc(bpf_map__def(map)->value_size);
if (buff)
err = bpf_map_update_elem(map_fd, &zero, buff, 0);
free(buff);
CHECK(!err || errno != EPERM, "test .rodata read-only map",
"err %d errno %d\n", err, errno);
}
void test_global_data(void)
{
const char *file = "./test_global_data.o";
__u32 duration = 0, retval;
struct bpf_object *obj;
int err, prog_fd;
err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd);
if (CHECK(err, "load program", "error %d loading %s\n", err, file))
return;
err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
NULL, NULL, &retval, &duration);
CHECK(err || retval, "pass global data run",
"err %d errno %d retval %d duration %d\n",
err, errno, retval, duration);
test_global_data_number(obj, duration);
test_global_data_string(obj, duration);
test_global_data_struct(obj, duration);
test_global_data_rdonly(obj, duration);
bpf_object__close(obj);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.