text stringlengths 4 6.14k |
|---|
/**
src/base/omx_base_source.h
OpenMAX base source component. This component does not perform any multimedia
processing. It derives from base component and contains a single port. It can be used
as base class for source components.
Copyright (C) 2007-2009 STMicroelectronics
Copyright (C) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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 St, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _OMX_BASE_SOURCE_COMPONENT_H_
#define _OMX_BASE_SOURCE_COMPONENT_H_
#include <OMX_Types.h>
#include <OMX_Component.h>
#include <OMX_Core.h>
#include "omx_base_component.h"
/** OMX_BASE_SOURCE_OUTPUTPORT_INDEX is the index of any output port for the derived components
*/
#define OMX_BASE_SOURCE_OUTPUTPORT_INDEX 0
/** OMX_BASE_SPLITTER_OUTPUTPORT_INDEX_1 is the index of any output port for the derived components
*/
#define OMX_BASE_SOURCE_OUTPUTPORT_INDEX_1 1
/** OMX_BASE_SOURCE_ALLPORT_INDEX as the standard specifies, the -1 value for port index is used to point to all the ports
*/
#define OMX_BASE_SOURCE_ALLPORT_INDEX -1
/** base source component private structure.
*/
DERIVEDCLASS(omx_base_source_PrivateType, omx_base_component_PrivateType)
#define omx_base_source_PrivateType_FIELDS omx_base_component_PrivateType_FIELDS \
/** @param BufferMgmtCallback function pointer for algorithm callback */ \
void (*BufferMgmtCallback)(OMX_COMPONENTTYPE* openmaxStandComp, OMX_BUFFERHEADERTYPE* outputbuffer);
ENDCLASS(omx_base_source_PrivateType)
/** Base source contructor
*/
OMX_ERRORTYPE omx_base_source_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName);
/** The base source destructor. It simply calls the base destructor
*/
OMX_ERRORTYPE omx_base_source_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
/** This is the central function for component processing. It
* is executed in a separate thread, is synchronized with
* semaphores at each port, those are released each time a new buffer
* is available on the given port.
*/
void* omx_base_source_BufferMgmtFunction(void* param);
/** This is the central function for buffer processing of a two port source component.
* It is executed in a separate thread, is synchronized with
* semaphores at each port, those are released each time a new buffer
* is available on the given port.
*/
void* omx_base_source_twoport_BufferMgmtFunction (void* param);
#endif
|
//
// BLYBitlyTextViewExample.h
// BitlySample
//
// Created by tracy pesin on 11/11/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BitlyTextView.h"
@interface BLYBitlyTextViewExample : UIViewController <BitlyTextViewDelegate>
@end
|
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef TR_DUMP_STATE_H_
#define TR_DUMP_STATE_H_
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
void trace_dump_format(enum pipe_format format);
void trace_dump_resource_template(const struct pipe_resource *templat);
void trace_dump_box(const struct pipe_box *box);
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
void trace_dump_viewport_state(const struct pipe_viewport_state *state);
void trace_dump_scissor_state(const struct pipe_scissor_state *state);
void trace_dump_clip_state(const struct pipe_clip_state *state);
void trace_dump_token(const struct tgsi_token *token);
void trace_dump_shader_state(const struct pipe_shader_state *state);
void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state);
void trace_dump_blend_state(const struct pipe_blend_state *state);
void trace_dump_blend_color(const struct pipe_blend_color *state);
void trace_dump_stencil_ref(const struct pipe_stencil_ref *state);
void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state);
void trace_dump_sampler_state(const struct pipe_sampler_state *state);
void trace_dump_sampler_view_template(const struct pipe_sampler_view *view,
enum pipe_texture_target target);
void trace_dump_surface_template(const struct pipe_surface *state,
enum pipe_texture_target target);
void trace_dump_transfer(const struct pipe_transfer *state);
void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state);
void trace_dump_index_buffer(const struct pipe_index_buffer *state);
void trace_dump_vertex_element(const struct pipe_vertex_element *state);
void trace_dump_draw_info(const struct pipe_draw_info *state);
#endif /* TR_STATE_H */
|
/* Definitions of target machine for GCC. m68k/ColdFire based uClinux system
using ELF objects with special linker post-processing to produce FLAT
executables.
Copyright (C) 2003, 2007, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{mshared-library-id=0|!mshared-library-id=*: crt1.o%s ;: Scrt1.o%s} \
crti.o%s crtbegin.o%s"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
/* Override the default LIB_SPEC from gcc.c. We don't currently support
profiling, or libg.a. */
#undef LIB_SPEC
#define LIB_SPEC \
"%{mid-shared-library:%{!static-libc:-R libc.gdb%s}} %{pthread:-lpthread} -lc"
/* Default to using -elf2flt with no options. */
#undef LINK_SPEC
#define LINK_SPEC \
"%{!elf2flt*:-elf2flt} \
%{mid-shared-library: \
%{mshared-library-id=*:-shared-lib-id %*;:-shared-lib-id 0}}"
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
GNU_USER_TARGET_OS_CPP_BUILTINS (); \
builtin_define ("__uClinux__"); \
if (TARGET_ID_SHARED_LIBRARY) \
{ \
builtin_define ("__ID_SHARED_LIBRARY__"); \
/* Shared libraries and executables do not share \
typeinfo names. */ \
builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
} \
} \
while (0)
/* -msep-data is the default PIC mode on this target. */
#define DRIVER_SELF_SPECS \
"%{fpie|fPIE|fpic|fPIC:%{!msep-data:%{!mid-shared-library: -msep-data}}}"
/* The uclinux binary format relies on relocations against a segment being
within that segment. Conservatively apply this rule to individual
sections. */
#undef M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
#define M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
|
/*
* Copyright (c) 2011 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "native_client/src/include/portability.h"
#include "native_client/src/include/nacl_macros.h"
/*
* This file is compiled by the test infrastructure as both a C and a
* C++ program, since the nacl_macros used below have different
* definitions depending on the language.
*/
int main(void) {
char buffer[4096];
NACL_ASSERT_IS_POINTER(buffer);
return 0;
}
|
/* sigwait - implementation of sigwait function from POSIX.1c.
Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <signal.h>
int
__sigwait (const sigset_t *set, int *sig)
{
__set_errno (ENOSYS);
return -1;
}
weak_alias (__sigwait, sigwait)
stub_warning (sigwait)
|
//===- PDBSymbolTypeVTableShape.h - VTable shape info -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_PDBSYMBOLTYPEVTABLESHAPE_H
#define LLVM_DEBUGINFO_PDB_PDBSYMBOLTYPEVTABLESHAPE_H
#include "PDBSymbol.h"
#include "PDBTypes.h"
namespace llvm {
class raw_ostream;
class PDBSymbolTypeVTableShape : public PDBSymbol {
public:
PDBSymbolTypeVTableShape(const IPDBSession &PDBSession,
std::unique_ptr<IPDBRawSymbol> VtblShapeSymbol);
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::VTableShape)
void dump(PDBSymDumper &Dumper) const override;
FORWARD_SYMBOL_METHOD(isConstType)
FORWARD_SYMBOL_METHOD(getCount)
FORWARD_SYMBOL_METHOD(getLexicalParentId)
FORWARD_SYMBOL_METHOD(getSymIndexId)
FORWARD_SYMBOL_METHOD(isUnalignedType)
FORWARD_SYMBOL_METHOD(isVolatileType)
};
} // namespace llvm
#endif // LLVM_DEBUGINFO_PDB_PDBSYMBOLTYPEVTABLESHAPE_H
|
/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sysdep.h>
#include "exit.h"
void
quick_exit (int status)
{
__run_exit_handlers (status, &__quick_exit_funcs, false);
}
|
/* Implement simple hashing table with string based keys.
Copyright (C) 1994-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef hashval_t
# define hashval_t unsigned long int
#endif
#include <limits.h> /* For CHAR_BIT. */
hashval_t
compute_hashval (const void *key, size_t keylen)
{
size_t cnt;
hashval_t hval;
/* Compute the hash value for the given string. The algorithm
is taken from [Aho,Sethi,Ullman], modified to reduce the number of
collisions for short strings with very varied bit patterns.
See http://www.clisp.org/haible/hashfunc.html. */
cnt = 0;
hval = keylen;
while (cnt < keylen)
{
hval = (hval << 9) | (hval >> (sizeof hval * CHAR_BIT - 9));
hval += (hashval_t) ((const unsigned char *) key)[cnt++];
}
return hval != 0 ? hval : ~((hashval_t) 0);
}
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ERRORS_H__
#define __ERRORS_H__
#ifndef GIMP_APP_GLUE_COMPILATION
#error You must not #include "errors.h" from an app/ subdir
#endif
void errors_init (Gimp *gimp,
const gchar *full_prog_name,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode);
void errors_exit (void);
void gimp_fatal_error (const gchar *message) G_GNUC_NORETURN;
void gimp_terminate (const gchar *message) G_GNUC_NORETURN;
#endif /* __ERRORS_H__ */
|
/****************************************************************************
*
* ftcid.c
*
* FreeType API for accessing CID font information.
*
* Copyright (C) 2007-2021 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#include <freetype/ftcid.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/services/svcid.h>
/* documentation is in ftcid.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
const char* *registry,
const char* *ordering,
FT_Int *supplement)
{
FT_Error error;
const char* r = NULL;
const char* o = NULL;
FT_Int s = 0;
error = FT_ERR( Invalid_Argument );
if ( face )
{
FT_Service_CID service;
FT_FACE_FIND_SERVICE( face, service, CID );
if ( service && service->get_ros )
error = service->get_ros( face, &r, &o, &s );
}
if ( registry )
*registry = r;
if ( ordering )
*ordering = o;
if ( supplement )
*supplement = s;
return error;
}
FT_EXPORT_DEF( FT_Error )
FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
FT_Bool *is_cid )
{
FT_Error error = FT_ERR( Invalid_Argument );
FT_Bool ic = 0;
if ( face )
{
FT_Service_CID service;
FT_FACE_FIND_SERVICE( face, service, CID );
if ( service && service->get_is_cid )
error = service->get_is_cid( face, &ic);
}
if ( is_cid )
*is_cid = ic;
return error;
}
FT_EXPORT_DEF( FT_Error )
FT_Get_CID_From_Glyph_Index( FT_Face face,
FT_UInt glyph_index,
FT_UInt *cid )
{
FT_Error error = FT_ERR( Invalid_Argument );
FT_UInt c = 0;
if ( face )
{
FT_Service_CID service;
FT_FACE_FIND_SERVICE( face, service, CID );
if ( service && service->get_cid_from_glyph_index )
error = service->get_cid_from_glyph_index( face, glyph_index, &c);
}
if ( cid )
*cid = c;
return error;
}
/* END */
|
/* { dg-additional-options "-Wno-pedantic" } */
struct trailing
{
unsigned m;
short ary[];
} trailing =
{.ary = {1}};
struct packed
{
unsigned m;
short ary[];
} __attribute__ ((packed)) packed =
{.ary = {2}};
/* { dg-final { scan-assembler ".align 1 .u32 packed\\\[2\\\] = { 0, 2 };" } } */
/* { dg-final { scan-assembler ".align 4 .u32 trailing\\\[2\\\] = { 0, 1 };" } } */
|
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Waypoint class
*
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
#ifndef WAYPOINT_H
#define WAYPOINT_H
#include <QObject>
#include <QString>
#include <QTextStream>
#include "QGCMAVLink.h"
#include "QGC.h"
class Waypoint : public QObject
{
Q_OBJECT
public:
Waypoint(quint16 id = 0, double x = 0.0, double y = 0.0, double z = 0.0, double param1 = 0.0, double param2 = 0.0, double param3 = 0.0, double param4 = 0.0,
bool autocontinue = true, bool current = false, MAV_FRAME frame=MAV_FRAME_GLOBAL_RELATIVE_ALT, MAV_CMD action=MAV_CMD_NAV_WAYPOINT, const QString& description=QString(""));
Waypoint(const Waypoint& waypoint);
~Waypoint();
quint16 getId() const {
return id;
}
double getX() const {
return x;
}
double getY() const {
return y;
}
double getZ() const {
return z;
}
double getLatitude() const {
return x;
}
double getLongitude() const {
return y;
}
double getAltitude() const {
return z;
}
double getYaw() const {
return yaw;
}
bool getAutoContinue() const {
return autocontinue;
}
bool getCurrent() const {
return current;
}
double getLoiterOrbit() const {
return orbit;
}
double getAcceptanceRadius() const {
return param2;
}
double getHoldTime() const {
return param1;
}
double getParam1() const {
return param1;
}
double getParam2() const {
return param2;
}
double getParam3() const {
return orbit;
}
double getParam4() const {
return yaw;
}
double getParam5() const {
return x;
}
double getParam6() const {
return y;
}
double getParam7() const {
return z;
}
int getTurns() const {
return param1;
}
MAV_FRAME getFrame() const {
return frame;
}
MAV_CMD getAction() const {
return action;
}
const QString& getName() const {
return name;
}
const QString& getDescription() const {
return description;
}
/** @brief Returns true if x, y, z contain reasonable navigation data */
bool isNavigationType();
/** @brief Returns true for waypoint witch also visible on map */
bool visibleOnMapWidget();
void save(QTextStream &saveStream);
bool load(QTextStream &loadStream);
protected:
quint16 id;
double x;
double y;
double z;
double yaw;
MAV_FRAME frame;
MAV_CMD action;
bool autocontinue;
bool current;
double orbit;
double param1;
double param2;
int turns;
QString name;
QString description;
quint64 reachedTime;
public slots:
void setId(quint16 id);
void setX(double x);
void setY(double y);
void setZ(double z);
void setLatitude(double lat);
void setLongitude(double lon);
void setAltitude(double alt);
/** @brief Yaw angle in COMPASS DEGREES: 0-360 */
void setYaw(int yaw);
/** @brief Yaw angle in COMPASS DEGREES: 0-360 */
void setYaw(double yaw);
/** @brief Set the waypoint action */
void setAction(int action);
void setAction(MAV_CMD action);
void setFrame(MAV_FRAME frame);
void setAutocontinue(bool autoContinue);
void setCurrent(bool current);
void setLoiterOrbit(double orbit);
void setParam1(double param1);
void setParam2(double param2);
void setParam3(double param3);
void setParam4(double param4);
void setParam5(double param5);
void setParam6(double param6);
void setParam7(double param7);
void setAcceptanceRadius(double radius);
void setHoldTime(int holdTime);
void setHoldTime(double holdTime);
/** @brief Number of turns for loiter waypoints */
void setTurns(int turns);
/** @brief Set waypoint as reached */
void setReached() { reachedTime = QGC::groundTimeMilliseconds(); }
/** @brief Wether this waypoint has been reached yet */
bool isReached() { return (reachedTime > 0); }
/** @brief Get the time this waypoint was reached */
quint64 getReachedTime() const { return reachedTime; }
public:
QString debugString();
signals:
/** @brief Announces a change to the waypoint data */
void changed(Waypoint* wp);
};
#endif // WAYPOINT_H
|
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2012 Red Hat, Inc.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef __G_POLLABLE_UTILS_H__
#define __G_POLLABLE_UTILS_H__
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif
#include <gio/gio.h>
G_BEGIN_DECLS
GLIB_AVAILABLE_IN_ALL
GSource *g_pollable_source_new (GObject *pollable_stream);
GLIB_AVAILABLE_IN_2_34
GSource *g_pollable_source_new_full (gpointer pollable_stream,
GSource *child_source,
GCancellable *cancellable);
GLIB_AVAILABLE_IN_2_34
gssize g_pollable_stream_read (GInputStream *stream,
void *buffer,
gsize count,
gboolean blocking,
GCancellable *cancellable,
GError **error);
GLIB_AVAILABLE_IN_2_34
gssize g_pollable_stream_write (GOutputStream *stream,
const void *buffer,
gsize count,
gboolean blocking,
GCancellable *cancellable,
GError **error);
GLIB_AVAILABLE_IN_2_34
gboolean g_pollable_stream_write_all (GOutputStream *stream,
const void *buffer,
gsize count,
gboolean blocking,
gsize *bytes_written,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif /* _G_POLLABLE_UTILS_H_ */
|
/**
* WinPR: Windows Portable Runtime
* Synchronization Functions
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 Thincast Technologies GmbH
* Copyright 2014 Norbert Federa <norbert.federa@thincast.com>
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/synch.h>
#include <winpr/interlocked.h>
#include "../log.h"
#define TAG WINPR_TAG("sync")
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
BOOL winpr_InitOnceBeginInitialize(LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID* lpContext)
{
WLog_ERR(TAG, "not implemented");
return FALSE;
}
BOOL winpr_InitOnceComplete(LPINIT_ONCE lpInitOnce, DWORD dwFlags, LPVOID lpContext)
{
WLog_ERR(TAG, "not implemented");
return FALSE;
}
VOID winpr_InitOnceInitialize(PINIT_ONCE InitOnce)
{
WLog_ERR(TAG, "not implemented");
}
BOOL winpr_InitOnceExecuteOnce(PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID* Context)
{
for (;;)
{
switch ((ULONG_PTR)InitOnce->Ptr & 3)
{
case 2:
/* already completed successfully */
return TRUE;
case 0:
/* first time */
if (InterlockedCompareExchangePointer(&InitOnce->Ptr, (PVOID)1, (PVOID)0) != (PVOID)0)
{
/* some other thread was faster */
break;
}
/* it's our job to call the init function */
if (InitFn(InitOnce, Parameter, Context))
{
/* success */
InitOnce->Ptr = (PVOID)2;
return TRUE;
}
/* the init function returned an error, reset the status */
InitOnce->Ptr = (PVOID)0;
return FALSE;
case 1:
/* in progress */
break;
default:
WLog_ERR(TAG, "internal error");
return FALSE;
}
Sleep(5);
}
}
#endif
|
//******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// 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
#import <MediaPlayer/MediaPlayerExport.h>
#import <Foundation/NSObject.h>
@class MPContentItem;
@class NSIndexPath;
@class NSError;
@protocol MPPlayableContentDataSource <NSObject>
- (MPContentItem*)contentItemAtIndexPath:(NSIndexPath*)indexPath;
- (NSInteger)numberOfChildItemsAtIndexPath:(NSIndexPath*)indexPath;
@optional
- (void)beginLoadingChildItemsAtIndexPath:(NSIndexPath*)indexPath completionHandler:(void (^)(NSError*))completionHandler;
- (BOOL)childItemsDisplayPlaybackProgressAtIndexPath:(NSIndexPath*)indexPath;
@end
|
#ifndef _DICT_DBM_H_INCLUDED_
#define _DICT_DBM_H_INCLUDED_
/*++
/* NAME
/* dict_dbm 3h
/* SUMMARY
/* dictionary manager interface to DBM files
/* SYNOPSIS
/* #include <dict_dbm.h>
/* DESCRIPTION
/* .nf
/*
* Utility library.
*/
#include <dict.h>
/*
* External interface.
*/
#define DICT_TYPE_DBM "dbm"
extern DICT *dict_dbm_open(const char *, int, int);
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
#endif
|
#include <string.h>
#include "modules/enose/enose.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/adc.h"
#include BOARD_CONFIG
uint8_t enose_status;
uint8_t enose_heat[ENOSE_NB_SENSOR];
uint16_t enose_val[ENOSE_NB_SENSOR];
uint16_t enose_PID_val;
#define ENOSE_SLAVE_ADDR 0xAE
#define ENOSE_PWM_ADDR 0x06
#define ENOSE_DATA_ADDR 0x00
#define ENOSE_HEAT_INIT 237
static uint8_t enose_conf_requested;
static volatile bool_t enose_i2c_done;
static struct adc_buf buf_PID;
void enose_init( void ) {
uint8_t i;
for (i=0; i< ENOSE_NB_SENSOR; i++) {
enose_heat[i] = ENOSE_HEAT_INIT;
enose_val[i] = 0;
}
enose_status = ENOSE_IDLE;
enose_conf_requested = TRUE;
enose_i2c_done = TRUE;
#ifdef ADC_CHANNEL_PID
adc_buf_channel(ADC_CHANNEL_PID, &buf_PID, ADC_CHANNEL_PID_NB_SAMPLES);
#endif
}
void enose_set_heat(uint8_t no_sensor, uint8_t value) {
enose_heat[no_sensor] = value;
enose_conf_requested = TRUE;
}
#ifndef DOWNLINK_DEVICE
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
#endif
#include "mcu_periph/uart.h"
#include "messages.h"
#include "subsystems/datalink/downlink.h"
void enose_periodic( void ) {
enose_PID_val = buf_PID.sum / buf_PID.av_nb_sample;
if (enose_i2c_done) {
if (enose_conf_requested) {
const uint8_t msg[] = { ENOSE_PWM_ADDR, enose_heat[0], enose_heat[1], enose_heat[2] };
memcpy((void*)i2c0_buf, msg, sizeof(msg));
i2c0_transmit(ENOSE_SLAVE_ADDR, sizeof(msg), &enose_i2c_done);
enose_i2c_done = FALSE;
enose_conf_requested = FALSE;
}
else if (enose_status == ENOSE_IDLE) {
enose_status = ENOSE_MEASURING_WR;
const uint8_t msg[] = { ENOSE_DATA_ADDR };
memcpy((void*)i2c0_buf, msg, sizeof(msg));
i2c0_transmit(ENOSE_SLAVE_ADDR, sizeof(msg), &enose_i2c_done);
enose_i2c_done = FALSE;
}
else if (enose_status == ENOSE_MEASURING_WR) {
enose_status = ENOSE_MEASURING_RD;
i2c0_receive(ENOSE_SLAVE_ADDR, 6, &enose_i2c_done);
enose_i2c_done = FALSE;
}
else if (enose_status == ENOSE_MEASURING_RD) {
uint16_t val = (i2c0_buf[0]<<8) | i2c0_buf[1];
if (val < 5000)
enose_val[0] = val;
val = (i2c0_buf[2]<<8) | i2c0_buf[3];
if (val < 5000)
enose_val[1] = val;
val = (i2c0_buf[4]<<8) | i2c0_buf[5];
if (val < 5000)
enose_val[2] = val;
enose_status = ENOSE_IDLE;
}
}
DOWNLINK_SEND_ENOSE_STATUS(DefaultChannel, DefaultDevice,&enose_val[0], &enose_val[1], &enose_val[2], &enose_PID_val, 3, enose_heat);
}
|
/* Reentrant random function from POSIX.1c.
Copyright (C) 1996, 1999, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 <stdlib.h>
/* This algorithm is mentioned in the ISO C standard, here extended
for 32 bits. */
int
rand_r (unsigned int *seed)
{
unsigned int next = *seed;
int result;
next *= 1103515245;
next += 12345;
result = (unsigned int) (next / 65536) % 2048;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (unsigned int) (next / 65536) % 1024;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (unsigned int) (next / 65536) % 1024;
*seed = next;
return result;
}
|
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_AUDIO_PROCESSING_AGC2_LIMITER_DB_GAIN_CURVE_H_
#define MODULES_AUDIO_PROCESSING_AGC2_LIMITER_DB_GAIN_CURVE_H_
#include <array>
#include "modules/audio_processing/agc2/agc2_testing_common.h"
namespace webrtc {
// A class for computing a limiter gain curve (in dB scale) given a set of
// hard-coded parameters (namely, kLimiterDbGainCurveMaxInputLevelDbFs,
// kLimiterDbGainCurveKneeSmoothnessDb, and
// kLimiterDbGainCurveCompressionRatio). The generated curve consists of four
// regions: identity (linear), knee (quadratic polynomial), compression
// (linear), saturation (linear). The aforementioned constants are used to shape
// the different regions.
class LimiterDbGainCurve {
public:
LimiterDbGainCurve();
double max_input_level_db() const { return max_input_level_db_; }
double max_input_level_linear() const { return max_input_level_linear_; }
double knee_start_linear() const { return knee_start_linear_; }
double limiter_start_linear() const { return limiter_start_linear_; }
// These methods can be marked 'constexpr' in C++ 14.
double GetOutputLevelDbfs(double input_level_dbfs) const;
double GetGainLinear(double input_level_linear) const;
double GetGainFirstDerivativeLinear(double x) const;
double GetGainIntegralLinear(double x0, double x1) const;
private:
double GetKneeRegionOutputLevelDbfs(double input_level_dbfs) const;
double GetCompressorRegionOutputLevelDbfs(double input_level_dbfs) const;
static constexpr double max_input_level_db_ = test::kLimiterMaxInputLevelDbFs;
static constexpr double knee_smoothness_db_ = test::kLimiterKneeSmoothnessDb;
static constexpr double compression_ratio_ = test::kLimiterCompressionRatio;
const double max_input_level_linear_;
// Do not modify signal with level <= knee_start_dbfs_.
const double knee_start_dbfs_;
const double knee_start_linear_;
// The upper end of the knee region, which is between knee_start_dbfs_ and
// limiter_start_dbfs_.
const double limiter_start_dbfs_;
const double limiter_start_linear_;
// Coefficients {a, b, c} of the knee region polynomial
// ax^2 + bx + c in the DB scale.
const std::array<double, 3> knee_region_polynomial_;
// Parameters for the computation of the first derivative of GetGainLinear().
const double gain_curve_limiter_d1_;
const double gain_curve_limiter_d2_;
// Parameters for the computation of the integral of GetGainLinear().
const double gain_curve_limiter_i1_;
const double gain_curve_limiter_i2_;
};
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_AGC2_LIMITER_DB_GAIN_CURVE_H_
|
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
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 __UILABELBMFONT_H__
#define __UILABELBMFONT_H__
#include "ui/UIWidget.h"
NS_CC_BEGIN
namespace ui {
/**
* @js NA
* @lua NA
*/
class TextBMFont : public Widget
{
DECLARE_CLASS_GUI_INFO
public:
/**
* Default constructor
*/
TextBMFont();
/**
* Default destructor
*/
virtual ~TextBMFont();
/**
* Allocates and initializes.
*/
static TextBMFont* create();
static TextBMFont* create(const std::string& text, const std::string& filename);
/** init a bitmap font atlas with an initial string and the FNT file */
void setFntFile(const std::string& fileName);
/** set string value for labelbmfont*/
void setText(const std::string& value);
/** get string value for labelbmfont*/
const std::string getStringValue();
virtual const Size& getVirtualRendererSize() const override;
virtual Node* getVirtualRenderer() override;
/**
* Returns the "class name" of widget.
*/
virtual std::string getDescription() const override;
protected:
virtual void initRenderer() override;
virtual void onSizeChanged() override;
virtual void updateTextureColor() override;
virtual void updateTextureOpacity() override;
virtual void updateTextureRGBA() override;
void labelBMFontScaleChangedWithSize();
virtual Widget* createCloneInstance() override;
virtual void copySpecialProperties(Widget* model) override;
virtual void adaptRenderers() override;
protected:
cocos2d::Label* _labelBMFontRenderer;
bool _fntFileHasInit;
std::string _fntFileName;
std::string _stringValue;
bool _labelBMFontRendererAdaptDirty;
};
}
NS_CC_END
#endif /* defined(__LabelBMFont__) */
|
//===--- RecursiveSymbolVisitor.h - Clang refactoring library -------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// A wrapper class around \c RecursiveASTVisitor that visits each
/// occurrences of a named symbol.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLING_REFACTOR_RECURSIVE_SYMBOL_VISITOR_H
#define LLVM_CLANG_TOOLING_REFACTOR_RECURSIVE_SYMBOL_VISITOR_H
#include "clang/AST/AST.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Lex/Lexer.h"
namespace clang {
namespace tooling {
/// Traverses the AST and visits the occurrence of each named symbol in the
/// given nodes.
template <typename T>
class RecursiveSymbolVisitor
: public RecursiveASTVisitor<RecursiveSymbolVisitor<T>> {
using BaseType = RecursiveASTVisitor<RecursiveSymbolVisitor<T>>;
public:
RecursiveSymbolVisitor(const SourceManager &SM, const LangOptions &LangOpts)
: SM(SM), LangOpts(LangOpts) {}
bool visitSymbolOccurrence(const NamedDecl *ND,
ArrayRef<SourceRange> NameRanges) {
return true;
}
// Declaration visitors:
bool VisitNamedDecl(const NamedDecl *D) {
return isa<CXXConversionDecl>(D) ? true : visit(D, D->getLocation());
}
bool VisitCXXConstructorDecl(const CXXConstructorDecl *CD) {
for (const auto *Initializer : CD->inits()) {
// Ignore implicit initializers.
if (!Initializer->isWritten())
continue;
if (const FieldDecl *FD = Initializer->getMember()) {
if (!visit(FD, Initializer->getSourceLocation(),
Lexer::getLocForEndOfToken(Initializer->getSourceLocation(),
0, SM, LangOpts)))
return false;
}
}
return true;
}
// Expression visitors:
bool VisitDeclRefExpr(const DeclRefExpr *Expr) {
return visit(Expr->getFoundDecl(), Expr->getLocation());
}
bool VisitMemberExpr(const MemberExpr *Expr) {
return visit(Expr->getFoundDecl().getDecl(), Expr->getMemberLoc());
}
bool VisitOffsetOfExpr(const OffsetOfExpr *S) {
for (unsigned I = 0, E = S->getNumComponents(); I != E; ++I) {
const OffsetOfNode &Component = S->getComponent(I);
if (Component.getKind() == OffsetOfNode::Field) {
if (!visit(Component.getField(), Component.getEndLoc()))
return false;
}
// FIXME: Try to resolve dependent field references.
}
return true;
}
// Other visitors:
bool VisitTypeLoc(const TypeLoc Loc) {
const SourceLocation TypeBeginLoc = Loc.getBeginLoc();
const SourceLocation TypeEndLoc =
Lexer::getLocForEndOfToken(TypeBeginLoc, 0, SM, LangOpts);
if (const auto *TemplateTypeParm =
dyn_cast<TemplateTypeParmType>(Loc.getType())) {
if (!visit(TemplateTypeParm->getDecl(), TypeBeginLoc, TypeEndLoc))
return false;
}
if (const auto *TemplateSpecType =
dyn_cast<TemplateSpecializationType>(Loc.getType())) {
if (!visit(TemplateSpecType->getTemplateName().getAsTemplateDecl(),
TypeBeginLoc, TypeEndLoc))
return false;
}
if (const Type *TP = Loc.getTypePtr()) {
if (TP->getTypeClass() == clang::Type::Record)
return visit(TP->getAsCXXRecordDecl(), TypeBeginLoc, TypeEndLoc);
}
return true;
}
bool VisitTypedefTypeLoc(TypedefTypeLoc TL) {
const SourceLocation TypeEndLoc =
Lexer::getLocForEndOfToken(TL.getBeginLoc(), 0, SM, LangOpts);
return visit(TL.getTypedefNameDecl(), TL.getBeginLoc(), TypeEndLoc);
}
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) {
// The base visitor will visit NNSL prefixes, so we should only look at
// the current NNS.
if (NNS) {
const NamespaceDecl *ND = NNS.getNestedNameSpecifier()->getAsNamespace();
if (!visit(ND, NNS.getLocalBeginLoc(), NNS.getLocalEndLoc()))
return false;
}
return BaseType::TraverseNestedNameSpecifierLoc(NNS);
}
private:
const SourceManager &SM;
const LangOptions &LangOpts;
bool visit(const NamedDecl *ND, SourceLocation BeginLoc,
SourceLocation EndLoc) {
return static_cast<T *>(this)->visitSymbolOccurrence(
ND, SourceRange(BeginLoc, EndLoc));
}
bool visit(const NamedDecl *ND, SourceLocation Loc) {
return visit(ND, Loc, Lexer::getLocForEndOfToken(Loc, 0, SM, LangOpts));
}
};
} // end namespace tooling
} // end namespace clang
#endif // LLVM_CLANG_TOOLING_REFACTOR_RECURSIVE_SYMBOL_VISITOR_H
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
#define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "components/storage_monitor/storage_monitor.h"
namespace base {
class FilePath;
}
namespace storage_monitor {
class PortableDeviceWatcherWin;
class TestStorageMonitorWin;
class VolumeMountWatcherWin;
class StorageMonitorWin : public StorageMonitor {
public:
// Should only be called by browser start up code.
// Use StorageMonitor::GetInstance() instead.
// To support unit tests, this constructor takes |volume_mount_watcher| and
// |portable_device_watcher| objects. These params are either constructed in
// unit tests or in StorageMonitorWin CreateInternal() function.
StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher,
PortableDeviceWatcherWin* portable_device_watcher);
~StorageMonitorWin() override;
// Must be called after the file thread is created.
void Init() override;
// StorageMonitor:
bool GetStorageInfoForPath(const base::FilePath& path,
StorageInfo* device_info) const override;
bool GetMTPStorageInfoFromDeviceId(
const std::string& storage_device_id,
base::string16* device_location,
base::string16* storage_object_id) const override;
void EjectDevice(
const std::string& device_id,
base::Callback<void(EjectStatus)> callback) override;
private:
class PortableDeviceNotifications;
friend class TestStorageMonitorWin;
void MediaChangeNotificationRegister();
// Gets the removable storage information given a |device_path|. On success,
// returns true and fills in |info|.
bool GetDeviceInfo(const base::FilePath& device_path,
StorageInfo* info) const;
static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam,
LPARAM lparam);
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam,
LPARAM lparam);
void OnDeviceChange(UINT event_type, LPARAM data);
void OnMediaChange(WPARAM wparam, LPARAM lparam);
// The window class of |window_|.
ATOM window_class_;
// The handle of the module that contains the window procedure of |window_|.
HMODULE instance_;
HWND window_;
// The handle of a registration for shell notifications.
ULONG shell_change_notify_id_;
// The volume mount point watcher, used to manage the mounted devices.
scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_;
// The portable device watcher, used to manage media transfer protocol
// devices.
scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_;
DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin);
};
} // namespace storage_monitor
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
|
//RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdarg.h>
void a(const char *a, ...) __attribute__((format(printf, 1,2))); // no-error
void b(const char *a, ...) __attribute__((format(printf, 1,1))); // expected-error {{'format' attribute parameter 3 is out of bounds}}
void c(const char *a, ...) __attribute__((format(printf, 0,2))); // expected-error {{'format' attribute parameter 2 is out of bounds}}
void d(const char *a, int c) __attribute__((format(printf, 1,2))); // expected-error {{format attribute requires variadic function}}
void e(char *str, int c, ...) __attribute__((format(printf, 2,3))); // expected-error {{format argument not a string type}}
typedef const char* xpto;
void f(xpto c, va_list list) __attribute__((format(printf, 1, 0))); // no-error
void g(xpto c) __attribute__((format(printf, 1, 0))); // no-error
void y(char *str) __attribute__((format(strftime, 1,0))); // no-error
void z(char *str, int c, ...) __attribute__((format(strftime, 1,2))); // expected-error {{strftime format attribute requires 3rd parameter to be 0}}
int (*f_ptr)(char*,...) __attribute__((format(printf, 1,2))); // no-error
int (*f2_ptr)(double,...) __attribute__((format(printf, 1, 2))); // expected-error {{format argument not a string type}}
struct _mystruct {
int (*printf)(const char *format, ...) __attribute__((__format__(printf, 1, 2))); // no-error
int (*printf2)(double format, ...) __attribute__((__format__(printf, 1, 2))); // expected-error {{format argument not a string type}}
};
typedef int (*f3_ptr)(char*,...) __attribute__((format(printf,1,0))); // no-error
// <rdar://problem/6623513>
int rdar6623513(void *, const char*, const char*, ...)
__attribute__ ((format (printf, 3, 0)));
int rdar6623513_aux(int len, const char* s) {
rdar6623513(0, "hello", "%.*s", len, s);
}
// same as format(printf(...))...
void a2(const char *a, ...) __attribute__((format(printf0, 1,2))); // no-error
void b2(const char *a, ...) __attribute__((format(printf0, 1,1))); // expected-error {{'format' attribute parameter 3 is out of bounds}}
void c2(const char *a, ...) __attribute__((format(printf0, 0,2))); // expected-error {{'format' attribute parameter 2 is out of bounds}}
void d2(const char *a, int c) __attribute__((format(printf0, 1,2))); // expected-error {{format attribute requires variadic function}}
void e2(char *str, int c, ...) __attribute__((format(printf0, 2,3))); // expected-error {{format argument not a string type}}
// FreeBSD usage
#define __printf0like(fmt,va) __attribute__((__format__(__printf0__,fmt,va)))
void null(int i, const char *a, ...) __printf0like(2,0); // no-error
void null(int i, const char *a, ...) { // expected-note{{passing argument to parameter 'a' here}}
if (a)
(void)0/* vprintf(...) would go here */;
}
void callnull(void){
null(0, 0); // no error
null(0, (char*)0); // no error
null(0, (void*)0); // no error
null(0, (int*)0); // expected-warning {{incompatible pointer types}}
}
// PR4470
int xx_vprintf(const char *, va_list);
const char *foo(const char *format) __attribute__((format_arg(1)));
void __attribute__((format(printf, 1, 0)))
foo2(const char *fmt, va_list va) {
xx_vprintf(foo(fmt), va);
}
// PR6542
extern void gcc_format (const char *, ...)
__attribute__ ((__format__(__gcc_diag__, 1, 2)));
extern void gcc_cformat (const char *, ...)
__attribute__ ((__format__(__gcc_cdiag__, 1, 2)));
extern void gcc_cxxformat (const char *, ...)
__attribute__ ((__format__(__gcc_cxxdiag__, 1, 2)));
extern void gcc_tformat (const char *, ...)
__attribute__ ((__format__(__gcc_tdiag__, 1, 2)));
const char *foo3(const char *format) __attribute__((format_arg("foo"))); // expected-error{{'format_arg' attribute requires parameter 1 to be an integer constant}}
|
#ifndef _FOCAL_MCAPTESTLIB_H
#define _FOCAL_MCAPTESTLIB_H
#define TX_NUM_MAX 30
#define RX_NUM_MAX 30
#define boolean unsigned char
#define false 0
#define true 1
typedef int (*FTS_I2c_Read_Function)(unsigned char * , int , unsigned char *, int);
typedef int (*FTS_I2c_Write_Function)(unsigned char * , int);
int Init_I2C_Read_Func(FTS_I2c_Read_Function fpI2C_Read);
int Init_I2C_Write_Func(FTS_I2c_Write_Function fpI2C_Write);
int SetParamData(char *TestParamData);
void FreeTestParamData(void);
boolean StartTestTP(void);
#endif
|
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
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 <features.h>
#include <stdlib.h>
#include <dlfcn.h>
/* psm: keep this before internals.h */
libc_hidden_proto(exit)
#include "internals.h"
/* Pointers to the libc functions. */
struct pthread_functions __libc_pthread_functions attribute_hidden;
# define FORWARD2(name, rettype, decl, params, defaction) \
rettype \
name decl \
{ \
if (__libc_pthread_functions.ptr_##name == NULL) \
defaction; \
\
return __libc_pthread_functions.ptr_##name params; \
}
# define FORWARD(name, decl, params, defretval) \
FORWARD2 (name, int, decl, params, return defretval)
FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0)
FORWARD (pthread_attr_init, (pthread_attr_t *attr), (attr), 0)
FORWARD (pthread_attr_getdetachstate,
(const pthread_attr_t *attr, int *detachstate), (attr, detachstate),
0)
FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate),
(attr, detachstate), 0)
FORWARD (pthread_attr_getinheritsched,
(const pthread_attr_t *attr, int *inherit), (attr, inherit), 0)
FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit),
(attr, inherit), 0)
FORWARD (pthread_attr_getschedparam,
(const pthread_attr_t *attr, struct sched_param *param),
(attr, param), 0)
FORWARD (pthread_attr_setschedparam,
(pthread_attr_t *attr, const struct sched_param *param),
(attr, param), 0)
FORWARD (pthread_attr_getschedpolicy,
(const pthread_attr_t *attr, int *policy), (attr, policy), 0)
FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy),
(attr, policy), 0)
FORWARD (pthread_attr_getscope,
(const pthread_attr_t *attr, int *scope), (attr, scope), 0)
FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
(attr, scope), 0)
FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0)
FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0)
FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0)
FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
FORWARD (pthread_cond_init,
(pthread_cond_t *cond, const pthread_condattr_t *cond_attr),
(cond, cond_attr), 0)
FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0)
FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
(cond, mutex), 0)
FORWARD (pthread_cond_timedwait,
(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *abstime), (cond, mutex, abstime), 0)
FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
(thread1, thread2), 1)
/* Use an alias to avoid warning, as pthread_exit is declared noreturn. */
FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
strong_alias (__pthread_exit, pthread_exit)
FORWARD (pthread_getschedparam,
(pthread_t target_thread, int *policy, struct sched_param *param),
(target_thread, policy, param), 0)
FORWARD (pthread_setschedparam,
(pthread_t target_thread, int policy,
const struct sched_param *param), (target_thread, policy, param), 0)
FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
FORWARD (pthread_mutex_init,
(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
(mutex, mutexattr), 0)
strong_alias(pthread_mutex_init, __pthread_mutex_init)
FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
FORWARD (pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), 0)
strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock)
FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
0)
FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
|
/* src/port/getopt.c */
/* This is used by psql under Win32 */
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. 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 University 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
*/
#include "c.h"
#include "pg_getopt.h"
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
/*
* On some versions of Solaris, opterr and friends are defined in core libc
* rather than in a separate getopt module. Define these variables only
* if configure found they aren't there by default. (We assume that testing
* opterr is sufficient for all of these.)
*/
#ifndef HAVE_INT_OPTERR
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
#endif
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
/*
* getopt
* Parse argc/argv argument vector.
*
* This implementation does not use optreset. Instead, we guarantee that
* it can be restarted on a new argv array after a previous call returned -1,
* if the caller resets optind to 1 before the first call of the new series.
* (Internally, this means we must be sure to reset "place" to EMSG before
* returning -1.)
*/
int
getopt(int nargc, char *const * nargv, const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
if (!*place)
{ /* update scanning pointer */
if (optind >= nargc || *(place = nargv[optind]) != '-')
{
place = EMSG;
return -1;
}
if (place[1] && *++place == '-' && place[1] == '\0')
{ /* found "--" */
++optind;
place = EMSG;
return -1;
}
} /* option letter okay? */
if ((optopt = (int) *place++) == (int) ':' ||
!(oli = strchr(ostr, optopt)))
{
/*
* if the user didn't specify '-' as an option, assume it means -1.
*/
if (optopt == (int) '-')
{
place = EMSG;
return -1;
}
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void) fprintf(stderr,
"illegal option -- %c\n", optopt);
return BADCH;
}
if (*++oli != ':')
{ /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else
{ /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind)
{ /* no arg */
place = EMSG;
if (*ostr == ':')
return BADARG;
if (opterr)
(void) fprintf(stderr,
"option requires an argument -- %c\n",
optopt);
return BADCH;
}
else
/* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return optopt; /* dump back option letter */
}
|
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
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) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), Nokia Corporation
(or its successors, if any) and the KDE Free Qt Foundation, which shall
act as a proxy defined in Section 6 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef STREAMINTERFACE_P_H
#define STREAMINTERFACE_P_H
#include "streaminterface.h"
#include "mediasource.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
namespace Phonon
{
class StreamInterfacePrivate
{
friend class StreamInterface;
public:
void disconnectMediaStream();
protected:
inline StreamInterfacePrivate()
: connected(false)
{
}
StreamInterface *q;
MediaSource mediaSource;
bool connected;
};
} // namespace Phonon
#endif // QT_NO_PHONON_ABSTRACTMEDIASTREAM
QT_END_NAMESPACE
#endif // STREAMINTERFACE_P_H
// vim: sw=4 sts=4 et tw=100
|
//===-- RemarkStringTable.h - Serializing string table ----------*- C++/-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This class is used to deduplicate and serialize a string table used for
// generating remarks.
//
// For parsing a string table, use ParsedStringTable in RemarkParser.h
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_REMARKS_REMARK_STRING_TABLE_H
#define LLVM_REMARKS_REMARK_STRING_TABLE_H
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include <vector>
namespace llvm {
class raw_ostream;
namespace remarks {
/// The string table used for serializing remarks.
/// This table can be for example serialized in a section to be consumed after
/// the compilation.
struct StringTable {
/// Allocator holding all the memory used by the map.
BumpPtrAllocator Allocator;
/// The string table containing all the unique strings used in the output.
/// It maps a string to an unique ID.
StringMap<unsigned, BumpPtrAllocator &> StrTab;
/// Total size of the string table when serialized.
size_t SerializedSize = 0;
StringTable() : Allocator(), StrTab(Allocator) {}
/// Add a string to the table. It returns an unique ID of the string.
std::pair<unsigned, StringRef> add(StringRef Str);
/// Serialize the string table to a stream. It is serialized as a little
/// endian uint64 (the size of the table in bytes) followed by a sequence of
/// NULL-terminated strings, where the N-th string is the string with the ID N
/// in the StrTab map.
void serialize(raw_ostream &OS) const;
/// Serialize the string table to a vector. This allows users to do the actual
/// writing to file/memory/other.
/// The string with the ID == N should be the N-th element in the vector.
std::vector<StringRef> serialize() const;
};
} // end namespace remarks
} // end namespace llvm
#endif /* LLVM_REMARKS_REMARK_STRING_TABLE_H */
|
/**
* \file
*
* \brief Instance description for NVMCTRL
*
* Copyright (c) 2016 Atmel Corporation,
* a wholly owned subsidiary of Microchip Technology Inc.
*
* \asf_license_start
*
* \page License
*
* 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 Licence 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.
*
* \asf_license_stop
*
*/
#ifndef _SAMR21_NVMCTRL_INSTANCE_
#define _SAMR21_NVMCTRL_INSTANCE_
/* ========== Register definition for NVMCTRL peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_NVMCTRL_CTRLA (0x41004000) /**< \brief (NVMCTRL) Control A */
#define REG_NVMCTRL_CTRLB (0x41004004) /**< \brief (NVMCTRL) Control B */
#define REG_NVMCTRL_PARAM (0x41004008) /**< \brief (NVMCTRL) NVM Parameter */
#define REG_NVMCTRL_INTENCLR (0x4100400C) /**< \brief (NVMCTRL) Interrupt Enable Clear */
#define REG_NVMCTRL_INTENSET (0x41004010) /**< \brief (NVMCTRL) Interrupt Enable Set */
#define REG_NVMCTRL_INTFLAG (0x41004014) /**< \brief (NVMCTRL) Interrupt Flag Status and Clear */
#define REG_NVMCTRL_STATUS (0x41004018) /**< \brief (NVMCTRL) Status */
#define REG_NVMCTRL_ADDR (0x4100401C) /**< \brief (NVMCTRL) Address */
#define REG_NVMCTRL_LOCK (0x41004020) /**< \brief (NVMCTRL) Lock Section */
#else
#define REG_NVMCTRL_CTRLA (*(RwReg16*)0x41004000UL) /**< \brief (NVMCTRL) Control A */
#define REG_NVMCTRL_CTRLB (*(RwReg *)0x41004004UL) /**< \brief (NVMCTRL) Control B */
#define REG_NVMCTRL_PARAM (*(RwReg *)0x41004008UL) /**< \brief (NVMCTRL) NVM Parameter */
#define REG_NVMCTRL_INTENCLR (*(RwReg8 *)0x4100400CUL) /**< \brief (NVMCTRL) Interrupt Enable Clear */
#define REG_NVMCTRL_INTENSET (*(RwReg8 *)0x41004010UL) /**< \brief (NVMCTRL) Interrupt Enable Set */
#define REG_NVMCTRL_INTFLAG (*(RwReg8 *)0x41004014UL) /**< \brief (NVMCTRL) Interrupt Flag Status and Clear */
#define REG_NVMCTRL_STATUS (*(RwReg16*)0x41004018UL) /**< \brief (NVMCTRL) Status */
#define REG_NVMCTRL_ADDR (*(RwReg *)0x4100401CUL) /**< \brief (NVMCTRL) Address */
#define REG_NVMCTRL_LOCK (*(RwReg16*)0x41004020UL) /**< \brief (NVMCTRL) Lock Section */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
/* ========== Instance parameters for NVMCTRL peripheral ========== */
#define NVMCTRL_AUX0_ADDRESS 0x00804000
#define NVMCTRL_AUX1_ADDRESS 0x00806000
#define NVMCTRL_AUX2_ADDRESS 0x00808000
#define NVMCTRL_AUX3_ADDRESS 0x0080A000
#define NVMCTRL_CLK_AHB_ID 4 // Index of AHB Clock in PM.AHBMASK register
#define NVMCTRL_FACTORY_WORD_IMPLEMENTED_MASK 0xC0000007FFFFFFFF
#define NVMCTRL_FLASH_SIZE 262144
#define NVMCTRL_LOCKBIT_ADDRESS 0x00802000
#define NVMCTRL_PAGE_HW 32
#define NVMCTRL_PAGE_SIZE 64
#define NVMCTRL_PAGE_W 16
#define NVMCTRL_PMSB 3
#define NVMCTRL_PSZ_BITS 6
#define NVMCTRL_ROW_PAGES 4
#define NVMCTRL_ROW_SIZE 256
#define NVMCTRL_TEMP_LOG_ADDRESS 0x00806030
#define NVMCTRL_USER_PAGE_ADDRESS 0x00800000
#define NVMCTRL_USER_PAGE_OFFSET 0x00800000
#define NVMCTRL_USER_WORD_IMPLEMENTED_MASK 0xC01FFFFFFFFFFFFF
#endif /* _SAMR21_NVMCTRL_INSTANCE_ */
|
/* sdp_internal.h - Service Discovery Protocol handling */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* The PDU identifiers of SDP packets between client and server
*/
#define BT_SDP_ERROR_RSP 0x01
#define BT_SDP_SVC_SEARCH_REQ 0x02
#define BT_SDP_SVC_SEARCH_RSP 0x03
#define BT_SDP_SVC_ATTR_REQ 0x04
#define BT_SDP_SVC_ATTR_RSP 0x05
#define BT_SDP_SVC_SEARCH_ATTR_REQ 0x06
#define BT_SDP_SVC_SEARCH_ATTR_RSP 0x07
/*
* Some additions to support service registration.
* These are outside the scope of the Bluetooth specification
*/
#define BT_SDP_SVC_REGISTER_REQ 0x75
#define BT_SDP_SVC_REGISTER_RSP 0x76
#define BT_SDP_SVC_UPDATE_REQ 0x77
#define BT_SDP_SVC_UPDATE_RSP 0x78
#define BT_SDP_SVC_REMOVE_REQ 0x79
#define BT_SDP_SVC_REMOVE_RSP 0x80
/*
* SDP Error codes
*/
#define BT_SDP_INVALID_VERSION 0x0001
#define BT_SDP_INVALID_RECORD_HANDLE 0x0002
#define BT_SDP_INVALID_SYNTAX 0x0003
#define BT_SDP_INVALID_PDU_SIZE 0x0004
#define BT_SDP_INVALID_CSTATE 0x0005
#define BT_SDP_MAX_SERVICES 10
struct bt_sdp_data_elem_seq {
u8_t type; /* Type: Will be data element sequence */
u16_t size; /* We only support 2 byte sizes for now */
} __packed;
struct bt_sdp_hdr {
u8_t op_code;
u16_t tid;
u16_t param_len;
} __packed;
struct bt_sdp_svc_rsp {
u16_t total_recs;
u16_t current_recs;
} __packed;
struct bt_sdp_att_rsp {
u16_t att_list_len;
} __packed;
/* Allowed attributes length in SSA Request PDU to be taken from server */
#define BT_SDP_MAX_ATTR_LEN 0xffff
/* Max allowed length of PDU Continuation State */
#define BT_SDP_MAX_PDU_CSTATE_LEN 16
/* Type mapping SDP PDU Continuation State */
struct bt_sdp_pdu_cstate {
u8_t length;
u8_t data[BT_SDP_MAX_PDU_CSTATE_LEN];
} __packed;
void bt_sdp_init(void);
|
/*
* This is the source code of Telegram for iOS v. 1.1
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Peter Iakovlev, 2013.
*/
#import <Foundation/Foundation.h>
#import "TLObject.h"
#import "TLMetaRpc.h"
@interface TLcontacts_Contacts : NSObject <TLObject>
@end
@interface TLcontacts_Contacts$contacts_contacts : TLcontacts_Contacts
@property (nonatomic, retain) NSArray *contacts;
@property (nonatomic, retain) NSArray *users;
@end
@interface TLcontacts_Contacts$contacts_contactsNotModified : TLcontacts_Contacts
@end
|
/*
* arch/arm/mach-iop33x/iq80331.c
*
* Board support code for the Intel IQ80331 platform.
*
* Author: Dave Jiang <dave.jiang@intel.com>
* Copyright (C) 2003 Intel Corp.
*
* 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.
*/
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/serial_core.h>
#include <linux/serial_8250.h>
#include <linux/mtd/physmap.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/pci.h>
#include <asm/mach/time.h>
#include <asm/mach-types.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <mach/time.h>
/*
* IQ80331 timer tick configuration.
*/
static void __init iq80331_timer_init(void)
{
/* D-Step parts run at a higher internal bus frequency */
if (*IOP3XX_ATURID >= 0xa)
iop_init_time(333000000);
else
iop_init_time(266000000);
}
static struct sys_timer iq80331_timer = {
.init = iq80331_timer_init,
};
/*
* IQ80331 PCI.
*/
static int __init
iq80331_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
int irq;
if (slot == 1 && pin == 1) {
/* PCI-X Slot INTA */
irq = IRQ_IOP33X_XINT1;
} else if (slot == 1 && pin == 2) {
/* PCI-X Slot INTB */
irq = IRQ_IOP33X_XINT2;
} else if (slot == 1 && pin == 3) {
/* PCI-X Slot INTC */
irq = IRQ_IOP33X_XINT3;
} else if (slot == 1 && pin == 4) {
/* PCI-X Slot INTD */
irq = IRQ_IOP33X_XINT0;
} else if (slot == 2) {
/* GigE */
irq = IRQ_IOP33X_XINT2;
} else {
printk(KERN_ERR "iq80331_pci_map_irq() called for unknown "
"device PCI:%d:%d:%d\n", dev->bus->number,
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
irq = -1;
}
return irq;
}
static struct hw_pci iq80331_pci __initdata = {
.nr_controllers = 1,
.ops = &iop3xx_ops,
.setup = iop3xx_pci_setup,
.preinit = iop3xx_pci_preinit_cond,
.map_irq = iq80331_pci_map_irq,
};
static int __init iq80331_pci_init(void)
{
if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
machine_is_iq80331())
pci_common_init(&iq80331_pci);
return 0;
}
subsys_initcall(iq80331_pci_init);
/*
* IQ80331 machine initialisation.
*/
static struct physmap_flash_data iq80331_flash_data = {
.width = 1,
};
static struct resource iq80331_flash_resource = {
.start = 0xc0000000,
.end = 0xc07fffff,
.flags = IORESOURCE_MEM,
};
static struct platform_device iq80331_flash_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &iq80331_flash_data,
},
.num_resources = 1,
.resource = &iq80331_flash_resource,
};
static void __init iq80331_init_machine(void)
{
platform_device_register(&iop3xx_i2c0_device);
platform_device_register(&iop3xx_i2c1_device);
platform_device_register(&iop33x_uart0_device);
platform_device_register(&iop33x_uart1_device);
platform_device_register(&iq80331_flash_device);
platform_device_register(&iop3xx_dma_0_channel);
platform_device_register(&iop3xx_dma_1_channel);
platform_device_register(&iop3xx_aau_channel);
}
MACHINE_START(IQ80331, "Intel IQ80331")
/* Maintainer: Intel Corp. */
.atag_offset = 0x100,
.map_io = iop3xx_map_io,
.init_irq = iop33x_init_irq,
.timer = &iq80331_timer,
.init_machine = iq80331_init_machine,
.restart = iop3xx_restart,
MACHINE_END
|
/*
* linear least squares model
*
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
* 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
*/
/**
* @file lls.c
* linear least squares model
*/
#include <math.h>
#include <string.h>
#include "lls.h"
#ifdef TEST
#define av_log(a,b,...) printf(__VA_ARGS__)
#endif
void av_init_lls(LLSModel *m, int indep_count){
memset(m, 0, sizeof(LLSModel));
m->indep_count= indep_count;
}
void av_update_lls(LLSModel *m, double *var, double decay){
int i,j;
for(i=0; i<=m->indep_count; i++){
for(j=i; j<=m->indep_count; j++){
m->covariance[i][j] *= decay;
m->covariance[i][j] += var[i]*var[j];
}
}
}
void av_solve_lls(LLSModel *m, double threshold, int min_order){
int i,j,k;
double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
double *covar_y = m->covariance[0];
int count= m->indep_count;
for(i=0; i<count; i++){
for(j=i; j<count; j++){
double sum= covar[i][j];
for(k=i-1; k>=0; k--)
sum -= factor[i][k]*factor[j][k];
if(i==j){
if(sum < threshold)
sum= 1.0;
factor[i][i]= sqrt(sum);
}else
factor[j][i]= sum / factor[i][i];
}
}
for(i=0; i<count; i++){
double sum= covar_y[i+1];
for(k=i-1; k>=0; k--)
sum -= factor[i][k]*m->coeff[0][k];
m->coeff[0][i]= sum / factor[i][i];
}
for(j=count-1; j>=min_order; j--){
for(i=j; i>=0; i--){
double sum= m->coeff[0][i];
for(k=i+1; k<=j; k++)
sum -= factor[k][i]*m->coeff[j][k];
m->coeff[j][i]= sum / factor[i][i];
}
m->variance[j]= covar_y[0];
for(i=0; i<=j; i++){
double sum= m->coeff[j][i]*covar[i][i] - 2*covar_y[i+1];
for(k=0; k<i; k++)
sum += 2*m->coeff[j][k]*covar[k][i];
m->variance[j] += m->coeff[j][i]*sum;
}
}
}
double av_evaluate_lls(LLSModel *m, double *param, int order){
int i;
double out= 0;
for(i=0; i<=order; i++)
out+= param[i]*m->coeff[order][i];
return out;
}
#ifdef TEST
#include <stdlib.h>
#include <stdio.h>
int main(void){
LLSModel m;
int i, order;
av_init_lls(&m, 3);
for(i=0; i<100; i++){
double var[4];
double eval;
#if 0
var[1] = rand() / (double)RAND_MAX;
var[2] = rand() / (double)RAND_MAX;
var[3] = rand() / (double)RAND_MAX;
var[2]= var[1] + var[3]/2;
var[0] = var[1] + var[2] + var[3] + var[1]*var[2]/100;
#else
var[0] = (rand() / (double)RAND_MAX - 0.5)*2;
var[1] = var[0] + rand() / (double)RAND_MAX - 0.5;
var[2] = var[1] + rand() / (double)RAND_MAX - 0.5;
var[3] = var[2] + rand() / (double)RAND_MAX - 0.5;
#endif
av_update_lls(&m, var, 0.99);
av_solve_lls(&m, 0.001, 0);
for(order=0; order<3; order++){
eval= av_evaluate_lls(&m, var+1, order);
av_log(NULL, AV_LOG_DEBUG, "real:%f order:%d pred:%f var:%f coeffs:%f %f %f\n",
var[0], order, eval, sqrt(m.variance[order] / (i+1)),
m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
}
}
return 0;
}
#endif
|
/*
* mailbox-omap.h
*
* Copyright (C) 2013 Texas Instruments, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _PLAT_MAILBOX_H
#define _PLAT_MAILBOX_H
/* Interrupt register configuration types */
#define MBOX_INTR_CFG_TYPE1 (0)
#define MBOX_INTR_CFG_TYPE2 (1)
/**
* struct omap_mbox_dev_info - OMAP mailbox device attribute info
* @name: name of the mailbox device
* @tx_id: mailbox queue id used for transmitting messages
* @rx_id: mailbox queue id on which messages are received
* @irq_id: irq identifier number to use from the hwmod data
* @usr_id: mailbox user id for identifying the interrupt into
* the MPU interrupt controller.
*/
struct omap_mbox_dev_info {
const char *name;
u32 tx_id;
u32 rx_id;
u32 irq_id;
u32 usr_id;
};
/**
* struct omap_mbox_pdata - OMAP mailbox platform data
* @intr_type: type of interrupt configuration registers used
while programming mailbox queue interrupts
* @num_users: number of users (processor devices) that the mailbox
* h/w block can interrupt
* @num_fifos: number of h/w fifos within the mailbox h/w block
* @info_cnt: number of mailbox devices for the platform
* @info: array of mailbox device attributes
*/
struct omap_mbox_pdata {
u32 intr_type;
u32 num_users;
u32 num_fifos;
u32 info_cnt;
struct omap_mbox_dev_info *info;
};
#endif /* _PLAT_MAILBOX_H */
|
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <cstddef>
#include <string>
#include <utility>
#include <vector>
#include "Common/CommonTypes.h"
#include "VideoCommon/RenderState.h"
#include "VideoCommon/TextureConfig.h"
class AbstractShader;
class NativeVertexFormat;
// We use three pipeline usages:
// - GX
// - Per-stage UBO (VS/GS/PS, VS constants accessible from PS)
// - 8 combined image samplers (accessible from PS)
// - 1 SSBO, accessible from PS if bounding box is enabled
// - Utility
// - Single UBO, accessible from all stages [set=0, binding=1]
// - 8 combined image samplers (accessible from PS) [set=1, binding=0-7]
// - 1 texel buffer, accessible from PS [set=2, binding=0]
// - Compute
// - 1 uniform buffer [set=0, binding=1]
// - 8 combined image samplers [set=1, binding=0-7]
// - 1 texel buffer [set=2, binding=0]
// - 1 storage image [set=3, binding=0]
enum class AbstractPipelineUsage
{
GX,
Utility
};
struct AbstractPipelineConfig
{
const NativeVertexFormat* vertex_format;
const AbstractShader* vertex_shader;
const AbstractShader* geometry_shader;
const AbstractShader* pixel_shader;
RasterizationState rasterization_state;
DepthState depth_state;
BlendingState blending_state;
FramebufferState framebuffer_state;
AbstractPipelineUsage usage;
bool operator==(const AbstractPipelineConfig& rhs) const
{
return std::tie(vertex_format, vertex_shader, geometry_shader, pixel_shader,
rasterization_state.hex, depth_state.hex, blending_state.hex,
framebuffer_state.hex, usage) ==
std::tie(rhs.vertex_format, rhs.vertex_shader, rhs.geometry_shader, rhs.pixel_shader,
rhs.rasterization_state.hex, rhs.depth_state.hex, rhs.blending_state.hex,
rhs.framebuffer_state.hex, rhs.usage);
}
bool operator!=(const AbstractPipelineConfig& rhs) const { return !operator==(rhs); }
bool operator<(const AbstractPipelineConfig& rhs) const
{
return std::tie(vertex_format, vertex_shader, geometry_shader, pixel_shader,
rasterization_state.hex, depth_state.hex, blending_state.hex,
framebuffer_state.hex, usage) <
std::tie(rhs.vertex_format, rhs.vertex_shader, rhs.geometry_shader, rhs.pixel_shader,
rhs.rasterization_state.hex, rhs.depth_state.hex, rhs.blending_state.hex,
rhs.framebuffer_state.hex, rhs.usage);
}
};
class AbstractPipeline
{
public:
AbstractPipeline() = default;
virtual ~AbstractPipeline() = default;
// "Cache data" can be used to assist a driver with creating pipelines by using previously
// compiled shader ISA. The abstract shaders and creation struct are still required to create
// pipeline objects, the cache is optionally used by the driver to speed up compilation.
using CacheData = std::vector<u8>;
virtual CacheData GetCacheData() const { return {}; }
};
|
/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <string.h>
/* Default stack size. */
#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
/* Minimal stack size after allocating thread descriptor and guard size. */
#define MINIMAL_REST_STACK 2048
/* Alignment requirement for TCB. */
#define TCB_ALIGNMENT 16
/* Location of current stack frame. */
#define CURRENT_STACK_FRAME __builtin_frame_address (0)
|
/* stzt01.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Table of constant values */
static integer c__8 = 8;
static real c_b6 = 0.f;
static real c_b13 = -1.f;
static integer c__1 = 1;
doublereal stzt01_(integer *m, integer *n, real *a, real *af, integer *lda,
real *tau, real *work, integer *lwork)
{
/* System generated locals */
integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2;
real ret_val;
/* Local variables */
integer i__, j;
real norma, rwork[1];
extern /* Subroutine */ int saxpy_(integer *, real *, real *, integer *,
real *, integer *);
extern doublereal slamch_(char *), slange_(char *, integer *,
integer *, real *, integer *, real *);
extern /* Subroutine */ int xerbla_(char *, integer *), slaset_(
char *, integer *, integer *, real *, real *, real *, integer *), slatzm_(char *, integer *, integer *, real *, integer *,
real *, real *, real *, integer *, real *);
/* -- LAPACK test routine (version 3.1) -- */
/* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
/* November 2006 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* STZT01 returns */
/* || A - R*Q || / ( M * eps * ||A|| ) */
/* for an upper trapezoidal A that was factored with STZRQF. */
/* Arguments */
/* ========= */
/* M (input) INTEGER */
/* The number of rows of the matrices A and AF. */
/* N (input) INTEGER */
/* The number of columns of the matrices A and AF. */
/* A (input) REAL array, dimension (LDA,N) */
/* The original upper trapezoidal M by N matrix A. */
/* AF (input) REAL array, dimension (LDA,N) */
/* The output of STZRQF for input matrix A. */
/* The lower triangle is not referenced. */
/* LDA (input) INTEGER */
/* The leading dimension of the arrays A and AF. */
/* TAU (input) REAL array, dimension (M) */
/* Details of the Householder transformations as returned by */
/* STZRQF. */
/* WORK (workspace) REAL array, dimension (LWORK) */
/* LWORK (input) INTEGER */
/* The length of the array WORK. LWORK >= m*n + m. */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. Local Arrays .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Parameter adjustments */
af_dim1 = *lda;
af_offset = 1 + af_dim1;
af -= af_offset;
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
--tau;
--work;
/* Function Body */
ret_val = 0.f;
if (*lwork < *m * *n + *m) {
xerbla_("STZT01", &c__8);
return ret_val;
}
/* Quick return if possible */
if (*m <= 0 || *n <= 0) {
return ret_val;
}
norma = slange_("One-norm", m, n, &a[a_offset], lda, rwork);
/* Copy upper triangle R */
slaset_("Full", m, n, &c_b6, &c_b6, &work[1], m);
i__1 = *m;
for (j = 1; j <= i__1; ++j) {
i__2 = j;
for (i__ = 1; i__ <= i__2; ++i__) {
work[(j - 1) * *m + i__] = af[i__ + j * af_dim1];
/* L10: */
}
/* L20: */
}
/* R = R * P(1) * ... *P(m) */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
i__2 = *n - *m + 1;
slatzm_("Right", &i__, &i__2, &af[i__ + (*m + 1) * af_dim1], lda, &
tau[i__], &work[(i__ - 1) * *m + 1], &work[*m * *m + 1], m, &
work[*m * *n + 1]);
/* L30: */
}
/* R = R - A */
i__1 = *n;
for (i__ = 1; i__ <= i__1; ++i__) {
saxpy_(m, &c_b13, &a[i__ * a_dim1 + 1], &c__1, &work[(i__ - 1) * *m +
1], &c__1);
/* L40: */
}
ret_val = slange_("One-norm", m, n, &work[1], m, rwork);
ret_val /= slamch_("Epsilon") * (real) max(*m,*n);
if (norma != 0.f) {
ret_val /= norma;
}
return ret_val;
/* End of STZT01 */
} /* stzt01_ */
|
#ifndef _JUDY1OP_INCLUDED
#define _JUDY1OP_INCLUDED
// @(#) $Revision: 4.1 $ $Source: /judy/src/funcs/Judy1Op.h $
//
// HEADER FILE FOR EXPORTED FEATURES FROM Judy1Op().
#define JUDY1OP_AND 1L
#define JUDY1OP_OR 2L
#define JUDY1OP_ANDNOT 3L
extern int Judy1Op(PPvoid_t PPDest, Pvoid_t PSet1, Pvoid_t PSet2,
Word_t Operation, JError_t * PJError);
#endif // ! _JUDY1OP_INCLUDED
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
#include "base/threading/thread_checker.h"
namespace content {
// This class is used by the WebRtcLocalAudioTrack to calculate the level of
// the audio signal. And the audio level will be eventually used by the volume
// animation UI.
// The algorithm used by this class is the same as how it is done in
// third_party/webrtc/voice_engine/level_indicator.cc.
class MediaStreamAudioLevelCalculator {
public:
MediaStreamAudioLevelCalculator();
~MediaStreamAudioLevelCalculator();
// Calculates the signal level of the audio data.
// Returns the absolute value of the amplitude of the signal.
int Calculate(const int16* audio_data, int number_of_channels,
int number_of_frames);
private:
// Used to DCHECK that the constructor and Calculate() are always called on
// the same audio thread. Note that the destructor will be called on a
// different thread, which can be either the main render thread or a new
// audio thread where WebRtcLocalAudioTrack::OnSetFormat() is called.
base::ThreadChecker thread_checker_;
int counter_;
int max_amplitude_;
int level_;
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
|
#include "all.h"
|
/*************************************************************************/
/* resource_format_image.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RESOURCE_FORMAT_IMAGE_H
#define RESOURCE_FORMAT_IMAGE_H
#include "io/resource_loader.h"
#include "io/resource_saver.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class ResourceFormatLoaderImage : public ResourceFormatLoader {
bool debug_load_times;
int max_texture_size;
public:
virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String& p_type) const;
virtual String get_resource_type(const String &p_path) const;
ResourceFormatLoaderImage();
};
#endif
|
/* linux/drivers/hwmon/lis33de.c
*
* (C) Copyright 2008
* MediaTek <www.mediatek.com>
*
* STK8BA50 driver for MT6573
*
* 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 STK8BA50_H
#define STK8BA50_H
#include <linux/ioctl.h>
#define STK8BA50_I2C_SLAVE_ADDR 0x18
/* STK8BA50 Register Map (Please refer to STK8BA50 Specifications) */
#define STK8BA50_XOUT1 0x02
#define STK8BA50_XOUT2 0x03
#define STK8BA50_YOUT1 0x04
#define STK8BA50_YOUT2 0x05
#define STK8BA50_ZOUT1 0x06
#define STK8BA50_ZOUT2 0x07
#define STK8BA50_INTSTS1 0x09
#define STK8BA50_INTSTS2 0x0A
#define STK8BA50_EVENTINFO1 0x0B
#define STK8BA50_EVENTINFO2 0x0C
#define STK8BA50_RANGESEL 0x0F
#define STK8BA50_BWSEL 0x10
#define STK8BA50_POWMODE 0x11
#define STK8BA50_DATASETUP 0x13
#define STK8BA50_SWRST 0x14
#define STK8BA50_INTEN1 0x16
#define STK8BA50_INTEN2 0x17
#define STK8BA50_INTMAP1 0x19
#define STK8BA50_INTMAP2 0x1A
#define STK8BA50_INTMAP3 0x1B
#define STK8BA50_DATASRC 0x1E
#define STK8BA50_INTCFG1 0x20
#define STK8BA50_INTCFG2 0x21
#define STK8BA50_LGDLY 0x22
#define STK8BA50_LGTHD 0x23
#define STK8BA50_HLGCFG 0x24
#define STK8BA50_HGDLY 0x25
#define STK8BA50_HGTHD 0x26
#define STK8BA50_SLOPEDLY 0x27
#define STK8BA50_SLOPETHD 0x28
#define STK8BA50_TAPTIME 0x2A
#define STK8BA50_TAPCFG 0x2B
#define STK8BA50_ORIENTCFG 0x2C
#define STK8BA50_ORIENTTHETA 0x2D
#define STK8BA50_FLATTHETA 0x2E
#define STK8BA50_FLATHOLD 0x2F
#define STK8BA50_SLFTST 0x32
#define STK8BA50_INTFCFG 0x34
#define STK8BA50_OFSTCOMP1 0x36
#define STK8BA50_OFSTCOMP2 0x37
#define STK8BA50_OFSTFILTX 0x38
#define STK8BA50_OFSTFILTY 0x39
#define STK8BA50_OFSTFILTZ 0x3A
#define STK8BA50_OFSTUNFILTX 0x3B
#define STK8BA50_OFSTUNFILTY 0x3C
#define STK8BA50_OFSTUNFILTZ 0x3D
/* SWRST register */
#define STK8BA50_SWRST_VAL 0xB6
/* STK8BAXX_POWMODE register */
#define STK8BA50_MD_SUSPEND 0x80
#define STK8BA50_MD_NORMAL 0x00
#define STK8BA50_MD_SLP_MASK 0x1E
/* RANGESEL register */
#define STK8BA50_RANGE_MASK 0x0F
#define STK8BA50_RNG_2G 0x3
#define STK8BA50_RNG_4G 0x5
#define STK8BA50_RNG_8G 0x8
#define STK8BA50_RNG_16G 0xC
/* BWSEL register */
#define STK8BA50_SPTIME_BASE 0x8
/* OFSTCOMP1 register*/
#define CAL_AXIS_X_EN 0x20
#define CAL_AXIS_Y_EN 0x40
#define CAL_AXIS_Z_EN 0x60
/* OFSTCOMP2 register*/
#define CAL_TG_X0_Y0_ZPOS1 0x20
#define CAL_TG_X0_Y0_ZNEG1 0x40
#define STK8BA50_OF_CAL_DRY_MASK 0x10
#define STK8BA50_SUCCESS 0
#define STK8BA50_ERR_I2C -1
#define STK8BA50_ERR_STATUS -3
#define STK8BA50_ERR_SETUP_FAILURE -4
#define STK8BA50_ERR_GETGSENSORDATA -5
#define STK8BA50_ERR_IDENTIFICATION -6
#define STK8BA50_BUFSIZE 256
#endif
|
#include "colormapst.h"
#ifndef _MICMAP_H_
#define _MICMAP_H_
extern ColormapPtr miInstalledMaps[MAXSCREENS];
typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
int *, VisualID *, unsigned long, int,
int);
int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
void miInstallColormap(ColormapPtr pmap);
void miUninstallColormap(ColormapPtr pmap);
void miResolveColor(unsigned short *, unsigned short *, unsigned short *,
VisualPtr);
Bool miInitializeColormap(ColormapPtr);
int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *);
Bool miCreateDefColormap(ScreenPtr);
void miClearVisualTypes(void);
Bool miSetVisualTypes(int, int, int, int);
Bool miSetPixmapDepths(void);
Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
int preferredCVC,
Pixel redMask, Pixel greenMask, Pixel blueMask);
int miGetDefaultVisualMask(int);
Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *,
unsigned long, int, int);
#define MAX_PSEUDO_DEPTH 10
#define MIN_TRUE_DEPTH 6
#define StaticGrayMask (1 << StaticGray)
#define GrayScaleMask (1 << GrayScale)
#define StaticColorMask (1 << StaticColor)
#define PseudoColorMask (1 << PseudoColor)
#define TrueColorMask (1 << TrueColor)
#define DirectColorMask (1 << DirectColor)
#define ALL_VISUALS (StaticGrayMask|\
GrayScaleMask|\
StaticColorMask|\
PseudoColorMask|\
TrueColorMask|\
DirectColorMask)
#define LARGE_VISUALS (TrueColorMask|\
DirectColorMask)
#define SMALL_VISUALS (StaticGrayMask|\
GrayScaleMask|\
StaticColorMask|\
PseudoColorMask)
#endif /* _MICMAP_H_ */
|
// Copyright 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 SYNC_SESSIONS_ORDERED_COMMIT_SET_H_
#define SYNC_SESSIONS_ORDERED_COMMIT_SET_H_
#include <map>
#include <set>
#include <vector>
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/engine/model_safe_worker.h"
#include "sync/syncable/syncable_id.h"
namespace syncer {
namespace sessions {
// TODO(ncarter): This code is more generic than just Commit and can
// be reused elsewhere (e.g. ChangeReorderBuffer do similar things). Merge
// all these implementations.
class SYNC_EXPORT_PRIVATE OrderedCommitSet {
public:
// A list of indices into the full list of commit ids such that:
// 1 - each element is an index belonging to a particular ModelSafeGroup.
// 2 - the vector is in sorted (smallest to largest) order.
// 3 - each element is a valid index for GetCommitItemAt.
// See GetCommitIdProjection for usage.
typedef std::vector<size_t> Projection;
// TODO(chron): Reserve space according to batch size?
explicit OrderedCommitSet(const ModelSafeRoutingInfo& routes);
~OrderedCommitSet();
bool HaveCommitItem(const int64 metahandle) const {
return inserted_metahandles_.count(metahandle) > 0;
}
void AddCommitItem(const int64 metahandle, const syncable::Id& commit_id,
ModelType type);
const std::vector<syncable::Id>& GetAllCommitIds() const {
return commit_ids_;
}
// Return the Id at index |position| in this OrderedCommitSet. Note that
// the index uniquely identifies the same logical item in each of:
// 1) this OrderedCommitSet
// 2) the CommitRequest sent to the server
// 3) the list of EntryResponse objects in the CommitResponse.
// These together allow re-association of the pre-commit Id with the
// actual committed entry.
const syncable::Id& GetCommitIdAt(const size_t position) const {
return commit_ids_[position];
}
// Same as above, but for ModelType of the item.
ModelType GetModelTypeAt(const size_t position) const {
return types_[position];
}
// Get the projection of commit ids onto the space of commit ids
// belonging to |group|. This is useful when you need to process a commit
// response one ModelSafeGroup at a time. See GetCommitIdAt for how the
// indices contained in the returned Projection can be used.
const Projection& GetCommitIdProjection(
ModelSafeGroup group) const;
size_t Size() const {
return commit_ids_.size();
}
bool Empty() const {
return Size() == 0;
}
// Returns all the types that are included in this list.
ModelTypeSet Types() const {
return types_in_list_;
}
// Returns true iff any of the commit ids added to this set have model type
// BOOKMARKS.
bool HasBookmarkCommitId() const;
void Append(const OrderedCommitSet& other);
void AppendReverse(const OrderedCommitSet& other);
void Truncate(size_t max_size);
// Removes all entries from this set.
void Clear();
void operator=(const OrderedCommitSet& other);
private:
// A set of CommitIdProjections associated with particular ModelSafeGroups.
typedef std::map<ModelSafeGroup, Projection> Projections;
// Helper container for return value of GetCommitItemAt.
struct CommitItem {
int64 meta;
syncable::Id id;
ModelType group;
};
CommitItem GetCommitItemAt(const size_t position) const;
// These lists are different views of the same items; e.g they are
// isomorphic.
std::set<int64> inserted_metahandles_;
std::vector<syncable::Id> commit_ids_;
std::vector<int64> metahandle_order_;
Projections projections_;
// We need this because of operations like AppendReverse that take ids from
// one OrderedCommitSet and insert into another -- we need to know the
// group for each ID so that the insertion can update the appropriate
// projection. We could store it in commit_ids_, but sometimes we want
// to just return the vector of Ids, so this is more straightforward
// and shouldn't take up too much extra space since commit lists are small.
std::vector<ModelType> types_;
// The set of types which are included in this particular list.
ModelTypeSet types_in_list_;
ModelSafeRoutingInfo routes_;
};
} // namespace sessions
} // namespace syncer
#endif // SYNC_SESSIONS_ORDERED_COMMIT_SET_H_
|
/**
* Copyright (c) 2014-2015, RongCloud.
* All rights reserved.
*
* All the contents are the copyright of RongCloud Network Technology Co.Ltd.
* Unless otherwise credited. http://rongcloud.cn
*
*/
// RCTextMessage.h
// Created by Heq.Shinoda on 14-6-13.
#import "RCMessageContent.h"
/*!
文本消息的类型名
*/
#define RCTextMessageTypeIdentifier @"RC:TxtMsg"
/*!
文本消息类
@discussion 文本消息类,此消息会进行存储并计入未读消息数。
*/
@interface RCTextMessage : RCMessageContent <NSCoding>
/*!
文本消息的内容
*/
@property(nonatomic, strong) NSString *content;
/*!
文本消息的附加信息
*/
@property(nonatomic, strong) NSString *extra;
/*!
初始化文本消息
@param content 文本消息的内容
@return 文本消息对象
*/
+ (instancetype)messageWithContent:(NSString *)content;
@end
|
/* Copyright (C) 1991, 1995, 1996, 2002 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 <unistd.h>
#include <mach.h>
/* Return the system page size. */
int
__getpagesize ()
{
return __vm_page_size;
}
libc_hidden_def (__getpagesize)
weak_alias (__getpagesize, getpagesize)
|
/***************************************************************************
qgspointcloudrgbrenderer.h
--------------------
begin : October 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPOINTCLOUDRGBRENDERER_H
#define QGSPOINTCLOUDRGBRENDERER_H
#include "qgspointcloudrenderer.h"
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgscontrastenhancement.h"
/**
* \ingroup core
* \brief An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
*
* \since QGIS 3.18
*/
class CORE_EXPORT QgsPointCloudRgbRenderer : public QgsPointCloudRenderer
{
public:
/**
* Constructor for QgsPointCloudRgbRenderer.
*/
QgsPointCloudRgbRenderer();
QString type() const override;
QgsPointCloudRenderer *clone() const override;
void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
/**
* Creates an RGB renderer from an XML \a element.
*/
static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
/**
* Returns the attribute to use for the red channel.
*
* \see greenAttribute()
* \see blueAttribute()
* \see setRedAttribute()
*/
QString redAttribute() const;
/**
* Sets the \a attribute to use for the red channel.
*
* \see setGreenAttribute()
* \see setBlueAttribute()
* \see redAttribute()
*/
void setRedAttribute( const QString &attribute );
/**
* Returns the attribute to use for the green channel.
*
* \see redAttribute()
* \see blueAttribute()
* \see setGreenAttribute()
*/
QString greenAttribute() const;
/**
* Sets the \a attribute to use for the green channel.
*
* \see setRedAttribute()
* \see setBlueAttribute()
* \see greenAttribute()
*/
void setGreenAttribute( const QString &attribute );
/**
* Returns the attribute to use for the blue channel.
*
* \see greenAttribute()
* \see redAttribute()
* \see setBlueAttribute()
*/
QString blueAttribute() const;
/**
* Sets the \a attribute to use for the blue channel.
*
* \see setRedAttribute()
* \see setGreenAttribute()
* \see blueAttribute()
*/
void setBlueAttribute( const QString &attribute );
/**
* Returns the contrast enhancement to use for the red channel.
*
* \see setRedContrastEnhancement()
* \see greenContrastEnhancement()
* \see blueContrastEnhancement()
*/
const QgsContrastEnhancement *redContrastEnhancement() const;
/**
* Sets the contrast \a enhancement to use for the red channel.
*
* Ownership of \a enhancement is transferred.
*
* \see redContrastEnhancement()
* \see setGreenContrastEnhancement()
* \see setBlueContrastEnhancement()
*/
void setRedContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
/**
* Returns the contrast enhancement to use for the green channel.
*
* \see setGreenContrastEnhancement()
* \see redContrastEnhancement()
* \see blueContrastEnhancement()
*/
const QgsContrastEnhancement *greenContrastEnhancement() const;
/**
* Sets the contrast \a enhancement to use for the green channel.
*
* Ownership of \a enhancement is transferred.
*
* \see greenContrastEnhancement()
* \see setRedContrastEnhancement()
* \see setBlueContrastEnhancement()
*/
void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
/**
* Returns the contrast enhancement to use for the blue channel.
*
* \see setBlueContrastEnhancement()
* \see redContrastEnhancement()
* \see greenContrastEnhancement()
*/
const QgsContrastEnhancement *blueContrastEnhancement() const;
/**
* Sets the contrast \a enhancement to use for the blue channel.
*
* Ownership of \a enhancement is transferred.
*
* \see blueContrastEnhancement()
* \see setRedContrastEnhancement()
* \see setGreenContrastEnhancement()
*/
void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
private:
QString mRedAttribute = QStringLiteral( "Red" );
QString mGreenAttribute = QStringLiteral( "Green" );
QString mBlueAttribute = QStringLiteral( "Blue" );
std::unique_ptr< QgsContrastEnhancement > mRedContrastEnhancement;
std::unique_ptr< QgsContrastEnhancement > mGreenContrastEnhancement;
std::unique_ptr< QgsContrastEnhancement > mBlueContrastEnhancement;
};
#endif // QGSPOINTCLOUDRGBRENDERER_H
|
/* Data structures and function declarations for the SSA value propagation
engine.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _TREE_SSA_PROPAGATE_H
#define _TREE_SSA_PROPAGATE_H 1
/* If SIM_P is true, statement S will be simulated again. */
static inline void
prop_set_simulate_again (gimple s, bool visit_p)
{
gimple_set_visited (s, visit_p);
}
/* Return true if statement T should be simulated again. */
static inline bool
prop_simulate_again_p (gimple s)
{
return gimple_visited_p (s);
}
/* Lattice values used for propagation purposes. Specific instances
of a propagation engine must return these values from the statement
and PHI visit functions to direct the engine. */
enum ssa_prop_result {
/* The statement produces nothing of interest. No edges will be
added to the work lists. */
SSA_PROP_NOT_INTERESTING,
/* The statement produces an interesting value. The set SSA_NAMEs
returned by SSA_PROP_VISIT_STMT should be added to
INTERESTING_SSA_EDGES. If the statement being visited is a
conditional jump, SSA_PROP_VISIT_STMT should indicate which edge
out of the basic block should be marked executable. */
SSA_PROP_INTERESTING,
/* The statement produces a varying (i.e., useless) value and
should not be simulated again. If the statement being visited
is a conditional jump, all the edges coming out of the block
will be considered executable. */
SSA_PROP_VARYING
};
/* Call-back functions used by the value propagation engine. */
typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (gimple, edge *, tree *);
typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gimple);
typedef bool (*ssa_prop_fold_stmt_fn) (gimple_stmt_iterator *gsi);
typedef tree (*ssa_prop_get_value_fn) (tree);
/* In tree-ssa-propagate.c */
void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn);
bool valid_gimple_rhs_p (tree);
void move_ssa_defining_stmt_for_defs (gimple, gimple);
bool update_gimple_call (gimple_stmt_iterator *, tree, int, ...);
bool update_call_from_tree (gimple_stmt_iterator *, tree);
bool stmt_makes_single_store (gimple);
bool substitute_and_fold (ssa_prop_get_value_fn, ssa_prop_fold_stmt_fn, bool);
#endif /* _TREE_SSA_PROPAGATE_H */
|
/*
* Support for Intel Camera Imaging ISP subsystem.
*
* Copyright (c) 2010 - 2014 Intel Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#ifndef __IA_CSS_OB_PARAM_H
#define __IA_CSS_OB_PARAM_H
#include "type_support.h"
#include "vmem.h"
#define OBAREA_MASK_SIZE 64
/* OB (Optical Black) */
struct sh_css_isp_ob_stream_config {
unsigned isp_pipe_version;
unsigned raw_bit_depth;
};
struct sh_css_isp_ob_params {
int32_t blacklevel_gr;
int32_t blacklevel_r;
int32_t blacklevel_b;
int32_t blacklevel_gb;
int32_t area_start_bq;
int32_t area_length_bq;
int32_t area_length_bq_inverse;
};
struct sh_css_isp_ob_vmem_params {
VMEM_ARRAY(vmask, OBAREA_MASK_SIZE);
};
#endif /* __IA_CSS_OB_PARAM_H */
|
// Scintilla source code edit control
/** @file CellBuffer.h
** Manages the text of the document.
**/
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CELLBUFFER_H
#define CELLBUFFER_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
// Interface to per-line data that wants to see each line insertion and deletion
class PerLine {
public:
virtual ~PerLine() {}
virtual void Init()=0;
virtual void InsertLine(int)=0;
virtual void RemoveLine(int)=0;
};
/**
* The line vector contains information about each of the lines in a cell buffer.
*/
class LineVector {
Partitioning starts;
PerLine *perLine;
public:
LineVector();
~LineVector();
void Init();
void SetPerLine(PerLine *pl);
void InsertText(int line, int delta);
void InsertLine(int line, int position, bool lineStart);
void SetLineStart(int line, int position);
void RemoveLine(int line);
int Lines() const {
return starts.Partitions();
}
int LineFromPosition(int pos) const;
int LineStart(int line) const {
return starts.PositionFromPartition(line);
}
int MarkValue(int line);
int AddMark(int line, int marker);
void MergeMarkers(int pos);
void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
void ClearLevels();
int SetLevel(int line, int level);
int GetLevel(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
};
enum actionType { insertAction, removeAction, startAction, containerAction };
/**
* Actions are used to store all the information required to perform one undo/redo step.
*/
class Action {
public:
actionType at;
int position;
char *data;
int lenData;
bool mayCoalesce;
Action();
~Action();
void Create(actionType at_, int position_=0, const char *data_=0, int lenData_=0, bool mayCoalesce_=true);
void Destroy();
void Grab(Action *source);
};
/**
*
*/
class UndoHistory {
Action *actions;
int lenActions;
int maxAction;
int currentAction;
int undoSequenceDepth;
int savePoint;
void EnsureUndoRoom();
// Private so UndoHistory objects can not be copied
UndoHistory(const UndoHistory &);
public:
UndoHistory();
~UndoHistory();
const char *AppendAction(actionType at, int position, const char *data, int length, bool &startSequence, bool mayCoalesce=true);
void BeginUndoAction();
void EndUndoAction();
void DropUndoSequence();
void DeleteUndoHistory();
/// The save point is a marker in the undo stack where the container has stated that
/// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint() const;
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
bool CanUndo() const;
int StartUndo();
const Action &GetUndoStep() const;
void CompletedUndoStep();
bool CanRedo() const;
int StartRedo();
const Action &GetRedoStep() const;
void CompletedRedoStep();
};
/**
* Holder for an expandable array of characters that supports undo and line markers.
* Based on article "Data Structures in a Bit-Mapped Text Editor"
* by Wilfred J. Hansen, Byte January 1987, page 183.
*/
class CellBuffer {
private:
SplitVector<char> substance;
SplitVector<char> style;
bool readOnly;
int utf8LineEnds;
bool collectingUndo;
UndoHistory uh;
LineVector lv;
bool UTF8LineEndOverlaps(int position) const;
void ResetLineEnds();
/// Actions without undo
void BasicInsertString(int position, const char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);
public:
CellBuffer();
~CellBuffer();
/// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve) const;
char StyleAt(int position) const;
void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const;
const char *BufferPointer();
const char *RangePointer(int position, int rangeLength);
int GapPosition() const;
int Length() const;
void Allocate(int newSize);
int GetLineEndTypes() const { return utf8LineEnds; }
void SetLineEndTypes(int utf8LineEnds_);
void SetPerLine(PerLine *pl);
int Lines() const;
int LineStart(int line) const;
int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); }
void InsertLine(int line, int position, bool lineStart);
void RemoveLine(int line);
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed.
bool SetStyleAt(int position, char styleValue, char mask='\377');
bool SetStyleFor(int position, int length, char styleValue, char mask);
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
bool IsReadOnly() const;
void SetReadOnly(bool set);
/// The save point is a marker in the undo stack where the container has stated that
/// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint() const;
bool SetUndoCollection(bool collectUndo);
bool IsCollectingUndo() const;
void BeginUndoAction();
void EndUndoAction();
void AddUndoAction(int token, bool mayCoalesce);
void DeleteUndoHistory();
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
bool CanUndo() const;
int StartUndo();
const Action &GetUndoStep() const;
void PerformUndoStep();
bool CanRedo() const;
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
};
#ifdef SCI_NAMESPACE
}
#endif
#endif
|
#include <linux/module.h>
MODULE_AUTHOR("Luis R. Rodriguez");
MODULE_DESCRIPTION("Kernel compatibility module");
MODULE_LICENSE("GPL");
#ifndef COMPAT_BASE
#error "You need a COMPAT_BASE"
#endif
#ifndef COMPAT_BASE_TREE
#error "You need a COMPAT_BASE_TREE"
#endif
#ifndef COMPAT_BASE_TREE_VERSION
#error "You need a COMPAT_BASE_TREE_VERSION"
#endif
#ifndef COMPAT_VERSION
#error "You need a COMPAT_VERSION"
#endif
static char *compat_base = COMPAT_BASE;
static char *compat_base_tree = COMPAT_BASE_TREE;
static char *compat_base_tree_version = COMPAT_BASE_TREE_VERSION;
static char *compat_version = COMPAT_VERSION;
module_param(compat_base, charp, 0400);
MODULE_PARM_DESC(compat_base_tree,
"The upstream verion of compat.git used");
module_param(compat_base_tree, charp, 0400);
MODULE_PARM_DESC(compat_base_tree,
"The upstream tree used as base for this backport");
module_param(compat_base_tree_version, charp, 0400);
MODULE_PARM_DESC(compat_base_tree_version,
"The git-describe of the upstream base tree");
module_param(compat_version, charp, 0400);
MODULE_PARM_DESC(compat_version,
"Version of the kernel compat backport work");
void compat_dependency_symbol(void)
{
}
EXPORT_SYMBOL_GPL(compat_dependency_symbol);
static int __init compat_init(void)
{
compat_pm_qos_power_init();
compat_system_workqueue_create();
init_compat_mmc_pm_flags();
printk(KERN_INFO
COMPAT_PROJECT " backport release: "
COMPAT_VERSION
"\n");
printk(KERN_INFO "Backport based on "
COMPAT_BASE_TREE " " COMPAT_BASE_TREE_VERSION
"\n");
printk(KERN_INFO "compat.git: "
COMPAT_BASE_TREE "\n");
return 0;
}
module_init(compat_init);
static void __exit compat_exit(void)
{
compat_pm_qos_power_deinit();
compat_system_workqueue_destroy();
return;
}
module_exit(compat_exit);
|
/*
* Copyright 2015 The SageTV Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __THREAD_UTIL__
#define __THREAD_UTIL__
#include <pthread.h>
typedef struct
{
pthread_mutex_t id;
}ACL_mutex;
typedef struct
{
pthread_t t;
}ACL_Thread;
ACL_mutex * ACL_CreateMutex();
void ACL_RemoveMutex(ACL_mutex *mutex);
int ACL_LockMutex(ACL_mutex *mutex);
int ACL_UnlockMutex(ACL_mutex *mutex);
ACL_Thread * ACL_CreateThread(int (*threadfunc)(void *), void *data);
int ACL_ThreadJoin(ACL_Thread * t);
int ACL_RemoveThread(ACL_Thread * t);
void ACL_Delay(unsigned int delay);
#endif // __THREAD_UTIL__
|
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VC_CONTAINERS_UTILS_H
#define VC_CONTAINERS_UTILS_H
#include "containers/containers.h"
#include "containers/containers_codecs.h"
#include "containers/core/containers_waveformat.h"
/*****************************************************************************
* Type definitions
*****************************************************************************/
/** Definition of the Global Unique Identifier type as used by some containers */
typedef struct GUID_T
{
uint32_t word0;
uint16_t short0;
uint16_t short1;
uint8_t bytes[8];
} GUID_T;
VC_CONTAINER_ES_FORMAT_T *vc_container_format_create(unsigned int extradata_size);
void vc_container_format_delete(VC_CONTAINER_ES_FORMAT_T *);
VC_CONTAINER_STATUS_T vc_container_format_extradata_alloc(
VC_CONTAINER_ES_FORMAT_T *format, unsigned int size);
VC_CONTAINER_STATUS_T vc_container_format_copy( VC_CONTAINER_ES_FORMAT_T *p_out,
VC_CONTAINER_ES_FORMAT_T *p_in,
unsigned int extra_buffer_size );
int utf8_from_charset(const char *charset, char *out, unsigned int out_size,
const void *in, unsigned int in_size);
const char *vc_container_metadata_id_to_string(VC_CONTAINER_METADATA_KEY_T key);
unsigned int vc_container_es_format_to_waveformatex(VC_CONTAINER_ES_FORMAT_T *format,
uint8_t *buffer, unsigned int buffer_size);
unsigned int vc_container_es_format_to_bitmapinfoheader(VC_CONTAINER_ES_FORMAT_T *format,
uint8_t *buffer, unsigned int buffer_size);
VC_CONTAINER_STATUS_T vc_container_waveformatex_to_es_format(uint8_t *p,
unsigned int buffer_size, unsigned int *extra_offset, unsigned int *extra_size,
VC_CONTAINER_ES_FORMAT_T *format);
VC_CONTAINER_STATUS_T vc_container_bitmapinfoheader_to_es_format(uint8_t *p,
unsigned int buffer_size, unsigned int *extra_offset, unsigned int *extra_size,
VC_CONTAINER_ES_FORMAT_T *format);
/** Find the greatest common denominator of 2 numbers.
*
* @param a first number
* @param b second number
*
* @return greatest common denominator of a and b
*/
int64_t vc_container_maths_gcd(int64_t a, int64_t b);
/** Reduce a rational number to it's simplest form.
*
* @param num Pointer to the numerator of the rational number to simplify
* @param den Pointer to the denominator of the rational number to simplify
*/
void vc_container_maths_rational_simplify(uint32_t *num, uint32_t *den);
#endif /* VC_CONTAINERS_UTILS_H */
|
//
// UIBarButtonItem+Common.h
// Coding_iOS
//
// Created by 王 原闯 on 14/11/5.
// Copyright (c) 2014年 Coding. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIBarButtonItem (Common)
+ (UIBarButtonItem *)itemWithBtnTitle:(NSString *)title target:(id)obj action:(SEL)selector;
+ (UIBarButtonItem *)itemWithIcon:(NSString*)iconName showBadge:(BOOL)showbadge target:(id)obj action:(SEL)selector;
@end
|
/*************************************************************************/
/* rich_text_editor_plugin.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RICH_TEXT_EDITOR_PLUGIN_H
#define RICH_TEXT_EDITOR_PLUGIN_H
#include "tools/editor/editor_plugin.h"
#include "tools/editor/editor_node.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/file_dialog.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class RichTextEditor : public Control {
OBJ_TYPE(RichTextEditor, Control );
friend class RichTextEditorPlugin;
enum {
PARSE_BBCODE,
CLEAR
};
Panel *panel;
MenuButton *options;
RichTextLabel *node;
EditorFileDialog *file_dialog;
void _file_selected(const String& p_path);
void _menu_option(int p_option);
protected:
void _notification(int p_what);
void _node_removed(Node *p_node);
static void _bind_methods();
public:
void edit(Node *p_rich_text);
RichTextEditor();
};
class RichTextEditorPlugin : public EditorPlugin {
OBJ_TYPE( RichTextEditorPlugin, EditorPlugin );
RichTextEditor *rich_text_editor;
EditorNode *editor;
public:
virtual String get_name() const { return "RichText"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
virtual bool handles(Object *p_node) const;
virtual void make_visible(bool p_visible);
RichTextEditorPlugin(EditorNode *p_node);
~RichTextEditorPlugin();
};
#endif // RICH_TEXT_EDITOR_PLUGIN_H
|
/*
* Copyright (c) 2007-2012 SlimDX Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "DeviceChild11.h"
#include "../d3dcompiler/ShaderBytecodeDC.h"
namespace SlimDX
{
namespace Direct3D11
{
ref class ClassLinkage;
/// <summary>
/// Represents a vertex shader.
/// </summary>
/// <unmanaged>ID3D11VertexShader</unmanaged>
public ref class VertexShader : public DeviceChild
{
COMOBJECT(ID3D11VertexShader, VertexShader);
public:
/// <summary>
/// Initializes a new instance of the <see cref="VertexShader"/> class.
/// </summary>
/// <param name="device">The device used to create the shader.</param>
/// <param name="shaderBytecode">The compiled shader bytecode.</param>
VertexShader( Direct3D11::Device^ device, D3DCompiler::ShaderBytecode^ shaderBytecode );
/// <summary>
/// Initializes a new instance of the <see cref="VertexShader"/> class.
/// </summary>
/// <param name="device">The device used to create the shader.</param>
/// <param name="shaderBytecode">The compiled shader bytecode.</param>
/// <param name="linkage">A dynamic class linkage interface.</param>
VertexShader( Direct3D11::Device^ device, D3DCompiler::ShaderBytecode^ shaderBytecode, ClassLinkage^ linkage );
};
}
}; |
/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_unordsd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = __bid64_quiet_unordered (x64, y64);
return (res);
}
|
// SPDX-License-Identifier: GPL-2.0
/***************************************************************************/
/*
* m54xx.c -- platform support for ColdFire 54xx based boards
*
* Copyright (C) 2010, Philippe De Muyter <phdm@macqel.be>
*/
/***************************************************************************/
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/clk.h>
#include <linux/bootmem.h>
#include <asm/pgalloc.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/m54xxsim.h>
#include <asm/mcfuart.h>
#include <asm/mcfclk.h>
#include <asm/m54xxgpt.h>
#ifdef CONFIG_MMU
#include <asm/mmu_context.h>
#endif
/***************************************************************************/
DEFINE_CLK(pll, "pll.0", MCF_CLK);
DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
DEFINE_CLK(mcfslt0, "mcfslt.0", MCF_BUSCLK);
DEFINE_CLK(mcfslt1, "mcfslt.1", MCF_BUSCLK);
DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK);
DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK);
DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK);
DEFINE_CLK(mcfuart3, "mcfuart.3", MCF_BUSCLK);
DEFINE_CLK(mcfi2c0, "imx1-i2c.0", MCF_BUSCLK);
struct clk *mcf_clks[] = {
&clk_pll,
&clk_sys,
&clk_mcfslt0,
&clk_mcfslt1,
&clk_mcfuart0,
&clk_mcfuart1,
&clk_mcfuart2,
&clk_mcfuart3,
&clk_mcfi2c0,
NULL
};
/***************************************************************************/
static void __init m54xx_uarts_init(void)
{
/* enable io pins */
__raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
__raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
MCFGPIO_PAR_PSC1);
__raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
__raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
}
/***************************************************************************/
static void __init m54xx_i2c_init(void)
{
#if IS_ENABLED(CONFIG_I2C_IMX)
u32 r;
/* set the fec/i2c/irq pin assignment register for i2c */
r = readl(MCF_PAR_FECI2CIRQ);
r |= MCF_PAR_FECI2CIRQ_SDA | MCF_PAR_FECI2CIRQ_SCL;
writel(r, MCF_PAR_FECI2CIRQ);
#endif /* IS_ENABLED(CONFIG_I2C_IMX) */
}
/***************************************************************************/
static void mcf54xx_reset(void)
{
/* disable interrupts and enable the watchdog */
asm("movew #0x2700, %sr\n");
__raw_writel(0, MCF_GPT_GMS0);
__raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
__raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
MCF_GPT_GMS0);
}
/***************************************************************************/
void __init config_BSP(char *commandp, int size)
{
#ifdef CONFIG_MMU
cf_bootmem_alloc();
mmu_context_init();
#endif
mach_reset = mcf54xx_reset;
mach_sched_init = hw_timer_init;
m54xx_uarts_init();
m54xx_i2c_init();
}
/***************************************************************************/
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 <unistd.h>
#include <hurd.h>
#include <hurd/port.h>
#include <hurd/id.h>
#include <hurd/lookup.h>
#include <fcntl.h>
/* Test for access to FILE by our real user and group IDs. */
int
__access (file, type)
const char *file;
int type;
{
error_t err;
file_t rcrdir, rcwdir, io;
int flags, allowed;
error_t reauthenticate (int which, file_t *result)
{
/* Get a port to our root directory, authenticated with the real IDs. */
error_t err;
mach_port_t ref;
ref = __mach_reply_port ();
err = HURD_PORT_USE
(&_hurd_ports[which],
({
err = __io_reauthenticate (port, ref, MACH_MSG_TYPE_MAKE_SEND);
if (!err)
err = __auth_user_authenticate (_hurd_id.rid_auth,
ref, MACH_MSG_TYPE_MAKE_SEND,
result);
err;
}));
__mach_port_destroy (__mach_task_self (), ref);
return err;
}
error_t init_port (int which, error_t (*operate) (mach_port_t))
{
switch (which)
{
case INIT_PORT_AUTH:
return (*operate) (_hurd_id.rid_auth);
case INIT_PORT_CRDIR:
return (reauthenticate (INIT_PORT_CRDIR, &rcrdir) ?:
(*operate) (rcrdir));
case INIT_PORT_CWDIR:
return (reauthenticate (INIT_PORT_CWDIR, &rcwdir) ?:
(*operate) (rcwdir));
default:
return _hurd_ports_use (which, operate);
}
}
rcrdir = rcwdir = MACH_PORT_NULL;
HURD_CRITICAL_BEGIN;
__mutex_lock (&_hurd_id.lock);
/* Get _hurd_id up to date. */
if (err = _hurd_check_ids ())
goto lose;
if (_hurd_id.rid_auth == MACH_PORT_NULL)
{
/* Set up _hurd_id.rid_auth. This is a special auth server port
which uses the real uid and gid (the first aux uid and gid) as
the only effective uid and gid. */
if (_hurd_id.aux.nuids < 1 || _hurd_id.aux.ngids < 1)
{
/* We do not have a real UID and GID. Lose, lose, lose! */
err = EGRATUITOUS;
goto lose;
}
/* Create a new auth port using our real UID and GID (the first
auxiliary UID and GID) as the only effective IDs. */
if (err = __USEPORT (AUTH,
__auth_makeauth (port,
NULL, MACH_MSG_TYPE_COPY_SEND, 0,
_hurd_id.aux.uids, 1,
_hurd_id.aux.uids,
_hurd_id.aux.nuids,
_hurd_id.aux.gids, 1,
_hurd_id.aux.gids,
_hurd_id.aux.ngids,
&_hurd_id.rid_auth)))
goto lose;
}
if (!err)
/* Look up the file name using the modified init ports. */
err = __hurd_file_name_lookup (&init_port, &__getdport, 0,
file, 0, 0, &io);
/* We are done with _hurd_id.rid_auth now. */
lose:
__mutex_unlock (&_hurd_id.lock);
HURD_CRITICAL_END;
if (rcrdir != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), rcrdir);
if (rcwdir != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), rcwdir);
if (err)
return __hurd_fail (err);
/* Find out what types of access we are allowed to this file. */
err = __file_check_access (io, &allowed);
__mach_port_deallocate (__mach_task_self (), io);
if (err)
return __hurd_fail (err);
flags = 0;
if (type & R_OK)
flags |= O_READ;
if (type & W_OK)
flags |= O_WRITE;
if (type & X_OK)
flags |= O_EXEC;
if (flags & ~allowed)
/* We are not allowed all the requested types of access. */
return __hurd_fail (EACCES);
return 0;
}
weak_alias (__access, access)
|
/* Software floating-point emulation.
Return 1 if a >= b
Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
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 "soft-fp.h"
#include "quad.h"
int _q_fge(const long double a, const long double b)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(B);
int r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
FP_CMP_Q(r, B, A, 3);
if (r == 3)
FP_SET_EXCEPTION(FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return (r <= 0);
}
|
/*
* Copyright © 2008 Ingo Molnar
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include <asm/iomap.h>
#include <asm/pat.h>
#include <linux/module.h>
#include <linux/highmem.h>
int is_io_mapping_possible(resource_size_t base, unsigned long size)
{
#if !defined(CONFIG_X86_PAE) && defined(CONFIG_PHYS_ADDR_T_64BIT)
/* There is no way to map greater than 1 << 32 address without PAE */
if (base + size > 0x100000000ULL)
return 0;
#endif
return 1;
}
EXPORT_SYMBOL_GPL(is_io_mapping_possible);
void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
{
enum fixed_addresses idx;
unsigned long vaddr;
pagefault_disable();
debug_kmap_atomic(type);
idx = type + KM_TYPE_NR * smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
arch_flush_lazy_mmu_mode();
return (void *)vaddr;
}
/*
* Map 'pfn' using fixed map 'type' and protections 'prot'
*/
void *
iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
{
/*
* For non-PAT systems, promote PAGE_KERNEL_WC to PAGE_KERNEL_UC_MINUS.
* PAGE_KERNEL_WC maps to PWT, which translates to uncached if the
* MTRR is UC or WC. UC_MINUS gets the real intention, of the
* user, which is "WC if the MTRR is WC, UC if you can't do that."
*/
if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC))
prot = PAGE_KERNEL_UC_MINUS;
return kmap_atomic_prot_pfn(pfn, type, prot);
}
EXPORT_SYMBOL_GPL(iomap_atomic_prot_pfn);
void
iounmap_atomic(void *kvaddr, enum km_type type)
{
unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
/*
* Force other mappings to Oops if they'll try to access this pte
* without first remap it. Keeping stale mappings around is a bad idea
* also, in case the page changes cacheability attributes or becomes
* a protected page in a hypervisor.
*/
if (vaddr == __fix_to_virt(FIX_KMAP_BEGIN+idx))
kpte_clear_flush(kmap_pte-idx, vaddr);
arch_flush_lazy_mmu_mode();
pagefault_enable();
}
EXPORT_SYMBOL_GPL(iounmap_atomic);
|
/* { dg-do compile } */
/* { dg-options "-Winline -O2" } */
int do_something_evil (void);
inline __attribute__ ((always_inline)) void
q2(void) /* { dg-message "sorry\[^\n\]*recursive" "" } */
{
if (do_something_evil ())
return;
q2(); /* { dg-message "sorry\[^\n\]*called from here" "" } */
q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion. */
}
|
// Copyright 2008, Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 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 Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 contains the declarations of some mathematical functions useful
// when working with KML or, more generally, geometry on a Great Circle.
//
// Many of the formulae here were cribbed from the excellent Aviation
// Formulary: http://williams.best.vwh.net/avform.htm
//
// NOTE: with the exception of the functions explicitly for converting between
// units, all functions here accept and return coordinates and angles in
// decimal degrees, and distances in meters.
#ifndef KML_BASE_MATH_UTIL_H__
#define KML_BASE_MATH_UTIL_H__
#include <math.h>
// At least one variant of MSVC does not define M_PI.
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include <utility>
#include "kml/base/vec3.h"
namespace kmlbase {
// Returns the initial azimuth (the angle measured clockwise from true north)
// at a point from that point to a second point. For example, the azimuth
// from 0,0 to 1,0 is 0 degrees. From 0,0 to 0,1 is 90 degrees (due east).
// The range of the result is (-180, 180].
//
// This is directly useful as the value of <heading> in KML's AbstractView.
//
// Note that this is the _initial_ azimuth; it changes as one follows the
// great circle path from point 1 to point2.
double AzimuthBetweenPoints(double lat_from, double lng_from,
double lat_to, double lng_to);
// Returns the angle from the horizontal plane between alt1 and alt2.
// For example, the returned angle from (37.00, -121.98, 600) to a point
// about 1778 meters west, 400 meters below at (37.00, -122.00, 200) is
// -12.7 degrees.
//
// To use this as the value of KML's <tilt>, add 90 degrees (since in KML a
// tilt of 0 is vertical.
//
// TODO: this is a naive implementation accurate only over short distances.
// It does not yet account for surface curvature.
double ElevationBetweenPoints(double lat_from, double lng_from, double alt_from,
double lat_to, double lng_to, double alt_to);
// Returns the great circle distance in meters between two points on the
// Earth's surface. The antemeridian is not considered here.
double DistanceBetweenPoints(double lat_from, double lng_from,
double lat_to, double lng_to);
// Returns the great circle distance in meters between two 3d points. The
// antemeridian is not considered here.
double DistanceBetweenPoints3d(
double lat_from, double lng_from, double alt_from,
double lat_to, double lng_to, double alt_to);
// Given a vector describing a line at an angle from the horizontal plane,
// where the vector starts at a point on the surface of the Earth,
// returns the absolute distance between the ground point and the point
// directly under the end point.
double GroundDistanceFromRangeAndElevation(double range, double elevation);
// Given a vector describing a line at an angle from the horizontal plane,
// where the vector starts at a point on the surface of the Earth,
// returns the absolute height between the end point and the surface
// point directly under it.
double HeightFromRangeAndElevation(double range, double elevation);
// Returns a Vec3 containing the latitude and longitude of a point at a
// distance (meters) out on the radial (degrees) from a center point lat, lng.
// The radial is measured clockwise from north. The antemeridian is not
// considered here.
Vec3 LatLngOnRadialFromPoint(double lat, double lng,
double distance, double radial);
// These functions are mostly internal, used in converting between degrees and
// radians.
double DegToRad(double degrees);
double RadToDeg(double radians);
double MetersToRadians(double meters);
double RadiansToMeters(double radians);
} // end namespace kmlbase
#endif // KML_BASE_MATH_UTIL_H__
|
/*
* Copyright (C) 2013 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.
*/
/**
* @ingroup pthread
* @{
* @file
* @brief Spin locks.
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
* @author René Kijewski <kijewski@inf.fu-berlin.de>
* @author Joakim Gebart <joakim.gebart@eistec.se>
* @}
*/
#include "pthread.h"
#include "atomic.h"
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
{
if (lock == NULL) {
return EINVAL;
}
(void) pshared;
ATOMIC_VALUE(lock->value) = 0;
return 0;
}
int pthread_spin_destroy(pthread_spinlock_t *lock)
{
if (lock == NULL) {
return EINVAL;
}
(void) lock;
return 0;
}
int pthread_spin_lock(pthread_spinlock_t *lock)
{
if (lock == NULL) {
return EINVAL;
}
while (atomic_set_to_one(&(lock->value)) == 0) {
/* spin */
}
return 0;
}
int pthread_spin_trylock(pthread_spinlock_t *lock)
{
if (lock == NULL) {
return EINVAL;
}
if (atomic_set_to_one(&(lock->value)) == 0) {
return EBUSY;
}
return 0;
}
int pthread_spin_unlock(pthread_spinlock_t *lock)
{
if (lock == NULL) {
return EINVAL;
}
if (atomic_set_to_zero(&(lock->value)) == 0) {
return EPERM;
}
return 0;
}
|
/* Test _Float16 type-generic built-in functions. */
/* { dg-do run } */
/* { dg-options "" } */
/* { dg-add-options float16 } */
/* { dg-add-options ieee } */
/* { dg-require-effective-target float16_runtime } */
#define WIDTH 16
#define EXT 0
#include "floatn-tg.h"
|
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/types.h>
#include <linux/export.h>
unsigned int x86_family(unsigned int sig)
{
unsigned int x86;
x86 = (sig >> 8) & 0xf;
if (x86 == 0xf)
x86 += (sig >> 20) & 0xff;
return x86;
}
EXPORT_SYMBOL_GPL(x86_family);
unsigned int x86_model(unsigned int sig)
{
unsigned int fam, model;
fam = x86_family(sig);
model = (sig >> 4) & 0xf;
if (fam >= 0x6)
model += ((sig >> 16) & 0xf) << 4;
return model;
}
EXPORT_SYMBOL_GPL(x86_model);
unsigned int x86_stepping(unsigned int sig)
{
return sig & 0xf;
}
EXPORT_SYMBOL_GPL(x86_stepping);
|
#ifndef INCLUDE_SERIALREADINGDELEGATEDEMO_H_
#define INCLUDE_SERIALREADINGDELEGATEDEMO_H_
//*** Example of global callback routine
void onDataCallback(Stream& stream, char arrivedChar, unsigned short availableCharsCount)
{
}
//*** Example of class callback processing
class SerialReadingDelegateDemo
{
public:
void begin()
{
Serial.setCallback(StreamDataReceivedDelegate(&SerialReadingDelegateDemo::onData, this));
debugf("hwsDelegateDemo instantiated, waiting for data");
};
void onData(Stream& stream, char arrivedChar, unsigned short availableCharsCount)
{
Serial.print("Class Delegate Demo Time = ");
Serial.print(micros());
Serial.print(" char = 0x");
Serial.print(String(arrivedChar, HEX)); // char hex code
Serial.print(" available = ");
Serial.println(availableCharsCount);
numCallback++;
if (arrivedChar == '\n') // Lets show data!
{
Serial.println("<New line received>");
while (stream.available())
{
char cur = stream.read();
charReceived++;
Serial.print(cur);
}
Serial.println();
}
}
private:
unsigned charReceived = 0;
unsigned numCallback = 0;
bool useRxFlag = true;
};
#endif /* INCLUDE_SERIALREADINGDELEGATEDEMO_H_ */
|
#ifndef GETOPT_H
#define GETOPT_H
/* include files needed by this include file */
/* macros defined by this include file */
#define no_argument 0
#define required_argument 1
#define OPTIONAL_ARG 2
/* types defined by this include file */
/* GETOPT_LONG_OPTION_T: The type of long option */
typedef struct GETOPT_LONG_OPTION_T
{
const char *name; /* the name of the long option */
int has_arg; /* one of the above macros */
int *flag; /* determines if getopt_long() returns a
* value for a long option; if it is
* non-NULL, 0 is returned as a function
* value and the value of val is stored in
* the area pointed to by flag. Otherwise,
* val is returned. */
int val; /* determines the value to return if flag is
* NULL. */
} GETOPT_LONG_OPTION_T;
typedef GETOPT_LONG_OPTION_T option;
#ifdef __cplusplus
extern "C"
{
#endif
/* externally-defined variables */
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
/* function prototypes */
#ifndef _AIX
int getopt (int argc, char **argv, char *optstring);
#endif
int getopt_long (int argc, char **argv, const char *shortopts,
const GETOPT_LONG_OPTION_T * longopts, int *longind);
int getopt_long_only (int argc, char **argv, const char *shortopts,
const GETOPT_LONG_OPTION_T * longopts, int *longind);
#ifdef __cplusplus
};
#endif
#endif /* GETOPT_H */
/* END OF FILE getopt.h */
|
/******************************************************************************
* Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
******************************************************************************/
#ifndef _R819XU_PHY_H
#define _R819XU_PHY_H
#define MAX_DOZE_WAITING_TIMES_9x 64
#define AGCTAB_ArrayLength AGCTAB_ArrayLengthPciE
#define MACPHY_ArrayLength MACPHY_ArrayLengthPciE
#define RadioA_ArrayLength RadioA_ArrayLengthPciE
#define RadioB_ArrayLength RadioB_ArrayLengthPciE
#define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE
#define RadioC_ArrayLength RadioC_ArrayLengthPciE
#define RadioD_ArrayLength RadioD_ArrayLengthPciE
#define PHY_REGArrayLength PHY_REGArrayLengthPciE
#define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE
#define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG
#define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array
#define Rtl819XRadioA_Array Rtl8192PciERadioA_Array
#define Rtl819XRadioB_Array Rtl8192PciERadioB_Array
#define Rtl819XRadioC_Array Rtl8192PciERadioC_Array
#define Rtl819XRadioD_Array Rtl8192PciERadioD_Array
#define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array
#define Rtl819XPHY_REGArray Rtl8192PciEPHY_REGArray
#define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray
extern u32 rtl819XMACPHY_Array_PG[];
extern u32 rtl819XPHY_REG_1T2RArray[];
extern u32 rtl819XAGCTAB_Array[];
extern u32 rtl819XRadioA_Array[];
extern u32 rtl819XRadioB_Array[];
extern u32 rtl819XRadioC_Array[];
extern u32 rtl819XRadioD_Array[];
enum hw90_block {
HW90_BLOCK_MAC = 0,
HW90_BLOCK_PHY0 = 1,
HW90_BLOCK_PHY1 = 2,
HW90_BLOCK_RF = 3,
HW90_BLOCK_MAXIMUM = 4,
};
enum rf90_radio_path {
RF90_PATH_A = 0,
RF90_PATH_B = 1,
RF90_PATH_C = 2,
RF90_PATH_D = 3,
RF90_PATH_MAX
};
#define bMaskByte0 0xff
#define bMaskByte1 0xff00
#define bMaskByte2 0xff0000
#define bMaskByte3 0xff000000
#define bMaskHWord 0xffff0000
#define bMaskLWord 0x0000ffff
#define bMaskDWord 0xffffffff
extern u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev,
u32 eRFPath);
extern void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr,
u32 dwBitMask, u32 dwData);
extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr,
u32 dwBitMask);
extern void rtl8192_phy_SetRFReg(struct net_device *dev,
enum rf90_radio_path eRFPath,
u32 RegAddr, u32 BitMask, u32 Data);
extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev,
enum rf90_radio_path eRFPath,
u32 RegAddr, u32 BitMask);
extern void rtl8192_phy_configmac(struct net_device *dev);
extern void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType);
extern bool rtl8192_phy_checkBBAndRF(struct net_device *dev,
enum hw90_block CheckBlock,
enum rf90_radio_path eRFPath);
extern bool rtl8192_BBConfig(struct net_device *dev);
extern void rtl8192_phy_getTxPower(struct net_device *dev);
extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel);
extern bool rtl8192_phy_RFConfig(struct net_device *dev);
extern void rtl8192_phy_updateInitGain(struct net_device *dev);
extern u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev,
enum rf90_radio_path eRFPath);
extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel);
extern void rtl8192_SetBWMode(struct net_device *dev,
enum ht_channel_width Bandwidth,
enum ht_extchnl_offset Offset);
extern void rtl8192_SwChnl_WorkItem(struct net_device *dev);
extern void rtl8192_SetBWModeWorkItem(struct net_device *dev);
extern void InitialGain819xPci(struct net_device *dev, u8 Operation);
extern void PHY_SetRtl8192eRfOff(struct net_device *dev);
bool
SetRFPowerState(
struct net_device *dev,
enum rt_rf_power_state eRFPowerState
);
#define PHY_SetRFPowerState SetRFPowerState
extern void PHY_ScanOperationBackup8192(struct net_device *dev, u8 Operation);
#endif
|
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this
* notice you can do whatever you want with this stuff. If we meet some
* day, and you think this stuff is worth it, you can buy me a beer in
* return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*/
#include "includes.h"
#if defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT)
#include <sys/types.h>
#include <string.h>
#include <openssl/md5.h>
/* 0 ... 63 => ascii - 64 */
static unsigned char itoa64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static char *magic = "$1$";
static char *
to64(unsigned long v, int n)
{
static char buf[5];
char *s = buf;
if (n > 4)
return (NULL);
memset(buf, '\0', sizeof(buf));
while (--n >= 0) {
*s++ = itoa64[v&0x3f];
v >>= 6;
}
return (buf);
}
int
is_md5_salt(const char *salt)
{
return (strncmp(salt, magic, strlen(magic)) == 0);
}
char *
md5_crypt(const char *pw, const char *salt)
{
static char passwd[120], salt_copy[9], *p;
static const char *sp, *ep;
unsigned char final[16];
int sl, pl, i, j;
MD5_CTX ctx, ctx1;
unsigned long l;
/* Refine the Salt first */
sp = salt;
/* If it starts with the magic string, then skip that */
if(strncmp(sp, magic, strlen(magic)) == 0)
sp += strlen(magic);
/* It stops at the first '$', max 8 chars */
for (ep = sp; *ep != '$'; ep++) {
if (*ep == '\0' || ep >= (sp + 8))
return (NULL);
}
/* get the length of the true salt */
sl = ep - sp;
/* Stash the salt */
memcpy(salt_copy, sp, sl);
salt_copy[sl] = '\0';
MD5_Init(&ctx);
/* The password first, since that is what is most unknown */
MD5_Update(&ctx, pw, strlen(pw));
/* Then our magic string */
MD5_Update(&ctx, magic, strlen(magic));
/* Then the raw salt */
MD5_Update(&ctx, sp, sl);
/* Then just as many characters of the MD5(pw, salt, pw) */
MD5_Init(&ctx1);
MD5_Update(&ctx1, pw, strlen(pw));
MD5_Update(&ctx1, sp, sl);
MD5_Update(&ctx1, pw, strlen(pw));
MD5_Final(final, &ctx1);
for(pl = strlen(pw); pl > 0; pl -= 16)
MD5_Update(&ctx, final, pl > 16 ? 16 : pl);
/* Don't leave anything around in vm they could use. */
memset(final, '\0', sizeof final);
/* Then something really weird... */
for (j = 0, i = strlen(pw); i != 0; i >>= 1)
if (i & 1)
MD5_Update(&ctx, final + j, 1);
else
MD5_Update(&ctx, pw + j, 1);
/* Now make the output string */
snprintf(passwd, sizeof(passwd), "%s%s$", magic, salt_copy);
MD5_Final(final, &ctx);
/*
* and now, just to make sure things don't run too fast
* On a 60 Mhz Pentium this takes 34 msec, so you would
* need 30 seconds to build a 1000 entry dictionary...
*/
for(i = 0; i < 1000; i++) {
MD5_Init(&ctx1);
if (i & 1)
MD5_Update(&ctx1, pw, strlen(pw));
else
MD5_Update(&ctx1, final, 16);
if (i % 3)
MD5_Update(&ctx1, sp, sl);
if (i % 7)
MD5_Update(&ctx1, pw, strlen(pw));
if (i & 1)
MD5_Update(&ctx1, final, 16);
else
MD5_Update(&ctx1, pw, strlen(pw));
MD5_Final(final, &ctx1);
}
p = passwd + strlen(passwd);
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12];
strlcat(passwd, to64(l, 4), sizeof(passwd));
l = (final[ 1]<<16) | (final[ 7]<<8) | final[13];
strlcat(passwd, to64(l, 4), sizeof(passwd));
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14];
strlcat(passwd, to64(l, 4), sizeof(passwd));
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15];
strlcat(passwd, to64(l, 4), sizeof(passwd));
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5];
strlcat(passwd, to64(l, 4), sizeof(passwd));
l = final[11] ;
strlcat(passwd, to64(l, 2), sizeof(passwd));
/* Don't leave anything around in vm they could use. */
memset(final, 0, sizeof(final));
memset(salt_copy, 0, sizeof(salt_copy));
memset(&ctx, 0, sizeof(ctx));
memset(&ctx1, 0, sizeof(ctx1));
(void)to64(0, 4);
return (passwd);
}
#endif /* defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT) */
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.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, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <map>
#include <string>
#include "cores/AudioEngine/Interfaces/AESound.h"
#include "settings/lib/ISettingCallback.h"
#include "threads/CriticalSection.h"
// forward definitions
class CAction;
class TiXmlNode;
class IAESound;
enum WINDOW_SOUND { SOUND_INIT = 0, SOUND_DEINIT };
class CGUIAudioManager : public ISettingCallback
{
class CWindowSounds
{
public:
IAESound *initSound;
IAESound *deInitSound;
};
class CSoundInfo
{
public:
int usage;
IAESound *sound;
};
public:
CGUIAudioManager();
~CGUIAudioManager();
virtual void OnSettingChanged(const CSetting *setting);
virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);
void Initialize();
void DeInitialize();
bool Load();
void UnLoad();
void PlayActionSound(const CAction& action);
void PlayWindowSound(int id, WINDOW_SOUND event);
void PlayPythonSound(const std::string& strFileName, bool useCached = true);
void Enable(bool bEnable);
void SetVolume(float level);
void Stop();
private:
typedef std::map<const std::string, CSoundInfo> soundCache;
typedef std::map<int, IAESound* > actionSoundMap;
typedef std::map<int, CWindowSounds > windowSoundMap;
typedef std::map<const std::string, IAESound* > pythonSoundsMap;
soundCache m_soundCache;
actionSoundMap m_actionSoundMap;
windowSoundMap m_windowSoundMap;
pythonSoundsMap m_pythonSounds;
std::string m_strMediaDir;
bool m_bEnabled;
CCriticalSection m_cs;
IAESound* LoadSound(const std::string &filename);
void FreeSound(IAESound *sound);
void FreeSoundAllUsage(IAESound *sound);
IAESound* LoadWindowSound(TiXmlNode* pWindowNode, const std::string& strIdentifier);
};
extern CGUIAudioManager g_audioManager;
|
/*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QUERYRESULT_H
#define QUERYRESULT_H
#include <memory>
#include "Field.h"
#ifdef _WIN32
#include <winsock2.h>
#endif
#include <mysql.h>
class TC_DATABASE_API ResultSet
{
public:
ResultSet(MYSQL_RES* result, MYSQL_FIELD* fields, uint64 rowCount, uint32 fieldCount);
~ResultSet();
bool NextRow();
uint64 GetRowCount() const { return _rowCount; }
uint32 GetFieldCount() const { return _fieldCount; }
Field* Fetch() const { return _currentRow; }
const Field & operator [] (uint32 index) const
{
ASSERT(index < _fieldCount);
return _currentRow[index];
}
protected:
uint64 _rowCount;
Field* _currentRow;
uint32 _fieldCount;
private:
void CleanUp();
MYSQL_RES* _result;
MYSQL_FIELD* _fields;
ResultSet(ResultSet const& right) = delete;
ResultSet& operator=(ResultSet const& right) = delete;
};
typedef std::shared_ptr<ResultSet> QueryResult;
class TC_DATABASE_API PreparedResultSet
{
public:
PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64 rowCount, uint32 fieldCount);
~PreparedResultSet();
bool NextRow();
uint64 GetRowCount() const { return m_rowCount; }
uint32 GetFieldCount() const { return m_fieldCount; }
Field* Fetch() const
{
ASSERT(m_rowPosition < m_rowCount);
return const_cast<Field*>(&m_rows[uint32(m_rowPosition) * m_fieldCount]);
}
Field const& operator[](uint32 index) const
{
ASSERT(m_rowPosition < m_rowCount);
ASSERT(index < m_fieldCount);
return m_rows[uint32(m_rowPosition) * m_fieldCount + index];
}
protected:
std::vector<Field> m_rows;
uint64 m_rowCount;
uint64 m_rowPosition;
uint32 m_fieldCount;
private:
MYSQL_BIND* m_rBind;
MYSQL_STMT* m_stmt;
MYSQL_RES* m_metadataResult; ///< Field metadata, returned by mysql_stmt_result_metadata
my_bool* m_isNull;
unsigned long* m_length;
void CleanUp();
bool _NextRow();
PreparedResultSet(PreparedResultSet const& right) = delete;
PreparedResultSet& operator=(PreparedResultSet const& right) = delete;
};
typedef std::shared_ptr<PreparedResultSet> PreparedQueryResult;
#endif
|
/*============================================================================
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
Package, Release 3e, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
California. 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 University 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 REGENTS AND CONTRIBUTORS "AS IS", AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
#include "softfloat.h"
float16_t f64_to_f16( float64_t a )
{
union ui64_f64 uA;
uint_fast64_t uiA;
bool sign;
int_fast16_t exp;
uint_fast64_t frac;
struct commonNaN commonNaN;
uint_fast16_t uiZ, frac16;
union ui16_f16 uZ;
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
uA.f = a;
uiA = uA.ui;
sign = signF64UI( uiA );
exp = expF64UI( uiA );
frac = fracF64UI( uiA );
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
if ( exp == 0x7FF ) {
if ( frac ) {
softfloat_f64UIToCommonNaN( uiA, &commonNaN );
uiZ = softfloat_commonNaNToF16UI( &commonNaN );
} else {
uiZ = packToF16UI( sign, 0x1F, 0 );
}
goto uiZ;
}
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
frac16 = softfloat_shortShiftRightJam64( frac, 38 );
if ( ! (exp | frac16) ) {
uiZ = packToF16UI( sign, 0, 0 );
goto uiZ;
}
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
return softfloat_roundPackToF16( sign, exp - 0x3F1, frac16 | 0x4000 );
uiZ:
uZ.ui = uiZ;
return uZ.f;
}
|
/***************************************************************************
* *
* Copyright: http://www.ii-system.com *
* License: LGPL *
* *
***************************************************************************/
#ifndef IISTASKHEADER_H
#define IISTASKHEADER_H
#include <QtGui>
#include <QFrame>
#include <QLabel>
#include <QEvent>
#include <QMouseEvent>
#include "iistaskpanel_global.h"
class iisTaskPanelScheme;
struct iisIconLabelScheme;
class iisIconLabel;
class IISTASKPANEL_EXPORT iisTaskHeader : public QFrame
{
Q_OBJECT
public:
iisTaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent = 0);
void setScheme(iisTaskPanelScheme *scheme);
virtual ~iisTaskHeader();
Q_SIGNALS:
void activated();
public Q_SLOTS:
void fold();
protected Q_SLOTS:
void animate();
protected:
virtual void paintEvent ( QPaintEvent * event );
virtual void enterEvent ( QEvent * event );
virtual void leaveEvent ( QEvent * event );
virtual void mouseReleaseEvent ( QMouseEvent * event );
bool eventFilter(QObject *obj, QEvent *event);
void changeIcons();
iisTaskPanelScheme *myScheme;
iisIconLabelScheme *myLabelScheme;
bool myExpandable;
bool m_over, m_buttonOver, m_fold;
double m_opacity;
iisIconLabel *myTitle;
QLabel *myButton;
};
#endif // IISTASKHEADER_H
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_SHA1_H_
#define BASE_SHA1_H_
#include <stddef.h>
#include <string>
#include "base/base_export.h"
namespace base {
// These functions perform SHA-1 operations.
static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
// Computes the SHA-1 hash of the input string |str| and returns the full
// hash.
BASE_EXPORT std::string SHA1HashString(const std::string& str);
// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
// in |hash|. |hash| must be kSHA1Length bytes long.
BASE_EXPORT void SHA1HashBytes(const unsigned char* data, size_t len,
unsigned char* hash);
} // namespace base
#endif // BASE_SHA1_H_
|
// A class for managing the data associated with sets of molecules
#ifndef PER_MOLECULE_SET_H
#define PER_MOLECULE_SET_H
// ATC_Method headers
#include "LammpsInterface.h"
#include "DependencyManager.h"
#include <map>
#include <set>
#include <vector>
namespace ATC {
// forward declarations
class ATC_Method;
template <typename T> class PerAtomQuantity;
/**
* @class MoleculeSet
* @brief A class for handling all the data associated with sets of molecules
*/
class MoleculeSet : public DependencyManager {
public:
MoleculeSet(ATC_Method * atc, int groupBit);
virtual ~MoleculeSet();
/** reset all data */
virtual void clear();
/** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL);
/** reset the number of atoms/molecules on this processor */
void reset_nlocal() {this->set_reset();};
/** recompute data when atoms cross processors */
void post_exchange() {this->set_reset();};
/** access the number of total molecules */
int global_molecule_count() const {return nMoleculesTotal_;};
/** access the number of local molecules */
int local_molecule_count() const {if (need_reset()) reset(); return moleculeToAtoms_.size();};
/** access molecule atoms by lammps id */
std::set<int> atoms_by_global_molecule(int id) const;
/** access molecules by local indexing */
const std::set<int> & atoms_by_local_molecule(int id) const;
/** access fraction of a locally indexed molecule on this processor */
virtual double local_fraction(int id) const = 0;
/** use global index to get local index */
//int global_to_local(int id) const;
/** use local index to get global index */
int local_to_global(int id) const {return (*localMoleculeToAtoms_[id]).first;};
protected:
/** pointer for access to atc data */
ATC_Method * atc_;
/** lammps group bit corresponding to desired molecules */
int groupBit_;
/** pointer to lammps interface */
const LammpsInterface * lammps_;
/** total number of molecules in this group */
// see Compute::molecules_in_group
int nMoleculesTotal_;
/** multimap from lammps molecule id to ids of consituent atoms, all atoms are real */
// multiple map to account for periodic images
mutable std::multimap<int, std::set<int> > moleculeToAtoms_;
/** vector in processor-local molecule order to constituent atom sets, atoms include ghosts */
mutable std::vector< std::map<int, std::set<int> >::const_iterator > localMoleculeToAtoms_;
/** resets the quantity based on the latest data */
virtual void reset() const = 0;
/** creates the ordered list of local molecules */
void set_local_molecules_to_atoms() const;
private:
// do not define this
MoleculeSet();
};
/**
* @class SmallMoleculeSet
* @brief A class for handling data for small molecules, i.e., molecules with maximum distance between atoms less than the lammps cutoff radius. Atom ids are in [0,nlocalTotal-1].
*/
class SmallMoleculeSet : public MoleculeSet {
public:
SmallMoleculeSet(ATC_Method * atc, int groupBit,
PerAtomQuantity<int> * bondList = NULL,
PerAtomQuantity<int> * numBond = NULL);
virtual ~SmallMoleculeSet();
/** reset all data */
virtual void clear();
/** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL);
/** access molecule atoms by lammps id */
std::set<int> atoms_by_global_molecule(int id) const;
/** access fraction of a locally indexed molecule on this processor */
virtual double local_fraction(int id) const;
protected:
/** store the number of atoms in a molecule on this processor */
//std::map<int, int> localAtomsPerMolecule_;
/** resets the quantity based on the latest data */
virtual void reset() const;
/** data structure containing bond list information, forces parallel communication of bond lists */
PerAtomQuantity<int> * bondList_;
/** data structure containing bond list information, forces parallel communication of bond lists */
PerAtomQuantity<int> * numBond_;
/** removes processor ghosts from a set of atom ids */
void remove_proc_ghosts(std::set<int> & atomSet) const;
// workspace variable for determining if we've hit an internal atom already
mutable Array<bool> _atomFound_;
private:
// do not define this
SmallMoleculeSet();
};
};
#endif
|
#pragma once
#include "vec3.h"
/* __declspec(align(16)) */ struct Ray
{
Vec3 origin;
int pad;
Vec3 dir;
int pad2;
Vec3 invdir;
int pad3;
};
|
/*
* Copyright (C) 2007 Red Hat. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License v2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/xattr.h>
#include <linux/posix_acl_xattr.h>
#include <linux/posix_acl.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include "ctree.h"
#include "btrfs_inode.h"
#include "xattr.h"
struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
{
int size;
const char *name;
char *value = NULL;
struct posix_acl *acl;
if (!IS_POSIXACL(inode))
return NULL;
acl = get_cached_acl(inode, type);
if (acl != ACL_NOT_CACHED)
return acl;
switch (type) {
case ACL_TYPE_ACCESS:
name = POSIX_ACL_XATTR_ACCESS;
break;
case ACL_TYPE_DEFAULT:
name = POSIX_ACL_XATTR_DEFAULT;
break;
default:
BUG();
}
size = __btrfs_getxattr(inode, name, "", 0);
if (size > 0) {
value = kzalloc(size, GFP_NOFS);
if (!value)
return ERR_PTR(-ENOMEM);
size = __btrfs_getxattr(inode, name, value, size);
}
if (size > 0) {
acl = posix_acl_from_xattr(value, size);
} else if (size == -ENOENT || size == -ENODATA || size == 0) {
acl = NULL;
} else {
acl = ERR_PTR(-EIO);
}
kfree(value);
if (!IS_ERR(acl))
set_cached_acl(inode, type, acl);
return acl;
}
static int btrfs_xattr_acl_get(struct dentry *dentry, const char *name,
void *value, size_t size, int type)
{
struct posix_acl *acl;
int ret = 0;
if (!IS_POSIXACL(dentry->d_inode))
return -EOPNOTSUPP;
acl = btrfs_get_acl(dentry->d_inode, type);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
return -ENODATA;
ret = posix_acl_to_xattr(acl, value, size);
posix_acl_release(acl);
return ret;
}
static int btrfs_set_acl(struct btrfs_trans_handle *trans,
struct inode *inode, struct posix_acl *acl, int type)
{
int ret, size = 0;
const char *name;
char *value = NULL;
if (acl) {
ret = posix_acl_valid(acl);
if (ret < 0)
return ret;
ret = 0;
}
switch (type) {
case ACL_TYPE_ACCESS:
name = POSIX_ACL_XATTR_ACCESS;
if (acl) {
ret = posix_acl_equiv_mode(acl, &inode->i_mode);
if (ret < 0)
return ret;
}
ret = 0;
break;
case ACL_TYPE_DEFAULT:
if (!S_ISDIR(inode->i_mode))
return acl ? -EINVAL : 0;
name = POSIX_ACL_XATTR_DEFAULT;
break;
default:
return -EINVAL;
}
if (acl) {
size = posix_acl_xattr_size(acl->a_count);
value = kmalloc(size, GFP_NOFS);
if (!value) {
ret = -ENOMEM;
goto out;
}
ret = posix_acl_to_xattr(acl, value, size);
if (ret < 0)
goto out;
}
ret = __btrfs_setxattr(trans, inode, name, value, size, 0);
out:
kfree(value);
if (!ret)
set_cached_acl(inode, type, acl);
return ret;
}
static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags, int type)
{
int ret;
struct posix_acl *acl = NULL;
if (!inode_owner_or_capable(dentry->d_inode))
return -EPERM;
if (!IS_POSIXACL(dentry->d_inode))
return -EOPNOTSUPP;
if (value) {
acl = posix_acl_from_xattr(value, size);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl) {
ret = posix_acl_valid(acl);
if (ret)
goto out;
}
}
ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type);
out:
posix_acl_release(acl);
return ret;
}
int btrfs_init_acl(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *dir)
{
struct posix_acl *acl = NULL;
int ret = 0;
if (!dir)
return 0;
if (!S_ISLNK(inode->i_mode)) {
if (IS_POSIXACL(dir)) {
acl = btrfs_get_acl(dir, ACL_TYPE_DEFAULT);
if (IS_ERR(acl))
return PTR_ERR(acl);
}
if (!acl)
inode->i_mode &= ~current_umask();
}
if (IS_POSIXACL(dir) && acl) {
if (S_ISDIR(inode->i_mode)) {
ret = btrfs_set_acl(trans, inode, acl,
ACL_TYPE_DEFAULT);
if (ret)
goto failed;
}
ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
if (ret < 0)
return ret;
if (ret > 0) {
ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
}
}
failed:
posix_acl_release(acl);
return ret;
}
int btrfs_acl_chmod(struct inode *inode)
{
struct posix_acl *acl;
int ret = 0;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
if (!IS_POSIXACL(inode))
return 0;
acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR_OR_NULL(acl))
return PTR_ERR(acl);
ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
if (ret)
return ret;
ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl);
return ret;
}
const struct xattr_handler btrfs_xattr_acl_default_handler = {
.prefix = POSIX_ACL_XATTR_DEFAULT,
.flags = ACL_TYPE_DEFAULT,
.get = btrfs_xattr_acl_get,
.set = btrfs_xattr_acl_set,
};
const struct xattr_handler btrfs_xattr_acl_access_handler = {
.prefix = POSIX_ACL_XATTR_ACCESS,
.flags = ACL_TYPE_ACCESS,
.get = btrfs_xattr_acl_get,
.set = btrfs_xattr_acl_set,
};
|
#include <linux/oprofile.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <asm/ptrace.h>
#include <asm/stacktrace.h>
#include <linux/stacktrace.h>
#include <linux/kernel.h>
#include <asm/sections.h>
#include <asm/inst.h>
struct stackframe {
unsigned long sp;
unsigned long pc;
unsigned long ra;
};
static inline int get_mem(unsigned long addr, unsigned long *result)
{
unsigned long *address = (unsigned long *) addr;
if (!access_ok(VERIFY_READ, addr, sizeof(unsigned long)))
return -1;
if (__copy_from_user_inatomic(result, address, sizeof(unsigned long)))
return -3;
return 0;
}
static inline int is_ra_save_ins(union mips_instruction *ip)
{
return (ip->i_format.opcode == sw_op || ip->i_format.opcode == sd_op)
&& ip->i_format.rs == 29 && ip->i_format.rt == 31;
}
static inline int is_sp_move_ins(union mips_instruction *ip)
{
if (ip->i_format.rs != 29 || ip->i_format.rt != 29)
return 0;
if (ip->i_format.opcode == addiu_op || ip->i_format.opcode == daddiu_op)
return 1;
return 0;
}
static inline int is_end_of_function_marker(union mips_instruction *ip)
{
if (ip->r_format.func == jr_op && ip->r_format.rs == 31)
return 1;
if (ip->i_format.opcode == lui_op && ip->i_format.rt == 28)
return 1;
return 0;
}
static inline int unwind_user_frame(struct stackframe *old_frame,
const unsigned int max_instr_check)
{
struct stackframe new_frame = *old_frame;
off_t ra_offset = 0;
size_t stack_size = 0;
unsigned long addr;
if (old_frame->pc == 0 || old_frame->sp == 0 || old_frame->ra == 0)
return -9;
for (addr = new_frame.pc; (addr + max_instr_check > new_frame.pc)
&& (!ra_offset || !stack_size); --addr) {
union mips_instruction ip;
if (get_mem(addr, (unsigned long *) &ip))
return -11;
if (is_sp_move_ins(&ip)) {
int stack_adjustment = ip.i_format.simmediate;
if (stack_adjustment > 0)
break;
stack_size = (unsigned) stack_adjustment;
} else if (is_ra_save_ins(&ip)) {
int ra_slot = ip.i_format.simmediate;
if (ra_slot < 0)
break;
ra_offset = ra_slot;
} else if (is_end_of_function_marker(&ip))
break;
}
if (!ra_offset || !stack_size)
return -1;
if (ra_offset) {
new_frame.ra = old_frame->sp + ra_offset;
if (get_mem(new_frame.ra, &(new_frame.ra)))
return -13;
}
if (stack_size) {
new_frame.sp = old_frame->sp + stack_size;
if (get_mem(new_frame.sp, &(new_frame.sp)))
return -14;
}
if (new_frame.sp > old_frame->sp)
return -2;
new_frame.pc = old_frame->ra;
*old_frame = new_frame;
return 0;
}
static inline void do_user_backtrace(unsigned long low_addr,
struct stackframe *frame,
unsigned int depth)
{
const unsigned int max_instr_check = 512;
const unsigned long high_addr = low_addr + THREAD_SIZE;
while (depth-- && !unwind_user_frame(frame, max_instr_check)) {
oprofile_add_trace(frame->ra);
if (frame->sp < low_addr || frame->sp > high_addr)
break;
}
}
#ifndef CONFIG_KALLSYMS
static inline void do_kernel_backtrace(unsigned long low_addr,
struct stackframe *frame,
unsigned int depth) { }
#else
static inline void do_kernel_backtrace(unsigned long low_addr,
struct stackframe *frame,
unsigned int depth)
{
while (depth-- && frame->pc) {
frame->pc = unwind_stack_by_address(low_addr,
&(frame->sp),
frame->pc,
&(frame->ra));
oprofile_add_trace(frame->ra);
}
}
#endif
void notrace op_mips_backtrace(struct pt_regs *const regs, unsigned int depth)
{
struct stackframe frame = { .sp = regs->regs[29],
.pc = regs->cp0_epc,
.ra = regs->regs[31] };
const int userspace = user_mode(regs);
const unsigned long low_addr = ALIGN(frame.sp, THREAD_SIZE);
if (userspace)
do_user_backtrace(low_addr, &frame, depth);
else
do_kernel_backtrace(low_addr, &frame, depth);
}
|
/* Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This is a Linux specific implementation of a mutex synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#include "wait.h"
long int gomp_futex_wake = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
long int gomp_futex_wait = FUTEX_WAIT | FUTEX_PRIVATE_FLAG;
void
gomp_mutex_lock_slow (gomp_mutex_t *mutex)
{
do
{
int oldval = __sync_val_compare_and_swap (mutex, 1, 2);
if (oldval != 0)
do_wait (mutex, 2);
}
while (!__sync_bool_compare_and_swap (mutex, 0, 2));
}
void
gomp_mutex_unlock_slow (gomp_mutex_t *mutex)
{
futex_wake (mutex, 1);
}
|
/*
* Copyright (C) 2008 Google, Inc.
* Author: Nick Pelly <npelly@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __ASM_ARCH_MSM_SERIAL_HS_H
#define __ASM_ARCH_MSM_SERIAL_HS_H
#include <linux/serial_core.h>
extern void msm_hs_request_clock_off(struct uart_port *uport);
extern void msm_hs_request_clock_on(struct uart_port *uport);
struct msm_serial_hs_platform_data {
int rx_wakeup_irq;
unsigned char inject_rx_on_wakeup;
char rx_to_inject;
void (*exit_lpm_cb)(struct uart_port *);
};
#endif
|
/*
* dummy.c
*
* Copyright 2010 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This is useful for systems with mixed controllable and
* non-controllable regulators, as well as for allowing testing on
* systems with no controllable regulators.
*/
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include "dummy.h"
struct regulator_dev *dummy_regulator_rdev;
static struct regulator_init_data dummy_initdata;
static struct regulator_ops dummy_ops;
static struct regulator_desc dummy_desc = {
.name = "dummy",
.id = -1,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
.ops = &dummy_ops,
};
static struct platform_device *dummy_pdev;
void __init regulator_dummy_init(void)
{
int ret;
dummy_pdev = platform_device_alloc("reg-dummy", -1);
if (!dummy_pdev) {
pr_err("Failed to allocate dummy regulator device\n");
return;
}
ret = platform_device_add(dummy_pdev);
if (ret != 0) {
pr_err("Failed to register dummy regulator device: %d\n", ret);
platform_device_put(dummy_pdev);
return;
}
dummy_regulator_rdev = regulator_register(&dummy_desc, NULL,
&dummy_initdata, NULL);
if (IS_ERR(dummy_regulator_rdev)) {
ret = PTR_ERR(dummy_regulator_rdev);
pr_err("Failed to register regulator: %d\n", ret);
platform_device_unregister(dummy_pdev);
return;
}
}
|
/*
* otg.c - ChipIdea USB IP core OTG driver
*
* Copyright (C) 2013 Freescale Semiconductor, Inc.
*
* Author: Peter Chen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/*
* This file mainly handles otgsc register, it may include OTG operation
* in the future.
*/
#include <linux/usb/otg.h>
#include <linux/usb/gadget.h>
#include <linux/usb/chipidea.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include "ci.h"
#include "bits.h"
#include "otg.h"
/**
* ci_otg_role - pick role based on ID pin state
* @ci: the controller
*/
enum ci_role ci_otg_role(struct ci_hdrc *ci)
{
u32 sts = hw_read(ci, OP_OTGSC, ~0);
enum ci_role role = sts & OTGSC_ID
? CI_ROLE_GADGET
: CI_ROLE_HOST;
return role;
}
void ci_handle_vbus_connected(struct ci_hdrc *ci)
{
u32 otgsc;
/*
* TODO: if the platform does not supply 5v to udc, or use other way
* to supply 5v, it needs to use other conditions to call
* usb_gadget_vbus_connect.
*/
if (!ci->is_otg)
return;
otgsc = hw_read(ci, OP_OTGSC, ~0);
if (otgsc & OTGSC_BSV)
usb_gadget_vbus_connect(&ci->gadget);
}
void ci_handle_vbus_change(struct ci_hdrc *ci)
{
u32 otgsc;
if (!ci->is_otg)
return;
otgsc = hw_read(ci, OP_OTGSC, ~0);
if (otgsc & OTGSC_BSV)
usb_gadget_vbus_connect(&ci->gadget);
else
usb_gadget_vbus_disconnect(&ci->gadget);
}
#define CI_VBUS_STABLE_TIMEOUT_MS 5000
static void ci_handle_id_switch(struct ci_hdrc *ci)
{
enum ci_role role = ci_otg_role(ci);
if (role != ci->role) {
dev_dbg(ci->dev, "switching from %s to %s\n",
ci_role(ci)->name, ci->roles[role]->name);
ci_role_stop(ci);
/* wait vbus lower than OTGSC_BSV */
hw_wait_reg(ci, OP_OTGSC, OTGSC_BSV, 0,
CI_VBUS_STABLE_TIMEOUT_MS);
ci_role_start(ci, role);
}
}
/* If there is pending otg event */
static inline bool ci_otg_event_is_pending(struct ci_hdrc *ci)
{
return ci->id_event || ci->b_sess_valid_event;
}
/**
* ci_otg_event - perform otg (vbus/id) event handle
* @ci: ci_hdrc struct
*/
static void ci_otg_event(struct ci_hdrc *ci)
{
if (ci->id_event) {
ci->id_event = false;
/* Keep controller active during id switch */
pm_runtime_get_sync(ci->dev);
ci_handle_id_switch(ci);
pm_runtime_put_sync(ci->dev);
} else if (ci->b_sess_valid_event) {
ci->b_sess_valid_event = false;
pm_runtime_get_sync(ci->dev);
ci_handle_vbus_change(ci);
pm_runtime_put_sync(ci->dev);
} else
dev_dbg(ci->dev, "it should be quit event\n");
enable_irq(ci->irq);
}
static int ci_otg_thread(void *ptr)
{
struct ci_hdrc *ci = ptr;
set_freezable();
do {
wait_event_freezable(ci->otg_wait,
ci_otg_event_is_pending(ci) ||
kthread_should_stop());
ci_otg_event(ci);
} while (!kthread_should_stop());
dev_warn(ci->dev, "ci_otg_thread quits\n");
return 0;
}
/**
* ci_hdrc_otg_init - initialize otg struct
* ci: the controller
*/
int ci_hdrc_otg_init(struct ci_hdrc *ci)
{
init_waitqueue_head(&ci->otg_wait);
ci->otg_task = kthread_run(ci_otg_thread, ci, "ci otg thread");
if (IS_ERR(ci->otg_task)) {
dev_err(ci->dev, "error to create otg thread\n");
return PTR_ERR(ci->otg_task);
}
return 0;
}
/**
* ci_hdrc_otg_destroy - destroy otg struct
* ci: the controller
*/
void ci_hdrc_otg_destroy(struct ci_hdrc *ci)
{
kthread_stop(ci->otg_task);
ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS);
ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS);
}
|
/*
* include/linux/if_team.h - Network team device driver header
* Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _LINUX_IF_TEAM_H_
#define _LINUX_IF_TEAM_H_
#ifdef __KERNEL__
struct team_pcpu_stats {
u64 rx_packets;
u64 rx_bytes;
u64 rx_multicast;
u64 tx_packets;
u64 tx_bytes;
struct u64_stats_sync syncp;
u32 rx_dropped;
u32 tx_dropped;
};
struct team;
struct team_port {
struct net_device *dev;
struct hlist_node hlist; /* node in hash list */
struct list_head list; /* node in ordinary list */
struct team *team;
int index;
/*
* A place for storing original values of the device before it
* become a port.
*/
struct {
unsigned char dev_addr[MAX_ADDR_LEN];
unsigned int mtu;
} orig;
bool linkup;
u32 speed;
u8 duplex;
struct rcu_head rcu;
};
struct team_mode_ops {
int (*init)(struct team *team);
void (*exit)(struct team *team);
rx_handler_result_t (*receive)(struct team *team,
struct team_port *port,
struct sk_buff *skb);
bool (*transmit)(struct team *team, struct sk_buff *skb);
int (*port_enter)(struct team *team, struct team_port *port);
void (*port_leave)(struct team *team, struct team_port *port);
void (*port_change_mac)(struct team *team, struct team_port *port);
};
enum team_option_type {
TEAM_OPTION_TYPE_U32,
TEAM_OPTION_TYPE_STRING,
};
struct team_option {
struct list_head list;
const char *name;
enum team_option_type type;
int (*getter)(struct team *team, void *arg);
int (*setter)(struct team *team, void *arg);
};
struct team_mode {
struct list_head list;
const char *kind;
struct module *owner;
size_t priv_size;
const struct team_mode_ops *ops;
};
#define TEAM_PORT_HASHBITS 4
#define TEAM_PORT_HASHENTRIES (1 << TEAM_PORT_HASHBITS)
#define TEAM_MODE_PRIV_LONGS 4
#define TEAM_MODE_PRIV_SIZE (sizeof(long) * TEAM_MODE_PRIV_LONGS)
struct team {
struct net_device *dev; /* associated netdevice */
struct team_pcpu_stats __percpu *pcpu_stats;
struct mutex lock; /* used for overall locking, e.g. port lists write */
/*
* port lists with port count
*/
int port_count;
struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES];
struct list_head port_list;
struct list_head option_list;
const struct team_mode *mode;
struct team_mode_ops ops;
long mode_priv[TEAM_MODE_PRIV_LONGS];
};
static inline struct hlist_head *team_port_index_hash(struct team *team,
int port_index)
{
return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
}
static inline struct team_port *team_get_port_by_index(struct team *team,
int port_index)
{
struct hlist_node *p;
struct team_port *port;
struct hlist_head *head = team_port_index_hash(team, port_index);
hlist_for_each_entry(port, p, head, hlist)
if (port->index == port_index)
return port;
return NULL;
}
static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
int port_index)
{
struct hlist_node *p;
struct team_port *port;
struct hlist_head *head = team_port_index_hash(team, port_index);
hlist_for_each_entry_rcu(port, p, head, hlist)
if (port->index == port_index)
return port;
return NULL;
}
extern int team_port_set_team_mac(struct team_port *port);
extern int team_options_register(struct team *team,
const struct team_option *option,
size_t option_count);
extern void team_options_unregister(struct team *team,
const struct team_option *option,
size_t option_count);
extern int team_mode_register(struct team_mode *mode);
extern int team_mode_unregister(struct team_mode *mode);
#endif /* __KERNEL__ */
#define TEAM_STRING_MAX_LEN 32
/**********************************
* NETLINK_GENERIC netlink family.
**********************************/
enum {
TEAM_CMD_NOOP,
TEAM_CMD_OPTIONS_SET,
TEAM_CMD_OPTIONS_GET,
TEAM_CMD_PORT_LIST_GET,
__TEAM_CMD_MAX,
TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
};
enum {
TEAM_ATTR_UNSPEC,
TEAM_ATTR_TEAM_IFINDEX, /* u32 */
TEAM_ATTR_LIST_OPTION, /* nest */
TEAM_ATTR_LIST_PORT, /* nest */
__TEAM_ATTR_MAX,
TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
};
/* Nested layout of get/set msg:
*
* [TEAM_ATTR_LIST_OPTION]
* [TEAM_ATTR_ITEM_OPTION]
* [TEAM_ATTR_OPTION_*], ...
* [TEAM_ATTR_ITEM_OPTION]
* [TEAM_ATTR_OPTION_*], ...
* ...
* [TEAM_ATTR_LIST_PORT]
* [TEAM_ATTR_ITEM_PORT]
* [TEAM_ATTR_PORT_*], ...
* [TEAM_ATTR_ITEM_PORT]
* [TEAM_ATTR_PORT_*], ...
* ...
*/
enum {
TEAM_ATTR_ITEM_OPTION_UNSPEC,
TEAM_ATTR_ITEM_OPTION, /* nest */
__TEAM_ATTR_ITEM_OPTION_MAX,
TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
};
enum {
TEAM_ATTR_OPTION_UNSPEC,
TEAM_ATTR_OPTION_NAME, /* string */
TEAM_ATTR_OPTION_CHANGED, /* flag */
TEAM_ATTR_OPTION_TYPE, /* u8 */
TEAM_ATTR_OPTION_DATA, /* dynamic */
__TEAM_ATTR_OPTION_MAX,
TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
};
enum {
TEAM_ATTR_ITEM_PORT_UNSPEC,
TEAM_ATTR_ITEM_PORT, /* nest */
__TEAM_ATTR_ITEM_PORT_MAX,
TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
};
enum {
TEAM_ATTR_PORT_UNSPEC,
TEAM_ATTR_PORT_IFINDEX, /* u32 */
TEAM_ATTR_PORT_CHANGED, /* flag */
TEAM_ATTR_PORT_LINKUP, /* flag */
TEAM_ATTR_PORT_SPEED, /* u32 */
TEAM_ATTR_PORT_DUPLEX, /* u8 */
__TEAM_ATTR_PORT_MAX,
TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
};
/*
* NETLINK_GENERIC related info
*/
#define TEAM_GENL_NAME "team"
#define TEAM_GENL_VERSION 0x1
#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
#endif /* _LINUX_IF_TEAM_H_ */
|
/* opcode/i386.h -- Intel 80386 opcode macros
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler, and GDB, the GNU Debugger.
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. */
/* The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
ix86 Unix assemblers, generate floating point instructions with
reversed source and destination registers in certain cases.
Unfortunately, gcc and possibly many other programs use this
reversed syntax, so we're stuck with it.
eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
`fsub %st,%st(3)' results in st(3) = st - st(3), rather than
the expected st(3) = st(3) - st
This happens with all the non-commutative arithmetic floating point
operations with two register operands, where the source register is
%st, and destination register is %st(i).
The affected opcode map is dceX, dcfX, deeX, defX. */
#ifndef SYSV386_COMPAT
/* Set non-zero for broken, compatible instructions. Set to zero for
non-broken opcodes at your peril. gcc generates SystemV/386
compatible instructions. */
#define SYSV386_COMPAT 1
#endif
#ifndef OLDGCC_COMPAT
/* Set non-zero to cater for old (<= 2.8.1) versions of gcc that could
generate nonsense fsubp, fsubrp, fdivp and fdivrp with operands
reversed. */
#define OLDGCC_COMPAT SYSV386_COMPAT
#endif
#define MOV_AX_DISP32 0xa0
#define POP_SEG_SHORT 0x07
#define JUMP_PC_RELATIVE 0xeb
#define INT_OPCODE 0xcd
#define INT3_OPCODE 0xcc
/* The opcode for the fwait instruction, which disassembler treats as a
prefix when it can. */
#define FWAIT_OPCODE 0x9b
#define ADDR_PREFIX_OPCODE 0x67
#define DATA_PREFIX_OPCODE 0x66
#define LOCK_PREFIX_OPCODE 0xf0
#define CS_PREFIX_OPCODE 0x2e
#define DS_PREFIX_OPCODE 0x3e
#define ES_PREFIX_OPCODE 0x26
#define FS_PREFIX_OPCODE 0x64
#define GS_PREFIX_OPCODE 0x65
#define SS_PREFIX_OPCODE 0x36
#define REPNE_PREFIX_OPCODE 0xf2
#define REPE_PREFIX_OPCODE 0xf3
#define TWO_BYTE_OPCODE_ESCAPE 0x0f
#define NOP_OPCODE (char) 0x90
/* register numbers */
#define EBP_REG_NUM 5
#define ESP_REG_NUM 4
/* modrm_byte.regmem for twobyte escape */
#define ESCAPE_TO_TWO_BYTE_ADDRESSING ESP_REG_NUM
/* index_base_byte.index for no index register addressing */
#define NO_INDEX_REGISTER ESP_REG_NUM
/* index_base_byte.base for no base register addressing */
#define NO_BASE_REGISTER EBP_REG_NUM
#define NO_BASE_REGISTER_16 6
/* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
#define REGMEM_FIELD_HAS_REG 0x3/* always = 0x3 */
#define REGMEM_FIELD_HAS_MEM (~REGMEM_FIELD_HAS_REG)
/* x86-64 extension prefix. */
#define REX_OPCODE 0x40
/* Indicates 64 bit operand size. */
#define REX_W 8
/* High extension to reg field of modrm byte. */
#define REX_R 4
/* High extension to SIB index field. */
#define REX_X 2
/* High extension to base field of modrm or SIB, or reg field of opcode. */
#define REX_B 1
/* max operands per insn */
#define MAX_OPERANDS 4
/* max immediates per insn (lcall, ljmp, insertq, extrq) */
#define MAX_IMMEDIATE_OPERANDS 2
/* max memory refs per insn (string ops) */
#define MAX_MEMORY_OPERANDS 2
/* max size of insn mnemonics. */
#define MAX_MNEM_SIZE 16
/* max size of register name in insn mnemonics. */
#define MAX_REG_NAME_SIZE 8
|
/* SPDX-License-Identifier: MIT */
#ifndef __NVBIOS_VPSTATE_H__
#define __NVBIOS_VPSTATE_H__
struct nvbios_vpstate_header {
u32 offset;
u8 version;
u8 hlen;
u8 ecount;
u8 elen;
u8 scount;
u8 slen;
u8 base_id;
u8 boost_id;
u8 tdp_id;
};
struct nvbios_vpstate_entry {
u8 pstate;
u16 clock_mhz;
};
int nvbios_vpstate_parse(struct nvkm_bios *, struct nvbios_vpstate_header *);
int nvbios_vpstate_entry(struct nvkm_bios *, struct nvbios_vpstate_header *,
u8 idx, struct nvbios_vpstate_entry *);
#endif
|
/*************************************************************************/
/* thread_windows.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef THREAD_WINDOWS_H
#define THREAD_WINDOWS_H
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
#ifdef WINDOWS_ENABLED
#include "os/thread.h"
#include <windows.h>
class ThreadWindows : public Thread {
ThreadCreateCallback callback;
void *user;
ID id;
HANDLE handle;
static Thread* create_thread_windows();
static DWORD WINAPI thread_callback( LPVOID userdata );
static Thread* create_func_windows(ThreadCreateCallback p_callback,void *,const Settings&);
static ID get_thread_ID_func_windows();
static void wait_to_finish_func_windows(Thread* p_thread);
ThreadWindows();
public:
virtual ID get_ID() const;
static void make_default();
~ThreadWindows();
};
#endif
#endif
|
/*
Unix SMB/CIFS implementation.
reproducer for bug 6898
Copyright (C) Volker Lendecke 2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "torture/proto.h"
#include "../libcli/security/security.h"
#include "libsmb/libsmb.h"
/*
* Make sure that GENERIC_WRITE does not trigger append. See
* https://bugzilla.samba.org/show_bug.cgi?id=6898
*/
bool run_posix_append(int dummy)
{
struct cli_state *cli;
const char *fname = "append";
NTSTATUS status;
uint16_t fnum;
off_t size;
uint8_t c = '\0';
bool ret = false;
printf("Starting POSIX_APPEND\n");
if (!torture_open_connection(&cli, 0)) {
return false;
}
status = torture_setup_unix_extensions(cli);
if (!NT_STATUS_IS_OK(status)) {
printf("torture_setup_unix_extensions failed: %s\n",
nt_errstr(status));
goto fail;
}
status = cli_ntcreate(
cli, fname, 0,
GENERIC_WRITE_ACCESS|GENERIC_READ_ACCESS|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_POSIX_SEMANTICS,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
FILE_OVERWRITE_IF,
FILE_NON_DIRECTORY_FILE|FILE_DELETE_ON_CLOSE,
0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_ntcreate failed: %s\n", nt_errstr(status));
goto fail;
}
/*
* Write two bytes at offset 0. With bug 6898 we would end up
* with a file of 2 byte length.
*/
status = cli_writeall(cli, fnum, 0, &c, 0, sizeof(c), NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_write failed: %s\n", nt_errstr(status));
goto fail;
}
status = cli_writeall(cli, fnum, 0, &c, 0, sizeof(c), NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_write failed: %s\n", nt_errstr(status));
goto fail;
}
status = cli_getattrE(cli, fnum, NULL, &size, NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_getatrE failed: %s\n", nt_errstr(status));
goto fail;
}
if (size != sizeof(c)) {
printf("BUG: Writing with O_APPEND!!\n");
goto fail;
}
ret = true;
fail:
torture_close_connection(cli);
return ret;
}
|
#ifndef __CLONE_PICTURE_H_
#define __CLONE_PICTURE_H_
#include <vector>
#include "picture.h"
namespace WelsDec {
// a picture with automatically managed storage & some analytic accessors
class LumaPicture {
public:
inline LumaPicture() : m_width(0), m_height(0), m_mb_size(0), m_b_size(0) { }
LumaPicture(const SPicture &pic);
// XXX analysis should be in a separate class
// get the unnormalized (e.g., sum of all values) at specified macroblock
int get_sum(int iMbX, int iMbY) const;
std::vector<uint16_t> get_b_sum(int iMbX, int iMbY) const;
uint8_t& at(int x, int y);
const uint8_t& at(int x, int y) const;
void set_mb_size(int newSize);
inline int width() const { return m_width; }
inline int height() const { return m_height; }
private:
// XXX generalize to support other data
std::vector<uint8_t> m_data;
int m_width;
int m_height;
int m_mb_size;
int m_b_size;
};
extern LumaPicture *gLastPicture;
}
#endif // __CLONE_PICTURE_H_ |
/* Software floating-point emulation.
Return a * b
Copyright (C) 1997,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
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 "soft-fp.h"
#include "quad.h"
long double _Q_mul(const long double a, const long double b)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
long double c;
FP_INIT_ROUNDMODE;
FP_UNPACK_Q(A, a);
FP_UNPACK_Q(B, b);
FP_MUL_Q(C, A, B);
FP_PACK_Q(c, C);
FP_HANDLE_EXCEPTIONS;
return c;
}
|
//===- LoopRotationUtils.h - Utilities to perform loop rotation -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file provides utilities to convert a loop into a loop with bottom test.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
#define LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
namespace llvm {
class AssumptionCache;
class DominatorTree;
class Loop;
class LoopInfo;
class MemorySSAUpdater;
class ScalarEvolution;
struct SimplifyQuery;
class TargetTransformInfo;
/// Convert a loop into a loop with bottom test. It may
/// perform loop latch simplication as well if the flag RotationOnly
/// is false. The flag Threshold represents the size threshold of the loop
/// header. If the loop header's size exceeds the threshold, the loop rotation
/// will give up. The flag IsUtilMode controls the heuristic used in the
/// LoopRotation. If it is true, the profitability heuristic will be ignored.
bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI,
AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE,
MemorySSAUpdater *MSSAU, const SimplifyQuery &SQ,
bool RotationOnly, unsigned Threshold, bool IsUtilMode);
} // namespace llvm
#endif
|
static void main(void)
{
unsigned min;
int value, latency;
latency = -2;
if (latency > (((min) >> 8) & 0xff)) {
value = 0xa;
}
if (value < 0) return;
((min) = (((min) & ~0xff)));
}
|
// Copyright (c) 2003
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); 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.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Michael Hoffmann <hoffmann@inf.ethz.ch>
// Lutz Kettner <kettner@mpi-sb.mpg.de>
// Sylvain Pion
// This file is obsolete; use <CGAL/iterator.h> instead.
#include <CGAL/iterator.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_VIEWS_STATUS_BUBBLE_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "chrome/browser/ui/status_bubble.h"
#include "ui/gfx/rect.h"
#include "url/gurl.h"
namespace gfx {
class Point;
}
namespace views {
class View;
class Widget;
}
// StatusBubble displays a bubble of text that fades in, hovers over the
// browser chrome and fades away when not needed. It is primarily designed
// to allow users to see where hovered links point to.
class StatusBubbleViews : public StatusBubble {
public:
// How wide the bubble's shadow is.
static const int kShadowThickness;
// The combined vertical padding above and below the text.
static const int kTotalVerticalPadding = 7;
// |base_view| is the view that this bubble is positioned relative to.
explicit StatusBubbleViews(views::View* base_view);
virtual ~StatusBubbleViews();
views::View* base_view() { return base_view_; }
// Reposition the bubble's popup - as we are using a WS_POPUP for the bubble,
// we have to manually position it when the browser window moves.
void RepositionPopup();
// The bubble only has a preferred height: the sum of the height of
// the font and kTotalVerticalPadding.
gfx::Size GetPreferredSize();
// Calculate and set new position for status bubble.
void Reposition();
// Set bubble to new width.
void SetBubbleWidth(int width);
// Overridden from StatusBubble:
virtual void SetStatus(const base::string16& status) OVERRIDE;
virtual void SetURL(const GURL& url, const std::string& languages) OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void MouseMoved(const gfx::Point& location,
bool left_content) OVERRIDE;
virtual void UpdateDownloadShelfVisibility(bool visible) OVERRIDE;
views::Widget* GetPopupForTest() { return popup(); }
protected:
views::Widget* popup() { return popup_.get(); }
private:
class StatusView;
class StatusViewAnimation;
class StatusViewExpander;
// Initializes the popup and view.
void Init();
// Attempt to move the status bubble out of the way of the cursor, allowing
// users to see links in the region normally occupied by the status bubble.
void AvoidMouse(const gfx::Point& location);
// Returns true if the base_view_'s widget is visible and not minimized.
bool IsFrameVisible();
// Returns true if the base_view_'s widget is maximized.
bool IsFrameMaximized();
// Expand bubble size to accommodate a long URL.
void ExpandBubble();
// Cancel all waiting expansion animations in the timer.
void CancelExpandTimer();
// Get the standard width for a status bubble in the current frame size.
int GetStandardStatusBubbleWidth();
// Get the maximum possible width for a status bubble in the current frame
// size.
int GetMaxStatusBubbleWidth();
// Set the bounds of the bubble relative to |base_view_|.
void SetBounds(int x, int y, int w, int h);
// The status text we want to display when there are no URLs to display.
base::string16 status_text_;
// The url we want to display when there is no status text to display.
base::string16 url_text_;
// The original, non-elided URL.
GURL url_;
// Used to elide the original URL again when we expand it.
std::string languages_;
// Position relative to the base_view_.
gfx::Point original_position_;
// original_position_ adjusted according to the current RTL.
gfx::Point position_;
gfx::Size size_;
// Last location passed to MouseMoved().
gfx::Point last_mouse_moved_location_;
// Whether the view contains the mouse.
bool contains_mouse_;
// How vertically offset the bubble is from its root position_.
int offset_;
// We use a HWND for the popup so that it may float above any HWNDs in our
// UI (the location bar, for example).
scoped_ptr<views::Widget> popup_;
views::View* base_view_;
StatusView* view_;
// Manages the expansion of a status bubble to fit a long URL.
scoped_ptr<StatusViewExpander> expand_view_;
// If the download shelf is visible, do not obscure it.
bool download_shelf_is_visible_;
// If the bubble has already been expanded, and encounters a new URL,
// change size immediately, with no hover.
bool is_expanded_;
// Times expansion of status bubble when URL is too long for standard width.
base::WeakPtrFactory<StatusBubbleViews> expand_timer_factory_;
DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews);
};
#endif // CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_
|
/*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "nv04.h"
struct nvkm_oclass *
gk20a_mc_oclass = &(struct nvkm_mc_oclass) {
.base.handle = NV_SUBDEV(MC, 0xea),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv04_mc_ctor,
.dtor = _nvkm_mc_dtor,
.init = nv50_mc_init,
.fini = _nvkm_mc_fini,
},
.intr = gf100_mc_intr,
.msi_rearm = nv40_mc_msi_rearm,
}.base;
|
#include "tst-rxspencer.c"
|
/* Note that struct foo is opaque (never defined) in this file. This
is allowed by C since this file does not reference any members of
the structure. The debugger needs to be able to associate this
opaque structure definition with the full definition in another
file.
*/
struct foo *foop;
extern struct foo *getfoo ();
#ifdef PROTOTYPES
extern void putfoo (struct foo *foop);
#endif
int main ()
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
foop = getfoo ();
putfoo (foop);
return 0;
}
|
/* spell.c -- spelling correction for pathnames. */
/* Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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 Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include <bashtypes.h>
#include <posixdir.h>
#include <posixstat.h>
#ifndef _MINIX
#include <sys/param.h>
#endif
#include <stdio.h>
#include <bashansi.h>
#include <maxpath.h>
#include <stdc.h>
static int mindist __P((char *, char *, char *));
static int spdist __P((char *, char *));
/*
* `spname' and its helpers are inspired by the code in "The UNIX
* Programming Environment", Kernighan & Pike, Prentice-Hall 1984,
* pages 209 - 213.
*/
/*
* `spname' -- return a correctly spelled filename
*
* int spname(char * oldname, char * newname)
* Returns: -1 if no reasonable match found
* 0 if exact match found
* 1 if corrected
* Stores corrected name in `newname'.
*/
int
spname(oldname, newname)
char *oldname;
char *newname;
{
char *op, *np, *p;
char guess[PATH_MAX + 1], best[PATH_MAX + 1];
op = oldname;
np = newname;
for (;;)
{
while (*op == '/') /* Skip slashes */
*np++ = *op++;
*np = '\0';
if (*op == '\0') /* Exact or corrected */
{
/* `.' is rarely the right thing. */
if (oldname[1] == '\0' && newname[1] == '\0' &&
oldname[0] != '.' && newname[0] == '.')
return -1;
return strcmp(oldname, newname) != 0;
}
/* Copy next component into guess */
for (p = guess; *op != '/' && *op != '\0'; op++)
if (p < guess + PATH_MAX)
*p++ = *op;
*p = '\0';
if (mindist(newname, guess, best) >= 3)
return -1; /* Hopeless */
/*
* Add to end of newname
*/
for (p = best; *np = *p++; np++)
;
}
}
/*
* Search directory for a guess
*/
static int
mindist(dir, guess, best)
char *dir;
char *guess;
char *best;
{
DIR *fd;
struct dirent *dp;
int dist, x;
dist = 3; /* Worst distance */
if (*dir == '\0')
dir = ".";
if ((fd = opendir(dir)) == NULL)
return dist;
while ((dp = readdir(fd)) != NULL)
{
/*
* Look for a better guess. If the new guess is as
* good as the current one, we take it. This way,
* any single character match will be a better match
* than ".".
*/
x = spdist(dp->d_name, guess);
if (x <= dist && x != 3)
{
strcpy(best, dp->d_name);
dist = x;
if (dist == 0) /* Exact match */
break;
}
}
(void)closedir(fd);
/* Don't return `.' */
if (best[0] == '.' && best[1] == '\0')
dist = 3;
return dist;
}
/*
* `spdist' -- return the "distance" between two names.
*
* int spname(char * oldname, char * newname)
* Returns: 0 if strings are identical
* 1 if two characters are transposed
* 2 if one character is wrong, added or deleted
* 3 otherwise
*/
static int
spdist(cur, new)
char *cur, *new;
{
while (*cur == *new)
{
if (*cur == '\0')
return 0; /* Exact match */
cur++;
new++;
}
if (*cur)
{
if (*new)
{
if (cur[1] && new[1] && cur[0] == new[1] && cur[1] == new[0] && strcmp (cur + 2, new + 2) == 0)
return 1; /* Transposition */
if (strcmp (cur + 1, new + 1) == 0)
return 2; /* One character mismatch */
}
if (strcmp(&cur[1], &new[0]) == 0)
return 2; /* Extra character */
}
if (*new && strcmp(cur, new + 1) == 0)
return 2; /* Missing character */
return 3;
}
char *
dirspell (dirname)
char *dirname;
{
int n;
char *guess;
n = (strlen (dirname) * 3 + 1) / 2 + 1;
guess = (char *)malloc (n);
if (guess == 0)
return 0;
switch (spname (dirname, guess))
{
case -1:
default:
free (guess);
return (char *)NULL;
case 0:
case 1:
return guess;
}
}
|
/*
* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
#define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
int my_skb_head_push(struct sk_buff *skb, unsigned int len);
void interface_rx(struct net_device *soft_iface,
struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size);
struct net_device *softif_create(const char *name);
void softif_destroy(struct net_device *soft_iface);
int softif_is_valid(const struct net_device *net_dev);
#endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.