text stringlengths 4 6.14k |
|---|
/*
* Only give sleepers 50% of their service deficit. This allows
* them to run sooner, but does not allow tons of sleepers to
* rip the spread apart.
*/
SCHED_FEAT(GENTLE_FAIR_SLEEPERS, true)
/*
* Place new tasks ahead so that they do not starve already running
* tasks
*/
SCHED_FEAT(START_DEBIT, true)
/*
* Prefer to schedule the task we woke last (assuming it failed
* wakeup-preemption), since its likely going to consume data we
* touched, increases cache locality.
*/
SCHED_FEAT(NEXT_BUDDY, false)
/*
* Prefer to schedule the task that ran last (when we did
* wake-preempt) as that likely will touch the same data, increases
* cache locality.
*/
SCHED_FEAT(LAST_BUDDY, true)
/*
* Consider buddies to be cache hot, decreases the likelyness of a
* cache buddy being migrated away, increases cache locality.
*/
SCHED_FEAT(CACHE_HOT_BUDDY, true)
/*
* Allow wakeup-time preemption of the current task:
*/
SCHED_FEAT(WAKEUP_PREEMPTION, true)
/*
* Use arch dependent cpu capacity functions
*/
SCHED_FEAT(ARCH_CAPACITY, true)
SCHED_FEAT(HRTICK, false)
SCHED_FEAT(DOUBLE_TICK, false)
SCHED_FEAT(LB_BIAS, true)
/*
* Decrement CPU capacity based on time not spent running tasks
*/
SCHED_FEAT(NONTASK_CAPACITY, true)
#ifdef CONFIG_PREEMPT_RT_FULL
SCHED_FEAT(TTWU_QUEUE, false)
# ifdef CONFIG_PREEMPT_LAZY
SCHED_FEAT(PREEMPT_LAZY, true)
# endif
#else
/*
* Queue remote wakeups on the target CPU and process them
* using the scheduler IPI. Reduces rq->lock contention/bounces.
*/
SCHED_FEAT(TTWU_QUEUE, true)
#endif
SCHED_FEAT(FORCE_SD_OVERLAP, false)
SCHED_FEAT(RT_RUNTIME_SHARE, true)
SCHED_FEAT(LB_MIN, false)
/*
* Apply the automatic NUMA scheduling policy. Enabled automatically
* at runtime if running on a NUMA machine. Can be controlled via
* numa_balancing=
*/
#ifdef CONFIG_NUMA_BALANCING
SCHED_FEAT(NUMA, false)
/*
* NUMA_FAVOUR_HIGHER will favor moving tasks towards nodes where a
* higher number of hinting faults are recorded during active load
* balancing.
*/
SCHED_FEAT(NUMA_FAVOUR_HIGHER, true)
/*
* NUMA_RESIST_LOWER will resist moving tasks towards nodes where a
* lower number of hinting faults have been recorded. As this has
* the potential to prevent a task ever migrating to a new node
* due to CPU overload it is disabled by default.
*/
SCHED_FEAT(NUMA_RESIST_LOWER, false)
#endif
|
#define CONFIG_SEQ 1
|
/**********************************************************************
Audacity: A Digital Audio Editor
RawAudioGuess.h
Dominic Mazzoni
Attempts to determine the format of an audio file that doesn't
have any header information. Returns the format as a
libsndfile-compatible format, along with the guessed number of
channels and the byte-offset.
**********************************************************************/
#include <wx/defs.h>
#include <sndfile.h>
#ifndef SNDFILE_1
#error Requires libsndfile 1.0.3 or higher
#endif
/* Returns the best guess as to the format, as a libsndfile
SF_FORMAT value
*/
int RawAudioGuess(const wxString &in_fname,
unsigned *out_offset, unsigned *out_channels);
|
/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#include <stdbool.h>
#include <stdint.h>
#include "twi_master.h"
#include "synaptics_touchpad.h"
/*lint ++flb "Enter library region" */
#define PRODUCT_ID_BYTES 10U //!< Number of bytes to expect to be in product ID
static uint8_t m_device_address; // !< Device address in bits [7:1]
static const uint8_t expected_product_id[PRODUCT_ID_BYTES] = {'T', 'M', '1', '9', '4', '4', '-', '0', '0', '2'}; //!< Product ID expected to get from product ID query
bool touchpad_init(uint8_t device_address)
{
bool transfer_succeeded = true;
m_device_address = (uint8_t)(device_address << 1);
// Do a soft reset
uint8_t reset_command = 0x01;
transfer_succeeded &= touchpad_write_register(TOUCHPAD_RESET, reset_command);
// Page select 0
uint8_t page_to_select = 0x00;
transfer_succeeded &= touchpad_write_register(TOUCHPAD_PAGESELECT, page_to_select);
// Read and verify product ID
transfer_succeeded &= touchpad_product_id_verify();
return transfer_succeeded;
}
bool touchpad_product_id_verify(void)
{
bool transfer_succeeded = true;
uint8_t product_id[PRODUCT_ID_BYTES];
transfer_succeeded &= touchpad_product_id_read(product_id, PRODUCT_ID_BYTES);
for (uint8_t i = 0; i < 10; i++)
{
if (product_id[i] != expected_product_id[i])
{
transfer_succeeded = false;
}
}
return transfer_succeeded;
}
bool touchpad_reset(void)
{
uint8_t w2_data[2] = {TOUCHPAD_COMMAND, 0x01};
return twi_master_transfer(m_device_address, w2_data, 2, TWI_ISSUE_STOP);
}
bool touchpad_interrupt_status_read(uint8_t *interrupt_status)
{
return touchpad_read_register(TOUCHPAD_INT_STATUS, interrupt_status);
}
bool touchpad_set_sleep_mode(TouchpadSleepMode_t mode)
{
return touchpad_write_register(TOUCHPAD_CONTROL, (uint8_t)mode);
}
bool touchpad_read_register(uint8_t register_address, uint8_t *value)
{
bool transfer_succeeded = true;
transfer_succeeded &= twi_master_transfer(m_device_address, ®ister_address, 1, TWI_DONT_ISSUE_STOP);
if (transfer_succeeded)
{
transfer_succeeded &= twi_master_transfer(m_device_address | TWI_READ_BIT, value, 1, TWI_ISSUE_STOP);
}
return transfer_succeeded;
}
bool touchpad_write_register(uint8_t register_address, const uint8_t value)
{
uint8_t w2_data[2];
w2_data[0] = register_address;
w2_data[1] = value;
return twi_master_transfer(m_device_address, w2_data, 2, TWI_ISSUE_STOP);
}
bool touchpad_product_id_read(uint8_t * product_id, uint8_t product_id_bytes)
{
uint8_t w2_data[1];
bool transfer_succeeded = true;
w2_data[0] = TOUCHPAD_PRODUCT_ID;
transfer_succeeded &= twi_master_transfer(m_device_address, w2_data, 1, TWI_DONT_ISSUE_STOP);
if (transfer_succeeded)
{
transfer_succeeded &= twi_master_transfer(m_device_address | TWI_READ_BIT, product_id, product_id_bytes, TWI_ISSUE_STOP);
}
return transfer_succeeded;
}
/*lint --flb "Leave library region" */
|
/* Copyright 2013 Google Inc. 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.
*/
#import "PacoScheduleGenerator.h"
@interface PacoScheduleGenerator (Daily)
+ (NSArray*)nextDatesForDailyExperiment:(PacoExperiment*)experiment
numOfDates:(int)numOfDates
fromDate:(NSDate*)fromDate;
@end
|
// Copyright 2014-present Facebook, Inc.
#import <Foundation/Foundation.h>
NS_INLINE void FunctionFromPathsLibrary() {}
|
// 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.
// Because the unit tests for gfx::Image are spread across multiple
// implementation files, this header contains the reusable components.
#ifndef UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
#define UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
#include "ui/gfx/image/image.h"
namespace gfx {
namespace test {
#if defined(OS_MACOSX)
typedef NSImage* PlatformImage;
#elif defined(TOOLKIT_GTK)
typedef GdkPixbuf* PlatformImage;
#else
typedef const SkBitmap* PlatformImage;
#endif
SkBitmap* CreateBitmap(int width, int height);
gfx::Image CreateImage();
bool IsEqual(const gfx::Image& image1, const gfx::Image& image2);
bool IsEmpty(const gfx::Image& image);
PlatformImage CreatePlatformImage();
gfx::Image::RepresentationType GetPlatformRepresentationType();
PlatformImage ToPlatformType(const gfx::Image& image);
} // namespace test
} // namespace gfx
#endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_DISPATCHER_H_
#define COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_DISPATCHER_H_
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/render_process_observer.h"
#include "ipc/ipc_message.h"
namespace guest_view {
// Dispatcher used to route messages to GuestViewContainer.
class GuestViewContainerDispatcher : public content::RenderProcessObserver {
public:
GuestViewContainerDispatcher();
~GuestViewContainerDispatcher() override;
protected:
// Returns true if |message| is handled for a GuestViewContainer.
virtual bool HandlesMessage(const IPC::Message& message);
private:
// content::RenderProcessObserver implementation.
bool OnControlMessageReceived(const IPC::Message& message) override;
DISALLOW_COPY_AND_ASSIGN(GuestViewContainerDispatcher);
};
} // namespace guest_view
#endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_DISPATCHER_H_
|
/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "py-event.h"
#include "infrun.h"
/* thread events can either be thread specific or process wide. If gdb is
running in non-stop mode then the event is thread specific, otherwise
it is process wide.
This function returns the currently stopped thread in non-stop mode and
Py_None otherwise. In each case it returns a borrowed reference. */
static PyObject *get_event_thread (void)
CPYCHECKER_RETURNS_BORROWED_REF;
static PyObject *
get_event_thread (void)
{
PyObject *thread = NULL;
if (non_stop)
thread = (PyObject *) find_thread_object (inferior_ptid);
else
thread = Py_None;
if (!thread)
{
PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
return NULL;
}
return thread;
}
PyObject *
create_thread_event_object (PyTypeObject *py_type)
{
PyObject *thread = NULL;
PyObject *thread_event_obj = NULL;
thread_event_obj = create_event_object (py_type);
if (!thread_event_obj)
goto fail;
thread = get_event_thread ();
if (!thread)
goto fail;
if (evpy_add_attribute (thread_event_obj,
"inferior_thread",
thread) < 0)
goto fail;
return thread_event_obj;
fail:
Py_XDECREF (thread_event_obj);
return NULL;
}
GDBPY_NEW_EVENT_TYPE (thread,
"gdb.ThreadEvent",
"ThreadEvent",
"GDB thread event object",
event_object_type,
/*no qual*/);
|
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
#include <unistd.h>
#include <rte_common.h>
#include <rte_byteorder.h>
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_random.h>
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
#include <rte_tcp.h>
#include <rte_lpm.h>
#include "main.h"
int
main(int argc, char **argv)
{
uint32_t lcore;
int ret;
/* Init EAL */
ret = rte_eal_init(argc, argv);
if (ret < 0)
return -1;
argc -= ret;
argv += ret;
/* Parse application arguments (after the EAL ones) */
ret = app_parse_args(argc, argv);
if (ret < 0) {
app_print_usage();
return -1;
}
/* Init */
app_init();
app_print_params();
/* Launch per-lcore init on every lcore */
rte_eal_mp_remote_launch(app_lcore_main_loop, NULL, CALL_MASTER);
RTE_LCORE_FOREACH_SLAVE(lcore) {
if (rte_eal_wait_lcore(lcore) < 0) {
return -1;
}
}
return 0;
}
|
/*
* 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_AEC3_CLOCKDRIFT_DETECTOR_H_
#define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
#include <stddef.h>
#include <array>
namespace webrtc {
class ApmDataDumper;
struct DownsampledRenderBuffer;
struct EchoCanceller3Config;
// Detects clockdrift by analyzing the estimated delay.
class ClockdriftDetector {
public:
enum class Level { kNone, kProbable, kVerified, kNumCategories };
ClockdriftDetector();
~ClockdriftDetector();
void Update(int delay_estimate);
Level ClockdriftLevel() const { return level_; }
private:
std::array<int, 3> delay_history_;
Level level_;
size_t stability_counter_;
};
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
|
#ifndef _ASM_HW_IRQ_H
#define _ASM_HW_IRQ_H
#include <xen/config.h>
#include <xen/device_tree.h>
#define NR_VECTORS 256 /* XXX */
typedef struct {
DECLARE_BITMAP(_bits,NR_VECTORS);
} vmask_t;
struct arch_pirq
{
};
struct irq_cfg {
#define arch_irq_desc irq_cfg
int eoi_cpu;
};
#define NR_LOCAL_IRQS 32
#define NR_IRQS 1024
#define nr_irqs NR_IRQS
#define nr_irqs NR_IRQS
#define nr_static_irqs NR_IRQS
struct irq_desc;
struct irqaction;
struct irq_desc *__irq_to_desc(int irq);
#define irq_to_desc(irq) __irq_to_desc(irq)
void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
#define domain_pirq_to_irq(d, pirq) (pirq)
void init_IRQ(void);
void init_secondary_IRQ(void);
int __init request_dt_irq(const struct dt_irq *irq,
void (*handler)(int, void *, struct cpu_user_regs *),
unsigned long irqflags, const char *devname,
void *dev_id);
int __init setup_dt_irq(const struct dt_irq *irq, struct irqaction *new);
#endif /* _ASM_HW_IRQ_H */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|
/**********************************************************************
* $Id: IntervalSize.h 2556 2009-06-06 22:22:28Z strk $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: index/quadtree/IntervalSize.java rev 1.7 (JTS-1.10)
*
**********************************************************************/
#ifndef GEOS_IDX_QUADTREE_INTERVALSIZE_H
#define GEOS_IDX_QUADTREE_INTERVALSIZE_H
#include <geos/export.h>
namespace geos {
namespace index { // geos::index
namespace quadtree { // geos::index::quadtree
/**
* \class IntervalSize indexQuadtree.h geos/indexQuadtree.h
*
* \brief
* Provides a test for whether an interval is
* so small it should be considered as zero for the purposes of
* inserting it into a binary tree.
*
* The reason this check is necessary is that round-off error can
* cause the algorithm used to subdivide an interval to fail, by
* computing a midpoint value which does not lie strictly between the
* endpoints.
*/
class GEOS_DLL IntervalSize {
public:
/**
* This value is chosen to be a few powers of 2 less than the
* number of bits available in the double representation (i.e. 53).
* This should allow enough extra precision for simple computations
* to be correct, at least for comparison purposes.
*/
static const int MIN_BINARY_EXPONENT = -50;
/**
* Computes whether the interval [min, max] is effectively zero width.
* I.e. the width of the interval is so much less than the
* location of the interval that the midpoint of the interval
* cannot be represented precisely.
*/
static bool isZeroWidth(double min, double max);
};
} // namespace geos::index::quadtree
} // namespace geos::index
} // namespace geos
#endif // GEOS_IDX_QUADTREE_INTERVALSIZE_H
/**********************************************************************
* $Log$
* Revision 1.1 2006/03/22 12:22:50 strk
* indexQuadtree.h split
*
**********************************************************************/
|
/*
* realpath.c -- canonicalize pathname by removing symlinks
* Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library 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 Library Public License for more details.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <limits.h> /* for PATH_MAX */
#include <sys/param.h> /* for MAXPATHLEN */
#include <errno.h>
#include <sys/stat.h> /* for S_IFLNK */
#ifndef PATH_MAX
#ifdef _POSIX_VERSION
#define PATH_MAX _POSIX_PATH_MAX
#else
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
#endif
#endif
#endif
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
#define MAX_READLINKS 32
#ifdef __STDC__
char *realpath(const char *path, char resolved_path[])
#else
char *realpath(path, resolved_path)
const char *path;
char resolved_path[];
#endif
{
char copy_path[PATH_MAX];
char link_path[PATH_MAX];
char got_path[PATH_MAX];
char *new_path = got_path;
char *max_path;
int readlinks = 0;
int n;
/* Make a copy of the source path since we may need to modify it. */
if (strlen(path) >= PATH_MAX - 2) {
__set_errno(ENAMETOOLONG);
return NULL;
}
strcpy(copy_path, path);
path = copy_path;
max_path = copy_path + PATH_MAX - 2;
/* If it's a relative pathname use getwd for starters. */
if (*path != '/') {
/* Ohoo... */
#define HAVE_GETCWD
#ifdef HAVE_GETCWD
getcwd(new_path, PATH_MAX - 1);
#else
getwd(new_path);
#endif
new_path += strlen(new_path);
if (new_path[-1] != '/')
*new_path++ = '/';
} else {
*new_path++ = '/';
path++;
}
/* Expand each slash-separated pathname component. */
while (*path != '\0') {
/* Ignore stray "/". */
if (*path == '/') {
path++;
continue;
}
if (*path == '.') {
/* Ignore ".". */
if (path[1] == '\0' || path[1] == '/') {
path++;
continue;
}
if (path[1] == '.') {
if (path[2] == '\0' || path[2] == '/') {
path += 2;
/* Ignore ".." at root. */
if (new_path == got_path + 1)
continue;
/* Handle ".." by backing up. */
while ((--new_path)[-1] != '/');
continue;
}
}
}
/* Safely copy the next pathname component. */
while (*path != '\0' && *path != '/') {
if (path > max_path) {
__set_errno(ENAMETOOLONG);
return NULL;
}
*new_path++ = *path++;
}
#ifdef S_IFLNK
/* Protect against infinite loops. */
if (readlinks++ > MAX_READLINKS) {
__set_errno(ELOOP);
return NULL;
}
/* See if latest pathname component is a symlink. */
*new_path = '\0';
n = readlink(got_path, link_path, PATH_MAX - 1);
if (n < 0) {
/* EINVAL means the file exists but isn't a symlink. */
if (errno != EINVAL) {
/* Make sure it's null terminated. */
*new_path = '\0';
strcpy(resolved_path, got_path);
return NULL;
}
} else {
/* Note: readlink doesn't add the null byte. */
link_path[n] = '\0';
if (*link_path == '/')
/* Start over for an absolute symlink. */
new_path = got_path;
else
/* Otherwise back up over this component. */
while (*(--new_path) != '/');
/* Safe sex check. */
if (strlen(path) + n >= PATH_MAX - 2) {
__set_errno(ENAMETOOLONG);
return NULL;
}
/* Insert symlink contents into path. */
strcat(link_path, path);
strcpy(copy_path, link_path);
path = copy_path;
}
#endif /* S_IFLNK */
*new_path++ = '/';
}
/* Delete trailing slash but don't whomp a lone slash. */
if (new_path != got_path + 1 && new_path[-1] == '/')
new_path--;
/* Make sure it's null terminated. */
*new_path = '\0';
strcpy(resolved_path, got_path);
return resolved_path;
}
|
/*
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file hal_gpt_lld.h
* @brief PLATFORM GPT subsystem low level driver header.
*
* @addtogroup GPT
* @{
*/
#ifndef HAL_GPT_LLD_H
#define HAL_GPT_LLD_H
#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @name PLATFORM configuration options
* @{
*/
/**
* @brief GPTD1 driver enable switch.
* @details If set to @p TRUE the support for GPTD1 is included.
* @note The default is @p FALSE.
*/
#if !defined(PLATFORM_GPT_USE_GPT1) || defined(__DOXYGEN__)
#define PLATFORM_GPT_USE_GPT1 FALSE
#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief GPT frequency type.
*/
typedef uint32_t gptfreq_t;
/**
* @brief GPT counter type.
*/
typedef uint16_t gptcnt_t;
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
typedef struct {
/**
* @brief Timer clock in Hz.
* @note The low level can use assertions in order to catch invalid
* frequency specifications.
*/
gptfreq_t frequency;
/**
* @brief Timer callback pointer.
* @note This callback is invoked on GPT counter events.
*/
gptcallback_t callback;
/* End of the mandatory fields.*/
} GPTConfig;
/**
* @brief Structure representing a GPT driver.
*/
struct GPTDriver {
/**
* @brief Driver state.
*/
gptstate_t state;
/**
* @brief Current configuration data.
*/
const GPTConfig *config;
#if defined(GPT_DRIVER_EXT_FIELDS)
GPT_DRIVER_EXT_FIELDS
#endif
/* End of the mandatory fields.*/
};
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Changes the interval of GPT peripheral.
* @details This function changes the interval of a running GPT unit.
* @pre The GPT unit must have been activated using @p gptStart().
* @pre The GPT unit must have been running in continuous mode using
* @p gptStartContinuous().
* @post The GPT unit interval is changed to the new value.
* @note The function has effect at the next cycle start.
*
* @param[in] gptp pointer to a @p GPTDriver object
* @param[in] interval new cycle time in timer ticks
* @notapi
*/
#define gpt_lld_change_interval(gptp, interval) { \
(void)gptp; \
(void)interval; \
}
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if (PLATFORM_GPT_USE_GPT1 == TRUE) && !defined(__DOXYGEN__)
extern GPTDriver GPTD1;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void gpt_lld_init(void);
void gpt_lld_start(GPTDriver *gptp);
void gpt_lld_stop(GPTDriver *gptp);
void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval);
void gpt_lld_stop_timer(GPTDriver *gptp);
void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_GPT == TRUE */
#endif /* HAL_GPT_LLD_H */
/** @} */
|
/* Check the access rights of a file relative to an open directory.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Eric Blake */
/* If the user's config.h happens to include <unistd.h>, let it include only
the system's <unistd.h> here, so that orig_faccessat doesn't recurse to
rpl_faccessat. */
#define _GL_INCLUDING_UNISTD_H
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#undef _GL_INCLUDING_UNISTD_H
#if HAVE_FACCESSAT
static int
orig_faccessat (int fd, char const *name, int mode, int flag)
{
return faccessat (fd, name, mode, flag);
}
#endif
/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <unistd.h>
above. */
#include "unistd.h"
#ifndef HAVE_ACCESS
/* Mingw lacks access, but it also lacks real vs. effective ids, so
the gnulib euidaccess module is good enough. */
# undef access
# define access euidaccess
#endif
#if HAVE_FACCESSAT
int
rpl_faccessat (int fd, char const *file, int mode, int flag)
{
int result = orig_faccessat (fd, file, mode, flag);
if (result == 0 && file[strlen (file) - 1] == '/')
{
struct stat st;
result = fstatat (fd, file, &st, 0);
if (result == 0 && !S_ISDIR (st.st_mode))
{
errno = ENOTDIR;
return -1;
}
}
return result;
}
#else /* !HAVE_FACCESSAT */
/* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory
open on descriptor FD. If possible, do it without changing the
working directory. Otherwise, resort to using save_cwd/fchdir, then
(access|euidaccess)/restore_cwd. If either the save_cwd or the
restore_cwd fails, then give a diagnostic and exit nonzero.
Note that this implementation only supports AT_EACCESS, although some
native versions also support AT_SYMLINK_NOFOLLOW. */
# define AT_FUNC_NAME faccessat
# define AT_FUNC_F1 euidaccess
# define AT_FUNC_F2 access
# define AT_FUNC_USE_F1_COND AT_EACCESS
# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
# define AT_FUNC_POST_FILE_ARGS , mode
# include "at-func.c"
#endif
|
/** @defgroup usb_private_defines USB Private Structures
@brief <b>Defined Constants and Types for the USB Private Structures</b>
@ingroup USB_defines
@version 1.0.0
@author @htmlonly © @endhtmlonly 2010
Gareth McMullin <gareth@blacksphere.co.nz>
@date 10 March 2013
LGPL License Terms @ref lgpl_license
*/
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
*
* 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 3 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 __USB_PRIVATE_H
#define __USB_PRIVATE_H
#define MAX_USER_CONTROL_CALLBACK 4
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/** Internal collection of device information. */
struct _usbd_device {
const struct usb_device_descriptor *desc;
const struct usb_config_descriptor *config;
const char **strings;
int num_strings;
uint8_t *ctrl_buf; /**< Internal buffer used for control transfers */
uint16_t ctrl_buf_len;
uint8_t current_address;
uint8_t current_config;
uint16_t pm_top; /**< Top of allocated endpoint buffer memory */
/* User callback functions for various USB events */
void (*user_callback_reset)(void);
void (*user_callback_suspend)(void);
void (*user_callback_resume)(void);
void (*user_callback_sof)(void);
struct usb_control_state {
enum {
IDLE, STALLED,
DATA_IN, LAST_DATA_IN, STATUS_IN,
DATA_OUT, LAST_DATA_OUT, STATUS_OUT,
} state;
struct usb_setup_data req __attribute__((aligned(4)));
uint8_t *ctrl_buf;
uint16_t ctrl_len;
void (*complete)(usbd_device *usbd_dev,
struct usb_setup_data *req);
} control_state;
struct user_control_callback {
usbd_control_callback cb;
uint8_t type;
uint8_t type_mask;
} user_control_callback[MAX_USER_CONTROL_CALLBACK];
void (*user_callback_ctr[8][3])(usbd_device *usbd_dev, uint8_t ea);
/* User callback function for some standard USB function hooks */
void (*user_callback_set_config)(usbd_device *usbd_dev,
uint16_t wValue);
const struct _usbd_driver *driver;
/* private driver data */
uint16_t fifo_mem_top;
uint16_t fifo_mem_top_ep0;
uint8_t force_nak[4];
/*
* We keep a backup copy of the out endpoint size registers to restore
* them after a transaction.
*/
uint32_t doeptsiz[4];
/*
* Received packet size for each endpoint. This is assigned in
* stm32f107_poll() which reads the packet status push register GRXSTSP
* for use in stm32f107_ep_read_packet().
*/
uint16_t rxbcnt;
};
enum _usbd_transaction {
USB_TRANSACTION_IN,
USB_TRANSACTION_OUT,
USB_TRANSACTION_SETUP,
};
/* Do not appear to belong to the API, so are omitted from docs */
/**@}*/
void _usbd_control_in(usbd_device *usbd_dev, uint8_t ea);
void _usbd_control_out(usbd_device *usbd_dev, uint8_t ea);
void _usbd_control_setup(usbd_device *usbd_dev, uint8_t ea);
int _usbd_standard_request_device(usbd_device *usbd_dev,
struct usb_setup_data *req, uint8_t **buf,
uint16_t *len);
int _usbd_standard_request_interface(usbd_device *usbd_dev,
struct usb_setup_data *req, uint8_t **buf,
uint16_t *len);
int _usbd_standard_request_endpoint(usbd_device *usbd_dev,
struct usb_setup_data *req, uint8_t **buf,
uint16_t *len);
int _usbd_standard_request(usbd_device *usbd_dev, struct usb_setup_data *req,
uint8_t **buf, uint16_t *len);
void _usbd_reset(usbd_device *usbd_dev);
/* Functions provided by the hardware abstraction. */
struct _usbd_driver {
usbd_device *(*init)(void);
void (*set_address)(usbd_device *usbd_dev, uint8_t addr);
void (*ep_setup)(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
uint16_t max_size,
void (*cb)(usbd_device *usbd_dev, uint8_t ep));
void (*ep_reset)(usbd_device *usbd_dev);
void (*ep_stall_set)(usbd_device *usbd_dev, uint8_t addr,
uint8_t stall);
void (*ep_nak_set)(usbd_device *usbd_dev, uint8_t addr, uint8_t nak);
uint8_t (*ep_stall_get)(usbd_device *usbd_dev, uint8_t addr);
uint16_t (*ep_write_packet)(usbd_device *usbd_dev, uint8_t addr,
const void *buf, uint16_t len);
uint16_t (*ep_read_packet)(usbd_device *usbd_dev, uint8_t addr,
void *buf, uint16_t len);
void (*poll)(usbd_device *usbd_dev);
void (*disconnect)(usbd_device *usbd_dev, bool disconnected);
uint32_t base_address;
bool set_address_before_status;
uint16_t rx_fifo_size;
};
#endif
|
/* pci.c - Generic PCI interfaces. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
*
* GRUB 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/pci.h>
#include <grub/dl.h>
#include <grub/emu/misc.h>
#include <grub/util/misc.h>
grub_pci_address_t
grub_pci_make_address (grub_pci_device_t dev, int reg)
{
grub_pci_address_t ret;
ret.dev = dev;
ret.pos = reg;
return ret;
}
void
grub_pci_iterate (grub_pci_iteratefunc_t hook)
{
struct pci_device_iterator *iter;
struct pci_slot_match slot;
struct pci_device *dev;
slot.domain = PCI_MATCH_ANY;
slot.bus = PCI_MATCH_ANY;
slot.dev = PCI_MATCH_ANY;
slot.func = PCI_MATCH_ANY;
iter = pci_slot_match_iterator_create (&slot);
while ((dev = pci_device_next (iter)))
hook (dev, dev->vendor_id | (dev->device_id << 16));
pci_iterator_destroy (iter);
}
void *
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
grub_size_t size)
{
void *addr;
int err;
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
if (err)
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
return addr;
}
void
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
grub_size_t size)
{
pci_device_unmap_range (dev, mem, size);
}
GRUB_MOD_INIT (pci)
{
pci_system_init ();
}
GRUB_MOD_FINI (pci)
{
pci_system_cleanup ();
}
|
/* progress_dlg.h
* Definitions for progress dialog box routines
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PROGRESS_DLG_H__
#define __PROGRESS_DLG_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** @file
* Progress (modal) dialog box routines.
* @ingroup dialog_group
*/
/** Progress dialog data. */
struct progdlg;
/** Progress dialog data. */
typedef struct progdlg progdlg_t;
/**
* Create and pop up the progress dialog. Allocates a "progdlg_t"
* and initialize it to contain all information the implementation
* needs in order to manipulate the dialog, and return a pointer to
* it.
*
* @param top_level_window UI widget to associate with the progress dialog, e.g.
* the main window.
* @param task_title The task to do, e.g. "Loading"
* @param item_title The item to do, e.g. "capture.cap"
* @param terminate_is_stop TRUE if the operation can't be cancelled, just
* stopped (i.e., it has a "Stop" button and clicking it doesn't undo
* anything already done), FALSE if it can
* @param stop_flag A pointer to a Boolean variable that will be
* set to TRUE if the user hits that button
* @return The newly created progress dialog
*/
progdlg_t *create_progress_dlg(gpointer top_level_window, const gchar *task_title, const gchar *item_title,
gboolean terminate_is_stop, gboolean *stop_flag);
/**
* Create a progress dialog, but only if it's not likely to disappear
* immediately. This can be disconcerting for the user.
*
* @param top_level_window The top-level window associated with the progress update.
* May be NULL.
* @param task_title The task to do, e.g. "Loading"
* @param item_title The item to do, e.g. "capture.cap"
* @param terminate_is_stop TRUE if the operation can't be cancelled, just
* stopped (i.e., it has a "Stop" button and clicking it doesn't undo
* anything already done), FALSE if it can
* @param stop_flag A pointer to a Boolean variable that will be
* set to TRUE if the user hits that button
* @param start_time A pointer to a GTimeVal structure which holds
* the time at which the caller started to process the data
* @param progress The current progress (0..1)
* @return The newly created progress dialog
*/
progdlg_t *delayed_create_progress_dlg(gpointer top_level_window, const gchar *task_title, const gchar *item_title,
gboolean terminate_is_stop, gboolean *stop_flag,
const GTimeVal *start_time, gfloat progress);
/**
* Update the progress information of the progress dialog box.
*
* @param dlg The progress dialog from create_progress_dlg()
* @param percentage The current percentage value (0..1)
* @param status the New status string to show, e.g. "3000KB of 6000KB"
*/
void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status);
/**
* Destroy or hide the progress bar.
*
* @param dlg The progress dialog from create_progress_dlg()
*/
void destroy_progress_dlg(progdlg_t *dlg);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __PROGRESS_DLG_H__ */
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
|
/*
* Copyright (C) 2019 Otto-von-Guericke-Universität Magdeburg
*
* 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 drivers_nrf24l01p_ng
* @{
*
* @file
* @brief Functions to print NRF24L01+ (NG) debug information
*
* @author Fabian Hüßler <fabian.huessler@ovgu.de>
*/
#ifndef NRF24L01P_NG_DIAGNOSTICS_H
#define NRF24L01P_NG_DIAGNOSTICS_H
#include "nrf24l01p_ng.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Print all NRF24L01+ register values
*
* @param[in] dev NRF24L01+ device handle
*/
void nrf24l01p_ng_diagnostics_print_all_regs(const nrf24l01p_ng_t *dev);
/**
* @brief Print NRF24L01+ device handle information
*
* @param[in] dev NRF24L01+ device handle
*/
void nrf24l01p_ng_diagnostics_print_dev_info(const nrf24l01p_ng_t *dev);
/**
* @brief Print NRF24L01+ frame
*
* @param[in] dev NRF24L01+ device handle
* @param[in] frame Frame
* @param[in] len Frame length
*/
void nrf24l01p_ng_diagnostics_print_frame(const nrf24l01p_ng_t *dev,
const void *frame, size_t len);
#ifdef __cplusplus
}
#endif
#endif /* NRF24L01P_NG_DIAGNOSTICS_H */
/** @} */
|
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef ISERVER_H
#define ISERVER_H
#ifdef _WIN32
#pragma once
#endif
#include <inetmsghandler.h>
#include <bitvec.h>
#include <const.h>
class INetMessage;
class IRecipientFilter;
class IClient;
typedef struct player_info_s player_info_t;
abstract_class IServer : public IConnectionlessPacketHandler
{
public:
virtual ~IServer() {}
virtual int GetNumClients( void ) const = 0; // returns current number of clients
virtual int GetNumProxies( void ) const = 0; // returns number of attached HLTV proxies
virtual int GetNumFakeClients() const = 0; // returns number of fake clients/bots
virtual int GetMaxClients( void ) const = 0; // returns current client limit
virtual IClient *GetClient( int index ) = 0; // returns interface to client
virtual int GetClientCount() const = 0; // returns number of clients slots (used & unused)
virtual int GetUDPPort( void ) const = 0; // returns current used UDP port
virtual float GetTime( void ) const = 0; // returns game world time
virtual int GetTick( void ) const = 0; // returns game world tick
virtual float GetTickInterval( void ) const = 0; // tick interval in seconds
virtual float GetTimescale( void ) const = 0; // returns the game time scale (multiplied in conjunction with host_timescale)
virtual const char *GetName( void ) const = 0; // public server name
virtual const char *GetMapName( void ) const = 0; // current map name (BSP)
virtual int GetSpawnCount( void ) const = 0;
virtual int GetNumClasses( void ) const = 0;
virtual int GetClassBits( void ) const = 0;
virtual void GetNetStats( float &avgIn, float &avgOut ) = 0; // total net in/out in bytes/sec
virtual int GetNumPlayers() = 0;
virtual bool GetPlayerInfo( int nClientIndex, player_info_t *pinfo ) = 0;
virtual bool IsActive( void ) const = 0;
virtual bool IsLoading( void ) const = 0;
virtual bool IsDedicated( void ) const = 0;
virtual bool IsPaused( void ) const = 0;
virtual bool IsMultiplayer( void ) const = 0;
virtual bool IsPausable() const = 0;
virtual bool IsHLTV() const = 0;
virtual bool IsReplay() const = 0;
virtual const char * GetPassword() const = 0; // returns the password or NULL if none set
virtual void SetPaused(bool paused) = 0;
virtual void SetTimescale( float flTimescale ) = 0;
virtual void SetPassword(const char *password) = 0; // set password (NULL to disable)
virtual void BroadcastMessage( INetMessage &msg, bool onlyActive = false, bool reliable = false) = 0;
virtual void BroadcastMessage( INetMessage &msg, IRecipientFilter &filter ) = 0;
virtual void DisconnectClient( IClient *client, const char *reason ) = 0;
};
#endif // ISERVER_H
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f (int p[]) { p++; }
|
// 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_ICONS_STATUS_TRAY_WIN_H_
#define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
#include <windows.h>
#include <memory>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "chrome/browser/status_icons/status_tray.h"
class StatusIconWin;
// A class that's responsible for increasing, if possible, the visibility
// of a status tray icon on the taskbar. The default implementation sends
// a task to a worker thread each time EnqueueChange is called.
class StatusTrayStateChangerProxy {
public:
virtual ~StatusTrayStateChangerProxy() {}
// Called by StatusTrayWin to request upgraded visibility on the icon
// represented by the |icon_id|, |window| pair.
virtual void EnqueueChange(UINT icon_id, HWND window) = 0;
};
class StatusTrayWin : public StatusTray {
public:
StatusTrayWin();
~StatusTrayWin() override;
void UpdateIconVisibilityInBackground(StatusIconWin* status_icon);
// Exposed for testing.
LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
protected:
// Overriden from StatusTray:
StatusIcon* CreatePlatformStatusIcon(StatusIconType type,
const gfx::ImageSkia& image,
const base::string16& tool_tip) override;
private:
FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest, EnsureVisibleTest);
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK
WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
UINT NextIconId();
void SetStatusTrayStateChangerProxyForTest(
std::unique_ptr<StatusTrayStateChangerProxy> proxy);
// The unique icon ID we will assign to the next icon.
UINT next_icon_id_;
// The window class of |window_|.
ATOM atom_;
// The handle of the module that contains the window procedure of |window_|.
HMODULE instance_;
// The window used for processing events.
HWND window_;
// The message ID of the "TaskbarCreated" message, sent to us when we need to
// reset our status icons.
UINT taskbar_created_message_;
// Manages changes performed on a background thread to manipulate visibility
// of notification icons.
std::unique_ptr<StatusTrayStateChangerProxy> state_changer_proxy_;
DISALLOW_COPY_AND_ASSIGN(StatusTrayWin);
};
#endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_FAKE_DESKTOP_MEDIA_LIST_H_
#define CHROME_BROWSER_MEDIA_FAKE_DESKTOP_MEDIA_LIST_H_
#include <vector>
#include "chrome/browser/media/desktop_media_list.h"
class FakeDesktopMediaList : public DesktopMediaList {
public:
FakeDesktopMediaList();
~FakeDesktopMediaList() override;
void AddSource(int id);
void RemoveSource(int index);
void MoveSource(int old_index, int new_index);
void SetSourceThumbnail(int index);
void SetSourceName(int index, base::string16 name);
// DesktopMediaList implementation:
void SetUpdatePeriod(base::TimeDelta period) override;
void SetThumbnailSize(const gfx::Size& thumbnail_size) override;
void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override;
void StartUpdating(DesktopMediaListObserver* observer) override;
int GetSourceCount() const override;
const Source& GetSource(int index) const override;
private:
std::vector<Source> sources_;
DesktopMediaListObserver* observer_;
gfx::ImageSkia thumbnail_;
};
#endif // CHROME_BROWSER_MEDIA_FAKE_DESKTOP_MEDIA_LIST_H_
|
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
#include "syscall.h"
#include "libc.h"
int fcntl(int fd, int cmd, ...)
{
unsigned long arg;
va_list ap;
va_start(ap, cmd);
arg = va_arg(ap, unsigned long);
va_end(ap);
if (cmd == F_SETFL) arg |= O_LARGEFILE;
if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, (void *)arg);
if (cmd == F_GETOWN) {
struct f_owner_ex ex;
int ret = __syscall(SYS_fcntl, fd, F_GETOWN_EX, &ex);
if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, (void *)arg);
if (ret) return __syscall_ret(ret);
return ex.type == F_OWNER_PGRP ? -ex.pid : ex.pid;
}
if (cmd == F_DUPFD_CLOEXEC) {
int ret = __syscall(SYS_fcntl, fd, F_DUPFD_CLOEXEC, arg);
if (ret != -EINVAL) {
if (ret >= 0)
__syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC);
return __syscall_ret(ret);
}
ret = __syscall(SYS_fcntl, fd, F_DUPFD_CLOEXEC, 0);
if (ret != -EINVAL) {
if (ret >= 0) __syscall(SYS_close, ret);
return __syscall_ret(-EINVAL);
}
ret = __syscall(SYS_fcntl, fd, F_DUPFD, arg);
if (ret >= 0) __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC);
return __syscall_ret(ret);
}
switch (cmd) {
case F_SETLK:
case F_GETLK:
case F_GETOWN_EX:
case F_SETOWN_EX:
return syscall(SYS_fcntl, fd, cmd, (void *)arg);
default:
return syscall(SYS_fcntl, fd, cmd, arg);
}
}
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 NICTA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Quincy Tse <quincy.tse@nicta.com.au>
*/
#ifndef FATAL_IMPL_H
#define FATAL_IMPL_H
#include <ostream>
/**
* \file
* \ingroup fatalimpl
* ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(),
* and ns3::FatalImpl::FlushStreams() declarations.
*/
/**
* \ingroup fatal
* \defgroup fatalimpl Fatal Implementation.
*/
namespace ns3 {
/**
* \ingroup fatalimpl
* \brief Implementation namespace for fatal error handlers.
*/
namespace FatalImpl {
/**
* \ingroup fatalimpl
*
* \brief Register a stream to be flushed on abnormal exit.
*
* If a \c std::terminate() call is encountered after the
* stream had been registered and before it has been
* unregistered, \c stream->flush() will be called. Users of
* this function should ensure the stream remains valid until
* it had been unregistered.
*
* \param [in] stream The stream to be flushed on abnormal exit.
*/
void RegisterStream (std::ostream* stream);
/**
* \ingroup fatalimpl
*
* \brief Unregister a stream for flushing on abnormal exit.
*
* After a stream had been unregistered, \c stream->flush()
* will no longer be called should abnormal termination be
* encountered.
*
* If the stream is not registered, nothing will happen.
*
* \param [in] stream The stream to be unregistered.
*/
void UnregisterStream (std::ostream* stream);
/**
* \ingroup fatalimpl
*
* \brief Flush all currently registered streams.
*
* This function iterates through each registered stream and
* unregisters them. The default \c SIGSEGV handler is overridden
* when this function is being executed, and will be restored
* when this function returns.
*
* If a \c SIGSEGV is encountered (most likely due to a bad \c ostream*
* being registered, or a registered \c osteam* pointing to an
* \c ostream that had already been destroyed), this function will
* skip the bad \c ostream* and continue to flush the next stream.
* The function will then terminate raising \c SIGIOT (aka \c SIGABRT)
*
* DO NOT call this function until the program is ready to crash.
*/
void FlushStreams (void);
} //FatalImpl
} //ns3
#endif
|
/*
*
* Connection Manager
*
* Copyright (C) 2007-2012 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __CONNMAN_IPCONFIG_H
#define __CONNMAN_IPCONFIG_H
#include <connman/ipaddress.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* SECTION:ipconfig
* @title: IP configuration premitives
* @short_description: Functions for IP configuration handling
*/
enum connman_ipconfig_type {
CONNMAN_IPCONFIG_TYPE_UNKNOWN = 0,
CONNMAN_IPCONFIG_TYPE_IPV4 = 1,
CONNMAN_IPCONFIG_TYPE_IPV6 = 2,
CONNMAN_IPCONFIG_TYPE_ALL = 3,
};
enum connman_ipconfig_method {
CONNMAN_IPCONFIG_METHOD_UNKNOWN = 0,
CONNMAN_IPCONFIG_METHOD_OFF = 1,
CONNMAN_IPCONFIG_METHOD_FIXED = 2,
CONNMAN_IPCONFIG_METHOD_MANUAL = 3,
CONNMAN_IPCONFIG_METHOD_DHCP = 4,
CONNMAN_IPCONFIG_METHOD_AUTO = 5,
};
struct connman_ipconfig;
#ifdef __cplusplus
}
#endif
#endif /* __CONNMAN_IPCONFIG_H */
|
/* Export function prototypes from dojump.c.
Copyright (C) 2015-2017 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/>. */
#ifndef GCC_DOJUMP_H
#define GCC_DOJUMP_H
/* At the start of a function, record that we have no previously-pushed
arguments waiting to be popped. */
extern void init_pending_stack_adjust (void);
/* Discard any pending stack adjustment. */
extern void discard_pending_stack_adjust (void);
/* When exiting from function, if safe, clear out any pending stack adjust
so the adjustment won't get done. */
extern void clear_pending_stack_adjust (void);
/* Pop any previously-pushed arguments that have not been popped yet. */
extern void do_pending_stack_adjust (void);
/* Struct for saving/restoring of pending_stack_adjust/stack_pointer_delta
values. */
struct saved_pending_stack_adjust
{
/* Saved value of pending_stack_adjust. */
int x_pending_stack_adjust;
/* Saved value of stack_pointer_delta. */
int x_stack_pointer_delta;
};
/* Remember pending_stack_adjust/stack_pointer_delta.
To be used around code that may call do_pending_stack_adjust (),
but the generated code could be discarded e.g. using delete_insns_since. */
extern void save_pending_stack_adjust (saved_pending_stack_adjust *);
/* Restore the saved pending_stack_adjust/stack_pointer_delta. */
extern void restore_pending_stack_adjust (saved_pending_stack_adjust *);
/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */
extern void jumpifnot (tree exp, rtx_code_label *label, int prob);
extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *, int);
/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */
extern void jumpif (tree exp, rtx_code_label *label, int prob);
extern void jumpif_1 (enum tree_code, tree, tree, rtx_code_label *, int);
/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
the result is zero, or IF_TRUE_LABEL if the result is one. */
extern void do_jump (tree exp, rtx_code_label *if_false_label,
rtx_code_label *if_true_label, int prob);
extern void do_jump_1 (enum tree_code, tree, tree, rtx_code_label *,
rtx_code_label *, int);
extern void do_compare_rtx_and_jump (rtx, rtx, enum rtx_code, int,
machine_mode, rtx, rtx_code_label *,
rtx_code_label *, int);
extern bool split_comparison (enum rtx_code, machine_mode,
enum rtx_code *, enum rtx_code *);
#endif /* GCC_DOJUMP_H */
|
/*
* OpenTyrian: A modern cross-platform port of Tyrian
* Copyright (C) 2007-2009 The OpenTyrian Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SPRITE_H
#define SPRITE_H
#include "opentyr.h"
#include "SDL.h"
#include <assert.h>
#include <stdio.h>
#define FONT_SHAPES 0
#define SMALL_FONT_SHAPES 1
#define TINY_FONT 2
#define PLANET_SHAPES 3
#define FACE_SHAPES 4
#define OPTION_SHAPES 5 /*Also contains help shapes*/
#define WEAPON_SHAPES 6
#define EXTRA_SHAPES 7 /*Used for Ending pics*/
#define SPRITE_TABLES_MAX 8
#ifdef TYRIAN2000
#define SPRITES_PER_TABLE_MAX 152
#else
#define SPRITES_PER_TABLE_MAX 151
#endif
typedef struct
{
Uint16 width, height;
Uint16 size;
Uint8 *data;
}
Sprite;
typedef struct
{
unsigned int count;
Sprite sprite[SPRITES_PER_TABLE_MAX];
}
Sprite_array;
extern Sprite_array sprite_table[SPRITE_TABLES_MAX];
static inline Sprite *sprite( unsigned int table, unsigned int index )
{
assert(table < COUNTOF(sprite_table));
assert(index < COUNTOF(sprite_table->sprite));
return &sprite_table[table].sprite[index];
}
static inline bool sprite_exists( unsigned int table, unsigned int index )
{
return (sprite(table, index)->data != NULL);
}
static inline Uint16 get_sprite_width( unsigned int table, unsigned int index )
{
return (sprite_exists(table, index) ? sprite(table, index)->width : 0);
}
static inline Uint16 get_sprite_height( unsigned int table, unsigned int index )
{
return (sprite_exists(table, index) ? sprite(table, index)->height : 0);
}
void load_sprites_file( unsigned table, const char *filename );
void load_sprites( unsigned int table, FILE *f );
void free_sprites( unsigned int table );
void blit_sprite( SDL_Surface *, int x, int y, unsigned int table, unsigned int index ); // JE_newDrawCShapeNum
void blit_sprite_blend( SDL_Surface *, int x, int y, unsigned int table, unsigned int index ); // JE_newDrawCShapeTrick
void blit_sprite_hv_unsafe( SDL_Surface *, int x, int y, unsigned int table, unsigned int index, Uint8 hue, Sint8 value ); // JE_newDrawCShapeBright
void blit_sprite_hv( SDL_Surface *, int x, int y, unsigned int table, unsigned int index, Uint8 hue, Sint8 value ); // JE_newDrawCShapeAdjust
void blit_sprite_hv_blend( SDL_Surface *, int x, int y, unsigned int table, unsigned int index, Uint8 hue, Sint8 value ); // JE_newDrawCShapeModify
void blit_sprite_dark( SDL_Surface *, int x, int y, unsigned int table, unsigned int index, bool black ); // JE_newDrawCShapeDarken, JE_newDrawCShapeShadow
typedef struct
{
unsigned int size;
Uint8 *data;
}
Sprite2_array;
extern Sprite2_array eShapes[6];
extern Sprite2_array shapesC1, shapes6, shapes9, shapesW2;
void JE_loadCompShapes( Sprite2_array *, JE_char s );
void JE_loadCompShapesB( Sprite2_array *, FILE *f );
void free_sprite2s( Sprite2_array * );
void blit_sprite2( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void blit_sprite2_blend( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void blit_sprite2_darken( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void blit_sprite2_filter( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index, Uint8 filter );
void blit_sprite2x2( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void blit_sprite2x2_blend( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void blit_sprite2x2_darken( SDL_Surface *, int x, int y, Sprite2_array, unsigned int index );
void JE_loadMainShapeTables( const char *shpfile );
void free_main_shape_tables( void );
#endif // SPRITE_H
|
/*
* Name: wx/palmos/chkconf.h
* Purpose: Compiler-specific configuration checking
* Author: William Osborne - minimal working wxPalmOS port
* Modified by: Yunhui Fu
* Created: 10/13/04
* RCS-ID: $Id$
* Copyright: (c) William Osborne
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_PALMOS_CHKCONF_H_
#define _WX_PALMOS_CHKCONF_H_
/*
* disable the settings which are not implemented yet
*/
#undef wxUSE_ACCEL
#define wxUSE_ACCEL 0
#undef wxUSE_ARCHIVE_STREAMS
#define wxUSE_ARCHIVE_STREAMS 0
#undef wxUSE_BMPBUTTON
#define wxUSE_BMPBUTTON 0
#undef wxUSE_CALENDARCTRL
#define wxUSE_CALENDARCTRL 0
#undef wxUSE_CARET
#define wxUSE_CARET 0
#undef wxUSE_CHECKLISTBOX
#define wxUSE_CHECKLISTBOX 0
#undef wxUSE_CHOICE
#define wxUSE_CHOICE 0
#undef wxUSE_CHOICEBOOK
#define wxUSE_CHOICEBOOK 0
#undef wxUSE_CHOICEDLG
#define wxUSE_CHOICEDLG 0
#undef wxUSE_CLIPBOARD
#define wxUSE_CLIPBOARD 0
#undef wxUSE_COMBOBOX
#define wxUSE_COMBOBOX 0
#undef wxUSE_DATAOBJ
#define wxUSE_DATAOBJ 0
#undef wxUSE_DIRDLG
#define wxUSE_DIRDLG 1
#undef wxUSE_DISPLAY
#define wxUSE_DISPLAY 0
#undef wxUSE_DOC_VIEW_ARCHITECTURE
#define wxUSE_DOC_VIEW_ARCHITECTURE 0
#undef wxUSE_DRAG_AND_DROP
#define wxUSE_DRAG_AND_DROP 0
#undef wxUSE_DRAGIMAGE
#define wxUSE_DRAGIMAGE 0
#undef wxUSE_DYNAMIC_LOADER
#define wxUSE_DYNAMIC_LOADER 0
#undef wxUSE_DYNLIB_CLASS
#define wxUSE_DYNLIB_CLASS 0
#undef wxUSE_ENH_METAFILE
#define wxUSE_ENH_METAFILE 0
#undef wxUSE_FFILE
#define wxUSE_FFILE 0
#undef wxUSE_FILE
#define wxUSE_FILE 1
#undef wxUSE_FILECONFIG
#define wxUSE_FILECONFIG 0
#undef wxUSE_FILEDLG
#define wxUSE_FILEDLG 1
#undef wxUSE_FILESYSTEM
#define wxUSE_FILESYSTEM 0
#undef wxUSE_FINDREPLDLG
#define wxUSE_FINDREPLDLG 0
#undef wxUSE_FONTDLG
#define wxUSE_FONTDLG 0
#undef wxUSE_FONTMAP
#define wxUSE_FONTMAP 0
#undef wxUSE_FS_ARCHIVE
#define wxUSE_FS_ARCHIVE 0
#undef wxUSE_FS_INET
#define wxUSE_FS_INET 0
#undef wxUSE_FS_ZIP
#define wxUSE_FS_ZIP 0
#undef wxUSE_GAUGE
#define wxUSE_GAUGE 0
#undef wxUSE_GRID
#define wxUSE_GRID 0
#undef wxUSE_HELP
#define wxUSE_HELP 0
#undef wxUSE_HTML
#define wxUSE_HTML 0
#undef wxUSE_IMAGE
#define wxUSE_IMAGE 0
#undef wxUSE_LIBPNG
#define wxUSE_LIBPNG 0
#undef wxUSE_LIBJPEG
#define wxUSE_LIBJPEG 0
#undef wxUSE_LIBTIFF
#define wxUSE_LIBTIFF 0
#undef wxUSE_GIF
#define wxUSE_GIF 0
#undef wxUSE_PNM
#define wxUSE_PNM 0
#undef wxUSE_PCX
#define wxUSE_PCX 0
#undef wxUSE_XPM
#define wxUSE_XPM 0
#undef wxUSE_ICO_CUR
#define wxUSE_ICO_CUR 0
#undef wxUSE_SVG
#define wxUSE_SVG 0
#undef wxUSE_INTL
#define wxUSE_INTL 0
#undef wxUSE_IPC
#define wxUSE_IPC 0
#undef wxUSE_JOYSTICK
#define wxUSE_JOYSTICK 0
#undef wxUSE_LISTBOOK
#define wxUSE_LISTBOOK 0
#undef wxUSE_LISTBOX
#define wxUSE_LISTBOX 0
#undef wxUSE_LISTCTRL
#define wxUSE_LISTCTRL 0
#undef wxUSE_LOG_DIALOG
#define wxUSE_LOG_DIALOG 0
#undef wxUSE_LOGWINDOW
#define wxUSE_LOGWINDOW 0
#undef wxUSE_METAFILE
#define wxUSE_METAFILE 0
#undef wxUSE_MDI
#define wxUSE_MDI 0
#undef wxUSE_MDI_ARCHITECTURE
#define wxUSE_MDI_ARCHITECTURE 0
#undef wxUSE_MEDIACTRL
#define wxUSE_MEDIACTRL 0
#undef wxUSE_MIMETYPE
#define wxUSE_MIMETYPE 0
#undef wxUSE_MOUSEWHEEL
#define wxUSE_MOUSEWHEEL 0
#undef wxUSE_NOTEBOOK
#define wxUSE_NOTEBOOK 0
#undef wxUSE_NUMBERDLG
#define wxUSE_NUMBERDLG 0
#undef wxUSE_ON_FATAL_EXCEPTION
#define wxUSE_ON_FATAL_EXCEPTION 0
#undef wxUSE_PALETTE
#define wxUSE_PALETTE 0
#undef wxUSE_POPUPWIN
#define wxUSE_POPUPWIN 0
#undef wxUSE_PRINTING_ARCHITECTURE
#define wxUSE_PRINTING_ARCHITECTURE 0
#undef wxUSE_PROTOCOL
#define wxUSE_PROTOCOL 0
#undef wxUSE_PROTOCOL_FILE
#define wxUSE_PROTOCOL_FILE 0
#undef wxUSE_PROTOCOL_FTP
#define wxUSE_PROTOCOL_FTP 0
#undef wxUSE_PROTOCOL_HTTP
#define wxUSE_PROTOCOL_HTTP 0
#undef wxUSE_REGEX
#define wxUSE_REGEX 0
#undef wxUSE_SCROLLBAR
#define wxUSE_SCROLLBAR 0
#undef wxUSE_SNGLINST_CHECKER
#define wxUSE_SNGLINST_CHECKER 0
#undef wxUSE_SOCKETS
#define wxUSE_SOCKETS 0
#undef wxUSE_SOUND
#define wxUSE_SOUND 0
#undef wxUSE_SPINBTN
#define wxUSE_SPINBTN 0
#undef wxUSE_SPINCTRL
#define wxUSE_SPINCTRL 0
#undef wxUSE_SPLASH
#define wxUSE_SPLASH 0
#undef wxUSE_SPLINES
#define wxUSE_SPLINES 0
#undef wxUSE_STARTUP_TIPS
#define wxUSE_STARTUP_TIPS 0
#undef wxUSE_STATBMP
#define wxUSE_STATBMP 0
#undef wxUSE_STATBOX
#define wxUSE_STATBOX 0
#undef wxUSE_STATLINE
#define wxUSE_STATLINE 0
#undef wxUSE_TARSTREAM
#define wxUSE_TARSTREAM 0
#undef wxUSE_TEXTBUFFER
#define wxUSE_TEXTBUFFER 0
#undef wxUSE_TEXTCTRL
#define wxUSE_TEXTCTRL 0
#undef wxUSE_TEXTFILE
#define wxUSE_TEXTFILE 0
#undef wxUSE_TEXTDLG
#define wxUSE_TEXTDLG 0
#undef wxUSE_THREADS
#define wxUSE_THREADS 0
#undef wxUSE_TIPWINDOW
#define wxUSE_TIPWINDOW 0
#undef wxUSE_TREEBOOK
#define wxUSE_TREEBOOK 0
#undef wxUSE_TREECTRL
#define wxUSE_TREECTRL 0
#undef wxUSE_TIMER
#define wxUSE_TIMER 0
#undef wxUSE_TOOLBAR
#define wxUSE_TOOLBAR 0
#undef wxUSE_TOOLBAR_NATIVE
#define wxUSE_TOOLBAR_NATIVE 0
#undef wxUSE_TOOLTIPS
#define wxUSE_TOOLTIPS 0
#undef wxUSE_URL
#define wxUSE_URL 0
//#undef wxUSE_WCHAR_T
//#define wxUSE_WCHAR_T 1
#undef wxUSE_WIZARDDLG
#define wxUSE_WIZARDDLG 0
#undef wxUSE_WXHTML_HELP
#define wxUSE_WXHTML_HELP 0
#undef wxUSE_XML
#define wxUSE_XML 0
#undef wxUSE_XRC
#define wxUSE_XRC 0
#undef wxUSE_ZIPSTREAM
#define wxUSE_ZIPSTREAM 0
#undef wxUSE_ZLIB
#define wxUSE_ZLIB 0
#undef wxUSE_COLLPANE
#define wxUSE_COLLPANE 0
#undef wxUSE_TOOLBOOK
#define wxUSE_TOOLBOOK 0
#undef wxUSE_SELECT_DISPATCHER
#define wxUSE_SELECT_DISPATCHER 1
#endif
/* _WX_PALMOS_CHKCONF_H_ */
|
#include "ntdb-source.h"
/* We had a bug where we marked the ntdb read-only for a ntdb_traverse_read.
* If we then expanded the ntdb, we would remap read-only, and later SEGV. */
#include "tap-interface.h"
#include "external-agent.h"
#include "logging.h"
static bool file_larger(int fd, ntdb_len_t size)
{
struct stat st;
fstat(fd, &st);
return st.st_size != size;
}
static unsigned add_records_to_grow(struct agent *agent, int fd, ntdb_len_t size)
{
unsigned int i;
for (i = 0; !file_larger(fd, size); i++) {
char data[50];
sprintf(data, "%i=%i", i, i);
if (external_agent_operation(agent, STORE, data) != SUCCESS)
return 0;
}
diag("Added %u records to grow file", i);
return i;
}
int main(int argc, char *argv[])
{
unsigned int i;
struct agent *agent;
struct ntdb_context *ntdb;
NTDB_DATA d = ntdb_mkdata("hello", 5);
const char filename[] = "run-remap-in-read_traverse.ntdb";
plan_tests(4);
agent = prepare_external_agent();
ntdb = ntdb_open(filename, MAYBE_NOSYNC,
O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
ok1(external_agent_operation(agent, OPEN, filename) == SUCCESS);
i = add_records_to_grow(agent, ntdb->file->fd, ntdb->file->map_size);
/* Do a traverse. */
ok1(ntdb_traverse(ntdb, NULL, NULL) == i);
/* Now store something! */
ok1(ntdb_store(ntdb, d, d, NTDB_INSERT) == 0);
ok1(tap_log_messages == 0);
ntdb_close(ntdb);
free_external_agent(agent);
return exit_status();
}
|
/**
* GeoDa TM, Copyright (C) 2011-2014 by Luc Anselin - all rights reserved
*
* This file is part of GeoDa.
*
* GeoDa 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.
*
* GeoDa 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 __GEODA_CENTER_DATA_VIEWER_ADD_COL_DLG_H__
#define __GEODA_CENTER_DATA_VIEWER_ADD_COL_DLG_H__
#include <map>
#include <set>
#include <wx/radiobut.h>
#include <wx/stattext.h>
#include <wx/grid.h>
#include <wx/choice.h>
#include "../GdaConst.h"
class Project;
class TableInterface;
class DataViewerAddColDlg: public wxDialog
{
public:
DataViewerAddColDlg(Project* project,
wxWindow* parent, bool time_variant_no_as_default=true,
bool can_change_time_variant=true,
wxString default_name=wxEmptyString,
GdaConst::FieldType default_field_type=GdaConst::double_type);
void CreateControls();
void OnChoiceType( wxCommandEvent& ev );
void SetDefaultsByType(GdaConst::FieldType type);
void OnOkClick( wxCommandEvent& ev );
void OnEditName( wxCommandEvent& ev );
void CheckName();
void OnEditLength( wxCommandEvent& ev );
void OnEditDecimals( wxCommandEvent& ev );
void OnChoiceDisplayedDecimals( wxCommandEvent& ev );
void UpdateMinMaxValues();
void UpdateApplyButton();
wxString GetColName();
int GetColId();
wxRadioButton* m_time_variant_no;
wxRadioButton* m_time_variant_yes;
wxButton* m_apply_button;
wxTextCtrl* m_name;
bool m_name_valid;
wxChoice* m_type;
wxChoice* m_insert_pos;
wxStaticText* m_length_lable;
wxTextCtrl* m_length;
int m_length_val;
bool m_length_valid;
wxStaticText* m_decimals_lable;
wxTextCtrl* m_decimals;
int m_decimals_val;
bool m_decimals_valid;
wxStaticText* m_displayed_decimals_lable;
wxChoice* m_displayed_decimals;
wxStaticText* m_max_label;
wxStaticText* m_max_val;
wxStaticText* m_min_label;
wxStaticText* m_min_val;
GdaConst::FieldType cur_type;
wxGrid* grid;
Project* project;
TableInterface* table_int;
private:
wxString default_name;
GdaConst::FieldType default_field_type;
bool time_variant_no_as_default;
bool can_change_time_variant;
wxString final_col_name;
int final_col_id;
std::set<wxString> curr_col_labels;
bool time_variant;
bool fixed_lengths;
DECLARE_EVENT_TABLE()
};
#endif
|
/* TradingPanel.h
Copyright (c) 2014 by Michael Zahniser
Endless Sky 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.
Endless Sky 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 TRADING_PANEL_H_
#define TRADING_PANEL_H_
#include "Panel.h"
class PlayerInfo;
class System;
// Overlay on the PlanetPanel showing commodity prices and inventory, and allowing
// buying and selling. This also lets you sell any plundered outfits you are
// carrying, although if you want to sell only certain ones and not others you
// will need to select them individually in the outfitter panel.
class TradingPanel : public Panel {
public:
TradingPanel(PlayerInfo &player);
~TradingPanel();
virtual void Step() override;
virtual void Draw() const override;
protected:
// Only override the ones you need; the default action is to return false.
virtual bool KeyDown(SDL_Keycode key, Uint16 mod, const Command &command) override;
virtual bool Click(int x, int y) override;
private:
void Buy(int64_t amount);
private:
PlayerInfo &player;
const System &system;
int selectedRow;
// Keep track of how much we sold and how much profit was made.
int tonsSold = 0;
int64_t profit = 0;
};
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkGeoEdgeStrategy.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkGeoEdgeStrategy - Layout graph edges on a globe as arcs.
//
// .SECTION Description
// vtkGeoEdgeStrategy produces arcs for each edge in the input graph.
// This is useful for viewing lines on a sphere (e.g. the earth).
// The arcs may "jump" above the sphere's surface using ExplodeFactor.
#ifndef vtkGeoEdgeStrategy_h
#define vtkGeoEdgeStrategy_h
#include "vtkInfovisLayoutModule.h" // For export macro
#include "vtkEdgeLayoutStrategy.h"
class VTKINFOVISLAYOUT_EXPORT vtkGeoEdgeStrategy : public vtkEdgeLayoutStrategy
{
public:
static vtkGeoEdgeStrategy *New();
vtkTypeMacro(vtkGeoEdgeStrategy,vtkEdgeLayoutStrategy);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// The base radius used to determine the earth's surface.
// Default is the earth's radius in meters.
// TODO: Change this to take in a vtkGeoTerrain to get altitude.
vtkSetMacro(GlobeRadius, double);
vtkGetMacro(GlobeRadius, double);
// Description:
// Factor on which to "explode" the arcs away from the surface.
// A value of 0.0 keeps the values on the surface.
// Values larger than 0.0 push the arcs away from the surface by a distance
// proportional to the distance between the points.
// The default is 0.2.
vtkSetMacro(ExplodeFactor, double);
vtkGetMacro(ExplodeFactor, double);
// Description:
// The number of subdivisions in the arc.
// The default is 20.
vtkSetMacro(NumberOfSubdivisions, int);
vtkGetMacro(NumberOfSubdivisions, int);
// Description:
// Perform the layout.
virtual void Layout();
protected:
vtkGeoEdgeStrategy();
~vtkGeoEdgeStrategy() {}
double GlobeRadius;
double ExplodeFactor;
int NumberOfSubdivisions;
private:
vtkGeoEdgeStrategy(const vtkGeoEdgeStrategy&); // Not implemented.
void operator=(const vtkGeoEdgeStrategy&); // Not implemented.
};
#endif
|
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/security.h>
int TestSecurityToken(int argc, char* argv[])
{
return 0;
}
|
// Filename: imageBase.h
// Created by: drose (19Jun00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef IMAGEBASE_H
#define IMAGEBASE_H
#include "pandatoolbase.h"
#include "programBase.h"
#include "coordinateSystem.h"
#include "pnmImage.h"
////////////////////////////////////////////////////////////////////
// Class : ImageBase
// Description : This specialization of ProgramBase is intended for
// programs that read and/or write a single image file.
// (See ImageMultiBase for programs that operate on
// multiple image files at once.)
//
// This is just a base class; see ImageReader, ImageWriter,
// or ImageFilter according to your particular I/O needs.
////////////////////////////////////////////////////////////////////
class ImageBase : public ProgramBase {
public:
ImageBase();
protected:
virtual bool post_command_line();
protected:
PNMImage _image;
};
#endif
|
// Filename: lwoSurfaceSidedness.h
// Created by: drose (24Apr01)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef LWOSURFACESIDEDNESS_H
#define LWOSURFACESIDEDNESS_H
#include "pandatoolbase.h"
#include "lwoChunk.h"
////////////////////////////////////////////////////////////////////
// Class : LwoSurfaceSidedness
// Description : Records whether polygons are frontfacing only or
// backfacing also. This is associated with the
// LwoSurface chunk.
////////////////////////////////////////////////////////////////////
class LwoSurfaceSidedness : public LwoChunk {
public:
enum Sidedness {
S_front = 1,
S_front_and_back = 3
};
Sidedness _sidedness;
public:
virtual bool read_iff(IffInputFile *in, size_t stop_at);
virtual void write(ostream &out, int indent_level = 0) const;
public:
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
LwoChunk::init_type();
register_type(_type_handle, "LwoSurfaceSidedness",
LwoChunk::get_class_type());
}
private:
static TypeHandle _type_handle;
};
#endif
|
/*
* Copyright (c) 2011, The Iconfactory. All rights reserved.
* Copyright (c) 2016 Microsoft Corporation. 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 Iconfactory 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 ICONFACTORY BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#import "UIGestureRecognizer.h"
@interface UIRotationGestureRecognizer : UIGestureRecognizer {
CGFloat _rotation;
}
@property (nonatomic) CGFloat rotation;
@property (nonatomic, readonly) CGFloat velocity;
@end
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkEdgeCenters.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkEdgeCenters - generate points at center of edges
// .SECTION Description
// vtkEdgeCenters is a filter that takes as input any graph and
// generates on output points at the center of the cells in the dataset.
// These points can be used for placing glyphs (vtkGlyph3D) or labeling
// (vtkLabeledDataMapper). (The center is the parametric center of the
// cell, not necessarily the geometric or bounding box center.) The edge
// attributes will be associated with the points on output.
//
// .SECTION Caveats
// You can choose to generate just points or points and vertex cells.
// Vertex cells are drawn during rendering; points are not. Use the ivar
// VertexCells to generate cells.
// .SECTION See Also
// vtkGlyph3D vtkLabeledDataMapper
#ifndef __vtkEdgeCenters_h
#define __vtkEdgeCenters_h
#include "vtkPolyDataAlgorithm.h"
class VTK_INFOVIS_EXPORT vtkEdgeCenters : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkEdgeCenters,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Construct object with vertex cell generation turned off.
static vtkEdgeCenters *New();
// Description:
// Enable/disable the generation of vertex cells.
vtkSetMacro(VertexCells,int);
vtkGetMacro(VertexCells,int);
vtkBooleanMacro(VertexCells,int);
protected:
vtkEdgeCenters();
~vtkEdgeCenters() {};
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int FillInputPortInformation(int port, vtkInformation *info);
int VertexCells;
private:
vtkEdgeCenters(const vtkEdgeCenters&); // Not implemented.
void operator=(const vtkEdgeCenters&); // Not implemented.
};
#endif
|
/**
* @file
*
* mnmctdr.c
*
* Northbridge DR MCT supporting functions
*
* @xrefitem bom "File Content Label" "Release Content"
* @e project: AGESA
* @e sub-project: (Mem/NB/DR)
* @e \$Revision: 44323 $ @e \$Date: 2010-12-22 01:24:58 -0700 (Wed, 22 Dec 2010) $
*
**/
/*****************************************************************************
*
* Copyright (c) 2011, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Advanced Micro Devices, Inc. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. 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.
*
* ***************************************************************************
*
*/
/*
*----------------------------------------------------------------------------
* MODULES USED
*
*----------------------------------------------------------------------------
*/
#include "AGESA.h"
#include "amdlib.h"
#include "Ids.h"
#include "mport.h"
#include "mm.h"
#include "mn.h"
#include "mndr.h"
#include "mu.h"
#include "OptionMemory.h"
#include "GeneralServices.h"
#include "Filecode.h"
#define FILECODE PROC_MEM_NB_DR_MNMCTDR_FILECODE
/*----------------------------------------------------------------------------
* DEFINITIONS AND MACROS
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* TYPEDEFS AND STRUCTURES
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* PROTOTYPES OF LOCAL FUNCTIONS
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* EXPORTED FUNCTIONS
*
*----------------------------------------------------------------------------
*/
/* -----------------------------------------------------------------------------*/
/**
*
*
* This function sets final values in BUCFG and BUCFG2
*
* @param[in,out] *NBPtr - Pointer to the MEM_NB_BLOCK
*
* @return TRUE - No fatal error occurs.
* @return FALSE - Fatal error occurs.
*/
BOOLEAN
MemNFinalizeMctDr (
IN OUT MEM_NB_BLOCK *NBPtr
)
{
MEM_DATA_STRUCT *MemPtr;
S_UINT64 SMsr;
MemPtr = NBPtr->MemPtr;
MemNSetBitFieldNb (NBPtr, BFAdapPrefMissRatio, 1);
MemNSetBitFieldNb (NBPtr, BFAdapPrefPosStep, 0);
MemNSetBitFieldNb (NBPtr, BFAdapPrefNegStep, 0);
MemNSetBitFieldNb (NBPtr, BFCohPrefPrbLmt, 1);
// Recommended settings for F2x11C
MemNSetBitFieldNb (NBPtr, BFMctWrLimit, 16);
MemNSetBitFieldNb (NBPtr, BFPrefCpuDis, 0);
MemNSetBitFieldNb (NBPtr, BFPrefIoDis, 0);
MemNSetBitFieldNb (NBPtr, BFFlushWrOnStpGnt, 1);
if (NBPtr->Node == BSP_DIE) {
if (!NBPtr->ClToNbFlag) {
LibAmdMsrRead (BU_CFG2, (UINT64 *)&SMsr, &MemPtr->StdHeader);
SMsr.lo &= ~((UINT32)1 << 15); // ClLinesToNbDis
LibAmdMsrWrite (BU_CFG2, (UINT64 *)&SMsr, &MemPtr->StdHeader);
}
LibAmdMsrRead (BU_CFG, (UINT64 *)&SMsr, &MemPtr->StdHeader);
SMsr.hi &= ~((UINT32)1 << (48 - 32)); // WbEnhWsbDis
LibAmdMsrWrite (BU_CFG, (UINT64 *)&SMsr, &MemPtr->StdHeader);
}
return (BOOLEAN) (NBPtr->MCTPtr->ErrCode < AGESA_FATAL);
}
/*----------------------------------------------------------------------------
* LOCAL FUNCTIONS
*
*----------------------------------------------------------------------------
*/
|
/* microblaze-opcm.h -- Header used in microblaze-opc.h
Copyright (C) 2009-2016 Free Software Foundation, Inc.
This file is part of the GNU opcodes library.
This library 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.
It 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 file; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef MICROBLAZE_OPCM
#define MICROBLAZE_OPCM
enum microblaze_instr
{
add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
mulh, mulhu, mulhsu,swapb,swaph,
idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
ncget, ncput, muli, bslli, bsrai, bsrli, mului,
/* 'or/and/xor' are C++ keywords. */
microblaze_or, microblaze_and, microblaze_xor,
andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
shr, sw, swr, swx, lbui, lhui, lwi,
sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv,
fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
fint, fsqrt,
tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
eget, ecget, neget, necget, eput, ecput, neput, necput,
teget, tecget, tneget, tnecget, teput, tecput, tneput, tnecput,
aget, caget, naget, ncaget, aput, caput, naput, ncaput,
taget, tcaget, tnaget, tncaget, taput, tcaput, tnaput, tncaput,
eaget, ecaget, neaget, necaget, eaput, ecaput, neaput, necaput,
teaget, tecaget, tneaget, tnecaget, teaput, tecaput, tneaput, tnecaput,
getd, tgetd, cgetd, tcgetd, ngetd, tngetd, ncgetd, tncgetd,
putd, tputd, cputd, tcputd, nputd, tnputd, ncputd, tncputd,
egetd, tegetd, ecgetd, tecgetd, negetd, tnegetd, necgetd, tnecgetd,
eputd, teputd, ecputd, tecputd, neputd, tneputd, necputd, tnecputd,
agetd, tagetd, cagetd, tcagetd, nagetd, tnagetd, ncagetd, tncagetd,
aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
invalid_inst
};
enum microblaze_instr_type
{
arithmetic_inst, logical_inst, mult_inst, div_inst, branch_inst,
return_inst, immediate_inst, special_inst, memory_load_inst,
memory_store_inst, barrel_shift_inst, anyware_inst
};
#define INST_WORD_SIZE 4
/* Gen purpose regs go from 0 to 31. */
/* Mask is reg num - max_reg_num, ie reg_num - 32 in this case. */
#define REG_PC_MASK 0x8000
#define REG_MSR_MASK 0x8001
#define REG_EAR_MASK 0x8003
#define REG_ESR_MASK 0x8005
#define REG_FSR_MASK 0x8007
#define REG_BTR_MASK 0x800b
#define REG_EDR_MASK 0x800d
#define REG_PVR_MASK 0xa000
#define REG_SLR_MASK 0x8800
#define REG_SHR_MASK 0x8802
#define REG_PID_MASK 0x9000
#define REG_ZPR_MASK 0x9001
#define REG_TLBX_MASK 0x9002
#define REG_TLBLO_MASK 0x9003
#define REG_TLBHI_MASK 0x9004
#define REG_TLBSX_MASK 0x9005
#define MIN_REGNUM 0
#define MAX_REGNUM 31
#define MIN_PVR_REGNUM 0
#define MAX_PVR_REGNUM 15
#define REG_PC 32 /* PC. */
#define REG_MSR 33 /* Machine status reg. */
#define REG_EAR 35 /* Exception reg. */
#define REG_ESR 37 /* Exception reg. */
#define REG_FSR 39 /* FPU Status reg. */
#define REG_BTR 43 /* Branch Target reg. */
#define REG_EDR 45 /* Exception reg. */
#define REG_SHR 50 /* Stack High reg. */
#define REG_SLR 51 /* Stack Low reg. */
#define REG_PVR 40960 /* Program Verification reg. */
#define REG_PID 36864 /* MMU: Process ID reg. */
#define REG_ZPR 36865 /* MMU: Zone Protect reg. */
#define REG_TLBX 36866 /* MMU: TLB Index reg. */
#define REG_TLBLO 36867 /* MMU: TLB Low reg. */
#define REG_TLBHI 36868 /* MMU: TLB High reg. */
#define REG_TLBSX 36869 /* MMU: TLB Search Index reg. */
/* Alternate names for gen purpose regs. */
#define REG_SP 1 /* stack pointer. */
#define REG_ROSDP 2 /* read-only small data pointer. */
#define REG_RWSDP 13 /* read-write small data pointer. */
/* Assembler Register - Used in Delay Slot Optimization. */
#define REG_AS 18
#define REG_ZERO 0
#define RD_LOW 21 /* Low bit for RD. */
#define RA_LOW 16 /* Low bit for RA. */
#define RB_LOW 11 /* Low bit for RB. */
#define IMM_LOW 0 /* Low bit for immediate. */
#define IMM_MBAR 21 /* low bit for mbar instruction. */
#define RD_MASK 0x03E00000
#define RA_MASK 0x001F0000
#define RB_MASK 0x0000F800
#define IMM_MASK 0x0000FFFF
/* Imm mask for barrel shifts. */
#define IMM5_MASK 0x0000001F
/* Imm mask for mbar. */
#define IMM5_MBAR_MASK 0x03E00000
/* FSL imm mask for get, put instructions. */
#define RFSL_MASK 0x000000F
/* Imm mask for msrset, msrclr instructions. */
#define IMM15_MASK 0x00007FFF
#endif /* MICROBLAZE-OPCM */
|
#pragma once
/*
* Copyright (C) 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 <string>
#include <vector>
#include "JNIBase.h"
class CJNINetworkInfo;
class CJNIConnectivityManager : public CJNIBase
{
public:
CJNIConnectivityManager(const jni::jhobject &object) : CJNIBase(object) {};
bool isNetworkTypeValid(int);
void setNetworkPreference(int);
int getNetworkPreference();
CJNINetworkInfo getActiveNetworkInfo();
CJNINetworkInfo getNetworkInfo(int);
std::vector<CJNINetworkInfo> getAllNetworkInfo();
int startUsingNetworkFeature(int, std::string);
int stopUsingNetworkFeature(int, std::string);
bool requestRouteToHost(int, int);
bool getBackgroundDataSetting();
static void PopulateStaticFields();
static int TYPE_MOBILE;
static int TYPE_WIFI;
static int TYPE_MOBILE_MMS;
static int TYPE_MOBILE_SUPL;
static int TYPE_MOBILE_DUN;
static int TYPE_MOBILE_HIPRI;
static int TYPE_WIMAX;
static int TYPE_BLUETOOTH;
static int TYPE_DUMMY;
static int TYPE_ETHERNET;
static int DEFAULT_NETWORK_PREFERENCE;
private:
CJNIConnectivityManager();
};
|
/* backtrace.c -- Entry point for stack backtrace library.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
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) The name of the author may not 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. */
#include "config.h"
#include <sys/types.h>
#include "backtrace.h"
#include "internal.h"
/* This source file is compiled if the unwind library is not
available. */
int
backtrace_full (struct backtrace_state *state ATTRIBUTE_UNUSED,
int skip ATTRIBUTE_UNUSED,
backtrace_full_callback callback ATTRIBUTE_UNUSED,
backtrace_error_callback error_callback, void *data)
{
error_callback (data,
"no stack trace because unwind library not available",
0);
return 0;
}
int
backtrace_simple (struct backtrace_state *state ATTRIBUTE_UNUSED,
int skip ATTRIBUTE_UNUSED,
backtrace_simple_callback callback ATTRIBUTE_UNUSED,
backtrace_error_callback error_callback, void *data)
{
error_callback (data,
"no stack trace because unwind library not available",
0);
return 0;
}
|
//===- DWARFTypeUnit.h ------------------------------------------*- 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_DWARF_DWARFTYPEUNIT_H
#define LLVM_DEBUGINFO_DWARF_DWARFTYPEUNIT_H
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
#include "llvm/Support/DataExtractor.h"
#include <cstdint>
namespace llvm {
class DWARFContext;
class DWARFDebugAbbrev;
struct DWARFSection;
class raw_ostream;
class DWARFTypeUnit : public DWARFUnit {
private:
uint64_t TypeHash;
uint32_t TypeOffset;
public:
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
const DWARFSection &LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
UnitSection, Entry) {}
uint32_t getHeaderSize() const override {
return DWARFUnit::getHeaderSize() + 12;
}
void dump(raw_ostream &OS, bool Brief = false);
static const DWARFSectionKind Section = DW_SECT_TYPES;
protected:
bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) override;
};
} // end namespace llvm
#endif // LLVM_DEBUGINFO_DWARF_DWARFTYPEUNIT_H
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKFUNCTIONALITYTEST_H_
#define QMITKFUNCTIONALITYTEST_H_
#include <berryUITestCase.h>
#include <berryIWorkbenchWindow.h>
#include <berryIWorkbenchPage.h>
#include <CppUnit/TestCaller.h>
/**
* Test cases for the <code>QmitkFunctionality</code> API.
*/
class QmitkFunctionalityTest : public berry::UITestCase {
public:
friend class CppUnit::TestCaller<QmitkFunctionalityTest>;
QmitkFunctionalityTest(const std::string& testName);
static CppUnit::Test* Suite();
void TestOpenAndClose();
void TestOpenAndWindowClose();
protected:
berry::IWorkbenchWindow::Pointer fWindow;
berry::IWorkbenchPage::Pointer fPage;
void DoSetUp();
void DoTearDown();
};
#endif /* QMITKFUNCTIONALITYTEST_H_ */
|
/* quote.h - prototypes for quote.c
Copyright (C) 1998-2001, 2003, 2009-2017 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef QUOTE_H_
# define QUOTE_H_ 1
# include <stddef.h>
/* The quoting options used by quote_n and quote. Its type is incomplete,
so it's useful only in expressions like '"e_quoting_options'. */
extern struct quoting_options quote_quoting_options;
/* Return an unambiguous printable representation of ARG (of size
ARGSIZE), allocated in slot N, suitable for diagnostics. If
ARGSIZE is SIZE_MAX, use the string length of the argument for
ARGSIZE. */
char const *quote_n_mem (int n, char const *arg, size_t argsize);
/* Return an unambiguous printable representation of ARG (of size
ARGSIZE), suitable for diagnostics. If ARGSIZE is SIZE_MAX, use
the string length of the argument for ARGSIZE. */
char const *quote_mem (char const *arg, size_t argsize);
/* Return an unambiguous printable representation of ARG, allocated in
slot N, suitable for diagnostics. */
char const *quote_n (int n, char const *arg);
/* Return an unambiguous printable representation of ARG, suitable for
diagnostics. */
char const *quote (char const *arg);
#endif /* !QUOTE_H_ */
|
/*
* Generated by class-dump 3.1.1.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2006 by Steve Nygard.
*/
#import <BackRow/BRType.h>
@interface BRMediaType : BRType
{
BRMediaType *_derivedFrom;
}
+ (void)initialize;
+ (id)song;
+ (id)songPreview;
+ (id)cdSong;
+ (id)musicVideo;
+ (id)musicVideoPreview;
+ (id)podcast;
+ (id)movie;
+ (id)dvd;
+ (id)moviePreview;
+ (id)TVShow;
+ (id)TVShowPreview;
+ (id)audioBook;
+ (id)movieTrailer;
+ (id)ytVideo;
+ (id)booklet;
+ (id)interactiveBooklet;
+ (id)coachedAudio;
+ (id)photo;
+ (id)stingrayMovie;
- (void)dealloc;
- (void)setParentType:(id)fp8;
- (id)parentType;
@end
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TOOLS_GN_PARSER_H_
#define TOOLS_GN_PARSER_H_
#include <map>
#include <vector>
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "tools/gn/err.h"
#include "tools/gn/parse_tree.h"
class Parser;
typedef scoped_ptr<ParseNode> (Parser::*PrefixFunc)(Token token);
typedef scoped_ptr<ParseNode> (Parser::*InfixFunc)(scoped_ptr<ParseNode> left,
Token token);
extern const char kGrammar_Help[];
struct ParserHelper {
PrefixFunc prefix;
InfixFunc infix;
int precedence;
};
// Parses a series of tokens. The resulting AST will refer to the tokens passed
// to the input, so the tokens an the file data they refer to must outlive your
// use of the ParseNode.
class Parser {
public:
// Will return a null pointer and set the err on error.
static scoped_ptr<ParseNode> Parse(const std::vector<Token>& tokens,
Err* err);
// Alternative to parsing that assumes the input is an expression.
static scoped_ptr<ParseNode> ParseExpression(const std::vector<Token>& tokens,
Err* err);
// Alternative to parsing that assumes the input is a literal value.
static scoped_ptr<ParseNode> ParseValue(const std::vector<Token>& tokens,
Err* err);
private:
// Vector must be valid for lifetime of call.
Parser(const std::vector<Token>& tokens, Err* err);
~Parser();
scoped_ptr<ParseNode> ParseExpression();
// Parses an expression with the given precedence or higher.
scoped_ptr<ParseNode> ParseExpression(int precedence);
// |PrefixFunc|s used in parsing expressions.
scoped_ptr<ParseNode> Literal(Token token);
scoped_ptr<ParseNode> Name(Token token);
scoped_ptr<ParseNode> Group(Token token);
scoped_ptr<ParseNode> Not(Token token);
scoped_ptr<ParseNode> List(Token token);
scoped_ptr<ParseNode> BlockComment(Token token);
// |InfixFunc|s used in parsing expressions.
scoped_ptr<ParseNode> BinaryOperator(scoped_ptr<ParseNode> left, Token token);
scoped_ptr<ParseNode> IdentifierOrCall(scoped_ptr<ParseNode> left,
Token token);
scoped_ptr<ParseNode> Assignment(scoped_ptr<ParseNode> left, Token token);
scoped_ptr<ParseNode> Subscript(scoped_ptr<ParseNode> left, Token token);
scoped_ptr<ParseNode> DotOperator(scoped_ptr<ParseNode> left, Token token);
// Helper to parse a comma separated list, optionally allowing trailing
// commas (allowed in [] lists, not in function calls).
scoped_ptr<ListNode> ParseList(Token start_token,
Token::Type stop_before,
bool allow_trailing_comma);
scoped_ptr<ParseNode> ParseFile();
scoped_ptr<ParseNode> ParseStatement();
scoped_ptr<BlockNode> ParseBlock();
scoped_ptr<ParseNode> ParseCondition();
// Generates a pre- and post-order traversal of the tree.
void TraverseOrder(const ParseNode* root,
std::vector<const ParseNode*>* pre,
std::vector<const ParseNode*>* post);
// Attach comments to nearby syntax.
void AssignComments(ParseNode* file);
bool IsAssignment(const ParseNode* node) const;
bool IsStatementBreak(Token::Type token_type) const;
bool LookAhead(Token::Type type);
bool Match(Token::Type type);
Token Consume(Token::Type type, const char* error_message);
Token Consume(Token::Type* types,
size_t num_types,
const char* error_message);
Token Consume();
const Token& cur_token() const { return tokens_[cur_]; }
bool done() const { return at_end() || has_error(); }
bool at_end() const { return cur_ >= tokens_.size(); }
bool has_error() const { return err_->has_error(); }
std::vector<Token> tokens_;
std::vector<Token> line_comment_tokens_;
std::vector<Token> suffix_comment_tokens_;
static ParserHelper expressions_[Token::NUM_TYPES];
Err* err_;
// Current index into the tokens.
size_t cur_;
FRIEND_TEST_ALL_PREFIXES(Parser, BinaryOp);
FRIEND_TEST_ALL_PREFIXES(Parser, Block);
FRIEND_TEST_ALL_PREFIXES(Parser, Condition);
FRIEND_TEST_ALL_PREFIXES(Parser, Expression);
FRIEND_TEST_ALL_PREFIXES(Parser, FunctionCall);
FRIEND_TEST_ALL_PREFIXES(Parser, List);
FRIEND_TEST_ALL_PREFIXES(Parser, ParenExpression);
FRIEND_TEST_ALL_PREFIXES(Parser, UnaryOp);
DISALLOW_COPY_AND_ASSIGN(Parser);
};
#endif // TOOLS_GN_PARSER_H_
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_STMHAL_IRQ_H
#define MICROPY_INCLUDED_STMHAL_IRQ_H
// these states correspond to values from query_irq, enable_irq and disable_irq
#define IRQ_STATE_DISABLED (0x00000001)
#define IRQ_STATE_ENABLED (0x00000000)
// Enable this to get a count for the number of times each irq handler is called,
// accessible via pyb.irq_stats().
#define IRQ_ENABLE_STATS (0)
#if IRQ_ENABLE_STATS
extern uint32_t irq_stats[FPU_IRQn + 1];
#define IRQ_ENTER(irq) ++irq_stats[irq]
#define IRQ_EXIT(irq)
#else
#define IRQ_ENTER(irq)
#define IRQ_EXIT(irq)
#endif
static inline mp_uint_t query_irq(void) {
return __get_PRIMASK();
}
// enable_irq and disable_irq are defined inline in mpconfigport.h
#if __CORTEX_M >= 0x03
// irqs with a priority value greater or equal to "pri" will be disabled
// "pri" should be between 1 and 15 inclusive
static inline uint32_t raise_irq_pri(uint32_t pri) {
uint32_t basepri = __get_BASEPRI();
// If non-zero, the processor does not process any exception with a
// priority value greater than or equal to BASEPRI.
// When writing to BASEPRI_MAX the write goes to BASEPRI only if either:
// - Rn is non-zero and the current BASEPRI value is 0
// - Rn is non-zero and less than the current BASEPRI value
pri <<= (8 - __NVIC_PRIO_BITS);
__ASM volatile ("msr basepri_max, %0" : : "r" (pri) : "memory");
return basepri;
}
// "basepri" should be the value returned from raise_irq_pri
static inline void restore_irq_pri(uint32_t basepri) {
__set_BASEPRI(basepri);
}
#endif
MP_DECLARE_CONST_FUN_OBJ_0(pyb_wfi_obj);
MP_DECLARE_CONST_FUN_OBJ_0(pyb_disable_irq_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_enable_irq_obj);
MP_DECLARE_CONST_FUN_OBJ_0(pyb_irq_stats_obj);
// IRQ priority definitions.
//
// Lower number implies higher interrupt priority.
//
// The default priority grouping is set to NVIC_PRIORITYGROUP_4 in the
// HAL_Init function. This corresponds to 4 bits for the priority field
// and 0 bits for the sub-priority field (which means that for all intensive
// purposes that the sub-priorities below are ignored).
//
// While a given interrupt is being processed, only higher priority (lower number)
// interrupts will preempt a given interrupt. If sub-priorities are active
// then the sub-priority determines the order that pending interrupts of
// a given priority are executed. This is only meaningful if 2 or more
// interrupts of the same priority are pending at the same time.
//
// The priority of the SysTick timer is determined from the TICK_INT_PRIORITY
// value which is normally set to 0 in the stm32f4xx_hal_conf.h file.
//
// The following interrupts are arranged from highest priority to lowest
// priority to make it a bit easier to figure out.
// Priority Sub-Priority
// -------- ------------
//#def IRQ_PRI_SYSTICK 0
//#def IRQ_SUBPRI_SYSTICK 0
// The UARTs have no FIFOs, so if they don't get serviced quickly then characters
// get dropped. The handling for each character only consumes about 0.5 usec
#define IRQ_PRI_UART 1
#define IRQ_SUBPRI_UART 0
// Flash IRQ must be higher priority than interrupts of all those components
// that rely on the flash storage.
#define IRQ_PRI_FLASH 2
#define IRQ_SUBPRI_FLASH 0
// SDIO must be higher priority than DMA for SDIO DMA transfers to work.
#define IRQ_PRI_SDIO 4
#define IRQ_SUBPRI_SDIO 0
// DMA should be higher priority than USB, since USB Mass Storage calls
// into the sdcard driver which waits for the DMA to complete.
#define IRQ_PRI_DMA 5
#define IRQ_SUBPRI_DMA 0
#define IRQ_PRI_OTG_FS 6
#define IRQ_SUBPRI_OTG_FS 0
#define IRQ_PRI_OTG_HS 6
#define IRQ_SUBPRI_OTG_HS 0
#define IRQ_PRI_TIM5 6
#define IRQ_SUBPRI_TIM5 0
#define IRQ_PRI_CAN 7
#define IRQ_SUBPRI_CAN 0
// Interrupt priority for non-special timers.
#define IRQ_PRI_TIMX 13
#define IRQ_SUBPRI_TIMX 0
#define IRQ_PRI_EXTINT 14
#define IRQ_SUBPRI_EXTINT 0
// PENDSV should be at the lowst priority so that other interrupts complete
// before exception is raised.
#define IRQ_PRI_PENDSV 15
#define IRQ_SUBPRI_PENDSV 0
#define IRQ_PRI_RTC_WKUP 15
#define IRQ_SUBPRI_RTC_WKUP 0
#endif // MICROPY_INCLUDED_STMHAL_IRQ_H
|
/*
* Mikrotik RouterBOARD 1xx series support
*
* Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/etherdevice.h>
#include <asm/bootinfo.h>
#include <asm/mach-adm5120/adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_nand.h>
#include <asm/mach-adm5120/adm5120_board.h>
#include <asm/mach-adm5120/adm5120_platform.h>
#include <asm/mach-adm5120/adm5120_info.h>
#include <prom/routerboot.h>
extern struct platform_nand_data rb1xx_nand_data __initdata;
extern struct gpio_button rb1xx_gpio_buttons[] __initdata;
extern void rb1xx_add_device_flash(void) __init;
extern void rb1xx_add_device_nand(void) __init;
extern void rb1xx_generic_setup(void) __init;
|
/*****************************************************************************
* CoreInteraction.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011-2014 Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <vlc_common.h>
#import <vlc_interface.h>
@interface VLCCoreInteraction : NSObject {
int i_currentPlaybackRate;
mtime_t timeA, timeB;
float f_maxVolume;
}
+ (VLCCoreInteraction *)sharedInstance;
@property (readwrite) int volume;
@property (readonly, nonatomic) float maxVolume;
@property (readwrite) int playbackRate;
@property (nonatomic, readwrite) BOOL aspectRatioIsLocked;
@property (readonly) int durationOfCurrentPlaylistItem;
@property (readonly) NSURL * URLOfCurrentPlaylistItem;
@property (readonly) NSString * nameOfCurrentPlaylistItem;
@property (nonatomic, readwrite) BOOL mute;
- (void)playOrPause;
- (void)pause;
- (void)stop;
- (void)faster;
- (void)slower;
- (void)normalSpeed;
- (void)toggleRecord;
- (void)next;
- (void)previous;
- (void)forward; //LEGACY SUPPORT
- (void)backward; //LEGACY SUPPORT
- (void)forwardExtraShort;
- (void)backwardExtraShort;
- (void)forwardShort;
- (void)backwardShort;
- (void)forwardMedium;
- (void)backwardMedium;
- (void)forwardLong;
- (void)backwardLong;
- (void)repeatOne;
- (void)repeatAll;
- (void)repeatOff;
- (void)shuffle;
- (void)setAtoB;
- (void)resetAtoB;
- (void)updateAtoB;
- (void)volumeUp;
- (void)volumeDown;
- (void)toggleMute;
- (void)addSubtitlesToCurrentInput:(NSArray *)paths;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
- (void)toggleFullscreen;
- (BOOL)fixPreferences;
- (void)setVideoFilter: (const char *)psz_name on:(BOOL)b_on;
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter integer: (int)i_value;
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter float: (float)f_value;
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter string: (const char *)psz_value;
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter boolean: (BOOL)b_value;
@end
|
// XGetopt.h Version 1.2
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// This software is released into the public domain.
// You are free to use it in any way you like.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XGETOPT_H
#define XGETOPT_H
extern int optind, opterr;
extern char *optarg;
int getopt(int argc, char *argv[], char *optstring);
#endif //XGETOPT_H
|
/*
* This file is part of the libsigrok project.
*
* Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
#include <stdlib.h>
#include <check.h>
#include <libsigrok/libsigrok.h>
#include "lib.h"
/* Check whether at least one output module is available. */
START_TEST(test_output_available)
{
const struct sr_output_module **outputs;
outputs = sr_output_list();
fail_unless(outputs != NULL, "No output modules found.");
}
END_TEST
/* Check whether sr_output_id_get() works. */
START_TEST(test_output_id)
{
const struct sr_output_module **outputs;
const char *id;
outputs = sr_output_list();
id = sr_output_id_get(outputs[0]);
fail_unless(id != NULL, "No id found in output module.");
}
END_TEST
/* Check whether sr_output_name_get() works. */
START_TEST(test_output_name)
{
const struct sr_output_module **outputs;
const char *name;
outputs = sr_output_list();
name = sr_output_name_get(outputs[0]);
fail_unless(name != NULL, "No name found in output module.");
}
END_TEST
/* Check whether sr_output_description_get() works. */
START_TEST(test_output_desc)
{
const struct sr_output_module **outputs;
const char *desc;
outputs = sr_output_list();
desc = sr_output_description_get(outputs[0]);
fail_unless(desc != NULL, "No description found in output module.");
}
END_TEST
/* Check whether sr_output_find() works. */
START_TEST(test_output_find)
{
const struct sr_output_module *omod;
const char *id;
omod = sr_output_find("bits");
fail_unless(omod != NULL, "Couldn't find the 'bits' output module.");
id = sr_output_id_get(omod);
fail_unless(!strcmp(id, "bits"), "That is not the 'bits' module!");
}
END_TEST
/* Check whether sr_output_options_get() works. */
START_TEST(test_output_options)
{
const struct sr_option **opt;
opt = sr_output_options_get(sr_output_find("bits"));
fail_unless(opt != NULL, "Couldn't find 'bits' options.");
fail_unless(!strcmp((*opt)->id, "width"), "Wrong 'bits' option found!");
}
END_TEST
Suite *suite_output_all(void)
{
Suite *s;
TCase *tc;
s = suite_create("output-all");
tc = tcase_create("basic");
tcase_add_test(tc, test_output_available);
tcase_add_test(tc, test_output_id);
tcase_add_test(tc, test_output_name);
tcase_add_test(tc, test_output_desc);
tcase_add_test(tc, test_output_find);
tcase_add_test(tc, test_output_options);
suite_add_tcase(s, tc);
return s;
}
|
#include <stdio.h>
printf("Hello world\n");
int Count;
for (Count = -5; Count <= 5; Count++)
printf("Count = %d\n", Count);
printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there");
printf("Character 'A' is '%c'\n", 65);
printf("Character 'a' is '%c'\n", 'a');
void main() {}
|
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_IS_SYMMETRIC_H
#define IGL_IS_SYMMETRIC_H
#include "igl_inline.h"
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#include <Eigen/Sparse>
namespace igl
{
// Returns true if the given matrix is symmetric
// Inputs:
// A m by m matrix
// Returns true if the matrix is square and symmetric
template <typename AT>
IGL_INLINE bool is_symmetric(const Eigen::SparseMatrix<AT>& A);
// Inputs:
// epsilon threshold on L1 difference between A and A'
template <typename AT, typename epsilonT>
IGL_INLINE bool is_symmetric(const Eigen::SparseMatrix<AT>& A, const epsilonT epsilon);
template <typename DerivedA>
IGL_INLINE bool is_symmetric(
const Eigen::PlainObjectBase<DerivedA>& A);
}
#ifndef IGL_STATIC_LIBRARY
# include "is_symmetric.cpp"
#endif
#endif
|
// TODO : should remove this when not needed
// used for plugging into the rewrite module (taken from the rewrite module)
typedef struct {
ngx_array_t *codes; /* uintptr_t */
ngx_uint_t stack_size;
ngx_flag_t log;
ngx_flag_t uninitialized_variable_warn;
} ndk_http_rewrite_loc_conf_t;
extern ngx_module_t ngx_http_rewrite_module;
extern uintptr_t ndk_http_script_exit_code;
char * ndk_http_rewrite_value (ngx_conf_t *cf, ndk_http_rewrite_loc_conf_t *lcf,
ngx_str_t *value);
ngx_int_t ndk_http_rewrite_var (ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
#define ndk_http_script_exit (u_char *) &ndk_http_script_exit_code
|
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef V8DOMActivityLogger_h
#define V8DOMActivityLogger_h
#include "core/CoreExport.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/WTFString.h"
#include <v8.h>
namespace blink {
class KURL;
class CORE_EXPORT V8DOMActivityLogger {
USING_FAST_MALLOC(V8DOMActivityLogger);
public:
virtual ~V8DOMActivityLogger() { }
virtual void logGetter(const String& apiName) { }
virtual void logSetter(const String& apiName, const v8::Local<v8::Value>& newValue) { }
virtual void logMethod(const String& apiName, int argc, const v8::Local<v8::Value>* argv) { }
virtual void logEvent(const String& eventName, int argc, const String* argv) { }
// Associates a logger with the world identified by worldId (worlId may be 0
// identifying the main world) and extension ID. Extension ID is used to
// identify a logger for main world only (worldId == 0). If the world is not
// a main world, an extension ID is ignored.
//
// A renderer process may host multiple extensions when the browser hits the
// renderer process limit. In such case, we assign multiple extensions to
// the same main world of a renderer process. In order to distinguish the
// extensions and their activity loggers in the main world, we require an
// extension ID. Otherwise, extension activities may be logged under
// a wrong extension ID.
static void setActivityLogger(int worldId, const String&, PassOwnPtr<V8DOMActivityLogger>);
static V8DOMActivityLogger* activityLogger(int worldId, const String& extensionId);
static V8DOMActivityLogger* activityLogger(int worldId, const KURL&);
// Returns activity logger for current V8 context or 0.
static V8DOMActivityLogger* currentActivityLogger();
// Returns activity logger for current V8 context if the context belongs to
// an isolated world or 0.
static V8DOMActivityLogger* currentActivityLoggerIfIsolatedWorld();
};
} // namespace blink
#endif // V8DOMActivityLogger_h
|
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "GeneralVectorPostprocessor.h"
// Forward Declarations
class ElementsAlongPlane;
template <>
InputParameters validParams<ElementsAlongPlane>();
/**
* Get all of the elements that are intersected by a plane
*/
class ElementsAlongPlane : public GeneralVectorPostprocessor
{
public:
static InputParameters validParams();
ElementsAlongPlane(const InputParameters & parameters);
virtual void initialize() override;
/**
* Find the elements
*/
virtual void execute() override;
protected:
/// Point in the plane
const Point & _p0;
/// Normal vector to the plane
const Point & _normal;
/// The elements that intersect the plane
VectorPostprocessorValue & _elem_ids;
};
|
/******************************************************************************
Copyright (c) 2011, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include "bid_internal.h"
/*****************************************************************************
* BID128_llrintd
****************************************************************************/
/*
DESCRIPTION:
The llrint function rounds its argument to the nearest integer value of
type long long int, rounding according to the current rounding direction.
RETURN VALUE:
If the rounded value is outside the range of the return type or the
argument is infinity or NaN, the result is the largest negative value
and the invalid exception is signaled
EXCEPTIONS SIGNALED:
invalid and inexact
*/
#if DECIMAL_CALL_BY_REFERENCE
void
bid128_llrint (long long int *pres, BID_UINT128 *px
_RND_MODE_PARAM _EXC_FLAGS_PARAM _EXC_MASKS_PARAM _EXC_INFO_PARAM) {
BID_UINT128 x = *px;
#if !DECIMAL_GLOBAL_ROUNDING
unsigned int rnd_mode = *prnd_mode;
#endif
#else
RES_WRAPFN_DFP(long long int, bid128_llrint, 128);
long long int
bid128_llrint (BID_UINT128 x _RND_MODE_PARAM _EXC_FLAGS_PARAM
_EXC_MASKS_PARAM _EXC_INFO_PARAM) {
#endif
long long int res; // assume sizeof (long long) = 8
if (rnd_mode == BID_ROUNDING_TO_NEAREST)
BIDECIMAL_CALL1_NORND (bid128_to_int64_xrnint, res, x);
else if (rnd_mode == BID_ROUNDING_TIES_AWAY)
BIDECIMAL_CALL1_NORND (bid128_to_int64_xrninta, res, x);
else if (rnd_mode == BID_ROUNDING_DOWN)
BIDECIMAL_CALL1_NORND (bid128_to_int64_xfloor, res, x);
else if (rnd_mode == BID_ROUNDING_UP)
BIDECIMAL_CALL1_NORND (bid128_to_int64_xceil, res, x);
else // if (rnd_mode == BID_ROUNDING_TO_ZERO)
BIDECIMAL_CALL1_NORND (bid128_to_int64_xint, res, x);
BID_RETURN (res);
}
|
/*
* Copyright (c) 2014 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/NSObject.h>
@interface MethodCall : NSObject
- (int)plusX :(int)x andY: (int)y;
@end
|
/* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 15. February 2012
* $Revision: V1.1.0
*
* Project: CMSIS DSP Library
* Title: arm_sub_q15.c
*
* Description: Q15 vector subtraction.
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Version 1.1.0 2012/02/15
* Updated with more optimizations, bug fixes and minor API changes.
*
* Version 1.0.10 2011/7/15
* Big Endian support added and Merged M0 and M3/M4 Source code.
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.2 2010/11/11
* Documentation updated.
*
* Version 1.0.1 2010/10/05
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20
* Production release and review comments incorporated.
*
* Version 0.0.7 2010/06/10
* Misra-C changes done
* -------------------------------------------------------------------- */
#include "arm_math.h"
/**
* @ingroup groupMath
*/
/**
* @addtogroup BasicSub
* @{
*/
/**
* @brief Q15 vector subtraction.
* @param[in] *pSrcA points to the first input vector
* @param[in] *pSrcB points to the second input vector
* @param[out] *pDst points to the output vector
* @param[in] blockSize number of samples in each vector
* @return none.
*
* <b>Scaling and Overflow Behavior:</b>
* \par
* The function uses saturating arithmetic.
* Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.
*/
void arm_sub_q15(
q15_t * pSrcA,
q15_t * pSrcB,
q15_t * pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* loop counter */
#ifndef ARM_MATH_CM0
/* Run the below code for Cortex-M4 and Cortex-M3 */
q31_t inA1, inA2;
q31_t inB1, inB2;
/*loop Unrolling */
blkCnt = blockSize >> 2u;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the results in the destination buffer two samples at a time. */
inA1 = *__SIMD32(pSrcA)++;
inA2 = *__SIMD32(pSrcA)++;
inB1 = *__SIMD32(pSrcB)++;
inB2 = *__SIMD32(pSrcB)++;
*__SIMD32(pDst)++ = __QSUB16(inA1, inB1);
*__SIMD32(pDst)++ = __QSUB16(inA2, inB2);
/* Decrement the loop counter */
blkCnt--;
}
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
blkCnt = blockSize % 0x4u;
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the result in the destination buffer. */
*pDst++ = (q15_t) __QSUB16(*pSrcA++, *pSrcB++);
/* Decrement the loop counter */
blkCnt--;
}
#else
/* Run the below code for Cortex-M0 */
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the result in the destination buffer. */
*pDst++ = (q15_t) __SSAT(((q31_t) * pSrcA++ - *pSrcB++), 16);
/* Decrement the loop counter */
blkCnt--;
}
#endif /* #ifndef ARM_MATH_CM0 */
}
/**
* @} end of BasicSub group
*/
|
/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "miscstruct.h"
#ifdef XFree86LOADER
#include "xf86_ansic.h"
#endif
|
#ifndef __ASM_SH64_MODULE_H
#define __ASM_SH64_MODULE_H
/*
* This file contains the SH architecture specific module code.
*/
#define module_map(x) vmalloc(x)
#define module_unmap(x) vfree(x)
#define module_arch_init(x) (0)
#define arch_init_modules(x) do { } while (0)
#endif /* __ASM_SH64_MODULE_H */
|
/*
* linux/arch/sh/kernel/mach_keywest.c
*
* Machine vector for HSA KeyWest Evaluiation board
*
* Copyright (C) 2001 Lineo, Japan
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <asm/machvec.h>
#include <asm/rtc.h>
#include <asm/machvec_init.h>
#include <asm/io.h>
#include <asm/io_keywest.h>
#include <asm/irq.h>
/*
* The Machine Vector
*/
extern void heartbeat_keywest(void);
extern void setup_keywest(void);
extern void init_keywest_IRQ(void);
struct sh_machine_vector mv_keywest __initmv = {
mv_name: "Key West",
mv_nr_irqs: NR_IRQS, // Defined in <asm/irq.h>
mv_inb: keywest_inb,
mv_inw: keywest_inw,
mv_inl: keywest_inl,
mv_outb: keywest_outb,
mv_outw: keywest_outw,
mv_outl: keywest_outl,
mv_inb_p: keywest_inb_p,
mv_inw_p: keywest_inw,
mv_inl_p: keywest_inl,
mv_outb_p: keywest_outb_p,
mv_outw_p: keywest_outw,
mv_outl_p: keywest_outl,
mv_insb: keywest_insb,
mv_insw: keywest_insw,
mv_insl: keywest_insl,
mv_outsb: keywest_outsb,
mv_outsw: keywest_outsw,
mv_outsl: keywest_outsl,
mv_readb: generic_readb,
mv_readw: generic_readw,
mv_readl: generic_readl,
mv_writeb: generic_writeb,
mv_writew: generic_writew,
mv_writel: generic_writel,
mv_ioremap: generic_ioremap,
mv_iounmap: generic_iounmap,
mv_isa_port2addr: keywest_isa_port2addr,
mv_irq_demux: keywest_irq_demux,
mv_init_arch: setup_keywest,
mv_init_irq: init_keywest_IRQ,
mv_rtc_gettimeofday: sh_rtc_gettimeofday,
mv_rtc_settimeofday: sh_rtc_settimeofday,
};
ALIAS_MV(keywest)
|
/* Compute x^2 + y^2 - 1, without large cancellation error.
Copyright (C) 2012-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 <math.h>
#include <math_private.h>
#include <float.h>
#if FLT_EVAL_METHOD == 0
# include <sysdeps/ieee754/dbl-64/x2y2m1.c>
#else
/* Return X^2 + Y^2 - 1, computed without large cancellation error.
It is given that 1 > X >= Y >= epsilon / 2, and that either X >=
0.75 or Y >= 0.5. */
double
__x2y2m1 (double x, double y)
{
return (double) __x2y2m1l (x, y);
}
#endif
|
/***************************************************************************//**
* @file PinNames.h
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H
#include "CommonPinNames.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
EFM32_STANDARD_PIN_DEFINITIONS,
/* Starter Kit says LED0 and LED1, but mbed expects 1 and 2. This way using 1 and 2 or 0 and 1 will work. */
LED0 = PF4,
LED1 = PF5,
LED2 = LED0,
LED3 = LED0,
LED4 = LED1,
/* Push Buttons */
SW0 = PF6,
SW1 = PF7,
BTN0 = SW0,
BTN1 = SW1,
// Standardized button names
BUTTON1 = BTN0,
BUTTON2 = BTN1,
/* Expansion headers */
EXP3 = PC9,
EXP4 = PA6,
EXP5 = PD9,
EXP6 = PA7,
EXP7 = PB6,
EXP8 = PA8,
EXP9 = PB7,
EXP10 = PA9,
EXP11 = PB8,
EXP12 = PD10,
EXP13 = PD8,
EXP14 = PD11,
EXP15 = PC11,
EXP16 = PC10,
/* Serial (just some usable pins) */
SERIAL_TX = PA6,
SERIAL_RX = PA7,
/* Board Controller UART (USB)*/
USBTX = PA0,
USBRX = PA1,
/* Board Controller */
STDIO_UART_TX = USBTX,
STDIO_UART_RX = USBRX
} PinName;
#ifdef __cplusplus
}
#endif
#endif
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTCONCURRENT_COMPILERTEST_H
#define QTCONCURRENT_COMPILERTEST_H
#include <QtCore/qglobal.h>
#ifndef QT_NO_CONCURRENT
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Core)
#if defined (Q_CC_MSVC) && (_MSC_VER < 1300)
# define QT_TYPENAME
#else
# define QT_TYPENAME typename
#endif
namespace QtPrivate {
template<class T>
class HasResultType {
typedef char Yes;
typedef void *No;
template<typename U> static Yes test(int, const typename U::result_type * = 0);
template<typename U> static No test(double);
public:
enum { Value = (sizeof(test<T>(0)) == sizeof(Yes)) };
};
}
QT_END_NAMESPACE
QT_END_HEADER
#endif // QT_NO_CONCURRENT
#endif
|
/*
* virarch.h: architecture handling
*
* 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 __VIR_ARCH_H__
# define __VIR_ARCH_H__
# include "internal.h"
typedef enum {
VIR_ARCH_NONE,
VIR_ARCH_ALPHA, /* Alpha 64 BE http://en.wikipedia.org/wiki/DEC_Alpha */
VIR_ARCH_ARMV6L, /* ARMv6 32 LE http://en.wikipedia.org/wiki/ARM_architecture */
VIR_ARCH_ARMV7L, /* ARMv7 32 LE http://en.wikipedia.org/wiki/ARM_architecture */
VIR_ARCH_ARMV7B, /* ARMv7 32 BE http://en.wikipedia.org/wiki/ARM_architecture */
VIR_ARCH_AARCH64, /* ARMv8 64 LE http://en.wikipedia.org/wiki/ARM_architecture */
VIR_ARCH_CRIS, /* ETRAX 32 LE http://en.wikipedia.org/wiki/ETRAX_CRIS */
VIR_ARCH_I686, /* x86 32 LE http://en.wikipedia.org/wiki/X86 */
VIR_ARCH_ITANIUM, /* Itanium 64 LE http://en.wikipedia.org/wiki/Itanium */
VIR_ARCH_LM32, /* MilkyMist 32 BE http://en.wikipedia.org/wiki/Milkymist */
VIR_ARCH_M68K, /* m68k 32 BE http://en.wikipedia.org/wiki/Motorola_68000_family */
VIR_ARCH_MICROBLAZE, /* Microblaze 32 BE http://en.wikipedia.org/wiki/MicroBlaze */
VIR_ARCH_MICROBLAZEEL, /* Microblaze 32 LE http://en.wikipedia.org/wiki/MicroBlaze */
VIR_ARCH_MIPS, /* MIPS 32 BE http://en.wikipedia.org/wiki/MIPS_architecture */
VIR_ARCH_MIPSEL, /* MIPS 32 LE http://en.wikipedia.org/wiki/MIPS_architecture */
VIR_ARCH_MIPS64, /* MIPS 64 BE http://en.wikipedia.org/wiki/MIPS_architecture */
VIR_ARCH_MIPS64EL, /* MIPS 64 LE http://en.wikipedia.org/wiki/MIPS_architecture */
VIR_ARCH_OR32, /* OpenRisc 32 BE http://en.wikipedia.org/wiki/OpenRISC#QEMU_support */
VIR_ARCH_PARISC, /* PA-Risc 32 BE http://en.wikipedia.org/wiki/PA-RISC */
VIR_ARCH_PARISC64, /* PA-Risc 64 BE http://en.wikipedia.org/wiki/PA-RISC */
VIR_ARCH_PPC, /* PowerPC 32 BE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_PPCLE, /* PowerPC 32 LE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_PPC64, /* PowerPC 64 BE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_PPC64LE, /* PowerPC 64 LE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_PPCEMB, /* PowerPC 32 BE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_S390, /* S390 32 BE http://en.wikipedia.org/wiki/S390 */
VIR_ARCH_S390X, /* S390 64 BE http://en.wikipedia.org/wiki/S390x */
VIR_ARCH_SH4, /* SuperH4 32 LE http://en.wikipedia.org/wiki/SuperH */
VIR_ARCH_SH4EB, /* SuperH4 32 BE http://en.wikipedia.org/wiki/SuperH */
VIR_ARCH_SPARC, /* Sparc 32 BE http://en.wikipedia.org/wiki/Sparc */
VIR_ARCH_SPARC64, /* Sparc 64 BE http://en.wikipedia.org/wiki/Sparc */
VIR_ARCH_UNICORE32, /* UniCore 32 LE http://en.wikipedia.org/wiki/Unicore*/
VIR_ARCH_X86_64, /* x86 64 LE http://en.wikipedia.org/wiki/X86 */
VIR_ARCH_XTENSA, /* XTensa 32 LE http://en.wikipedia.org/wiki/Xtensa#Processor_Cores */
VIR_ARCH_XTENSAEB, /* XTensa 32 BE http://en.wikipedia.org/wiki/Xtensa#Processor_Cores */
VIR_ARCH_LAST,
} virArch;
# define ARCH_IS_X86(arch) ((arch) == VIR_ARCH_X86_64 ||\
(arch) == VIR_ARCH_I686)
# define ARCH_IS_PPC(arch) ((arch) == VIR_ARCH_PPC ||\
(arch) == VIR_ARCH_PPCLE ||\
(arch) == VIR_ARCH_PPC64 ||\
(arch) == VIR_ARCH_PPC64LE ||\
(arch) == VIR_ARCH_PPCEMB)
# define ARCH_IS_PPC64(arch) ((arch) == VIR_ARCH_PPC64 ||\
(arch) == VIR_ARCH_PPC64LE)
# define ARCH_IS_ARM(arch) ((arch) == VIR_ARCH_ARMV6L ||\
(arch) == VIR_ARCH_ARMV7L ||\
(arch) == VIR_ARCH_ARMV7B ||\
(arch) == VIR_ARCH_AARCH64)
# define ARCH_IS_S390(arch) ((arch) == VIR_ARCH_S390 ||\
(arch) == VIR_ARCH_S390X)
typedef enum {
VIR_ARCH_LITTLE_ENDIAN,
VIR_ARCH_BIG_ENDIAN,
} virArchEndian;
unsigned int virArchGetWordSize(virArch arch);
virArchEndian virArchGetEndian(virArch arch);
const char *virArchToString(virArch arch);
virArch virArchFromString(const char *name);
virArch virArchFromHost(void);
#endif /* __VIR_ARCH_H__ */
|
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
// STL includes
#include <string>
#include <set>
#include <iostream>
#include <algorithm>
// MOOSE includes
#include "DependencyResolver.h"
/**
* Interface for sorting dependent vectors of objects.
*/
class DependencyResolverInterface
{
public:
/**
* Constructor.
*/
DependencyResolverInterface() {}
/**
* Return a set containing the names of items requested by the object.
*/
virtual const std::set<std::string> & getRequestedItems() = 0;
/**
* Return a set containing the names of items owned by the object.
*/
virtual const std::set<std::string> & getSuppliedItems() = 0;
/**
* Given a vector, sort using the getRequested/SuppliedItems sets.
*/
template <typename T>
static void sort(typename std::vector<T> & vector);
/**
* A helper method for cyclic errors.
*/
template <typename T>
static void cyclicDependencyError(CyclicDependencyException<T> & e, const std::string & header);
};
template <typename T>
void
DependencyResolverInterface::sort(typename std::vector<T> & vector)
{
DependencyResolver<T> resolver;
typename std::vector<T>::iterator start = vector.begin();
typename std::vector<T>::iterator end = vector.end();
for (typename std::vector<T>::iterator iter = start; iter != end; ++iter)
{
const std::set<std::string> & requested_items = (*iter)->getRequestedItems();
for (typename std::vector<T>::iterator iter2 = start; iter2 != end; ++iter2)
{
if (iter == iter2)
continue;
const std::set<std::string> & supplied_items = (*iter2)->getSuppliedItems();
std::set<std::string> intersect;
std::set_intersection(requested_items.begin(),
requested_items.end(),
supplied_items.begin(),
supplied_items.end(),
std::inserter(intersect, intersect.end()));
// If the intersection isn't empty then there is a dependency here
if (!intersect.empty())
resolver.insertDependency(*iter, *iter2);
}
}
// Sort based on dependencies
std::stable_sort(start, end, resolver);
}
template <typename T>
void
DependencyResolverInterface::cyclicDependencyError(CyclicDependencyException<T> & e,
const std::string & header)
{
std::ostringstream oss;
oss << header << ":\n";
const typename std::multimap<T, T> & depends = e.getCyclicDependencies();
for (typename std::multimap<T, T>::const_iterator it = depends.begin(); it != depends.end(); ++it)
oss << (static_cast<T>(it->first))->name() << " -> " << (static_cast<T>(it->second))->name()
<< "\n";
mooseError(oss.str());
}
|
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef CONVECTIONDIFFUSIONACTION_H
#define CONVECTIONDIFFUSIONACTION_H
#include "Action.h"
class ConvectionDiffusionAction : public Action
{
public:
ConvectionDiffusionAction(const std::string & name, InputParameters params);
virtual void act();
};
template<>
InputParameters validParams<ConvectionDiffusionAction>();
#endif //CONVECTIONDIFFUSIONACTION_H
|
#pragma once
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#ifdef __cplusplus
extern "C" {
#endif
#define ReleaseIni(ih) if (ih) { IniUninitialize(ih); }
#define ReleaseNullIni(ih) if (ih) { IniUninitialize(ih); ih = NULL; }
typedef void* INI_HANDLE;
typedef const void* C_INI_HANDLE;
extern const int INI_HANDLE_BYTES;
struct INI_VALUE
{
LPCWSTR wzName;
LPCWSTR wzValue;
DWORD dwLineNumber;
};
HRESULT DAPI IniInitialize(
__out_bcount(INI_HANDLE_BYTES) INI_HANDLE* piHandle
);
void DAPI IniUninitialize(
__in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle
);
HRESULT DAPI IniSetOpenTag(
__inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in_z_opt LPCWSTR wzOpenTagPrefix,
__in_z_opt LPCWSTR wzOpenTagPostfix
);
HRESULT DAPI IniSetValueStyle(
__inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in_z_opt LPCWSTR wzValuePrefix,
__in_z_opt LPCWSTR wzValueSeparator
);
HRESULT DAPI IniSetCommentStyle(
__inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in_z_opt LPCWSTR wzLinePrefix
);
HRESULT DAPI IniParse(
__inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in LPCWSTR wzPath,
__out_opt FILE_ENCODING *pfeEncodingFound
);
HRESULT DAPI IniGetValueList(
__in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__deref_out_ecount_opt(pcValues) INI_VALUE** prgivValues,
__out DWORD *pcValues
);
HRESULT DAPI IniGetValue(
__in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in LPCWSTR wzValueName,
__deref_out_z LPWSTR* psczValue
);
HRESULT DAPI IniSetValue(
__in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in LPCWSTR wzValueName,
__in_z_opt LPCWSTR wzValue
);
HRESULT DAPI IniWriteFile(
__in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
__in_z_opt LPCWSTR wzPath,
__in FILE_ENCODING feOverrideEncoding
);
#ifdef __cplusplus
}
#endif
|
/*
* Copyright (c) 2012 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
#include "rtp_rtcp_defines.h"
#include "rtp_utility.h"
#include "typedefs.h"
#include "Bitrate.h"
#include "scoped_ptr.h"
namespace webrtc {
class ReceiverFEC;
class ModuleRtpRtcpImpl;
class CriticalSectionWrapper;
class RTPReceiverVideo {
public:
RTPReceiverVideo(const WebRtc_Word32 id,
ModuleRtpRtcpImpl* owner);
virtual ~RTPReceiverVideo();
ModuleRTPUtility::Payload* RegisterReceiveVideoPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 maxRate);
WebRtc_Word32 ParseVideoCodecSpecific(
WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength,
const RtpVideoCodecTypes videoType,
const bool isRED,
const WebRtc_UWord8* incomingRtpPacket,
const WebRtc_UWord16 incomingRtpPacketSize,
const WebRtc_Word64 nowMS);
virtual WebRtc_Word32 ReceiveRecoveredPacketCallback(
WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength);
void SetPacketOverHead(WebRtc_UWord16 packetOverHead);
protected:
virtual WebRtc_Word32 CallbackOfReceivedPayloadData(
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const WebRtcRTPHeader* rtpHeader) = 0;
virtual WebRtc_UWord32 TimeStamp() const = 0;
virtual WebRtc_UWord16 SequenceNumber() const = 0;
virtual WebRtc_UWord32 PayloadTypeToPayload(
const WebRtc_UWord8 payloadType,
ModuleRTPUtility::Payload*& payload) const = 0;
virtual bool RetransmitOfOldPacket(
const WebRtc_UWord16 sequenceNumber,
const WebRtc_UWord32 rtpTimeStamp) const = 0;
virtual WebRtc_Word8 REDPayloadType() const = 0;
WebRtc_Word32 SetCodecType(const RtpVideoCodecTypes videoType,
WebRtcRTPHeader* rtpHeader) const;
WebRtc_Word32 ParseVideoCodecSpecificSwitch(
WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength,
const RtpVideoCodecTypes videoType);
WebRtc_Word32 ReceiveGenericCodec(WebRtcRTPHeader *rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength);
WebRtc_Word32 ReceiveVp8Codec(WebRtcRTPHeader *rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength);
WebRtc_Word32 BuildRTPheader(const WebRtcRTPHeader* rtpHeader,
WebRtc_UWord8* dataBuffer) const;
private:
WebRtc_Word32 _id;
CriticalSectionWrapper* _criticalSectionReceiverVideo;
// FEC
bool _currentFecFrameDecoded;
ReceiverFEC* _receiveFEC;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
|
// Copyright (c) 2010 The WebM 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 __WEBMDSHOW_COMMON_MFSRCWRAP_HPP__
#define __WEBMDSHOW_COMMON_MFSRCWRAP_HPP__
namespace WebmMfUtil
{
enum MfState
{
MFSTATE_STOPPED = 0,
MFSTATE_STARTED = 1,
MFSTATE_PAUSED = 2,
MFSTATE_ERROR = 3
};
class ComDllWrapper;
class MfMediaStream;
class MfByteStreamHandlerWrapper : public IMFAsyncCallback
{
public:
static HRESULT Create(std::wstring dll_path, GUID mfobj_clsid,
MfByteStreamHandlerWrapper** ptr_bsh_wrapper);
virtual ~MfByteStreamHandlerWrapper();
HRESULT GetAudioMediaType(IMFMediaType** ptr_type) const;
HRESULT GetAudioSample(IMFSample** ptr_sample);
HRESULT GetVideoMediaType(IMFMediaType** ptr_type) const;
HRESULT GetVideoSample(IMFSample** ptr_sample);
HRESULT LoadMediaStreams();
HRESULT OpenURL(std::wstring url);
HRESULT Pause();
HRESULT Start(bool seeking, LONGLONG start_time);
HRESULT Stop();
UINT GetAudioStreamCount() const;
UINT GetVideoStreamCount() const;
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID iid, void** ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IMFAsyncCallback methods
STDMETHODIMP GetParameters(DWORD*, DWORD*);
STDMETHODIMP Invoke(IMFAsyncResult* pAsyncResult);
private:
_COM_SMARTPTR_TYPEDEF(IMFByteStreamHandler, IID_IMFByteStreamHandler);
_COM_SMARTPTR_TYPEDEF(IMFByteStream, IID_IMFByteStream);
_COM_SMARTPTR_TYPEDEF(IMFMediaEvent, IID_IMFMediaEvent);
_COM_SMARTPTR_TYPEDEF(IMFMediaEventGenerator, IID_IMFMediaEventGenerator);
_COM_SMARTPTR_TYPEDEF(IMFMediaSource, IID_IMFMediaSource);
_COM_SMARTPTR_TYPEDEF(IMFMediaStream, IID_IMFMediaStream);
_COM_SMARTPTR_TYPEDEF(IMFPresentationDescriptor,
IID_IMFPresentationDescriptor);
_COM_SMARTPTR_TYPEDEF(IMFMediaTypeHandler, IID_IMFMediaTypeHandler);
MfByteStreamHandlerWrapper();
HRESULT Create_(std::wstring dll_path, GUID mfobj_clsid);
HRESULT HandleMediaSourceEvent_(IMFMediaEventPtr& ptr_event);
HRESULT OnSourcePaused_(IMFMediaEventPtr& ptr_event);
HRESULT OnSourceSeeked_(IMFMediaEventPtr& ptr_event);
HRESULT OnSourceStarted_(IMFMediaEventPtr& ptr_event);
HRESULT OnSourceStopped_(IMFMediaEventPtr& ptr_event);
HRESULT OnNewStream_(IMFMediaEventPtr& ptr_event);
HRESULT OnUpdatedStream_(IMFMediaEventPtr& ptr_event);
HRESULT WaitForEvent_(MediaEventType expected_event_type);
HRESULT WaitForNewStreamEvents_();
HRESULT WaitForPausedEvents_();
HRESULT WaitForSeekedEvents_();
HRESULT WaitForStartedEvents_();
HRESULT WaitForStoppedEvents_();
HRESULT WaitForUpdatedStreamEvents_();
ComDllWrapper* ptr_com_dll_;
DWORD stream_count_;
EventWaiter open_event_;
EventWaiter media_source_event_;
HRESULT media_event_error_;
IMFByteStreamPtr ptr_byte_stream_;
IMFByteStreamHandlerPtr ptr_handler_;
IMFMediaEventGeneratorPtr ptr_event_queue_;
IMFMediaSourcePtr ptr_media_src_;
IMFPresentationDescriptorPtr ptr_pres_desc_;
MediaEventType expected_event_type_;
MediaEventType event_type_recvd_;
MfMediaStream* ptr_audio_stream_;
MfMediaStream* ptr_video_stream_;
MfState state_;
UINT audio_stream_count_;
UINT selected_stream_count_;
UINT video_stream_count_;
ULONG ref_count_;
DISALLOW_COPY_AND_ASSIGN(MfByteStreamHandlerWrapper);
};
} // WebmMfUtil namespace
#endif // __WEBMDSHOW_COMMON_MFSRCWRAP_HPP__
|
/*
* Copyright (c) 2000-2009, Eastman Kodak Company
* 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 Eastman Kodak Company 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.
*
*
* Portions of the Original Code are
* Copyright (c) 1988-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
*
* Creation Date: 07/14/2001
*
* Original Author:
* George Sotak george.sotak@kodak.com
*
* Contributor(s):
* Ricardo Rosario ricardo.rosario@kodak.com
*/
#ifndef _EXIF_STRIP_IMAGE_H_
#define _EXIF_STRIP_IMAGE_H_
#include "ExifConf.h"
#include "ExifTypeDefs.h"
#include "ExifErrorCodes.h"
class ExifIO ;
class ExifIFD ;
/*!
\author George Sotak <george.sotak@kodak.com>
\date Mon Jan 21 17:03:38 2002
\brief Provides the functionality to read/write uncompressed thumbnails
This class is used internally by ExifIFD to write uncompressed thumbnails.
Compressed thumbnails are done with ExifJpegImage.
*/
class ExifStripImage
{
public:
//! Constructor
/*!
\param tdir Pointer to the IFD object containing this image.
\param tio Pointer to the TiffIO object.
*/
ExifStripImage(ExifStatus& status, ExifIFD* tdir, ExifIO* tio) ;
//! Destructor
~ExifStripImage() ;
//! Write the image
ExifStatus writeImage( ExifImageDesc &imgDesc ) ;
//! Read the image
ExifStatus readImage( ExifImageDesc &imgDesc ) ;
//! Write out a single scanline
/*!
\param buf Data buffer.
\param row The row number of the scanline.
\param sample Indicate which band of data.
\return 1 if succeed; otherwise zero.
*/
ExifStatus writeScanline(tdata_t buf, exif_uint32 row,
tsample_t sample = 0);
// Read in a specified scanline
/*!
\param buf Data buffer.
\param row The row number of the scanline.
\param sample Indicate which band of data.
\return 1 if succeed; otherwise zero.
*/
ExifStatus readScanline(tdata_t buf, exif_uint32 row, tsample_t sample = 0);
protected:
ExifStatus init();
// Write the supplied data to the specified strip.
//!param: strip - Strip number.
//!param: data - Data buffer.
//!param: cc - The count of data in byte.
//!return: The number of bytes wrote.
exif_int32 writeRawStrip(exif_uint32 strip, tdata_t data, exif_int32 cc);
// Compute which strip a (row, sample) value is in.
//!param: row - Row number.
//!param: sample - Sample number.
exif_uint32 computeStrip(exif_uint32 row, tsample_t sample, ExifStatus& errRtn);
// Compute the number of bytes in a variable height, row-aligned strip.
//!return: Size in bytes
exif_int32 vStripSize(exif_uint32 nrows);
// Compute the number of bytes in a (row-aligned) strip.
//!return: Size in bytes
exif_int32 stripSize();
// Setup strip/tile offsets
int setupOffsets();
ExifStatus writeCheck(int tiles);
// Append to strip/tile
ExifStatus appendToStrip(exif_uint32 strip, tdata_t data, exif_int32 cc);
// Grow strips/tiles
int growStrips(int delta);
//!i: methods for reading
ExifStatus checkRead(int tiles);
void reverseBits( tdata_t buf, tsize_t nBytes ) ;
private:
//!i: data members
ExifIFD* mExifdir;
ExifIO* mExifio;
exif_uint32 mStripsperimage;
exif_uint32 mNStrips; // size of the strip/tile offset
// array, can grow
exif_int32 mScanlinesize;
exif_uint32 mCurstrip; /* current strip for read/write */
};
#endif // _EXIF_STRIP_IMAGE_H_
|
/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the SCEA Shared Source License, Version 1.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://research.scea.com/scea_shared_source_license.html
*
* 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 __domVertices_h__
#define __domVertices_h__
#include <dae/daeDocument.h>
#include <dom/domTypes.h>
#include <dom/domElements.h>
#include <dom/domExtra.h>
#include <dom/domInputLocal.h>
class DAE;
/**
* The vertices element declares the attributes and identity of mesh-vertices.
* The vertices element describes mesh-vertices in a mesh geometry. The mesh-vertices
* represent the position (identity) of the vertices comprising the mesh
* and other vertex attributes that are invariant to tessellation.
*/
class domVertices : public daeElement
{
public:
virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::VERTICES; }
static daeInt ID() { return 628; }
virtual daeInt typeID() const { return ID(); }
protected: // Attributes
/**
* The id attribute is a text string containing the unique identifier of
* this element. This value must be unique within the instance document.
* Required attribute.
*/
xsID attrId;
/**
* The name attribute is the text string name of this element. Optional attribute.
*/
xsNCName attrName;
protected: // Elements
/**
* The input element must occur at least one time. These inputs are local
* inputs. @see domInput
*/
domInputLocal_Array elemInput_array;
/**
* The extra element may appear any number of times. @see domExtra
*/
domExtra_Array elemExtra_array;
public: //Accessors and Mutators
/**
* Gets the id attribute.
* @return Returns a xsID of the id attribute.
*/
xsID getId() const { return attrId; }
/**
* Sets the id attribute.
* @param atId The new value for the id attribute.
*/
void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
if( _document != NULL ) _document->changeElementID( this, attrId );
}
/**
* Gets the name attribute.
* @return Returns a xsNCName of the name attribute.
*/
xsNCName getName() const { return attrName; }
/**
* Sets the name attribute.
* @param atName The new value for the name attribute.
*/
void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
/**
* Gets the input element array.
* @return Returns a reference to the array of input elements.
*/
domInputLocal_Array &getInput_array() { return elemInput_array; }
/**
* Gets the input element array.
* @return Returns a constant reference to the array of input elements.
*/
const domInputLocal_Array &getInput_array() const { return elemInput_array; }
/**
* Gets the extra element array.
* @return Returns a reference to the array of extra elements.
*/
domExtra_Array &getExtra_array() { return elemExtra_array; }
/**
* Gets the extra element array.
* @return Returns a constant reference to the array of extra elements.
*/
const domExtra_Array &getExtra_array() const { return elemExtra_array; }
protected:
/**
* Constructor
*/
domVertices(DAE& dae) : daeElement(dae), attrId(), attrName(), elemInput_array(), elemExtra_array() {}
/**
* Destructor
*/
virtual ~domVertices() {}
/**
* Overloaded assignment operator
*/
virtual domVertices &operator=( const domVertices &cpy ) { (void)cpy; return *this; }
public: // STATIC METHODS
/**
* Creates an instance of this class and returns a daeElementRef referencing it.
* @return a daeElementRef referencing an instance of this object.
*/
static DLLSPEC daeElementRef create(DAE& dae);
/**
* Creates a daeMetaElement object that describes this element in the meta object reflection framework.
* If a daeMetaElement already exists it will return that instead of creating a new one.
* @return A daeMetaElement describing this COLLADA element.
*/
static DLLSPEC daeMetaElement* registerElement(DAE& dae);
};
#endif
|
//******************************************************************************
//
// Copyright (c) 2015 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.
//
//******************************************************************************
#import <Foundation/NSObject.h>
@interface NSObject (NSScriptWhoseTests)
- (BOOL)isEqualTo:other;
@end
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2013 Linaro Limited
* Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
* Copyright (C) 2017 Andes Technology Corporation
*/
#include <linux/ftrace.h>
/*
* Most of this file is copied from arm64.
*/
void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
unsigned long frame_pointer)
{
unsigned long return_hooker = (unsigned long)&return_to_handler;
unsigned long old;
struct ftrace_graph_ent trace;
int err;
if (unlikely(atomic_read(¤t->tracing_graph_pause)))
return;
/*
* We don't suffer access faults, so no extra fault-recovery assembly
* is needed here.
*/
old = *parent;
trace.func = self_addr;
trace.depth = current->curr_ret_stack + 1;
if (!ftrace_graph_entry(&trace))
return;
err = ftrace_push_return_trace(old, self_addr, &trace.depth,
frame_pointer, NULL);
if (err == -EBUSY)
return;
*parent = return_hooker;
}
|
/*
* Copyright (c) 2013-2015 TRUSTONIC LIMITED
* 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.
*/
#ifndef __DCITUI_H__
#define __DCITUI_H__
/**< Responses have bit 31 set */
#define RSP_ID_MASK (1U << 31)
#define RSP_ID(cmd_id) (((uint32_t)(cmd_id)) | RSP_ID_MASK)
#define IS_CMD(cmd_id) ((((uint32_t)(cmd_id)) & RSP_ID_MASK) == 0)
#define IS_RSP(cmd_id) ((((uint32_t)(cmd_id)) & RSP_ID_MASK) == RSP_ID_MASK)
#define CMD_ID_FROM_RSP(rsp_id) (rsp_id & (~RSP_ID_MASK))
/**
* Return codes of driver commands.
*/
#define TUI_DCI_OK 0x00030000
#define TUI_DCI_ERR_UNKNOWN_CMD 0x00030001
#define TUI_DCI_ERR_NOT_SUPPORTED 0x00030002
#define TUI_DCI_ERR_INTERNAL_ERROR 0x00030003
#define TUI_DCI_ERR_NO_RESPONSE 0x00030004
#define TUI_DCI_ERR_BAD_PARAMETERS 0x00030005
#define TUI_DCI_ERR_NO_EVENT 0x00030006
#define TUI_DCI_ERR_OUT_OF_DISPLAY 0x00030007
/* ... add more error codes when needed */
/**
* Notification ID's for communication Trustlet Connector -> Driver.
*/
#define NOT_TUI_NONE 0
/* NWd system event that closes the current TUI session*/
#define NOT_TUI_CANCEL_EVENT 1
/**
* Command ID's for communication Driver -> Trustlet Connector.
*/
#define CMD_TUI_SW_NONE 0
/* SWd request to NWd to start the TUI session */
#define CMD_TUI_SW_OPEN_SESSION 1
/* SWd request to NWd to close the TUI session */
#define CMD_TUI_SW_CLOSE_SESSION 2
/* SWd request to NWd stop accessing display controller */
#define CMD_TUI_SW_STOP_DISPLAY 3
/**
* Maximum data length.
*/
#define MAX_DCI_DATA_LEN (1024*100)
/* Command payload */
struct tui_alloc_data_t {
uint32_t alloc_size;
uint32_t num_of_buff;
};
union dci_cmd_payload_t {
struct tui_alloc_data_t alloc_data;
};
/* Command */
struct dci_command_t {
uint32_t id;
union dci_cmd_payload_t payload;
};
/* TUI frame buffer (output from NWd) */
struct tui_alloc_buffer_t {
uint64_t pa;
};
#define MAX_DCI_BUFFER_NUMBER 4
/* Response */
struct dci_response_t {
uint32_t id; /* must be command ID | RSP_ID_MASK */
uint32_t return_code;
struct tui_alloc_buffer_t alloc_buffer[MAX_DCI_BUFFER_NUMBER];
};
/* DCI buffer */
struct tui_dci_msg_t {
uint32_t nwd_notif; /* Notification from TlcTui to DrTui */
struct dci_command_t cmd_nwd; /* Command from DrTui to TlcTui */
struct dci_response_t nwd_rsp; /* Response from TlcTui to DrTui */
};
/**
* Driver UUID. Update accordingly after reserving UUID
*/
#define DR_TUI_UUID { { 0xff, 0xff, 0xff, 0xff, 0xd0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x14 } }
#endif /* __DCITUI_H__ */
|
/**************************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#define CAML_INTERNALS
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/osdeps.h>
#include "unixsupport.h"
CAMLprim value unix_execv(value path, value args)
{
char_os * wpath;
char_os ** argv;
caml_unix_check_path(path, "execv");
argv = cstringvect(args, "execv");
wpath = caml_stat_strdup_to_os(String_val(path));
(void) execv_os(wpath, EXECV_CAST argv);
caml_stat_free(wpath);
cstringvect_free(argv);
uerror("execv", path);
return Val_unit; /* never reached, but suppress warnings */
/* from smart compilers */
}
|
/*
* Private header file for the (dumb) serial driver
*
* Copyright (C) 1997 by Theodore Ts'o.
*
* Redistribution of this file is permitted under the terms of the GNU
* Public License (GPL)
*/
#ifndef _LINUX_SERIALP_H
#define _LINUX_SERIALP_H
/*
* This is our internal structure for each serial port's state.
*
* Many fields are paralleled by the structure used by the serial_struct
* structure.
*
* For definitions of the flags field, see tty.h
*/
#include <linux/config.h>
#include <linux/termios.h>
#include <linux/tqueue.h>
#include <linux/circ_buf.h>
#include <linux/wait.h>
#if (LINUX_VERSION_CODE < 0x020300)
/* Unfortunate, but Linux 2.2 needs async_icount defined here and
* it got moved in 2.3 */
#include <linux/serial.h>
#endif
struct serial_state {
int magic;
int baud_base;
unsigned long port;
int irq;
int flags;
int hub6;
int type;
int line;
int revision; /* Chip revision (950) */
int xmit_fifo_size;
int custom_divisor;
int count;
u8 *iomem_base;
u16 iomem_reg_shift;
unsigned short close_delay;
unsigned short closing_wait; /* time to wait before closing */
struct async_icount icount;
struct termios normal_termios;
struct termios callout_termios;
int io_type;
struct async_struct *info;
struct pci_dev *dev;
};
struct async_struct {
int magic;
unsigned long port;
int hub6;
int flags;
int xmit_fifo_size;
struct serial_state *state;
struct tty_struct *tty;
int read_status_mask;
int ignore_status_mask;
int timeout;
int quot;
int x_char; /* xon/xoff character */
int close_delay;
unsigned short closing_wait;
unsigned short closing_wait2;
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
int LCR; /* Line control register */
int ACR; /* 16950 Additional Control Reg. */
unsigned long event;
unsigned long last_active;
int line;
int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
struct circ_buf xmit;
spinlock_t xmit_lock;
u8 *iomem_base;
u16 iomem_reg_shift;
int io_type;
struct tq_struct tqueue;
#ifdef DECLARE_WAITQUEUE
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
wait_queue_head_t delta_msr_wait;
#else
struct wait_queue *open_wait;
struct wait_queue *close_wait;
struct wait_queue *delta_msr_wait;
#endif
struct async_struct *next_port; /* For the linked list */
struct async_struct *prev_port;
};
#define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
#define SERIAL_MAGIC 0x5301
#define SSTATE_MAGIC 0x5302
/*
* Events are used to schedule things to happen at timer-interrupt
* time, instead of at rs interrupt time.
*/
#define RS_EVENT_WRITE_WAKEUP 0
/*
* Multiport serial configuration structure --- internal structure
*/
struct rs_multiport_struct {
int port1;
unsigned char mask1, match1;
int port2;
unsigned char mask2, match2;
int port3;
unsigned char mask3, match3;
int port4;
unsigned char mask4, match4;
int port_monitor;
};
#if defined(__alpha__) && !defined(CONFIG_PCI)
/*
* Digital did something really horribly wrong with the OUT1 and OUT2
* lines on at least some ALPHA's. The failure mode is that if either
* is cleared, the machine locks up with endless interrupts.
*/
#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
#else
#define ALPHA_KLUDGE_MCR 0
#endif
/*
* Structures and definitions for PCI support
*/
struct pci_dev;
struct pci_board {
int flags;
int num_ports;
int base_baud;
int uart_offset;
int reg_shift;
int (*init_fn)(struct pci_dev *dev, struct pci_board *board,
int enable);
int first_uart_offset;
};
struct pci_board_inst {
struct pci_board board;
struct pci_dev *dev;
};
extern int pci_siig10x_fn(struct pci_dev *dev, struct pci_board *board, int enable);
extern int pci_siig20x_fn(struct pci_dev *dev, struct pci_board *board, int enable);
#ifndef PCI_ANY_ID
#define PCI_ANY_ID (~0)
#endif
#define SPCI_FL_BASE_MASK 0x0007
#define SPCI_FL_BASE0 0x0000
#define SPCI_FL_BASE1 0x0001
#define SPCI_FL_BASE2 0x0002
#define SPCI_FL_BASE3 0x0003
#define SPCI_FL_BASE4 0x0004
#define SPCI_FL_GET_BASE(x) (x & SPCI_FL_BASE_MASK)
#define SPCI_FL_IRQ_MASK (0x0007 << 4)
#define SPCI_FL_IRQBASE0 (0x0000 << 4)
#define SPCI_FL_IRQBASE1 (0x0001 << 4)
#define SPCI_FL_IRQBASE2 (0x0002 << 4)
#define SPCI_FL_IRQBASE3 (0x0003 << 4)
#define SPCI_FL_IRQBASE4 (0x0004 << 4)
#define SPCI_FL_GET_IRQBASE(x) ((x & SPCI_FL_IRQ_MASK) >> 4)
/* Use successive BARs (PCI base address registers),
else use offset into some specified BAR */
#define SPCI_FL_BASE_TABLE 0x0100
/* Use successive entries in the irq resource table */
#define SPCI_FL_IRQ_TABLE 0x0200
/* Use the irq resource table instead of dev->irq */
#define SPCI_FL_IRQRESOURCE 0x0400
/* Use the Base address register size to cap number of ports */
#define SPCI_FL_REGION_SZ_CAP 0x0800
/* Do not use irq sharing for this device */
#define SPCI_FL_NO_SHIRQ 0x1000
/* This is a PNP device */
#define SPCI_FL_ISPNP 0x2000
#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE|SPCI_FL_ISPNP)
#endif /* _LINUX_SERIAL_H */
|
/* PR middle-end/36858 */
/* { dg-do run } */
/* { dg-options "-w" { target { lp64 } } } */
/* { dg-options "-w" { target { llp64 } } } */
/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" { target { ilp32 } } } */
/* { dg-require-effective-target sse2 } */
#include "sse2-check.h"
#include <stdarg.h>
#include <emmintrin.h>
int
__attribute__((noinline))
test (int a, ...)
{
return a;
}
__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
int
__attribute__((noinline))
foo (void)
{
return test (1, n1);
}
static void
__attribute__((noinline))
sse2_test (void)
{
if (foo () != 1)
abort ();
}
|
/* asn1.h
*
* Some very limited asn.1 support.
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2005 Niels Möller
*
* The nettle 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 nettle 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 nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#ifndef NETTLE_ASN1_H_INCLUDED
#define NETTLE_ASN1_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define asn1_der_iterator_first nettle_asn1_der_iterator_first
#define asn1_der_iterator_next nettle_asn1_der_iterator_next
#define asn1_der_decode_constructed nettle_asn1_der_decode_constructed
#define asn1_der_decode_constructed_last nettle_asn1_der_decode_constructed_last
#define asn1_der_decode_bitstring nettle_asn1_der_decode_bitstring
#define asn1_der_decode_bitstring_last nettle_asn1_der_decode_bitstring_last
#define asn1_der_get_uint32 nettle_asn1_der_get_uint32
#define asn1_der_get_bignum nettle_asn1_der_get_bignum
/* enum asn1_type keeps the class number and the constructive in bits
13-14, and the constructive flag in bit 12. The remaining 14 bits
are the tag (although currently, only tags in the range 0-30 are
supported). */
enum
{
ASN1_TYPE_CONSTRUCTED = 1 << 12,
ASN1_CLASS_UNIVERSAL = 0,
ASN1_CLASS_APPLICATION = 1 << 13,
ASN1_CLASS_CONTEXT_SPECIFIC = 2 << 13,
ASN1_CLASS_PRIVATE = 3 << 13,
ASN1_CLASS_MASK = 3 << 13,
ASN1_CLASS_SHIFT = 13,
};
enum asn1_type
{
ASN1_BOOLEAN = 1,
ASN1_INTEGER = 2,
ASN1_BITSTRING = 3,
ASN1_OCTETSTRING = 4,
ASN1_NULL = 5,
ASN1_IDENTIFIER = 6,
ASN1_REAL = 9,
ASN1_ENUMERATED = 10,
ASN1_UTF8STRING = 12,
ASN1_SEQUENCE = 16 | ASN1_TYPE_CONSTRUCTED,
ASN1_SET = 17 | ASN1_TYPE_CONSTRUCTED,
ASN1_PRINTABLESTRING = 19,
ASN1_TELETEXSTRING = 20,
ASN1_IA5STRING = 22,
ASN1_UTC = 23,
ASN1_UNIVERSALSTRING = 28,
ASN1_BMPSTRING = 30,
};
enum asn1_iterator_result
{
ASN1_ITERATOR_ERROR,
ASN1_ITERATOR_PRIMITIVE,
ASN1_ITERATOR_CONSTRUCTED,
ASN1_ITERATOR_END,
};
/* Parsing DER objects. */
struct asn1_der_iterator
{
unsigned buffer_length;
const uint8_t *buffer;
/* Next object to parse. */
unsigned pos;
enum asn1_type type;
/* Pointer to the current object */
unsigned length;
const uint8_t *data;
};
/* Initializes the iterator. */
enum asn1_iterator_result
asn1_der_iterator_first(struct asn1_der_iterator *iterator,
unsigned length, const uint8_t *input);
enum asn1_iterator_result
asn1_der_iterator_next(struct asn1_der_iterator *iterator);
/* Starts parsing of a constructed object. */
enum asn1_iterator_result
asn1_der_decode_constructed(struct asn1_der_iterator *i,
struct asn1_der_iterator *contents);
/* For the common case that we have a sequence at the end of the
object. Checks that the current object is the final one, and then
reinitializes the iterator to parse its ontents. */
enum asn1_iterator_result
asn1_der_decode_constructed_last(struct asn1_der_iterator *i);
enum asn1_iterator_result
asn1_der_decode_bitstring(struct asn1_der_iterator *i,
struct asn1_der_iterator *contents);
enum asn1_iterator_result
asn1_der_decode_bitstring_last(struct asn1_der_iterator *i);
/* All these functions return 1 on success, 0 on failure */
int
asn1_der_get_uint32(struct asn1_der_iterator *i,
uint32_t *x);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ASN1_H_INCLUDED */
|
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* 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: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* Prototypes missing in Digital UNIX 4.x */
int snprintf(char *, size_t, const char *, ...);
int vsnprintf(char *, size_t, const char *, va_list);
int pfopen(char *, int);
|
/*
* Copyright (c) 2018-2019 Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_DRIVERS_WATCHDOG_TESTS_H
#define MBED_DRIVERS_WATCHDOG_TESTS_H
#if DEVICE_WATCHDOG
/** Test Watchdog max_timeout validity
*
* Given a device supporting Watchdog driver API,
* when @a Watchdog::get_max_timeout() is called,
* then the returned value is greater than 1.
*/
void test_max_timeout_is_valid();
/** Test Watchdog stop
*
* Given a device without a support for the @a disable_watchdog feature,
* when @a Watchdog::stop() is called,
* then false is returned.
*
* Otherwise, given the device with @a disable_watchdog feature support:
*
* Given the Watchdog is *NOT* running,
* when @a Watchdog::stop() is called,
* then false is returned.
*
* Given the Watchdog is running,
* when @a Watchdog::stop() is called before the timeout expires,
* then true is returned and the device is not restarted.
*
* Given the Watchdog is *NOT* running (it has already been stopped),
* when @a Watchdog::stop() is called,
* then false is returned.
*/
void test_stop();
/** Test Watchdog start multiple times
*
* Given a set of unique timeout values,
* when Watchdog::start(T) is called for each value T,
* then, for every T, Watchdog::start() returns true
* and Watchdog::get_timeout() returns an actual timeout value R
* and T <= R < 2 * T.
*/
void test_restart();
/** Test Watchdog start with a valid config
*
* Given a value of T ms which is within supported Watchdog timeout range,
* when Watchdog::start(T) is called,
* then true is returned
* and Watchdog::get_timeout() returns an actual timeout value R
* and T <= R < 2 * T.
*/
template<uint32_t timeout_ms>
void test_start();
/** Test Watchdog start with max_timeout
*
* Given max_timeout value returned by @a Watchdog::get_max_timeout(),
* when @a Watchdog::start(max_timeout) is called,
* then true is returned
* and @a Watchdog::get_timeout() returns max_timeout.
*/
void test_start_max_timeout();
#endif
#endif
|
/* Multiple versions of strncasecmp_l.
Copyright (C) 2013-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/>. */
#if IS_IN (libc)
# include <string.h>
# define strncasecmp_l __strncasecmp_l_ppc
extern __typeof (__strncasecmp_l) __strncasecmp_l_ppc attribute_hidden;
extern __typeof (__strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
#endif
#include <string/strncase_l.c>
#undef strncasecmp_l
#if IS_IN (libc)
# include <shlib-compat.h>
# include "init-arch.h"
/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ifunc symbol properly. */
extern __typeof (__strncasecmp_l) __libc_strncasecmp_l;
libc_ifunc (__libc_strncasecmp_l,
(hwcap & PPC_FEATURE_HAS_VSX)
? __strncasecmp_l_power7
: __strncasecmp_l_ppc);
weak_alias (__libc_strncasecmp_l, strncasecmp_l)
#endif
|
/**
*
* \file
*
* \brief SAM Advanced Encryption Standard driver.
*
* This file defines a useful set of functions for the AES on SAM devices.
*
* Copyright (c) 2014-2016 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include "aes.h"
#include "aes_callback.h"
/** \internal Max number of callback type. */
#define AES_CALLBACK_TYPE_NUM 2
/**
* \internal
* \brief AES callback function pointer
*/
aes_callback_t aes_callback_pointer[AES_CALLBACK_TYPE_NUM]={NULL,NULL};
enum status_code aes_register_callback(
const aes_callback_t callback,
const enum aes_callback_type type)
{
if (type >= AES_CALLBACK_TYPE_NUM){
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
aes_callback_pointer[type] = callback;
return STATUS_OK;
}
enum status_code aes_unregister_callback(
const aes_callback_t callback,
const enum aes_callback_type type)
{
if (type >= AES_CALLBACK_TYPE_NUM){
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
aes_callback_pointer[type] = NULL;
return STATUS_OK;
}
/**
* \internal The AES interrupt handler.
*/
void AES_Handler(void)
{
uint32_t status = AES->INTFLAG.reg;
if (status & AES_INTFLAG_ENCCMP) {
if (aes_callback_pointer[AES_CALLBACK_ENCRYPTION_COMPLETE]) {
AES->INTFLAG.reg = AES_INTFLAG_ENCCMP;
aes_callback_pointer[AES_CALLBACK_ENCRYPTION_COMPLETE]();
}
}
if (status & AES_INTFLAG_GFMCMP) {
if (aes_callback_pointer[AES_CALLBACK_ENCRYPTION_COMPLETE]) {
AES->INTFLAG.reg = AES_INTFLAG_GFMCMP;
aes_callback_pointer[AES_CALLBACK_ENCRYPTION_COMPLETE]();
}
}
}
|
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkTransparentShader_DEFINED
#define SkTransparentShader_DEFINED
#include "SkShader.h"
class SK_API SkTransparentShader : public SkShader {
public:
SkTransparentShader() {}
virtual size_t contextSize() const SK_OVERRIDE;
class TransparentShaderContext : public SkShader::Context {
public:
TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&);
virtual ~TransparentShaderContext();
virtual uint32_t getFlags() const SK_OVERRIDE;
virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
private:
const SkBitmap* fDevice;
typedef SkShader::Context INHERITED;
};
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
protected:
virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE;
// we don't need to flatten anything at all
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE {}
private:
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
#endif
typedef SkShader INHERITED;
};
#endif
|
/*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved. Released under a BSD
license as described in the file LICENSE.
*/
#pragma once
#include "vw.h"
#include "allreduce.h"
template <class T, void(*f)(T&, const T&)> void all_reduce(vw& all, T* buffer, const size_t n)
{ switch (all.all_reduce_type)
{ case AllReduceType::Socket:
((AllReduceSockets*)all.all_reduce)->all_reduce<T, f>(buffer, n);
break;
case AllReduceType::Thread:
((AllReduceThreads*)all.all_reduce)->all_reduce<T, f>(buffer, n);
break;
}
}
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtDBus module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QDBUSINTERFACE_H
#define QDBUSINTERFACE_H
#include <QtDBus/qdbusabstractinterface.h>
#include <QtDBus/qdbusconnection.h>
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
class QDBusInterfacePrivate;
class Q_DBUS_EXPORT QDBusInterface: public QDBusAbstractInterface
{
friend class QDBusConnection;
private:
QDBusInterface(QDBusInterfacePrivate *p);
public:
QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(),
const QDBusConnection &connection = QDBusConnection::sessionBus(),
QObject *parent = 0);
~QDBusInterface();
virtual const QMetaObject *metaObject() const;
virtual void *qt_metacast(const char *);
virtual int qt_metacall(QMetaObject::Call, int, void **);
private:
Q_DECLARE_PRIVATE(QDBusInterface)
};
QT_END_NAMESPACE
#endif // QT_NO_DBUS
#endif
|
// Locale support -*- C++ -*-
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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 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 General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/** @file ctype_inline.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
//
// ISO C++ 14882: 22.1 Locales
//
// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
// functions go in ctype.cc
_GLIBCXX_BEGIN_NAMESPACE(std)
bool
ctype<char>::
is(mask __m, char __c) const
{ return _M_table[static_cast<unsigned char>(__c)] & __m; }
const char*
ctype<char>::
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
return __high;
}
const char*
ctype<char>::
scan_is(mask __m, const char* __low, const char* __high) const
{
while (__low < __high && !this->is(__m, *__low))
++__low;
return __low;
}
const char*
ctype<char>::
scan_not(mask __m, const char* __low, const char* __high) const
{
while (__low < __high && this->is(__m, *__low) != 0)
++__low;
return __low;
}
_GLIBCXX_END_NAMESPACE
|
/**************************************************************************
*
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*********************************************************************/
#ifndef HARDWARE_H
#define HARDWARE_H
#include "stm32f10x_conf.h"
#include "stm32f10x_it.h"
#define MAX_BINARY_OUTPUTS 2
#endif
|
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include <QDialog>
#include "Common/CommonTypes.h"
#include "VideoCommon/PostProcessing.h"
class EnhancementsWidget;
class QCheckBox;
class QDialogButtonBox;
class QGridLayout;
class QLineEdit;
class QSlider;
class QTabWidget;
class QWidget;
class PostProcessingConfigWindow final : public QDialog
{
Q_OBJECT
public:
explicit PostProcessingConfigWindow(EnhancementsWidget* parent, const std::string& shader);
~PostProcessingConfigWindow();
private:
class ConfigGroup final
{
public:
explicit ConfigGroup(
const VideoCommon::PostProcessingConfiguration::ConfigurationOption* config_option);
const std::string& GetGUIName() const noexcept;
const std::string& GetParent() const noexcept;
const std::string& GetOptionName() const noexcept;
void AddSubGroup(std::unique_ptr<ConfigGroup>&& subgroup);
bool HasSubGroups() const noexcept;
const std::vector<std::unique_ptr<ConfigGroup>>& GetSubGroups() const noexcept;
u32 AddWidgets(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
void EnableSuboptions(bool state);
int GetSliderValue(size_t index) const;
void SetSliderText(size_t index, const QString& text);
private:
u32 AddBool(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
u32 AddInteger(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
u32 AddFloat(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
QCheckBox* m_checkbox;
std::vector<QSlider*> m_sliders;
std::vector<QLineEdit*> m_value_boxes;
const VideoCommon::PostProcessingConfiguration::ConfigurationOption* m_config_option;
std::vector<std::unique_ptr<ConfigGroup>> m_subgroups;
};
void Create();
void ConnectWidgets();
QWidget* CreateDependentTab(const std::unique_ptr<ConfigGroup>& config_group);
void PopulateGroups();
void UpdateBool(ConfigGroup* config_group, bool state);
void UpdateInteger(ConfigGroup* config_group, int value);
void UpdateFloat(ConfigGroup* config_group, int value);
QTabWidget* m_tabs;
QDialogButtonBox* m_buttons;
const std::string& m_shader;
VideoCommon::PostProcessingConfiguration* m_post_processor;
std::unordered_map<std::string, ConfigGroup*> m_config_map;
std::vector<std::unique_ptr<ConfigGroup>> m_config_groups;
};
|
#ifndef NS_EVENT_H_KLE3JJCO
#define NS_EVENT_H_KLE3JJCO
#include <oak/misc.h>
namespace ns
{
PUBLIC std::string normalize_event_string (std::string const& eventString, size_t* startOfKey = NULL);
PUBLIC std::string glyphs_for_event_string (std::string const& eventString, size_t* startOfKey = NULL);
PUBLIC std::string glyphs_for_flags (NSUInteger flags);
} /* ns */
PUBLIC NSAttributedString* OakAttributedStringForEventString (NSString* eventString, NSFont* font);
#endif /* end of include guard: NS_EVENT_H_KLE3JJCO */
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_BASE_NET_ERRORS_H__
#define NET_BASE_NET_ERRORS_H__
#include <vector>
#include "base/basictypes.h"
#include "base/platform_file.h"
#include "net/base/net_export.h"
namespace net {
// Error domain of the net module's error codes.
NET_EXPORT extern const char kErrorDomain[];
// Error values are negative.
enum Error {
// No error.
OK = 0,
#define NET_ERROR(label, value) ERR_ ## label = value,
#include "net/base/net_error_list.h"
#undef NET_ERROR
// The value of the first certificate error code.
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID,
};
// Returns a textual representation of the error code for logging purposes.
NET_EXPORT const char* ErrorToString(int error);
// Returns true if |error| is a certificate error code.
inline bool IsCertificateError(int error) {
// Certificate errors are negative integers from net::ERR_CERT_BEGIN
// (inclusive) to net::ERR_CERT_END (exclusive) in *decreasing* order.
return (error <= ERR_CERT_BEGIN && error > ERR_CERT_END) ||
(error == ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY) ||
(error == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN);
}
// Map system error code to Error.
NET_EXPORT Error MapSystemError(int os_error);
// Returns a list of all the possible net error codes (not counting OK). This
// is intended for use with UMA histograms that are reporting the result of
// an action that is represented as a net error code.
//
// Note that the error codes are all positive (since histograms expect positive
// sample values). Also note that a guard bucket is created after any valid
// error code that is not followed immediately by a valid error code.
NET_EXPORT std::vector<int> GetAllErrorCodesForUma();
// A convenient function to translate platform file error to net error code.
NET_EXPORT Error PlatformFileErrorToNetError(
base::PlatformFileError file_error);
} // namespace net
#endif // NET_BASE_NET_ERRORS_H__
|
/*
* Copyright (C) 2018 John Crispin <john@phrozen.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/pci.h>
//#include <linux/of_irq.h>
#include <linux/of_pci.h>
int pcibios_plat_dev_init(struct pci_dev *dev)
{
return PCIBIOS_SUCCESSFUL;
}
int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
return of_irq_parse_and_map_pci(dev, slot, pin);
}
|
/*
* RemoteZynAddSubFx.h - ZynAddSubFX-embedding plugin
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef REMOTE_ZYNADDSUBFX_H
#define REMOTE_ZYNADDSUBFX_H
#include "RemotePlugin.h"
enum ZasfRemoteMessageIDs
{
IdZasfPresetDirectory = IdUserBase,
IdZasfLmmsWorkingDirectory,
IdZasfSetPitchWheelBendRange
} ;
#endif
|
/* Copyright (C) 1999, 2002, 2003 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. */
/* <bits/string.h> and <bits/string2.h> declare some extern inline
functions. These functions are declared additionally here if
inlining is not possible. */
#undef __USE_STRING_INLINES
#define __USE_STRING_INLINES
#define _FORCE_INLINES
#define __STRING_INLINE /* empty */
#define __NO_INLINE__
#include <string.h>
#undef index
#undef rindex
#undef __NO_INLINE__
#include <bits/string.h>
#include <bits/string2.h>
/* Functions which are inlines in i486 but not i386. */
void *
__memcpy_by2 (void *dest, const void *src, size_t n)
{
return memcpy (dest, src, n);
}
strong_alias (__memcpy_by2, __memcpy_by4)
strong_alias (__memcpy_by2, __memcpy_g)
strong_alias (__memcpy_by2, __memcpy_g_internal)
void *
__memset_ccn_by2 (void *s, unsigned int c, size_t n)
{
return memset (s, c & 0xff, n);
}
strong_alias (__memset_ccn_by2, __memset_ccn_by4)
void *
__memset_gcn_by2 (void *s, int c, size_t n)
{
return memset (s, c, n);
}
strong_alias (__memset_gcn_by2, __memset_gcn_by4)
size_t
__strlen_g (const char *s)
{
return strlen (s);
}
char *
__strcpy_g (char *d, const char *s)
{
return strcpy (d, s);
}
char *
__mempcpy_by2 (char *d, const char *s, size_t n)
{
return mempcpy (d, s, n);
}
strong_alias (__mempcpy_by2, __mempcpy_by4)
strong_alias (__mempcpy_by2, __mempcpy_byn)
char *
__stpcpy_g (char *d, const char *s)
{
return stpcpy (d, s);
}
char *
__strncpy_by2 (char *d, const char s[], size_t srclen, size_t n)
{
return strncpy (d, s, n);
}
strong_alias (__strncpy_by2, __strncpy_by4)
strong_alias (__strncpy_by2, __strncpy_byn)
char *
__strncpy_gg (char *d, const char *s, size_t n)
{
return strncpy (d, s, n);
}
char *
__strcat_c (char *d, const char s[], size_t srclen)
{
return strcat (d, s);
}
char *
__strcat_g (char *d, const char *s)
{
return strcat (d, s);
}
char *
__strncat_g (char *d, const char s[], size_t n)
{
return strncat (d, s, n);
}
int
__strcmp_gg (const char *s1, const char *s2)
{
return strcmp (s1, s2);
}
int
__strncmp_g (const char *s1, const char *s2, size_t n)
{
return strncmp (s1, s2, n);
}
char *
__strrchr_c (const char *s, int c)
{
return strrchr (s, c >> 8);
}
char *
__strrchr_g (const char *s, int c)
{
return strrchr (s, c);
}
size_t
__strcspn_cg (const char *s, const char reject[], size_t reject_len)
{
return strcspn (s, reject);
}
size_t
__strcspn_g (const char *s, const char *reject)
{
return strcspn (s, reject);
}
size_t
__strspn_cg (const char *s, const char accept[], size_t accept_len)
{
return strspn (s, accept);
}
size_t
__strspn_g (const char *s, const char *accept)
{
return strspn (s, accept);
}
char *
__strpbrk_cg (const char *s, const char accept[], size_t accept_len)
{
return strpbrk (s, accept);
}
char *
__strpbrk_g (const char *s, const char *accept)
{
return strpbrk (s, accept);
}
char *
__strstr_cg (const char *haystack, const char needle[], size_t needle_len)
{
return strstr (haystack, needle);
}
char *
__strstr_g (const char *haystack, const char needle[])
{
return strstr (haystack, needle);
}
|
/*
* Copyright (C) 2017-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "cores/RetroPlayer/process/RPProcessInfo.h"
namespace KODI
{
namespace RETRO
{
class CRPProcessInfoWayland : public CRPProcessInfo
{
public:
CRPProcessInfoWayland();
static CRPProcessInfo* Create();
static void Register();
};
}
}
|
/*
* Sonics Silicon Backplane
* GPIO driver
*
* Copyright 2011, Broadcom Corporation
* Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de>
*
* Licensed under the GNU/GPL. See COPYING for details.
*/
#include <linux/gpio.h>
#include <linux/export.h>
#include <linux/ssb/ssb.h>
#include "ssb_private.h"
static struct ssb_bus *ssb_gpio_get_bus(struct gpio_chip *chip)
{
return container_of(chip, struct ssb_bus, gpio);
}
static int ssb_gpio_chipco_get_value(struct gpio_chip *chip, unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
return !!ssb_chipco_gpio_in(&bus->chipco, 1 << gpio);
}
static void ssb_gpio_chipco_set_value(struct gpio_chip *chip, unsigned gpio,
int value)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_chipco_gpio_out(&bus->chipco, 1 << gpio, value ? 1 << gpio : 0);
}
static int ssb_gpio_chipco_direction_input(struct gpio_chip *chip,
unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_chipco_gpio_outen(&bus->chipco, 1 << gpio, 0);
return 0;
}
static int ssb_gpio_chipco_direction_output(struct gpio_chip *chip,
unsigned gpio, int value)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_chipco_gpio_outen(&bus->chipco, 1 << gpio, 1 << gpio);
ssb_chipco_gpio_out(&bus->chipco, 1 << gpio, value ? 1 << gpio : 0);
return 0;
}
static int ssb_gpio_chipco_request(struct gpio_chip *chip, unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_chipco_gpio_control(&bus->chipco, 1 << gpio, 0);
/* clear pulldown */
ssb_chipco_gpio_pulldown(&bus->chipco, 1 << gpio, 0);
/* Set pullup */
ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 1 << gpio);
return 0;
}
static void ssb_gpio_chipco_free(struct gpio_chip *chip, unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
/* clear pullup */
ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0);
}
static int ssb_gpio_chipco_init(struct ssb_bus *bus)
{
struct gpio_chip *chip = &bus->gpio;
chip->label = "ssb_chipco_gpio";
chip->owner = THIS_MODULE;
chip->request = ssb_gpio_chipco_request;
chip->free = ssb_gpio_chipco_free;
chip->get = ssb_gpio_chipco_get_value;
chip->set = ssb_gpio_chipco_set_value;
chip->direction_input = ssb_gpio_chipco_direction_input;
chip->direction_output = ssb_gpio_chipco_direction_output;
chip->ngpio = 16;
/* There is just one SoC in one device and its GPIO addresses should be
* deterministic to address them more easily. The other buses could get
* a random base number. */
if (bus->bustype == SSB_BUSTYPE_SSB)
chip->base = 0;
else
chip->base = -1;
return gpiochip_add(chip);
}
#ifdef CONFIG_SSB_DRIVER_EXTIF
static int ssb_gpio_extif_get_value(struct gpio_chip *chip, unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
return !!ssb_extif_gpio_in(&bus->extif, 1 << gpio);
}
static void ssb_gpio_extif_set_value(struct gpio_chip *chip, unsigned gpio,
int value)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_extif_gpio_out(&bus->extif, 1 << gpio, value ? 1 << gpio : 0);
}
static int ssb_gpio_extif_direction_input(struct gpio_chip *chip,
unsigned gpio)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_extif_gpio_outen(&bus->extif, 1 << gpio, 0);
return 0;
}
static int ssb_gpio_extif_direction_output(struct gpio_chip *chip,
unsigned gpio, int value)
{
struct ssb_bus *bus = ssb_gpio_get_bus(chip);
ssb_extif_gpio_outen(&bus->extif, 1 << gpio, 1 << gpio);
ssb_extif_gpio_out(&bus->extif, 1 << gpio, value ? 1 << gpio : 0);
return 0;
}
static int ssb_gpio_extif_init(struct ssb_bus *bus)
{
struct gpio_chip *chip = &bus->gpio;
chip->label = "ssb_extif_gpio";
chip->owner = THIS_MODULE;
chip->get = ssb_gpio_extif_get_value;
chip->set = ssb_gpio_extif_set_value;
chip->direction_input = ssb_gpio_extif_direction_input;
chip->direction_output = ssb_gpio_extif_direction_output;
chip->ngpio = 5;
/* There is just one SoC in one device and its GPIO addresses should be
* deterministic to address them more easily. The other buses could get
* a random base number. */
if (bus->bustype == SSB_BUSTYPE_SSB)
chip->base = 0;
else
chip->base = -1;
return gpiochip_add(chip);
}
#else
static int ssb_gpio_extif_init(struct ssb_bus *bus)
{
return -ENOTSUPP;
}
#endif
int ssb_gpio_init(struct ssb_bus *bus)
{
if (ssb_chipco_available(&bus->chipco))
return ssb_gpio_chipco_init(bus);
else if (ssb_extif_available(&bus->extif))
return ssb_gpio_extif_init(bus);
else
SSB_WARN_ON(1);
return -1;
}
|
/*
* switchroot.c - switch to new root directory and start init.
*
* Copyright 2002-2009 Red Hat, Inc. 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 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/>.
*
* Authors:
* Peter Jones <pjones@redhat.com>
* Jeremy Katz <katzj@redhat.com>
*/
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/param.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include "c.h"
#include "nls.h"
#include "closestream.h"
#include "statfs_magic.h"
#ifndef MS_MOVE
#define MS_MOVE 8192
#endif
#ifndef MNT_DETACH
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
#endif
/* remove all files/directories below dirName -- don't cross mountpoints */
static int recursiveRemove(int fd)
{
struct stat rb;
DIR *dir;
int rc = -1;
int dfd;
if (!(dir = fdopendir(fd))) {
warn(_("failed to open directory"));
goto done;
}
/* fdopendir() precludes us from continuing to use the input fd */
dfd = dirfd(dir);
if (fstat(dfd, &rb)) {
warn(_("stat failed"));
goto done;
}
while(1) {
struct dirent *d;
int isdir = 0;
errno = 0;
if (!(d = readdir(dir))) {
if (errno) {
warn(_("failed to read directory"));
goto done;
}
break; /* end of directory */
}
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
continue;
#ifdef _DIRENT_HAVE_D_TYPE
if (d->d_type == DT_DIR || d->d_type == DT_UNKNOWN)
#endif
{
struct stat sb;
if (fstatat(dfd, d->d_name, &sb, AT_SYMLINK_NOFOLLOW)) {
warn(_("stat of %s failed"), d->d_name);
continue;
}
/* remove subdirectories if device is same as dir */
if (S_ISDIR(sb.st_mode) && sb.st_dev == rb.st_dev) {
int cfd;
cfd = openat(dfd, d->d_name, O_RDONLY);
if (cfd >= 0) {
recursiveRemove(cfd);
close(cfd);
}
isdir = 1;
} else
continue;
}
if (unlinkat(dfd, d->d_name, isdir ? AT_REMOVEDIR : 0))
warn(_("failed to unlink %s"), d->d_name);
}
rc = 0; /* success */
done:
if (dir)
closedir(dir);
return rc;
}
static int switchroot(const char *newroot)
{
/* Don't try to unmount the old "/", there's no way to do it. */
const char *umounts[] = { "/dev", "/proc", "/sys", "/run", NULL };
int i;
int cfd;
pid_t pid;
struct stat newroot_stat, sb;
if (stat(newroot, &newroot_stat) != 0) {
warn(_("stat of %s failed"), newroot);
return -1;
}
for (i = 0; umounts[i] != NULL; i++) {
char newmount[PATH_MAX];
snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]);
if ((stat(newmount, &sb) != 0) || (sb.st_dev != newroot_stat.st_dev)) {
/* mount point seems to be mounted already or stat failed */
umount2(umounts[i], MNT_DETACH);
continue;
}
if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) {
warn(_("failed to mount moving %s to %s"),
umounts[i], newmount);
warnx(_("forcing unmount of %s"), umounts[i]);
umount2(umounts[i], MNT_FORCE);
}
}
if (chdir(newroot)) {
warn(_("failed to change directory to %s"), newroot);
return -1;
}
cfd = open("/", O_RDONLY);
if (cfd < 0) {
warn(_("cannot open %s"), "/");
return -1;
}
if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
close(cfd);
warn(_("failed to mount moving %s to /"), newroot);
return -1;
}
if (chroot(".")) {
close(cfd);
warn(_("failed to change root"));
return -1;
}
if (cfd >= 0) {
pid = fork();
if (pid <= 0) {
struct statfs stfs;
if (fstatfs(cfd, &stfs) == 0 &&
(F_TYPE_EQUAL(stfs.f_type, STATFS_RAMFS_MAGIC) ||
F_TYPE_EQUAL(stfs.f_type, STATFS_TMPFS_MAGIC)))
recursiveRemove(cfd);
else
warn(_("old root filesystem is not an initramfs"));
if (pid == 0)
exit(EXIT_SUCCESS);
}
close(cfd);
}
return 0;
}
static void __attribute__((__noreturn__)) usage(FILE *output)
{
fputs(USAGE_HEADER, output);
fprintf(output, _(" %s [options] <newrootdir> <init> <args to init>\n"),
program_invocation_short_name);
fputs(USAGE_SEPARATOR, output);
fputs(_("Switch to another filesystem as the root of the mount tree.\n"), output);
fputs(USAGE_OPTIONS, output);
fputs(USAGE_HELP, output);
fputs(USAGE_VERSION, output);
fprintf(output, USAGE_MAN_TAIL("switch_root(8)"));
exit(output == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
int main(int argc, char *argv[])
{
char *newroot, *init, **initargs;
atexit(close_stdout);
if (argv[1] && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
usage(stdout);
if (argv[1] && (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-V"))) {
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
}
if (argc < 3)
usage(stderr);
newroot = argv[1];
init = argv[2];
initargs = &argv[2];
if (!*newroot || !*init)
usage(stderr);
if (switchroot(newroot))
errx(EXIT_FAILURE, _("failed. Sorry."));
if (access(init, X_OK))
warn(_("cannot access %s"), init);
execv(init, initargs);
err(EXIT_FAILURE, _("failed to execute %s"), init);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.