text stringlengths 4 6.14k |
|---|
/* machine.h. Generated automatically by configure. */
/* Any machine specific stuff goes here */
/* Add details necessary for your own installation here! */
/* This is for use with "configure" -- if you are not using configure
then use machine.van for the "vanilla" version of machine.h */
/* Note special macros: ANSI_C (ANSI C syntax)
SEGMENTED (segmented memory machine e.g. MS-DOS)
MALLOCDECL (declared if malloc() etc have
been declared) */
/* #undef const */
/* #undef MALLOCDECL */
#define NOT_SEGMENTED 1
/* #undef HAVE_COMPLEX_H */
#define HAVE_MALLOC_H 1
#define STDC_HEADERS 1
#define HAVE_BCOPY 1
#define HAVE_BZERO 1
#define CHAR0ISDBL0 1
/* #undef WORDS_BIGENDIAN */
#define U_INT_DEF 1
#define VARARGS 1
/* for basic or larger versions */
#define COMPLEX 1
#define SPARSE 1
/* for loop unrolling */
/* #undef VUNROLL */
/* #undef MUNROLL */
/* for segmented memory */
#ifndef NOT_SEGMENTED
#define SEGMENTED
#endif
/* any compiler should have this header */
/* if not, change it */
#include <stdio.h>
/* Check for ANSI C memmove and memset */
#ifdef STDC_HEADERS
/* standard copy & zero functions */
#define MEM_COPY(from,to,size) memmove((to),(from),(size))
#define MEM_ZERO(where,size) memset((where),'\0',(size))
#ifndef ANSI_C
#define ANSI_C 1
#endif
#endif
/* standard headers */
#ifdef ANSI_C
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <float.h>
#endif
/* if have bcopy & bzero and no alternatives yet known, use them */
#ifdef HAVE_BCOPY
#ifndef MEM_COPY
/* nonstandard copy function */
#define MEM_COPY(from,to,size) bcopy((char *)(from),(char *)(to),(int)(size))
#endif
#endif
#ifdef HAVE_BZERO
#ifndef MEM_ZERO
/* nonstandard zero function */
#define MEM_ZERO(where,size) bzero((char *)(where),(int)(size))
#endif
#endif
/* if the system has complex.h */
#ifdef HAVE_COMPLEX_H
#include <complex.h>
#endif
/* If prototypes are available & ANSI_C not yet defined, then define it,
but don't include any header files as the proper ANSI C headers
aren't here */
#define HAVE_PROTOTYPES 1
#ifdef HAVE_PROTOTYPES
#ifndef ANSI_C
#define ANSI_C 1
#endif
#endif
/* floating point precision */
/* you can choose single, double or long double (if available) precision */
#define FLOAT 1
#define DOUBLE 2
#define LONG_DOUBLE 3
/* #undef REAL_FLT */
/* #undef REAL_DBL */
/* if nothing is defined, choose double precision */
#ifndef REAL_DBL
#ifndef REAL_FLT
#define REAL_DBL 1
#endif
#endif
/* single precision */
#ifdef REAL_FLT
#define Real float
#define LongReal float
#define REAL FLOAT
#define LONGREAL FLOAT
#endif
/* double precision */
#ifdef REAL_DBL
#define Real double
#define LongReal double
#define REAL DOUBLE
#define LONGREAL DOUBLE
#endif
/* machine epsilon or unit roundoff error */
/* This is correct on most IEEE Real precision systems */
#ifdef DBL_EPSILON
#if REAL == DOUBLE
#define MACHEPS DBL_EPSILON
#elif REAL == FLOAT
#define MACHEPS FLT_EPSILON
#elif REAL == LONGDOUBLE
#define MACHEPS LDBL_EPSILON
#endif
#endif
#define F_MACHEPS 1.19209e-07
#define D_MACHEPS 2.22045e-16
#ifndef MACHEPS
#if REAL == DOUBLE
#define MACHEPS D_MACHEPS
#elif REAL == FLOAT
#define MACHEPS F_MACHEPS
#elif REAL == LONGDOUBLE
#define MACHEPS D_MACHEPS
#endif
#endif
/* #undef M_MACHEPS */
/********************
#ifdef DBL_EPSILON
#define MACHEPS DBL_EPSILON
#endif
#ifdef M_MACHEPS
#ifndef MACHEPS
#define MACHEPS M_MACHEPS
#endif
#endif
********************/
#define M_MAX_INT 2147483647
#ifdef M_MAX_INT
#ifndef MAX_RAND
#define MAX_RAND ((double)(M_MAX_INT))
#endif
#endif
/* for non-ANSI systems */
#ifndef HUGE_VAL
#define HUGE_VAL HUGE
#endif
#ifdef ANSI_C
//extern int isatty(int); // Needed to comment this out to get rid of compiler error (MWB)
#endif
|
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2013. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/
#ifndef UCS_PPC64_CPU_H_
#define UCS_PPC64_CPU_H_
#include <ucs/debug/log.h>
#include <ucs/sys/compiler.h>
#ifdef HAVE_SYS_PLATFORM_PPC_H
# include <sys/platform/ppc.h>
#endif
#define UCS_SYS_CACHE_LINE_SIZE 128
/* Assume the worst - weak memory ordering */
#define ucs_memory_bus_fence() asm volatile ("sync"::: "memory")
#define ucs_memory_bus_store_fence() ucs_memory_bus_fence()
#define ucs_memory_bus_load_fence() ucs_memory_bus_fence()
#define ucs_memory_cpu_fence() ucs_memory_bus_fence()
#define ucs_memory_cpu_store_fence() ucs_memory_bus_fence()
#define ucs_memory_cpu_load_fence() ucs_memory_bus_fence()
static inline uint64_t ucs_arch_read_hres_clock()
{
#ifndef HAVE_SYS_PLATFORM_PPC_H
uint64_t tb;
asm volatile ("mfspr %0, 268" : "=r" (tb));
return tb;
#else
return __ppc_get_timebase();
#endif
}
static inline ucs_cpu_model_t ucs_arch_get_cpu_model()
{
return UCS_CPU_MODEL_UNKNOWN;
}
double ucs_arch_get_clocks_per_sec();
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE272_Least_Privilege_Violation__w32_char_SHRegOpenUSKey_13.c
Label Definition File: CWE272_Least_Privilege_Violation__w32.label.xml
Template File: point-flaw-13.tmpl.c
*/
/*
* @description
* CWE: 272 Least Privilege Violation
* Sinks: SHRegOpenUSKey
* GoodSink: Open a registry key using SHRegOpenUSKeyA() and HKEY_CURRENT_USER
* BadSink : Open a registry key using SHRegOpenUSKeyA() and HKEY_LOCAL_MACHINE
* Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#include <windows.h>
#include <shlwapi.h>
#pragma comment( lib, "shlwapi" )
#ifndef OMITBAD
void CWE272_Least_Privilege_Violation__w32_char_SHRegOpenUSKey_13_bad()
{
if(GLOBAL_CONST_FIVE==5)
{
{
char * keyName = "TEST\\TestKey";
HUSKEY hKey;
/* FLAW: Call SHRegOpenUSKeyA() with HKEY_LOCAL_MACHINE (fIgnoreHKCU == TRUE) violating the least privilege principal */
if (SHRegOpenUSKeyA(
keyName,
KEY_WRITE,
NULL,
&hKey,
TRUE) != ERROR_SUCCESS)
{
printLine("Registry key could not be opened");
}
else
{
printLine("Registry key opened successfully");
SHRegCloseUSKey(hKey);
}
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(GLOBAL_CONST_FIVE!=5) instead of if(GLOBAL_CONST_FIVE==5) */
static void good1()
{
if(GLOBAL_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
char * keyName = "TEST\\TestKey";
HUSKEY hKey;
/* FIX: Call SHRegOpenUSKeyA() with HKEY_CURRENT_USER (fIgnoreHKCU == FALSE) */
if (SHRegOpenUSKeyA(
keyName,
KEY_WRITE,
NULL,
&hKey,
FALSE) != ERROR_SUCCESS)
{
printLine("Registry key could not be opened");
}
else
{
printLine("Registry key opened successfully");
SHRegCloseUSKey(hKey);
}
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(GLOBAL_CONST_FIVE==5)
{
{
char * keyName = "TEST\\TestKey";
HUSKEY hKey;
/* FIX: Call SHRegOpenUSKeyA() with HKEY_CURRENT_USER (fIgnoreHKCU == FALSE) */
if (SHRegOpenUSKeyA(
keyName,
KEY_WRITE,
NULL,
&hKey,
FALSE) != ERROR_SUCCESS)
{
printLine("Registry key could not be opened");
}
else
{
printLine("Registry key opened successfully");
SHRegCloseUSKey(hKey);
}
}
}
}
void CWE272_Least_Privilege_Violation__w32_char_SHRegOpenUSKey_13_good()
{
good1();
good2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE272_Least_Privilege_Violation__w32_char_SHRegOpenUSKey_13_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE272_Least_Privilege_Violation__w32_char_SHRegOpenUSKey_13_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
/**
* @author Kamin Whitehouse
*/
#ifndef __TESTREGISTRY_H__
#define __TESTREGISTRY_H__
typedef struct location_t{
uint16_t x;
uint16_t y;
} location_t;
#endif //__TESTREGISTRY_H__
|
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Memory mapping */
#define CONFIG_FLASH_SIZE_BYTES 0x00040000 /* 256 kB */
#define CONFIG_FLASH_BANK_SIZE 0x800 /* 2 kB */
#define CONFIG_FLASH_ERASE_SIZE 0x800 /* 2 KB */
#define CONFIG_FLASH_WRITE_SIZE 0x8 /* 64 bits */
/* Ideal write size in page-mode */
#define CONFIG_FLASH_WRITE_IDEAL_SIZE 0x100 /* 256 (32 double words) */
/*
* SRAM1 (48kB) at 0x20000000
* SRAM2 (16kB) at 0x10000000 (and aliased at 0x2000C000)
* so they are contiguous.
*/
#define CONFIG_RAM_BASE 0x20000000
#define CONFIG_RAM_SIZE 0x00010000 /* 64 kB */
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 82
/* DFU Address */
#define STM32_DFU_BASE 0x1fff0000
|
/*
* 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
*/
#ifndef AVFILTER_DRAWUTILS_H
#define AVFILTER_DRAWUTILS_H
/**
* @file
* misc drawing utilities
*/
#include <stdint.h>
#include "avfilter.h"
#include "libavutil/pixfmt.h"
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt);
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w,
uint8_t dst_color[4],
enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
int *is_packed_rgba, uint8_t rgba_map[4]);
void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
uint8_t *src[4], int pixelstep[4],
int hsub, int vsub, int x, int y, int w, int h);
void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
uint8_t *src[4], int src_linesize[4], int pixelstep[4],
int hsub, int vsub, int x, int y, int y2, int w, int h);
#define MAX_PLANES 4
typedef struct FFDrawContext {
const struct AVPixFmtDescriptor *desc;
enum AVPixelFormat format;
unsigned nb_planes;
int pixelstep[MAX_PLANES]; /*< offset between pixels */
uint8_t comp_mask[MAX_PLANES]; /*< bitmask of used non-alpha components */
uint8_t hsub[MAX_PLANES]; /*< horizontal subsampling */
uint8_t vsub[MAX_PLANES]; /*< vertical subsampling */
uint8_t hsub_max;
uint8_t vsub_max;
int full_range;
unsigned flags;
} FFDrawContext;
typedef struct FFDrawColor {
uint8_t rgba[4];
union {
uint32_t u32[4];
uint16_t u16[8];
uint8_t u8[16];
} comp[MAX_PLANES];
} FFDrawColor;
/**
* Process alpha pixel component.
*/
#define FF_DRAW_PROCESS_ALPHA 1
/**
* Init a draw context.
*
* Only a limited number of pixel formats are supported, if format is not
* supported the function will return an error.
* flags is combination of FF_DRAW_* flags.
* @return 0 for success, < 0 for error
*/
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags);
/**
* Prepare a color.
*/
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4]);
/**
* Copy a rectangle from an image to another.
*
* The coordinates must be as even as the subsampling requires.
*/
void ff_copy_rectangle2(FFDrawContext *draw,
uint8_t *dst[], int dst_linesize[],
uint8_t *src[], int src_linesize[],
int dst_x, int dst_y, int src_x, int src_y,
int w, int h);
/**
* Fill a rectangle with an uniform color.
*
* The coordinates must be as even as the subsampling requires.
* The color needs to be inited with ff_draw_color.
*/
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color,
uint8_t *dst[], int dst_linesize[],
int dst_x, int dst_y, int w, int h);
/**
* Blend a rectangle with an uniform color.
*/
void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color,
uint8_t *dst[], int dst_linesize[],
int dst_w, int dst_h,
int x0, int y0, int w, int h);
/**
* Blend an alpha mask with an uniform color.
*
* @param draw draw context
* @param color color for the overlay;
* @param dst destination image
* @param dst_linesize line stride of the destination
* @param dst_w width of the destination image
* @param dst_h height of the destination image
* @param mask mask
* @param mask_linesize line stride of the mask
* @param mask_w width of the mask
* @param mask_h height of the mask
* @param l2depth log2 of depth of the mask (0 for 1bpp, 3 for 8bpp)
* @param endianness bit order of the mask (0: MSB to the left)
* @param x0 horizontal position of the overlay
* @param y0 vertical position of the overlay
*/
void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color,
uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h,
const uint8_t *mask, int mask_linesize, int mask_w, int mask_h,
int l2depth, unsigned endianness, int x0, int y0);
/**
* Round a dimension according to subsampling.
*
* @param draw draw context
* @param sub_dir 0 for horizontal, 1 for vertical
* @param round_dir 0 nearest, -1 round down, +1 round up
* @param value value to round
* @return the rounded value
*/
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir,
int value);
/**
* Return the list of pixel formats supported by the draw functions.
*
* The flags are the same as ff_draw_init, i.e., none currently.
*/
AVFilterFormats *ff_draw_supported_pixel_formats(unsigned flags);
#endif /* AVFILTER_DRAWUTILS_H */
|
// Copyright (c)2008-2011, Preferred Infrastructure 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 Preferred Infrastructure nor the names of other
// 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 INCLUDE_GUARD_PFI_NETWORK_IOSTREAM_H_
#define INCLUDE_GUARD_PFI_NETWORK_IOSTREAM_H_
#include <streambuf>
#include <stdexcept>
#include <stdint.h>
#include "socket.h"
#include "../lang/shared_ptr.h"
namespace pfi{
namespace network{
template <class C, class T = std::char_traits<C> >
class basic_socketstreambuf : public std::basic_streambuf<C,T>{
public:
typedef C char_type;
basic_socketstreambuf()
: buf(T::eof())
, sock(){
}
~basic_socketstreambuf(){
}
bool connect(const std::string &host, uint16_t port){
pfi::lang::shared_ptr<stream_socket> sock(new stream_socket());
this->sock=
pfi::lang::shared_ptr<socket_holder>
(new socket_holder_impl<pfi::lang::shared_ptr<stream_socket> >(sock));
return sock->connect(host, port);
}
private:
class socket_holder{
public:
virtual ~socket_holder(){}
virtual stream_socket *get()=0;
};
template <class PSOCK>
class socket_holder_impl : public socket_holder{
public:
socket_holder_impl(PSOCK sock): sock(sock) {}
stream_socket *get(){ return sock.get(); }
private:
PSOCK sock;
};
public:
template <class PSOCK>
void setsock(PSOCK sock){
this->sock=pfi::lang::shared_ptr<socket_holder>(new socket_holder_impl<PSOCK>(sock));
}
bool is_connected() const{
if (!sock->get()) return false;
return sock->get()->is_connected();
}
stream_socket *socket() const{
return sock->get();
}
// virtual protected members
std::streamsize xsputn(const char_type *s, std::streamsize n){
if (!sock->get()) return 0;
int res=sock->get()->write(s, sizeof(char_type)*n);
if (res<0) return 0;
return res;
}
int overflow(int c){
if (!sock->get()) return T::eof();
char d=static_cast<char>(c);
int res=sock->get()->write(&d, sizeof(char_type));
if (res<0) return T::eof();
return res==0?T::eof():0;
}
int sync(){
int res=sock->get()->flush();
return res<0?0:-1;
}
int uflow(){
int ret=underflow();
buf=T::eof();
return ret;
}
int underflow(){
if (buf==T::eof()){
if (!sock->get()) return T::eof();
buf=sock->get()->getc();
}
return buf;
}
private:
int buf;
pfi::lang::shared_ptr<socket_holder> sock;
};
template <class C, class T = std::char_traits<C> >
class basic_socketstream : public std::basic_iostream<C,T>{
public:
basic_socketstream()
: std::basic_iostream<C,T>(){
this->init(&sockbuf);
}
basic_socketstream(const std::string &host, uint16_t port)
: std::basic_iostream<C,T>(){
this->init(&sockbuf);
connect(host, port);
}
template <class PSOCK>
basic_socketstream(PSOCK sock)
: std::basic_iostream<C,T>(){
this->init(&sockbuf);
setsock(sock);
}
~basic_socketstream(){
}
void connect(const std::string &host, uint16_t port){
if (!sockbuf.connect(host, port))
this->setstate(std::ios_base::failbit);
else
this->clear();
}
template <class PSOCK>
void setsock(PSOCK sock){
sockbuf.setsock(sock);
this->clear();
}
bool is_connected() const{
return sockbuf.is_connected();
}
stream_socket *socket() const{
return sockbuf.socket();
}
private:
basic_socketstreambuf<C,T> sockbuf;
};
typedef basic_socketstreambuf<char> socketstreambuf;
typedef basic_socketstream<char> socketstream;
} // network
} // pfi
#endif // #ifndef INCLUDE_GUARD_PFI_NETWORK_IOSTREAM_H_
|
/**
* Created by Weex.
* Copyright (c) 2016, Alibaba, Inc. All rights reserved.
*
* This source code is licensed under the Apache Licence 2.0.
* For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
*/
#import "WXScrollerProtocol.h"
#import "WXComponent.h"
#import "WXConvert.h"
@class WXTouchGestureRecognizer;
@class WXThreadSafeCounter;
/**
* The following variables and methods are used in Weex INTERNAL logic.
* @warning These variables and methods must never be called or overridden.
*/
@interface WXComponent ()
{
@package
NSString *_type;
NSMutableArray *_subcomponents;
/**
* Layout
*/
css_node_t *_cssNode;
BOOL _isLayoutDirty;
CGRect _calculatedFrame;
CGPoint _absolutePosition;
WXPositionType _positionType;
/**
* View
*/
UIColor *_backgroundColor;
WXClipType _clipToBounds;
UIView *_view;
CGFloat _opacity;
WXVisibility _visibility;
/**
* Events
*/
BOOL _appearEvent;
BOOL _disappearEvent;
UITapGestureRecognizer *_tapGesture;
NSMutableArray *_swipeGestures;
UILongPressGestureRecognizer *_longPressGesture;
UIPanGestureRecognizer *_panGesture;
BOOL _listenPanStart;
BOOL _listenPanMove;
BOOL _listenPanEnd;
WXTouchGestureRecognizer* _touchGesture;
/**
* Display
*/
CALayer *_layer;
BOOL _composite;
BOOL _compositingChild;
WXThreadSafeCounter *_displayCounter;
UIColor *_borderTopColor;
UIColor *_borderRightColor;
UIColor *_borderLeftColor;
UIColor *_borderBottomColor;
CGFloat _borderTopWidth;
CGFloat _borderRightWidth;
CGFloat _borderLeftWidth;
CGFloat _borderBottomWidth;
CGFloat _borderTopLeftRadius;
CGFloat _borderTopRightRadius;
CGFloat _borderBottomLeftRadius;
CGFloat _borderBottomRightRadius;
WXBorderStyle _borderTopStyle;
WXBorderStyle _borderRightStyle;
WXBorderStyle _borderBottomStyle;
WXBorderStyle _borderLeftStyle;
BOOL _isFixed;
BOOL _async;
BOOL _isNeedJoinLayoutSystem;
BOOL _lazyCreateView;
NSString *_transform;
NSString *_transformOrigin;
}
///--------------------------------------
/// @name Package Internal Methods
///--------------------------------------
- (void)_layoutDidFinish;
- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition
gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents;
- (void)_willDisplayLayer:(CALayer *)layer;
- (void)_unloadViewWithReusing:(BOOL)isReusing;
- (id<WXScrollerProtocol>)ancestorScroller;
- (void)_insertSubcomponent:(WXComponent *)subcomponent atIndex:(NSInteger)index;
- (void)_removeFromSupercomponent;
- (void)_moveToSupercomponent:(WXComponent *)newSupercomponent atIndex:(NSUInteger)index;
- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles;
- (void)_updateAttributesOnComponentThread:(NSDictionary *)attributes;
- (void)_updateStylesOnMainThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles;
- (void)_updateAttributesOnMainThread:(NSDictionary *)attributes;
- (void)_addEventOnComponentThread:(NSString *)eventName;
- (void)_removeEventOnComponentThread:(NSString *)eventName;
- (void)_addEventOnMainThread:(NSString *)eventName;
- (void)_removeEventOnMainThread:(NSString *)eventName;
///--------------------------------------
/// @name Protected Methods
///--------------------------------------
- (BOOL)_needsDrawBorder;
- (void)_drawBorderWithContext:(CGContextRef)context size:(CGSize)size;
- (void)_frameDidCalculated:(BOOL)isChanged;
- (NSUInteger)_childrenCountForLayout;
- (void)_fillAbsolutePositions;
///--------------------------------------
/// @name Private Methods
///--------------------------------------
- (void)_initCSSNodeWithStyles:(NSDictionary *)styles;
- (void)_updateCSSNodeStyles:(NSDictionary *)styles;
- (void)_resetCSSNodeStyles:(NSArray *)styles;
- (void)_recomputeCSSNodeChildren;
- (void)_handleBorders:(NSDictionary *)styles isUpdating:(BOOL)updating;
- (void)_initViewPropertyWithStyles:(NSDictionary *)styles;
- (void)_updateViewStyles:(NSDictionary *)styles;
- (void)_resetStyles:(NSArray *)styles;
- (void)_initEvents:(NSArray *)events;
- (void)_removeAllEvents;
- (void)_setupNavBarWithStyles:(NSMutableDictionary *)styles attributes:(NSMutableDictionary *)attributes;
- (void)_updateNavBarAttributes:(NSDictionary *)attributes;
- (void)_handleFirstScreenTime;
- (void)_resetNativeBorderRadius;
@end
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: src-delomboked/com/sponberg/fluid/util/LRUCacheTree.java
//
#ifndef _FFTLRUCacheTree_H_
#define _FFTLRUCacheTree_H_
@class FFTLRUCache;
@class IOSObjectArray;
@class JavaUtilHashSet;
#import "JreEmulation.h"
@interface FFTLRUCacheTree : NSObject {
@public
int maxEntries_;
FFTLRUCache *cache_;
FFTLRUCache *subCache_;
JavaUtilHashSet *dontCacheChainsStartingWith_;
}
- (id)initWithInt:(int)maxEntries;
- (void)dontCacheChainStartingWithWithNSString:(NSString *)key;
- (id)getWithNSStringArray:(IOSObjectArray *)keyChain;
- (id)getHelperWithNSStringArray:(IOSObjectArray *)keyChain
withInt:(int)index;
- (void)putWithNSStringArray:(IOSObjectArray *)keyChain
withId:(id)value;
- (void)putHelperWithNSStringArray:(IOSObjectArray *)keyChain
withInt:(int)index
withId:(id)value;
- (void)removeWithNSStringArray:(IOSObjectArray *)keyChain;
- (void)removeHelperWithNSStringArray:(IOSObjectArray *)keyChain
withInt:(int)index;
- (void)copyAllFieldsTo:(FFTLRUCacheTree *)other;
@end
__attribute__((always_inline)) inline void FFTLRUCacheTree_init() {}
J2OBJC_FIELD_SETTER(FFTLRUCacheTree, cache_, FFTLRUCache *)
J2OBJC_FIELD_SETTER(FFTLRUCacheTree, subCache_, FFTLRUCache *)
J2OBJC_FIELD_SETTER(FFTLRUCacheTree, dontCacheChainsStartingWith_, JavaUtilHashSet *)
typedef FFTLRUCacheTree ComSponbergFluidUtilLRUCacheTree;
#endif // _FFTLRUCacheTree_H_
|
// -*- c++ -*-
// +--------------------------------------------------------------------+
// | This file is part of WaveletTL - the Wavelet Template Library |
// | |
// | Copyright (c) 2002-2007 |
// | Thorsten Raasch, Manuel Werner, |
// +--------------------------------------------------------------------+
#ifndef _FRAMETL_POISSON_1D_TESTCASE_H
#define _FRAMETL_POISSON_1D_TESTCASE_H
#include <utils/function.h>
#include <functional.h>
#include <aggregated_frame.h>
#include <geometry/point.h>
using MathTL::Function;
using MathTL::Point;
namespace FrameTL
{
/*!
Right-hand side for the one-dimensional Poisson equation in the
unit interval.
*/
template<class VALUE = double>
class Singularity1D_RHS_2
: public Function<1, VALUE>
{
public:
Singularity1D_RHS_2() {};
virtual ~Singularity1D_RHS_2() {};
VALUE value(const Point<1>& p,
const unsigned int component = 0) const
{
return -sin(3.*M_PI*p[0])*9.*M_PI*M_PI - 4.;
}
void vector_value(const Point<1> &p,
Vector<VALUE>& values) const { ; }
};
/*!
Exact solution for the one-dimensional Poisson equation in the
unit interval.
*/
template<class VALUE = double>
class Singularity1D_2
: public Function<1, VALUE>
{
public:
Singularity1D_2() {};
virtual ~Singularity1D_2() {};
VALUE value(const Point<1>& p,
const unsigned int component = 0) const
{
if (0. <= p[0] && p[0] < 0.5)
return -sin(3.*M_PI*p[0]) + 2.*p[0]*p[0];
if (0.5 <= p[0] && p[0] <= 1.0)
return -sin(3.*M_PI*p[0]) + 2.*(1-p[0])*(1-p[0]);
return 0.;
}
void vector_value(const Point<1> &p,
Vector<VALUE>& values) const { ; }
};
/*!
First order derivative of the exact solution for the one-dimensional Poisson
equation in the unit interval.
*/
template<class VALUE = double>
class Singularity1D_2_prime
: public Function<1, VALUE>
{
public:
Singularity1D_2_prime() {};
virtual ~Singularity1D_2_prime() {};
VALUE value(const Point<1>& p,
const unsigned int component = 0) const
{
if (0. <= p[0] && p[0] < 0.5)
return -cos(3.*M_PI*p[0])*3*M_PI + 4.*p[0];
if (0.5 <= p[0] && p[0] <= 1.0)
return -cos(3.*M_PI*p[0])*3*M_PI - 4.*(1-p[0]);
return 0.;
}
void vector_value(const Point<1> &p,
Vector<VALUE>& values) const { ; }
};
}
#endif // _FRAMETL_POISSON_1D_TESTCASE_H
|
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2016-2018 Baldur Karlsson
*
* 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 <pthread.h>
#include <signal.h>
#include "data/embedded_files.h"
#define __PRETTY_FUNCTION_SIGNATURE__ __PRETTY_FUNCTION__
#define OS_DEBUG_BREAK() raise(SIGTRAP)
#if ENABLED(RDOC_APPLE)
#include <libkern/OSByteOrder.h>
#define EndianSwap16(x) OSSwapInt16(x)
#define EndianSwap32(x) OSSwapInt32(x)
#define EndianSwap64(x) OSSwapInt64(x)
#else
#define EndianSwap16(x) __builtin_bswap16(x)
#define EndianSwap32(x) __builtin_bswap32(x)
#define EndianSwap64(x) __builtin_bswap64(x)
#endif
struct EmbeddedResourceType
{
EmbeddedResourceType(const unsigned char *b, int l) : base(b), len(l) {}
const unsigned char *base;
int len;
std::string Get() const { return std::string(base, base + len); }
};
#define EmbeddedResource(filename) \
EmbeddedResourceType(&CONCAT(data_, filename)[0], CONCAT(CONCAT(data_, filename), _len))
#define GetEmbeddedResource(filename) EmbeddedResource(filename).Get()
#define GetDynamicEmbeddedResource(resource) resource.Get()
namespace OSUtility
{
inline void ForceCrash()
{
__builtin_trap();
}
inline void DebugBreak()
{
raise(SIGTRAP);
}
bool DebuggerPresent();
void WriteOutput(int channel, const char *str);
};
namespace Threading
{
struct pthreadLockData
{
pthread_mutex_t lock;
pthread_mutexattr_t attr;
};
typedef CriticalSectionTemplate<pthreadLockData> CriticalSection;
};
namespace Bits
{
inline uint32_t CountLeadingZeroes(uint32_t value)
{
return value == 0 ? 32 : __builtin_clz(value);
}
#if ENABLED(RDOC_X64)
inline uint64_t CountLeadingZeroes(uint64_t value)
{
return value == 0 ? 64 : __builtin_clzl(value);
}
#endif
};
|
#pragma once
#include "PixelConverter.h"
#include <cstdint>
template<bool enabled, uint8_t defaultValue = 255>
class PixelComponentValueGetter{
public:
static const bool Enabled = enabled;
static uint8_t Get(const uint8_t *ptr){
return defaultValue;
}
};
template<bool enabled, int byteOffset, uint8_t defaultValue = 255>
class PixelComponentGetter{
public:
static const bool Enabled = enabled;
static uint8_t Get(const uint8_t *ptr){
return ptr[byteOffset];
}
};
template<int byteOffset, uint8_t defaultValue>
class PixelComponentGetter < false, byteOffset, defaultValue > {
public:
static const bool Enabled = false;
static uint8_t Get(const uint8_t *ptr){
return defaultValue;
}
};
template<bool enabled, int byteOffset>
class PixelComponentSetter{
public:
static const bool Enabled = enabled;
static void Set(uint8_t *ptr, uint8_t v){
ptr[byteOffset] = v;
}
};
template<int byteOffset>
class PixelComponentSetter < false, byteOffset > {
public:
static const bool Enabled = false;
static void Set(uint8_t *ptr, uint8_t v){
}
};
template<bool v>
class BoolToInt{
public:
static const int Value = 1;
};
template<>
class BoolToInt < false > {
public:
static const int Value = 0;
};
template<int v, int add>
class Accumulator{
public:
static const int Value = v + add;
};
template<class R, class G, class B, class A>
class PixelGetter{
typedef BoolToInt<R::Enabled> AccumArgR;
typedef BoolToInt<G::Enabled> AccumArgG;
typedef BoolToInt<B::Enabled> AccumArgB;
typedef BoolToInt<A::Enabled> AccumArgA;
public:
static const int PixelByteSize =
Accumulator <
Accumulator<
Accumulator <
Accumulator<0, AccumArgR::Value>::Value,
AccumArgG::Value > ::Value,
AccumArgB::Value>::Value,
AccumArgA::Value > ::Value;
static uint8_t GetR(const uint8_t *ptr){
return R::Get(ptr);
}
static uint8_t GetG(const uint8_t *ptr){
return G::Get(ptr);
}
static uint8_t GetB(const uint8_t *ptr){
return B::Get(ptr);
}
static uint8_t GetA(const uint8_t *ptr){
return A::Get(ptr);
}
};
template<class R, class G, class B, class A>
class PixelSetter{
typedef BoolToInt<R::Enabled> AccumArgR;
typedef BoolToInt<G::Enabled> AccumArgG;
typedef BoolToInt<B::Enabled> AccumArgB;
typedef BoolToInt<A::Enabled> AccumArgA;
public:
static const int PixelByteSize =
Accumulator <
Accumulator<
Accumulator <
Accumulator<0, AccumArgR::Value>::Value,
AccumArgG::Value > ::Value,
AccumArgB::Value>::Value,
AccumArgA::Value > ::Value;
static void SetR(uint8_t *ptr, uint8_t v){
R::Set(ptr, v);
}
static void SetG(uint8_t *ptr, uint8_t v){
G::Set(ptr, v);
}
static void SetB(uint8_t *ptr, uint8_t v){
B::Set(ptr, v);
}
static void SetA(uint8_t *ptr, uint8_t v){
A::Set(ptr, v);
}
};
template<class Setter, class Getter>
class PixelConverterStd8Bit : public PixelConverter{
public:
PixelConverterStd8Bit(){
}
virtual ~PixelConverterStd8Bit(){
}
virtual void Convert(void *dst, const void *src, uint32_t pixelCount) override{
uint8_t *dst8Bit = static_cast<uint8_t *>(dst);
const uint8_t *src8Bit = static_cast<const uint8_t *>(src);
for (uint32_t i = 0; i < pixelCount; i++, dst8Bit += Setter::PixelByteSize, src8Bit += Getter::PixelByteSize){
auto r = Getter::GetR(src8Bit);
auto g = Getter::GetG(src8Bit);
auto b = Getter::GetB(src8Bit);
auto a = Getter::GetA(src8Bit);
Setter::SetR(dst8Bit, r);
Setter::SetG(dst8Bit, g);
Setter::SetB(dst8Bit, b);
Setter::SetA(dst8Bit, a);
}
}
}; |
//
// LocalOAuthConfirmAuthParamsBuilder.h
// DConnectSDK
//
// Copyright (c) 2014 NTT DOCOMO,INC.
// Released under the MIT license
// http://opensource.org/licenses/mit-license.php
//
#import <Foundation/Foundation.h>
#import "LocalOAuthConfirmAuthParams.h"
@interface LocalOAuthConfirmAuthParamsBuilder : NSObject
- (LocalOAuthConfirmAuthParamsBuilder *) applicationName: (NSString *)applicationName;
- (LocalOAuthConfirmAuthParamsBuilder *) clientId: (NSString *)clientId;
- (LocalOAuthConfirmAuthParamsBuilder *) grantType: (NSString *)grantType;
- (LocalOAuthConfirmAuthParamsBuilder *) serviceId: (NSString *)serviceId;
- (LocalOAuthConfirmAuthParamsBuilder *) scope: (NSArray *)scope;
- (LocalOAuthConfirmAuthParamsBuilder *) isForDevicePlugin: (BOOL) isForDevicePlugin;
- (LocalOAuthConfirmAuthParams *)build;
@end
|
#include <stdio.h>
#include "wich.h"
int main(int ____c, char *____v[])
{
setup_error_handlers();
String * s1;
String * s2;
String * s3;
String * s4;
String * s5;
s1 = String_new("abc");
s2 = String_add(s1,String_new("xyz"));
s3 = String_add(s1,String_from_int(100));
s4 = String_add(s1,String_from_float(3.14));
s5 = String_add(s1,String_from_vector(Vector_new((double []){1,2,3}, 3)));
print_string(s1);
print_string(s2);
print_string(s3);
print_string(s4);
print_string(s5);
return 0;
}
|
//
// FKFlickrPlacesGetPlaceTypes.h
// FlickrKit
//
// Generated by FKAPIBuilder on 19 Sep, 2014 at 10:49.
// Copyright (c) 2013 DevedUp Ltd. All rights reserved. http://www.devedup.com
//
// DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED
#import "FKFlickrAPIMethod.h"
typedef enum {
FKFlickrPlacesGetPlaceTypesError_InvalidAPIKey = 100, /* The API key passed was not valid or has expired. */
FKFlickrPlacesGetPlaceTypesError_ServiceCurrentlyUnavailable = 105, /* The requested service is temporarily unavailable. */
FKFlickrPlacesGetPlaceTypesError_WriteOperationFailed = 106, /* The requested operation failed due to a temporary issue. */
FKFlickrPlacesGetPlaceTypesError_FormatXXXNotFound = 111, /* The requested response format was not found. */
FKFlickrPlacesGetPlaceTypesError_MethodXXXNotFound = 112, /* The requested method was not found. */
FKFlickrPlacesGetPlaceTypesError_InvalidSOAPEnvelope = 114, /* The SOAP envelope send in the request could not be parsed. */
FKFlickrPlacesGetPlaceTypesError_InvalidXMLRPCMethodCall = 115, /* The XML-RPC request document could not be parsed. */
FKFlickrPlacesGetPlaceTypesError_BadURLFound = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */
} FKFlickrPlacesGetPlaceTypesError;
/*
Fetches a list of available place types for Flickr.
Response:
<place_types>
<place_type place_type_id="22">neighbourhood</place_type>
<place_type place_type_id="7">locality</place_type>
<place_type place_type_id="9">county</place_type>
<place_type place_type_id="8">region</place_type>
<place_type place_type_id="12">country</place_type>
<place_type place_type_id="29">continent</place_type>
</place_types>
*/
@interface FKFlickrPlacesGetPlaceTypes : NSObject <FKFlickrAPIMethod>
@end
|
//
// UIView+Extension.h
// extension
//
// Created by czljcb on 2017/8/12.
// Copyright © 2017年 czljcb. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (Extension)
/** x */
@property (assign, nonatomic) CGFloat x;
/** y */
@property (assign, nonatomic) CGFloat y;
/** width */
@property (assign, nonatomic) CGFloat width;
/** height */
@property (assign, nonatomic) CGFloat height;
/** size */
@property (assign, nonatomic) CGSize size;
/** centerX */
@property (assign, nonatomic) CGFloat centerX;
/** centerY */
@property (assign, nonatomic) CGFloat centerY;
@property (nonatomic, readonly) UIViewController *viewController;
+ (instancetype)viewFromXib;
/**
Converts a point from the receiver's coordinate system to that of the specified view or window.
@param point A point specified in the local coordinate system (bounds) of the receiver.
@param view The view or window into whose coordinate system point is to be converted.
If view is nil, this method instead converts to window base coordinates.
@return The point converted to the coordinate system of view.
*/
- (CGPoint)convertPoint:(CGPoint)point toViewOrWindow:(UIView *)view;
/**
Converts a point from the coordinate system of a given view or window to that of the receiver.
@param point A point specified in the local coordinate system (bounds) of view.
@param view The view or window with point in its coordinate system.
If view is nil, this method instead converts from window base coordinates.
@return The point converted to the local coordinate system (bounds) of the receiver.
*/
- (CGPoint)convertPoint:(CGPoint)point fromViewOrWindow:(UIView *)view;
/**
Converts a rectangle from the receiver's coordinate system to that of another view or window.
@param rect A rectangle specified in the local coordinate system (bounds) of the receiver.
@param view The view or window that is the target of the conversion operation. If view is nil, this method instead converts to window base coordinates.
@return The converted rectangle.
*/
- (CGRect)convertRect:(CGRect)rect toViewOrWindow:(UIView *)view;
/**
Converts a rectangle from the coordinate system of another view or window to that of the receiver.
@param rect A rectangle specified in the local coordinate system (bounds) of view.
@param view The view or window with rect in its coordinate system.
If view is nil, this method instead converts from window base coordinates.
@return The converted rectangle.
*/
- (CGRect)convertRect:(CGRect)rect fromViewOrWindow:(UIView *)view;
@end
|
//*****************************************************************************
// pinmux.c
//
// Configure the device pins for different peripheral signals
//
// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
//
//
// Redistribution and use in source and binary forms, with or without
// 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 Texas Instruments Incorporated 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.
//
//*****************************************************************************
//*****************************************************************************
// This file was automatically generated on 7/21/2014 at 3:06:20 PM
// by TI PinMux version 3.0.334
//
//*****************************************************************************
#include "pinmux.h"
#include "hw_types.h"
#include "hw_memmap.h"
#include "hw_gpio.h"
#include "pin.h"
#include "rom.h"
#include "rom_map.h"
#include "gpio.h"
#include "prcm.h"
//*****************************************************************************
void
PinMuxConfig(void)
{
//
// Enable Peripheral Clocks
//
MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
//
// Configure PIN_55 for UART0 UART0_TX
//
MAP_PinTypeUART(PIN_55, PIN_MODE_3);
//
// Configure PIN_57 for UART0 UART0_RX
//
MAP_PinTypeUART(PIN_57, PIN_MODE_3);
//
// Configure PIN_64 for GPIOOutput
//
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
//
// Configure PIN_04 for GPIOInput
//
MAP_PinTypeGPIO(PIN_04, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x20, GPIO_DIR_MODE_IN);
//
// Configure PIN_08 for GPIOInput
//
MAP_PinTypeGPIO(PIN_08, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA2_BASE, 0x2, GPIO_DIR_MODE_IN);
}
|
/******************************************************************************
File: InterpRegisters.h
Description:
Specification of the Smalltalk Interpreter Registers
******************************************************************************/
#pragma once
#include "STMethod.h"
#include "STProcess.h"
#include "STMethod.h"
#include "STContext.h"
// N.B. Must be kept in sync with istasm.inc
struct InterpreterRegisters
{
ST::Process* m_pActiveProcess;
ST::CompiledMethod* m_pMethod;
BYTE* m_instructionPointer;
StackFrame* m_pActiveFrame;
Oop* m_stackPointer;
Oop* m_basePointer;
// These are the only Oops the VM refererences without ref. counting them (for performance)
MethodOTE* m_oopNewMethod;
ProcessOTE* m_oteActiveProcess;
public:
Oop activeFrameOop() { return Oop(m_pActiveFrame)+1; }
StackFrame& activeFrame() { return *m_pActiveFrame; }
void StoreIPInFrame(); // Save down IP to active frame
void LoadIPFromFrame(); // Load IP from active frame
void StoreSPInFrame(); // Save down SP to active frame
void LoadSPFromFrame(); // Load SP from active frame
void NewActiveProcess(ProcessOTE* newProcess);
void FetchContextRegisters(); // Load current IP/SP from active frame
void StoreContextRegisters(); // Save down current IP/SP to active frame
void StoreSuspendedFrame(); // Save active frame back to process as top frame
void LoadSuspendedFrame(); // Restore process suspended frame as active frame
void PrepareToSuspendProcess(); // Resize proc, update suspended frame, and store context to that frame
void PrepareToResumeProcess(); // Resize proc, update suspended frame, and store context to that frame
void ResizeProcess();
};
inline void InterpreterRegisters::ResizeProcess()
{
HARDASSERT(m_pActiveProcess != NULL);
MWORD words = m_stackPointer - reinterpret_cast<const Oop*>(m_pActiveProcess) + 1;
m_oteActiveProcess->setSize(words*sizeof(MWORD));
}
typedef __declspec(align(16)) struct InterpreterRegisters InterpreterRegisters16;
|
//
// MyOneSDK.h
// MyOneSDK
//
// Created by Mon Zacharias on 27/10/2017.
// Copyright © 2017 Mon Zacharias. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for MyOneSDK.
FOUNDATION_EXPORT double MyOneSDKVersionNumber;
//! Project version string for MyOneSDK.
FOUNDATION_EXPORT const unsigned char MyOneSDKVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <MyOneSDK/PublicHeader.h>
|
#include<stdio.h>
int main (){
int n, i, new1;
float avg = 0;
do {
scanf("%d",&n);
}while(n < 1 && n > 9999);
for(i = 0; n / 10 != 0; i++){
new1 = n % 10;
avg += new1;
n /= 10;
}
avg = avg / i;
if(avg < 7)
printf("light\n");
else
printf("heavy\n");
return 0;
}
|
#ifndef __VSC_LOGIN_H__
#define __VSC_LOGIN_H__
#include <QDialog>
#include "ui_vsclogin.h"
#include "utility.hpp"
#include <QTimer>
#include <QPoint>
#include <QMouseEvent>
class VSCLogin : public QDialog
{
Q_OBJECT
public:
VSCLogin(QWidget *parent = 0);
~VSCLogin(){}
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
public:
BOOL GetIsLogin()
{
return m_isLogin;
}
BOOL SetDefault()
{
m_isLogin = FALSE;
return TRUE;
}
BOOL GetUserPasswd(astring &strUser, astring &strPasswd);
public slots:
void LoginClicked();
void ExitClicked();
public:
Ui::VSCLogin ui;
private:
QPoint m_DragPosition;
bool m_Drag;
private:
BOOL m_isLogin;
};
#endif // __VSC_LOGIN_H__
|
//
// LPDRootTabBarViewModel.h
// LPDMvvmKit
//
// Created by foxsofter on 15/12/16.
// Copyright © 2015年 eleme. All rights reserved.
//
#import "LPDTabBarViewModel.h"
@interface LPDRootTabBarViewModel : LPDTabBarViewModel
@end
|
#ifndef B_PNG_H
#define B_PNG_H
static unsigned char b_png[] =
{
0x00, 0x00, 0x01, 0x1e,
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x4f, 0xdf, 0x12,
0x29, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9,
0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x10, 0x00,
0x00, 0x0b, 0x10, 0x01, 0xad, 0x23, 0xbd, 0x75, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45,
0x07, 0xd3, 0x07, 0x06, 0x00, 0x2e, 0x30, 0xe2, 0xeb, 0x7e, 0x6d, 0x00, 0x00, 0x00, 0xab, 0x49,
0x44, 0x41, 0x54, 0x78, 0xda, 0x75, 0xd0, 0xb1, 0x0d, 0xc2, 0x30, 0x10, 0x05, 0xd0, 0x47, 0x84,
0x9c, 0x8a, 0x9a, 0x12, 0x57, 0x14, 0x48, 0xa9, 0x58, 0x80, 0x0d, 0x58, 0x81, 0xcd, 0x18, 0x25,
0x2c, 0xc0, 0x0c, 0x81, 0x11, 0x10, 0x15, 0x34, 0xa6, 0x20, 0x0e, 0xb6, 0x14, 0x4e, 0xd7, 0xf8,
0xfe, 0xf7, 0xbf, 0xfb, 0x7f, 0x61, 0xaa, 0xbd, 0xaa, 0xae, 0xec, 0xb9, 0x5a, 0x42, 0xa0, 0xab,
0xe1, 0x37, 0x01, 0x74, 0x16, 0xfe, 0xd5, 0x8a, 0x2d, 0x4f, 0x0d, 0x9c, 0x48, 0x9c, 0x6b, 0x46,
0x18, 0xc5, 0x1a, 0x88, 0xe0, 0x5e, 0x33, 0xda, 0x92, 0xb1, 0x01, 0xb7, 0x39, 0x8d, 0x57, 0xa9,
0x71, 0x9b, 0xdf, 0x02, 0x86, 0x4c, 0x1a, 0x48, 0xa4, 0xfc, 0xec, 0x08, 0xa5, 0x97, 0x54, 0x6b,
0xfc, 0x90, 0xc8, 0x30, 0xe7, 0xf6, 0x3b, 0x0f, 0x96, 0x22, 0x91, 0x9e, 0x23, 0x3b, 0xf0, 0x60,
0x4d, 0xcf, 0x85, 0x56, 0xf3, 0x3b, 0xb3, 0xcd, 0xbf, 0x5f, 0xc5, 0xed, 0x61, 0x62, 0xdc, 0x0b,
0xc6, 0x5b, 0x3d, 0x3c, 0x93, 0x38, 0xfd, 0xc9, 0x3e, 0x96, 0x5b, 0xfa, 0x6c, 0x75, 0xea, 0x43,
0x4e, 0x65, 0xcc, 0x63, 0xa8, 0xe1, 0x38, 0xaa, 0x7c, 0x00, 0x42, 0x00, 0x2d, 0xff, 0xe5, 0x0e,
0x8f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
#endif
|
/**********************************************************************
* *
* Voreen - The Volume Rendering Engine *
* *
* Created between 2005 and 2012 by The Voreen Team *
* as listed in CREDITS.TXT <http://www.voreen.org> *
* *
* This file is part of the Voreen software package. Voreen 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. *
* *
* Voreen 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 *
* in the file "LICENSE.txt" along with this program. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
* The authors reserve all rights not expressly granted herein. For *
* non-commercial academic use see the license exception specified in *
* the file "LICENSE-academic.txt". To get information about *
* commercial licensing please contact the authors. *
* *
**********************************************************************/
#ifndef VRN_NETWORKANNOTATION_H
#define VRN_NETWORKANNOTATION_H
#include "voreen/core/io/serialization/serialization.h"
namespace voreen {
class VRN_CORE_API NetworkAnnotation : public Serializable {
public:
NetworkAnnotation();
void serialize(XmlSerializer& s) const;
void deserialize(XmlDeserializer& s);
void setPosition(int x, int y);
std::pair<int,int> getPosition() const;
bool hasFence() const;
std::pair<int,int> getFencePosition() const;
void setFencePosition(int x, int y);
void setText(const std::string& text);
const std::string& getText() const;
private:
std::string text_;
int positionX_;
int positionY_;
bool hasFence_;
int positionFenceX_;
int positionFenceY_;
};
class VRN_CORE_API NetworkAnnotationContainer : public MetaDataBase {
public:
NetworkAnnotationContainer();
std::string getClassName() const { return "NetworkAnnotationContainer"; };
Serializable* create() const;
MetaDataBase* clone() const;
std::string toString() const;
void serialize(XmlSerializer& s) const;
void deserialize(XmlDeserializer& s);
void addNetworkAnnotation(NetworkAnnotation* annotation);
void removeNetworkAnnotation(NetworkAnnotation* annotation);
void clearNetworkAnnotations();
bool isEmpty() const;
bool getShowAnnotations() const;
void setShowAnnotations(bool v);
const std::vector<NetworkAnnotation*>& getAnnotations() const;
private:
std::vector<NetworkAnnotation*> annotations_;
bool showAnnotations_;
};
} // namespace
#endif // VRN_NETWORKANNOTATION_H
|
/*
* utils.c
*
* metapixel
*
* Copyright (C) 1997-2004 Mark Probst
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include "api.h"
int
utils_manhattan_distance (int x1, int y1, int x2, int y2)
{
return abs(x1 - x2) + abs(y1 - y2);
}
int
utils_flip_multiplier (unsigned int flips)
{
int multiplier = 1;
if (flips & FLIP_HOR)
multiplier *= 2;
if (flips & FLIP_VER)
multiplier *= 2;
return multiplier;
}
|
/* packet-dcerpc-bossvr.c
*
* Routines for DCE DFS Basic Overseer Server dissection
* Copyright 2002, Jaime Fournier <Jaime.Fournier@hush.com>
* This information is based off the released idl files from opengroup.
* ftp://ftp.opengroup.org/pub/dce122/dce/src/file.tar.gz file/bosserver/bbos_ncs_interface.idl
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include "packet-dcerpc.h"
void proto_register_dcerpc_bossvr(void);
void proto_reg_handoff_dcerpc_bossvr(void);
static int proto_bossvr = -1;
static int hf_bossvr_opnum = -1;
static gint ett_bossvr = -1;
static e_guid_t uuid_bossvr = { 0x4d37f2dd, 0xed43, 0x0000, { 0x02, 0xc0, 0x37, 0xcf, 0x1e, 0x00, 0x00, 0x01 } };
static guint16 ver_bossvr = 0;
static dcerpc_sub_dissector bossvr_dissectors[] = {
{ 0, "GetServerStatus", NULL, NULL},
{ 1, "CreateBnode", NULL, NULL},
{ 2, "DeleteBnode", NULL, NULL},
{ 3, "SetStatus", NULL, NULL},
{ 4, "GetStatus", NULL, NULL},
{ 5, "EnumerateInstance", NULL, NULL},
{ 6, "GetInstanceInfo", NULL, NULL},
{ 7, "GetInstanceParm", NULL, NULL},
{ 8, "AddSUser", NULL, NULL},
{ 9, "DeleteSUser", NULL, NULL},
{ 10, "ListSUsers", NULL, NULL},
{ 11, "ListKeys", NULL, NULL},
{ 12, "AddKey", NULL, NULL},
{ 13, "DeleteKey", NULL, NULL},
{ 14, "GenerateKey", NULL, NULL},
{ 15, "GarbageCollectKeys", NULL, NULL},
{ 16, "GetCellName", NULL, NULL},
{ 17, "SetTStatus", NULL, NULL},
{ 18, "ShutdownAll", NULL, NULL},
{ 19, "RestartAll", NULL, NULL},
{ 20, "StartupAll", NULL, NULL},
{ 21, "SetNoAuthFlag", NULL, NULL},
{ 22, "ReBossvr", NULL, NULL},
{ 23, "Restart", NULL, NULL},
{ 24, "Install", NULL, NULL},
{ 25, "UnInstall", NULL, NULL},
{ 26, "GetDates", NULL, NULL},
{ 27, "Prune", NULL, NULL},
{ 28, "SetRestartTime", NULL, NULL},
{ 29, "GetRestartTime", NULL, NULL},
{ 30, "GetLog", NULL, NULL},
{ 31, "WaitAll", NULL, NULL},
{ 32, "SetDebug", NULL, NULL},
{ 33, "GetServerInterfaces", NULL, NULL},
{ 0, NULL, NULL, NULL }
};
void
proto_register_dcerpc_bossvr (void)
{
static hf_register_info hf[] = {
{ &hf_bossvr_opnum,
{ "Operation", "bossvr.opnum", FT_UINT16, BASE_DEC,
NULL, 0x0, NULL, HFILL }}
};
static gint *ett[] = {
&ett_bossvr,
};
proto_bossvr = proto_register_protocol ("DCE DFS Basic Overseer Server", "BOSSVR", "bossvr");
proto_register_field_array (proto_bossvr, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
}
void
proto_reg_handoff_dcerpc_bossvr (void)
{
/* Register the protocol as dcerpc */
dcerpc_init_uuid (proto_bossvr, ett_bossvr, &uuid_bossvr, ver_bossvr, bossvr_dissectors, hf_bossvr_opnum);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
|
/* Open a stdio stream on an anonymous temporary file. Generic/POSIX version.
Copyright (C) 1991,93,96,97,98,99,2000 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. */
#include <stdio.h>
#include <unistd.h>
#ifdef USE_IN_LIBIO
# include <iolibio.h>
# define __fdopen _IO_fdopen
# define tmpfile __new_tmpfile
#endif
/* This returns a new stream opened on a temporary file (generated
by tmpnam). The file is opened with mode "w+b" (binary read/write).
If we couldn't generate a unique filename or the file couldn't
be opened, NULL is returned. */
FILE *
tmpfile (void)
{
char buf[FILENAME_MAX];
int fd;
FILE *f;
if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
return NULL;
fd = __gen_tempname (buf, __GT_FILE);
if (fd < 0)
return NULL;
/* Note that this relies on the Unix semantics that
a file is not really removed until it is closed. */
(void) remove (buf);
if ((f = __fdopen (fd, "w+b")) == NULL)
__close (fd);
return f;
}
#ifdef USE_IN_LIBIO
# undef tmpfile
# include <shlib-compat.h>
versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1);
#endif
|
/*
* sr595.h:
* Extend wiringPi with the 74x595 shift registers.
* Copyright (c) 2013 Gordon Henderson
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi 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.
*
* wiringPi 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 wiringPi.
* If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
extern int sr595Setup(const int pinBase,
const int numPins,
const int dataPin,
const int clockPin,
const int latchPin);
#ifdef __cplusplus
}
#endif
|
static int pcm20_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
{
struct video_tuner v;
f(v.field1, v.field2);
}
|
/* Aseprite
* Copyright (C) 2001-2013 David Capello
*
* 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 APP_UI_POPUP_FRAME_PIN_H_INCLUDED
#define APP_UI_POPUP_FRAME_PIN_H_INCLUDED
#pragma once
#include "ui/button.h"
#include "ui/popup_window.h"
namespace app {
class PopupWindowPin : public ui::PopupWindow {
public:
PopupWindowPin(const std::string& text, ClickBehavior clickBehavior);
protected:
virtual bool onProcessMessage(ui::Message* msg) override;
virtual void onHitTest(ui::HitTestEvent& ev) override;
// The pin. Your derived class must add this pin in some place of
// the frame as a children, and you must to remove the pin from the
// parent in your class's dtor.
ui::CheckBox* getPin() { return &m_pin; }
private:
void onPinClick(ui::Event& ev);
ui::CheckBox m_pin;
};
} // namespace app
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 Advanced Micro Devices, 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// For SB HT chain only
// mmconf is not ready yet
static void set_bsp_node_CHtExtNodeCfgEn(void)
{
#if CONFIG_EXT_RT_TBL_SUPPORT
u32 dword;
dword = pci_io_read_config32(PCI_DEV(0, 0x18, 0), 0x68);
dword |= (1<<27) | (1<<25);
/* CHtExtNodeCfgEn: coherent link extended node configuration enable,
Nodes[31:0] will be 0xff:[31:0], Nodes[63:32] will be 0xfe:[31:0]
---- 32 nodes now only
It can be used even nodes less than 8 nodes.
We can have 8 more device on bus 0 in that case
*/
/* CHtExtAddrEn */
pci_io_write_config32(PCI_DEV(0, 0x18, 0), 0x68, dword);
// CPU on bus 0xff and 0xfe now. For now on we can use CONFIG_CBB and CONFIG_CDB.
#endif
}
static void enumerate_ht_chain(void)
{
#if CONFIG_HT_CHAIN_UNITID_BASE != 0
/* CONFIG_HT_CHAIN_UNITID_BASE could be 0 (only one ht device in the ht chain),
if so, don't need to go through the chain */
/* Assumption the HT chain that is bus 0 has the HT I/O Hub on it.
* On most boards this just happens. If a CPU has multiple
* non Coherent links the appropriate bus registers for the
* links needs to be programed to point at bus 0.
*/
unsigned next_unitid, last_unitid = 0;
#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20
// let't record the device of last ht device, So we can set the
// Unitid to CONFIG_HT_CHAIN_END_UNITID_BASE
unsigned real_last_unitid = 0;
u8 real_last_pos = 0;
int ht_dev_num = 0; // except host_bridge
u8 end_used = 0;
#endif
next_unitid = CONFIG_HT_CHAIN_UNITID_BASE;
do {
u32 id;
u8 hdr_type, pos;
last_unitid = next_unitid;
id = pci_io_read_config32(PCI_DEV(0,0,0), PCI_VENDOR_ID);
/* If the chain is enumerated quit */
if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
(((id >> 16) & 0xffff) == 0xffff) ||
(((id >> 16) & 0xffff) == 0x0000))
{
break;
}
hdr_type = pci_io_read_config8(PCI_DEV(0,0,0), PCI_HEADER_TYPE);
pos = 0;
hdr_type &= 0x7f;
if ((hdr_type == PCI_HEADER_TYPE_NORMAL) ||
(hdr_type == PCI_HEADER_TYPE_BRIDGE))
{
pos = pci_io_read_config8(PCI_DEV(0,0,0), PCI_CAPABILITY_LIST);
}
while (pos != 0) {
u8 cap;
cap = pci_io_read_config8(PCI_DEV(0,0,0), pos + PCI_CAP_LIST_ID);
if (cap == PCI_CAP_ID_HT) {
u16 flags;
/* Read and write and reread flags so the link
* direction bit is valid.
*/
flags = pci_io_read_config16(PCI_DEV(0,0,0), pos + PCI_CAP_FLAGS);
pci_io_write_config16(PCI_DEV(0,0,0), pos + PCI_CAP_FLAGS, flags);
flags = pci_io_read_config16(PCI_DEV(0,0,0), pos + PCI_CAP_FLAGS);
if ((flags >> 13) == 0) {
unsigned count;
unsigned ctrl, ctrl_off;
pci_devfn_t devx;
#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20
if (next_unitid >= 0x18) {
if (!end_used) {
next_unitid = CONFIG_HT_CHAIN_END_UNITID_BASE;
end_used = 1;
} else {
goto out;
}
}
real_last_unitid = next_unitid;
real_last_pos = pos;
ht_dev_num++;
#endif
#if !CONFIG_HT_CHAIN_END_UNITID_BASE
if (!next_unitid)
goto out;
#endif
flags &= ~0x1f;
flags |= next_unitid & 0x1f;
count = (flags >> 5) & 0x1f;
devx = PCI_DEV(0, next_unitid, 0);
next_unitid += count;
pci_io_write_config16(PCI_DEV(0, 0, 0), pos + PCI_CAP_FLAGS, flags);
/* Test for end of chain */
ctrl_off = ((flags >> 10) & 1)?
PCI_HT_CAP_SLAVE_CTRL0 : PCI_HT_CAP_SLAVE_CTRL1;
do {
ctrl = pci_io_read_config16(devx, pos + ctrl_off);
/* Is this the end of the hypertransport chain? */
if (ctrl & (1 << 6)) {
goto out;
}
if (ctrl & ((1 << 4) | (1 << 8))) {
/*
* Either the link has failed, or we have
* a CRC error.
* Sometimes this can happen due to link
* retrain, so lets knock it down and see
* if its transient
*/
ctrl |= ((1 << 4) | (1 <<8)); // Link fail + Crc
pci_io_write_config16(devx, pos + ctrl_off, ctrl);
ctrl = pci_io_read_config16(devx, pos + ctrl_off);
if (ctrl & ((1 << 4) | (1 << 8))) {
// can not clear the error
break;
}
}
} while ((ctrl & (1 << 5)) == 0);
break;
}
}
pos = pci_io_read_config8(PCI_DEV(0, 0, 0), pos + PCI_CAP_LIST_NEXT);
}
} while (last_unitid != next_unitid);
out: ;
#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20
if ((ht_dev_num > 1) && (real_last_unitid != CONFIG_HT_CHAIN_END_UNITID_BASE) && !end_used) {
u16 flags;
flags = pci_io_read_config16(PCI_DEV(0,real_last_unitid,0), real_last_pos + PCI_CAP_FLAGS);
flags &= ~0x1f;
flags |= CONFIG_HT_CHAIN_END_UNITID_BASE & 0x1f;
pci_io_write_config16(PCI_DEV(0, real_last_unitid, 0), real_last_pos + PCI_CAP_FLAGS, flags);
}
#endif
#endif
}
|
/* wireshark_application.h
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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 WIRESHARK_APPLICATION_H
#define WIRESHARK_APPLICATION_H
#include "config.h"
#include <glib.h>
#include "epan/prefs.h"
#include "capture_opts.h"
#include <capchild/capture_session.h>
#include "file.h"
#include "register.h"
#include "ui/help_url.h"
#include <QApplication>
#include <QFileInfo>
#include <QFont>
#include <QList>
#include <QSocketNotifier>
#include <QThread>
#include <QTimer>
// Recent items:
// - Read from prefs
// - Add from open file
// - Check current list
// - Signal updated item
// -
typedef struct _recent_item_status {
QString filename;
qint64 size;
bool accessible;
bool in_thread;
} recent_item_status;
class WiresharkApplication : public QApplication
{
Q_OBJECT
public:
explicit WiresharkApplication(int &argc, char **argv);
enum AppSignal {
ColumnsChanged,
FilterExpressionsChanged,
PacketDissectionChanged,
PreferencesChanged,
StaticRecentFilesRead
};
void registerUpdate(register_action_e action, const char *message);
void emitAppSignal(AppSignal signal);
void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
void allSystemsGo();
void refreshLocalInterfaces();
e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path);
QList<recent_item_status *> recentItems() const;
void addRecentItem(const QString &filename, qint64 size, bool accessible);
void captureCallback(int event, capture_session * cap_session);
void captureFileCallback(int event, void * data);
QDir lastOpenDir();
void setLastOpenDir(const char *dir_name);
void setLastOpenDir(QString *dir_str);
void helpTopicAction(topic_action_e action);
QFont monospaceFont(bool bold = false);
void setMonospaceFont(const char *font_string);
int monospaceTextSize(const char *str, bool bold = false);
void setConfigurationProfile(const gchar *profile_name);
bool isInitialized() { return initialized_; }
private:
bool initialized_;
QFont mono_regular_font_;
QFont mono_bold_font_;
QTimer recent_timer_;
QTimer addr_resolv_timer_;
QTimer tap_update_timer_;
QList<QString> pending_open_files_;
QSocketNotifier *if_notifier_;
protected:
bool event(QEvent *event);
signals:
void appInitialized();
void localInterfaceListChanged();
void openCaptureFile(QString &cf_path, QString &display_filter, unsigned int type);
void recentFilesRead();
void updateRecentItemStatus(const QString &filename, qint64 size, bool accessible);
void splashUpdate(register_action_e action, const char *message);
void configurationProfileChanged(const gchar *profile_name);
void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
void filterExpressionsChanged();
void packetDissectionChanged();
void preferencesChanged();
void addressResolutionChanged();
// XXX It might make more sense to move these to main.cpp or main_window.cpp or their own class.
void captureCapturePrepared(capture_session *cap_session);
void captureCaptureUpdateStarted(capture_session *cap_session);
void captureCaptureUpdateContinue(capture_session *cap_session);
void captureCaptureUpdateFinished(capture_session *cap_session);
void captureCaptureFixedStarted(capture_session *cap_session);
void captureCaptureFixedFinished(capture_session *cap_session);
void captureCaptureStopping(capture_session *cap_session);
void captureCaptureFailed(capture_session *cap_session);
void captureFileOpened(const capture_file *cf);
void captureFileReadStarted(const capture_file *cf);
void captureFileReadFinished(const capture_file *cf);
void captureFileClosing(const capture_file *cf);
void captureFileClosed(const capture_file *cf);
void openStatCommandDialog(const QString &menu_path, const char *arg, void *userdata);
public slots:
void clearRecentItems();
private slots:
void cleanup();
void ifChangeEventsAvailable();
void itemStatusFinished(const QString filename = "", qint64 size = 0, bool accessible = false);
void refreshRecentFiles(void);
void refreshAddressResolution(void);
void updateTaps();
};
extern WiresharkApplication *wsApp;
/** Global compile time version string */
extern GString *comp_info_str;
/** Global runtime version string */
extern GString *runtime_info_str;
#endif // WIRESHARK_APPLICATION_H
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
|
#ifndef _ASM_UAPI_LKL_BITSPERLONG_H
#define _ASM_UAPI_LKL_BITSPERLONG_H
#ifdef CONFIG_64BIT
#define __BITS_PER_LONG 64
#else
#define __BITS_PER_LONG 32
#endif
#define __ARCH_WANT_STAT64
#endif /* _ASM_UAPI_LKL_BITSPERLONG_H */
|
#define CONFIG_AX25_MODULE 1
|
#include <linux/cpumask.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/irqnr.h>
#include <asm/cputime.h>
#include <linux/tick.h>
#ifndef arch_irq_stat_cpu
#define arch_irq_stat_cpu(cpu) 0
#endif
#ifndef arch_irq_stat
#define arch_irq_stat() 0
#endif
#ifdef arch_idle_time
static cputime64_t get_idle_time(int cpu)
{
cputime64_t idle;
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
idle += arch_idle_time(cpu);
return idle;
}
static cputime64_t get_iowait_time(int cpu)
{
cputime64_t iowait;
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
if (cpu_online(cpu) && nr_iowait_cpu(cpu))
iowait += arch_idle_time(cpu);
return iowait;
}
#else
static u64 get_idle_time(int cpu)
{
u64 idle, idle_time = -1ULL;
if (cpu_online(cpu))
idle_time = get_cpu_idle_time_us(cpu, NULL);
if (idle_time == -1ULL)
/* !NO_HZ or cpu offline so we can rely on cpustat.idle */
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
else
idle = usecs_to_cputime64(idle_time);
return idle;
}
static u64 get_iowait_time(int cpu)
{
u64 iowait, iowait_time = -1ULL;
if (cpu_online(cpu))
iowait_time = get_cpu_iowait_time_us(cpu, NULL);
if (iowait_time == -1ULL)
/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
else
iowait = usecs_to_cputime64(iowait_time);
return iowait;
}
#endif
static int show_stat(struct seq_file *p, void *v)
{
int i, j;
unsigned long jif;
u64 user, nice, system, idle, iowait, irq, softirq, steal;
u64 guest, guest_nice;
u64 sum = 0;
u64 sum_softirq = 0;
unsigned int per_softirq_sums[NR_SOFTIRQS] = {0};
struct timespec boottime;
user = nice = system = idle = iowait =
irq = softirq = steal = 0;
guest = guest_nice = 0;
getboottime(&boottime);
jif = boottime.tv_sec;
for_each_possible_cpu(i) {
user += kcpustat_cpu(i).cpustat[CPUTIME_USER];
nice += kcpustat_cpu(i).cpustat[CPUTIME_NICE];
system += kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM];
idle += get_idle_time(i);
iowait += get_iowait_time(i);
irq += kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
softirq += kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ];
steal += kcpustat_cpu(i).cpustat[CPUTIME_STEAL];
guest += kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
guest_nice += kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
sum += kstat_cpu_irqs_sum(i);
sum += arch_irq_stat_cpu(i);
for (j = 0; j < NR_SOFTIRQS; j++) {
unsigned int softirq_stat = kstat_softirqs_cpu(j, i);
per_softirq_sums[j] += softirq_stat;
sum_softirq += softirq_stat;
}
}
sum += arch_irq_stat();
seq_puts(p, "cpu ");
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice));
seq_putc(p, '\n');
for_each_online_cpu(i) {
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
user = kcpustat_cpu(i).cpustat[CPUTIME_USER];
nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE];
system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM];
idle = get_idle_time(i);
iowait = get_iowait_time(i);
irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ];
steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL];
guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
seq_printf(p, "cpu%d", i);
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest));
seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice));
seq_putc(p, '\n');
}
seq_printf(p, "intr %llu", (unsigned long long)sum);
/* sum again ? it could be updated? */
for_each_irq_nr(j)
seq_put_decimal_ull(p, ' ', kstat_irqs(j));
seq_printf(p,
"\nctxt %llu\n"
"btime %lu\n"
"processes %lu\n"
"procs_running %lu\n"
"procs_blocked %lu\n",
nr_context_switches(),
(unsigned long)jif,
total_forks,
nr_running(),
nr_iowait());
seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq);
for (i = 0; i < NR_SOFTIRQS; i++)
seq_put_decimal_ull(p, ' ', per_softirq_sums[i]);
seq_putc(p, '\n');
return 0;
}
static int stat_open(struct inode *inode, struct file *file)
{
size_t size = 1024 + 128 * num_online_cpus();
/* minimum size to display an interrupt count : 2 bytes */
size += 2 * nr_irqs;
return single_open_size(file, show_stat, NULL, size);
}
static const struct file_operations proc_stat_operations = {
.open = stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int __init proc_stat_init(void)
{
proc_create("stat", 0, NULL, &proc_stat_operations);
return 0;
}
module_init(proc_stat_init);
|
/*
* Dropbear - a SSH2 server
*
* Copyright (c) 2002,2003 Matt Johnston
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. */
#ifndef _LOCALTCPFWD_H_
#define _LOCALTCPFWD_H_
#ifndef DISABLE_LOCALTCPFWD
#include "includes.h"
#include "channel.h"
int newtcpdirect(struct Channel * channel);
#endif
#endif
|
/*
* Copyright (c) 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Alexander Larsson <alexl@redhat.com>
*
*/
#ifndef __GTK_REVEALER_H__
#define __GTK_REVEALER_H__
#include <gtk/gtkbin.h>
G_BEGIN_DECLS
#define GTK_TYPE_REVEALER (gtk_revealer_get_type ())
#define GTK_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_REVEALER, GtkRevealer))
#define GTK_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_REVEALER, GtkRevealerClass))
#define GTK_IS_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_REVEALER))
#define GTK_IS_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_REVEALER))
#define GTK_REVEALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_REVEALER, GtkRevealerClass))
typedef struct _GtkRevealer GtkRevealer;
typedef struct _GtkRevealerClass GtkRevealerClass;
typedef enum {
GTK_REVEALER_TRANSITION_TYPE_NONE,
GTK_REVEALER_TRANSITION_TYPE_CROSSFADE,
GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT,
GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT,
GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP,
GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN
} GtkRevealerTransitionType;
struct _GtkRevealer {
GtkBin parent_instance;
};
struct _GtkRevealerClass {
GtkBinClass parent_class;
};
GDK_AVAILABLE_IN_3_10
GType gtk_revealer_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_10
GtkWidget* gtk_revealer_new (void);
GDK_AVAILABLE_IN_3_10
gboolean gtk_revealer_get_reveal_child (GtkRevealer *revealer);
GDK_AVAILABLE_IN_3_10
void gtk_revealer_set_reveal_child (GtkRevealer *revealer,
gboolean reveal_child);
GDK_AVAILABLE_IN_3_10
gboolean gtk_revealer_get_child_revealed (GtkRevealer *revealer);
GDK_AVAILABLE_IN_3_10
guint gtk_revealer_get_transition_duration (GtkRevealer *revealer);
GDK_AVAILABLE_IN_3_10
void gtk_revealer_set_transition_duration (GtkRevealer *revealer,
guint duration);
GDK_AVAILABLE_IN_3_10
void gtk_revealer_set_transition_type (GtkRevealer *revealer,
GtkRevealerTransitionType transition);
GDK_AVAILABLE_IN_3_10
GtkRevealerTransitionType gtk_revealer_get_transition_type (GtkRevealer *revealer);
G_END_DECLS
#endif
|
/* $Id: xcoredraw.c,v 1.2 2005/07/01 10:02:58 svitak Exp $ */
/*
* $Log: xcoredraw.c,v $
* Revision 1.2 2005/07/01 10:02:58 svitak
* Misc fixes to address compiler warnings, esp. providing explicit types
* for all functions and cleaning up unused variables.
*
* Revision 1.1 2005/06/17 21:23:51 svitak
* This file was relocated from a directory with the same name minus the
* leading underscore. This was done to allow comiling on case-insensitive
* file systems. Makefile was changed to reflect the relocations.
*
* Revision 1.1.1.1 2005/06/14 04:38:33 svitak
* Import from snapshot of CalTech CVS tree of June 8, 2005
*
* Revision 1.8 2000/06/12 04:24:59 mhucka
* 1) Removed nested comments in RCS/CVS log lines, to quiet down the
* IRIX cc compiler.
* 2) Added NOTREACHED comments where appropriate.
*
* Revision 1.7 2000/05/02 06:18:31 mhucka
* Added type casts for certain function call arguments.
*
* Revision 1.6 1995/09/27 00:09:20 venkat
* XtVaSetValues()-calls-changed-to-XoXtVaSetValues()-to-avoid-alpha-FPE's
*
* Revision 1.5 1994/05/25 13:34:46 bhalla
* Added default 80% of parent form height
*
* Revision 1.4 1994/02/08 22:33:37 bhalla
* Added xoFullName to get sensible names for the widgets
*
* Revision 1.3 1994/02/08 17:47:26 bhalla
* Added call to xoGetGeom for geometry field initialization
*
* Revision 1.2 1994/02/02 20:04:53 bhalla
* Eliminated soft actions.
* */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "Widg/Framed.h"
#include "Widg/Form.h"
#include "Draw/CoreDraw.h"
#include "draw_ext.h"
#include "_widg/xform_struct.h"
static Gen2Xo GXconvert[] = {
{"xmin", XtNxmin},
{"xmax", XtNxmax},
{"ymin", XtNymin},
{"ymax", XtNymax},
{"drawflags", XtNdrawflags},
};
#ifndef MAX_NTARGS
#define MAX_NTARGS 20
#endif
int XCoreDraw (coredraw, action)
register struct xcoredraw_type *coredraw;
Action *action;
{
int ac=action->argc;
char** av=action->argv;
Widget parentW,xoFindParentForm();
FramedWidget fW;
static int xupdating = 0;
if (Debug(0) > 1)
ActionHeader("XCoreDraw", coredraw, action);
SELECT_ACTION (action) {
case INIT:
break;
case PROCESS:
break;
case RESET:
break;
case CREATE:
/* arguments are: object_type name [field value] ... */
if ((parentW = xoFindParentForm(coredraw)) == NULL) return(0);
fW = (FramedWidget)XtVaCreateManagedWidget(
xoFullName(coredraw), framedWidgetClass, parentW,
XtVaTypedArg,XtNhGeometry,XtRString,"80%",4,
XtNchildClass, coredrawWidgetClass,
XtNmappedWhenManaged, False,
NULL);
coredraw->widget = (char *)XoGetFramedChild(fW);
XtAddCallback((Widget) coredraw->widget,XtNcallback,xoCallbackFn,
(XtPointer)coredraw);
ac--, av++; /* object type */
ac--, av++; /* path */
xoParseCreateArgs(coredraw,ac,av);
XtMapWidget((Widget) fW);
xoGetGeom(coredraw);
return(1);
/* NOTREACHED */
break;
case SET:
if (ac && !xupdating) { /* need to set fields */
gx_convert(coredraw,GXconvert,XtNumber(GXconvert),ac,av);
return(0);
}
break;
case DELETE:
if (!(coredraw->widget)) return(0);
XtDestroyWidget((Widget)coredraw->widget);
break;
case XUPDATE : /* update coredraw fields due to changes in widget */
xupdating = 1;
xg_convert(coredraw,GXconvert,XtNumber(GXconvert),ac,av);
xupdating = 0;
break;
default:
xoExecuteFunction(coredraw,action,coredraw->script,"");
break;
}
return 0;
}
void xoSetDrawRefresh(w,state)
Widget w;
int state;
{
int drawflags;
XtVaGetValues(w, XtNdrawflags, &drawflags, NULL);
if (state == 0) {
if (drawflags & XO_DRAW_RESIZABLE_NOT)
return;
XoXtVaSetValues(w,
XtNdrawflags,drawflags | XO_DRAW_RESIZABLE_NOT,
NULL);
} else {
if (!(drawflags & XO_DRAW_RESIZABLE_NOT))
return;
XoXtVaSetValues(w,
XtNdrawflags,drawflags & ~XO_DRAW_RESIZABLE_NOT,
NULL);
}
}
#undef MAX_NTARGS /* 20 */
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
// clang-format off
NPairStyle(full/bin,
NPairFullBin,
NP_FULL | NP_BIN | NP_MOLONLY |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
// clang-format on
#else
#ifndef LMP_NPAIR_FULL_BIN_H
#define LMP_NPAIR_FULL_BIN_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairFullBin : public NPair {
public:
NPairFullBin(class LAMMPS *);
~NPairFullBin() {}
void build(class NeighList *);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/
|
/* 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) 2010. 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.
*/
/********************************************************************************************
* LEGAL DISCLAIMER
*
* (Header of MediaTek Software/Firmware Release or Documentation)
*
* BY OPENING OR USING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") RECEIVED
* FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER 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 BUYER AGREES TO LOOK
* ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION
* OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'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 BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE WITH THE LAWS
* OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF LAWS PRINCIPLES.
************************************************************************************************/
#ifndef _MTK_CAMERA_CORE_CAMPIPE_INC_CAMPIPE_IMGIOPIPE_MAPPER_H_
#define _MTK_CAMERA_CORE_CAMPIPE_INC_CAMPIPE_IMGIOPIPE_MAPPER_H_
// imageio/ispio, for mapper
#include <inc/imageio/ispio_pipe_scenario.h>
#include <inc/imageio/ispio_stddef.h>
/*******************************************************************************
*
********************************************************************************/
namespace NSCamPipe {
NSImageio::NSIspio::EScenarioID mapScenarioID(NSCamPipe::ESWScenarioID const eSWScenarioID, NSCamPipe::EPipeID ePipeID);
NSImageio::NSIspio::EScenarioFmt mapScenarioFmt(NSCamPipe::EScenarioFmt const eScenarioFmt);
NSImageio::NSIspio::ERawPxlID mapRawPixelID(MUINT32 const u4PixelID);
void mapBufInfo(NSCamHW::BufInfo &rCamPipeBufInfo, NSImageio::NSIspio::BufInfo const &rBufInfo);
EImageFormat mapRawFormat(MUINT32 u4BitDepth);
EImageFormat mapYUVFormat(MUINT32 u4ColorOrder);
}; //namespace NSCamPipe
#endif //_MTK_CAMERA_CORE_CAMPIPE_INC_CAMPIPE_IMGIOPIPE_MAPPER_H_
|
/* Copyright (c) 2012 Samsung Electronics Co. Ltd
*
* Exynos Phy register definitions
*
* 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.
*/
#ifndef _ASM_ARCH_XHCI_EXYNOS_H_
#define _ASM_ARCH_XHCI_EXYNOS_H_
/* Phy register MACRO definitions */
#define LINKSYSTEM_FLADJ_MASK (0x3f << 1)
#define LINKSYSTEM_FLADJ(_x) ((_x) << 1)
#define LINKSYSTEM_XHCI_VERSION_CONTROL (0x1 << 27)
#define PHYUTMI_OTGDISABLE (1 << 6)
#define PHYUTMI_FORCESUSPEND (1 << 1)
#define PHYUTMI_FORCESLEEP (1 << 0)
#define PHYCLKRST_SSC_REFCLKSEL_MASK (0xff << 23)
#define PHYCLKRST_SSC_REFCLKSEL(_x) ((_x) << 23)
#define PHYCLKRST_SSC_RANGE_MASK (0x03 << 21)
#define PHYCLKRST_SSC_RANGE(_x) ((_x) << 21)
#define PHYCLKRST_SSC_EN (0x1 << 20)
#define PHYCLKRST_REF_SSP_EN (0x1 << 19)
#define PHYCLKRST_REF_CLKDIV2 (0x1 << 18)
#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f << 11)
#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF (0x19 << 11)
#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF (0x02 << 11)
#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF (0x68 << 11)
#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF (0x7d << 11)
#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02 << 11)
#define PHYCLKRST_FSEL_MASK (0x3f << 5)
#define PHYCLKRST_FSEL(_x) ((_x) << 5)
#define PHYCLKRST_FSEL_PAD_100MHZ (0x27 << 5)
#define PHYCLKRST_FSEL_PAD_24MHZ (0x2a << 5)
#define PHYCLKRST_FSEL_PAD_20MHZ (0x31 << 5)
#define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38 << 5)
#define PHYCLKRST_RETENABLEN (0x1 << 4)
#define PHYCLKRST_REFCLKSEL_MASK (0x03 << 2)
#define PHYCLKRST_REFCLKSEL_PAD_REFCLK (0x2 << 2)
#define PHYCLKRST_REFCLKSEL_EXT_REFCLK (0x3 << 2)
#define PHYCLKRST_PORTRESET (0x1 << 1)
#define PHYCLKRST_COMMONONN (0x1 << 0)
#define PHYPARAM0_REF_USE_PAD (0x1 << 31)
#define PHYPARAM0_REF_LOSLEVEL_MASK (0x1f << 26)
#define PHYPARAM0_REF_LOSLEVEL (0x9 << 26)
#define PHYPARAM1_PCS_TXDEEMPH_MASK (0x1f << 0)
#define PHYPARAM1_PCS_TXDEEMPH (0x1c)
#define PHYTEST_POWERDOWN_SSP (0x1 << 3)
#define PHYTEST_POWERDOWN_HSP (0x1 << 2)
#define PHYBATCHG_UTMI_CLKSEL (0x1 << 2)
#define FSEL_CLKSEL_24M (0x5)
/* XHCI PHY register structure */
struct exynos_usb3_phy {
unsigned int reserve1;
unsigned int link_system;
unsigned int phy_utmi;
unsigned int phy_pipe;
unsigned int phy_clk_rst;
unsigned int phy_reg0;
unsigned int phy_reg1;
unsigned int phy_param0;
unsigned int phy_param1;
unsigned int phy_term;
unsigned int phy_test;
unsigned int phy_adp;
unsigned int phy_batchg;
unsigned int phy_resume;
unsigned int reserve2[3];
unsigned int link_port;
};
#endif /* _ASM_ARCH_XHCI_EXYNOS_H_ */
|
/*
* Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "ActivityState.h"
namespace WebCore {
class ActivityStateChangeObserver {
public:
virtual ~ActivityStateChangeObserver()
{
}
virtual void activityStateDidChange(ActivityState::Flags oldActivityState, ActivityState::Flags newActivityState) = 0;
};
} // namespace WebCore
|
/*
* Copyright (c) 2015 Novell, Inc.
* Copyright (c) 2020 SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may
* find current contact information at www.novell.com.
*/
#ifndef STORAGE_XFS_H
#define STORAGE_XFS_H
#include "storage/Filesystems/BlkFilesystem.h"
namespace storage
{
/**
* Class to represent an XFS filesystem
* https://en.wikipedia.org/wiki/Xfs in the devicegraph.
*/
class Xfs : public BlkFilesystem
{
public:
/**
* Create a device of type Xfs. Usually this function is not called
* directly. Instead BlkDevice::create_blk_filesystem() is called.
*
* @see Device::create(Devicegraph*)
*/
static Xfs* create(Devicegraph* devicegraph);
static Xfs* load(Devicegraph* devicegraph, const xmlNode* node);
public:
class Impl;
Impl& get_impl();
const Impl& get_impl() const;
virtual Xfs* clone() const override;
protected:
Xfs(Impl* impl);
};
/**
* Checks whether device points to a Xfs.
*
* @throw NullPointerException
*/
bool is_xfs(const Device* device);
/**
* Converts pointer to Device to pointer to Xfs.
*
* @return Pointer to Xfs.
* @throw DeviceHasWrongType, NullPointerException
*/
Xfs* to_xfs(Device* device);
/**
* @copydoc to_xfs(Device*)
*/
const Xfs* to_xfs(const Device* device);
}
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2007 - 2011 Red Hat, Inc.
* Copyright 2007 - 2008 Novell, Inc.
*/
#ifndef __NM_SETTING_GSM_H__
#define __NM_SETTING_GSM_H__
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-setting.h"
G_BEGIN_DECLS
#define NM_TYPE_SETTING_GSM (nm_setting_gsm_get_type ())
#define NM_SETTING_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_GSM, NMSettingGsm))
#define NM_SETTING_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_GSM, NMSettingGsmClass))
#define NM_IS_SETTING_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_GSM))
#define NM_IS_SETTING_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_GSM))
#define NM_SETTING_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_GSM, NMSettingGsmClass))
#define NM_SETTING_GSM_SETTING_NAME "gsm"
#define NM_SETTING_GSM_NUMBER "number"
#define NM_SETTING_GSM_USERNAME "username"
#define NM_SETTING_GSM_PASSWORD "password"
#define NM_SETTING_GSM_PASSWORD_FLAGS "password-flags"
#define NM_SETTING_GSM_APN "apn"
#define NM_SETTING_GSM_NETWORK_ID "network-id"
#define NM_SETTING_GSM_PIN "pin"
#define NM_SETTING_GSM_PIN_FLAGS "pin-flags"
#define NM_SETTING_GSM_HOME_ONLY "home-only"
#define NM_SETTING_GSM_DEVICE_ID "device-id"
#define NM_SETTING_GSM_SIM_ID "sim-id"
#define NM_SETTING_GSM_SIM_OPERATOR_ID "sim-operator-id"
#define NM_SETTING_GSM_MTU "mtu"
/**
* NMSettingGsm:
*
* GSM-based Mobile Broadband Settings
*/
struct _NMSettingGsm {
NMSetting parent;
};
typedef struct {
NMSettingClass parent;
/*< private >*/
gpointer padding[4];
} NMSettingGsmClass;
GType nm_setting_gsm_get_type (void);
NMSetting *nm_setting_gsm_new (void);
const char *nm_setting_gsm_get_number (NMSettingGsm *setting);
const char *nm_setting_gsm_get_username (NMSettingGsm *setting);
const char *nm_setting_gsm_get_password (NMSettingGsm *setting);
const char *nm_setting_gsm_get_apn (NMSettingGsm *setting);
const char *nm_setting_gsm_get_network_id (NMSettingGsm *setting);
const char *nm_setting_gsm_get_pin (NMSettingGsm *setting);
gboolean nm_setting_gsm_get_home_only (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_gsm_get_device_id (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_gsm_get_sim_id (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_gsm_get_sim_operator_id (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_8
guint32 nm_setting_gsm_get_mtu (NMSettingGsm *setting);
NMSettingSecretFlags nm_setting_gsm_get_pin_flags (NMSettingGsm *setting);
NMSettingSecretFlags nm_setting_gsm_get_password_flags (NMSettingGsm *setting);
G_END_DECLS
#endif /* __NM_SETTING_GSM_H__ */
|
/*****************************************************************************
*
* McStas, neutron ray-tracing package
* Copyright 1997-2006, All rights reserved
* Risoe National Laboratory, Roskilde, Denmark
* Institut Laue Langevin, Grenoble, France
*
* Library: share/ref-lib.h
*
* %Identification
* Written by: Peter Christiansen
* Date: August, 2006
* Origin: RISOE
* Release: McStas 1.10
* Version: $Revision$
*
* Commonly used reflection functions are declared in this file which
* are used by some guide and mirror components.
*
* Depends on read_table-lib
*
* Usage: within SHARE
* %include "ref-lib"
*
****************************************************************************/
%include "read_table-lib"
#ifndef REF_LIB_H
#define REF_LIB_H "$Revision$"
void StdReflecFunc(double, double*, double*);
void TableReflecFunc(double, t_Table*, double*);
#endif
/* end of ref-lib.h */
|
/**
* @file
*
* @brief Restart Thread
* @ingroup ScoreThread
*/
/*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/threadimpl.h>
#include <rtems/score/userextimpl.h>
#include <rtems/config.h>
bool _Thread_Restart(
Thread_Control *the_thread,
void *pointer_argument,
Thread_Entry_numeric_type numeric_argument
)
{
#if defined( RTEMS_SMP )
if (
rtems_configuration_is_smp_enabled()
&& !_Thread_Is_executing( the_thread )
) {
return false;
}
#endif
if ( !_States_Is_dormant( the_thread->current_state ) ) {
_Thread_Set_transient( the_thread );
_Thread_Reset( the_thread, pointer_argument, numeric_argument );
_Thread_Load_environment( the_thread );
_Thread_Ready( the_thread );
_User_extensions_Thread_restart( the_thread );
return true;
}
return false;
}
|
#ifndef NCHAN_MEMSTORE_H
#define NCHAN_MEMSTORE_H
extern nchan_store_t nchan_store_memory;
ngx_int_t msg_reserve(nchan_msg_t *msg, char *lbl);
ngx_int_t msg_release(nchan_msg_t *msg, char *lbl);
ngx_int_t memstore_channel_owner(ngx_str_t *id);
nchan_loc_conf_shared_data_t *memstore_get_conf_shared_data(nchan_loc_conf_t *cf);
ngx_int_t memstore_reserve_conf_shared_data(nchan_loc_conf_t *cf);
#endif //NCHAN_MEMSTORE_H
|
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Ishan Arora and Christophe Dumez <chris@qbittorrent.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H
#include <QTcpServer>
#ifndef QT_NO_OPENSSL
#include <QSslCertificate>
#include <QSslKey>
#endif
namespace Http
{
class IRequestHandler;
class Connection;
class Server : public QTcpServer
{
Q_OBJECT
Q_DISABLE_COPY(Server)
public:
Server(IRequestHandler *requestHandler, QObject *parent = 0);
~Server();
#ifndef QT_NO_OPENSSL
void enableHttps(const QSslCertificate &certificate, const QSslKey &key);
void disableHttps();
#endif
private:
#ifdef QBT_USES_QT5
void incomingConnection(qintptr socketDescriptor);
#else
void incomingConnection(int socketDescriptor);
#endif
private:
IRequestHandler *m_requestHandler;
#ifndef QT_NO_OPENSSL
bool m_https;
QSslCertificate m_certificate;
QSslKey m_key;
#endif
};
}
#endif // HTTP_SERVER_H
|
/***************************************************************************
qgsanalysis.h
--------
begin : September 2018
copyright : (C) 2018 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef QGSANALYSIS_H
#define QGSANALYSIS_H
#include "qgis_analysis.h"
#include "qgis_sip.h"
#include <memory>
class QgsGeometryCheckRegistry;
/**
* \ingroup analysis
* QgsAnalysis is a singleton class containing various registry and other global members
* related to analysis classes.
* \since QGIS 3.4
*/
class ANALYSIS_EXPORT QgsAnalysis
{
public:
//! QgsAnalysis cannot be copied
QgsAnalysis( const QgsAnalysis &other ) = delete;
//! QgsAnalysis cannot be copied
QgsAnalysis &operator=( const QgsAnalysis &other ) = delete;
/**
* Returns a pointer to the singleton instance.
*/
static QgsAnalysis *instance();
/**
* Returns the global geometry checker registry, used for managing all geometry check factories.
*/
static QgsGeometryCheckRegistry *geometryCheckRegistry();
private:
QgsAnalysis();
std::unique_ptr<QgsGeometryCheckRegistry> mGeometryCheckRegistry;
#ifdef SIP_RUN
QgsAnalysis( const QgsAnalysis &other );
#endif
};
#endif // QGSANALYSIS_H
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef IMPROPER_CLASS
// clang-format off
ImproperStyle(inversion/harmonic,ImproperInversionHarmonic);
// clang-format on
#else
#ifndef LMP_IMPROPER_INVERSION_HARMONIC_H
#define LMP_IMPROPER_INVERSION_HARMONIC_H
#include "improper.h"
namespace LAMMPS_NS {
class ImproperInversionHarmonic : public Improper {
public:
ImproperInversionHarmonic(class LAMMPS *);
virtual ~ImproperInversionHarmonic();
virtual void compute(int, int);
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
double *kw, *w0;
void invang(const int &i1, const int &i2, const int &i3, const int &i4, const int &type,
const int &evflag, const int &eflag, const double &vb1x, const double &vb1y,
const double &vb1z, const double &rrvb1, const double &rr2vb1, const double &vb2x,
const double &vb2y, const double &vb2z, const double &rrvb2, const double &rr2vb2,
const double &vb3x, const double &vb3y, const double &vb3z, const double &rrvb3,
const double &rr2vb3);
void allocate();
};
} // namespace LAMMPS_NS
#endif
#endif
|
#include "timestamp.h"
#include "sys/time.h"
FILE * logfp;
struct timeval mystime;
double oldtime=0;
static int loglevel=0;
int logprint(const char *const message,const int loglevel){
int retval=0;
int myerror=0;
char outmessage[MAX_MESSAGE];
snprintf(outmessage,MAX_MESSAGE,"timestamp.c:%s",message);
switch (loglevel){
case(LEVEL_DEBUG):
pydebug(outmessage);
break;
case(LEVEL_INFO):
pyinfo(outmessage);
break;
default:
/* fallthru */
case(LEVEL_USER):
pyuser(outmessage);
break;
}
//retval=fprintf(logfp,"%s",message);
// #ifdef FLUSH_LOG_FILE
if( fflush(logfp) == EOF ){
myerror=errno;
fprintf(stderr,"ERROR: log file flush failed!\n");
fprintf(stderr,"%s\n",strerror(myerror));
return(151);
};
//#endif
return(0);
}
void timestamp_open(const char * const logname){
logfp=fopen(logname,"w");
}
void timestamp_close(void){
fclose(logfp);
}
void timestamp_init(){
struct timeval now;
time_t etimes;
double nowtime,etime,itime;
suseconds_t etimeu;
char message[MAX_MESSAGE];
gettimeofday(&now,NULL);
etimes = now.tv_sec - mystime.tv_sec;
etimeu = now.tv_usec - mystime.tv_usec;
etime = (double)(etimes)+((double)(etimeu))/(1e6);
nowtime=(double)(now.tv_sec) + ((double)(now.tv_usec) / 1.0e6);
oldtime=nowtime;
itime=nowtime-oldtime;
snprintf(message,MAX_MESSAGE,"%f %f %f %s\n",etime,nowtime,itime,"time stamp reset");
logprint(message,LEVEL_INFO);
}
void timestamp(const char *const stampmsg,const int loglevel){
struct timeval now;
time_t etimes;
double nowtime,etime,itime;
suseconds_t etimeu;
char message[MAX_MESSAGE];
gettimeofday(&now,NULL);
etimes = now.tv_sec - mystime.tv_sec;
etimeu = now.tv_usec - mystime.tv_usec;
etime = (double)(etimes)+((double)(etimeu))/(1e6);
nowtime=(double)(now.tv_sec) + ((double)(now.tv_usec) / 1.0e6);
itime=nowtime-oldtime;
snprintf(message,MAX_MESSAGE,"%f %f %f %s",etime,nowtime,itime,stampmsg);
logprint(message,loglevel);
oldtime=nowtime;
}
int errprint(const char * const message,const int loglevel){
int retval;
/* print the message with the program name prefixed, and also echo to the log file */
if (logfp != NULL){
retval=fprintf(logfp,"\n*****: %s\n",message);
}
retval=fprintf(stderr,"%s\n",message);
return(retval);
}
int vprint(const char * const message){
int retval=0;
if (vflag != 0 ){
printf("verbose %i: %s\n",vflag,message);
retval=fprintf(logfp,"%s\n",message);
}
return(retval);
}
|
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#pragma ident "@(#) libfi/mpp_reduce/minval_s_3.c 92.1 07/09/99 17:07:39"
#include <stdlib.h>
#include <liberrno.h>
#include <fmath.h>
#include <cray/dopevec.h>
#include "f90_macros.h"
#define RANK 3
/*
* Compiler generated call: CALL _MINVAL_JS3(RESULT, SOURCE, DIM, MASK)
* CALL _MINVAL_SS3(RESULT, SOURCE, DIM, MASK)
*
* Purpose: Determine the minimum value of the elements of SOURCE
* along dimension DIM corresponding to the true elements
* of MASK. This particular routine handles source arrays
* of rank 3 with a data type of 64-bit integer or
* 64-bit floating point.
*
* Arguments:
* RESULT - Dope vector for temporary result array
* SOURCE - Dope vector for user source array
* DIM - Dimension to operate along
* MASK - Dope vector for logical mask array
*
* Description:
* This is the MPP single PE version of MINVAL. This
* routine checks the scope of the source and mask
* arrays and if they are private, calls the current
* Y-MP single processor version of the routine. If they
* are shared, then it allocates a result array before
* calling a Fortran routine which declares the source
* and mask arguments to be UNKNOWN SHARED.
*
* Include file minval_s.h contains the rank independent
* source code for this routine.
*/
#include "minval_s.h"
|
// DO NOT EDIT -- generated by mk-ops
#if !defined (octave_mx_i16_ui16nda_h)
#define octave_mx_i16_ui16nda_h 1
#include "oct-inttypes.h"
#include "uint16NDArray.h"
#include "mx-op-decl.h"
SND_CMP_OP_DECLS (octave_int16, uint16NDArray, OCTAVE_API)
SND_BOOL_OP_DECLS (octave_int16, uint16NDArray, OCTAVE_API)
#endif
|
/*-
* Copyright (c) 2005 Poul-Henning Kamp
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/include/printf.h,v 1.5 2011/03/06 17:45:37 pjd Exp $
*/
#ifndef _XPRINTF_PRIVATE_H_
#define _XPRINTF_PRIVATE_H_
#include <printf.h>
#include <pthread.h>
#ifndef VECTORS
#define VECTORS
typedef __attribute__ ((vector_size(16))) unsigned char VECTORTYPE;
#ifdef __SSE2__
#define V64TYPE
#endif /* __SSE2__ */
#endif /* !VECTORS */
/* FreeBSD extension */
struct __printf_io;
typedef int printf_render(struct __printf_io *, const struct printf_info *, const void *const *);
#if 0
int register_printf_render(int spec, printf_render *render, printf_arginfo_function *arginfo);
#endif
/*
* Unlike register_printf_domain_function(), register_printf_domain_render()
* doesn't have a context pointer, because none of the internal rendering
* functions use it.
*/
int register_printf_domain_render(printf_domain_t, int, printf_render *, printf_arginfo_function *);
/* xprintf.c */
extern const char __lowercase_hex[17];
extern const char __uppercase_hex[17];
void __printf_flush(struct __printf_io *io);
int __printf_puts(struct __printf_io *io, const void *ptr, int len);
int __printf_pad(struct __printf_io *io, int n, int zero);
int __printf_out(struct __printf_io *io, const struct printf_info *pi, const void *ptr, int len);
int __v2printf(printf_comp_t restrict pc, printf_domain_t restrict domain, FILE * restrict fp, locale_t restrict loc, const char * restrict fmt0, va_list ap);
int __xvprintf(printf_comp_t restrict pc, printf_domain_t restrict domain, FILE * restrict fp, locale_t restrict loc, const char * restrict fmt0, va_list ap);
extern int __use_xprintf;
printf_arginfo_function __printf_arginfo_pct;
printf_render __printf_render_pct;
printf_arginfo_function __printf_arginfo_n;
printf_function __printf_render_n;
#ifdef VECTORS
printf_render __xprintf_vector;
#endif /* VECTORS */
#ifdef XPRINTF_PERF
#define CALLOC(x,y) xprintf_calloc((x),(y))
#define MALLOC(x) xprintf_malloc((x))
void *xprintf_calloc(size_t, size_t) __attribute__((__malloc__));
void *xprintf_malloc(size_t) __attribute__((__malloc__));
#else /* !XPRINTF_PERF */
#define CALLOC(x,y) calloc((x),(y))
#define MALLOC(x) malloc((x))
#endif /* !XPRINTF_PERF */
/* xprintf_domain.c */
void __xprintf_domain_init(void);
extern pthread_once_t __xprintf_domain_once;
#ifdef XPRINTF_DEBUG
extern printf_domain_t xprintf_domain_global;
#endif
#ifdef XPRINTF_PERF
struct array; /* forward reference */
void arrayfree(struct array *);
#endif
#define xprintf_domain_init() pthread_once(&__xprintf_domain_once, __xprintf_domain_init)
/* xprintf_errno.c */
printf_arginfo_function __printf_arginfo_errno;
printf_render __printf_render_errno;
/* xprintf_float.c */
printf_arginfo_function __printf_arginfo_float;
printf_render __printf_render_float;
/* xprintf_hexdump.c */
printf_arginfo_function __printf_arginfo_hexdump;
printf_render __printf_render_hexdump;
/* xprintf_int.c */
printf_arginfo_function __printf_arginfo_ptr;
printf_arginfo_function __printf_arginfo_int;
printf_render __printf_render_ptr;
printf_render __printf_render_int;
/* xprintf_quoute.c */
printf_arginfo_function __printf_arginfo_quote;
printf_render __printf_render_quote;
/* xprintf_str.c */
printf_arginfo_function __printf_arginfo_chr;
printf_render __printf_render_chr;
printf_arginfo_function __printf_arginfo_str;
printf_render __printf_render_str;
/* xprintf_time.c */
printf_arginfo_function __printf_arginfo_time;
printf_render __printf_render_time;
/* xprintf_vis.c */
printf_arginfo_function __printf_arginfo_vis;
printf_render __printf_render_vis;
#ifdef XPRINTF_PERF
struct array; /* forward reference */
#endif /* XPRINTF_PERF */
struct _printf_compiled {
pthread_mutex_t mutex;
#ifdef XPRINTF_PERF
struct array *aa;
struct array *pa;
struct array *ua;
#endif /* XPRINTF_PERF */
const char *fmt;
printf_domain_t domain;
locale_t loc;
struct printf_info *pi;
struct printf_info *pil;
int *argt;
union arg *args;
int maxarg;
};
#define XPRINTF_PLAIN ((printf_comp_t)-1)
int __printf_comp(printf_comp_t restrict, printf_domain_t restrict);
int __printf_exec(printf_comp_t restrict, FILE * restrict, va_list);
#ifdef XPRINTF_PERF
void arg_type_enqueue(struct array *);
void print_info_enqueue(struct array *);
void union_arg_enqueue(struct array *);
#endif /* XPRINTF_PERF */
#endif /* !_XPRINTF_PRIVATE_H_ */
|
#ifndef _DTX_STM32F1_JTAG_H_
#define _DTX_STM32F1_JTAG_H_
#include "common.h"
#include "../rcc.h"
static inline void DisableJTAG()
{
rcc_periph_clock_enable(RCC_AFIO);
AFIO_MAPR = (AFIO_MAPR & ~AFIO_MAPR_SWJ_MASK) | AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF;
gpio_set_mode(GPIO_BANK_JTMS_SWDIO, GPIO_MODE_OUTPUT_50_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO_JTMS_SWDIO);
gpio_set(GPIO_BANK_JTMS_SWDIO, GPIO_JTMS_SWDIO);
gpio_set_mode(GPIO_BANK_JTCK_SWCLK, GPIO_MODE_OUTPUT_50_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO_JTCK_SWCLK);
gpio_set(GPIO_BANK_JTCK_SWCLK, GPIO_JTCK_SWCLK);
}
#endif // _DTX_STM32F1_JTAG_H_
|
// -*- c++ -*-
/*
* Copyright (C) 2011 Hans Vandierendonck (hvandierendonck@acm.org)
* Copyright (C) 2011 Dimitrios S. Nikolopoulos (dsn@ics.forth.gr)
*
* This file is part of Swan.
*
* Swan 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.
*
* Swan 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 Swan. If not, see <http://www.gnu.org/licenses/>.
*/
/* queue/taskgraph.h
* This file implements a minimal taskgraph as it applies to queues.
*/
#ifndef QUEUE_TASKGRAPH_H
#define QUEUE_TASKGRAPH_H
#include "swan/wf_frames.h"
#include "swan/lock.h"
#include "swan/padding.h"
namespace obj {
// ----------------------------------------------------------------------
// queue_tags: tag storage for queue dependency usage types
// ----------------------------------------------------------------------
class task_metadata;
// queue_tags stores the accessed generation and links the task on the task list.
// Required for queue types
class queue_tags {
task_metadata * st_task;
queue_tags * qt_next;
friend class queue_metadata;
};
// ----------------------------------------------------------------------
// queue_metadata: dependency-tracking metadata for queues
// ----------------------------------------------------------------------
class queue_metadata {
typedef cas_mutex_v<uint8_t> mutex_t;
queue_tags * youngest;
mutex_t mutex;
private:
void lock() { mutex.lock(); }
void unlock() { mutex.unlock(); }
public:
queue_metadata() : youngest( 0 ) { }
~queue_metadata() {
assert( !youngest && "Must have finished all tasks when "
"destructing queue_metadata" );
}
// Register users of this queue.
void add_task( task_metadata * t, queue_tags * tags );
// Erase links if we are about to destroy a task
void del_task( task_metadata * fr, queue_tags * tags );
bool has_tasks() const { return youngest != 0; }
};
// ----------------------------------------------------------------------
// Queue dependency tags
// ----------------------------------------------------------------------
// Popdep (input) dependency tags - fully serialized with other pop and pushpop
class popdep_tags : public popdep_tags_base<queue_metadata>,
public queue_tags {
public:
popdep_tags( queue_version<queue_metadata> * parent )
: popdep_tags_base( parent ) { }
};
// Pushpopdep (input/output) dependency tags - fully serialized with other
// pop and pushpop
class pushpopdep_tags : public pushpopdep_tags_base<queue_metadata>,
public queue_tags {
public:
pushpopdep_tags( queue_version<queue_metadata> * parent )
: pushpopdep_tags_base( parent ) { }
};
// Pushdep (output) dependency tags
class pushdep_tags : public pushdep_tags_base<queue_metadata> {
public:
pushdep_tags( queue_version<queue_metadata> * parent )
: pushdep_tags_base( parent ) { }
};
// ----------------------------------------------------------------------
// Dependency handling traits
// ----------------------------------------------------------------------
// queue pop dependency traits
template<>
struct dep_traits<queue_metadata, task_metadata, popdep> {
template<typename T>
static void
arg_issue( task_metadata * fr, popdep<T> & obj,
typename popdep<T>::dep_tags * tags ) {
queue_metadata * md = obj.get_version()->get_metadata();
md->add_task( fr, tags );
}
template<typename T>
static bool
arg_ini_ready( const popdep<T> & obj ) {
const queue_metadata * md = obj.get_version()->get_metadata();
return !md->has_tasks();
}
template<typename T>
static void
arg_release( task_metadata * fr, popdep<T> & obj,
typename popdep<T>::dep_tags & tags ) {
queue_metadata * md = obj.get_version()->get_metadata();
md->del_task( fr, &tags );
}
};
// queue push dependency traits
template<>
struct dep_traits<queue_metadata, task_metadata, pushdep> {
template<typename T>
static void arg_issue( task_metadata * fr, pushdep<T> & obj,
typename pushdep<T>::dep_tags * sa ) {
}
template<typename T>
static bool arg_ini_ready( const pushdep<T> & obj ) {
return true;
}
template<typename T>
static void arg_release( task_metadata * fr, pushdep<T> & obj,
typename pushdep<T>::dep_tags & sa ) {
}
};
} // end of namespace obj
#endif // QUEUE_TASKGRAPH_H
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "PDU-definitions"
* found in "../asn/PDU-definitions.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#include "SystemInformationChangeIndication-v860ext-IEs.h"
static asn_TYPE_member_t asn_MBR_SystemInformationChangeIndication_v860ext_IEs_1[] = {
{ ATF_POINTER, 1, offsetof(struct SystemInformationChangeIndication_v860ext_IEs, etws_Information),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_ETWS_Information,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"etws-Information"
},
};
static int asn_MAP_SystemInformationChangeIndication_v860ext_IEs_oms_1[] = { 0 };
static ber_tlv_tag_t asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_SystemInformationChangeIndication_v860ext_IEs_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* etws-Information at 9476 */
};
static asn_SEQUENCE_specifics_t asn_SPC_SystemInformationChangeIndication_v860ext_IEs_specs_1 = {
sizeof(struct SystemInformationChangeIndication_v860ext_IEs),
offsetof(struct SystemInformationChangeIndication_v860ext_IEs, _asn_ctx),
asn_MAP_SystemInformationChangeIndication_v860ext_IEs_tag2el_1,
1, /* Count of tags in the map */
asn_MAP_SystemInformationChangeIndication_v860ext_IEs_oms_1, /* Optional members */
1, 0, /* Root/Additions */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_SystemInformationChangeIndication_v860ext_IEs = {
"SystemInformationChangeIndication-v860ext-IEs",
"SystemInformationChangeIndication-v860ext-IEs",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
SEQUENCE_decode_uper,
SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1,
sizeof(asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1)
/sizeof(asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1[0]), /* 1 */
asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1, /* Same as above */
sizeof(asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1)
/sizeof(asn_DEF_SystemInformationChangeIndication_v860ext_IEs_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
asn_MBR_SystemInformationChangeIndication_v860ext_IEs_1,
1, /* Elements count */
&asn_SPC_SystemInformationChangeIndication_v860ext_IEs_specs_1 /* Additional specs */
};
|
/*
* Process Hacker -
* National Language Support functions
*
* This file is part of Process Hacker.
*
* Process Hacker 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.
*
* Process Hacker 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 Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NTNLS_H
#define _NTNLS_H
#define MAXIMUM_LEADBYTES 12
typedef struct _CPTABLEINFO
{
USHORT CodePage;
USHORT MaximumCharacterSize;
USHORT DefaultChar;
USHORT UniDefaultChar;
USHORT TransDefaultChar;
USHORT TransUniDefaultChar;
USHORT DBCSCodePage;
UCHAR LeadByte[MAXIMUM_LEADBYTES];
PUSHORT MultiByteTable;
PVOID WideCharTable;
PUSHORT DBCSRanges;
PUSHORT DBCSOffsets;
} CPTABLEINFO, *PCPTABLEINFO;
typedef struct _NLSTABLEINFO
{
CPTABLEINFO OemTableInfo;
CPTABLEINFO AnsiTableInfo;
PUSHORT UpperCaseTable;
PUSHORT LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO;
#if (PHNT_MODE != PHNT_MODE_KERNEL)
NTSYSAPI USHORT NlsAnsiCodePage;
NTSYSAPI BOOLEAN NlsMbCodePageTag;
NTSYSAPI BOOLEAN NlsMbOemCodePageTag;
#endif
#endif
|
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file portab.h
* @brief Application portability macros and structures.
*
* @addtogroup application_portability
* @{
*/
#ifndef PORTAB_H
#define PORTAB_H
/*===========================================================================*/
/* Module constants. */
/*===========================================================================*/
#define PORTAB_LINE_LED1 LINE_LED1
#define PORTAB_LINE_LED2 LINE_LED2
#define PORTAB_LED_OFF PAL_LOW
#define PORTAB_LED_ON PAL_HIGH
#define PORTAB_LINE_BUTTON LINE_BUTTON
#define PORTAB_BUTTON_PRESSED PAL_HIGH
#define PORTAB_SD1 LPSD1
#define PORTAB_DAC_TRIG 5
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Module data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Module macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
void portab_setup(void);
#ifdef __cplusplus
}
#endif
/*===========================================================================*/
/* Module inline functions. */
/*===========================================================================*/
#endif /* PORTAB_H */
/** @} */
|
/*----------------------------------------------------------------------------
* CMSIS-RTOS - RTX
*----------------------------------------------------------------------------
* Name: RT_TASK.H
* Purpose: Task functions and system start up.
* Rev.: V4.79
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - 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 ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND 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.
*---------------------------------------------------------------------------*/
/* Definitions */
/* Values for 'state' */
#define INACTIVE 0U
#define READY 1U
#define RUNNING 2U
#define WAIT_DLY 3U
#define WAIT_ITV 4U
#define WAIT_OR 5U
#define WAIT_AND 6U
#define WAIT_SEM 7U
#define WAIT_MBX 8U
#define WAIT_MUT 9U
/* Return codes */
#define OS_R_TMO 0x01U
#define OS_R_EVT 0x02U
#define OS_R_SEM 0x03U
#define OS_R_MBX 0x04U
#define OS_R_MUT 0x05U
#define OS_R_OK 0x00U
#define OS_R_NOK 0xFFU
/* Variables */
extern struct OS_TSK os_tsk;
extern struct OS_TCB os_idle_TCB;
/* Functions */
extern void rt_switch_req (P_TCB p_new);
extern void rt_dispatch (P_TCB next_TCB);
extern void rt_block (U16 timeout, U8 block_state);
extern void rt_tsk_pass (void);
extern OS_TID rt_tsk_self (void);
extern OS_RESULT rt_tsk_prio (OS_TID task_id, U8 new_prio);
extern OS_TID rt_tsk_create (FUNCP task, U32 prio_stksz, void *stk, void *argv);
extern OS_RESULT rt_tsk_delete (OS_TID task_id);
#ifdef __CMSIS_RTOS
extern void rt_sys_init (void);
extern void rt_sys_start (void);
#else
extern void rt_sys_init (FUNCP first_task, U32 prio_stksz, void *stk);
#endif
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
|
/*
* SPDX-FileCopyrightText: 2008 Till Harbaum <till@harbaum.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <osm2go_i18n.h>
#include <osm2go_platform.h>
void error_dlg(trstring::arg_type msg, osm2go_platform::Widget *parent = nullptr);
void warning_dlg(trstring::arg_type msg, osm2go_platform::Widget *parent = nullptr);
void message_dlg(trstring::arg_type title, trstring::arg_type msg, osm2go_platform::Widget *parent = nullptr);
|
#ifndef OBJECT_H_
#define OBJECT_H_
#include "QGLViewer/frame.h"
class Object
{
public :
void draw() const;
qglviewer::Frame frame;
};
#endif // OBJECT_H_
|
/**
******************************************************************************
* @file SDIO/uSDCard/stm32l1xx_conf.h
* @author MCD Application Team
* @version V1.1.1
* @date 13-April-2012
* @brief Library configuration file.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32L1xx_CONF_H
#define __STM32L1xx_CONF_H
/* Includes ------------------------------------------------------------------*/
/* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */
#include "stm32l1xx_adc.h"
#include "stm32l1xx_aes.h"
#include "stm32l1xx_comp.h"
#include "stm32l1xx_crc.h"
#include "stm32l1xx_dac.h"
#include "stm32l1xx_dbgmcu.h"
#include "stm32l1xx_dma.h"
#include "stm32l1xx_exti.h"
#include "stm32l1xx_flash.h"
#include "stm32l1xx_fsmc.h"
#include "stm32l1xx_gpio.h"
#include "stm32l1xx_i2c.h"
#include "stm32l1xx_iwdg.h"
#include "stm32l1xx_lcd.h"
#include "stm32l1xx_opamp.h"
#include "stm32l1xx_pwr.h"
#include "stm32l1xx_rcc.h"
#include "stm32l1xx_rtc.h"
#include "stm32l1xx_sdio.h"
#include "stm32l1xx_spi.h"
#include "stm32l1xx_syscfg.h"
#include "stm32l1xx_tim.h"
#include "stm32l1xx_usart.h"
#include "stm32l1xx_wwdg.h"
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT 1 */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function which reports
* the name of the source file and the source line number of the call
* that failed. If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#endif /* __STM32L1xx_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "coreplugin/core_global.h"
QT_BEGIN_NAMESPACE
class QWidget;
QT_END_NAMESPACE
namespace Core {
struct CORE_EXPORT FileUtils
{
// Helpers for common directory browser options.
static void showInGraphicalShell(QWidget *parent, const QString &path);
static void openTerminal(const QString &path);
static QString msgFindInDirectory();
// Platform-dependent action descriptions
static QString msgGraphicalShellAction();
static QString msgTerminalAction();
// File operations aware of version control and file system case-insensitiveness
static void removeFile(const QString &filePath, bool deleteFromFS);
static bool renameFile(const QString &from, const QString &to);
};
} // namespace Core
|
#ifndef _SYSLIMITS_H
#define _SYSLIMITS_H
/* some POSIX definitions */
#define OPEN_MAX 8
#define PATH_MAX 256
#endif
|
#ifndef Settings_h
#define Settings_h
// EEPROM locations for parameters
#define CHANNEL_LOC 12 // int
#define PA_LEVEL_LOC 14 // int
#define DATA_RATE_LOC 16 // int
#define CAL_POS_1_LOC 18 // int
#define CAL_POS_2_LOC 20 // int
#define SAVED_POS_ARR_LOC 22 // int[4]
#define START_IN_CAL_LOC 30 // boolean
class Settings
{
public:
Settings();
void SetChannel(int val);
int GetChannel();
void SetPALevel(int val);
int GetPALevel();
void SetCalPos1(int val);
int GetCalPos1();
void SetCalPos2(int val);
int GetCalPos2();
void SetSavedPos(int val, int index);
int GetSavedPos(int index);
void SetStartInCal(int calSUp);
int GetStartInCal();
int GetDataRate();
private:
// any reason to save the state of the settings?
// or is it a one time read on boot up?
};
#endif // bsp_h
|
#include "includes.h"
#include "Expect.h"
//Values for 'flags' that are not visible to the user
//These must not clash with any visible values
#define DIALOG_DONE 67108864
void ExpectDialogAdd(ListNode *ExpectDialogs, char *Expect, char *Reply, int Flags)
{
TExpectDialog *ExpectDialog;
ExpectDialog=(TExpectDialog *) calloc(1,sizeof(TExpectDialog));
ExpectDialog->Expect=CopyStr(ExpectDialog->Expect,Expect);
ExpectDialog->Reply=CopyStr(ExpectDialog->Reply,Reply);
ExpectDialog->Flags=Flags;
ListAddItem(ExpectDialogs,ExpectDialog);
}
void ExpectDialogDestroy(void *p_Item)
{
TExpectDialog *ExpectDialog;
ExpectDialog=(TExpectDialog *) p_Item;
DestroyString(ExpectDialog->Expect);
DestroyString(ExpectDialog->Reply);
free(ExpectDialog);
}
int STREAMExpectDialog(STREAM *S, ListNode *ExpectDialogs)
{
int inchar;
ListNode *Curr;
TExpectDialog *ExpectDialog;
inchar=STREAMReadChar(S);
while (inchar !=EOF)
{
if (inchar > 0)
{
Curr=ListGetNext(ExpectDialogs);
while (Curr)
{
ExpectDialog=(TExpectDialog *) Curr->Item;
if (! (ExpectDialog->Flags & DIALOG_DONE))
{
//if the current value does not equal where we are in the string
//we have to consider whether it is the first character in the string
if (ExpectDialog->Expect[ExpectDialog->Match]!=inchar) ExpectDialog->Match=0;
if (ExpectDialog->Expect[ExpectDialog->Match]==inchar)
{
ExpectDialog->Match++;
if (ExpectDialog->Expect[ExpectDialog->Match]=='\0')
{
ExpectDialog->Match=0;
ExpectDialog->Flags |= DIALOG_DONE;
if (ExpectDialog->Reply)
{
//this is to allow programs that clear their buffers before reading to do that without throwing away our reply
usleep(10000);
STREAMWriteLine(ExpectDialog->Reply,S);
}
if (ExpectDialog->Flags & DIALOG_END) return(TRUE);
if (ExpectDialog->Flags & DIALOG_FAIL) return(FALSE);
}
}
if (! (ExpectDialog->Flags & DIALOG_OPTIONAL)) break;
}
Curr=ListGetNext(Curr);
}
}
inchar=STREAMReadChar(S);
}
return(FALSE);
}
int STREAMExpectAndReply(STREAM *S, const char *Expect, const char *Reply)
{
if (STREAMReadToString(S, NULL, NULL, Expect))
{
if (Reply)
{
STREAMWriteLine(Reply,S);
STREAMFlush(S);
}
return(TRUE);
}
return(FALSE);
}
int STREAMExpectSilence(STREAM *S, int wait)
{
int inchar;
int len=0, SavedTimeout;
SavedTimeout=S->Timeout;
S->Timeout=wait;
inchar=STREAMReadChar(S);
while (inchar > 0) inchar=STREAMReadChar(S);
S->Timeout=SavedTimeout;
return(FALSE);
}
|
/*
Copyright <SWGEmu>
See file COPYING for copying conditions.*/
#ifndef BETCOMMAND_H_
#define BETCOMMAND_H_
#include "server/zone/managers/minigames/GamblingManager.h"
#include "server/zone/objects/creature/CreatureObject.h"
#include "server/zone/Zone.h"
#include "server/zone/ZoneServer.h"
#include "server/zone/objects/scene/SceneObject.h"
#include "server/zone/objects/creature/CreatureObject.h"
#include "server/zone/packets/ui/SuiCreatePageMessage.h"
#include "server/chat/StringIdChatParameter.h"
class BetCommand : public QueueCommand {
public:
BetCommand(const String& name, ZoneProcessServer* server)
: QueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) const {
if (!checkStateMask(creature))
return INVALIDSTATE;
if (!checkInvalidLocomotions(creature))
return INVALIDLOCOMOTION;
return SUCCESS;
if (creature->isPlayerCreature()) {
CreatureObject* player = cast<CreatureObject*>(creature);
if (player == NULL)
return GENERALERROR;
GamblingManager* gamblingManager = server->getGamblingManager();
if (gamblingManager == NULL)
return GENERALERROR;
if (!gamblingManager->isPlaying(player)) {
player->sendSystemMessage("@gambling/default_interface:bet_failed");
return GENERALERROR;
}
try {
StringTokenizer args(arguments.toString());
if (args.hasMoreTokens()) {
int amount = args.getIntToken();
String bet;
args.getStringToken(bet);
bet.toLowerCase();
int targetBet = -1;
for (int i=0; i<gamblingManager->getRoulette()->size(); ++i) {
if (gamblingManager->getRoulette()->get(i)==bet) {
targetBet = i;
}
}
if (targetBet == -1) {
player->sendSystemMessage("@gambling/default_interface:bet_failed_amt");
return GENERALERROR;
}
gamblingManager->bet(player, amount, targetBet, 0);
}
} catch (Exception& e) {
player->sendSystemMessage("@gambling/default_interface:bet_failed_amt");
}
}
return SUCCESS;
}
};
#endif //BETCOMMAND_H_
|
/*
* Copyright (C) 2017 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @defgroup drivers_feetech Feetech driver
* @ingroup drivers_actuators
*
* This module contains drivers for any device using feetech's servomotors communication bus.
* The bus is mainly used for servomotors, but a device can be anything : sensors, other actuators.
*
* @{
*
* @file
* @brief Interface definition for Feetech devices driver
*
* @author Loïc Dauphin <loic.dauphin@inria.fr>
*/
#ifndef FEETECH_H
#define FEETECH_H
#include <stdlib.h>
#include "feetech_protocol.h"
#include "uart_half_duplex.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t feetech_id_t; /**< device id type */
typedef uint8_t feetech_addr_t; /**< address type */
/**
* @brief Descriptor struct for a feetech device
*/
typedef struct {
uart_half_duplex_t *stream; /**< the stream used */
feetech_id_t id; /**< the device address */
} feetech_t;
/**
* @brief Possible feetech return values
*/
enum {
FEETECH_OK, /**< Success */
FEETECH_TIMEOUT, /**< No response from the device */
FEETECH_BUFFER_TOO_SMALL, /**< Buffer is too small for the message */
FEETECH_INVALID_MESSAGE, /**< Invalid message received */
};
/**
* @brief Send a PING message to a device
*
* @param[in] stream the stream
* @param[in] id the device address
*
* @return FEETECH_OK if a device answered
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_ping(uart_half_duplex_t *stream, feetech_id_t id);
/**
* @brief Initialize a Feetech device
*
* @param[out] device the Feetech device
* @param[in] stream the stream
* @param[in] id the device address
*/
void feetech_init(feetech_t *device, uart_half_duplex_t *stream, feetech_id_t id);
/**
* @brief Write to a device 8bits address
*
* @param[in] device the Feetech device
* @param[in] addr the address to write
* @param[in] value the value to write
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_write8(feetech_t *device, feetech_addr_t addr, uint8_t value);
/**
* @brief Write to a device 16bits address
*
* @param[in] device the Feetech device
* @param[in] addr the address to write
* @param[in] value the value to write
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_write16(feetech_t *device, feetech_addr_t addr, uint16_t value);
/**
* @brief Write to a device address
*
* @param[in] device the Feetech device
* @param[in] addr the address to start write
* @param[in] data the data to write
* @param[in] length the data length
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_write(feetech_t *device, feetech_addr_t addr, const uint8_t *data, size_t length);
/**
* @brief Read from a device 8bits address
*
* @param[in] device the Feetech device
* @param[in] addr the address to read
* @param[out] value the value to read
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_read8(feetech_t *device, feetech_addr_t addr, uint8_t *value);
/**
* @brief Read from a device 16bits address
*
* @param[in] device the Feetech device
* @param[in] addr the address to read
* @param[out] value the value to read
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_read16(feetech_t *device, feetech_addr_t addr, uint16_t *value);
/**
* @brief Read from a device address
*
* @param[in] device the Feetech device
* @param[in] addr the address to start read
* @param[out] data the data buffer to fill
* @param[in] length the data length
*
* @return FEETECH_OK on success
* @return FEETECH_TIMEOUT if the device did not answer
* @return FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
* @return FEETECH_INVALID_MESSAGE if an invalid message was received
*/
int feetech_read(feetech_t *device, feetech_addr_t addr, uint8_t *data, size_t length);
#ifdef __cplusplus
}
#endif
#endif
/** @} */
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 Ruby-GNOME2 Project Team
* Copyright (C) 2005 Masao Mutoh
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
/* deprecated
#include "rbgdk3private.h"
#define RG_TARGET_NAMESPACE cPangoRenderer
#define _SELF(s) (RVAL2GDKPANGORENDERER(s))
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE screen;
GdkScreen* gscreen;
rb_scan_args(argc, argv, "01", &screen);
if (NIL_P(screen)){
gscreen = gdk_screen_get_default();
} else {
gscreen = RVAL2GDKSCREEN(screen);
}
G_INITIALIZE(self, gdk_pango_renderer_new(gscreen));
return Qnil;
}
static VALUE
rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
VALUE screen;
GdkScreen* gscreen;
rb_scan_args(argc, argv, "01", &screen);
if (NIL_P(screen)){
gscreen = gdk_screen_get_default();
} else {
gscreen = RVAL2GDKSCREEN(screen);
}
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
}
static VALUE
rg_s_default(G_GNUC_UNUSED VALUE self)
{
GdkScreen* gscreen = gdk_screen_get_default();
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
}
static VALUE
rg_set_drawable(VALUE self, VALUE drawable)
{
gdk_pango_renderer_set_drawable(_SELF(self),
RVAL2GDKDRAWABLE(drawable));
return self;
}
static VALUE
rg_set_gc(VALUE self, VALUE gc)
{
gdk_pango_renderer_set_gc(_SELF(self),
NIL_P(gc) ? NULL : RVAL2GDKGC(gc));
return self;
}
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
static VALUE
rg_set_stipple(VALUE self, VALUE part, VALUE stipple)
{
gdk_pango_renderer_set_stipple(_SELF(self), RVAL2PANGORENDERPART(part),
NIL_P(stipple) ? NULL : RVAL2GDKBITMAP(stipple));
return self;
}
#else
static VALUE
prenderer_set_stipple(G_GNUC_UNUSED VALUE self,
G_GNUC_UNUSED VALUE part,
G_GNUC_UNUSED VALUE stipple)
{
rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
return self;
}
#endif
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
static VALUE
rg_set_override_color(VALUE self, VALUE part, VALUE color)
{
gdk_pango_renderer_set_override_color(_SELF(self),
RVAL2PANGORENDERPART(part),
RVAL2GDKCOLOR(color));
return self;
}
#else
static VALUE
prenderer_set_override_color(G_GNUC_UNUSED VALUE self,
G_GNUC_UNUSED VALUE part,
G_GNUC_UNUSED VALUE color)
{
rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
return self;
}
#endif
void
Init_gdk_pangorenderer(VALUE mGdk)
{
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
RG_DEF_METHOD(initialize, -1);
RG_DEF_METHOD(set_drawable, 1);
RG_DEF_METHOD(set_gc, 1);
RG_DEF_METHOD(set_stipple, 2);
RG_DEF_METHOD(set_override_color, 2);
RG_DEF_SMETHOD(get_default, -1);
RG_DEF_SMETHOD(default, 0);
}
*/
|
/*
* (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef InlineTextBox_h
#define InlineTextBox_h
#include "InlineBox.h"
#include "RenderText.h" // so textRenderer() can be inline
namespace WebCore {
struct CompositionUnderline;
const unsigned short cNoTruncation = USHRT_MAX;
const unsigned short cFullTruncation = USHRT_MAX - 1;
// Helper functions shared by InlineTextBox / SVGRootInlineBox
void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color& strokeColor, float strokeThickness, ColorSpace);
Color correctedTextColor(Color textColor, Color backgroundColor);
class InlineTextBox : public InlineBox {
public:
InlineTextBox(RenderObject* obj)
: InlineBox(obj)
, m_prevTextBox(0)
, m_nextTextBox(0)
, m_start(0)
, m_len(0)
, m_truncation(cNoTruncation)
{
}
InlineTextBox* prevTextBox() const { return m_prevTextBox; }
InlineTextBox* nextTextBox() const { return m_nextTextBox; }
void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
unsigned start() const { return m_start; }
unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
unsigned len() const { return m_len; }
void setStart(unsigned start) { m_start = start; }
void setLen(unsigned len) { m_len = len; }
void offsetRun(int d) { m_start += d; }
void setFallbackFonts(const HashSet<const SimpleFontData*>&);
void takeFallbackFonts(Vector<const SimpleFontData*>&);
unsigned short truncation() { return m_truncation; }
private:
virtual int selectionTop();
virtual int selectionHeight();
public:
virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
bool isSelected(int startPos, int endPos) const;
void selectionStartEnd(int& sPos, int& ePos);
private:
virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
public:
RenderText* textRenderer() const;
private:
virtual void deleteLine(RenderArena*);
virtual void extractLine();
virtual void attachLine();
public:
virtual RenderObject::SelectionState selectionState();
private:
virtual void clearTruncation() { m_truncation = cNoTruncation; }
virtual int placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int visibleRightEdge, int ellipsisWidth, bool& foundBox);
public:
virtual bool isLineBreak() const;
void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; }
private:
virtual bool isInlineTextBox() { return true; }
public:
virtual int caretMinOffset() const;
virtual int caretMaxOffset() const;
private:
virtual unsigned caretMaxRenderedOffset() const;
int textPos() const;
public:
virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
virtual int positionForOffset(int offset) const;
bool containsCaretOffset(int offset) const; // false for offset after line break
private:
InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderObject
InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObject
int m_start;
unsigned short m_len;
unsigned short m_truncation; // Where to truncate when text overflow is applied. We use special constants to
// denote no truncation (the whole run paints) and full truncation (nothing paints at all).
protected:
void paintCompositionBackground(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, int startPos, int endPos);
void paintDocumentMarkers(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, bool background);
void paintCompositionUnderline(GraphicsContext*, int tx, int ty, const CompositionUnderline&);
#if PLATFORM(MAC)
void paintCustomHighlight(int tx, int ty, const AtomicString& type);
#endif
private:
void paintDecoration(GraphicsContext*, int tx, int ty, int decoration, ShadowData*);
void paintSelection(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&);
void paintSpellingOrGrammarMarker(GraphicsContext*, int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&, bool grammar);
void paintTextMatchMarker(GraphicsContext*, int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&);
void computeRectForReplacementMarker(int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&);
};
inline RenderText* InlineTextBox::textRenderer() const
{
return toRenderText(renderer());
}
} // namespace WebCore
#endif // InlineTextBox_h
|
#define LIBUSB_NANO 10920
|
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class MITShuttleDataSource;
extern NSString* const MITMobileErrorOwnerDeallocatedErrorFormat;
extern NSUInteger const MITMobileOwnerDeallocatedError;
extern NSError* MITDispatcherDeallocatedError(void *block);
@interface MITShuttleDataSource : NSObject <NSCopying>
@property(nonatomic) NSTimeInterval expiryInterval;
#pragma mark - For subclasses
@property(nonatomic,readonly) BOOL didFetchResults;
@property(nonatomic,strong) NSDate *fetchDate;
@property(nonatomic,strong) NSError *lastRequestError;
@property(nonatomic,strong) NSManagedObjectContext *managedObjectContext;
@property(nonatomic,strong) NSFetchedResultsController *fetchedResultsController;
@property(nonatomic,strong) NSOperationQueue *completionQueue;
@property(nonatomic,getter=isRequestActive) BOOL requestActive;
- (BOOL)needsUpdateFromServer;
- (void)_enqueueRequestCompletionBlock:(void (^)(void))block;
- (void)_performAsynchronousFetch:(void(^)(NSFetchedResultsController *fetchedResultsController, NSError *error))fetchCompletion;
@end
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "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 Nokia Corporation and its Subsidiary(-ies) 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."
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef NOTE_H
#define NOTE_H
#include <QObject>
#include <QDateTime>
class Note : public QObject
{
Q_OBJECT
Q_PROPERTY(int index READ index WRITE setIndex)
Q_PROPERTY(QString message READ message WRITE setMessage)
Q_PROPERTY(QDateTime alarm READ alarm WRITE setAlarm)
public:
Note(QObject *parent =0) : QObject(parent) {}
~Note() {}
public slots:
int index() const { return m_index; }
void setIndex(int index) { m_index = index; }
QString message() const { return m_message; }
void setMessage(const QString &message) { m_message = message; }
QDateTime alarm() const { return m_alarm; }
void setAlarm(const QDateTime &alarm) { m_alarm = alarm; }
private:
int m_index;
QString m_message;
QDateTime m_alarm;
};
#endif
|
/*
* Copyright (C) Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @{
*
* @file
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#include "lwip/tcpip.h"
#include "lwip/netif/netdev2.h"
#include "lwip/netif.h"
#include "netif/lowpan6.h"
#ifdef MODULE_NETDEV2_TAP
#include "netdev2_tap.h"
#include "netdev2_tap_params.h"
#endif
#ifdef MODULE_AT86RF2XX
#include "at86rf2xx.h"
#include "at86rf2xx_params.h"
#endif
#include "lwip.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
#ifdef MODULE_NETDEV2_TAP
#define LWIP_NETIF_NUMOF (NETDEV2_TAP_MAX)
#endif
#ifdef MODULE_AT86RF2XX /* is mutual exclusive with above ifdef */
#define LWIP_NETIF_NUMOF (sizeof(at86rf2xx_params) / sizeof(at86rf2xx_params[0]))
#endif
#ifdef LWIP_NETIF_NUMOF
static struct netif netif[LWIP_NETIF_NUMOF];
#endif
#ifdef MODULE_NETDEV2_TAP
static netdev2_tap_t netdev2_taps[LWIP_NETIF_NUMOF];
#endif
#ifdef MODULE_AT86RF2XX
static at86rf2xx_t at86rf2xx_devs[LWIP_NETIF_NUMOF];
#endif
void lwip_bootstrap(void)
{
/* TODO: do for every eligable netdev2 */
#ifdef LWIP_NETIF_NUMOF
#ifdef MODULE_NETDEV2_TAP
for (int i = 0; i < LWIP_NETIF_NUMOF; i++) {
netdev2_tap_setup(&netdev2_taps[i], &netdev2_tap_params[i]);
if (netif_add(&netif[i], &netdev2_taps[i], lwip_netdev2_init,
tcpip_input) == NULL) {
DEBUG("Could not add netdev2_tap device\n");
return;
}
}
#elif defined(MODULE_AT86RF2XX)
for (int i = 0; i < LWIP_NETIF_NUMOF; i++) {
at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]);
if (netif_add(&netif[i], &at86rf2xx_devs[i], lwip_netdev2_init,
tcpip_6lowpan_input) == NULL) {
DEBUG("Could not add at86rf2xx device\n");
return;
}
}
#endif
if (netif[0].state != NULL) {
/* state is set to a netdev2_t in the netif_add() functions above */
netif_set_default(&netif[0]);
}
#endif
/* also allow for external interface definition */
tcpip_init(NULL, NULL);
}
/** @} */
|
#pragma once
#include <stddef.h>
#include <ucontext.h>
#include <functional>
#include <exception>
#include <vector>
#include <list>
#include "ts_queue.h"
#include "timer.h"
namespace co
{
enum class TaskState
{
runnable,
io_block, // write, writev, read, select, poll, ...
sys_block, // co_mutex, ...
user_block, // user switch it.
sleep, // sleep nanosleep poll(NULL, 0, timeout)
done,
fatal,
};
typedef std::function<void()> TaskF;
struct FdStruct;
struct Task;
struct EpollPtr
{
FdStruct* fdst = NULL;
Task* tk = NULL;
uint32_t io_block_id = 0;
uint32_t revent = 0; // 结果event
};
struct FdStruct
{
int fd;
uint32_t event; // epoll event flags.
EpollPtr epoll_ptr; // 传递入epoll的指针
FdStruct() : fd(-1), event(0) {
epoll_ptr.fdst = this;
}
};
class BlockObject;
struct Task
: public TSQueueHook
{
uint64_t id_;
TaskState state_;
uint64_t yield_count_;
ucontext_t ctx_;
TaskF fn_;
char* stack_;
std::string debug_info_;
std::exception_ptr eptr_; // 保存exception的指针
std::atomic<uint32_t> ref_count_; // 引用计数
std::atomic<uint32_t> io_block_id_; // 每次io_block请求分配一个ID
std::vector<FdStruct> wait_fds_; // io_block等待的fd列表
uint32_t wait_successful_; // io_block成功等待到的fd数量(用于poll和select)
LFLock io_block_lock_; // 当等待的fd多余1个时, 用此锁sync添加到epoll和从epoll删除的操作, 以防在epoll中残留fd, 导致Task无法释放.
int io_block_timeout_;
CoTimerPtr io_block_timer_;
int64_t user_wait_type_; // user_block等待的类型
uint64_t user_wait_id_; // user_block等待的id
BlockObject* block_; // sys_block等待的block对象
int sleep_ms_; // 睡眠时间
explicit Task(TaskF const& fn, int stack_size);
~Task();
void SetDebugInfo(std::string const& info);
const char* DebugInfo();
static uint64_t s_id;
static std::atomic<uint64_t> s_task_count;
void IncrementRef();
void DecrementRef();
static uint64_t GetTaskCount();
// Task引用计数归0时不要立即释放, 以防epoll_wait取到残余数据时访问野指针.
typedef std::list<Task*> DeleteList;
static DeleteList s_delete_list;
static LFLock s_delete_list_lock;
static void SwapDeleteList(DeleteList &output);
static std::size_t GetDeletedTaskCount();
};
class RefGuard
{
public:
explicit RefGuard(Task* tk);
explicit RefGuard(Task& tk);
~RefGuard();
RefGuard(RefGuard const&) = delete;
RefGuard& operator=(RefGuard const&) = delete;
private:
Task *tk_;
};
} //namespace co
|
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2013, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* ---------------------------------------------------------------------------- */
#ifndef _SAM4S_CMCC_INSTANCE_
#define _SAM4S_CMCC_INSTANCE_
/* ========== Register definition for CMCC peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_CMCC_TYPE (0x4007C000U) /**< \brief (CMCC) Cache Type Register */
#define REG_CMCC_CFG (0x4007C004U) /**< \brief (CMCC) Cache Configuration Register */
#define REG_CMCC_CTRL (0x4007C008U) /**< \brief (CMCC) Cache Control Register */
#define REG_CMCC_SR (0x4007C00CU) /**< \brief (CMCC) Cache Status Register */
#define REG_CMCC_MAINT0 (0x4007C020U) /**< \brief (CMCC) Cache Maintenance Register 0 */
#define REG_CMCC_MAINT1 (0x4007C024U) /**< \brief (CMCC) Cache Maintenance Register 1 */
#define REG_CMCC_MCFG (0x4007C028U) /**< \brief (CMCC) Cache Monitor Configuration Register */
#define REG_CMCC_MEN (0x4007C02CU) /**< \brief (CMCC) Cache Monitor Enable Register */
#define REG_CMCC_MCTRL (0x4007C030U) /**< \brief (CMCC) Cache Monitor Control Register */
#define REG_CMCC_MSR (0x4007C034U) /**< \brief (CMCC) Cache Monitor Status Register */
#else
#define REG_CMCC_TYPE (*(__I uint32_t*)0x4007C000U) /**< \brief (CMCC) Cache Type Register */
#define REG_CMCC_CFG (*(__IO uint32_t*)0x4007C004U) /**< \brief (CMCC) Cache Configuration Register */
#define REG_CMCC_CTRL (*(__O uint32_t*)0x4007C008U) /**< \brief (CMCC) Cache Control Register */
#define REG_CMCC_SR (*(__I uint32_t*)0x4007C00CU) /**< \brief (CMCC) Cache Status Register */
#define REG_CMCC_MAINT0 (*(__O uint32_t*)0x4007C020U) /**< \brief (CMCC) Cache Maintenance Register 0 */
#define REG_CMCC_MAINT1 (*(__O uint32_t*)0x4007C024U) /**< \brief (CMCC) Cache Maintenance Register 1 */
#define REG_CMCC_MCFG (*(__IO uint32_t*)0x4007C028U) /**< \brief (CMCC) Cache Monitor Configuration Register */
#define REG_CMCC_MEN (*(__IO uint32_t*)0x4007C02CU) /**< \brief (CMCC) Cache Monitor Enable Register */
#define REG_CMCC_MCTRL (*(__O uint32_t*)0x4007C030U) /**< \brief (CMCC) Cache Monitor Control Register */
#define REG_CMCC_MSR (*(__I uint32_t*)0x4007C034U) /**< \brief (CMCC) Cache Monitor Status Register */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* _SAM4S_CMCC_INSTANCE_ */
|
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3D_QPOSTMAN_P_H
#define QT3D_QPOSTMAN_P_H
#include <Qt3DCore/private/qobserverinterface_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3D {
class QScene;
class QPostmanPrivate;
class QT3DCORE_PRIVATE_EXPORT QAbstractPostman : public QObserverInterface
{
public:
virtual void setScene(QScene *sceneLookup) = 0;
virtual void notifyBackend(const QSceneChangePtr &change) = 0;
};
class QPostman Q_DECL_FINAL
: public QObject
, public QAbstractPostman
{
Q_OBJECT
public:
explicit QPostman(QObject *parent = 0);
void setScene(QScene *sceneLookup) Q_DECL_FINAL;
void sceneChangeEvent(const QSceneChangePtr &e) Q_DECL_FINAL;
void notifyBackend(const QSceneChangePtr &change) Q_DECL_FINAL;
private Q_SLOTS:
void submitChangeBatch();
private:
Q_DECLARE_PRIVATE(QPostman)
Q_INVOKABLE void notifyFrontendNode(const QSceneChangePtr &e);
};
} // Qt3D
QT_END_NAMESPACE
Q_DECLARE_METATYPE(Qt3D::QAbstractPostman*)
#endif // QT3D_QPOSTMAN_P_H
|
#ifndef __S3UPLOADER_H__
#define __S3UPLOADER_H__
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <iostream>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cstring>
using std::vector;
#include <curl/curl.h>
#include "S3Common.h"
struct Uploader {
Uploader();
~Uploader();
bool init(const char *data, S3Credential *cred);
bool write(char *buf, uint64_t &len);
void destroy();
private:
// pthread_t* threads;
};
const char *GetUploadId(const char *host, const char *bucket,
const char *obj_name, const S3Credential &cred);
const char *PartPutS3Object(const char *host, const char *bucket,
const char *obj_name, const S3Credential &cred,
const char *data, uint64_t data_size,
uint64_t part_number, const char *upload_id);
bool CompleteMultiPutS3(const char *host, const char *bucket,
const char *obj_name, const char *upload_id,
const char **etag_array, uint64_t count,
const S3Credential &cred);
#endif
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkNumericTraitsStdVector_h
#define __itkNumericTraitsStdVector_h
#include "itkNumericTraits.h"
#include <vector>
// This work is part of the National Alliance for Medical Image Computing
// (NAMIC), funded by the National Institutes of Health through the NIH Roadmap
// for Medical Research, Grant U54 EB005149.
namespace itk
{
/**
* \brief Define numeric traits for std::vector.
* \tparam T Component type of std::vector
*
* We provide here a generic implementation based on creating types of
* std::vector whose components are the types of the NumericTraits from
* the original std::vector components. This implementation require
* support for partial specializations, since it is based on the
* concept that:
* NumericTraits<std::vector< T > > is defined piecewise by
* std::vector< NumericTraits< T > >
*
* \note The Zero(), One(), min() and max() methods here take
* references to a pixel as input. This is due to the fact that the
* length of the std::vector is not known until
* run-time. Since the most common use of Zero and One is for
* comparison purposes or initialization of sums etc, this might just
* as easily be re-written with a pixel passed in as a reference and
* the length is inferred from this pixel.
*
* \sa NumericTraits
* \ingroup DataRepresentation
* \ingroup ITK-Common
*/
template< typename T >
class NumericTraits< std::vector< T > >
{
public:
typedef typename NumericTraits< T >::AbsType ElementAbsType;
typedef typename NumericTraits< T >::AccumulateType ElementAccumulateType;
typedef typename NumericTraits< T >::FloatType ElementFloatType;
typedef typename NumericTraits< T >::PrintType ElementPrintType;
typedef typename NumericTraits< T >::RealType ElementRealType;
/** Return the type of the native component type. */
typedef T ValueType;
typedef std::vector< T > Self;
/** Unsigned component type */
typedef std::vector< ElementAbsType > AbsType;
/** Accumulation of addition and multiplication. */
typedef std::vector< ElementAccumulateType > AccumulateType;
/** Typedef for operations that use floating point instead of real precision
*/
typedef std::vector< ElementFloatType > FloatType;
// TODO: this won't really print well, at least not without defining an operator
// to push to a stream.
/** Return the type that can be printed. */
typedef std::vector< ElementPrintType > PrintType;
/** Type for real-valued scalar operations. */
typedef std::vector< ElementRealType > RealType;
/** Type for real-valued scalar operations. */
typedef ElementRealType ScalarRealType;
/** Measurement vector type */
typedef Self MeasurementVectorType;
/** Component wise defined element
*
* \note minimum value for floating pointer types is defined as
* minimum positive normalize value.
*/
static const Self max(const Self & a)
{
Self b( a.Size(), NumericTraits< T >::max() );
return b;
}
static const Self min(const Self & a)
{
Self b( a.Size(), NumericTraits< T >::min() );
return b;
}
static const Self ZeroValue(const Self & a)
{
Self b( a.Size(), NumericTraits< T >::Zero );
return b;
}
static const Self OneValue(const Self & a)
{
Self b( a.Size(), NumericTraits< T >::One );
return b;
}
static const Self NonpositiveMin(const Self & a)
{
Self b( a.Size(), NumericTraits< T >::NonpositiveMin() );
return b;
}
/** Resize the input vector to the specified size */
static void SetLength(std::vector< T > & m, const unsigned int s)
{
m.resize(s);
}
/** Return the size of the vector. */
static unsigned int GetLength(const std::vector< T > & m)
{
return m.size();
}
static void AssignToArray( const Self & v, MeasurementVectorType & mv )
{
mv = v;
}
template<class TArray>
static void AssignToArray( const Self & v, TArray & mv )
{
for( unsigned int i=0; i<GetLength(v); i++ )
{
mv[i] = v[i];
}
}
};
} // end namespace itk
#endif // __itkNumericTraitsStdVector_h
|
#ifndef ZMAP_SHARD_H
#define ZMAP_SHARD_H
#include <stdint.h>
#include "cyclic.h"
typedef void (*shard_complete_cb)(uint8_t id, void *arg);
typedef struct shard {
struct shard_state {
uint32_t sent;
uint32_t blacklisted;
uint32_t failures;
uint32_t first_scanned;
uint32_t max_targets;
} state;
struct shard_params {
uint64_t first;
uint64_t last;
uint64_t factor;
uint64_t modulus;
} params;
uint64_t current;
uint8_t id;
shard_complete_cb cb;
void *arg;
} shard_t;
void shard_init(shard_t* shard,
uint8_t shard_id,
uint8_t num_shards,
uint8_t sub_id,
uint8_t num_subshard,
const cycle_t* cycle,
shard_complete_cb cb,
void *arg);
uint32_t shard_get_cur_ip(shard_t *shard);
uint32_t shard_get_next_ip(shard_t *shard);
#endif /* ZMAP_SHARD_H */
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class ApplianceModeSupportValue
{
NOT_SET,
enable,
disable
};
namespace ApplianceModeSupportValueMapper
{
AWS_EC2_API ApplianceModeSupportValue GetApplianceModeSupportValueForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForApplianceModeSupportValue(ApplianceModeSupportValue value);
} // namespace ApplianceModeSupportValueMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-9-16 GuEe-GUI the first version
*/
#ifndef DRV_VIRTIO_BLK_H__
#define DRV_VIRTIO_BLK_H__
#include <rthw.h>
#include <stdint.h>
#include "virtio.h"
#define VIRTIO_BLK_BUF_DATA_SIZE 512
#define VIRTIO_BLK_BYTES_PER_SECTOR 512
#define VIRTIO_BLK_BLOCK_SIZE 512
#define VIRTIO_BLK_SECTOR_COUNT 0x40000 /* 128MB */
#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
#define VIRTIO_BLK_F_MQ 12 /* Support more than one vq */
#define VIRTIO_BLK_T_IN 0 /* Read the blk */
#define VIRTIO_BLK_T_OUT 1 /* Write the blk */
#define VIRTIO_F_ANY_LAYOUT 27
#define VIRTIO_RING_F_INDIRECT_DESC 28
#define VIRTIO_RING_F_EVENT_IDX 29
struct virtio_blk_buf
{
int valid;
uint32_t block_no;
uint8_t *data;
};
struct virtio_blk_req
{
uint32_t type;
uint32_t reserved;
uint64_t sector;
};
/*
* virtio_blk must be a static variable because
* pages must consist of two contiguous pages of
* page-aligned physical memory
*/
struct virtio_blk
{
char pages[2 * PAGE_SIZE];
struct virtq_desc *desc;
struct virtq_avail *avail;
struct virtq_used *used;
char free[QUEUE_SIZE];
uint16_t used_idx;
struct
{
struct virtio_blk_buf *buf;
char status;
} info[QUEUE_SIZE];
struct virtio_blk_req ops[QUEUE_SIZE];
} __attribute__ ((aligned (PAGE_SIZE)));
struct virtio_blk_device
{
struct rt_device parent;
struct virtio_blk *blk;
uint32_t *mmio_base;
#ifdef RT_USING_SMP
struct rt_spinlock spinlock;
#endif
};
int rt_hw_virtio_blk_init(void);
#endif /* DRV_VIRTIO_BLK_H__ */
|
#ifndef PARTICLEMEM_H__
#define PARTICLEMEM_H__
#ifdef _WIN32
#pragma once
#endif
#include <vector>
class CCoreTriangleEffect;
#define TRIANGLE_FPS 30
typedef struct visibleparticles_s
{
CCoreTriangleEffect *pVisibleParticle;
} visibleparticles_t;
//---------------------------------------------------------------------------
// Memory block record.
class MemoryBlock
{
private:
char *m_pData;
//bool m_bBlockIsInUse;
public:
MemoryBlock(long lBlockSize)
: next(NULL), prev(NULL)
//m_bBlockIsInUse(false) // Initialize block to 'free' state.
{
// Allocate memory here.
m_pData = new char[lBlockSize];
}
virtual ~MemoryBlock()
{
// Free memory.
delete[] m_pData;
}
inline char *Memory(void) { return m_pData; }
MemoryBlock * next;
MemoryBlock * prev;
};
class MemList
{
public:
MemList() : m_pHead(NULL) {}
~MemList() { Reset(); }
void Push(MemoryBlock * newItem)
{
if(!m_pHead)
{
m_pHead = newItem;
newItem->next = NULL;
newItem->prev = NULL;
return;
}
MemoryBlock * temp = m_pHead;
m_pHead = newItem;
m_pHead->next = temp;
m_pHead->prev = NULL;
temp->prev = m_pHead;
}
MemoryBlock * Front( void )
{
return(m_pHead);
}
MemoryBlock * Pop( void )
{
if(!m_pHead)
return(NULL);
MemoryBlock * temp = m_pHead;
m_pHead = m_pHead->next;
if(m_pHead)
m_pHead->prev = NULL;
temp->next = NULL;
temp->prev = NULL;
return(temp);
}
void Delete( MemoryBlock * pItem)
{
if(m_pHead == pItem)
{
MemoryBlock * temp = m_pHead;
m_pHead = m_pHead->next;
if(m_pHead)
m_pHead->prev = NULL;
temp->next = NULL;
temp->prev = NULL;
return;
}
MemoryBlock * prev = pItem->prev;
MemoryBlock * next = pItem->next;
if(prev)
prev->next = next;
if(next)
next->prev = prev;
pItem->next = NULL;
pItem->prev = NULL;
}
void Reset( void )
{
while(m_pHead)
Delete(m_pHead);
}
private:
MemoryBlock * m_pHead;
};
// Some helpful typedefs.
typedef std::vector<MemoryBlock *> VectorOfMemoryBlocks;
typedef VectorOfMemoryBlocks::iterator MemoryBlockIterator;
// Mini memory manager - singleton.
class CMiniMem
{
private:
// Main memory pool. Array is fine, but vectors are
// easier. :)
static VectorOfMemoryBlocks m_vecMemoryPool;
// Size of memory blocks in pool.
static long m_lMemoryBlockSize;
static long m_lMaxBlocks;
static long m_lMemoryPoolSize;
static CMiniMem *_instance;
int m_iTotalParticles;
int m_iParticlesDrawn;
protected:
// private constructor and destructor.
CMiniMem(long lMemoryPoolSize, long lMaxBlockSize);
virtual ~CMiniMem();
// ------------ Memory pool manager calls.
// Find a free block and mark it as "in use". Return NULL
// if no free blocks found.
char *AllocateFreeBlock(void);
public:
// Return a pointer to usable block of memory.
char *newBlock(void);
// Mark a target memory item as no longer "in use".
void deleteBlock(MemoryBlock *p);
// Return the remaining capacity of the memory pool as a percent.
long PercentUsed(void);
void ProcessAll( void ); //Processes all
void Reset( void ); //clears memory, setting all particles to not used.
static int ApplyForce( Vector vOrigin, Vector vDirection, float flRadius, float flStrength );
static CMiniMem *Instance(void);
static long MaxBlockSize(void);
bool CheckSize( int iSize );
int GetTotalParticles( void ) { return m_iTotalParticles; }
int GetDrawnParticles( void ) { return m_iParticlesDrawn; }
void IncreaseParticlesDrawn( void ){ m_iParticlesDrawn++; }
void Shutdown( void );
visibleparticles_t *m_pVisibleParticles;
};
#endif//PARTICLEMEM_H__ |
// DeadlockDetect.h
// Declares the cDeadlockDetect class that tries to detect deadlocks and aborts the server when it detects one
/*
This class simply monitors each world's m_WorldAge, which is expected to grow on each tick.
If the world age doesn't grow for several seconds, it's either because the server is Super-overloaded,
or because the world tick thread hangs in a deadlock. We presume the latter and therefore kill the server.
Once we learn to write crashdumps programmatically, we should do so just before killing, to enable debugging.
*/
#pragma once
#include "OSSupport/IsThread.h"
class cDeadlockDetect:
public cIsThread
{
using Super = cIsThread;
public:
cDeadlockDetect();
virtual ~cDeadlockDetect() override;
/** Starts the detection. Hides cIsThread's Start, because we need some initialization */
void Start(int a_IntervalSec);
/** Adds the critical section for tracking.
Tracked CSs are listed, together with ownership details, when a deadlock is detected.
A tracked CS must be untracked before it is destroyed.
a_Name is an arbitrary name that is listed along with the CS in the output. */
void TrackCriticalSection(cCriticalSection & a_CS, const AString & a_Name);
/** Removes the CS from the tracking. */
void UntrackCriticalSection(cCriticalSection & a_CS);
protected:
struct sWorldAge
{
/** Last m_WorldAge that has been detected in this world */
cTickTimeLong m_Age;
/** Number of cycles for which the age has been the same */
int m_NumCyclesSame;
} ;
/** Maps world name -> sWorldAge */
typedef std::map<AString, sWorldAge> WorldAges;
/** Protects m_TrackedCriticalSections from multithreaded access. */
cCriticalSection m_CS;
/** CriticalSections that are tracked (their status output on deadlock).
Protected against multithreaded access by m_CS. */
std::vector<std::pair<cCriticalSection *, AString>> m_TrackedCriticalSections;
WorldAges m_WorldAges;
/** Number of secods for which the ages must be the same for the detection to trigger */
int m_IntervalSec;
// cIsThread overrides:
virtual void Execute(void) override;
/** Sets the initial world age. */
void SetWorldAge(const AString & a_WorldName, cTickTimeLong a_Age);
/** Checks if the world's age has changed, updates the world's stats; calls DeadlockDetected() if deadlock detected. */
void CheckWorldAge(const AString & a_WorldName, cTickTimeLong a_Age);
/** Called when a deadlock is detected in a world. Aborts the server.
a_WorldName is the name of the world whose age has triggered the detection.
a_WorldAge is the age (in ticks) in which the world is stuck. */
[[noreturn]] void DeadlockDetected(const AString & a_WorldName, cTickTimeLong a_WorldAge);
/** Outputs a listing of the tracked CSs, together with their name and state. */
void ListTrackedCSs();
} ;
|
//
// pili_camera.h
// camera-sdk
//
// Created on 15/2/6.
// Copyright (c) Pili Engineering, Qiniu Inc. All rights reserved.
//
#ifndef camera_sdk_pili_camera_h
#define camera_sdk_pili_camera_h
#include "pili_macro.h"
#include "pili_type.h"
#include "push.h"
#include "flv.h"
#endif
|
/*
Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
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.
MagickCore image coder methods.
*/
#ifndef _MAGICKCORE_CODER_H
#define _MAGICKCORE_CODER_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _CoderInfo
{
char
*path,
*magick,
*name;
MagickBooleanType
exempt,
stealth;
size_t
signature;
} CoderInfo;
extern MagickExport char
**GetCoderList(const char *,size_t *,ExceptionInfo *);
extern MagickExport const CoderInfo
*GetCoderInfo(const char *,ExceptionInfo *),
**GetCoderInfoList(const char *,size_t *,ExceptionInfo *);
extern MagickExport MagickBooleanType
ListCoderInfo(FILE *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
|
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2009-01-05 Bernard first implementation
*/
#include <rthw.h>
#include <rtthread.h>
#include "board.h"
#include "pin_mux.h"
/* MPU configuration. */
static void BOARD_ConfigMPU(void)
{
/* Disable I cache and D cache */
SCB_DisableICache();
SCB_DisableDCache();
/* Disable MPU */
ARM_MPU_Disable();
/* Region 0 setting */
MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);
/* Region 1 setting */
MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
/* Region 2 setting */
// spi flash: normal type, cacheable, no bufferable, no shareable
MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_512MB);
/* Region 3 setting */
MPU->RBAR = ARM_MPU_RBAR(3, 0x00000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
/* Region 4 setting */
MPU->RBAR = ARM_MPU_RBAR(4, 0x00000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
/* Region 5 setting */
MPU->RBAR = ARM_MPU_RBAR(5, 0x20000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
/* Region 6 setting */
MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB);
#if defined(SDRAM_MPU_INIT)
/* Region 7 setting */
MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);
/* Region 8 setting */
MPU->RBAR = ARM_MPU_RBAR(8, 0x81E00000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB);
#endif
/* Enable MPU */
ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
/* Enable I cache and D cache */
SCB_EnableDCache();
SCB_EnableICache();
}
/* This is the timer interrupt service routine. */
void SysTick_Handler(void)
{
/* enter interrupt */
rt_interrupt_enter();
rt_tick_increase();
/* leave interrupt */
rt_interrupt_leave();
}
/* This function will initial STM32 board. */
void rt_hw_board_init()
{
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_BootClockRUN();
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
#ifdef RT_USING_HEAP
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
|
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Output extension hooks for the Format library.
// `internal::InvokeFlush` calls the appropriate flush function for the
// specified output argument.
// `BufferRawSink` is a simple output sink for a char buffer. Used by SnprintF.
// `FILERawSink` is a std::FILE* based sink. Used by PrintF and FprintF.
#ifndef IRESEARCH_ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
#define IRESEARCH_ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
#include <cstdio>
#include <ostream>
#include <string>
#include "absl/base/port.h"
#include "absl/strings/string_view.h"
namespace iresearch_absl {
IRESEARCH_ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
// RawSink implementation that writes into a char* buffer.
// It will not overflow the buffer, but will keep the total count of chars
// that would have been written.
class BufferRawSink {
public:
BufferRawSink(char* buffer, size_t size) : buffer_(buffer), size_(size) {}
size_t total_written() const { return total_written_; }
void Write(string_view v);
private:
char* buffer_;
size_t size_;
size_t total_written_ = 0;
};
// RawSink implementation that writes into a FILE*.
// It keeps track of the total number of bytes written and any error encountered
// during the writes.
class FILERawSink {
public:
explicit FILERawSink(std::FILE* output) : output_(output) {}
void Write(string_view v);
size_t count() const { return count_; }
int error() const { return error_; }
private:
std::FILE* output_;
int error_ = 0;
size_t count_ = 0;
};
// Provide RawSink integration with common types from the STL.
inline void AbslFormatFlush(std::string* out, string_view s) {
out->append(s.data(), s.size());
}
inline void AbslFormatFlush(std::ostream* out, string_view s) {
out->write(s.data(), s.size());
}
inline void AbslFormatFlush(FILERawSink* sink, string_view v) {
sink->Write(v);
}
inline void AbslFormatFlush(BufferRawSink* sink, string_view v) {
sink->Write(v);
}
// This is a SFINAE to get a better compiler error message when the type
// is not supported.
template <typename T>
auto InvokeFlush(T* out, string_view s) -> decltype(AbslFormatFlush(out, s)) {
AbslFormatFlush(out, s);
}
} // namespace str_format_internal
IRESEARCH_ABSL_NAMESPACE_END
} // namespace absl
#endif // IRESEARCH_ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
|
/*
* Copyright © 2012, United States Government, as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is 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 APP_MG_CONTROL_H
#define APP_MG_CONTROL_H
/**
* @file AppMGControl.cpp
* @brief Contains the definition function main() for the Multiple terrains app, used here for control of a quadruped.
* @author Brian Mirletz, Alexander Xydes, Dawn Hustig-Schultz
* $Id$
*/
//robot
#include "dev/dhustigschultz/MountainGoat/MountainGoat.h"
// controller
#include "JSONMGFeedbackControl.h"
// obstacles
#include "models/obstacles/tgBlockField.h"
// This library
#include "core/tgModel.h"
#include "core/tgSubject.h"
#include "core/tgSimViewGraphics.h"
#include "core/tgSimulation.h"
#include "core/tgWorld.h"
#include "core/terrain/tgBoxGround.h"
#include "core/terrain/tgHillyGround.h"
// Boost
#include <boost/program_options.hpp>
// The C++ Standard Library
#include <iostream>
#include <string>
namespace po = boost::program_options;
class AppMGControl
{
public:
AppMGControl(int argc, char** argv);
/** Setup the simulation */
bool setup();
/** Run the simulation */
bool run();
private:
/** Parse command line options */
void handleOptions(int argc, char** argv);
const tgHillyGround::Config getHillyConfig();
const tgBoxGround::Config getBoxConfig();
tgModel* getBlocks();
/** Create the tgWorld object */
tgWorld *createWorld();
/** Use for displaying tensegrities in simulation */
tgSimViewGraphics *createGraphicsView(tgWorld *world);
/** Use for trial episodes of many tensegrities in an experiment */
tgSimView *createView(tgWorld *world);
/** Run a series of episodes for nSteps each */
void simulate(tgSimulation *simulation);
// Keep these around for cleanup
tgWorld* world;
tgSimView* view;
tgSimulation* simulation;
bool use_graphics;
bool add_controller;
bool add_blocks;
bool add_hills;
bool all_terrain;
double timestep_physics; //Seconds
double timestep_graphics; // Seconds, AKA render rate. Leave at 1/60 for real-time viewing
int nEpisodes; // Number of episodes ("trial runs")
int nSteps; // Number of steps in each episode, 60k is 100 seconds (timestep_physics*nSteps)
int nSegments; // Number of segments in the tensegrity spine
int nTypes; // Number of types of terrain to be used. Currently 3
double startX;
double startY;
double startZ;
double startAngle;
double goalAngle;
std::string lowerPath;
std::string suffix;
bool bSetup;
};
#endif // APP_MG_CONTROL_H
|
#include <stdlib.h>
#include <stdio.h>
void jsPrint () { fprintf(stderr, "Unimplemented Javascript primitive myPrint!\n"); exit(1); }
|
/*-
* Copyright 2007-2009 Colin Percival
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#ifndef _SYSENDIAN_H_
#define _SYSENDIAN_H_
/* If we don't have be64enc, the <sys/endian.h> we have isn't usable. */
#if !HAVE_DECL_BE64ENC
#undef HAVE_SYS_ENDIAN_H
#endif
#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#else
#include <stdint.h>
static inline uint32_t
be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
}
static inline void
be32enc(void *pp, uint32_t x)
{
uint8_t * p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
}
static inline uint64_t
be64dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) +
((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) +
((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) +
((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56));
}
static inline void
be64enc(void *pp, uint64_t x)
{
uint8_t * p = (uint8_t *)pp;
p[7] = x & 0xff;
p[6] = (x >> 8) & 0xff;
p[5] = (x >> 16) & 0xff;
p[4] = (x >> 24) & 0xff;
p[3] = (x >> 32) & 0xff;
p[2] = (x >> 40) & 0xff;
p[1] = (x >> 48) & 0xff;
p[0] = (x >> 56) & 0xff;
}
static inline uint32_t
le32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
}
static inline void
le32enc(void *pp, uint32_t x)
{
uint8_t * p = (uint8_t *)pp;
p[0] = x & 0xff;
p[1] = (x >> 8) & 0xff;
p[2] = (x >> 16) & 0xff;
p[3] = (x >> 24) & 0xff;
}
static inline uint64_t
le64dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) +
((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) +
((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) +
((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56));
}
static inline void
le64enc(void *pp, uint64_t x)
{
uint8_t * p = (uint8_t *)pp;
p[0] = x & 0xff;
p[1] = (x >> 8) & 0xff;
p[2] = (x >> 16) & 0xff;
p[3] = (x >> 24) & 0xff;
p[4] = (x >> 32) & 0xff;
p[5] = (x >> 40) & 0xff;
p[6] = (x >> 48) & 0xff;
p[7] = (x >> 56) & 0xff;
}
#endif /* !HAVE_SYS_ENDIAN_H */
#endif /* !_SYSENDIAN_H_ */
|
/*
* Copyright (C) 2004 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#if !TARGET_OS_IPHONE
#import <AppKit/AppKit.h>
#endif
/*!
This informal protocol enables a plug-in to request that its containing application
perform certain operations.
*/
@interface NSObject (WebPlugInContainer)
/*!
@method webPlugInContainerLoadRequest:inFrame:
@abstract Tell the application to show a URL in a target frame
@param request The request to be loaded.
@param target The target frame. If the frame with the specified target is not
found, a new window is opened and the main frame of the new window is named
with the specified target. If nil is specified, the frame that contains
the applet is targeted.
*/
- (void)webPlugInContainerLoadRequest:(NSURLRequest *)request inFrame:(NSString *)target;
/*!
@method webPlugInContainerShowStatus:
@abstract Tell the application to show the specified status message.
@param message The string to be shown.
*/
- (void)webPlugInContainerShowStatus:(NSString *)message;
#if !TARGET_OS_IPHONE
/*!
@property webPlugInContainerSelectionColor
@abstract The color that should be used for any special drawing when
plug-in is selected.
*/
@property (nonatomic, readonly, strong) NSColor *webPlugInContainerSelectionColor;
#endif
/*!
@property webFrame
@abstract Allows the plug-in to access the WebFrame that
contains the plug-in. This method will not be implemented by containers that
are not WebKit based.
*/
@property (nonatomic, readonly, strong) WebFrame *webFrame;
@end
|
/*
* Copyright (c) 2014, STMicroelectronics International N.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BASE64_H
#define BASE64_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
bool base64_enc(const void *data, size_t size, char *buf, size_t *blen);
bool base64_dec(const char *data, size_t size, void *buf, size_t *blen);
size_t base64_enc_len(size_t size);
#endif /* BASE64_H */
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_
#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_
#include "content/public/browser/web_ui_controller.h"
class Profile;
class PrefRegistrySyncable;
// The Web UI handler for chrome://signin.
class SyncPromoUI : public content::WebUIController {
public:
// Please keep this in sync with enums in sync_promo_trial.cc.
enum Source {
SOURCE_START_PAGE = 0, // This must be first.
SOURCE_NTP_LINK,
SOURCE_MENU,
SOURCE_SETTINGS,
SOURCE_EXTENSION_INSTALL_BUBBLE,
SOURCE_WEBSTORE_INSTALL,
SOURCE_APP_LAUNCHER,
SOURCE_UNKNOWN, // This must be last.
};
// Constructs a SyncPromoUI.
explicit SyncPromoUI(content::WebUI* web_ui);
// Returns true if the sync promo should be visible.
// |profile| is the profile of the tab the promo would be shown on.
static bool ShouldShowSyncPromo(Profile* profile);
// Returns true if we should show the sync promo at startup.
static bool ShouldShowSyncPromoAtStartup(Profile* profile,
bool is_new_profile);
// Called when the sync promo has been shown so that we can keep track
// of the number of times we've displayed it.
static void DidShowSyncPromoAtStartup(Profile* profile);
// Returns true if a user has seen the sync promo at startup previously.
static bool HasShownPromoAtStartup(Profile* profile);
// Returns true if the user has previously skipped the sync promo.
static bool HasUserSkippedSyncPromo(Profile* profile);
// Registers the fact that the user has skipped the sync promo.
static void SetUserSkippedSyncPromo(Profile* profile);
// Registers the preferences the Sync Promo UI needs.
static void RegisterUserPrefs(PrefRegistrySyncable* registry);
// Returns the sync promo URL wth the given arguments in the query.
// |next_page| is the URL to navigate to when the user completes or skips the
// promo. If an empty URL is given then the promo will navigate to the NTP.
// |source| identifies from where the sync promo is being called, and is used
// to record sync promo UMA stats in the context of the source.
// |auto_close| whether to close the sync promo automatically when done.
static GURL GetSyncPromoURL(
const GURL& next_page, Source source, bool auto_close);
// Gets the next page URL from the query portion of the sync promo URL.
static GURL GetNextPageURLForSyncPromoURL(const GURL& url);
// Gets the source from the query portion of the sync promo URL.
// The source identifies from where the sync promo was opened.
static Source GetSourceForSyncPromoURL(const GURL& url);
// Returns whether the given sync URL contains auto_close parameter.
static bool GetAutoCloseForSyncPromoURL(const GURL& url);
// Returns true if chrome should use the web-based sign in flow, false if
// chrome should use the ClientLogin flow. This function will return true
// only for platforms where |ENABLE_ONE_CLICK_SIGNIN| is defined.
static bool UseWebBasedSigninFlow();
// Forces UseWebBasedSigninFlow() to return true when set; used in tests only.
static void ForceWebBasedSigninFlowForTesting(bool force);
private:
DISALLOW_COPY_AND_ASSIGN(SyncPromoUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MatrixTransformComponent_h
#define MatrixTransformComponent_h
#include "core/css/cssom/TransformComponent.h"
#include "platform/transforms/TransformationMatrix.h"
namespace blink {
class CORE_EXPORT MatrixTransformComponent final : public TransformComponent {
WTF_MAKE_NONCOPYABLE(MatrixTransformComponent);
DEFINE_WRAPPERTYPEINFO();
public:
static MatrixTransformComponent* create(double a, double b, double c, double d, double e, double f)
{
return new MatrixTransformComponent(a, b, c, d, e, f);
}
static MatrixTransformComponent* create(double m11, double m12, double m13, double m14,
double m21, double m22, double m23, double m24,
double m31, double m32, double m33, double m34,
double m41, double m42, double m43, double m44)
{
return new MatrixTransformComponent(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
}
// 2D matrix attributes
double a() const { return m_matrix->a(); }
double b() const { return m_matrix->b(); }
double c() const { return m_matrix->c(); }
double d() const { return m_matrix->d(); }
double e() const { return m_matrix->e(); }
double f() const { return m_matrix->f(); }
// 3D matrix attributes
double m11() const { return m_matrix->m11(); }
double m12() const { return m_matrix->m12(); }
double m13() const { return m_matrix->m13(); }
double m14() const { return m_matrix->m14(); }
double m21() const { return m_matrix->m21(); }
double m22() const { return m_matrix->m22(); }
double m23() const { return m_matrix->m23(); }
double m24() const { return m_matrix->m24(); }
double m31() const { return m_matrix->m31(); }
double m32() const { return m_matrix->m32(); }
double m33() const { return m_matrix->m33(); }
double m34() const { return m_matrix->m34(); }
double m41() const { return m_matrix->m41(); }
double m42() const { return m_matrix->m42(); }
double m43() const { return m_matrix->m43(); }
double m44() const { return m_matrix->m44(); }
TransformComponentType type() const override { return m_is2D ? MatrixType : Matrix3DType; }
// Bindings require a non const return value.
MatrixTransformComponent* asMatrix() const override { return const_cast<MatrixTransformComponent*>(this); }
CSSFunctionValue* toCSSValue() const override;
static MatrixTransformComponent* perspective(double length);
static MatrixTransformComponent* rotate(double angle);
static MatrixTransformComponent* rotate3d(double angle, double x, double y, double z);
static MatrixTransformComponent* scale(double x, double y);
static MatrixTransformComponent* scale3d(double x, double y, double z);
static MatrixTransformComponent* skew(double x, double y);
static MatrixTransformComponent* translate(double x, double y);
static MatrixTransformComponent* translate3d(double x, double y, double z);
private:
MatrixTransformComponent(double a, double b, double c, double d, double e, double f)
: TransformComponent()
, m_matrix(TransformationMatrix::create(a, b, c, d, e, f))
, m_is2D(true)
{ }
MatrixTransformComponent(double m11, double m12, double m13, double m14,
double m21, double m22, double m23, double m24,
double m31, double m32, double m33, double m34,
double m41, double m42, double m43, double m44)
: TransformComponent()
, m_matrix(TransformationMatrix::create(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44))
, m_is2D(false)
{ }
MatrixTransformComponent(PassOwnPtr<const TransformationMatrix> matrix, TransformComponentType fromType)
: TransformComponent()
, m_matrix(std::move(matrix))
, m_is2D(is2DComponentType(fromType))
{ }
// TransformationMatrix needs to be 16-byte aligned. PartitionAlloc
// supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr
// to allocate TransformationMatrix on PartitionAlloc.
// TODO(oilpan): Oilpan should support 16-byte aligned allocations.
OwnPtr<const TransformationMatrix> m_matrix;
bool m_is2D;
};
} // namespace blink
#endif
|
/*
* image.h - Image Data Structures and definitions
*
* One day, this file will define a common structure
* for all image / animation / volume type data structures.
* This will allow me to design and implement a library of
* pixel processing routines for pre and post processing of
* image data in the rendering process. Good examples will be
* image map filtering, animated image maps, DCT/IDCT algorithms,
* scalar volume data, a common set of file format readers and converters.
*
*/
typedef struct {
int ID; /* frame number */
unsigned int info; /* bitmapped flags and values */
/* YUV, RGB, DCT, image, animation, */
/* volume, etc. */
unsigned int loaded; /* memory residency information */
unsigned int xs; /* pels in x dimension */
unsigned int ys; /* pels in y dimension */
unsigned int zs; /* pels in z dimension */
unsigned char * data; /* raw image/volume data */
char filename[FILENAME_MAX]; /* filename or remote access identifier */
} Frame;
|
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2012, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <clogger.h>
#include <libcork/core.h>
#include <check.h>
#include "vrt.h"
#include "helpers.h"
#include "integers.h"
#include "queue.h"
/*----------------------------------------------------------------------
* Sum test
*/
#define DEFAULT_GENERATE_COUNT 10
static int64_t GENERATE_COUNT = DEFAULT_GENERATE_COUNT;
#define RUN_TEST(queue_size, batch_size, run_func) \
DESCRIBE_TEST; \
int64_t result; \
\
struct vrt_queue *q; \
struct vrt_producer *p; \
struct vrt_consumer *c; \
vrt_clock elapsed; \
\
fail_if_error(q = vrt_queue_new \
("queue_sum", vrt_value_type_int(), \
queue_size)); \
fail_if_error(p = vrt_producer_new \
("generate", batch_size, q)); \
fail_if_error(c = vrt_consumer_new("sum", q)); \
\
struct generate_config generate_config = { \
p, GENERATE_COUNT \
}; \
struct sum_config sum_config = { \
c, &result \
}; \
\
struct vrt_queue_client clients[] = { \
{ generate_integers, &generate_config }, \
{ sum_integers, &sum_config }, \
{ NULL, NULL } \
}; \
\
fail_if_error(run_func(q, clients, &elapsed)); \
fprintf(stdout, "Result: %" PRId64 "\n", result); \
vrt_report_clock(elapsed, GENERATE_COUNT); \
vrt_queue_free(q);
START_TEST(test_sum_threaded_small)
{
RUN_TEST(16, 4, vrt_test_queue_threaded);
}
END_TEST
START_TEST(test_sum_threaded)
{
RUN_TEST(0, 0, vrt_test_queue_threaded);
}
END_TEST
START_TEST(test_sum_threaded_spin_small)
{
RUN_TEST(16, 4, vrt_test_queue_threaded_spin);
}
END_TEST
START_TEST(test_sum_threaded_spin)
{
RUN_TEST(0, 0, vrt_test_queue_threaded_spin);
}
END_TEST
START_TEST(test_sum_threaded_hybrid_small)
{
RUN_TEST(16, 4, vrt_test_queue_threaded_hybrid);
}
END_TEST
START_TEST(test_sum_threaded_hybrid)
{
RUN_TEST(0, 0, vrt_test_queue_threaded_hybrid);
}
END_TEST
/*----------------------------------------------------------------------
* Testing harness
*/
Suite *
test_suite()
{
Suite *s = suite_create("varon-t");
TCase *tc_vrt = tcase_create("varon-t");
tcase_add_test(tc_vrt, test_sum_threaded);
tcase_add_test(tc_vrt, test_sum_threaded_small);
tcase_add_test(tc_vrt, test_sum_threaded_spin);
tcase_add_test(tc_vrt, test_sum_threaded_spin_small);
tcase_add_test(tc_vrt, test_sum_threaded_hybrid);
tcase_add_test(tc_vrt, test_sum_threaded_hybrid_small);
suite_add_tcase(s, tc_vrt);
return s;
}
int
main(int argc, const char **argv)
{
int number_failed;
Suite *suite = test_suite();
SRunner *runner = srunner_create(suite);
setup_allocator();
if (argc > 1) {
if (sscanf(argv[1], "%" PRId64, &GENERATE_COUNT) != 1) {
fprintf(stderr, "Invalid record count: \"%s\"\n", argv[1]);
return -1;
}
}
vrt_testing_mode();
clog_setup_logging();
srunner_run_all(runner, CK_NORMAL);
number_failed = srunner_ntests_failed(runner);
srunner_free(runner);
return (number_failed == 0)? EXIT_SUCCESS: EXIT_FAILURE;
}
|
/*
* Copyright (c) 2021, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright 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.
*/
/**
* @file
* This file includes compile-time configurations for the DNS-SD Server.
*
*/
#ifndef CONFIG_DNSSD_SERVER_H_
#define CONFIG_DNSSD_SERVER_H_
/**
* @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE
*
* Define to 1 to enable DNS-SD Server support.
*
*/
#ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE
#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_DNSSD_SERVER_PORT
*
* Define the the DNS-SD Server port.
*
*/
#ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_PORT
#define OPENTHREAD_CONFIG_DNSSD_SERVER_PORT 53
#endif
/**
* @def OPENTHREAD_CONFIG_DNSSD_SERVER_BIND_UNSPECIFIED_NETIF
*
* Define to 1 to bind DNS-SD server to unspecified interface, 0 to bind to Thread interface.
*
*/
#ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_BIND_UNSPECIFIED_NETIF
#define OPENTHREAD_CONFIG_DNSSD_SERVER_BIND_UNSPECIFIED_NETIF 0
#endif
/**
* @def OPENTHREAD_CONFIG_DNSSD_QUERY_TIMEOUT
*
* Specifies the default wait time that DNS-SD Server waits for a query response (e.g. from Discovery Proxy).
*
*/
#ifndef OPENTHREAD_CONFIG_DNSSD_QUERY_TIMEOUT
#define OPENTHREAD_CONFIG_DNSSD_QUERY_TIMEOUT 6000
#endif
#endif // CONFIG_DNSSD_SERVER_H_
|
/****************************************************************************
*
* Copyright (C) 2015 Mark Charlebois. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 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.
*
****************************************************************************/
/**
* @file hrt_test.h
* Example app for Linux
*
* @author Mark Charlebois <charlebm@gmail.com>
*/
#pragma once
#include <px4_platform_common/app.h>
class HRTTest
{
public:
HRTTest() {}
~HRTTest() {}
int main();
static px4::AppState appState; /* track requests to terminate app */
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.