text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2011 SingularityCore <http://www.singularitycore.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 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 SKYFIRE_DB2STORES_H
#define SKYFIRE_DB2STORES_H
#include "Common.h"
#include "DB2Store.h"
#include "DB2Structure.h"
#include <list>
extern DB2Storage <ItemEntry> sItemStore;
extern DB2Storage <ItemSparseEntry> sItemSparseStore;
void LoadDB2Stores(const std::string& dataPath);
#endif
|
/* =========================================================================
filemq - An updated attempt at FileMQ.
Copyright (c) the Contributors as noted in the AUTHORS file.
This file is part of FileMQ, a C implemenation of the protocol:
https://github.com/danriegsecker/filemq2.
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 __FILEMQ_H_INCLUDED__
#define __FILEMQ_H_INCLUDED__
// Include the project library file
#include "filemq_library.h"
// Add your own public definitions here, if you need them
#endif
|
/*
* $Id$
*
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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 <string.h>
#include <stdlib.h>
#include "boxheader_manager.h"
#include "opj_inttypes.h"
#ifdef SERVER
#include "fcgi_stdio.h"
#define logstream FCGI_stdout
#else
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
#endif /*SERVER*/
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
{
Byte8_t boxlen;
Byte_t headlen;
char *boxtype;
boxheader_param_t *boxheader;
boxlen = fetch_4bytebigendian( fd, offset);
boxtype = (char *)fetch_bytes( fd, offset+4, 4);
headlen = 8;
if( boxlen == 1){ /* read XLBox */
boxlen = fetch_8bytebigendian( fd, offset+8);
headlen = 16;
}
boxheader = (boxheader_param_t *)malloc( sizeof( boxheader_param_t));
boxheader->headlen = headlen;
boxheader->length = boxlen;
strncpy( boxheader->type, boxtype, 4);
boxheader->next = NULL;
free( boxtype);
return boxheader;
}
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset)
{
return gene_boxheader( superbox->fd, get_DBoxoff(superbox)+offset);
}
void print_boxheader( boxheader_param_t *boxheader)
{
fprintf( logstream, "boxheader info:\n"
"\t type: %.4s\n"
"\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, boxheader->length);
}
|
/****************** <VPR heading BEGIN do not edit this line> *****************
*
* VR Juggler Portable Runtime
*
* Original Authors:
* Allen Bierbaum, Patrick Hartling, Kevin Meinert, Carolina Cruz-Neira
*
****************** <VPR heading END do not edit this line> ******************/
/*************** <auto-copyright.pl BEGIN do not edit this line> **************
*
* VR Juggler is (C) Copyright 1998-2011 by Iowa State University
*
* Original Authors:
* Allen Bierbaum, Christopher Just,
* Patrick Hartling, Kevin Meinert,
* Carolina Cruz-Neira, Albert Baker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*************** <auto-copyright.pl END do not edit this line> ***************/
#ifndef _VPR_CONNECTION_ABORTED_EXCEPTION_H_
#define _VPR_CONNECTION_ABORTED_EXCEPTION_H_
#include <vpr/vprConfig.h>
#include <vpr/IO/Socket/SocketException.h>
namespace vpr
{
/** \class ConnectionAbortedException ConnectionAbortedException.h vpr/IO/Socket/ConnectionAbortedException.h
*
* Exception type thrown if network communication fails because the connection
* is reset.
*
* @since 1.1.18
*/
class VPR_API ConnectionAbortedException : public SocketException
{
public:
ConnectionAbortedException(const std::string& msg,
const std::string& location = "")
throw();
virtual ~ConnectionAbortedException() throw();
virtual std::string getExceptionName() const
{
return "vpr::ConnectionAbortedException";
}
};
}
#endif
|
/*
* kmod-insmod - insert modules into linux kernel using libkmod.
*
* Copyright (C) 2011-2013 ProFUSION embedded systems
*
* 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/>.
*/
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <shared/util.h>
#include <libkmod/libkmod.h>
#include "kmod.h"
static const char cmdopts_s[] = "psfVh";
static const struct option cmdopts[] = {
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
{NULL, 0, 0, 0}
};
static void help(void)
{
printf("Usage:\n"
"\t%s [options] filename [args]\n"
"Options:\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
program_invocation_short_name);
}
static const char *mod_strerror(int err)
{
switch (err) {
case ENOEXEC:
return "Invalid module format";
case ENOENT:
return "Unknown symbol in module";
case ESRCH:
return "Module has wrong symbol version";
case EINVAL:
return "Invalid parameters";
default:
return strerror(err);
}
}
static int do_insmod(int argc, char *argv[])
{
struct kmod_ctx *ctx;
struct kmod_module *mod;
const char *filename;
char *opts = NULL;
size_t optslen = 0;
int i, err;
const char *null_config = NULL;
unsigned int flags = 0;
for (;;) {
int c, idx = 0;
c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
if (c == -1)
break;
switch (c) {
case 'p':
case 's':
/* ignored, for compatibility only */
break;
case 'f':
flags |= KMOD_PROBE_FORCE_MODVERSION;
flags |= KMOD_PROBE_FORCE_VERMAGIC;
break;
case 'h':
help();
return EXIT_SUCCESS;
case 'V':
puts(PACKAGE " version " VERSION);
puts(KMOD_FEATURES);
return EXIT_SUCCESS;
case '?':
return EXIT_FAILURE;
default:
ERR("unexpected getopt_long() value '%c'.\n",
c);
return EXIT_FAILURE;
}
}
if (optind >= argc) {
ERR("missing filename.\n");
return EXIT_FAILURE;
}
filename = argv[optind];
if (streq(filename, "-")) {
ERR("this tool does not support loading from stdin!\n");
return EXIT_FAILURE;
}
for (i = optind + 1; i < argc; i++) {
size_t len = strlen(argv[i]);
void *tmp = realloc(opts, optslen + len + 2);
if (tmp == NULL) {
ERR("out of memory\n");
free(opts);
return EXIT_FAILURE;
}
opts = tmp;
if (optslen > 0) {
opts[optslen] = ' ';
optslen++;
}
memcpy(opts + optslen, argv[i], len);
optslen += len;
opts[optslen] = '\0';
}
ctx = kmod_new(NULL, &null_config);
if (!ctx) {
ERR("kmod_new() failed!\n");
free(opts);
return EXIT_FAILURE;
}
err = kmod_module_new_from_path(ctx, filename, &mod);
if (err < 0) {
ERR("could not load module %s: %s\n", filename,
strerror(-err));
goto end;
}
err = kmod_module_insert_module(mod, flags, opts);
if (err < 0) {
ERR("could not insert module %s: %s\n", filename,
mod_strerror(-err));
}
kmod_module_unref(mod);
end:
kmod_unref(ctx);
free(opts);
return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
const struct kmod_cmd kmod_cmd_compat_insmod = {
.name = "insmod",
.cmd = do_insmod,
.help = "compat insmod command",
};
|
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup pkg_lwip_opts lwIP options
* @ingroup pkg_lwip
* @brief Options for the lwIP stack
* @{
*
* @file
* @brief Option definitions
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef LWIPOPTS_H
#define LWIPOPTS_H
#include "thread.h"
#include "net/gnrc/netif/hdr.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief lwIP configuration macros.
* @see lwIP documentation
* @{
*/
#ifdef MODULE_LWIP_ARP
#define LWIP_ARP 1
#else /* MODULE_LWIP_ARP */
#define LWIP_ARP 0
#endif /* MODULE_LWIP_ARP */
#ifdef MODULE_LWIP_AUTOIP
#define LWIP_AUTOIP 1
#else /* MODULE_LWIP_AUTOIP */
#define LWIP_AUTOIP 0
#endif /* MODULE_LWIP_AUTOIP */
#ifdef MODULE_LWIP_DHCP
#define LWIP_DHCP 1
#else /* MODULE_LWIP_DHCP */
#define LWIP_DHCP 0
#endif /* MODULE_LWIP_DHCP */
#ifdef MODULE_LWIP_ETHERNET
#define LWIP_ETHERNET 1
#else /* MODULE_LWIP_ETHERNET */
#define LWIP_ETHERNET 0
#endif /* MODULE_LWIP_ETHERNET */
#ifdef MODULE_LWIP_NETIF
#define LWIP_NETIF_API 1
#else /* MODULE_LWIP_NETIF */
#define LWIP_NETIF_API 0
#endif /* MODULE_LWIP_NETIF */
#ifdef MODULE_LWIP_IGMP
#define LWIP_IGMP 1
#else /* MODULE_LWIP_IGMP */
#define LWIP_IGMP 0
#endif /* MODULE_LWIP_IGMP */
#ifdef MODULE_LWIP_IPV4
#define LWIP_IPV4 1
#else /* MODULE_LWIP_IPV4 */
#define LWIP_IPV4 0
#endif /* MODULE_LWIP_IPV4 */
#ifdef MODULE_LWIP_IPV6_AUTOCONFIG
#define LWIP_IPV6_AUTOCONFIG 1
#else /* MODULE_LWIP_IPV6_AUTOCONFIG */
#define LWIP_IPV6_AUTOCONFIG 0
#endif /* MODULE_LWIP_IPV6_AUTOCONFIG */
#ifdef MODULE_LWIP_IPV6_MLD
#define LWIP_IPV6_MLD 1
#else /* MODULE_LWIP_IPV6 */
#define LWIP_IPV6_MLD 0
#endif /* MODULE_LWIP_IPV6 */
#ifdef MODULE_LWIP_IPV6
#define LWIP_IPV6 1
#else /* MODULE_LWIP_IPV6 */
#define LWIP_IPV6 0
#endif /* MODULE_LWIP_IPV6 */
#ifdef MODULE_LWIP_NETIF_PPP
#define PPP_SUPPORT 1
#else /* MODULE_LWIP_NETIF_PPP */
#define PPP_SUPPORT 0
#endif /* MODULE_LWIP_NETIF_PPP */
#ifdef MODULE_LWIP_RAW
#define LWIP_RAW 1
#else /* MODULE_LWIP_RAW */
#define LWIP_RAW 0
#endif /* MODULE_LWIP_RAW */
#ifdef MODULE_LWIP_SIXLOWPAN
#define LWIP_6LOWPAN 1
#else /* MODULE_LWIP_STATS */
#define LWIP_6LOWPAN 0
#endif /* MODULE_LWIP_STATS */
#ifdef MODULE_LWIP_STATS
#define LWIP_STATS 1
#else /* MODULE_LWIP_STATS */
#define LWIP_STATS 0
#endif /* MODULE_LWIP_STATS */
#ifdef MODULE_LWIP_TCP
#define LWIP_TCP 1
#else /* MODULE_LWIP_TCP */
#define LWIP_TCP 0
#endif /* MODULE_LWIP_TCP */
#ifdef MODULE_LWIP_UDP
#define LWIP_UDP 1
#else /* MODULE_LWIP_UDP */
#define LWIP_UDP 0
#endif /* MODULE_LWIP_UDP */
#ifdef MODULE_LWIP_UDPLITE
#define LWIP_UDPLITE 1
#else /* MODULE_LWIP_UDPLITE */
#define LWIP_UDPLITE 0
#endif /* MODULE_LWIP_UDPLITE */
#if IS_USED(MODULE_LWIP_SOCK)
#define LWIP_NETCONN 1
#if IS_USED(MODULE_SOCK_AUX_LOCAL)
#define LWIP_NETBUF_RECVINFO 1
#endif /* MODULE_SOCK_AUX_LOCAL */
#else
#define LWIP_NETCONN 0
#endif /* MODULE_LWIP_SOCK */
#ifdef MODULE_SHELL_COMMANDS
#define LWIP_DEBUG 1
#endif
#ifndef TCP_LISTEN_BACKLOG
# if defined(MODULE_LWIP_SOCK_TCP)
# define TCP_LISTEN_BACKLOG 1
# else
# define TCP_LISTEN_BACKLOG 0
# endif
#endif /* TCP_LISTEN_BACKLOG */
#define LWIP_SOCKET 0
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
#define MEMP_MEM_MALLOC 1
#define NETIF_MAX_HWADDR_LEN (GNRC_NETIF_HDR_L2ADDR_MAX_LEN)
#ifndef TCPIP_THREAD_STACKSIZE
#define TCPIP_THREAD_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
#endif
#define MEM_ALIGNMENT 4
#ifndef MEM_SIZE
/* packet buffer size of GNRC + stack for TCP/IP */
#define MEM_SIZE (TCPIP_THREAD_STACKSIZE + 6144)
#endif
#ifdef DEVELHELP
void sys_mark_tcpip_thread(void);
#define LWIP_MARK_TCPIP_THREAD sys_mark_tcpip_thread
bool sys_check_core_locked(void);
#define LWIP_ASSERT_CORE_LOCKED() \
LWIP_ASSERT("Core lock held", sys_check_core_locked())
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* LWIPOPTS_H */
/** @} */
|
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
// Original class author: M.R. Tonks
#ifndef FINITESTRAINMATERIAL_H
#define FINITESTRAINMATERIAL_H
#include "TensorMechanicsMaterial.h"
/**
* FiniteStrainMaterial implements a finite strain formulation using the tensor mechanics system.
* It determines the strain increment, the strain rate and the rotation increment. It uses the
* form from Rashid, 1993 in which the constitutive calculation is conducted in an intermediate
* configruation. The final stress is then rotated via the incremental rotation to the current
* cofiguration.
*
* Any material that inherits from this one must override ComputeQpStress with the desired
* constitutive relationship.
*/
class FiniteStrainMaterial : public TensorMechanicsMaterial
{
public:
FiniteStrainMaterial(const std::string & name, InputParameters parameters);
protected:
virtual void initQpStatefulProperties();
virtual void computeStrain();
virtual void computeQpStrain();
virtual void computeQpStrain(const RankTwoTensor & Fhat);
virtual void computeQpStress() = 0;
MaterialProperty<RankTwoTensor> & _strain_rate;
MaterialProperty<RankTwoTensor> & _strain_increment;
MaterialProperty<RankTwoTensor> & _total_strain_old;
MaterialProperty<RankTwoTensor> & _elastic_strain_old;
MaterialProperty<RankTwoTensor> & _stress_old;
MaterialProperty<RankTwoTensor> & _rotation_increment;
MaterialProperty<RankTwoTensor> & _deformation_gradient;
};
#endif //FINITESTRAINMATERIAL_H
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef LOADCOREDIALOG_H
#define LOADCOREDIALOG_H
#include <QDialog>
namespace Core { class Id; }
namespace ProjectExplorer { class Kit; }
namespace Debugger {
namespace Internal {
class AttachCoreDialogPrivate;
class AttachCoreDialog : public QDialog
{
Q_OBJECT
public:
explicit AttachCoreDialog(QWidget *parent);
~AttachCoreDialog();
int exec();
QString localExecutableFile() const;
QString localCoreFile() const;
QString remoteCoreFile() const;
QString overrideStartScript() const;
bool useLocalCoreFile() const;
bool forcesLocalCoreFile() const;
bool isLocalKit() const;
// For persistance.
ProjectExplorer::Kit *kit() const;
void setLocalExecutableFile(const QString &executable);
void setLocalCoreFile(const QString &core);
void setRemoteCoreFile(const QString &core);
void setOverrideStartScript(const QString &scriptName);
void setKitId(Core::Id id);
void setForceLocalCoreFile(bool on);
private:
void changed();
void coreFileChanged(const QString &core);
void selectRemoteCoreFile();
AttachCoreDialogPrivate *d;
};
} // namespace Debugger
} // namespace Internal
#endif // LOADCOREDIALOG_H
|
/**
*
* Phantom OS
*
* Copyright (C) 2005-2013 Dmitry Zavalishin, dz@dz.ru
*
* Arm Raspberry PI hardware mappings.
*
**/
#include <kernel/board.h>
#include <kernel/trap.h>
#include <kernel/interrupts.h>
#include <kernel/driver.h>
#include <kernel/stats.h>
#include <hal.h>
#include <assert.h>
#include <stdio.h>
#include <arm/memio.h>
#include <arm/private.h>
#include <dev/mem_disk.h>
#include "arm-raspberry.h"
#define DEBUG_MSG_PREFIX "board"
#include <debug_ext.h>
#define debug_level_flow 6
#define debug_level_error 10
#define debug_level_info 10
char board_name[] = "Raspberry PI";
//static char * symtab_getname( void *addr );
void board_init_early(void)
{
// Relocate trap table to address 0
extern unsigned int _start_of_kernel[];
unsigned int *atzero = 0;
unsigned int shift = (unsigned int)&_start_of_kernel;
assert(0==(shift&3));
// TODO wrong place - must be in arm arch code
// Copy branch instructions, correcting (relative) target
// address by distance we move them to. Branch address lacks
// lower 2 bits (allways 0), so divide shift by 4
int i;
for( i = 0; i < 8; i++ )
{
atzero[i] = _start_of_kernel[i] + (shift/4);
}
// TODO wrong place - must be in arm arch code
//phantom_symtab_getname = symtab_getname;
}
void board_init_cpu_management(void)
{
}
void board_init_kernel_timer(void)
{
arm_raspberry_timer0_init(100);
}
void board_start_smp(void)
{
// I'm single-CPU board, sorry.
}
// -----------------------------------------------------------------------
// Arm -mpoke-function-name
// -----------------------------------------------------------------------
/*
static char * symtab_getname( void *addr )
{
int len = *(int*)(addr-4);
if( (len & 0xFF000000) != 0xFF000000 )
return "?";
return (char *)(addr - 4 - (len&0xFFFFFF));
}
*/
// -----------------------------------------------------------------------
// Interrupts processing
// -----------------------------------------------------------------------
void board_interrupt_enable(int irq)
{
arm_bcm2835_interrupt_enable(irq);
}
void board_interrupt_disable(int irq)
{
arm_bcm2835_interrupt_disable(irq);
}
void board_init_interrupts(void)
{
arm_bcm2835_init_interrupts();
}
void board_interrupts_disable_all(void)
{
arm_bcm2835_interrupts_disable_all();
}
void board_sched_cause_soft_irq(void)
{
int ie = hal_save_cli();
asm volatile("swi 0xFFF");
//phantom_scheduler_soft_interrupt();
if(ie) hal_sti();
}
// -----------------------------------------------------------------------
// Drivers
// -----------------------------------------------------------------------
// NB! No network drivers on stage 0!
static isa_probe_t board_drivers[] =
{
// { "UART0", driver_pl011_uart_probe, 1, 0x16000000, 1 },
/*
{ "UART1", driver_pl011_uart_probe, 1, 0x17000000, 2 },
{ "RTC", driver_pl031_rtc_probe, 0, 0x15000000, 8 },
{ "MMC", driver_pl181_mmc_probe, 1, 0x1C000000, 23 }, // And 24 - how do we give 2 irqs?
{ "PL050.kb", driver_pl050_keyb_probe, 1, 0x18000000, 3 },
{ "PL050.ms", driver_pl050_mouse_probe, 1, 0x19000000, 4 },
*/
/*
{ "PL041.Audio", driver_mem_pl041_audio_probe, 2, 0x1D000000, 25 },
{ "LAN91C111", driver_mem_LAN91C111_net_probe, 2, 0xC8000000, 27 },
*/
// End of list marker
{ 0, 0, 0, 0, 0 },
};
static int flash_mbytes = 0;
void board_make_driver_map(void)
{
arm_raspberry_video_init();
phantom_register_drivers(board_drivers);
}
int phantom_dev_keyboard_getc(void)
{
return debug_console_getc();
}
int phantom_scan_console_getc(void)
{
return debug_console_getc();
}
int phantom_dev_keyboard_get_key(void)
{
//#warning completely wrong!!!
// return debug_console_getc();
while(1)
hal_sleep_msec(10000);
}
//int driver_isa_vga_putc( int c )
int board_boot_console_putc( int c )
{
debug_console_putc(c);
return c;
}
void rtc_read_tm() {}
long long arch_get_rtc_delta() { return 0LL; }
void board_fill_memory_map( amap_t *ram_map )
{
extern char end[];
int uptokernel = (int)&end;
// Suppose we have 512Mb and give out 128Mb to video
int len = (512-128)*1024*1024;
assert( 0 == amap_modify( ram_map, uptokernel, len-uptokernel, MEM_MAP_HI_RAM) );
}
// TODO it's PL011 UART, generalize! Connect ICP code too
// TODO use memio.h
#define MEM(___a) *((volatile unsigned int *)(___a))
//#define SERIAL_BASE 0x7e201000
#define SERIAL_BASE 0x20201000
#define SERIAL_FLAG_REGISTER 0x18
#define SERIAL_TX_BUFFER_FULL (1 << 5)
#define SERIAL_RX_BUFFER_EMPTY (1 << 4)
#define DR() MEM(SERIAL_BASE)
#define FR() MEM(SERIAL_BASE+SERIAL_FLAG_REGISTER)
static void do_putc(int c)
{
// Wait until the serial buffer is empty
//while (*(volatile unsigned long*)(SERIAL_BASE + SERIAL_FLAG_REGISTER) & (SERIAL_TX_BUFFER_FULL));
while( FR() & SERIAL_TX_BUFFER_FULL )
;
// Put our character, c, into the serial buffer
RD() = c;
}
void debug_console_putc(int c)
{
if(c=='\n')
do_putc('\r');
do_putc(c);
}
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_PASSES_H_
#define TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_PASSES_H_
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "mlir/IR/BuiltinOps.h" // from @llvm-project
#include "mlir/Pass/Pass.h" // from @llvm-project
#include "mlir/Support/LogicalResult.h" // from @llvm-project
namespace mlir {
namespace TFR {
// Scans the func op and adds all the canonicalization patterns of the ops
// except the tf ops, inside the function.
void populateCanonicalizationPatterns(FuncOp func, RewritePatternSet &patterns);
// Decompose ops.
std::unique_ptr<OperationPass<FuncOp>> CreateDecomposeTFOpsPass(
llvm::Optional<ModuleOp> tfr_module = llvm::None);
// Rewrites quantized operands and results with their storage types.
// This pass should be run at module level after decomposition, if there are
// quantized operands or results.
std::unique_ptr<OperationPass<ModuleOp>> CreateRewriteQuantizedIOPass();
// Raise to TF ops.
std::unique_ptr<OperationPass<FuncOp>> CreateRaiseToTFOpsPass(
llvm::Optional<ModuleOp> tfr_module = llvm::None,
bool materialize_derived_attrs = false);
} // namespace TFR
} // namespace mlir
#endif // TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_PASSES_H_
|
//
// NSArray+LDK.h
// LDCore
//
// Created by Bryan Nagle on 9/26/13.
// Copyright (c) 2013 Liquid Analytics. All rights reserved.
//
#import <Foundation/Foundation.h>
@class LDMItem;
@interface NSArray (LDK)
- (NSArray *)objectsOfClass:(Class)class;
- (BOOL)containsAnyObjectInArray:(NSArray *)array;
- (void)paginateWithPageSize:(NSInteger)pageSize pageBlock:(void (^)(NSArray *objectPage))block;
- (NSUInteger)indexOfItemWithField:(NSString *)field andValue:(id)value;
- (LDMItem *)itemWithField:(NSString *)field andValue:(id)value;
- (NSArray *)itemsWithField:(NSString *)field andValue:(id)value;
- (LDMRelationshipSchema *)relationshipWithName:(NSString *)name;
- (NSArray *)sortedArrayUsingField:(NSString *)field andValues:(NSArray *)values;
- (NSString*) stringWithQuotationsAndCommasForArray:(NSString*) field;
+ (NSArray *)arrayOfClassNames:(NSArray *)classes;
- (NSArray *)valuesForField:(NSString *)field;
- (NSArray *)arrayByFlatteningArrayofArrays;
- (id)lastObjectByMatchingPredicate:(NSPredicate *)predicate;
- (NSDictionary *)collateItemsByField:(NSString *)field;
- (BOOL)containsDimension:(LDMDimension *)aDimension;
@end
|
#include <stdlib.h>
#include "nix.h"
#include "xec-debug.h"
void *g_nix_log = NULL;
extern int nix_fd_init(size_t);
extern int nix_signal_init(size_t);
// XXX MOVE TO ENV!
void
nix_init(size_t nfds, size_t nsigs)
{
if (g_nix_log != NULL)
return;
g_nix_log = xec_log_register("nix");
if (!nix_fd_init(nfds)) {
XEC_BUGCHECK(NULL, 500);
abort();
}
if (!nix_signal_init(nsigs)) {
XEC_BUGCHECK(NULL, 501);
abort();
}
}
|
/* -*- mode: C -*- */
/*
IGraph library.
Copyright (C) 2006-2012 Gabor Csardi <csardi.gabor@gmail.com>
334 Harvard st, Cambridge MA, 02139 USA
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include <igraph.h>
void print_vector(igraph_vector_t *v) {
long int i, n=igraph_vector_size(v);
igraph_real_t sum=0.0;
for (i=0; i<n; i++) {
if (!igraph_is_nan(VECTOR(*v)[i])) { sum += VECTOR(*v)[i]; }
}
for (i=0; i<n; i++) {
igraph_real_printf(VECTOR(*v)[i]/sum);
printf(" ");
}
printf("\n");
}
igraph_bool_t print_motif(const igraph_t *graph, igraph_vector_t *vids,
int isoclass, void* extra) {
printf("Class %d: ", isoclass);
igraph_vector_print(vids);
return 0;
}
int main() {
igraph_t g;
igraph_vector_t hist;
igraph_vector_t cp;
igraph_vector_init_real(&cp, 8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
igraph_ring(&g, 1000, IGRAPH_DIRECTED, 1, 1);
igraph_vector_init(&hist, 0);
igraph_motifs_randesu(&g, &hist, 3, &cp);
print_vector(&hist);
igraph_destroy(&g);
igraph_vector_destroy(&hist);
igraph_famous(&g, "bull");
igraph_motifs_randesu_callback(&g, 3, &cp, &print_motif, 0);
igraph_motifs_randesu_callback(&g, 4, &cp, &print_motif, 0);
igraph_destroy(&g);
igraph_vector_destroy(&cp);
return 0;
}
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* $FreeBSD$
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _REGSET_H
#define _REGSET_H
/*
* #pragma ident "@(#)regset.h 1.11 05/06/08 SMI"
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* XXXDTRACE: define registers properly
*/
#if 0
#define REG_PC PC
#define REG_FP EBP
#define REG_SP SP
#define REG_PS EFL
#define REG_R0 EAX
#define REG_R1 EDX
#endif
#ifdef __cplusplus
}
#endif
#endif /* _REGSET_H */
|
/*
* Copyright 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_BASE_SSLFINGERPRINT_H_
#define WEBRTC_BASE_SSLFINGERPRINT_H_
#include <string>
#include "webrtc/base/basictypes.h"
#include "webrtc/base/buffer.h"
#include "webrtc/base/sslidentity.h"
namespace rtc {
class SSLCertificate;
struct SSLFingerprint {
static SSLFingerprint* Create(const std::string& algorithm,
const rtc::SSLIdentity* identity);
static SSLFingerprint* Create(const std::string& algorithm,
const rtc::SSLCertificate* cert);
static SSLFingerprint* CreateFromRfc4572(const std::string& algorithm,
const std::string& fingerprint);
SSLFingerprint(const std::string& algorithm, const uint8* digest_in,
size_t digest_len);
SSLFingerprint(const SSLFingerprint& from);
bool operator==(const SSLFingerprint& other) const;
std::string GetRfc4572Fingerprint() const;
std::string ToString();
std::string algorithm;
rtc::Buffer digest;
};
} // namespace rtc
#endif // WEBRTC_BASE_SSLFINGERPRINT_H_
|
//
// Copyright 2016 Google Inc.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
#ifndef HS_GLSL_ONCE
#define HS_GLSL_ONCE
#define HS_SLAB_THREADS_LOG2 4
#define HS_SLAB_THREADS (1 << HS_SLAB_THREADS_LOG2)
#define HS_SLAB_WIDTH_LOG2 4
#define HS_SLAB_WIDTH (1 << HS_SLAB_WIDTH_LOG2)
#define HS_SLAB_HEIGHT 8
#define HS_SLAB_KEYS (HS_SLAB_WIDTH * HS_SLAB_HEIGHT)
#define HS_REG_LAST(c) c##8
#define HS_KEY_WORDS 1
#define HS_VAL_WORDS 0
#define HS_BS_SLABS 16
#define HS_BS_SLABS_LOG2_RU 4
#define HS_BC_SLABS_LOG2_MAX 4
#define HS_FM_BLOCK_HEIGHT 1
#define HS_FM_SCALE_MIN 0
#define HS_FM_SCALE_MAX 0
#define HS_HM_BLOCK_HEIGHT 1
#define HS_HM_SCALE_MIN 0
#define HS_HM_SCALE_MAX 0
#define HS_EMPTY
#define HS_INTEL_GEN8
#define HS_SLAB_ROWS() \
HS_SLAB_ROW( 1, 0 ) \
HS_SLAB_ROW( 2, 1 ) \
HS_SLAB_ROW( 3, 2 ) \
HS_SLAB_ROW( 4, 3 ) \
HS_SLAB_ROW( 5, 4 ) \
HS_SLAB_ROW( 6, 5 ) \
HS_SLAB_ROW( 7, 6 ) \
HS_SLAB_ROW( 8, 7 ) \
HS_EMPTY
#define HS_TRANSPOSE_SLAB() \
HS_TRANSPOSE_STAGE( 1 ) \
HS_TRANSPOSE_STAGE( 2 ) \
HS_TRANSPOSE_STAGE( 3 ) \
HS_TRANSPOSE_STAGE( 4 ) \
HS_TRANSPOSE_BLEND( r, s, 1, 2, 1 ) \
HS_TRANSPOSE_BLEND( r, s, 1, 4, 3 ) \
HS_TRANSPOSE_BLEND( r, s, 1, 6, 5 ) \
HS_TRANSPOSE_BLEND( r, s, 1, 8, 7 ) \
HS_TRANSPOSE_BLEND( s, t, 2, 3, 1 ) \
HS_TRANSPOSE_BLEND( s, t, 2, 4, 2 ) \
HS_TRANSPOSE_BLEND( s, t, 2, 7, 5 ) \
HS_TRANSPOSE_BLEND( s, t, 2, 8, 6 ) \
HS_TRANSPOSE_BLEND( t, u, 3, 5, 1 ) \
HS_TRANSPOSE_BLEND( t, u, 3, 6, 2 ) \
HS_TRANSPOSE_BLEND( t, u, 3, 7, 3 ) \
HS_TRANSPOSE_BLEND( t, u, 3, 8, 4 ) \
HS_TRANSPOSE_BLEND( u, v, 4, 2, 1 ) \
HS_TRANSPOSE_BLEND( u, v, 4, 4, 3 ) \
HS_TRANSPOSE_BLEND( u, v, 4, 6, 5 ) \
HS_TRANSPOSE_BLEND( u, v, 4, 8, 7 ) \
HS_TRANSPOSE_REMAP( v, 1, 1 ) \
HS_TRANSPOSE_REMAP( v, 2, 5 ) \
HS_TRANSPOSE_REMAP( v, 3, 2 ) \
HS_TRANSPOSE_REMAP( v, 4, 6 ) \
HS_TRANSPOSE_REMAP( v, 5, 3 ) \
HS_TRANSPOSE_REMAP( v, 6, 7 ) \
HS_TRANSPOSE_REMAP( v, 7, 4 ) \
HS_TRANSPOSE_REMAP( v, 8, 8 ) \
HS_EMPTY
#endif
//
//
//
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
#define REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
#include <memory>
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
namespace webrtc {
class DesktopFrame;
class DesktopRegion;
}
namespace remoting {
class VideoPacket;
class VideoEncoderHelper {
public:
VideoEncoderHelper();
VideoEncoderHelper(const VideoEncoderHelper&) = delete;
VideoEncoderHelper& operator=(const VideoEncoderHelper&) = delete;
// Returns a new VideoPacket with common fields (e.g. capture_time_ms, rects
// list, frame shape if any) initialized based on the supplied |frame|.
// Screen width and height will be set iff |frame|'s size differs from that
// of the previously-supplied frame.
std::unique_ptr<VideoPacket> CreateVideoPacket(
const webrtc::DesktopFrame& frame);
// Returns a new VideoPacket with the common fields populated from |frame|,
// but the updated rects overridden by |updated_region|. This is useful for
// encoders which alter the updated region e.g. by expanding it to macroblock
// boundaries.
std::unique_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion(
const webrtc::DesktopFrame& frame,
const webrtc::DesktopRegion& updated_region);
private:
// The most recent screen size. Used to detect screen size changes.
webrtc::DesktopSize screen_size_;
};
} // namespace remoting
#endif // REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_VIRTUAL_KEYBOARD_PRIVATE_CHROME_VIRTUAL_KEYBOARD_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_VIRTUAL_KEYBOARD_PRIVATE_CHROME_VIRTUAL_KEYBOARD_DELEGATE_H_
#include <string>
#include "ash/public/cpp/clipboard_history_controller.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_delegate.h"
#include "extensions/common/api/virtual_keyboard.h"
namespace media {
class AudioSystem;
}
namespace extensions {
class ChromeVirtualKeyboardDelegate
: public VirtualKeyboardDelegate,
public ash::ClipboardHistoryController::Observer {
public:
explicit ChromeVirtualKeyboardDelegate(
content::BrowserContext* browser_context);
ChromeVirtualKeyboardDelegate(const ChromeVirtualKeyboardDelegate&) = delete;
ChromeVirtualKeyboardDelegate& operator=(
const ChromeVirtualKeyboardDelegate&) = delete;
~ChromeVirtualKeyboardDelegate() override;
// TODO(oka): Create ChromeVirtualKeyboardPrivateDelegate class and move all
// the methods except for RestrictFeatures into the class for clear separation
// of virtualKeyboard and virtualKeyboardPrivate API.
void GetKeyboardConfig(
OnKeyboardSettingsCallback on_settings_callback) override;
void OnKeyboardConfigChanged() override;
bool HideKeyboard() override;
bool InsertText(const std::u16string& text) override;
bool OnKeyboardLoaded() override;
void SetHotrodKeyboard(bool enable) override;
bool LockKeyboard(bool state) override;
bool SendKeyEvent(const std::string& type,
int char_value,
int key_code,
const std::string& key_name,
int modifiers) override;
bool ShowLanguageSettings() override;
bool ShowSuggestionSettings() override;
bool IsSettingsEnabled() override;
bool SetVirtualKeyboardMode(int mode_enum,
gfx::Rect target_bounds,
OnSetModeCallback on_set_mode_callback) override;
bool SetDraggableArea(
const api::virtual_keyboard_private::Bounds& rect) override;
bool SetRequestedKeyboardState(int state_enum) override;
bool SetOccludedBounds(const std::vector<gfx::Rect>& bounds) override;
bool SetHitTestBounds(const std::vector<gfx::Rect>& bounds) override;
bool SetAreaToRemainOnScreen(const gfx::Rect& bounds) override;
bool SetWindowBoundsInScreen(const gfx::Rect& bounds_in_screen) override;
void GetClipboardHistory(
const std::set<std::string>& item_ids_filter,
OnGetClipboardHistoryCallback get_history_callback) override;
bool PasteClipboardItem(const std::string& clipboard_item_id) override;
bool DeleteClipboardItem(const std::string& clipboard_item_id) override;
api::virtual_keyboard::FeatureRestrictions RestrictFeatures(
const api::virtual_keyboard::RestrictFeatures::Params& params) override;
private:
// ash::ClipboardHistoryController::Observer:
void OnClipboardHistoryItemListAddedOrRemoved() override;
void OnClipboardHistoryItemsUpdated(
const std::vector<base::UnguessableToken>& menu_item_ids) override;
void OnGetHistoryValuesAfterItemsUpdated(base::Value updated_items);
void OnHasInputDevices(OnKeyboardSettingsCallback on_settings_callback,
bool has_audio_input_devices);
void DispatchConfigChangeEvent(
std::unique_ptr<base::DictionaryValue> settings);
content::BrowserContext* browser_context_;
std::unique_ptr<media::AudioSystem> audio_system_;
base::WeakPtr<ChromeVirtualKeyboardDelegate> weak_this_;
base::WeakPtrFactory<ChromeVirtualKeyboardDelegate> weak_factory_{this};
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_VIRTUAL_KEYBOARD_PRIVATE_CHROME_VIRTUAL_KEYBOARD_DELEGATE_H_
|
// Copyright 2021 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_ENTERPRISE_CONNECTORS_DEVICE_TRUST_ATTESTATION_ASH_ASH_ATTESTATION_SERVICE_H_
#define CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_ATTESTATION_ASH_ASH_ATTESTATION_SERVICE_H_
#include <memory>
#include "base/memory/weak_ptr.h"
#include "chrome/browser/enterprise/connectors/device_trust/attestation/common/attestation_service.h"
class Profile;
namespace ash {
namespace attestation {
struct TpmChallengeKeyResult;
class TpmChallengeKeyWithTimeout;
} // namespace attestation
} // namespace ash
namespace enterprise_connectors {
// This class is in charge of handling the key pair used for attestation. Also
// provides the methods needed in the handshake between Chrome, an IdP and
// Verified Access.
class AshAttestationService : public AttestationService {
public:
explicit AshAttestationService(Profile* profile);
~AshAttestationService() override;
// AttestationService:
void BuildChallengeResponseForVAChallenge(
const std::string& challenge,
std::unique_ptr<attestation::DeviceTrustSignals> signals,
AttestationCallback callback) override;
private:
// Runs the `callback` which resumes the navigation with the `result`
// challenge response. In case the challenge response was not successfully
// built. An empty challenge response will be used. `tpm_key_challenger` is
// also forwarded to ensure the instance lives as long as the callback runs.
void ReturnResult(
std::unique_ptr<ash::attestation::TpmChallengeKeyWithTimeout>
tpm_key_challenger,
AttestationCallback callback,
const ash::attestation::TpmChallengeKeyResult& result);
Profile* const profile_;
base::WeakPtrFactory<AshAttestationService> weak_factory_{this};
};
} // namespace enterprise_connectors
#endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_ATTESTATION_ASH_ASH_ATTESTATION_SERVICE_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_APPS_APP_WINDOW_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#define CHROME_BROWSER_UI_VIEWS_APPS_APP_WINDOW_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#include "base/memory/raw_ptr.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
namespace views {
class DesktopNativeWidgetAura;
}
class ChromeNativeAppWindowViewsWin;
// AppWindowDesktopWindowTreeHostWin handles updating the glass of app frames on
// Windows. It is used for all desktop app windows on Windows, but is only
// actively doing anything when a glass window frame is being used.
class AppWindowDesktopWindowTreeHostWin
: public views::DesktopWindowTreeHostWin {
public:
AppWindowDesktopWindowTreeHostWin(
ChromeNativeAppWindowViewsWin* app_window,
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
AppWindowDesktopWindowTreeHostWin(const AppWindowDesktopWindowTreeHostWin&) =
delete;
AppWindowDesktopWindowTreeHostWin& operator=(
const AppWindowDesktopWindowTreeHostWin&) = delete;
~AppWindowDesktopWindowTreeHostWin() override;
private:
// Overridden from DesktopWindowTreeHostWin:
bool GetClientAreaInsets(gfx::Insets* insets,
HMONITOR monitor) const override;
bool GetDwmFrameInsetsInPixels(gfx::Insets* insets) const override;
void HandleFrameChanged() override;
raw_ptr<ChromeNativeAppWindowViewsWin> app_window_;
};
#endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_WINDOW_DESKTOP_WINDOW_TREE_HOST_WIN_H_
|
/*
* licence.c: licence text
*/
#include <stdio.h>
static char *licencetext[] = {
"FIXME: licence text goes here",
NULL
};
void licence(void)
{
char **p;
for (p = licencetext; *p; p++)
puts(*p);
}
|
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2016, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
@class TyphoonBlockDefinition;
@class TyphoonInjectionContext;
typedef NS_ENUM(NSInteger, TyphoonBlockDefinitionRoute) {
TyphoonBlockDefinitionRouteInvalid,
TyphoonBlockDefinitionRouteConfiguration,
TyphoonBlockDefinitionRouteInitializer,
TyphoonBlockDefinitionRouteInjections
};
@interface TyphoonBlockDefinitionController : NSObject
+ (instancetype)currentController;
@property (nonatomic, assign, readonly) TyphoonBlockDefinitionRoute route;
@property (nonatomic, assign, readonly, getter = isBuildingInstance) BOOL buildingInstance;
@property (nonatomic, strong, readonly) TyphoonBlockDefinition *definition;
@property (nonatomic, strong, readonly) id instance;
@property (nonatomic, strong, readonly) TyphoonInjectionContext *injectionContext;
- (void)useConfigurationRouteWithinBlock:(void (^)())block;
- (void)useInitializerRouteWithDefinition:(TyphoonBlockDefinition *)definition
injectionContext:(TyphoonInjectionContext *)context
withinBlock:(void (^)())block;
- (void)useInjectionsRouteWithDefinition:(TyphoonBlockDefinition *)definition
instance:(id)instance
injectionContext:(TyphoonInjectionContext *)context
withinBlock:(void (^)())block;
@end
|
/* Copyright (C) 1991,92,94,95,97,98,2000,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <stddef.h>
#include <setjmp.h>
#include <signal.h>
/* Set the signal mask to the one specified in ENV, and jump
to the position specified in ENV, causing the setjmp
call there to return VAL, or 1 if VAL is 0. */
void
__libc_siglongjmp (sigjmp_buf env, int val)
{
/* Perform any cleanups needed by the frames being unwound. */
_longjmp_unwind (env, val);
if (env[0].__mask_was_saved)
/* Restore the saved signal mask. */
(void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
(sigset_t *) NULL);
/* Call the machine-dependent function to restore machine state. */
__longjmp (env[0].__jmpbuf, val ?: 1);
}
strong_alias (__libc_siglongjmp, __libc_longjmp)
libc_hidden_def (__libc_longjmp)
weak_alias (__libc_siglongjmp, _longjmp)
weak_alias (__libc_siglongjmp, longjmp)
weak_alias (__libc_siglongjmp, siglongjmp)
|
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmCTestCommand_h
#define cmCTestCommand_h
#include "cmCommand.h"
class cmCTest;
class cmCTestScriptHandler;
/** \class cmCTestCommand
* \brief A superclass for all commands added to the CTestScriptHandler
*
* cmCTestCommand is the superclass for all commands that will be added to
* the ctest script handlers parser.
*
*/
class cmCTestCommand : public cmCommand
{
public:
cmCTestCommand() {this->CTest = 0; this->CTestScriptHandler = 0;}
cmCTest *CTest;
cmCTestScriptHandler *CTestScriptHandler;
cmTypeMacro(cmCTestCommand, cmCommand);
};
#endif
|
#include "blaswrap.h"
#include "f2c.h"
/* Subroutine */ int dormr3_(char *side, char *trans, integer *m, integer *n,
integer *k, integer *l, doublereal *a, integer *lda, doublereal *tau,
doublereal *c__, integer *ldc, doublereal *work, integer *info)
{
/* -- LAPACK routine (version 3.0) --
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
Courant Institute, Argonne National Lab, and Rice University
June 30, 1999
Purpose
=======
DORMR3 overwrites the general real m by n matrix C with
Q * C if SIDE = 'L' and TRANS = 'N', or
Q'* C if SIDE = 'L' and TRANS = 'T', or
C * Q if SIDE = 'R' and TRANS = 'N', or
C * Q' if SIDE = 'R' and TRANS = 'T',
where Q is a real orthogonal matrix defined as the product of k
elementary reflectors
Q = H(1) H(2) . . . H(k)
as returned by DTZRZF. Q is of order m if SIDE = 'L' and of order n
if SIDE = 'R'.
Arguments
=========
SIDE (input) CHARACTER*1
= 'L': apply Q or Q' from the Left
= 'R': apply Q or Q' from the Right
TRANS (input) CHARACTER*1
= 'N': apply Q (No transpose)
= 'T': apply Q' (Transpose)
M (input) INTEGER
The number of rows of the matrix C. M >= 0.
N (input) INTEGER
The number of columns of the matrix C. N >= 0.
K (input) INTEGER
The number of elementary reflectors whose product defines
the matrix Q.
If SIDE = 'L', M >= K >= 0;
if SIDE = 'R', N >= K >= 0.
L (input) INTEGER
The number of columns of the matrix A containing
the meaningful part of the Householder reflectors.
If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
A (input) DOUBLE PRECISION array, dimension
(LDA,M) if SIDE = 'L',
(LDA,N) if SIDE = 'R'
The i-th row must contain the vector which defines the
elementary reflector H(i), for i = 1,2,...,k, as returned by
DTZRZF in the last k rows of its array argument A.
A is modified by the routine but restored on exit.
LDA (input) INTEGER
The leading dimension of the array A. LDA >= max(1,K).
TAU (input) DOUBLE PRECISION array, dimension (K)
TAU(i) must contain the scalar factor of the elementary
reflector H(i), as returned by DTZRZF.
C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
On entry, the m-by-n matrix C.
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
LDC (input) INTEGER
The leading dimension of the array C. LDC >= max(1,M).
WORK (workspace) DOUBLE PRECISION array, dimension
(N) if SIDE = 'L',
(M) if SIDE = 'R'
INFO (output) INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
Further Details
===============
Based on contributions by
A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
=====================================================================
Test the input arguments
Parameter adjustments */
/* System generated locals */
integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
/* Local variables */
static logical left;
static integer i__;
extern logical lsame_(char *, char *);
extern /* Subroutine */ int dlarz_(char *, integer *, integer *, integer *
, doublereal *, integer *, doublereal *, doublereal *, integer *,
doublereal *);
static integer i1, i2, i3, ja, ic, jc, mi, ni, nq;
extern /* Subroutine */ int xerbla_(char *, integer *);
static logical notran;
#define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
#define c___ref(a_1,a_2) c__[(a_2)*c_dim1 + a_1]
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
--tau;
c_dim1 = *ldc;
c_offset = 1 + c_dim1 * 1;
c__ -= c_offset;
--work;
/* Function Body */
*info = 0;
left = lsame_(side, "L");
notran = lsame_(trans, "N");
/* NQ is the order of Q */
if (left) {
nq = *m;
} else {
nq = *n;
}
if (! left && ! lsame_(side, "R")) {
*info = -1;
} else if (! notran && ! lsame_(trans, "T")) {
*info = -2;
} else if (*m < 0) {
*info = -3;
} else if (*n < 0) {
*info = -4;
} else if (*k < 0 || *k > nq) {
*info = -5;
} else if (*l < 0 || left && *l > *m || ! left && *l > *n) {
*info = -6;
} else if (*lda < max(1,*k)) {
*info = -8;
} else if (*ldc < max(1,*m)) {
*info = -11;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("DORMR3", &i__1);
return 0;
}
/* Quick return if possible */
if (*m == 0 || *n == 0 || *k == 0) {
return 0;
}
if (left && ! notran || ! left && notran) {
i1 = 1;
i2 = *k;
i3 = 1;
} else {
i1 = *k;
i2 = 1;
i3 = -1;
}
if (left) {
ni = *n;
ja = *m - *l + 1;
jc = 1;
} else {
mi = *m;
ja = *n - *l + 1;
ic = 1;
}
i__1 = i2;
i__2 = i3;
for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
if (left) {
/* H(i) or H(i)' is applied to C(i:m,1:n) */
mi = *m - i__ + 1;
ic = i__;
} else {
/* H(i) or H(i)' is applied to C(1:m,i:n) */
ni = *n - i__ + 1;
jc = i__;
}
/* Apply H(i) or H(i)' */
dlarz_(side, &mi, &ni, l, &a_ref(i__, ja), lda, &tau[i__], &c___ref(
ic, jc), ldc, &work[1]);
/* L10: */
}
return 0;
/* End of DORMR3 */
} /* dormr3_ */
#undef c___ref
#undef a_ref
|
#undef CONFIG_FEATURE_HTTPD_AUTH_MD5
|
/* Public keys for module signature verification
*
* Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licence
* as published by the Free Software Foundation; either version
* 2 of the Licence, or (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/err.h>
#include <keys/asymmetric-type.h>
#include "module-internal.h"
struct key *modsign_keyring;
extern __initdata const u8 modsign_certificate_list[];
extern __initdata const u8 modsign_certificate_list_end[];
asm(".section .init.data,\"aw\"\n"
"modsign_certificate_list:\n"
".incbin \"signing_key.x509\"\n"
".incbin \"extra_certificates\"\n"
"modsign_certificate_list_end:"
);
/*
* We need to make sure ccache doesn't cache the .o file as it doesn't notice
* if modsign.pub changes.
*/
static __initdata const char annoy_ccache[] = __TIME__ "foo";
/*
* Load the compiled-in keys
*/
static __init int module_verify_init(void)
{
pr_notice("Initialise module verification\n");
modsign_keyring = key_alloc(&key_type_keyring, ".module_sign",
(0), (0),
current_cred(),
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA);
if (IS_ERR(modsign_keyring))
panic("Can't allocate module signing keyring\n");
if (key_instantiate_and_link(modsign_keyring, NULL, 0, NULL, NULL) < 0)
panic("Can't instantiate module signing keyring\n");
return 0;
}
/*
* Must be initialised before we try and load the keys into the keyring.
*/
device_initcall(module_verify_init);
/*
* Load the compiled-in keys
*/
static __init int load_module_signing_keys(void)
{
key_ref_t key;
const u8 *p, *end;
size_t plen;
pr_notice("Loading module verification certificates\n");
end = modsign_certificate_list_end;
p = modsign_certificate_list;
while (p < end) {
/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
* than 256 bytes in size.
*/
if (end - p < 4)
goto dodgy_cert;
if (p[0] != 0x30 &&
p[1] != 0x82)
goto dodgy_cert;
plen = (p[2] << 8) | p[3];
plen += 4;
if (plen > end - p)
goto dodgy_cert;
key = key_create_or_update(make_key_ref(modsign_keyring, 1),
"asymmetric",
NULL,
p,
plen,
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
KEY_USR_VIEW,
KEY_ALLOC_NOT_IN_QUOTA);
if (IS_ERR(key))
pr_err("MODSIGN: Problem loading in-kernel X.509 certificate (%ld)\n",
PTR_ERR(key));
else
pr_notice("MODSIGN: Loaded cert '%s'\n",
key_ref_to_ptr(key)->description);
p += plen;
}
return 0;
dodgy_cert:
pr_err("MODSIGN: Problem parsing in-kernel X.509 certificate list\n");
return 0;
}
late_initcall(load_module_signing_keys);
|
/**********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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.
***********************************************************************/
#ifndef FC__DIPLODLG_G_H
#define FC__DIPLODLG_G_H
#include "shared.h"
#include "diptreaty.h"
void handle_diplomacy_init_meeting(int counterpart, int initiated_from);
void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from);
void handle_diplomacy_create_clause(int counterpart, int giver,
enum clause_type type, int value);
void handle_diplomacy_remove_clause(int counterpart, int giver,
enum clause_type type, int value);
void handle_diplomacy_accept_treaty(int counterpart, bool I_accepted,
bool other_accepted);
void close_all_diplomacy_dialogs(void);
#endif /* FC__DIPLODLG_G_H */
|
/* { dg-do run { target { ! ia32 } } } */
/* { dg-require-effective-target amx_tile } */
/* { dg-require-effective-target amx_int8 } */
/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
#include <immintrin.h>
#define AMX_INT8
#define DO_TEST test_amx_int8_dpbsud
void test_amx_int8_dpbsud ();
#include "amx-check.h"
/* Init tile buffer with int32 value*/
void init_i32_max_tile_buffer (uint8_t *buf)
{
int i, j;
int *ptr = (int *)buf;
for (i = 0; i < 16; i++)
for (j = 0; j < 16; j++)
ptr[i * 16 + j] = 2 * i - (16 - j);
}
void calc_matrix_dpbsud (__tile *dst, __tile *src1, __tile *src2)
{
int8_t *src1_buf = (int8_t *)src1->buf;
uint8_t *src2_buf = (uint8_t *)src2->buf;
int *dst_buf = (int *)dst->buf;
int M = src1->rows;
int N = src1->colsb / 4;
int K = src2->colsb / 4;
int i, j, k, t;
for (i = 0; i < M; i++)
for (j = 0; j < N; j++)
for (k = 0; k < K; k++)
for (t = 0; t < 4; t++)
{
dst_buf[i * N + k] +=
((int) src1_buf[i * 4 * N + 4 * j + t]) *
((unsigned) src2_buf[j * 4 * K + 4 * k + t]);
}
}
void test_amx_int8_dpbsud ()
{
__tilecfg_u cfg;
__tile dst, dst_ref, src1, src2;
uint8_t tmp_dst_buf[1024];
init_i32_max_tile_buffer (tmp_dst_buf);
init_tile_config (&cfg);
init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
init_tile_reg_and_src (2, src1);
init_tile_reg_and_src (3, src2);
calc_matrix_dpbsud (&dst, &src1, &src2);
_tile_dpbsud (1, 2, 3);
_tile_stored (1, dst_ref.buf, _STRIDE);
if (!check_tile_register (&dst_ref, &dst))
abort();
}
|
/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include <tls.h>
#ifndef __ASSEMBLER__
# include <nptl/pthreadP.h>
#endif
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
/* ??? Assumes that nothing comes between PSEUDO and PSEUDO_END
besides "ret". */
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.globl __##syscall_name##_nocancel; \
.type __##syscall_name##_nocancel, @function; \
.usepv __##syscall_name##_nocancel, std; \
.align 4; \
cfi_startproc; \
__LABEL(__##syscall_name##_nocancel) \
ldgp gp, 0(pv); \
PSEUDO_PROF; \
__LABEL($pseudo_nocancel) \
PSEUDO_PREPARE_ARGS; \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys; \
bne a3, SYSCALL_ERROR_LABEL; \
__LABEL($pseudo_ret) \
.subsection 2; \
.size __##syscall_name##_nocancel, .-__##syscall_name##_nocancel; \
.globl name; \
.type name, @function; \
.usepv name, std; \
.align 4; \
cfi_startproc; \
__LABEL(name) \
ldgp gp, 0(pv); \
PSEUDO_PROF; \
SINGLE_THREAD_P(t0); \
beq t0, $pseudo_nocancel; \
subq sp, 64, sp; \
cfi_def_cfa_offset(64); \
stq ra, 0(sp); \
cfi_offset(ra, -64); \
SAVE_ARGS_##args; \
CENABLE; \
LOAD_ARGS_##args; \
/* Save the CENABLE return value in RA. That register \
is preserved across syscall and the real return \
address is saved on the stack. */ \
mov v0, ra; \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys; \
stq v0, 8(sp); \
mov ra, a0; \
bne a3, $multi_error; \
CDISABLE; \
ldq ra, 0(sp); \
ldq v0, 8(sp); \
addq sp, 64, sp; \
cfi_remember_state; \
cfi_restore(ra); \
cfi_def_cfa_offset(0); \
ret; \
cfi_restore_state; \
__LABEL($multi_error) \
CDISABLE; \
ldq ra, 0(sp); \
ldq v0, 8(sp); \
addq sp, 64, sp; \
cfi_restore(ra); \
cfi_def_cfa_offset(0); \
SYSCALL_ERROR_FALLTHRU; \
SYSCALL_ERROR_HANDLER; \
cfi_endproc; \
.previous
# undef PSEUDO_END
# define PSEUDO_END(sym) \
cfi_endproc; \
.subsection 2; \
.size sym, .-sym
# define SAVE_ARGS_0 /* Nothing. */
# define SAVE_ARGS_1 SAVE_ARGS_0; stq a0, 8(sp)
# define SAVE_ARGS_2 SAVE_ARGS_1; stq a1, 16(sp)
# define SAVE_ARGS_3 SAVE_ARGS_2; stq a2, 24(sp)
# define SAVE_ARGS_4 SAVE_ARGS_3; stq a3, 32(sp)
# define SAVE_ARGS_5 SAVE_ARGS_4; stq a4, 40(sp)
# define SAVE_ARGS_6 SAVE_ARGS_5; stq a5, 48(sp)
# define LOAD_ARGS_0 /* Nothing. */
# define LOAD_ARGS_1 LOAD_ARGS_0; ldq a0, 8(sp)
# define LOAD_ARGS_2 LOAD_ARGS_1; ldq a1, 16(sp)
# define LOAD_ARGS_3 LOAD_ARGS_2; ldq a2, 24(sp)
# define LOAD_ARGS_4 LOAD_ARGS_3; ldq a3, 32(sp)
# define LOAD_ARGS_5 LOAD_ARGS_4; ldq a4, 40(sp)
# define LOAD_ARGS_6 LOAD_ARGS_5; ldq a5, 48(sp)
# ifdef IS_IN_libpthread
# define __local_enable_asynccancel __pthread_enable_asynccancel
# define __local_disable_asynccancel __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
# define __local_enable_asynccancel __libc_enable_asynccancel
# define __local_disable_asynccancel __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
# elif defined IS_IN_librt
# define __local_enable_asynccancel __librt_enable_asynccancel
# define __local_disable_asynccancel __librt_disable_asynccancel
# else
# error Unsupported library
# endif
# ifdef PIC
# define CENABLE bsr ra, __local_enable_asynccancel !samegp
# define CDISABLE bsr ra, __local_disable_asynccancel !samegp
# else
# define CENABLE jsr ra, __local_enable_asynccancel; ldgp ra, 0(gp)
# define CDISABLE jsr ra, __local_disable_asynccancel; ldgp ra, 0(gp)
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
# define SINGLE_THREAD_P \
__builtin_expect (__local_multiple_threads == 0, 1)
# elif defined(PIC)
# define SINGLE_THREAD_P(reg) ldl reg, __local_multiple_threads(gp) !gprel
# else
# define SINGLE_THREAD_P(reg) \
ldah reg, __local_multiple_threads(gp) !gprelhigh; \
ldl reg, __local_multiple_threads(reg) !gprellow
# endif
# else
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P(reg) \
call_pal PAL_rduniq; \
ldl reg, MULTIPLE_THREADS_OFFSET($0)
# endif
# endif
#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
#endif
|
// Must compile with -g and -O
int foo (int, int);
int bar (int x, int y) {
int z = x % y;
return z;
}
int main(int argc, char** argv) {
int a = argc;
a = foo(a, a);
return a;
}
|
/* GStreamer
*
* unit test for mpeg2enc
*
* Copyright (C) <2006> Mark Nauwelaerts <manauw@skynet.be>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <unistd.h>
#include <gst/check/gstcheck.h>
/* For ease of programming we use globals to keep refs for our floating
* src and sink pads we create; otherwise we always have to do get_pad,
* get_peer, and then remove references in every test function */
static GstPad *mysrcpad, *mysinkpad;
#define VIDEO_CAPS_STRING "video/x-raw, " \
"format = (string) I420, " \
"width = (int) 384, " \
"height = (int) 288, " \
"framerate = (fraction) 25/1"
#define MPEG_CAPS_STRING "video/mpeg, " \
"mpegversion = (int) { 1, 2 }, " \
"systemstream = (bool) false, " \
"height = (int) 288, " \
"framerate = (fraction) 25/1"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (MPEG_CAPS_STRING));
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (VIDEO_CAPS_STRING));
/* some global vars, makes it easy as for the ones above */
static GMutex mpeg2enc_mutex;
static GCond mpeg2enc_cond;
static gboolean arrived_eos;
static gboolean
test_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
g_mutex_lock (&mpeg2enc_mutex);
arrived_eos = TRUE;
g_cond_signal (&mpeg2enc_cond);
g_mutex_unlock (&mpeg2enc_mutex);
break;
default:
break;
}
return gst_pad_event_default (pad, parent, event);
}
static GstElement *
setup_mpeg2enc (void)
{
GstElement *mpeg2enc;
GST_DEBUG ("setup_mpeg2enc");
mpeg2enc = gst_check_setup_element ("mpeg2enc");
mysrcpad = gst_check_setup_src_pad (mpeg2enc, &srctemplate);
mysinkpad = gst_check_setup_sink_pad (mpeg2enc, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
/* need to know when we are eos */
gst_pad_set_event_function (mysinkpad, test_sink_event);
/* and notify the test run */
g_mutex_init (&mpeg2enc_mutex);
g_cond_init (&mpeg2enc_cond);
return mpeg2enc;
}
static void
cleanup_mpeg2enc (GstElement * mpeg2enc)
{
GST_DEBUG ("cleanup_mpeg2enc");
gst_element_set_state (mpeg2enc, GST_STATE_NULL);
gst_pad_set_active (mysrcpad, FALSE);
gst_pad_set_active (mysinkpad, FALSE);
gst_check_teardown_src_pad (mpeg2enc);
gst_check_teardown_sink_pad (mpeg2enc);
gst_check_teardown_element (mpeg2enc);
g_mutex_clear (&mpeg2enc_mutex);
g_cond_clear (&mpeg2enc_cond);
}
GST_START_TEST (test_video_pad)
{
GstElement *mpeg2enc;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
int i, num_buffers;
guint8 data0[] = { 0x00, 0x00, 0x01, 0xb3 };
mpeg2enc = setup_mpeg2enc ();
fail_unless (gst_element_set_state (mpeg2enc,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* corresponds to I420 buffer for the size mentioned in the caps */
inbuffer = gst_buffer_new_and_alloc (384 * 288 * 3 / 2);
/* makes valgrind's memcheck happier */
gst_buffer_memset (inbuffer, 0, 0, -1);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* need to force eos and state change to make sure the encoding task ends */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
/* need to wait a bit to make sure mpeg2enc task digested all this */
g_mutex_lock (&mpeg2enc_mutex);
while (!arrived_eos)
g_cond_wait (&mpeg2enc_cond, &mpeg2enc_mutex);
g_mutex_unlock (&mpeg2enc_mutex);
num_buffers = g_list_length (buffers);
/* well, we do not really know much with mpeg, but at least something ... */
fail_unless (num_buffers >= 1);
/* clean up buffers */
for (i = 0; i < num_buffers; ++i) {
outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL);
switch (i) {
case 0:
fail_unless (gst_buffer_get_size (outbuffer) >= sizeof (data0));
fail_unless (gst_buffer_memcmp (outbuffer, 0, data0,
sizeof (data0)) == 0);
break;
default:
break;
}
buffers = g_list_remove (buffers, outbuffer);
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
gst_buffer_unref (outbuffer);
outbuffer = NULL;
}
cleanup_mpeg2enc (mpeg2enc);
g_list_free (buffers);
buffers = NULL;
}
GST_END_TEST;
static Suite *
mpeg2enc_suite (void)
{
Suite *s = suite_create ("mpeg2enc");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_video_pad);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = mpeg2enc_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}
|
#include <math.h>
#include "libm.h"
int __fpclassify(double x)
{
uint32_t lo,hi;
EXTRACT_WORDS(hi,lo,x);
int e = hi>>7 & 0x7ff;
if (!e) {
if (lo == 0 && (hi << 1) == 0)
return FP_ZERO;
return FP_SUBNORMAL;
}
if (e==0x7ff) {
if (lo || hi & 0x000FFFFF)
return FP_NAN;
return FP_INFINITE;
}
return FP_NORMAL;
}
|
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
*/
#include <string.h>
#include "grn.h"
#include "grn_db.h"
#include "grn_ctx_impl.h"
struct _grn_command_input {
grn_obj *command;
grn_hash *arguments;
};
grn_command_input *
grn_command_input_open(grn_ctx *ctx, grn_obj *command)
{
grn_command_input *input = NULL;
GRN_API_ENTER;
input = GRN_MALLOC(sizeof(grn_command_input));
if (!input) {
ERR(GRN_NO_MEMORY_AVAILABLE,
"[command-input] failed to allocate grn_command_input");
goto exit;
}
input->command = command;
/* TODO: Allocate by self. */
{
uint32_t n;
input->arguments = grn_expr_get_vars(ctx, input->command, &n);
}
exit :
GRN_API_RETURN(input);
}
grn_rc
grn_command_input_close(grn_ctx *ctx, grn_command_input *input)
{
GRN_API_ENTER;
/* TODO: Free input->arguments by self. */
/* grn_expr_clear_vars(ctx, input->command); */
GRN_FREE(input);
GRN_API_RETURN(ctx->rc);
}
grn_obj *
grn_command_input_add(grn_ctx *ctx,
grn_command_input *input,
const char *name,
int name_size,
grn_bool *added)
{
grn_obj *argument = NULL;
/* TODO: Use grn_bool */
int internal_added = GRN_FALSE;
GRN_API_ENTER;
if (name_size == -1) {
name_size = strlen(name);
}
if (input->arguments) {
grn_hash_add(ctx, input->arguments, name, name_size, (void **)&argument,
&internal_added);
if (internal_added) {
GRN_TEXT_INIT(argument, 0);
}
}
if (added) {
*added = internal_added;
}
GRN_API_RETURN(argument);
}
grn_obj *
grn_command_input_get(grn_ctx *ctx,
grn_command_input *input,
const char *name,
int name_size)
{
grn_obj *argument = NULL;
GRN_API_ENTER;
if (name_size == -1) {
name_size = strlen(name);
}
if (input->arguments) {
grn_hash_get(ctx, input->arguments, name, name_size, (void **)&argument);
}
GRN_API_RETURN(argument);
}
grn_obj *
grn_command_input_at(grn_ctx *ctx,
grn_command_input *input,
unsigned int offset)
{
grn_obj *argument = NULL;
GRN_API_ENTER;
if (input->arguments) {
argument = (grn_obj *)grn_hash_get_value_(ctx, input->arguments,
offset + 1, NULL);
}
GRN_API_RETURN(argument);
}
grn_obj *
grn_command_input_get_arguments(grn_ctx *ctx,
grn_command_input *input)
{
GRN_API_ENTER;
GRN_API_RETURN((grn_obj *)(input->arguments));
}
grn_rc
grn_command_register(grn_ctx *ctx,
const char *command_name,
int command_name_size,
grn_command_run_func *run,
grn_expr_var *vars,
unsigned int n_vars,
void *user_data)
{
GRN_API_ENTER;
if (command_name_size == -1) {
command_name_size = strlen(command_name);
}
{
grn_obj *command_object;
command_object = grn_proc_create(ctx,
command_name,
command_name_size,
GRN_PROC_COMMAND,
NULL, NULL, NULL, n_vars, vars);
if (!command_object) {
GRN_PLUGIN_ERROR(ctx, GRN_COMMAND_ERROR,
"[command][%.*s] failed to grn_proc_create()",
command_name_size, command_name);
GRN_API_RETURN(ctx->rc);
}
{
grn_proc *command = (grn_proc *)command_object;
command->callbacks.command.run = run;
command->user_data = user_data;
}
}
GRN_API_RETURN(GRN_SUCCESS);
}
grn_rc
grn_command_run(grn_ctx *ctx,
grn_obj *command,
grn_command_input *input)
{
grn_proc *proc;
GRN_API_ENTER;
proc = (grn_proc *)command;
if (proc->callbacks.command.run) {
proc->callbacks.command.run(ctx, command, input, proc->user_data);
} else {
/* TODO: REMOVE ME. For backward compatibility. */
uint32_t stack_curr = ctx->impl->stack_curr;
grn_proc_call(ctx, command, 0, command);
if (ctx->impl->stack_curr > stack_curr) {
grn_ctx_pop(ctx);
}
}
GRN_API_RETURN(ctx->rc);
}
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
//=============================================================================
//
// Custom property structs
//
//-----------------------------------------------------------------------------
//
// Custom property schema is kept by GameSetupStruct object as a single
// instance and defines property type and default value. Every game entity that
// has properties implemented keeps CustomProperties object, which stores
// actual property values only if ones are different from defaults.
//
//=============================================================================
#ifndef AGS_SHARED_GAME_CUSTOM_PROPERTIES_H
#define AGS_SHARED_GAME_CUSTOM_PROPERTIES_H
#include "ags/lib/std/map.h"
#include "ags/shared/util/string.h"
#include "ags/shared/util/string_types.h"
namespace AGS3 {
#define LEGACY_MAX_CUSTOM_PROPERTIES 30
// NOTE: for some reason the property name stored in schema object was limited
// to only 20 characters, while the custom properties map could hold up to 200.
// Whether this was an error or design choice is unknown.
#define LEGACY_MAX_CUSTOM_PROP_SCHEMA_NAME_LENGTH 20
#define LEGACY_MAX_CUSTOM_PROP_NAME_LENGTH 200
#define LEGACY_MAX_CUSTOM_PROP_DESC_LENGTH 100
#define LEGACY_MAX_CUSTOM_PROP_VALUE_LENGTH 500
namespace AGS {
namespace Shared {
enum PropertyVersion {
kPropertyVersion_Initial = 1,
kPropertyVersion_340,
kPropertyVersion_Current = kPropertyVersion_340
};
enum PropertyType {
kPropertyUndefined = 0,
kPropertyBoolean,
kPropertyInteger,
kPropertyString
};
enum PropertyError {
kPropertyErr_NoError,
kPropertyErr_UnsupportedFormat
};
//
// PropertyDesc - a description of a single custom property
//
struct PropertyDesc {
String Name;
PropertyType Type;
String Description;
String DefaultValue;
PropertyDesc();
PropertyDesc(const String &name, PropertyType type, const String &desc, const String &def_value);
};
// NOTE: AGS has case-insensitive property IDs
// Schema - a map of property descriptions
typedef std::unordered_map<String, PropertyDesc, IgnoreCase_Hash, IgnoreCase_EqualTo> PropertySchema;
namespace Properties {
PropertyError ReadSchema(PropertySchema &schema, Stream *in);
void WriteSchema(const PropertySchema &schema, Stream *out);
// Reads property values from the stream and assign them to map.
// The non-matching existing map items, if any, are NOT erased.
PropertyError ReadValues(StringIMap &map, Stream *in);
// Writes property values chunk to the stream
void WriteValues(const StringIMap &map, Stream *out);
} // namespace Properties
} // namespace Shared
} // namespace AGS
} // namespace AGS3
#endif
|
/*
* QEMU System Emulator - managing I/O handler
*
* Copyright (c) 2003-2008 Fabrice Bellard
*
* 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.
*/
#include "config-host.h"
#include "qemu-common.h"
#include "qemu/queue.h"
#include "block/aio.h"
#include "qemu/main-loop.h"
#ifndef _WIN32
#include <sys/wait.h>
#endif
/* This context runs on top of main loop. We can't reuse qemu_aio_context
* because iohandlers mustn't be polled by aio_poll(qemu_aio_context). */
static AioContext *iohandler_ctx;
static void iohandler_init(void)
{
if (!iohandler_ctx) {
iohandler_ctx = aio_context_new(&error_abort);
}
}
GSource *iohandler_get_g_source(void)
{
iohandler_init();
return aio_get_g_source(iohandler_ctx);
}
void qemu_set_fd_handler(int fd,
IOHandler *fd_read,
IOHandler *fd_write,
void *opaque)
{
iohandler_init();
aio_set_fd_handler(iohandler_ctx, fd, false,
fd_read, fd_write, opaque);
}
/* reaping of zombies. right now we're not passing the status to
anyone, but it would be possible to add a callback. */
#ifndef _WIN32
typedef struct ChildProcessRecord {
int pid;
QLIST_ENTRY(ChildProcessRecord) next;
} ChildProcessRecord;
static QLIST_HEAD(, ChildProcessRecord) child_watches =
QLIST_HEAD_INITIALIZER(child_watches);
static QEMUBH *sigchld_bh;
static void sigchld_handler(int signal)
{
qemu_bh_schedule(sigchld_bh);
}
static void sigchld_bh_handler(void *opaque)
{
ChildProcessRecord *rec, *next;
QLIST_FOREACH_SAFE(rec, &child_watches, next, next) {
if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) {
QLIST_REMOVE(rec, next);
g_free(rec);
}
}
}
static void qemu_init_child_watch(void)
{
struct sigaction act;
sigchld_bh = qemu_bh_new(sigchld_bh_handler, NULL);
memset(&act, 0, sizeof(act));
act.sa_handler = sigchld_handler;
act.sa_flags = SA_NOCLDSTOP;
sigaction(SIGCHLD, &act, NULL);
}
int qemu_add_child_watch(pid_t pid)
{
ChildProcessRecord *rec;
if (!sigchld_bh) {
qemu_init_child_watch();
}
QLIST_FOREACH(rec, &child_watches, next) {
if (rec->pid == pid) {
return 1;
}
}
rec = g_malloc0(sizeof(ChildProcessRecord));
rec->pid = pid;
QLIST_INSERT_HEAD(&child_watches, rec, next);
return 0;
}
#endif
|
/*-------------------------------------------------------------------------
This source file is a part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2014 Torus Knot Software Ltd
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 __OgreDefaultWorkQueueTBB_H__
#define __OgreDefaultWorkQueueTBB_H__
#include "../OgreWorkQueue.h"
#include <set>
namespace Ogre
{
/** Implementation of a general purpose request / response style background work queue.
@remarks
This implementation utilises tbb's task system for the WorkQueue implementation.
*/
class _OgreExport DefaultWorkQueue : public DefaultWorkQueueBase
{
public:
DefaultWorkQueue(const String& name = BLANKSTRING);
virtual ~DefaultWorkQueue();
/** Process the next request on the queue.
@remarks
This method is public, but only intended for advanced users to call.
The only reason you would call this, is if you were using your
own thread to drive the worker processing. The thread calling this
method will be the thread used to call the RequestHandler.
*/
/// Main function for each thread spawned.
virtual void _threadMain();
/// @copydoc WorkQueue::shutdown
virtual void shutdown();
/// @copydoc WorkQueue::startup
virtual void startup(bool forceRestart = true);
/// Register the current thread with the rendersystem
void _registerThreadWithRenderSystem();
protected:
virtual void notifyWorkers();
private:
#if OGRE_NO_TBB_SCHEDULER == 0
tbb::task_scheduler_init mTaskScheduler;
#endif
tbb::task_group mTaskGroup;
/// Synchronise registering threads with the RenderSystem
OGRE_MUTEX(mRegisterRSMutex);
std::set<tbb::tbb_thread::id> mRegisteredThreads;
};
}
#endif
|
//____________________________________________________________________________
/*!
\class genie::P33PaschosLalakulichPXSec
\brief Double differential resonance cross section for P33 according to the
Paschos, Lalakulich model.
Is a concrete implementation of the XSecAlgorithmI interface.
\ref O.Lalakulich and E.A.Paschos, Resonance Production by Neutrinos:
I. J=3/2 Resonances, hep-ph/0501109
\author This class is based on code written by the model authors (Olga
Lalakulich, 17.02.2005). The code was modified to fit into the
GENIE framework by Costas Andreopoulos.
\created February 22, 2005
\cpright Copyright (c) 2003-2015, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _P33_PASCHOS_LALAKULICH_PARTIAL_XSEC_H_
#define _P33_PASCHOS_LALAKULICH_PARTIAL_XSEC_H_
#include "Base/XSecAlgorithmI.h"
namespace genie {
class BaryonResDataSetI;
class XSecIntegratorI;
class P33PaschosLalakulichPXSec : public XSecAlgorithmI {
public:
P33PaschosLalakulichPXSec();
P33PaschosLalakulichPXSec(string name);
virtual ~P33PaschosLalakulichPXSec();
//-- XSecAlgorithmI interface implementation
double XSec (const Interaction * i, KinePhaseSpace_t k) const;
double Integral (const Interaction * i) const;
bool ValidProcess (const Interaction * i) const;
//-- overload the Algorithm::Configure() methods to load private data
// members from configuration options
void Configure(const Registry & config);
void Configure(string config);
private:
void LoadConfig (void);
double Pauli (double Q2, double W, double MN) const; ///< Pauli suppression for D2
double Nu (double Q2, double W, double MN) const; ///< kinematic variables
double NuStar (double Q2, double W, double MN) const; ///< ...
double PPiStar (double W, double MN) const; ///< ...
const BaryonResDataSetI * fRESDataTable;
const XSecIntegratorI * fXSecIntegrator;
bool fTurnOnPauliCorrection;
double fMa;
double fMv;
double fCos28c;
};
} // genie namespace
#endif // _P33_PASCHOS_LALAKULICH_PARTIAL_XSEC_H_
|
#include "f2c.h"
#ifdef KR_headers
double floor();
shortint h_nint(x) real *x;
#else
#undef abs
#include "math.h"
shortint h_nint(real *x)
#endif
{
return (shortint)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x));
}
|
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "util.h"
/* STUB */
void util_in_open(void *ptr)
{ return;
}
|
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <malloc.h>
#include <ctype.h>
#include "stats.h"
#include "collect.h"
#include "trace.h"
#include "string1.h"
/* The /proc manpage says units are units of 1/sysconf(_SC_CLK_TCK)
seconds. sysconf(_SC_CLK_TCK) seems to always be 100. */
/* We ignore steal and guest. */
#define KEYS \
X(user, "E,U=cs", "time in user mode"), \
X(nice, "E,U=cs", "time in user mode with low priority"), \
X(system, "E,U=cs", "time in system mode"), \
X(idle, "E,U=cs", "time in idle task"), \
X(iowait, "E,U=cs", "time in I/O wait"), \
X(irq, "E,U=cs", "time in IRQ"), \
X(softirq, "E,U=cs", "time in softIRQ")
static void cpu_collect(struct stats_type *type)
{
const char *path = "/proc/stat";
FILE *file = NULL;
char file_buf[4096];
char *line = NULL;
size_t line_size = 0;
file = fopen(path, "r");
if (file == NULL) {
ERROR("cannot open `%s': %m\n", path);
goto out;
}
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf));
while (getline(&line, &line_size, file) >= 0) {
char *rest = line;
char *cpu = wsep(&rest);
if (cpu == NULL || rest == NULL)
continue;
if (strncmp(cpu, "cpu", 3) != 0)
continue;
cpu += 3;
if (!isdigit(*cpu))
continue;
struct stats *stats = get_current_stats(type, cpu);
if (stats == NULL)
continue;
#define X(k,r...) #k
str_collect_key_list(rest, stats, KEYS, NULL);
#undef X
}
out:
free(line);
if (file != NULL)
fclose(file);
}
struct stats_type cpu_stats_type = {
.st_name = "cpu",
.st_collect = &cpu_collect,
#define X SCHEMA_DEF
.st_schema_def = JOIN(KEYS),
#undef X
};
|
#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
#error This file can only be included implicitly by stlsoft/stlsoft.h; any other use is not supported
#endif
#define STLSOFT_HEAD_VER _STLSOFT_VER
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define C_LUCY_RAWLEXICON
#include "Lucy/Util/ToolSet.h"
#include "Lucy/Index/RawLexicon.h"
#include "Lucy/Index/Posting/MatchPosting.h"
#include "Lucy/Index/TermStepper.h"
#include "Lucy/Index/TermInfo.h"
#include "Lucy/Plan/FieldType.h"
#include "Lucy/Plan/Schema.h"
#include "Lucy/Store/InStream.h"
RawLexicon*
RawLex_new(Schema *schema, String *field, InStream *instream,
int64_t start, int64_t end) {
RawLexicon *self = (RawLexicon*)Class_Make_Obj(RAWLEXICON);
return RawLex_init(self, schema, field, instream, start, end);
}
RawLexicon*
RawLex_init(RawLexicon *self, Schema *schema, String *field,
InStream *instream, int64_t start, int64_t end) {
FieldType *type = Schema_Fetch_Type(schema, field);
Lex_init((Lexicon*)self, field);
RawLexiconIVARS *const ivars = RawLex_IVARS(self);
// Assign
ivars->start = start;
ivars->end = end;
ivars->len = end - start;
ivars->instream = (InStream*)INCREF(instream);
// Get ready to begin.
InStream_Seek(ivars->instream, ivars->start);
// Get steppers.
ivars->term_stepper = FType_Make_Term_Stepper(type);
ivars->tinfo_stepper = (TermStepper*)MatchTInfoStepper_new(schema);
return self;
}
void
RawLex_Destroy_IMP(RawLexicon *self) {
RawLexiconIVARS *const ivars = RawLex_IVARS(self);
DECREF(ivars->instream);
DECREF(ivars->term_stepper);
DECREF(ivars->tinfo_stepper);
SUPER_DESTROY(self, RAWLEXICON);
}
bool
RawLex_Next_IMP(RawLexicon *self) {
RawLexiconIVARS *const ivars = RawLex_IVARS(self);
if (InStream_Tell(ivars->instream) >= ivars->len) { return false; }
TermStepper_Read_Delta(ivars->term_stepper, ivars->instream);
TermStepper_Read_Delta(ivars->tinfo_stepper, ivars->instream);
return true;
}
Obj*
RawLex_Get_Term_IMP(RawLexicon *self) {
RawLexiconIVARS *const ivars = RawLex_IVARS(self);
return TermStepper_Get_Value(ivars->term_stepper);
}
int32_t
RawLex_Doc_Freq_IMP(RawLexicon *self) {
RawLexiconIVARS *const ivars = RawLex_IVARS(self);
TermInfo *tinfo = (TermInfo*)TermStepper_Get_Value(ivars->tinfo_stepper);
return tinfo ? TInfo_Get_Doc_Freq(tinfo) : 0;
}
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_win32_w32_stack_h__
#define INCLUDE_win32_w32_stack_h__
#include "common.h"
#if defined(GIT_MSVC_CRTDBG)
/**
* This type defines a callback to be used to augment a C stacktrace
* with "aux" data. This can be used, for example, to allow LibGit2Sharp
* (or other interpreted consumer libraries) to give us C# stacktrace
* data for the PInvoke.
*
* This callback will be called during crtdbg-instrumented allocs.
*
* @param aux_id [out] A returned "aux_id" representing a unique
* (de-duped at the C# layer) stacktrace. "aux_id" 0 is reserved
* to mean no aux stacktrace data.
*/
typedef void (*git_win32__stack__aux_cb_alloc)(unsigned int *aux_id);
/**
* This type defines a callback to be used to augment the output of
* a stacktrace. This will be used to request the C# layer format
* the C# stacktrace associated with "aux_id" into the provided
* buffer.
*
* This callback will be called during leak reporting.
*
* @param aux_id The "aux_id" key associated with a stacktrace.
* @param aux_msg A buffer where a formatted message should be written.
* @param aux_msg_len The size of the buffer.
*/
typedef void (*git_win32__stack__aux_cb_lookup)(unsigned int aux_id, char *aux_msg, unsigned int aux_msg_len);
/**
* Register an "aux" data provider to augment our C stacktrace data.
*
* This can be used, for example, to allow LibGit2Sharp (or other
* interpreted consumer libraries) to give us the C# stacktrace of
* the PInvoke.
*
* If you choose to use this feature, it should be registered during
* initialization and not changed for the duration of the process.
*/
GIT_EXTERN(int) git_win32__stack__set_aux_cb(
git_win32__stack__aux_cb_alloc cb_alloc,
git_win32__stack__aux_cb_lookup cb_lookup);
/**
* Maximum number of stackframes to record for a
* single stacktrace.
*/
#define GIT_WIN32__STACK__MAX_FRAMES 30
/**
* Wrapper containing the raw unprocessed stackframe
* data for a single stacktrace and any "aux_id".
*
* I put the aux_id first so leaks will be sorted by it.
* So, for example, if a specific callstack in C# leaks
* a repo handle, all of the pointers within the associated
* repo pointer will be grouped together.
*/
typedef struct {
unsigned int aux_id;
unsigned int nr_frames;
void *frames[GIT_WIN32__STACK__MAX_FRAMES];
} git_win32__stack__raw_data;
/**
* Load symbol table data. This should be done in the primary
* thread at startup (under a lock if there are other threads
* active).
*/
void git_win32__stack_init(void);
/**
* Cleanup symbol table data. This should be done in the
* primary thead at shutdown (under a lock if there are other
* threads active).
*/
void git_win32__stack_cleanup(void);
/**
* Capture raw stack trace data for the current process/thread.
*
* @param skip Number of initial frames to skip. Pass 0 to
* begin with the caller of this routine. Pass 1 to begin
* with its caller. And so on.
*/
int git_win32__stack_capture(git_win32__stack__raw_data *pdata, int skip);
/**
* Compare 2 raw stacktraces with the usual -1,0,+1 result.
* This includes any "aux_id" values in the comparison, so that
* our de-dup is also "aux" context relative.
*/
int git_win32__stack_compare(
git_win32__stack__raw_data *d1,
git_win32__stack__raw_data *d2);
/**
* Format raw stacktrace data into buffer WITHOUT using any mallocs.
*
* @param prefix String written before each frame; defaults to "\t".
* @param suffix String written after each frame; defaults to "\n".
*/
int git_win32__stack_format(
char *pbuf, int buf_len,
const git_win32__stack__raw_data *pdata,
const char *prefix, const char *suffix);
/**
* Convenience routine to capture and format stacktrace into
* a buffer WITHOUT using any mallocs. This is primarily a
* wrapper for testing.
*
* @param skip Number of initial frames to skip. Pass 0 to
* begin with the caller of this routine. Pass 1 to begin
* with its caller. And so on.
* @param prefix String written before each frame; defaults to "\t".
* @param suffix String written after each frame; defaults to "\n".
*/
int git_win32__stack(
char * pbuf, int buf_len,
int skip,
const char *prefix, const char *suffix);
#endif /* GIT_MSVC_CRTDBG */
#endif
|
/**
* WinPR: Windows Portable Runtime
* WinPR Logger
*
* Copyright 2014 Armin Novak <armin.novak@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/wlog.h>
#include "wlog/Message.h"
#include "wlog/CallbackAppender.h"
/**
* Callback Appender
*/
WINPR_API void WLog_CallbackAppender_SetCallbacks(wLog* log, wLogCallbackAppender* appender,
CallbackAppenderMessage_t msg, CallbackAppenderImage_t img, CallbackAppenderPackage_t pkg,
CallbackAppenderData_t data)
{
if (!appender)
return;
if (appender->Type != WLOG_APPENDER_CALLBACK)
return;
appender->message = msg;
appender->image = img;
appender->package = pkg;
appender->data = data;
}
int WLog_CallbackAppender_Open(wLog* log, wLogCallbackAppender* appender)
{
return 0;
}
int WLog_CallbackAppender_Close(wLog* log, wLogCallbackAppender* appender)
{
return 0;
}
int WLog_CallbackAppender_WriteMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message)
{
char prefix[WLOG_MAX_PREFIX_SIZE];
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
if (appender->message)
{
appender->message(message);
}
else
{
return -1;
}
return 1;
}
int WLog_CallbackAppender_WriteDataMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message)
{
if (appender->data)
{
appender->data(message);
}
else
{
return -1;
}
return 1;
}
int WLog_CallbackAppender_WriteImageMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message)
{
if (appender->image)
{
appender->image(message);
}
else
{
return -1;
}
return 1;
}
int WLog_CallbackAppender_WritePacketMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message)
{
if (appender->package)
{
appender->package(message);
}
else
{
return -1;
}
return 1;
}
wLogCallbackAppender* WLog_CallbackAppender_New(wLog* log)
{
wLogCallbackAppender* CallbackAppender;
CallbackAppender = (wLogCallbackAppender*) malloc(sizeof(wLogCallbackAppender));
if (CallbackAppender)
{
ZeroMemory(CallbackAppender, sizeof(wLogCallbackAppender));
CallbackAppender->Type = WLOG_APPENDER_CALLBACK;
CallbackAppender->Open = (WLOG_APPENDER_OPEN_FN) WLog_CallbackAppender_Open;
CallbackAppender->Close = (WLOG_APPENDER_OPEN_FN) WLog_CallbackAppender_Close;
CallbackAppender->WriteMessage =
(WLOG_APPENDER_WRITE_MESSAGE_FN) WLog_CallbackAppender_WriteMessage;
CallbackAppender->WriteDataMessage =
(WLOG_APPENDER_WRITE_DATA_MESSAGE_FN) WLog_CallbackAppender_WriteDataMessage;
CallbackAppender->WriteImageMessage =
(WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN) WLog_CallbackAppender_WriteImageMessage;
CallbackAppender->WritePacketMessage =
(WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN) WLog_CallbackAppender_WritePacketMessage;
CallbackAppender->message = NULL;
CallbackAppender->image = NULL;
CallbackAppender->package = NULL;
CallbackAppender->data = NULL;
}
return CallbackAppender;
}
void WLog_CallbackAppender_Free(wLog* log, wLogCallbackAppender* appender)
{
if (appender)
{
free(appender);
}
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_
#define UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/views/controls/button/text_button.h"
#include "ui/views/examples/example_base.h"
namespace views {
class ImageButton;
class View;
namespace examples {
// ButtonExample simply counts the number of clicks.
class ButtonExample : public ExampleBase, public ButtonListener {
public:
ButtonExample();
virtual ~ButtonExample();
// Overridden from ExampleBase:
virtual void CreateExampleView(View* container) OVERRIDE;
private:
// Overridden from ButtonListener:
virtual void ButtonPressed(Button* sender, const Event& event) OVERRIDE;
// Example buttons.
TextButton* text_button_;
ImageButton* image_button_;
// Values used to modify the look and feel of the button.
TextButton::TextAlignment alignment_;
bool use_native_theme_border_;
const SkBitmap* icon_;
// The number of times the buttons are pressed.
int count_;
DISALLOW_COPY_AND_ASSIGN(ButtonExample);
};
} // namespace examples
} // namespace views
#endif // UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_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 CC_OUTPUT_OVERLAY_STRATEGY_SANDWICH_H_
#define CC_OUTPUT_OVERLAY_STRATEGY_SANDWICH_H_
#include "base/macros.h"
#include "cc/output/overlay_processor.h"
namespace cc {
class OverlayCandidateValidator;
// The sandwich strategy looks for a video quad without regard to quads above
// it. The video is "overlaid" on top of the scene, and then the non-empty
// parts of the scene are "overlaid" on top of the video. This is only valid
// for overlay contents that are fully opaque.
class CC_EXPORT OverlayStrategySandwich : public OverlayProcessor::Strategy {
public:
explicit OverlayStrategySandwich(
OverlayCandidateValidator* capability_checker);
~OverlayStrategySandwich() override;
bool Attempt(ResourceProvider* resource_provider,
RenderPassList* render_passes,
OverlayCandidateList* candidate_list) override;
private:
QuadList::Iterator TryOverlay(RenderPass* render_pass,
OverlayCandidateList* candidate_list,
const OverlayCandidate& candidate,
QuadList::Iterator candidate_iterator);
OverlayCandidateValidator* capability_checker_; // Weak.
DISALLOW_COPY_AND_ASSIGN(OverlayStrategySandwich);
};
} // namespace cc
#endif // CC_OUTPUT_OVERLAY_STRATEGY_SANDWICH_H_
|
/*
* Copyright (c) 2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef FCONF_ETHOSN_GETTER_H
#define FCONF_ETHOSN_GETTER_H
#include <assert.h>
#include <lib/fconf/fconf.h>
#define hw_config__ethosn_config_getter(prop) ethosn_config.prop
#define hw_config__ethosn_core_addr_getter(idx) __extension__ ({ \
assert(idx < ethosn_config.num_cores); \
ethosn_config.core[idx].addr; \
})
#define ETHOSN_STATUS_DISABLED U(0)
#define ETHOSN_STATUS_ENABLED U(1)
#define ETHOSN_CORE_NUM_MAX U(64)
struct ethosn_core_t {
uint64_t addr;
};
struct ethosn_config_t {
uint32_t num_cores;
struct ethosn_core_t core[ETHOSN_CORE_NUM_MAX];
};
int fconf_populate_arm_ethosn(uintptr_t config);
extern struct ethosn_config_t ethosn_config;
#endif /* FCONF_ETHOSN_GETTER_H */
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_ANDROID_H_
#define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_ANDROID_H_
#include <sys/types.h>
#include "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h"
#include "sandbox/sandbox_export.h"
namespace sandbox {
// This class provides a Seccomp-BPF sandbox policy for programs that run
// in the Android Runtime (Java) environment. It builds upon the Linux
// BaselinePolicy, which would be suitable for Android shell-based programs,
// and adds allowances for the JVM.
//
// As with the Linux BaselinePolicy, the behavior is largely implementation
// defined.
//
// TODO(rsesek): This policy may currently have allowances for //content-level
// features. This needs an audit. https://crbug.com/739879
class SANDBOX_EXPORT BaselinePolicyAndroid : public BaselinePolicy {
public:
BaselinePolicyAndroid();
explicit BaselinePolicyAndroid(bool allow_sched_affinity);
BaselinePolicyAndroid(const BaselinePolicyAndroid&) = delete;
BaselinePolicyAndroid& operator=(const BaselinePolicyAndroid&) = delete;
~BaselinePolicyAndroid() override;
// sandbox::BaselinePolicy:
sandbox::bpf_dsl::ResultExpr EvaluateSyscall(
int system_call_number) const override;
private:
bool allow_sched_affinity_ = false;
};
} // namespace sandbox
#endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_ANDROID_H_
|
//
// SmileSettingVC.h
// TouchID
//
// Created by ryu-ushin on 5/25/15.
// Copyright (c) 2015 rain. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SmileSettingVC : UIViewController
@end
|
/* Copyright (C) 1991, 1997, 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, see
<http://www.gnu.org/licenses/>. */
#include <string.h>
#include <memcopy.h>
#undef memset
void *
memset (dstpp, c, len)
void *dstpp;
int c;
size_t len;
{
long int dstp = (long int) dstpp;
if (len >= 8)
{
size_t xlen;
op_t cccc;
cccc = (unsigned char) c;
cccc |= cccc << 8;
cccc |= cccc << 16;
if (OPSIZ > 4)
/* Do the shift in two steps to avoid warning if long has 32 bits. */
cccc |= (cccc << 16) << 16;
/* There are at least some bytes to set.
No need to test for LEN == 0 in this alignment loop. */
while (dstp % OPSIZ != 0)
{
((byte *) dstp)[0] = c;
dstp += 1;
len -= 1;
}
/* Write 8 `op_t' per iteration until less than 8 `op_t' remain. */
xlen = len / (OPSIZ * 8);
while (xlen > 0)
{
((op_t *) dstp)[0] = cccc;
((op_t *) dstp)[1] = cccc;
((op_t *) dstp)[2] = cccc;
((op_t *) dstp)[3] = cccc;
((op_t *) dstp)[4] = cccc;
((op_t *) dstp)[5] = cccc;
((op_t *) dstp)[6] = cccc;
((op_t *) dstp)[7] = cccc;
dstp += 8 * OPSIZ;
xlen -= 1;
}
len %= OPSIZ * 8;
/* Write 1 `op_t' per iteration until less than OPSIZ bytes remain. */
xlen = len / OPSIZ;
while (xlen > 0)
{
((op_t *) dstp)[0] = cccc;
dstp += OPSIZ;
xlen -= 1;
}
len %= OPSIZ;
}
/* Write the last few bytes. */
while (len > 0)
{
((byte *) dstp)[0] = c;
dstp += 1;
len -= 1;
}
return dstpp;
}
libc_hidden_builtin_def (memset)
|
/*
* wdt.c
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* IO dispatcher for a shared memory channel driver.
*
* Copyright (C) 2010 Texas Instruments, Inc.
*
* This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <linux/types.h>
#include <dspbridge/dbdefs.h>
#include <dspbridge/dspdeh.h>
#include <dspbridge/dev.h>
#include <dspbridge/_chnl_sm.h>
#include <dspbridge/wdt.h>
#include <dspbridge/host_os.h>
#define OMAP34XX_WDT3_BASE (L4_PER_34XX_BASE + 0x30000)
static struct dsp_wdt_setting dsp_wdt;
void dsp_wdt_dpc(unsigned long data)
{
struct deh_mgr *deh_mgr;
dev_get_deh_mgr(dev_get_first(), &deh_mgr);
if (deh_mgr)
bridge_deh_notify(deh_mgr, DSP_WDTOVERFLOW, 0);
}
irqreturn_t dsp_wdt_isr(int irq, void *data)
{
u32 value;
/* */
value = __raw_readl(dsp_wdt.reg_base + OMAP3_WDT3_ISR_OFFSET);
__raw_writel(value, dsp_wdt.reg_base + OMAP3_WDT3_ISR_OFFSET);
tasklet_schedule(&dsp_wdt.wdt3_tasklet);
return IRQ_HANDLED;
}
int dsp_wdt_init(void)
{
int ret = 0;
dsp_wdt.sm_wdt = NULL;
dsp_wdt.reg_base = ioremap(OMAP34XX_WDT3_BASE, SZ_4K);
if (!dsp_wdt.reg_base)
return -ENOMEM;
tasklet_init(&dsp_wdt.wdt3_tasklet, dsp_wdt_dpc, 0);
dsp_wdt.fclk = clk_get(NULL, "wdt3_fck");
if (dsp_wdt.fclk) {
dsp_wdt.iclk = clk_get(NULL, "wdt3_ick");
if (!dsp_wdt.iclk) {
clk_put(dsp_wdt.fclk);
dsp_wdt.fclk = NULL;
ret = -EFAULT;
}
} else
ret = -EFAULT;
if (!ret)
ret = request_irq(INT_34XX_WDT3_IRQ, dsp_wdt_isr, 0,
"dsp_wdt", &dsp_wdt);
/* */
if (!ret)
disable_irq(INT_34XX_WDT3_IRQ);
return ret;
}
void dsp_wdt_sm_set(void *data)
{
dsp_wdt.sm_wdt = data;
dsp_wdt.sm_wdt->wdt_overflow = 5; /* */
}
void dsp_wdt_exit(void)
{
free_irq(INT_34XX_WDT3_IRQ, &dsp_wdt);
tasklet_kill(&dsp_wdt.wdt3_tasklet);
if (dsp_wdt.fclk)
clk_put(dsp_wdt.fclk);
if (dsp_wdt.iclk)
clk_put(dsp_wdt.iclk);
dsp_wdt.fclk = NULL;
dsp_wdt.iclk = NULL;
dsp_wdt.sm_wdt = NULL;
if (dsp_wdt.reg_base)
iounmap(dsp_wdt.reg_base);
dsp_wdt.reg_base = NULL;
}
void dsp_wdt_enable(bool enable)
{
u32 tmp;
static bool wdt_enable;
if (wdt_enable == enable || !dsp_wdt.fclk || !dsp_wdt.iclk)
return;
wdt_enable = enable;
if (enable) {
clk_enable(dsp_wdt.fclk);
clk_enable(dsp_wdt.iclk);
dsp_wdt.sm_wdt->wdt_setclocks = 1;
tmp = __raw_readl(dsp_wdt.reg_base + OMAP3_WDT3_ISR_OFFSET);
__raw_writel(tmp, dsp_wdt.reg_base + OMAP3_WDT3_ISR_OFFSET);
enable_irq(INT_34XX_WDT3_IRQ);
} else {
disable_irq(INT_34XX_WDT3_IRQ);
dsp_wdt.sm_wdt->wdt_setclocks = 0;
clk_disable(dsp_wdt.iclk);
clk_disable(dsp_wdt.fclk);
}
}
|
/*
* Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: version.c,v 1.6 2007/06/19 23:47:23 tbox Exp $ */
#include <versions.h>
#include <lwres/version.h>
LIBLWRES_EXTERNAL_DATA const char lwres_version[] = VERSION;
LIBLWRES_EXTERNAL_DATA const unsigned int lwres_libinterface = LIBINTERFACE;
LIBLWRES_EXTERNAL_DATA const unsigned int lwres_librevision = LIBREVISION;
LIBLWRES_EXTERNAL_DATA const unsigned int lwres_libage = LIBAGE;
|
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.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.
*/
#ifndef MPD_CUE_PARSER_H
#define MPD_CUE_PARSER_H
#include "check.h"
#include <stdbool.h>
struct cue_parser *
cue_parser_new(void);
void
cue_parser_free(struct cue_parser *parser);
/**
* Feed a text line from the CUE file into the parser. Call
* cue_parser_get() after this to see if a song has been finished.
*/
void
cue_parser_feed(struct cue_parser *parser, const char *line);
/**
* Tell the parser that the end of the file has been reached. Call
* cue_parser_get() after this to see if a song has been finished.
* This procedure must be done twice!
*/
void
cue_parser_finish(struct cue_parser *parser);
/**
* Check if a song was finished by the last cue_parser_feed() or
* cue_parser_finish() call.
*
* @return a song object that must be freed by the caller, or NULL if
* no song was finished at this time
*/
struct song *
cue_parser_get(struct cue_parser *parser);
#endif
|
/* Compute remainder and a congruent to the quotient.
Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
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>
static const float zero = 0.0;
float
__remquof (float x, float y, int *quo)
{
int32_t hx,hy;
u_int32_t sx;
int cquo, qs;
GET_FLOAT_WORD (hx, x);
GET_FLOAT_WORD (hy, y);
sx = hx & 0x80000000;
qs = sx ^ (hy & 0x80000000);
hy &= 0x7fffffff;
hx &= 0x7fffffff;
/* Purge off exception values. */
if (hy == 0)
return (x * y) / (x * y); /* y = 0 */
if ((hx >= 0x7f800000) /* x not finite */
|| (hy > 0x7f800000)) /* y is NaN */
return (x * y) / (x * y);
if (hy <= 0x7dffffff)
x = __ieee754_fmodf (x, 8 * y); /* now x < 8y */
if ((hx - hy) == 0)
{
*quo = qs ? -1 : 1;
return zero * x;
}
x = fabsf (x);
y = fabsf (y);
cquo = 0;
if (x >= 4 * y)
{
x -= 4 * y;
cquo += 4;
}
if (x >= 2 * y)
{
x -= 2 * y;
cquo += 2;
}
if (hy < 0x01000000)
{
if (x + x > y)
{
x -= y;
++cquo;
if (x + x >= y)
{
x -= y;
++cquo;
}
}
}
else
{
float y_half = 0.5 * y;
if (x > y_half)
{
x -= y;
++cquo;
if (x >= y_half)
{
x -= y;
++cquo;
}
}
}
*quo = qs ? -cquo : cquo;
if (sx)
x = -x;
return x;
}
weak_alias (__remquof, remquof)
|
/* tap-voip.h
* VoIP packet tap interface 2007 Tomas Kukosa
*
* $Id: tap-voip.h 27474 2009-02-17 06:35:13Z jake $
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _TAP_VOIP_H_
#define _TAP_VOIP_H_
/* defines voip call state */
typedef enum _voip_call_state {
VOIP_NO_STATE,
VOIP_CALL_SETUP,
VOIP_RINGING,
VOIP_IN_CALL,
VOIP_CANCELLED,
VOIP_COMPLETED,
VOIP_REJECTED,
VOIP_UNKNOWN
} voip_call_state;
typedef enum _voip_call_active_state {
VOIP_ACTIVE,
VOIP_INACTIVE
} voip_call_active_state;
/* structure for common/proprietary VoIP calls TAP */
typedef struct _voip_packet_info_t
{
gchar *protocol_name;
gchar *call_id;
voip_call_state call_state;
voip_call_active_state call_active_state;
gchar *from_identity;
gchar *to_identity;
gchar *call_comment;
gchar *frame_label;
gchar *frame_comment;
} voip_packet_info_t;
#endif /* _TAP_VOIP_H_ */
|
/*
* Copyright (c) 2018 Rockchip Electronics Co. Ltd.
*
* 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/device.h>
#include <linux/init.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
#include "rockchip_pcm.h"
static const struct snd_pcm_hardware snd_rockchip_hardware = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_INTERLEAVED,
.period_bytes_min = 32,
.period_bytes_max = 8192,
.periods_min = 1,
.periods_max = 52,
.buffer_bytes_max = 64 * 1024,
.fifo_size = 32,
};
static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = {
.pcm_hardware = &snd_rockchip_hardware,
.prealloc_buffer_size = 32 * 1024,
};
int rockchip_pcm_platform_register(struct device *dev)
{
return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_COMPAT);
}
EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register);
MODULE_LICENSE("GPL v2");
|
/*
* arch/arm/mach-imx/mach-mx1ads.c
*
* Initially based on:
* linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
* Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
*
* 2004 (c) MontaVista Software, Inc.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/i2c.h>
#include <linux/i2c/pcf857x.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/iomux-mx1.h>
#include <mach/irqs.h>
#include "devices-imx1.h"
static const int mx1ads_pins[] __initconst = {
/* */
PC9_PF_UART1_CTS,
PC10_PF_UART1_RTS,
PC11_PF_UART1_TXD,
PC12_PF_UART1_RXD,
/* */
PB28_PF_UART2_CTS,
PB29_PF_UART2_RTS,
PB30_PF_UART2_TXD,
PB31_PF_UART2_RXD,
/* */
PA15_PF_I2C_SDA,
PA16_PF_I2C_SCL,
/* */
PC13_PF_SPI1_SPI_RDY,
PC14_PF_SPI1_SCLK,
PC15_PF_SPI1_SS,
PC16_PF_SPI1_MISO,
PC17_PF_SPI1_MOSI,
};
/*
*/
static const struct imxuart_platform_data uart0_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};
static const struct imxuart_platform_data uart1_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};
/*
*/
static const struct physmap_flash_data mx1ads_flash_data __initconst = {
.width = 4, /* */
};
static const struct resource flash_resource __initconst = {
.start = MX1_CS0_PHYS,
.end = MX1_CS0_PHYS + SZ_32M - 1,
.flags = IORESOURCE_MEM,
};
/*
*/
static struct pcf857x_platform_data pcf857x_data[] = {
{
.gpio_base = 4 * 32,
}, {
.gpio_base = 4 * 32 + 16,
}
};
static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
.bitrate = 100000,
};
static struct i2c_board_info mx1ads_i2c_devices[] = {
{
I2C_BOARD_INFO("pcf8575", 0x22),
.platform_data = &pcf857x_data[0],
}, {
I2C_BOARD_INFO("pcf8575", 0x24),
.platform_data = &pcf857x_data[1],
},
};
/*
*/
static void __init mx1ads_init(void)
{
imx1_soc_init();
mxc_gpio_setup_multiple_pins(mx1ads_pins,
ARRAY_SIZE(mx1ads_pins), "mx1ads");
/* */
imx1_add_imx_uart0(&uart0_pdata);
imx1_add_imx_uart1(&uart1_pdata);
/* */
platform_device_register_resndata(NULL, "physmap-flash", 0,
&flash_resource, 1,
&mx1ads_flash_data, sizeof(mx1ads_flash_data));
/* */
i2c_register_board_info(0, mx1ads_i2c_devices,
ARRAY_SIZE(mx1ads_i2c_devices));
imx1_add_imx_i2c(&mx1ads_i2c_data);
}
static void __init mx1ads_timer_init(void)
{
mx1_clocks_init(32000);
}
struct sys_timer mx1ads_timer = {
.init = mx1ads_timer_init,
};
MACHINE_START(MX1ADS, "Freescale MX1ADS")
/* */
.atag_offset = 0x100,
.map_io = mx1_map_io,
.init_early = imx1_init_early,
.init_irq = mx1_init_irq,
.handle_irq = imx1_handle_irq,
.timer = &mx1ads_timer,
.init_machine = mx1ads_init,
.restart = mxc_restart,
MACHINE_END
MACHINE_START(MXLADS, "Freescale MXLADS")
.atag_offset = 0x100,
.map_io = mx1_map_io,
.init_early = imx1_init_early,
.init_irq = mx1_init_irq,
.handle_irq = imx1_handle_irq,
.timer = &mx1ads_timer,
.init_machine = mx1ads_init,
.restart = mxc_restart,
MACHINE_END
|
/*
* Shows notices if remote clients exit with "Bad user info" or
* ConfigFileEntry.kline_reason.
* Assumes client_exit is enabled so users can't fake these reasons,
* and kline_reason is enabled and the same everywhere.
* Yes, this is a hack, but it is simple and avoids sending
* more data across servers -- jilles
*/
#include "stdinc.h"
#include "modules.h"
#include "client.h"
#include "hook.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
static const char sno_desc[] =
"Adds server notices for global XLINEs, KLINEs, and DLINEs";
static void h_gla_client_exit(hook_data_client_exit *);
mapi_hfn_list_av1 gla_hfnlist[] = {
{ "client_exit", (hookfn) h_gla_client_exit },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, NULL, NULL, sno_desc);
static void
h_gla_client_exit(hook_data_client_exit *hdata)
{
struct Client *source_p;
source_p = hdata->target;
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!strcmp(hdata->comment, "Bad user info"))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"XLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (ConfigFileEntry.kline_reason != NULL &&
!strcmp(hdata->comment, ConfigFileEntry.kline_reason))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
}
|
#ifndef _H8300_TERMIOS_H
#define _H8300_TERMIOS_H
#include <asm/termbits.h>
#include <asm/ioctls.h>
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
#define NCC 8
struct termio {
unsigned short c_iflag; /* */
unsigned short c_oflag; /* */
unsigned short c_cflag; /* */
unsigned short c_lflag; /* */
unsigned char c_line; /* */
unsigned char c_cc[NCC]; /* */
};
#ifdef __KERNEL__
/*
*/
#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
#endif
/* */
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
#define TIOCM_RTS 0x004
#define TIOCM_ST 0x008
#define TIOCM_SR 0x010
#define TIOCM_CTS 0x020
#define TIOCM_CAR 0x040
#define TIOCM_RNG 0x080
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* */
#ifdef __KERNEL__
/*
*/
#define user_termio_to_kernel_termios(termios, termio) \
({ \
unsigned short tmp; \
get_user(tmp, &(termio)->c_iflag); \
(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
get_user(tmp, &(termio)->c_oflag); \
(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
get_user(tmp, &(termio)->c_cflag); \
(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
get_user(tmp, &(termio)->c_lflag); \
(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
get_user((termios)->c_line, &(termio)->c_line); \
copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
})
/*
*/
#define kernel_termios_to_user_termio(termio, termios) \
({ \
put_user((termios)->c_iflag, &(termio)->c_iflag); \
put_user((termios)->c_oflag, &(termio)->c_oflag); \
put_user((termios)->c_cflag, &(termio)->c_cflag); \
put_user((termios)->c_lflag, &(termio)->c_lflag); \
put_user((termios)->c_line, &(termio)->c_line); \
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
})
#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
#endif /* */
#endif /* */
|
/* Compute x^2 + y^2 - 1, without large cancellation error.
Copyright (C) 2012-2013 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>
#include <stdlib.h>
/* Calculate X + Y exactly and store the result in *HI + *LO. It is
given that |X| >= |Y| and the values are small enough that no
overflow occurs. */
static inline void
add_split (double *hi, double *lo, double x, double y)
{
/* Apply Dekker's algorithm. */
*hi = x + y;
*lo = (x - *hi) + y;
}
/* Calculate X * Y exactly and store the result in *HI + *LO. It is
given that the values are small enough that no overflow occurs and
large enough (or zero) that no underflow occurs. */
static void
mul_split (double *hi, double *lo, double x, double y)
{
#ifdef __FP_FAST_FMA
/* Fast built-in fused multiply-add. */
*hi = x * y;
*lo = __builtin_fma (x, y, -*hi);
#elif defined FP_FAST_FMA
/* Fast library fused multiply-add, compiler before GCC 4.6. */
*hi = x * y;
*lo = __fma (x, y, -*hi);
#else
/* Apply Dekker's algorithm. */
*hi = x * y;
# define C ((1 << (DBL_MANT_DIG + 1) / 2) + 1)
double x1 = x * C;
double y1 = y * C;
# undef C
x1 = (x - x1) + x1;
y1 = (y - y1) + y1;
double x2 = x - x1;
double y2 = y - y1;
*lo = (((x1 * y1 - *hi) + x1 * y2) + x2 * y1) + x2 * y2;
#endif
}
/* Compare absolute values of floating-point values pointed to by P
and Q for qsort. */
static int
compare (const void *p, const void *q)
{
double pd = fabs (*(const double *) p);
double qd = fabs (*(const double *) q);
if (pd < qd)
return -1;
else if (pd == qd)
return 0;
else
return 1;
}
/* 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)
{
double vals[4];
SET_RESTORE_ROUND (FE_TONEAREST);
mul_split (&vals[1], &vals[0], x, x);
mul_split (&vals[3], &vals[2], y, y);
if (x >= 0.75)
vals[1] -= 1.0;
else
{
vals[1] -= 0.5;
vals[3] -= 0.5;
}
qsort (vals, 4, sizeof (double), compare);
/* Add up the values so that each element of VALS has absolute value
at most equal to the last set bit of the next nonzero
element. */
for (size_t i = 0; i <= 2; i++)
{
add_split (&vals[i + 1], &vals[i], vals[i + 1], vals[i]);
qsort (vals + i + 1, 3 - i, sizeof (double), compare);
}
/* Now any error from this addition will be small. */
return vals[3] + vals[2] + vals[1] + vals[0];
}
|
/*
* Support for the PPC e500-based mpc8544ds board
*
* Copyright 2012 Freescale Semiconductor, Inc.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include "config.h"
#include "qemu-common.h"
#include "e500.h"
#include "hw/boards.h"
#include "sysemu/device_tree.h"
#include "hw/ppc/openpic.h"
#include "qemu/error-report.h"
static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
{
const char model[] = "MPC8544DS";
const char compatible[] = "MPC8544DS\0MPC85xxDS";
qemu_fdt_setprop(fdt, "/", "model", model, sizeof(model));
qemu_fdt_setprop(fdt, "/", "compatible", compatible,
sizeof(compatible));
}
static void mpc8544ds_init(MachineState *machine)
{
PPCE500Params params = {
.pci_first_slot = 0x11,
.pci_nr_slots = 2,
.fixup_devtree = mpc8544ds_fixup_devtree,
.mpic_version = OPENPIC_MODEL_FSL_MPIC_20,
.ccsrbar_base = 0xE0000000ULL,
.pci_mmio_base = 0xC0000000ULL,
.pci_mmio_bus_base = 0xC0000000ULL,
.pci_pio_base = 0xE1000000ULL,
.spin_base = 0xEF000000ULL,
};
if (machine->ram_size > 0xc0000000) {
error_report("The MPC8544DS board only supports up to 3GB of RAM");
exit(1);
}
ppce500_init(machine, ¶ms);
}
static void ppce500_machine_init(MachineClass *mc)
{
mc->desc = "mpc8544ds";
mc->init = mpc8544ds_init;
mc->max_cpus = 15;
}
DEFINE_MACHINE("mpc8544ds", ppce500_machine_init)
|
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for MassStoreCommands.c.
*/
#ifndef _MASS_STORE_COMMANDS_H_
#define _MASS_STORE_COMMANDS_H_
/* Includes: */
#include <avr/io.h>
#include "../MassStorageHost.h"
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
/** Additional error code for Mass Storage functions when a device returns a logical command failure. */
#define MASS_STORE_SCSI_COMMAND_FAILED 0xC0
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MASSSTORE_COMMANDS_C)
static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr);
static uint8_t MassStore_WaitForDataReceived(void);
static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSICommandStatus) ATTR_NON_NULL_PTR_ARG(1);
#endif
uint8_t MassStore_MassStorageReset(void);
uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex);
uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
SCSI_Request_Sense_Response_t* const SensePtr) ATTR_NON_NULL_PTR_ARG(2);
uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
SCSI_Inquiry_Response_t* const InquiryPtr) ATTR_NON_NULL_PTR_ARG(2);
uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
const uint32_t BlockAddress,
const uint8_t Blocks,
const uint16_t BlockSize,
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(5);
uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
const uint32_t BlockAddress,
const uint8_t Blocks,
const uint16_t BlockSize,
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(5);
uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
SCSI_Capacity_t* const CapacityPtr) ATTR_NON_NULL_PTR_ARG(2);
uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex);
uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
const bool PreventRemoval);
#endif
|
/************************************************************************
**
** Copyright (C) 2015 Kevin B. Hendricks Stratford, ON, Canada
** Copyright (C) 2009, 2010, 2011 Strahinja Markovic <strahinja.markovic@gmail.com>
**
** This file is part of Sigil.
**
** Sigil 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.
**
** Sigil 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 Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#pragma once
#ifndef HTMLRESOURCE_H
#define HTMLRESOURCE_H
#include <QtCore/QHash>
#include "Misc/CSSInfo.h"
#include "BookManipulation/GuideSemantics.h"
#include "ResourceObjects/XMLResource.h"
class QString;
/**
* Represents an HTML file of the book.
* Stores several caches of the content for faster access.
* There's a QWebPage cache that stores the rendered form of
* the HTML and a QTextDocument cache that stores the syntax
* colored version.
*/
class HTMLResource : public XMLResource
{
Q_OBJECT
public:
/**
* Constructor.
*
* @param fullfilepath The full path to the file that this
* resource is representing.
* @param resources The hash of Resources present in the FolderKeeper.
* @param parent The object's parent.
*/
HTMLResource(const QString &mainfolder, const QString &fullfilepath,
const QHash<QString, Resource *> &resources,
QObject *parent = NULL);
/**
* Sets the guide semantic type information.
*
* @param type The new semantic type.
*/
void SetGuideSemanticType(GuideSemantics::GuideSemanticType type);
// inherited
virtual ResourceType Type() const;
virtual void SetText(const QString &text);
virtual bool LoadFromDisk();
void SaveToDisk(bool book_wide_save = false);
/**
* Splits the content of the resource into multiple section.
* The SGF section markers are used as the break points.
* The first section is set as the content of the resource,
* and the others are returned.
*
* @return The content of all the sections except the first.
*/
QStringList SplitOnSGFSectionMarkers();
/**
* Returns the paths to all the linked resources
* like images and stylesheets.
*
* @return The paths to the linked resources.
*/
QStringList GetPathsToLinkedResources();
/**
* Returns the paths to all the linked stylesheets
*
* @return The paths to the linked stylesheets.
*/
QStringList GetLinkedStylesheets();
QStringList GetManifestProperties() const;
bool DeleteCSStyles(QList<CSSInfo::CSSSelector *> css_selectors);
signals:
void LinkedResourceUpdated();
void TextChanging();
void LoadedFromDisk();
private:
/**
* Makes sure the given paths are watched for updates.
*
* @param filepaths The paths to resources to watch.
*/
void TrackNewResources(const QStringList &filepaths);
///////////////////////////////
// PRIVATE MEMBER VARIABLES
///////////////////////////////
/**
* The resource list from FolderKeeper.
* @todo This is ugly as hell. Find a way to remove this.
*/
const QHash<QString, Resource *> &m_Resources;
};
#endif // HTMLRESOURCE_H
|
/*-------------------------------------------------------------------------
*
* parse_type.h
* handle type operations for parser
*
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/parser/parse_type.h,v 1.42 2010/01/02 16:58:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PARSE_TYPE_H
#define PARSE_TYPE_H
#include "access/htup.h"
#include "parser/parse_node.h"
typedef HeapTuple Type;
extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName,
int32 *typmod_p);
extern Type typenameType(ParseState *pstate, const TypeName *typeName,
int32 *typmod_p);
extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName,
int32 *typmod_p);
extern char *TypeNameToString(const TypeName *typeName);
extern char *TypeNameListToString(List *typenames);
extern Type typeidType(Oid id);
extern Oid typeTypeId(Type tp);
extern int16 typeLen(Type t);
extern bool typeByVal(Type t);
extern char *typeTypeName(Type t);
extern Oid typeTypeRelid(Type typ);
extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
extern Oid typeidTypeRelid(Oid type_id);
extern void parseTypeString(const char *str, Oid *type_id, int32 *typmod_p);
#define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid)
#endif /* PARSE_TYPE_H */
|
/****************************************************************************
* netutils/uiplib/uiplib.c
* Various uIP library functions.
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Based on uIP which also has a BSD style license:
*
* Author: Adam Dunkels <adam@sics.se>
* Copyright (c) 2004, Adam Dunkels and the Swedish Institute of
* Computer Science.
* 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. 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <debug.h>
#include <nuttx/net/uip/uip.h>
#include <apps/netutils/uiplib.h>
/****************************************************************************
* Public Functions
****************************************************************************/
bool uiplib_ipaddrconv(const char *addrstr, uint8_t *ipaddr)
{
unsigned char tmp;
char c;
unsigned char i;
unsigned char j;
tmp = 0;
for (i = 0; i < 4; ++i)
{
j = 0;
do
{
c = *addrstr;
++j;
if (j > 4)
{
return false;
}
if (c == '.' || c == 0)
{
*ipaddr = tmp;
++ipaddr;
tmp = 0;
}
else if(c >= '0' && c <= '9')
{
tmp = (tmp * 10) + (c - '0');
}
else
{
return false;
}
++addrstr;
}
while(c != '.' && c != 0);
}
return true;
}
bool uiplib_hwmacconv(const char *hwstr, uint8_t *hw)
{
unsigned char tmp;
char c;
unsigned char i;
unsigned char j;
if (strlen(hwstr) != 17)
{
return false;
}
tmp = 0;
for (i = 0; i < 6; ++i)
{
j = 0;
do
{
c = *hwstr;
++j;
if (j > 3)
{
return false;
}
if (c == ':' || c == 0)
{
*hw = tmp;
nvdbg("HWMAC[%d]%0.2X\n",i,tmp);
++hw;
tmp = 0;
}
else if(c >= '0' && c <= '9')
{
tmp = (tmp << 4) + (c - '0');
}
else if(c >= 'a' && c <= 'f')
{
tmp = (tmp << 4) + (c - 'a' + 10);
}
else if(c >= 'A' && c <= 'F')
{
tmp = (tmp << 4) + (c - 'A' + 10);
}
else
{
return false;
}
++hwstr;
}
while(c != ':' && c != 0);
}
return true;
}
|
// @(#)root/odbc:$Id$
// Author: Sergey Linev 6/02/2006
/*************************************************************************
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TODBCStatement
#define ROOT_TODBCStatement
#ifndef ROOT_TSQLStatement
#include "TSQLStatement.h"
#endif
#ifdef __CINT__
typedef void * SQLHSTMT;
typedef UShort_t SQLUSMALLINT;
typedef UInt_t SQLUINTEGER;
typedef Short_t SQLSMALLINT;
typedef Short_t SQLRETURN;
#else
#ifdef WIN32
#include "windows.h"
#endif
#include <sql.h>
#endif
class TODBCStatement : public TSQLStatement {
protected:
#ifdef __CINT__
struct ODBCBufferRec_t;
#else
struct ODBCBufferRec_t {
Int_t fBroottype;
Int_t fBsqltype;
Int_t fBsqlctype;
void *fBbuffer;
Int_t fBelementsize;
SQLLEN *fBlenarray;
char *fBstrbuffer;
char *fBnamebuffer;
};
#endif
protected:
SQLHSTMT fHstmt;
Int_t fBufferPreferredSize;
ODBCBufferRec_t *fBuffer;
Int_t fNumBuffers;
Int_t fBufferLength; // number of entries for each parameter/column
Int_t fBufferCounter; // used to indicate position in buffers
SQLUSMALLINT *fStatusBuffer;
Int_t fWorkingMode; // 1 - setting parameters, 2 - reading results, 0 - unknown
SQLUINTEGER fNumParsProcessed; // contains number of parameters, affected by last operation
SQLUINTEGER fNumRowsFetched; // indicates number of fetched rows
ULong64_t fLastResultRow; // stores values of row number after last fetch operation
void *GetParAddr(Int_t npar, Int_t roottype = 0, Int_t length = 0);
long double ConvertToNumeric(Int_t npar);
const char *ConvertToString(Int_t npar);
Bool_t BindColumn(Int_t ncol, SQLSMALLINT sqltype, SQLUINTEGER size);
Bool_t BindParam(Int_t n, Int_t type, Int_t size = 1024);
Bool_t ExtractErrors(SQLRETURN retcode, const char* method);
void SetNumBuffers(Int_t isize, Int_t ilen);
void FreeBuffers();
Bool_t IsParSettMode() const { return fWorkingMode==1; }
Bool_t IsResultSet() const { return fWorkingMode==2; }
public:
TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize, Bool_t errout = kTRUE);
virtual ~TODBCStatement();
virtual void Close(Option_t * = "");
virtual Int_t GetBufferLength() const { return fBufferLength; }
virtual Int_t GetNumParameters();
virtual Bool_t SetNull(Int_t npar);
virtual Bool_t SetInt(Int_t npar, Int_t value);
virtual Bool_t SetUInt(Int_t npar, UInt_t value);
virtual Bool_t SetLong(Int_t npar, Long_t value);
virtual Bool_t SetLong64(Int_t npar, Long64_t value);
virtual Bool_t SetULong64(Int_t npar, ULong64_t value);
virtual Bool_t SetDouble(Int_t npar, Double_t value);
virtual Bool_t SetString(Int_t npar, const char* value, Int_t maxsize = 256);
virtual Bool_t SetBinary(Int_t npar, void* mem, Long_t size, Long_t maxsize = 0x1000);
virtual Bool_t SetDate(Int_t npar, Int_t year, Int_t month, Int_t day);
virtual Bool_t SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec);
virtual Bool_t SetDatime(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec);
virtual Bool_t SetTimestamp(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec, Int_t frac = 0);
virtual Bool_t NextIteration();
virtual Bool_t Process();
virtual Int_t GetNumAffectedRows();
virtual Bool_t StoreResult();
virtual Int_t GetNumFields();
virtual const char *GetFieldName(Int_t nfield);
virtual Bool_t NextResultRow();
virtual Bool_t IsNull(Int_t);
virtual Int_t GetInt(Int_t npar);
virtual UInt_t GetUInt(Int_t npar);
virtual Long_t GetLong(Int_t npar);
virtual Long64_t GetLong64(Int_t npar);
virtual ULong64_t GetULong64(Int_t npar);
virtual Double_t GetDouble(Int_t npar);
virtual const char *GetString(Int_t npar);
virtual Bool_t GetBinary(Int_t npar, void* &mem, Long_t& size);
virtual Bool_t GetDate(Int_t npar, Int_t& year, Int_t& month, Int_t& day);
virtual Bool_t GetTime(Int_t npar, Int_t& hour, Int_t& min, Int_t& sec);
virtual Bool_t GetDatime(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec);
virtual Bool_t GetTimestamp(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec, Int_t&);
ClassDef(TODBCStatement, 0); //ODBC implementation of TSQLStatement
};
#endif
|
#include "tai.h"
#include "caldate.h"
void caldate_easter(struct caldate *cd)
{
long c;
long t;
long j;
long n;
long y;
y = cd->year;
c = (y / 100) + 1;
t = 210 - (((c * 3) / 4) % 210);
j = y % 19;
n = 57 - ((14 + j * 11 + (c * 8 + 5) / 25 + t) % 30);
if ((n == 56) && (j > 10)) --n;
if (n == 57) --n;
n -= ((((y % 28) * 5) / 4 + t + n + 2) % 7);
if (n < 32) { cd->month = 3; cd->day = (int)n; }
else { cd->month = 4; cd->day = (int)(n - 31); }
}
|
// 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 CHROME_BROWSER_UI_ASH_CHROME_KEYBOARD_UI_H_
#define CHROME_BROWSER_UI_ASH_CHROME_KEYBOARD_UI_H_
#include <memory>
#include "base/macros.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/keyboard/content/keyboard_ui_content.h"
namespace content {
class BrowserContext;
class WebContents;
}
namespace extensions {
class ExtensionFunctionDispatcher;
class WindowController;
}
namespace gfx {
class Rect;
}
namespace keyboard {
class KeyboardController;
class KeyboardControllerObserver;
}
namespace ui {
class InputMethod;
}
// Subclass of KeyboardUIContent. It is used by KeyboardController to get
// access to the virtual keyboard window and setup Chrome extension functions.
class ChromeKeyboardUI : public keyboard::KeyboardUIContent,
public content::WebContentsObserver {
public:
explicit ChromeKeyboardUI(content::BrowserContext* context);
~ChromeKeyboardUI() override;
// keyboard::KeyboardUIContent overrides
bool ShouldWindowOverscroll(aura::Window* window) const override;
private:
// keyboard::KeyboardUIContent overrides
ui::InputMethod* GetInputMethod() override;
void RequestAudioInput(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
void SetupWebContents(content::WebContents* contents) override;
void SetController(keyboard::KeyboardController* controller) override;
void ShowKeyboardContainer(aura::Window* container) override;
// The overridden implementation dispatches
// chrome.virtualKeyboardPrivate.onTextInputBoxFocused event to extension to
// provide the input type information. Naturally, when the virtual keyboard
// extension is used as an IME then chrome.input.ime.onFocus provides the
// information, but not when the virtual keyboard is used in conjunction with
// another IME. virtualKeyboardPrivate.onTextInputBoxFocused is the remedy in
// that case.
void SetUpdateInputType(ui::TextInputType type) override;
// content::WebContentsObserver overrides
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
std::unique_ptr<keyboard::KeyboardControllerObserver> observer_;
DISALLOW_COPY_AND_ASSIGN(ChromeKeyboardUI);
};
#endif // CHROME_BROWSER_UI_ASH_CHROME_KEYBOARD_UI_H_
|
/*
* Copyright (c) 2011 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
* nc_opcode_histogram.c - Collects histogram information while validating.
*/
#include <stdio.h>
#include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_opcode_histogram.h"
#include "native_client/src/include/portability_io.h"
#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/trusted/validator/x86/decoder/nc_inst_iter.h"
#include "native_client/src/trusted/validator/x86/decoder/nc_inst_state.h"
#include "native_client/src/trusted/validator/x86/decoder/nc_inst_state_internal.h"
#include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.h"
#include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter_internal.h"
Bool NACL_FLAGS_opcode_histogram = FALSE;
void NaClOpcodeHistogramInitialize(NaClValidatorState* state) {
int i;
if (!state->print_opcode_histogram) return;
for (i = 0; i < 256; ++i) {
state->opcode_histogram.opcode_histogram[i] = 0;
}
}
void NaClOpcodeHistogramRecord(NaClValidatorState* state) {
NaClInstState* inst_state = state->cur_inst_state;
const NaClInst* inst = state->cur_inst;
if ((inst->name != InstInvalid) &&
(inst_state->num_opcode_bytes > 0)) {
state->opcode_histogram.opcode_histogram[
inst_state->bytes.byte[inst_state->num_prefix_bytes]]++;
}
}
#define LINE_SIZE 1024
void NaClOpcodeHistogramPrintStats(NaClValidatorState* state) {
int i;
char line[LINE_SIZE];
int line_size = LINE_SIZE;
int printed_in_this_row = 0;
NaClValidatorMessage(LOG_INFO, state, "Opcode Histogram:\n");
for (i = 0; i < 256; ++i) {
if (0 != state->opcode_histogram.opcode_histogram[i]) {
if (line_size < LINE_SIZE) {
line_size -= SNPRINTF(line, line_size, "%"NACL_PRId32"\t0x%02x\t",
state->opcode_histogram.opcode_histogram[i], i);
}
++printed_in_this_row;
if (printed_in_this_row > 3) {
printed_in_this_row = 0;
NaClValidatorMessage(LOG_INFO, state, "%s\n", line);
line_size = LINE_SIZE;
}
}
}
if (0 != printed_in_this_row) {
NaClValidatorMessage(LOG_INFO, state, "%s\n", line);
}
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_CHILD_THREADED_DATA_PROVIDER_H_
#define CONTENT_CHILD_THREADED_DATA_PROVIDER_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "ipc/ipc_channel.h"
#include "ipc/message_filter.h"
struct ResourceMsg_RequestCompleteData;
namespace blink {
class WebThreadedDataReceiver;
}
namespace IPC {
class SyncChannel;
}
namespace scheduler {
class WebThreadImplForWorkerScheduler;
}
namespace content {
class ResourceDispatcher;
class ThreadedDataProvider {
public:
ThreadedDataProvider(
int request_id,
blink::WebThreadedDataReceiver* threaded_data_receiver,
linked_ptr<base::SharedMemory> shm_buffer,
int shm_size,
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_);
// Any destruction of this class has to bounce via the background thread to
// ensure all data is flushed; call Stop() to start this process.
void Stop();
void OnReceivedDataOnBackgroundThread(int data_offset,
int data_length,
int encoded_data_length);
void OnReceivedDataOnForegroundThread(const char* data,
int data_length,
int encoded_data_length);
void OnResourceMessageFilterAddedMainThread();
void OnRequestCompleteForegroundThread(
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
const ResourceMsg_RequestCompleteData& request_complete_data,
const base::TimeTicks& renderer_completion_time);
private:
~ThreadedDataProvider();
void DestructOnMainThread();
void StopOnBackgroundThread();
void OnResourceMessageFilterAddedBackgroundThread();
void OnRequestCompleteBackgroundThread(
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
const ResourceMsg_RequestCompleteData& request_complete_data,
const base::TimeTicks& renderer_completion_time);
void ForwardAndACKData(const char* data,
int data_length,
int encoded_data_length);
void DataNotifyForegroundThread(
scoped_ptr<std::vector<char> > data_copy,
int data_length,
int encoded_data_length);
scoped_refptr<IPC::MessageFilter> filter_;
int request_id_;
linked_ptr<base::SharedMemory> shm_buffer_;
int shm_size_;
scoped_ptr<base::WeakPtrFactory<ThreadedDataProvider> >
background_thread_weak_factory_;
scheduler::WebThreadImplForWorkerScheduler& background_thread_;
IPC::SyncChannel* ipc_channel_;
blink::WebThreadedDataReceiver* threaded_data_receiver_;
bool resource_filter_active_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
struct QueuedSharedMemoryData {
const char* data;
int length;
int encoded_length;
};
std::vector<QueuedSharedMemoryData> queued_data_;
base::WeakPtrFactory<ThreadedDataProvider>
main_thread_weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ThreadedDataProvider);
};
} // namespace content
#endif // CONTENT_CHILD_THREADED_DATA_PROVIDER_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_GTK_GTK_WINDOW_UTIL_H_
#define CHROME_BROWSER_UI_GTK_GTK_WINDOW_UTIL_H_
#include <gtk/gtk.h>
#include "ui/gfx/rect.h"
class BaseWindow;
namespace content {
class WebContents;
}
namespace gtk_window_util {
// Performs Cut/Copy/Paste operation on the |window|'s |web_contents|.
void DoCut(GtkWindow* window, content::WebContents* web_contents);
void DoCopy(GtkWindow* window, content::WebContents* web_contents);
void DoPaste(GtkWindow* window, content::WebContents* web_contents);
// Ubuntu patches their version of GTK+ to that there is always a
// gripper in the bottom right corner of the window. We always need to
// disable this feature since we can't communicate this to WebKit easily.
void DisableResizeGrip(GtkWindow* window);
// Returns the resize cursor corresponding to the window |edge|.
GdkCursorType GdkWindowEdgeToGdkCursorType(GdkWindowEdge edge);
// Returns |true| if the window bounds match the monitor size.
bool BoundsMatchMonitorSize(GtkWindow* window, gfx::Rect bounds);
bool HandleTitleBarLeftMousePress(GtkWindow* window,
const gfx::Rect& bounds,
GdkEventButton* event);
// Request the underlying window to unmaximize. Also tries to work around
// a window manager "feature" that can prevent this in some edge cases.
void UnMaximize(GtkWindow* window,
const gfx::Rect& bounds,
const gfx::Rect& restored_bounds);
// Set a custom WM_CLASS for a window.
void SetWindowCustomClass(GtkWindow* window, const std::string& wmclass);
// A helper method for setting the GtkWindow size that should be used in place
// of calling gtk_window_resize directly. This is done to avoid a WM "feature"
// where setting the window size to the monitor size causes the WM to set the
// EWMH for full screen mode.
void SetWindowSize(GtkWindow* window, const gfx::Size& size);
// Update the origin of |bounds| and |restored_bounds| with values gotten
// from GTK.
void UpdateWindowPosition(BaseWindow* window,
gfx::Rect* bounds,
gfx::Rect* restored_bounds);
} // namespace gtk_window_util
#endif // CHROME_BROWSER_UI_GTK_GTK_WINDOW_UTIL_H_
|
/*
* Copyright 2011 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_BASE_BANDWIDTHSMOOTHER_H_
#define WEBRTC_BASE_BANDWIDTHSMOOTHER_H_
#include "webrtc/base/rollingaccumulator.h"
#include "webrtc/base/timeutils.h"
namespace rtc {
// The purpose of BandwidthSmoother is to smooth out bandwidth
// estimations so that 'trstate' messages can be triggered when we
// are "sure" there is sufficient bandwidth. To avoid frequent fluctuations,
// we take a slightly pessimistic view of our bandwidth. We only increase
// our estimation when we have sampled bandwidth measurements of values
// at least as large as the current estimation * percent_increase
// for at least time_between_increase time. If a sampled bandwidth
// is less than our current estimation we immediately decrease our estimation
// to that sampled value.
// We retain the initial bandwidth guess as our current bandwidth estimation
// until we have received (min_sample_count_percent * samples_count_to_average)
// number of samples. Min_sample_count_percent must be in range [0, 1].
class BandwidthSmoother {
public:
BandwidthSmoother(int initial_bandwidth_guess,
uint32 time_between_increase,
double percent_increase,
size_t samples_count_to_average,
double min_sample_count_percent);
~BandwidthSmoother();
// Samples a new bandwidth measurement.
// bandwidth is expected to be non-negative.
// returns true if the bandwidth estimation changed
bool Sample(uint32 sample_time, int bandwidth);
int get_bandwidth_estimation() const {
return bandwidth_estimation_;
}
private:
uint32 time_between_increase_;
double percent_increase_;
uint32 time_at_last_change_;
int bandwidth_estimation_;
RollingAccumulator<int> accumulator_;
double min_sample_count_percent_;
};
} // namespace rtc
#endif // WEBRTC_BASE_BANDWIDTHSMOOTHER_H_
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <memory>
#include <react/renderer/core/Props.h>
#include <react/renderer/debug/DebugStringConvertible.h>
namespace facebook {
namespace react {
class RawTextProps;
using SharedRawTextProps = std::shared_ptr<const RawTextProps>;
class RawTextProps : public Props {
public:
RawTextProps() = default;
RawTextProps(const RawTextProps &sourceProps, const RawProps &rawProps);
#pragma mark - Props
std::string text{};
#pragma mark - DebugStringConvertible
#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};
} // namespace react
} // namespace facebook
|
/* Copyright 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Settings to enable JTAG debugging */
#include "jtag.h"
#include "registers.h"
void jtag_pre_init(void)
{
/*
* Stop all timers we might use and watchdogs when the JTAG stops
* the CPU.
*/
STM32_DBGMCU_APB1FZ |=
STM32_RCC_PB1_TIM2 | STM32_RCC_PB1_TIM3 | STM32_RCC_PB1_TIM4 |
STM32_RCC_PB1_TIM5 | STM32_RCC_PB1_TIM6 | STM32_RCC_PB1_TIM7 |
STM32_RCC_PB1_WWDG | STM32_RCC_PB1_IWDG;
STM32_DBGMCU_APB2FZ |=
STM32_RCC_PB2_TIM15 | STM32_RCC_PB2_TIM16 | STM32_RCC_PB2_TIM17;
}
|
#pragma once
#ifndef TIIO_TGA_INCLUDED
#define TIIO_TGA_INCLUDED
#include "tiio.h"
//#include "timage_io.h"
#include "tproperty.h"
//===========================================================================
namespace Tiio {
//===========================================================================
class TgaWriterProperties final : public TPropertyGroup {
public:
TEnumProperty m_pixelSize; // 16,24,32
TBoolProperty m_compressed;
TgaWriterProperties();
};
//===========================================================================
Tiio::Reader *makeTgaReader();
Tiio::Writer *makeTgaWriter();
//===========================================================================
} // namespace
#endif
|
/*
*******************************************************************************
*
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html#License
*
*******************************************************************************
*******************************************************************************
*
* Copyright (C) 2002, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <unicode/ustring.h>
#include <unicode/ubrk.h>
U_CFUNC int c_main(void);
void printTextRange(UChar* str, int32_t start, int32_t end)
{
char charBuf[1000];
UChar savedEndChar;
savedEndChar = str[end];
str[end] = 0;
u_austrncpy(charBuf, str+start, sizeof(charBuf)-1);
charBuf[sizeof(charBuf)-1]=0;
printf("string[%2d..%2d] \"%s\"\n", start, end-1, charBuf);
str[end] = savedEndChar;
}
/* Print each element in order: */
void printEachForward( UBreakIterator* boundary, UChar* str) {
int32_t end;
int32_t start = ubrk_first(boundary);
for (end = ubrk_next(boundary); end != UBRK_DONE; start = end, end =
ubrk_next(boundary)) {
printTextRange(str, start, end );
}
}
/* Print each element in reverse order: */
void printEachBackward( UBreakIterator* boundary, UChar* str) {
int32_t start;
int32_t end = ubrk_last(boundary);
for (start = ubrk_previous(boundary); start != UBRK_DONE; end = start,
start =ubrk_previous(boundary)) {
printTextRange( str, start, end );
}
}
/* Print first element */
void printFirst(UBreakIterator* boundary, UChar* str) {
int32_t end;
int32_t start = ubrk_first(boundary);
end = ubrk_next(boundary);
printTextRange( str, start, end );
}
/* Print last element */
void printLast(UBreakIterator* boundary, UChar* str) {
int32_t start;
int32_t end = ubrk_last(boundary);
start = ubrk_previous(boundary);
printTextRange(str, start, end );
}
/* Print the element at a specified position */
void printAt(UBreakIterator* boundary, int32_t pos , UChar* str) {
int32_t start;
int32_t end = ubrk_following(boundary, pos);
start = ubrk_previous(boundary);
printTextRange(str, start, end );
}
/* Creating and using text boundaries*/
int c_main( void ) {
UBreakIterator *boundary;
char cStringToExamine[] = "Aaa bbb ccc. Ddd eee fff.";
UChar stringToExamine[sizeof(cStringToExamine)+1];
UErrorCode status = U_ZERO_ERROR;
printf("\n\n"
"C Boundary Analysis\n"
"-------------------\n\n");
printf("Examining: %s\n", cStringToExamine);
u_uastrcpy(stringToExamine, cStringToExamine);
/*print each sentence in forward and reverse order*/
boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine,
-1, &status);
if (U_FAILURE(status)) {
printf("ubrk_open error: %s\n", u_errorName(status));
exit(1);
}
printf("\n----- Sentence Boundaries, forward: -----------\n");
printEachForward(boundary, stringToExamine);
printf("\n----- Sentence Boundaries, backward: ----------\n");
printEachBackward(boundary, stringToExamine);
ubrk_close(boundary);
/*print each word in order*/
boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine,
u_strlen(stringToExamine), &status);
printf("\n----- Word Boundaries, forward: -----------\n");
printEachForward(boundary, stringToExamine);
printf("\n----- Word Boundaries, backward: ----------\n");
printEachBackward(boundary, stringToExamine);
/*print first element*/
printf("\n----- first: -------------\n");
printFirst(boundary, stringToExamine);
/*print last element*/
printf("\n----- last: --------------\n");
printLast(boundary, stringToExamine);
/*print word at charpos 10 */
printf("\n----- at pos 10: ---------\n");
printAt(boundary, 10 , stringToExamine);
ubrk_close(boundary);
printf("\nEnd of C boundary analysis\n");
return 0;
}
|
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2013, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import "TyphoonDefinition.h"
@protocol TyphoonPropertyInjection;
@protocol TyphoonInjection;
@class TyphoonComponentFactory;
@class TyphoonRuntimeArguments;
@interface TyphoonDefinition (InstanceBuilder)
- (id)initializeInstanceWithArgs:(TyphoonRuntimeArguments *)args factory:(TyphoonComponentFactory *)factory;
- (void)doInjectionEventsOn:(id)instance withArgs:(TyphoonRuntimeArguments *)args factory:(TyphoonComponentFactory *)factory;
- (void)doAfterAllInjectionsOn:(id)instance;
- (id)targetForInitializerWithFactory:(TyphoonComponentFactory *)factory args:(TyphoonRuntimeArguments *)args;
@end
|
/* Copyright (c) 2008 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Onyx2D/O2Context_builtin.h>
#import <windows.h>
#import <Onyx2D/O2GlyphStencil.h>
#ifdef __cplusplus
extern "C" {
#endif
@class Win32Font, O2DeviceContext_gdi, O2DeviceContext_gdiDIBSection;
@interface O2Context_builtin_gdi : O2Context_builtin {
HDC _dc;
Win32Font *_gdiFont;
int _gdiDescent;
O2Paint *_textFillPaint;
size_t _glyphCacheCount;
O2GlyphStencilRef *_glyphCache;
int _scratchWidth;
int _scratchHeight;
O2DeviceContext_gdiDIBSection *_scratchContext;
HDC _scratchDC;
uint8_t *_scratchBitmap;
Win32Font *_scratchFont;
}
- (O2DeviceContext_gdi *)deviceContext;
@end
#ifdef __cplusplus
}
#endif
|
/*
https://github.com/waynezxcv/Gallop
Copyright (c) 2016 waynezxcv <liuweiself@126.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "SDWebImageManager.h"
@interface CALayer(WebCacheOperation)
/**
* 通过Key给CALayer对象设置下载的NSOperation对象
*
* @param operation NSOperation对象
* @param key NSOperation对象对应的Key
*/
- (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key;
/**
* 通过Key来取消这个CALayer对象上的NSOperation
*
* @param key NSOperation对象对应的Key
*/
- (void)sd_cancelImageLoadOperationWithKey:(NSString *)key;
/**
* 通过Key来移除这个CALayer对象上的NSOperation
*
* @param key NSOperation对象对应的Key
*/
- (void)sd_removeImageLoadOperationWithKey:(NSString *)key;
@end
|
/* -*- mode: c; c-basic-offset: 8; -*-
* vim: noexpandtab sw=8 ts=8 sts=0:
*
* mount.c - operations for initializing and mounting configfs.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
* sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/configfs.h>
#include "configfs_internal.h"
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
static struct vfsmount *configfs_mount = NULL;
struct kmem_cache *configfs_dir_cachep;
static int configfs_mnt_count = 0;
static const struct super_operations configfs_ops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
};
static struct config_group configfs_root_group = {
.cg_item = {
.ci_namebuf = "root",
.ci_name = configfs_root_group.cg_item.ci_namebuf,
},
};
int configfs_is_root(struct config_item *item)
{
return item == &configfs_root_group.cg_item;
}
static struct configfs_dirent configfs_root = {
.s_sibling = LIST_HEAD_INIT(configfs_root.s_sibling),
.s_children = LIST_HEAD_INIT(configfs_root.s_children),
.s_element = &configfs_root_group.cg_item,
.s_type = CONFIGFS_ROOT,
.s_iattr = NULL,
};
static int configfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *inode;
struct dentry *root;
sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = CONFIGFS_MAGIC;
sb->s_op = &configfs_ops;
sb->s_time_gran = 1;
inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
&configfs_root, sb);
if (inode) {
inode->i_op = &configfs_root_inode_operations;
inode->i_fop = &configfs_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
} else {
pr_debug("could not get root inode\n");
return -ENOMEM;
}
root = d_make_root(inode);
if (!root) {
pr_debug("%s: could not get root dentry!\n",__func__);
return -ENOMEM;
}
config_group_init(&configfs_root_group);
configfs_root_group.cg_item.ci_dentry = root;
root->d_fsdata = &configfs_root;
sb->s_root = root;
sb->s_d_op = &configfs_dentry_ops; /* the rest get that */
return 0;
}
static struct dentry *configfs_do_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_single(fs_type, flags, data, configfs_fill_super);
}
static struct file_system_type configfs_fs_type = {
.owner = THIS_MODULE,
.name = "configfs",
.mount = configfs_do_mount,
.kill_sb = kill_litter_super,
};
MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
&configfs_mnt_count);
return err ? ERR_PTR(err) : configfs_mount->mnt_root;
}
void configfs_release_fs(void)
{
simple_release_fs(&configfs_mount, &configfs_mnt_count);
}
static int __init configfs_init(void)
{
int err = -ENOMEM;
configfs_dir_cachep = kmem_cache_create("configfs_dir_cache",
sizeof(struct configfs_dirent),
0, 0, NULL);
if (!configfs_dir_cachep)
goto out;
err = sysfs_create_mount_point(kernel_kobj, "config");
if (err)
goto out2;
err = register_filesystem(&configfs_fs_type);
if (err)
goto out3;
return 0;
out3:
pr_err("Unable to register filesystem!\n");
sysfs_remove_mount_point(kernel_kobj, "config");
out2:
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
out:
return err;
}
static void __exit configfs_exit(void)
{
unregister_filesystem(&configfs_fs_type);
sysfs_remove_mount_point(kernel_kobj, "config");
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
}
MODULE_AUTHOR("Oracle");
MODULE_LICENSE("GPL");
MODULE_VERSION("0.0.2");
MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration.");
module_init(configfs_init);
module_exit(configfs_exit);
|
#ifndef _TAF_STD_LIB_H_
#define _TAF_STD_LIB_H_
/*****************************************************************************
1 ÆäËûÍ·Îļþ°üº¬
*****************************************************************************/
#include "PsTypeDef.h"
#include "MnMsgApi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#pragma pack(4)
/*****************************************************************************
2 ºê¶¨Òå
*****************************************************************************/
/* Added by f62575 for V9R1 STKÉý¼¶, 2013-6-26, begin */
#define TAF_STD_7BIT_MASK (0x7f)
/* Added by f62575 for V9R1 STKÉý¼¶, 2013-6-26, end */
#define TAF_STD_MAX_GSM7BITDEFALPHA_NUM (128)
#define TAF_STD_NOSTANDARD_ASCII_CODE (0xff)
#define TAF_STD_GSM_7BIT_EXTENSION_FLAG (0xfe)
/*****************************************************************************
3 ö¾Ù¶¨Òå
*****************************************************************************/
/*****************************************************************************
4 È«¾Ö±äÁ¿ÉùÃ÷
*****************************************************************************/
/*****************************************************************************
5 ÏûϢͷ¶¨Òå
*****************************************************************************/
/*****************************************************************************
6 ÏûÏ¢¶¨Òå
*****************************************************************************/
/*****************************************************************************
7 STRUCT¶¨Òå
*****************************************************************************/
/*****************************************************************************
8 UNION¶¨Òå
*****************************************************************************/
/*****************************************************************************
9 OTHERS¶¨Òå
*****************************************************************************/
/*****************************************************************************
10 º¯ÊýÉùÃ÷
*****************************************************************************/
VOS_UINT32 TAF_STD_Itoa(
VOS_UINT32 ulDigit,
VOS_CHAR *pcDigitStr,
VOS_UINT32 *pulDigitStrLength
);
VOS_UINT32 TAF_STD_AsciiNum2HexString(
VOS_UINT8 *pucSrc,
VOS_UINT16 *pusSrcLen
);
VOS_UINT16 TAF_STD_HexAlpha2AsciiString(
VOS_UINT8 *pucSrc,
VOS_UINT16 usSrcLen,
VOS_UINT8 *pucDst
);
/* Added by f62575 for V9R1 STKÉý¼¶, 2013-6-26, begin */
/*½«7bit±àÂ뷽ʽµÄ×Ö·ûת»»Îª8bit×Ö·û*/
VOS_UINT32 TAF_STD_UnPack7Bit(
const VOS_UINT8 *pucOrgChar,
VOS_UINT32 ulLen,
VOS_UINT8 ucFillBit,
VOS_UINT8 *pucUnPackedChar
);
/*½«×Ö·ûת»»Îª7bit±àÂ뷽ʽ*/
VOS_UINT32 TAF_STD_Pack7Bit(
const VOS_UINT8 *pucOrgChar,
VOS_UINT32 ulLen,
VOS_UINT8 ucFillBit,
VOS_UINT8 *pucPackedChar,
VOS_UINT32 *pulLen
);
/* Added by f62575 for V9R1 STKÉý¼¶, 2013-6-26, end */
VOS_UINT32 TAF_STD_ConvertBcdNumberToAscii(
const VOS_UINT8 *pucBcdNumber,
VOS_UINT8 ucBcdLen,
VOS_CHAR *pcAsciiNumber
);
VOS_UINT32 TAF_STD_ConvertBcdCodeToAscii(
VOS_UINT8 ucBcdCode,
VOS_CHAR *pcAsciiCode
);
VOS_UINT32 TAF_STD_ConvertAsciiNumberToBcd(
const VOS_CHAR *pcAsciiNumber,
VOS_UINT8 *pucBcdNumber,
VOS_UINT8 *pucBcdLen
);
VOS_UINT32 TAF_STD_ConvertAsciiAddrToBcd(
MN_MSG_ASCII_ADDR_STRU *pstAsciiAddr,
MN_MSG_BCD_ADDR_STRU *pstBcdAddr
);
VOS_UINT32 TAF_STD_ConvertAsciiCodeToBcd(
VOS_CHAR cAsciiCode,
VOS_UINT8 *pucBcdCode
);
VOS_UINT8 TAF_STD_ConvertDeciDigitToBcd(
VOS_UINT8 ucDeciDigit,
VOS_BOOL bReverseOrder
);
VOS_UINT32 TAF_STD_ConvertBcdToDeciDigit(
VOS_UINT8 ucBcdDigit,
VOS_BOOL bReverseOrder,
VOS_UINT8 *pucDigit
);
VOS_UINT32 TAF_STD_ConvertAsciiToDefAlpha(
const VOS_UINT8 *pucAsciiChar,
VOS_UINT32 ulLen,
VOS_UINT8 *pucDefAlpha
);
VOS_UINT32 TAF_STD_ConvertDefAlphaToAscii(
const VOS_UINT8 *pucDefAlpha,
VOS_UINT32 ulDefAlphaLen,
VOS_UINT8 *pucAsciiChar,
VOS_UINT32 *pulAsciiCharLen
);
VOS_UINT32 TAF_STD_ConvertBcdCodeToDtmf(
VOS_UINT8 ucBcdCode,
VOS_UINT8 *pucDtmfCode
);
VOS_UINT32 TAF_STD_ConvertBcdNumberToDtmf(
const VOS_UINT8 *pucBcdNumber,
VOS_UINT8 ucBcdLen,
VOS_UINT8 *pucDtmfNumber
);
#if (VOS_OS_VER == VOS_WIN32)
#pragma pack()
#else
#pragma pack(0)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* end of TafSpmCtx.h */
|
/*
* aram_managerc
*
* ARAM manager
*
* Copyright (C) 2014-2015 NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#define pr_fmt(fmt) "%s : %d, " fmt, __func__, __LINE__
#include <linux/debugfs.h>
#include "aram_manager.h"
static void *aram_handle;
static LIST_HEAD(aram_alloc_list);
static LIST_HEAD(aram_free_list);
void aram_print(void)
{
mem_print(aram_handle);
}
EXPORT_SYMBOL(aram_print);
void *aram_request(const char *name, size_t size)
{
return mem_request(aram_handle, name, size);
}
EXPORT_SYMBOL(aram_request);
bool aram_release(void *handle)
{
return mem_release(aram_handle, handle);
}
EXPORT_SYMBOL(aram_release);
unsigned long aram_get_address(void *handle)
{
return mem_get_address(handle);
}
EXPORT_SYMBOL(aram_get_address);
#ifdef CONFIG_DEBUG_FS
static struct dentry *aram_dump_debugfs_file;
static int aram_dump(struct seq_file *s, void *data)
{
mem_dump(aram_handle, s);
return 0;
}
static int aram_dump_open(struct inode *inode, struct file *file)
{
return single_open(file, aram_dump, inode->i_private);
}
static const struct file_operations aram_dump_fops = {
.open = aram_dump_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
int aram_init(unsigned long addr, unsigned long size)
{
aram_handle = create_mem_manager("ARAM", addr, size);
if (IS_ERR(aram_handle)) {
pr_err("ERROR: failed to create aram memory_manager");
return PTR_ERR(aram_handle);
}
#ifdef CONFIG_DEBUG_FS
aram_dump_debugfs_file = debugfs_create_file("aram_dump",
S_IRUGO, NULL, NULL, &aram_dump_fops);
if (!aram_dump_debugfs_file) {
pr_err("ERROR: failed to create aram_dump debugfs");
destroy_mem_manager(aram_handle);
return -ENOMEM;
}
#endif
return 0;
}
EXPORT_SYMBOL(aram_init);
void aram_exit(void)
{
#ifdef CONFIG_DEBUG_FS
debugfs_remove(aram_dump_debugfs_file);
#endif
destroy_mem_manager(aram_handle);
}
EXPORT_SYMBOL(aram_exit);
|
/* Make sure blank lines does not cause memory corruption BZ #18887.
Copyright (C) 2009-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 <mntent.h>
#include <stdio.h>
#include <string.h>
/* Make sure blank lines don't trigger memory corruption. This doesn't happen
for all targets though, so it's a best effort test BZ #18887. */
static int
do_test (void)
{
FILE *fp;
fp = tmpfile ();
fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
rewind (fp);
/* The corruption happens here ... */
getmntent (fp);
/* ... but trigers here. */
endmntent (fp);
/* If the test failed, we would crash, and not hit this point. */
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
|
/*
* SiI8620 Linux Driver
*
* Copyright (C) 2013 Silicon Image, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
* This program is distributed AS-IS WITHOUT ANY WARRANTY of any
* kind, whether express or implied; INCLUDING without the implied warranty
* of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE or NON-INFRINGEMENT.
* See the GNU General Public License for more details at
* http://www.gnu.org/licenses/gpl-2.0.html.
*/
#if !defined(SI_INFOFRAME_H)
#define SI_INFOFRAME_H
struct __attribute__ ((__packed__)) info_frame_header_t {
uint8_t type_code;
uint8_t version_number;
uint8_t length;
};
enum AviColorSpace_e {
acsRGB,
acsYCbCr422,
acsYCbCr444,
acsFuture
};
/*
* AVI Info Frame Structure
*/
struct __attribute__ ((__packed__)) avi_info_frame_data_byte_1_t {
uint8_t ScanInfo:2;
uint8_t BarInfo:2;
uint8_t ActiveFormatInfoPresent:1;
enum AviColorSpace_e colorSpace:2;
uint8_t futureMustBeZero:1;
};
struct __attribute__ ((__packed__)) avi_info_frame_data_byte_2_t {
uint8_t ActiveFormatAspectRatio:4;
uint8_t PictureAspectRatio:2;
uint8_t Colorimetry:2;
};
struct __attribute__ ((__packed__)) avi_info_frame_data_byte_3_t {
uint8_t NonUniformPictureScaling:2;
uint8_t RGBQuantizationRange:2;
uint8_t ExtendedColorimetry:3;
uint8_t ITContent:1;
};
struct __attribute__ ((__packed__)) avi_info_frame_data_byte_4_t {
uint8_t VIC:7;
uint8_t futureMustBeZero:1;
};
enum BitsContent_e {
cnGraphics,
cnPhoto,
cnCinema,
cnGame
};
enum AviQuantization_e {
aqLimitedRange,
aqFullRange,
aqReserved0,
aqReserved1
};
struct __attribute__ ((__packed__)) avi_info_frame_data_byte_5_t {
uint8_t pixelRepetionFactor:4;
enum BitsContent_e content:2;
enum AviQuantization_e quantization:2;
};
struct __attribute__ ((__packed__)) hw_avi_named_payload_t {
uint8_t checksum;
union {
struct __attribute__ ((__packed__)) {
struct avi_info_frame_data_byte_1_t pb1;
struct avi_info_frame_data_byte_2_t
colorimetryAspectRatio;
struct avi_info_frame_data_byte_3_t pb3;
struct avi_info_frame_data_byte_4_t VIC;
struct avi_info_frame_data_byte_5_t pb5;
uint8_t LineNumEndTopBarLow;
uint8_t LineNumEndTopBarHigh;
uint8_t LineNumStartBottomBarLow;
uint8_t LineNumStartBottomBarHigh;
uint8_t LineNumEndLeftBarLow;
uint8_t LineNumEndLeftBarHigh;
uint8_t LineNumStartRightBarLow;
uint8_t LineNumStartRightBarHigh;
} bitFields;
uint8_t infoFrameData[13];
} ifData_u;
};
/* this union overlays the TPI HW for AVI InfoFrames,
* starting at REG_TPI_AVI_CHSUM.
*/
union hw_avi_payload_t {
struct hw_avi_named_payload_t namedIfData;
uint8_t ifData[14];
};
struct __attribute__ ((__packed__)) avi_payload_t {
union hw_avi_payload_t hwPayLoad;
uint8_t byte_14;
uint8_t byte_15;
};
struct __attribute__ ((__packed__)) avi_info_frame_t {
struct info_frame_header_t header;
struct avi_payload_t payLoad;
};
/* these values determine the interpretation of PB5 */
enum HDMI_Video_Format_e {
hvfNoAdditionalHDMIVideoFormatPresent,
hvfExtendedResolutionFormatPresent,
hvf3DFormatIndicationPresent
};
enum _3D_structure_e {
tdsFramePacking,
tdsTopAndBottom = 0x06,
tdsSideBySide = 0x08
};
enum ThreeDExtData_e {
tdedHorizontalSubSampling,
tdedQuincunxOddLeftOddRight = 0x04,
tdedQuincunxOddLeftEvenRight,
tdedQuincunxEvenLeftOddRight,
tdedQuincunxEvenLeftEvenRight
};
enum ThreeDMetaDataType_e {
tdmdParallaxIso23022_3Section6_x_2_2
};
struct __attribute__ ((__packed__)) vendor_specific_payload_t {
uint8_t checksum;
uint8_t IEEERegistrationIdentifier[3]; /* 0x000C03 Little Endian */
struct __attribute__ ((__packed__)) {
unsigned reserved:5;
enum HDMI_Video_Format_e HDMI_Video_Format:3;
} pb4;
union {
uint8_t HDMI_VIC;
struct __attribute__ ((__packed__)) _ThreeDStructure {
unsigned reserved:3;
unsigned ThreeDMetaPresent:1;
enum _3D_structure_e threeDStructure:4;
} ThreeDStructure;
} pb5;
struct __attribute__ ((__packed__)) {
uint8_t reserved:4;
uint8_t threeDExtData:4; /* ThreeDExtData_e */
} pb6;
struct __attribute__ ((__packed__)) _PB7 {
uint8_t threeDMetaDataLength:5;
uint8_t threeDMetaDataType:3; /* ThreeDMetaDataType_e */
} pb7;
};
struct __attribute__ ((__packed__)) vendor_specific_info_frame_t {
struct info_frame_header_t header;
struct vendor_specific_payload_t payLoad;
};
/*
* MPEG Info Frame Structure
* Table 8-11 on page 141 of HDMI Spec v1.4
*/
struct __attribute__ ((__packed__)) unr_info_frame_t {
struct info_frame_header_t header;
uint8_t checksum;
uint8_t byte_1;
uint8_t byte_2;
uint8_t byte_3;
uint8_t byte_4;
uint8_t byte_5;
uint8_t byte_6;
};
#ifdef ENABLE_DUMP_INFOFRAME
void DumpIncomingInfoFrameImpl(char *pszId, char *pszFile, int iLine,
info_frame_t *pInfoFrame, uint8_t length);
#define DumpIncomingInfoFrame(pData, length) \
DumpIncomingInfoFrameImpl(#pData, __FILE__, __LINE__, \
(info_frame_t *)pData, length)
#else
#define DumpIncomingInfoFrame(pData, length) /* do nothing */
#endif
#endif /* if !defined(SI_INFOFRAME_H) */
|
/* gdbserv-client.h -- Facilities for communicating with remote client
using GDB remote protocol.
Copyright 1998, 2000, 2002 Red Hat, Inc.
This file is part of RDA, the Red Hat Debug Agent (and library).
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Alternative licenses for RDA may be arranged by contacting Red Hat,
Inc. */
#ifdef __cplusplus
extern "C" {
#elif 0
}
#endif
struct gdbserv;
struct gdbserv_client {
void *data;
/* Write LEN characters to the remote client. */
void (*write) (struct gdbserv *gdbserv, const unsigned char *ch,
unsigned len);
};
void *gdbserv_client_data (struct gdbserv *gdbserv);
/* This is a call into the target so that it to is notified of the
connecting client. The target can reject the connection by
returning NULL */
/* Notify the server that the client has initiated a connection.
Returns a GDBSERV struct for the session (or null if the target
rejected the connect). The server will, in turn, pass the request
onto the target. The target can either reject the connection
(returning NULL) or accept the connection (returning a target
object). */
typedef struct gdbserv_target *(gdbserv_target_attach) (struct gdbserv *gdbserv,
void *attatch_data);
struct gdbserv *gdbserv_fromclient_attach (struct gdbserv_client *gdbclient,
gdbserv_target_attach *to_target_attach,
void *target_attach_data);
/* Notify the server that the client has disconnected. */
void gdbserv_fromclient_detach (struct gdbserv *gdbserv);
/* The low level client code pumps packets/data into GDBSERV using the
following. */
/* Raw characters from the client<->server. */
void gdbserv_fromclient_data (struct gdbserv *gdbserv, const char *data,
int sizeof_data);
/* The remote client has requested that the target ``break'' (halt).
Notify gdbserv of the request so that it can pass it through to the
target (using gdbserv_target->break_program()). */
void gdbserv_fromclient_break (struct gdbserv *gdbserv);
#ifdef __cplusplus
}
#endif
|
/*
* IBM Accurate Mathematical Library
* Written by International Business Machines Corp.
* Copyright (C) 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/******************************************************************/
/* */
/* MODULE_NAME:sincos32.h */
/* */
/* common data and variables prototype and definition */
/******************************************************************/
#ifndef SINCOS32_H
#define SINCCOS32_H
#ifdef BIG_ENDI
static const number
/**/ hpinv = {{0x3FE45F30, 0x6DC9C883}}, /* 0.63661977236758138 */
/**/ toint = {{0x43380000, 0x00000000}}; /* 6755399441055744 */
#else
#ifdef LITTLE_ENDI
static const number
/**/ hpinv = {{0x6DC9C883, 0x3FE45F30}}, /* 0.63661977236758138 */
/**/ toint = {{0x00000000, 0x43380000}}; /* 6755399441055744 */
#endif
#endif
static const mp_no
oofac27 = {-3,{1.0,7.0,4631664.0,12006312.0,13118056.0,6538613.0,646354.0,
8508025.0,9131256.0,7548776.0,2529842.0,8864927.0,660489.0,15595125.0,12777885.0,
11618489.0,13348664.0,5486686.0,514518.0,11275535.0,4727621.0,3575562.0,
13579710.0,5829745.0,7531862.0,9507898.0,6915060.0,4079264.0,1907586.0,
6078398.0,13789314.0,5504104.0,14136.0}},
pi = {1,{1.0,3.0,
2375530.0,8947107.0,578323.0,1673774.0,225395.0,4498441.0,3678761.0,
10432976.0,536314.0,10021966.0,7113029.0,2630118.0,3723283.0,7847508.0,
6737716.0,15273068.0,12626985.0,12044668.0,5299519.0,8705461.0,11880201.0,
1544726.0,14014857.0,7994139.0,13709579.0,10918111.0,11906095.0,16610011.0,
13638367.0,12040417.0,11529578.0,2522774.0}},
hp = {1,{1.0, 1.0,
9576373.0,4473553.0,8677769.0,9225495.0,112697.0,10637828.0,
10227988.0,13605096.0,268157.0,5010983.0,3556514.0,9703667.0,
1861641.0,12312362.0,3368858.0,7636534.0,6313492.0,14410942.0,
2649759.0,12741338.0,14328708.0,9160971.0,7007428.0,12385677.0,
15243397.0,13847663.0,14341655.0,16693613.0,15207791.0,14408816.0,
14153397.0,1261387.0,6110792.0,2291862.0,4181138.0,5295267.0}};
static const double toverp[75] = {
10680707.0, 7228996.0, 1387004.0, 2578385.0, 16069853.0,
12639074.0, 9804092.0, 4427841.0, 16666979.0, 11263675.0,
12935607.0, 2387514.0, 4345298.0, 14681673.0, 3074569.0,
13734428.0, 16653803.0, 1880361.0, 10960616.0, 8533493.0,
3062596.0, 8710556.0, 7349940.0, 6258241.0, 3772886.0,
3769171.0, 3798172.0, 8675211.0, 12450088.0, 3874808.0,
9961438.0, 366607.0, 15675153.0, 9132554.0, 7151469.0,
3571407.0, 2607881.0, 12013382.0, 4155038.0, 6285869.0,
7677882.0, 13102053.0, 15825725.0, 473591.0, 9065106.0,
15363067.0, 6271263.0, 9264392.0, 5636912.0, 4652155.0,
7056368.0, 13614112.0, 10155062.0, 1944035.0, 9527646.0,
15080200.0, 6658437.0, 6231200.0, 6832269.0, 16767104.0,
5075751.0, 3212806.0, 1398474.0, 7579849.0, 6349435.0,
12618859.0, 4703257.0, 12806093.0, 14477321.0, 2786137.0,
12875403.0, 9837734.0, 14528324.0, 13719321.0, 343717.0 };
#endif
|
/*
* Copyright (C) 2005 Nico Sabbi
*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdint.h>
#include "aac_hdr.h"
#include "libavutil/attributes.h"
/// \param srate (out) sample rate
/// \param num (out) number of audio frames in this ADTS frame
/// \return size of the ADTS frame in bytes
/// aac_parse_frames needs a buffer at least 8 bytes long
int aac_parse_frame(uint8_t *buf, int *srate, int *num)
{
int i = 0, sr, fl = 0, id av_unused;
static int srates[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0, 0, 0};
if((buf[i] != 0xFF) || ((buf[i+1] & 0xF6) != 0xF0))
return 0;
id = (buf[i+1] >> 3) & 0x01; //id=1 mpeg2, 0: mpeg4
sr = (buf[i+2] >> 2) & 0x0F;
if(sr > 11)
return 0;
*srate = srates[sr];
fl = ((buf[i+3] & 0x03) << 11) | (buf[i+4] << 3) | ((buf[i+5] >> 5) & 0x07);
*num = (buf[i+6] & 0x02) + 1;
return fl;
}
|
/* CFNumber.h
Copyright (c) 1999-2003, Apple, Inc. All rights reserved.
*/
#if !defined(__COREFOUNDATION_CFNUMBER__)
#define __COREFOUNDATION_CFNUMBER__ 1
#include <CoreFoundation/CFBase.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef const struct __CFBoolean * CFBooleanRef;
#if TARGET_OS_WIN32
#define kCFBooleanTrue (*((const CFBooleanRef *)QTGetCFConstant("kCFBooleanTrue")))
#define kCFBooleanFalse (*((const CFBooleanRef *)QTGetCFConstant("kCFBooleanFalse")))
#else
CF_EXPORT
const CFBooleanRef kCFBooleanTrue;
CF_EXPORT
const CFBooleanRef kCFBooleanFalse;
#endif
CF_EXPORT
CFTypeID CFBooleanGetTypeID(void);
CF_EXPORT
Boolean CFBooleanGetValue(CFBooleanRef boolean);
typedef enum {
/* Types from MacTypes.h */
kCFNumberSInt8Type = 1,
kCFNumberSInt16Type = 2,
kCFNumberSInt32Type = 3,
kCFNumberSInt64Type = 4,
kCFNumberFloat32Type = 5,
kCFNumberFloat64Type = 6, /* 64-bit IEEE 754 */
/* Basic C types */
kCFNumberCharType = 7,
kCFNumberShortType = 8,
kCFNumberIntType = 9,
kCFNumberLongType = 10,
kCFNumberLongLongType = 11,
kCFNumberFloatType = 12,
kCFNumberDoubleType = 13,
/* Other */
kCFNumberCFIndexType = 14,
kCFNumberMaxType = 14
} CFNumberType;
typedef const struct __CFNumber * CFNumberRef;
#if TARGET_OS_WIN32
#define kCFNumberPositiveInfinity (*((const CFNumberRef *)QTGetCFConstant("kCFNumberPositiveInfinity")))
#define kCFNumberNegativeInfinity (*((const CFNumberRef *)QTGetCFConstant("kCFNumberNegativeInfinity")))
#define kCFNumberNaN (*((const CFNumberRef *)QTGetCFConstant("kCFNumberNaN")))
#else
CF_EXPORT
const CFNumberRef kCFNumberPositiveInfinity;
CF_EXPORT
const CFNumberRef kCFNumberNegativeInfinity;
CF_EXPORT
const CFNumberRef kCFNumberNaN;
#endif
CF_EXPORT
CFTypeID CFNumberGetTypeID(void);
/*
Creates a CFNumber with the given value. The type of number pointed
to by the valuePtr is specified by type. If type is a floating point
type and the value represents one of the infinities or NaN, the
well-defined CFNumber for that value is returned. If either of
valuePtr or type is an invalid value, the result is undefined.
*/
CF_EXPORT
CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
/*
Returns the storage format of the CFNumber's value. Note that
this is not necessarily the type provided in CFNumberCreate().
*/
CF_EXPORT
CFNumberType CFNumberGetType(CFNumberRef number);
/*
Returns the size in bytes of the type of the number.
*/
CF_EXPORT
CFIndex CFNumberGetByteSize(CFNumberRef number);
/*
Returns true if the type of the CFNumber's value is one of
the defined floating point types.
*/
CF_EXPORT
Boolean CFNumberIsFloatType(CFNumberRef number);
/*
Copies the CFNumber's value into the space pointed to by
valuePtr, as the specified type. If conversion needs to take
place, the conversion rules follow human expectation and not
C's promotion and truncation rules. If the conversion is
lossy, or the value is out of range, false is returned. Best
attempt at conversion will still be in *valuePtr.
*/
CF_EXPORT
Boolean CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
/*
Compares the two CFNumber instances. If conversion of the
types of the values is needed, the conversion and comparison
follow human expectations and not C's promotion and comparison
rules. Negative zero compares less than positive zero.
Positive infinity compares greater than everything except
itself, to which it compares equal. Negative infinity compares
less than everything except itself, to which it compares equal.
Unlike standard practice, if both numbers are NaN, then they
compare equal; if only one of the numbers is NaN, then the NaN
compares greater than the other number if it is negative, and
smaller than the other number if it is positive. (Note that in
CFEqual() with two CFNumbers, if either or both of the numbers
is NaN, true is returned.)
*/
CF_EXPORT
CFComparisonResult CFNumberCompare(CFNumberRef number, CFNumberRef otherNumber, void *context);
#if defined(__cplusplus)
}
#endif
#endif /* ! __COREFOUNDATION_CFNUMBER__ */
|
/* Copyright (c) 2012 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 "main_cbsc_tx.h"
#include "cbsc_tx.h"
#include "cbsc_tx_defines.h"
#include "ant_interface.h"
#include "ant_parameters.h"
#include "app_error.h"
#include "nrf_soc.h"
#define ANTPLUS_NETWORK_NUMBER 0 /**< Network number. */
#define ANT_EVENT_MSG_BUFFER_MIN_SIZE 32u /**< Minimum size of ANT event message buffer. */
#define CBSC_TX_CHANNEL_TYPE CHANNEL_TYPE_MASTER /**< Master Channel. */
#define CBSC_TX_TRANS_TYPE 1u /**< Transmission Type. */
#define CBSC_TX_DEVICE_NUMBER 1u /**< Device Number. */
#define CBSC_EXT_ASSIGN 0 /**< ANT Ext Assign. */
#define CBSC_DEVICE_TYPE 0x79u /**< Bike speed and cadence Device Type. */
#define CBSC_RF_FREQ 0x39u /**< RF Channel 57 (2457 MHz). */
#define CBSC_MSG_PERIOD 0x1F96u /**< Decimal 8086 (~4.05Hz). */
#define CBSC_NETWORK_KEY {0,0,0,0,0,0,0,0} /**< The network key used. */
static const uint8_t m_network_key[] = CBSC_NETWORK_KEY; /**< ANT network key. */
/**@brief Function for configuring the ANT channel.
*/
static __INLINE void channel_open(void)
{
// Set Network Address.
uint32_t err_code = sd_ant_network_address_set(ANTPLUS_NETWORK_NUMBER, (uint8_t*)m_network_key);
APP_ERROR_CHECK(err_code);
// Set Channel Number.
err_code = sd_ant_channel_assign(CBSC_TX_ANT_CHANNEL,
CBSC_TX_CHANNEL_TYPE,
ANTPLUS_NETWORK_NUMBER,
CBSC_EXT_ASSIGN);
APP_ERROR_CHECK(err_code);
// Set Channel ID.
err_code = sd_ant_channel_id_set(CBSC_TX_ANT_CHANNEL,
CBSC_TX_DEVICE_NUMBER,
CBSC_DEVICE_TYPE,
CBSC_TX_TRANS_TYPE);
APP_ERROR_CHECK(err_code);
// Set Channel RF frequency.
err_code = sd_ant_channel_radio_freq_set(CBSC_TX_ANT_CHANNEL, CBSC_RF_FREQ);
APP_ERROR_CHECK(err_code);
// Set Channel period.
err_code = sd_ant_channel_period_set(CBSC_TX_ANT_CHANNEL, CBSC_MSG_PERIOD);
APP_ERROR_CHECK(err_code);
// Open Channel.
err_code = sd_ant_channel_open(CBSC_TX_ANT_CHANNEL);
APP_ERROR_CHECK(err_code);
}
void main_cbsc_tx_run(void)
{
// Open the ANT channel and initialize the profile module.
channel_open();
uint32_t err_code = cbsc_tx_initialize();
APP_ERROR_CHECK(err_code);
uint8_t ant_channel;
uint8_t event_message_buffer[ANT_EVENT_MSG_BUFFER_MIN_SIZE];
uint8_t event = NO_EVENT;
// Extract and process all pending events, while maximizing application sleep.
for (;;)
{
err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
// Extract and process all pending ANT stack events.
while (sd_ant_event_get(&ant_channel, &event, event_message_buffer) == NRF_SUCCESS)
{
err_code = cbsc_tx_channel_event_handle(event);
APP_ERROR_CHECK(err_code);
}
}
}
/**@brief Function for handling protocol stack IRQ.
*
* Interrupt is generated by the ANT stack upon sending event to the application.
*/
void SD_EVT_IRQHandler(void)
{
}
|
/********************************************************************************
* sched/timer/timer.h
*
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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 NuttX 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 __SCHED_TIMER_TIMER_H
#define __SCHED_TIMER_TIMER_H
/********************************************************************************
* Included Files
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/compiler.h>
#include <nuttx/wdog.h>
/********************************************************************************
* Definitions
********************************************************************************/
#define PT_FLAGS_PREALLOCATED 0x01 /* Timer comes from a pool of preallocated timers */
/********************************************************************************
* Public Types
********************************************************************************/
/* This structure represents one POSIX timer */
struct posix_timer_s
{
FAR struct posix_timer_s *flink;
uint8_t pt_flags; /* See PT_FLAGS_* definitions */
uint8_t pt_crefs; /* Reference count */
uint8_t pt_signo; /* Notification signal */
pid_t pt_owner; /* Creator of timer */
int pt_delay; /* If non-zero, used to reset repetitive timers */
int pt_last; /* Last value used to set watchdog */
WDOG_ID pt_wdog; /* The watchdog that provides the timing */
union sigval pt_value; /* Data passed with notification */
};
/********************************************************************************
* Public Data
********************************************************************************/
/* This is a list of free, preallocated timer structures */
#if CONFIG_PREALLOC_TIMERS > 0
extern volatile sq_queue_t g_freetimers;
#endif
/* This is a list of instantiated timer structures -- active and inactive. The
* timers are place on this list by timer_create() and removed from the list by
* timer_delete() or when the owning thread exits.
*/
extern volatile sq_queue_t g_alloctimers;
/********************************************************************************
* Public Function Prototypes
********************************************************************************/
void weak_function timer_initialize(void);
void weak_function timer_deleteall(pid_t pid);
int timer_release(FAR struct posix_timer_s *timer);
#endif /* __SCHED_TIMER_TIMER_H */
|
// This code is from http://www.codecolony.de/opengl.htm#TexturesBFC
// by Phillip Crocoll
// should be freely usable, but we should contact him and let him know.
#ifdef WIN32
#include <GL/glaux.h>
#else
#include <GL/gl.h>
#endif
class COGLTexture
{
public:
COGLTexture();
~COGLTexture();
#ifdef WIN32
_AUX_RGBImageRec *Image;
#endif
unsigned int GetID();
void LoadFromFile(char *filename);
void SetActive();
int GetWidth();
int GetHeight();
private:
int Width, Height;
unsigned int ID;
bool bInitialized;
};
|
/* $OpenBSD: atexit.h,v 1.7 2007/09/03 14:40:16 millert Exp $ */
/*
* Copyright (c) 2002 Daniel Hartmeier
* 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.
*
* 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 HOLDERS 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.
*
*/
struct atexit {
struct atexit *next; /* next in list */
int ind; /* next index in this table */
int max; /* max entries >= ATEXIT_SIZE */
struct atexit_fn {
union {
void (*std_func)(void);
void (*cxa_func)(void *);
} fn_ptr;
void *fn_arg; /* argument for CXA callback */
void *fn_dso; /* shared module handle */
} fns[1]; /* the table itself */
};
extern int __atexit_invalid;
extern struct atexit *__atexit; /* points to head of LIFO stack */
int __cxa_atexit(void (*)(void *), void *, void *);
void __cxa_finalize(void *);
|
/* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// GTLSQLAdminInstancesCloneResponse.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Cloud SQL Administration API (sqladmin/v1beta3)
// Description:
// API for Cloud SQL database instance management.
// Documentation:
// https://developers.google.com/cloud-sql/docs/admin-api/
// Classes:
// GTLSQLAdminInstancesCloneResponse (0 custom class methods, 2 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
// ----------------------------------------------------------------------------
//
// GTLSQLAdminInstancesCloneResponse
//
// Database instance clone response.
@interface GTLSQLAdminInstancesCloneResponse : GTLObject
// This is always sql#instancesClone.
@property (copy) NSString *kind;
// An unique identifier for the operation associated with the cloned instance.
// You can use this identifier to retrieve the Operations resource, which has
// information about the operation.
@property (copy) NSString *operation;
@end
|
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2008 Greenplum, Inc.
//
// @filename:
// CDynamicPtrArrayTest.h
//
// @doc:
// Test for CDynamicPtrArray
//---------------------------------------------------------------------------
#ifndef GPOS_CDynamicPtrArrayTest_H
#define GPOS_CDynamicPtrArrayTest_H
#include "gpos/base.h"
namespace gpos
{
//---------------------------------------------------------------------------
// @class:
// CDynamicPtrArrayTest
//
// @doc:
// Static unit tests
//
//---------------------------------------------------------------------------
class CDynamicPtrArrayTest
{
public:
// unittests
static GPOS_RESULT EresUnittest();
static GPOS_RESULT EresUnittest_Basic();
static GPOS_RESULT EresUnittest_Ownership();
static GPOS_RESULT EresUnittest_ArrayAppend();
static GPOS_RESULT EresUnittest_ArrayAppendExactFit();
static GPOS_RESULT EresUnittest_PdrgpulSubsequenceIndexes();
// destructor function for char's
static void DestroyChar(char *);
}; // class CDynamicPtrArrayTest
} // namespace gpos
#endif // !GPOS_CDynamicPtrArrayTest_H
// EOF
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of Image Engine Design nor the names of any
// other contributors to this software may be used to endorse or
// promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef IECOREPYTHON_IMATHEULERBINDING_H
#define IECOREPYTHON_IMATHEULERBINDING_H
namespace IECorePython
{
void bindImathEuler();
}
#endif // IECOREPYTHON_IMATHEULERBINDING_H
|
/*
* Copyright (c) 2019 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 MEDIA_ENGINE_UNHANDLED_PACKETS_BUFFER_H_
#define MEDIA_ENGINE_UNHANDLED_PACKETS_BUFFER_H_
#include <stdint.h>
#include <functional>
#include <tuple>
#include <utility>
#include <vector>
#include "rtc_base/copy_on_write_buffer.h"
namespace cricket {
class UnhandledPacketsBuffer {
public:
// Visible for testing.
static constexpr size_t kMaxStashedPackets = 50;
UnhandledPacketsBuffer();
~UnhandledPacketsBuffer();
// Store packet in buffer.
void AddPacket(uint32_t ssrc,
int64_t packet_time_us,
rtc::CopyOnWriteBuffer packet);
// Feed all packets with |ssrcs| into |consumer|.
void BackfillPackets(
rtc::ArrayView<const uint32_t> ssrcs,
std::function<void(uint32_t, int64_t, rtc::CopyOnWriteBuffer)> consumer);
private:
size_t insert_pos_ = 0;
struct PacketWithMetadata {
uint32_t ssrc;
int64_t packet_time_us;
rtc::CopyOnWriteBuffer packet;
};
std::vector<PacketWithMetadata> buffer_;
};
} // namespace cricket
#endif // MEDIA_ENGINE_UNHANDLED_PACKETS_BUFFER_H_
|
// Copyright (c) 2011-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_WALLETVIEW_H
#define BITCOIN_QT_WALLETVIEW_H
#include <amount.h>
#include <QStackedWidget>
class BitcoinGUI;
class ClientModel;
class OverviewPage;
class PlatformStyle;
class ReceiveCoinsDialog;
class SendCoinsDialog;
class SendCoinsRecipient;
class TransactionView;
class WalletModel;
class AddressBookPage;
QT_BEGIN_NAMESPACE
class QModelIndex;
class QProgressDialog;
QT_END_NAMESPACE
/*
WalletView class. This class represents the view to a single wallet.
It was added to support multiple wallet functionality. Each wallet gets its own WalletView instance.
It communicates with both the client and the wallet models to give the user an up-to-date view of the
current core state.
*/
class WalletView : public QStackedWidget
{
Q_OBJECT
public:
explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent);
~WalletView();
void setBitcoinGUI(BitcoinGUI *gui);
/** Set the client model.
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
*/
void setClientModel(ClientModel *clientModel);
WalletModel *getWalletModel() { return walletModel; }
/** Set the wallet model.
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
functionality.
*/
void setWalletModel(WalletModel *walletModel);
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
void showOutOfSyncWarning(bool fShow);
private:
ClientModel *clientModel;
WalletModel *walletModel;
OverviewPage *overviewPage;
QWidget *transactionsPage;
ReceiveCoinsDialog *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage;
AddressBookPage *usedSendingAddressesPage;
AddressBookPage *usedReceivingAddressesPage;
TransactionView *transactionView;
QProgressDialog *progressDialog;
const PlatformStyle *platformStyle;
public Q_SLOTS:
/** Switch to overview (home) page */
void gotoOverviewPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
/** Show Sign/Verify Message dialog and switch to verify message tab */
void gotoVerifyMessageTab(QString addr = "");
/** Show incoming transaction notification for new transactions.
The new items are those between start and end inclusive, under the given parent item.
*/
void processNewTransaction(const QModelIndex& parent, int start, int /*end*/);
/** Encrypt the wallet */
void encryptWallet(bool status);
/** Backup the wallet */
void backupWallet();
/** Change encrypted wallet passphrase */
void changePassphrase();
/** Ask for passphrase to unlock wallet temporarily */
void unlockWallet();
/** Show used sending addresses */
void usedSendingAddresses();
/** Show used receiving addresses */
void usedReceivingAddresses();
/** Re-emit encryption status signal */
void updateEncryptionStatus();
/** Show progress dialog e.g. for rescan */
void showProgress(const QString &title, int nProgress);
/** User has requested more information about the out of sync state */
void requestedSyncWarningInfo();
Q_SIGNALS:
/** Signal that we want to show the main window */
void showNormalIfMinimized();
/** Fired when a message should be reported to the user */
void message(const QString &title, const QString &message, unsigned int style);
/** Encryption status of wallet changed */
void encryptionStatusChanged();
/** HD-Enabled status of wallet changed (only possible during startup) */
void hdEnabledStatusChanged();
/** Notify that a new transaction appeared */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName);
/** Notify that the out of sync warning icon has been pressed */
void outOfSyncWarningClicked();
};
#endif // BITCOIN_QT_WALLETVIEW_H
|
/*
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/arcregs.h>
#include <asm/ptrace.h>
/* Bit values in STATUS32 */
#define E1_MASK (1 << 1) /* Level 1 interrupts enable */
#define E2_MASK (1 << 2) /* Level 2 interrupts enable */
int interrupt_init(void)
{
return 0;
}
/*
* returns true if interrupts had been enabled before we disabled them
*/
int disable_interrupts(void)
{
int status = read_aux_reg(ARC_AUX_STATUS32);
int state = (status & (E1_MASK | E2_MASK)) ? 1 : 0;
status &= ~(E1_MASK | E2_MASK);
/* STATUS32 register is updated indirectly with "FLAG" instruction */
__asm__("flag %0" : : "r" (status));
return state;
}
void enable_interrupts(void)
{
unsigned int status = read_aux_reg(ARC_AUX_STATUS32);
status |= E1_MASK | E2_MASK;
/* STATUS32 register is updated indirectly with "FLAG" instruction */
__asm__("flag %0" : : "r" (status));
}
static void print_reg_file(long *reg_rev, int start_num)
{
unsigned int i;
/* Print 3 registers per line */
for (i = start_num; i < start_num + 25; i++) {
printf("r%02u: 0x%08lx\t", i, (unsigned long)*reg_rev);
if (((i + 1) % 3) == 0)
printf("\n");
/* Because pt_regs has registers reversed */
reg_rev--;
}
/* Add new-line if none was inserted in the end of loop above */
if (((i + 1) % 3) != 0)
printf("\n");
}
void show_regs(struct pt_regs *regs)
{
printf("ECR:\t0x%08lx\n", regs->ecr);
printf("RET:\t0x%08lx\nBLINK:\t0x%08lx\nSTAT32:\t0x%08lx\n",
regs->ret, regs->blink, regs->status32);
printf("GP: 0x%08lx\t r25: 0x%08lx\t\n", regs->r26, regs->r25);
printf("BTA: 0x%08lx\t SP: 0x%08lx\t FP: 0x%08lx\n", regs->bta,
regs->sp, regs->fp);
printf("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", regs->lp_start,
regs->lp_end, regs->lp_count);
print_reg_file(&(regs->r0), 0);
}
void bad_mode(struct pt_regs *regs)
{
if (regs)
show_regs(regs);
panic("Resetting CPU ...\n");
}
void do_memory_error(unsigned long address, struct pt_regs *regs)
{
printf("Memory error exception @ 0x%lx\n", address);
bad_mode(regs);
}
void do_instruction_error(unsigned long address, struct pt_regs *regs)
{
printf("Instruction error exception @ 0x%lx\n", address);
bad_mode(regs);
}
void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
{
printf("Machine check exception @ 0x%lx\n", address);
bad_mode(regs);
}
void do_interrupt_handler(void)
{
printf("Interrupt fired\n");
bad_mode(0);
}
void do_itlb_miss(struct pt_regs *regs)
{
printf("I TLB miss exception\n");
bad_mode(regs);
}
void do_dtlb_miss(struct pt_regs *regs)
{
printf("D TLB miss exception\n");
bad_mode(regs);
}
void do_tlb_prot_violation(unsigned long address, struct pt_regs *regs)
{
printf("TLB protection violation or misaligned access @ 0x%lx\n",
address);
bad_mode(regs);
}
void do_privilege_violation(struct pt_regs *regs)
{
printf("Privilege violation exception\n");
bad_mode(regs);
}
void do_trap(struct pt_regs *regs)
{
printf("Trap exception\n");
bad_mode(regs);
}
void do_extension(struct pt_regs *regs)
{
printf("Extension instruction exception\n");
bad_mode(regs);
}
#ifdef CONFIG_ISA_ARCV2
void do_swi(struct pt_regs *regs)
{
printf("Software Interrupt exception\n");
bad_mode(regs);
}
void do_divzero(unsigned long address, struct pt_regs *regs)
{
printf("Division by zero exception @ 0x%lx\n", address);
bad_mode(regs);
}
void do_dcerror(struct pt_regs *regs)
{
printf("Data cache consistency error exception\n");
bad_mode(regs);
}
void do_maligned(unsigned long address, struct pt_regs *regs)
{
printf("Misaligned data access exception @ 0x%lx\n", address);
bad_mode(regs);
}
#endif
|
#ifndef CYGONCE_HAL_PLF_STUB_H
#define CYGONCE_HAL_PLF_STUB_H
//=============================================================================
//
// plf_stub.h
//
// Platform header for GDB stub support.
//
//=============================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos 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.
//
// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): dmoseley
// Contributors:dmoseley
// Date: 2000-08-11
// Purpose: Platform HAL stub support for AM33-20/ASB2303 boards.
// Usage: #include <cyg/hal/plf_stub.h>
//
//####DESCRIPTIONEND####
//
//=============================================================================
#include <pkgconf/hal.h>
#include <pkgconf/hal_mn10300_am33_asb.h>
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM
#include <cyg/hal/mn10300_stub.h> // architecture stub support
//----------------------------------------------------------------------------
// Define some platform specific communication details. This is mostly
// handled by hal_if now, but we need to make sure the comms tables are
// properly initialized.
externC void cyg_hal_plf_comms_init(void);
#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init()
#define HAL_STUB_PLATFORM_GET_CHAR() cyg_hal_plf_serial_getc(0)
#define HAL_STUB_PLATFORM_PUT_CHAR(c) cyg_hal_plf_serial_putc(0, (c))
#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) cyg_hal_plf_serial_setbaud(0, (baud))
#define HAL_STUB_PLATFORM_INTERRUPTIBLE (&hal_asb_interruptible)
#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT
//----------------------------------------------------------------------------
// Stub initializer.
externC void hal_asb_platform_init(void);
#define HAL_STUB_PLATFORM_INIT() hal_asb_platform_init()
#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
//-----------------------------------------------------------------------------
// Syscall support.
#ifdef CYGPKG_CYGMON
// Cygmon provides syscall handling for this board
#define SIGSYSCALL SIGSYS
extern int __get_syscall_num (void);
#endif
//-----------------------------------------------------------------------------
// Register validity checking.
#ifdef CYGPKG_CYGMON
#define CYGHWR_REGISTER_VALIDITY_CHECKING
#endif
//-----------------------------------------------------------------------------
#endif // CYGONCE_HAL_PLF_STUB_H
// End of plf_stub.h
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.