text
stringlengths
4
6.14k
/* * libquicktime yuv4 encoder * * Copyright (c) 2011 Carl Eugen Hoyos * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "internal.h" static av_cold int yuv4_encode_init(AVCodecContext *avctx) { avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) { av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); return AVERROR(ENOMEM); } return 0; } static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { uint8_t *dst; uint8_t *y, *u, *v; int i, j, ret; if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0) return ret; dst = pkt->data; avctx->coded_frame->reference = 0; avctx->coded_frame->key_frame = 1; avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; y = pic->data[0]; u = pic->data[1]; v = pic->data[2]; for (i = 0; i < avctx->height + 1 >> 1; i++) { for (j = 0; j < avctx->width + 1 >> 1; j++) { *dst++ = u[j] ^ 0x80; *dst++ = v[j] ^ 0x80; *dst++ = y[ 2 * j ]; *dst++ = y[ 2 * j + 1]; *dst++ = y[pic->linesize[0] + 2 * j ]; *dst++ = y[pic->linesize[0] + 2 * j + 1]; } y += 2 * pic->linesize[0]; u += pic->linesize[1]; v += pic->linesize[2]; } pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; } static av_cold int yuv4_encode_close(AVCodecContext *avctx) { av_freep(&avctx->coded_frame); return 0; } AVCodec ff_yuv4_encoder = { .name = "yuv4", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_YUV4, .init = yuv4_encode_init, .encode2 = yuv4_encode_frame, .close = yuv4_encode_close, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"), };
/** * @file vlanStat.c */ /* Embedded Xinu, Copyright (C) 2009, 2013. All rights reserved. */ #include <ether.h> #include <stdio.h> int vlanStat(void) { fprintf(stderr, "ERROR: VLANs not supported by this driver.\n"); return SYSERR; }
/* * This file is part of the Soletta Project * * Copyright (C) 2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once /* This file is required to build TinyDLS, and uses the constants defined * by Soletta's build system to create one that TinyDTLS will be happy * with, without actually running or generating its configure script. */ #include "dtls_config.h"
/* fitblk.h ========= Author: R.J.Barnes */ #ifndef _FITBLK_H #define _FITBLK_H struct FitPrm { int channel; /* zero=mono 1 or 2 is stereo */ int offset; /* used for stereo badlags */ int cp; int xcf; int tfreq; int noise; int nrang; int smsep; int nave; int mplgs; int mpinc; int txpl; int lagfr; int mppul; int bmnum; int old; int *lag[2]; int *pulse; int *pwr0; int maxbeam; double interfer[3]; double bmsep; double phidiff; double tdiff; double vdir; }; struct FitBlock { struct FitPrm prm; struct complex *acfd; struct complex *xcfd; }; struct FitElv { /* elevation angle derived from the cross correlation */ double normal; double low; double high; }; struct FitNoise { /* noise statistics */ double vel; double skynoise; double lag0; }; struct FitRange { /* fitted parameters for a single range */ double v; double v_err; double p_0; double p_l; double p_l_err; double p_s; double p_s_err; double w_l; double w_l_err; double w_s; double w_s_err; double phi0; double phi0_err; double sdev_l; double sdev_s; double sdev_phi; int qflg,gsct; char nump; }; #endif
#include <iostream> #include <string> #include <map> using namespace std; map<string, int> repeatCounts(long int pos, const string& seq, int maxsize); bool isRepeatUnit(const string& seq, const string& unit);
/*++ Copyright (c) 2006 Microsoft Corporation Module Name: obj_pair_hashtable.h Abstract: <abstract> Author: Leonardo de Moura (leonardo) 2008-02-19. Revision History: --*/ #ifndef OBJ_PAIR_HASHTABLE_H_ #define OBJ_PAIR_HASHTABLE_H_ #include"hash.h" #include"hashtable.h" /** \brief Special entry for a hashtable of pairs of obj pointers (i.e., objects that have a hash() method). This entry uses 0x0 and 0x1 to represent HT_FREE and HT_DELETED. */ template<typename T1, typename T2> class obj_pair_hash_entry { unsigned m_hash; // cached hash code std::pair<T1*, T2*> m_data; public: typedef std::pair<T1*, T2*> data; obj_pair_hash_entry():m_data(static_cast<T1*>(0),static_cast<T2*>(0)) {} unsigned get_hash() const { return m_hash; } bool is_free() const { return m_data.first == 0; } bool is_deleted() const { return m_data.first == reinterpret_cast<T1 *>(1); } bool is_used() const { return m_data.first != reinterpret_cast<T1 *>(0) && m_data.first != reinterpret_cast<T1 *>(1); } data const & get_data() const { return m_data; } data & get_data() { return m_data; } void set_data(data const d) { m_data = d; } void set_hash(unsigned h) { m_hash = h; } void mark_as_deleted() { m_data.first = reinterpret_cast<T1 *>(1); } void mark_as_free() { m_data.first = 0; } }; template<typename T1, typename T2> class obj_pair_hashtable : public core_hashtable<obj_pair_hash_entry<T1, T2>, obj_ptr_pair_hash<T1, T2>, default_eq<std::pair<T1*, T2*> > > { public: obj_pair_hashtable(unsigned initial_capacity = DEFAULT_HASHTABLE_INITIAL_CAPACITY): core_hashtable<obj_pair_hash_entry<T1, T2>, obj_ptr_pair_hash<T1, T2>, default_eq<std::pair<T1*, T2*> > >(initial_capacity) { } }; template<typename Key1, typename Key2, typename Value> class obj_pair_map { protected: class entry; public: class key_data { Key1 * m_key1; Key2 * m_key2; Value m_value; unsigned m_hash; friend class entry; public: key_data(): m_key1(0), m_key2(0), m_hash(0) { } key_data(Key1 * k1, Key2 * k2): m_key1(k1), m_key2(k2) { m_hash = combine_hash(m_key1->hash(), m_key2->hash()); } key_data(Key1 * k1, Key2 * k2, const Value & v): m_key1(k1), m_key2(k2), m_value(v) { m_hash = combine_hash(m_key1->hash(), m_key2->hash()); } unsigned hash() const { return m_hash; } bool operator==(key_data const & other) const { return m_key1 == other.m_key1 && m_key2 == other.m_key2; } Key1 * get_key1() const { return m_key1; } Key2 * get_key2() const { return m_key2; } Value const & get_value() const { return m_value; } }; protected: class entry { key_data m_data; public: typedef key_data data; entry() {} unsigned get_hash() const { return m_data.hash(); } bool is_free() const { return m_data.m_key1 == 0; } bool is_deleted() const { return m_data.m_key1 == reinterpret_cast<Key1 *>(1); } bool is_used() const { return m_data.m_key1 != reinterpret_cast<Key1 *>(0) && m_data.m_key1 != reinterpret_cast<Key1 *>(1); } key_data const & get_data() const { return m_data; } key_data & get_data() { return m_data; } void set_data(key_data const & d) { m_data = d; } void set_hash(unsigned h) { SASSERT(h == m_data.hash()); } void mark_as_deleted() { m_data.m_key1 = reinterpret_cast<Key1 *>(1); } void mark_as_free() { m_data.m_key1 = 0; } }; typedef core_hashtable<entry, obj_hash<key_data>, default_eq<key_data> > table; table m_table; entry * find_core(Key1 * k1, Key2 * k2) const { return m_table.find_core(key_data(k1, k2)); } public: obj_pair_map(): m_table(DEFAULT_HASHTABLE_INITIAL_CAPACITY) {} typedef typename table::iterator iterator; void reset() { m_table.reset(); } bool empty() const { return m_table.empty(); } unsigned size() const { return m_table.size(); } unsigned capacity() const { return m_table.capacity(); } iterator begin() const { return m_table.begin(); } iterator end() const { return m_table.end(); } void insert(Key1 * k1, Key2 * k2, Value const & v) { m_table.insert(key_data(k1, k2, v)); } key_data const & insert_if_not_there(Key1 * k1, Key2 * k2, Value const & v) { return m_table.insert_if_not_there(key_data(k1, k2, v)); } bool find(Key1 * k1, Key2 * k2, Value & v) const { entry * e = find_core(k1, k2); if (e) { v = e->get_data().get_value(); } return (0 != e); } bool contains(Key1 * k1, Key2 * k2) const { return find_core(k1, k2) != 0; } void erase(Key1 * k1, Key2 * k2) { m_table.remove(key_data(k1, k2)); } }; #endif /* OBJ_PAIR_HASHTABLE_H_ */
/* * arch/arm/mach-pnx4008/include/mach/pm.h * * PNX4008 Power Management Routiness - header file * * Authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com> * * 2005 (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. */ #ifndef __ASM_ARCH_PNX4008_PM_H #define __ASM_ARCH_PNX4008_PM_H #ifndef __ASSEMBLER__ #include "irq.h" #include "irqs.h" #include "clock.h" extern void pnx4008_pm_idle(void); extern void pnx4008_pm_suspend(void); extern unsigned int pnx4008_cpu_suspend_sz; extern void pnx4008_cpu_suspend(void); extern unsigned int pnx4008_cpu_standby_sz; extern void pnx4008_cpu_standby(void); extern int pnx4008_startup_pll(struct clk *); extern int pnx4008_shutdown_pll(struct clk *); #endif /* */ #endif /* */
/* * arch/arm/mach-pnx4008/time.c * * PNX4008 Timers * * Authors: Vitaly Wool, Dmitry Chigirev, Grigory Tolstolytkin <source@mvista.com> * * 2005 (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/kernel.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/module.h> #include <linux/kallsyms.h> #include <linux/time.h> #include <linux/timex.h> #include <linux/irq.h> #include <linux/io.h> #include <mach/hardware.h> #include <asm/leds.h> #include <asm/mach/time.h> #include <asm/errno.h> #include "time.h" /* */ /* */ static unsigned long pnx4008_gettimeoffset(void) { u32 ticks_to_match = __raw_readl(HSTIM_MATCH0) - __raw_readl(HSTIM_COUNTER); u32 elapsed = LATCH - ticks_to_match; return (elapsed * (tick_nsec / 1000)) / LATCH; } /* */ static irqreturn_t pnx4008_timer_interrupt(int irq, void *dev_id) { if (__raw_readl(HSTIM_INT) & MATCH0_INT) { do { timer_tick(); /* */ __raw_writel(__raw_readl(HSTIM_MATCH0) + LATCH, HSTIM_MATCH0); __raw_writel(MATCH0_INT, HSTIM_INT); /* */ /* */ } while ((signed) (__raw_readl(HSTIM_MATCH0) - __raw_readl(HSTIM_COUNTER)) < 0); } return IRQ_HANDLED; } static struct irqaction pnx4008_timer_irq = { .name = "PNX4008 Tick Timer", .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, .handler = pnx4008_timer_interrupt }; /* */ static __init void pnx4008_setup_timer(void) { __raw_writel(RESET_COUNT, MSTIM_CTRL); while (__raw_readl(MSTIM_COUNTER)) ; /* */ __raw_writel(0, MSTIM_CTRL); /* */ __raw_writel(0, MSTIM_MCTRL); __raw_writel(RESET_COUNT, HSTIM_CTRL); while (__raw_readl(HSTIM_COUNTER)) ; /* */ __raw_writel(0, HSTIM_CTRL); __raw_writel(0, HSTIM_MCTRL); __raw_writel(0, HSTIM_CCR); __raw_writel(12, HSTIM_PMATCH); /* */ __raw_writel(LATCH, HSTIM_MATCH0); __raw_writel(MR0_INT, HSTIM_MCTRL); setup_irq(HSTIMER_INT, &pnx4008_timer_irq); __raw_writel(COUNT_ENAB | DEBUG_EN, HSTIM_CTRL); /* */ } /* */ #define TIMCLK_CTRL_REG IO_ADDRESS((PNX4008_PWRMAN_BASE + 0xBC)) #define WATCHDOG_CLK_EN 1 #define TIMER_CLK_EN 2 /* */ static u32 timclk_ctrl_reg_save; void pnx4008_timer_suspend(void) { timclk_ctrl_reg_save = __raw_readl(TIMCLK_CTRL_REG); __raw_writel(0, TIMCLK_CTRL_REG); /* */ } void pnx4008_timer_resume(void) { __raw_writel(timclk_ctrl_reg_save, TIMCLK_CTRL_REG); /* */ } struct sys_timer pnx4008_timer = { .init = pnx4008_setup_timer, .offset = pnx4008_gettimeoffset, .suspend = pnx4008_timer_suspend, .resume = pnx4008_timer_resume, };
/* Configuration file for an m68k OpenBSD target. Copyright (C) 1999-2017 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ /* Target OS builtins. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__unix__"); \ builtin_define ("__OpenBSD__"); \ builtin_assert ("system=unix"); \ builtin_assert ("system=OpenBSD"); \ } \ while (0) /* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified. This will control the use of inline 68881 insns in certain macros. */ #undef CPP_SPEC #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" #undef ASM_SPEC #define ASM_SPEC \ "%(asm_cpu_spec) %{" FPIE1_OR_FPIC1_SPEC ":-k} %{" FPIE2_OR_FPIC2_SPEC ":-k -K}" /* Layout of source language data types. */ /* This must agree with <machine/ansi.h> */ #undef SIZE_TYPE #define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE #define WCHAR_TYPE "int" #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 #undef WINT_TYPE #define WINT_TYPE "int" /* Storage layout. */ /* Every structure or union's size must be a multiple of 2 bytes. */ #define STRUCTURE_SIZE_BOUNDARY 16 /* Specific options for DBX Output. */ /* This is BSD, so it wants DBX format. */ #define DBX_DEBUGGING_INFO 1 /* Do not break .stabs pseudos into continuations. */ #define DBX_CONTIN_LENGTH 0 /* This is the char to use for continuation (in case we need to turn continuation back on). */ #define DBX_CONTIN_CHAR '?' /* Stack & calling: aggregate returns. */ /* ??? This is traditional, but quite possibly wrong. It appears to disagree with gdb. */ #define PCC_STATIC_STRUCT_RETURN 1 /* Don't default to pcc-struct-return, because gcc is the only compiler, and we want to retain compatibility with older gcc versions. */ #define DEFAULT_PCC_STRUCT_RETURN 0 /* Assembler format: exception region output. */ /* All configurations that don't use elf must be explicit about not using dwarf unwind information. */ #define DWARF2_UNWIND_INFO 0 #define TARGET_HAVE_NAMED_SECTIONS false
/* Copyright (C) 2012-2017 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>. This file is part of the GNU Atomic Library (libatomic). Libatomic 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. Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ /* Included after all more target-specific host-config.h. */ #ifndef protect_start_end # ifdef HAVE_ATTRIBUTE_VISIBILITY # pragma GCC visibility push(hidden) # endif void libat_lock_1 (void *ptr); void libat_unlock_1 (void *ptr); static inline UWORD protect_start (void *ptr) { libat_lock_1 (ptr); return 0; } static inline void protect_end (void *ptr, UWORD dummy UNUSED) { libat_unlock_1 (ptr); } # define protect_start_end 1 # ifdef HAVE_ATTRIBUTE_VISIBILITY # pragma GCC visibility pop # endif #endif /* protect_start_end */ #include_next <host-config.h>
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * * 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. * * This software 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 software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ // // TXViewport.h // // A TXViewport allows a large window to be viewed by adding scrollbars to the // right and bottom if necessary. It also has a bump-scroll mode where there // are no scrollbars, and scrolling is achieved by bumping up against the edge // of the screen instead. Note that this only works when the viewport fills // the entire screen. If the child window is smaller than the viewport, it is // always positioned centrally in the viewport. #ifndef __TXVIEWPORT_H__ #define __TXVIEWPORT_H__ #include <rfb/Timer.h> #include "TXWindow.h" #include "TXScrollbar.h" class TXViewport : public TXWindow, public TXScrollbarCallback, public rfb::Timer::Callback { public: TXViewport(Display* dpy_, int width, int height, TXWindow* parent_=0); virtual ~TXViewport(); // setChild() sets the child window which is to be viewed in the viewport. void setChild(TXWindow* child_); // setOffset() sets the position of the child in the viewport. Note that the // offsets are negative. For example when the offset is (-100,-30), position // (100,30) in the child window is at the top-left of the viewport. The // offsets given are clipped to keep the child window filling the viewport // (except where the child window is smaller than the viewport, in which case // it is always positioned centrally in the viewport). It returns true if // the child was repositioned. bool setOffset(int x, int y); // setBumpScroll() puts the viewport in bump-scroll mode. void setBumpScroll(bool b); // bumpScrollEvent() can be called with a MotionNotify event which may // potentially be against the edge of the screen. It returns true if the // event was used for bump-scrolling, false if it should be processed // normally. bool bumpScrollEvent(XMotionEvent* ev); private: virtual void resizeNotify(); virtual void scrollbarPos(int x, int y, TXScrollbar* sb); virtual bool handleTimeout(rfb::Timer* timer); TXWindow* clipper; TXWindow* child; TXScrollbar* hScrollbar; TXScrollbar* vScrollbar; const int scrollbarSize; int xOff, yOff; rfb::Timer bumpScrollTimer; bool bumpScroll; bool needScrollbars; int bumpScrollX, bumpScrollY; }; #endif
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/mount.h> #include <mntent.h> #define MAXFS 16 static char *devlist[MAXFS]; static char **devp = &devlist[0]; static char *getdev(char *arg) { FILE *f; struct mntent *mnt; f = setmntent("/etc/mtab", "r"); if (f) { while (mnt = getmntent(f)) { if ((strcmp(mnt->mnt_fsname, arg) == 0) || (strcmp(mnt->mnt_dir, arg) == 0)) { endmntent(f); return strdup(mnt->mnt_fsname); } } endmntent(f); } return NULL; } static int deleted(const char *p) { char **d = &devlist[0]; while(d < devp) { if (*d && strcmp(*d, p) == 0) return 1; d++; } return 0; } static void queue_rm_mtab(const char *p) { if (devp == &devlist[MAXFS]) fputs("umount: too many file systems.\n", stderr); else *devp++ = strdup(p); } static int rewrite_mtab(void) { FILE *inpf, *outf; struct mntent *mnt; inpf = setmntent("/etc/mtab", "r"); if (!inpf) { perror("Can't open /etc/mtab"); exit(1); } outf = setmntent("/etc/mtab.new", "w"); if (!outf) { perror("Can't create temporary file"); exit(1); } while (mnt = getmntent(inpf)) { /* FIXME: should we check device and dir ? */ if (deleted(mnt->mnt_fsname)) continue; else addmntent(outf, mnt); } endmntent(inpf); endmntent(outf); if (rename("/etc/mtab.new", "/etc/mtab") < 0) { perror("Error installing /etc/mtab"); exit(1); } return 0; } int main(int argc, char *argv[]) { struct mntent *mnt; const char *dev; char **dp; FILE *f; int err = 0; umask(022); if (argc != 2) { fprintf(stderr, "%s: umount device\n", argv[0]); return 1; } if (strcmp(argv[1], "-a") == 0) { /* We need to umount things in reverse order if we have mounts on mounts */ f = setmntent("/etc/mtab", "r"); if (f == NULL) { perror("mtab"); exit(1); } while(mnt = getmntent(f)) { /* We can't unmount / */ if (strcmp(mnt->mnt_dir, "/")) queue_rm_mtab(mnt->mnt_fsname); } endmntent(f); dp = devp; /* Unmount in reverse order of mounting */ while(--dp >= devlist) { if (umount(*dp) == -1) { perror(*dp); *dp = NULL; err |= 1; } } rewrite_mtab(); } else { dev = getdev(argv[1]); if (!dev) dev = argv[1]; if (umount(dev) == 0) { queue_rm_mtab(dev); rewrite_mtab(); } else perror("umount"); return 1; } return err; }
#ifndef _USB_OSAI_H_ #define _USB_OSAI_H_ #include <linux/delay.h> #include <linux/spinlock_types.h> #include <linux/spinlock.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/dma-mapping.h> #include <linux/random.h> #include <linux/slab.h> #include <linux/mu3d/hal/mu3d_hal_comm.h> #undef EXTERN #ifdef _USB_OSAI_EXT_ #define EXTERN #else #define EXTERN extern #endif #define K_QMU (1<<7) #define K_ALET (1<<6) #define K_CRIT (1<<5) #define K_ERR (1<<4) #define K_WARNIN (1<<3) #define K_NOTICE (1<<2) #define K_INFO (1<<1) #define K_DEBUG (1<<0) /*Set the debug level at musb_core.c*/ extern u32 debug_level; #ifdef USE_SSUSB_QMU #define qmu_printk(level, fmt, args...) do { \ if ( debug_level & (level|K_QMU) ) { \ printk("[U3D][Q]" fmt, ## args); \ } \ } while (0) #endif #define os_printk(level, fmt, args...) do { \ if ( debug_level & level ) { \ printk("[U3D]" fmt, ## args); \ } \ } while (0) #define OS_R_OK ((DEV_INT32) 0) EXTERN spinlock_t _lock; EXTERN DEV_INT32 os_reg_isr(DEV_UINT32 irq,irq_handler_t handler,void *isrbuffer); EXTERN void os_ms_delay (DEV_UINT32 ui4_delay); EXTERN void os_us_delay (DEV_UINT32 ui4_delay); void os_memcpy(DEV_INT8 *pv_to, DEV_INT8 *pv_from, size_t z_l); EXTERN void *os_memset(void *pv_to, DEV_UINT8 ui1_c, size_t z_l); EXTERN void *os_mem_alloc(size_t z_size); EXTERN void *os_phys_to_virt(void *paddr); EXTERN void os_mem_free(void *pv_mem); EXTERN void os_disableIrq(DEV_UINT32 irq); EXTERN void os_disableIrq(DEV_UINT32 irq); EXTERN void os_enableIrq(DEV_UINT32 irq); EXTERN void os_clearIrq(DEV_UINT32 irq); EXTERN void os_get_random_bytes(void *buf,DEV_INT32 nbytes); EXTERN void os_disableDcache(void); EXTERN void os_flushinvalidateDcache(void); #undef EXTERN #endif
//============================================================================= // MusE Score // Linux Music Score Editor // // Copyright (C) 2010 Werner Schweer and others // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //============================================================================= #ifndef __BENDPROPERTIES_H__ #define __BENDPROPERTIES_H__ #include "ui_bend.h" #include "libmscore/pitchvalue.h" namespace Ms { class Bend; //--------------------------------------------------------- // BendProperties //--------------------------------------------------------- class BendProperties : public QDialog, public Ui::BendDialog { Q_OBJECT Bend* bend; QButtonGroup* bendTypes; virtual void hideEvent(QHideEvent*); private slots: void bendTypeChanged(int); public: BendProperties(Bend*, QWidget* parent = 0); const QList<PitchValue>& points() const; }; } // namespace Ms #endif
/** $lic$ * Copyright (C) 2012-2015 by Massachusetts Institute of Technology * Copyright (C) 2010-2013 by The Board of Trustees of Stanford University * * This file is part of zsim. * * zsim 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. * * If you use this software in your research, we request that you reference * the zsim paper ("ZSim: Fast and Accurate Microarchitectural Simulation of * Thousand-Core Systems", Sanchez and Kozyrakis, ISCA-40, June 2013) as the * source of the simulator in any publications that use this software, and that * you send us a citation of your work. * * zsim 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 NULL_CORE_H_ #define NULL_CORE_H_ //A core model with IPC=1 and no hooks into the memory hierarchy. Useful to isolate threads that need to be run for simulation purposes. #include "core.h" #include "pad.h" class NullCore : public Core { protected: uint64_t instrs; uint64_t curCycle; uint64_t phaseEndCycle; //next stopping point public: explicit NullCore(g_string& _name); void initStats(AggregateStat* parentStat); uint64_t getInstrs() const {return instrs;} uint64_t getPhaseCycles() const; uint64_t getCycles() const {return instrs; /*IPC=1*/ } void contextSwitch(int32_t gid); virtual void join(); InstrFuncPtrs GetFuncPtrs(); protected: inline void bbl(BblInfo* bblInstrs); static void LoadFunc(THREADID tid, ADDRINT addr); static void StoreFunc(THREADID tid, ADDRINT addr); static void BblFunc(THREADID tid, ADDRINT bblAddr, BblInfo* bblInfo); static void PredLoadFunc(THREADID tid, ADDRINT addr, BOOL pred); static void PredStoreFunc(THREADID tid, ADDRINT addr, BOOL pred); static void BranchFunc(THREADID, ADDRINT, BOOL, ADDRINT, ADDRINT) {} } ATTR_LINE_ALIGNED; //This needs to take up a whole cache line, or false sharing will be extremely frequent #endif // NULL_CORE_H_
/**************************************************************************** ** ** This file is part of the Qt Extended Opensource Package. ** ** Copyright (C) 2009 Trolltech ASA. ** ** Contact: Qt Extended Information (info@qtextended.org) ** ** This file may be used under the terms of the GNU General Public License ** version 2.0 as published by the Free Software Foundation and appearing ** in the file LICENSE.GPL included in the packaging of this file. ** ** Please review the following information to ensure GNU General Public ** Licensing requirements will be met: ** http://www.fsf.org/licensing/licenses/info/GPLv2.html. ** ** ****************************************************************************/ #ifndef GSTREAMERENGINE_H #define GSTREAMERENGINE_H #include <qmediaengine.h> #include "gstreamerplaybinsession.h" class QMediaEngineInformation; class QMediaSessionRequest; class QMediaServerSession; namespace gstreamer { class EnginePrivate; class Engine : public QMediaEngine { Q_OBJECT public: Engine(); ~Engine(); void initialize(); void start(); void stop(); void suspend(); void resume(); QMediaEngineInformation const* engineInformation(); void registerSession(QMediaServerSession* session); void unregisterSession(QMediaServerSession* session); private: QList<PlaybinSession*> sessions; QList<PlaybinSession*> suspendedSessions; EnginePrivate* d; }; } // ns gstreamer #endif
#ifndef _ASM_SCORE_SECTIONS_H #define _ASM_SCORE_SECTIONS_H #include <asm-generic/sections.h> #endif /* */
// license:BSD-3-Clause // copyright-holders:Aaron Giles /*************************************************************************** Gaelco 3D serial hardware ***************************************************************************/ /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ #define MCFG_GAELCO_SERIAL_IRQ_HANDLER(_devcb) \ devcb = &gaelco_serial_device::set_irq_handler(*device, DEVCB_##_devcb); /* external status bits */ #define GAELCOSER_STATUS_READY 0x01 #define GAELCOSER_STATUS_RTS 0x02 /* only RTS currently understood ! */ //#define GAELCOSER_STATUS_DTR 0x04 #define GAELCOSER_EXT_STATUS_MASK 0x03 /* internal bits follow ... */ #define GAELCOSER_STATUS_IRQ_ENABLE 0x10 #define GAELCOSER_STATUS_RESET 0x20 #define GAELCOSER_STATUS_SEND 0x40 /*************************************************************************** DEVICE INTERFACE TYPE ***************************************************************************/ /* ----- device interface ----- */ struct buf_t { volatile UINT8 data; volatile UINT8 stat; volatile int cnt; volatile int data_cnt; }; struct shmem_t { buf_t buf[2]; }; struct osd_shared_mem { char *fn; size_t size; void *ptr; int creator; }; class gaelco_serial_device : public device_t { public: gaelco_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~gaelco_serial_device() {} template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<gaelco_serial_device &>(device).m_irq_handler.set_callback(object); } DECLARE_READ8_MEMBER( status_r); DECLARE_WRITE8_MEMBER( data_w); DECLARE_READ8_MEMBER( data_r); DECLARE_WRITE8_MEMBER( rts_w ); /* Set to 1 during transmit, 0 for receive */ DECLARE_WRITE8_MEMBER( tr_w); /* Big questions marks, related to serial i/o */ /* Not used in surfplnt, but in radikalb * Set at beginning of transfer sub, cleared at end */ DECLARE_WRITE8_MEMBER( unknown_w); /* only used in radikalb, set at beginning of receive isr, cleared at end */ DECLARE_WRITE8_MEMBER( irq_enable ); protected: // device-level overrides virtual void device_start() override; virtual void device_stop() override; virtual void device_reset() override; private: // internal state devcb_write_line m_irq_handler; UINT8 m_status; int m_last_in_msg_cnt; int m_slack_cnt; emu_timer *m_sync_timer; buf_t *m_in_ptr; buf_t *m_out_ptr; osd_shared_mem *m_os_shmem; shmem_t *m_shmem; std::mutex m_mutex; TIMER_CALLBACK_MEMBER( set_status_cb ); TIMER_CALLBACK_MEMBER( link_cb ); void set_status(UINT8 mask, UINT8 set, int wait); void process_in(); void sync_link(); }; extern const device_type GAELCO_SERIAL;
/* * arch/arm/mach-ixp2000/include/mach/ixdp2x00.h * * Register and other defines for IXDP2[48]00 platforms * * Original Author: Naeem Afzal <naeem.m.afzal@intel.com> * Maintainer: Deepak Saxena <dsaxena@plexity.net> * * Copyright (C) 2002 Intel Corp. * Copyright (C) 2003-2004 MontaVista Software, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #ifndef _IXDP2X00_H_ #define _IXDP2X00_H_ /* */ #define IXDP2X00_PHYS_CPLD_BASE 0xc7000000 #define IXDP2X00_VIRT_CPLD_BASE 0xfe000000 #define IXDP2X00_CPLD_SIZE 0x00100000 #define IXDP2X00_CPLD_REG(x) \ (volatile unsigned long *)(IXDP2X00_VIRT_CPLD_BASE | x) /* */ #define IXDP2400_CPLD_SYSLED IXDP2X00_CPLD_REG(0x0) #define IXDP2400_CPLD_DISP_DATA IXDP2X00_CPLD_REG(0x4) #define IXDP2400_CPLD_CLOCK_SPEED IXDP2X00_CPLD_REG(0x8) #define IXDP2400_CPLD_INT_STAT IXDP2X00_CPLD_REG(0xc) #define IXDP2400_CPLD_REV IXDP2X00_CPLD_REG(0x10) #define IXDP2400_CPLD_SYS_CLK_M IXDP2X00_CPLD_REG(0x14) #define IXDP2400_CPLD_SYS_CLK_N IXDP2X00_CPLD_REG(0x18) #define IXDP2400_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x48) /* */ #define IXDP2800_CPLD_INT_STAT IXDP2X00_CPLD_REG(0x0) #define IXDP2800_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x140) #define IXDP2X00_GPIO_I2C_ENABLE 0x02 #define IXDP2X00_GPIO_SCL 0x07 #define IXDP2X00_GPIO_SDA 0x06 /* */ #define IXDP2400_SLAVE_ENET_DEVFN 0x18 /* */ #define IXDP2400_MASTER_ENET_DEVFN 0x20 /* */ #define IXDP2400_MEDIA_DEVFN 0x28 /* */ #define IXDP2400_SWITCH_FABRIC_DEVFN 0x30 /* */ #define IXDP2800_SLAVE_ENET_DEVFN 0x20 /* */ #define IXDP2800_MASTER_ENET_DEVFN 0x18 /* */ #define IXDP2800_SWITCH_FABRIC_DEVFN 0x30 /* */ #define IXDP2X00_P2P_DEVFN 0x20 /* */ #define IXDP2X00_21555_DEVFN 0x30 /* */ #define IXDP2X00_SLAVE_NPU_DEVFN 0x28 /* */ #define IXDP2X00_PMC_DEVFN 0x38 /* */ #define IXDP2X00_MASTER_NPU_DEVFN 0x38 /* */ #ifndef __ASSEMBLY__ /* */ static inline unsigned int ixdp2x00_master_npu(void) { return !!ixp2000_is_pcimaster(); } /* */ void ixdp2x00_init_irq(volatile unsigned long*, volatile unsigned long *, unsigned long); void ixdp2x00_slave_pci_postinit(void); void ixdp2x00_init_machine(void); void ixdp2x00_map_io(void); #endif #endif /* */
/* * Copyright (c) 2005-2006 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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 the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_AOPS_H__ #define __XFS_AOPS_H__ extern mempool_t *xfs_ioend_pool; /* */ enum { IO_DIRECT = 0, /* */ IO_DELALLOC, /* */ IO_UNWRITTEN, /* */ IO_OVERWRITE, /* */ }; #define XFS_IO_TYPES \ { 0, "" }, \ { IO_DELALLOC, "delalloc" }, \ { IO_UNWRITTEN, "unwritten" }, \ { IO_OVERWRITE, "overwrite" } /* */ typedef struct xfs_ioend { struct xfs_ioend *io_list; /* */ unsigned int io_type; /* */ int io_error; /* */ atomic_t io_remaining; /* */ unsigned int io_isasync : 1; /* */ unsigned int io_isdirect : 1;/* */ struct inode *io_inode; /* */ struct buffer_head *io_buffer_head;/* */ struct buffer_head *io_buffer_tail;/* */ size_t io_size; /* */ xfs_off_t io_offset; /* */ struct work_struct io_work; /* */ struct xfs_trans *io_append_trans;/* */ struct kiocb *io_iocb; int io_result; } xfs_ioend_t; extern const struct address_space_operations xfs_address_space_operations; extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); extern void xfs_count_page_state(struct page *, int *, int *); #endif /* */
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1999, 2000 by Silicon Graphics * Copyright (C) 2003 by Ralf Baechle */ #include <linux/init.h> #include <linux/mm.h> #include <asm/fixmap.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> void pgd_init(unsigned long page) { unsigned long *p, *end; unsigned long entry; #ifdef __PAGETABLE_PMD_FOLDED entry = (unsigned long)invalid_pte_table; #else entry = (unsigned long)invalid_pmd_table; #endif p = (unsigned long *) page; end = p + PTRS_PER_PGD; while (p < end) { p[0] = entry; p[1] = entry; p[2] = entry; p[3] = entry; p[4] = entry; p[5] = entry; p[6] = entry; p[7] = entry; p += 8; } } #ifndef __PAGETABLE_PMD_FOLDED void pmd_init(unsigned long addr, unsigned long pagetable) { unsigned long *p, *end; p = (unsigned long *) addr; end = p + PTRS_PER_PMD; while (p < end) { p[0] = pagetable; p[1] = pagetable; p[2] = pagetable; p[3] = pagetable; p[4] = pagetable; p[5] = pagetable; p[6] = pagetable; p[7] = pagetable; p += 8; } } #endif void __init pagetable_init(void) { unsigned long vaddr; pgd_t *pgd_base; /* */ pgd_init((unsigned long)swapper_pg_dir); #ifndef __PAGETABLE_PMD_FOLDED pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table); #endif pgd_base = swapper_pg_dir; /* */ vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base); }
/* Copyright (C) 2008 Paul Davis Author: Sakari Bergen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ardour_location_importer_h__ #define __ardour_location_importer_h__ #include "ardour/element_importer.h" #include "ardour/element_import_handler.h" #include <boost/shared_ptr.hpp> #include "pbd/xml++.h" namespace ARDOUR { class Location; class Session; class LIBARDOUR_API LocationImportHandler : public ElementImportHandler { public: LocationImportHandler (XMLTree const & source, Session & session); std::string get_info () const; }; class LIBARDOUR_API LocationImporter : public ElementImporter { public: LocationImporter (XMLTree const & source, Session & session, LocationImportHandler & handler, XMLNode const & node); ~LocationImporter (); std::string get_info () const; protected: bool _prepare_move (); void _cancel_move (); void _move (); private: LocationImportHandler & handler; XMLNode xml_location; Location * location; void parse_xml (); }; } // namespace ARDOUR #endif
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #pragma once #include <array> #include "Common/x64Emitter.h" class DSPEmitter; enum DSPJitRegSpecial { DSP_REG_AX0_32 =32, DSP_REG_AX1_32 =33, DSP_REG_ACC0_64 =34, DSP_REG_ACC1_64 =35, DSP_REG_PROD_64 =36, DSP_REG_MAX_MEM_BACKED = 36, DSP_REG_USED =253, DSP_REG_STATIC =254, DSP_REG_NONE =255 }; enum DSPJitSignExtend { SIGN, ZERO, NONE }; class DSPJitRegCache { private: struct X64CachedReg { size_t guest_reg; //including DSPJitRegSpecial bool pushed; }; struct DynamicReg { Gen::OpArg loc; void *mem; size_t size; bool dirty; bool used; int last_use_ctr; int parentReg; int shift;//current shift if parentReg == DSP_REG_NONE //otherwise the shift this part can be found at Gen::X64Reg host_reg; /* TODO: + drop sameReg + add parentReg + add shift: - if parentReg != DSP_REG_NONE, this is the shift where this register is found in the parentReg - if parentReg == DSP_REG_NONE, this is the current shift _state_ */ }; std::array<DynamicReg, 37> regs; std::array<X64CachedReg, 16> xregs; DSPEmitter &emitter; bool temporary; bool merged; int use_ctr; private: //find a free host reg Gen::X64Reg findFreeXReg(); Gen::X64Reg spillXReg(); Gen::X64Reg findSpillFreeXReg(); void spillXReg(Gen::X64Reg reg); void movToHostReg(size_t reg, Gen::X64Reg host_reg, bool load); void movToHostReg(size_t reg, bool load); void rotateHostReg(size_t reg, int shift, bool emit); void movToMemory(size_t reg); void flushMemBackedRegs(); public: DSPJitRegCache(DSPEmitter &_emitter); //for branching into multiple control flows DSPJitRegCache(const DSPJitRegCache &cache); DSPJitRegCache& operator=(const DSPJitRegCache &cache); ~DSPJitRegCache(); //merge must be done _before_ leaving the code branch, so we can fix //up any differences in state void flushRegs(DSPJitRegCache &cache, bool emit = true); /* since some use cases are non-trivial, some examples: //this does not modify the final state of gpr <code using gpr> FixupBranch b = JCC(); DSPJitRegCache c = gpr; <code using c> gpr.flushRegs(c); SetBranchTarget(b); <code using gpr> //this does not modify the final state of gpr <code using gpr> DSPJitRegCache c = gpr; FixupBranch b1 = JCC(); <code using gpr> gpr.flushRegs(c); FixupBranch b2 = JMP(); SetBranchTarget(b1); <code using gpr> gpr.flushRegs(c); SetBranchTarget(b2); <code using gpr> //this allows gpr to be modified in the second branch //and fixes gpr according to the results form in the first branch <code using gpr> DSPJitRegCache c = gpr; FixupBranch b1 = JCC(); <code using c> FixupBranch b2 = JMP(); SetBranchTarget(b1); <code using gpr> gpr.flushRegs(c); SetBranchTarget(b2); <code using gpr> //this does not modify the final state of gpr <code using gpr> u8* b = GetCodePtr(); DSPJitRegCache c = gpr; <code using gpr> gpr.flushRegs(c); JCC(b); <code using gpr> this all is not needed when gpr would not be used at all in the conditional branch */ //drop this copy without warning void drop(); //prepare state so that another flushed DSPJitRegCache can take over void flushRegs(); void loadRegs(bool emit=true);//load statically allocated regs from memory void saveRegs();//save statically allocated regs to memory void pushRegs();//save registers before abi call void popRegs();//restore registers after abi call //returns a register with the same contents as reg that is safe //to use through saveStaticRegs and for ABI-calls Gen::X64Reg makeABICallSafe(Gen::X64Reg reg); //gives no SCALE_RIP with abs(offset) >= 0x80000000 //32/64 bit writes allowed when the register has a _64 or _32 suffix //only 16 bit writes allowed without any suffix. void getReg(int reg, Gen::OpArg &oparg, bool load = true); //done with all usages of OpArg above void putReg(int reg, bool dirty = true); void readReg(int sreg, Gen::X64Reg host_dreg, DSPJitSignExtend extend); void writeReg(int dreg, Gen::OpArg arg); //find a free host reg, spill if used, reserve void getFreeXReg(Gen::X64Reg &reg); //spill a specific host reg if used, reserve void getXReg(Gen::X64Reg reg); //unreserve the given host reg void putXReg(Gen::X64Reg reg); };
/* Store current floating-point environment and clear exceptions. Copyright (C) 2000-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Huggins-Daines <dhd@debian.org>, 2000 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 <fenv.h> #include <string.h> int feholdexcept (fenv_t *envp) { union { unsigned long long buf[4]; fenv_t env; } clear; unsigned long long *bufptr; /* Store the environment. */ bufptr = clear.buf; __asm__ ( "fstd,ma %%fr0,8(%1)\n" : "=m" (clear), "+r" (bufptr) : : "%r0"); memcpy (envp, &clear.env, sizeof (fenv_t)); /* Clear exception queues */ memset (clear.env.__exception, 0, sizeof (clear.env.__exception)); /* And set all exceptions to non-stop. */ clear.env.__status_word &= ~FE_ALL_EXCEPT; /* Now clear all flags */ clear.env.__status_word &= ~(FE_ALL_EXCEPT << 27); /* Load the new environment. Note: fr0 must load last to enable T-bit Thus we start bufptr at the end and work backwards */ bufptr = (unsigned long long *)((unsigned int)(clear.buf) + sizeof(unsigned int)*4); __asm__ ( "fldd,mb -8(%0),%%fr0\n" : : "r" (bufptr), "m" (clear) : "%r0"); return 0; } libm_hidden_def (feholdexcept)
/*********************************************************************** Memory primitives (c) 1994, 1995 Innobase Oy Created 5/30/1994 Heikki Tuuri ************************************************************************/ #ifndef ut0mem_h #define ut0mem_h #include "univ.i" #include <string.h> #include <stdlib.h> /* The total amount of memory currently allocated from the OS with malloc */ extern ulint ut_total_allocated_memory; UNIV_INLINE void* ut_memcpy(void* dest, void* sour, ulint n); UNIV_INLINE void* ut_memmove(void* dest, void* sour, ulint n); UNIV_INLINE int ut_memcmp(void* str1, void* str2, ulint n); /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined and set_to_zero is TRUE. */ void* ut_malloc_low( /*==========*/ /* out, own: allocated memory */ ulint n, /* in: number of bytes to allocate */ ibool set_to_zero); /* in: TRUE if allocated memory should be set to zero if UNIV_SET_MEM_TO_ZERO is defined */ /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined. */ void* ut_malloc( /*======*/ /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate */ /************************************************************************** Frees a memory bloock allocated with ut_malloc. */ void ut_free( /*====*/ void* ptr); /* in, own: memory block */ /************************************************************************** Frees in shutdown all allocated memory not freed yet. */ void ut_free_all_mem(void); /*=================*/ UNIV_INLINE char* ut_strcpy(char* dest, char* sour); UNIV_INLINE ulint ut_strlen(const char* str); UNIV_INLINE int ut_strcmp(void* str1, void* str2); /************************************************************************** Catenates two strings into newly allocated memory. The memory must be freed using mem_free. */ char* ut_str_catenate( /*============*/ /* out, own: catenated null-terminated string */ char* str1, /* in: null-terminated string */ char* str2); /* in: null-terminated string */ #ifndef UNIV_NONINL #include "ut0mem.ic" #endif #endif
/* Determine whether string value is affirmation or negative response according to current locale's data. Copyright (C) 1996, 1998, 2000, 2002, 2003, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stddef.h> #include <stdlib.h> #if ENABLE_NLS # include <sys/types.h> # include <limits.h> # include <regex.h> # include "gettext.h" # define _(msgid) gettext (msgid) static int try (const char *response, const char *pattern, const int match, const int nomatch, const char **lastp, regex_t *re) { if (pattern != *lastp) { /* The pattern has changed. */ if (*lastp) { /* Free the old compiled pattern. */ regfree (re); *lastp = NULL; } /* Compile the pattern and cache it for future runs. */ if (regcomp (re, pattern, REG_EXTENDED) != 0) return -1; *lastp = pattern; } /* See if the regular expression matches RESPONSE. */ return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch; } #endif int rpmatch (const char *response) { #if ENABLE_NLS /* Match against one of the response patterns, compiling the pattern first if necessary. */ /* We cache the response patterns and compiled regexps here. */ static const char *yesexpr, *noexpr; static regex_t yesre, nore; int result; return ((result = try (response, _("^[yY]"), 1, 0, &yesexpr, &yesre)) ? result : try (response, _("^[nN]"), 0, -1, &noexpr, &nore)); #else /* Test against "^[yY]" and "^[nN]", hardcoded to avoid requiring regex */ return (*response == 'y' || *response == 'Y' ? 1 : *response == 'n' || *response == 'N' ? 0 : -1); #endif }
/* * This file is part of Cleanflight and Betaflight. * * Cleanflight and Betaflight are free software. You can redistribute * this software and/or modify this software 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. * * Cleanflight and Betaflight are distributed in the hope that they * 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 software. * * If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "rx/rx.h" #include "rx/rx_spi.h" #define RC_CHANNEL_COUNT_FRSKY_X 16 void frSkyXSetRcData(uint16_t *rcData, const uint8_t *payload); void frSkyXInit(void); rx_spi_received_e frSkyXHandlePacket(uint8_t * const packet, uint8_t * const protocolState);
/* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset * http://razor-qt.org * * Copyright: 2013 Christian Surlykke * * This program or library is free software; you can redistribute it * and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * END_COMMON_COPYRIGHT_HEADER */ #ifndef _APPLICATIONCHOOSER_H #define _APPLICATIONCHOOSER_H #include "ui_applicationchooser.h" #include <XdgDesktopFile> #include <XdgMimeType> class QSettings; class ApplicationChooser : public QDialog { Q_OBJECT public: ApplicationChooser(const XdgMimeType& mimeInfo, bool showUseAlwaysCheckBox = false); virtual ~ApplicationChooser(); XdgDesktopFile* DefaultApplication() const { return m_CurrentDefaultApplication; } virtual int exec(); private slots: void selectionChanged(); void updateAllIcons(); private: void fillApplicationListWidget(); void addApplicationsToApplicationListWidget(QTreeWidgetItem* parent, QList<XdgDesktopFile*> applications, QSet<XdgDesktopFile*> & alreadyAdded); XdgMimeType m_MimeInfo; Ui::ApplicationChooser widget; XdgDesktopFile* m_CurrentDefaultApplication; }; #endif /* _APPLICATIONCHOOSER_H */
//////////////////////////////////////////////////////////////////////////////// /// @brief write locker /// /// @file /// /// DISCLAIMER /// /// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// 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. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Frank Celler /// @author Achim Brandt /// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #ifndef ARANGODB_BASICS_WRITE_LOCKER_H #define ARANGODB_BASICS_WRITE_LOCKER_H 1 #include "Basics/Common.h" #include "Basics/ReadWriteLock.h" // ----------------------------------------------------------------------------- // --SECTION-- public macros // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @brief construct locker with file and line information /// /// Ones needs to use macros twice to get a unique variable based on the line /// number. //////////////////////////////////////////////////////////////////////////////// #define WRITE_LOCKER_VAR_A(a) _write_lock_variable ## a #define WRITE_LOCKER_VAR_B(a) WRITE_LOCKER_VAR_A(a) #ifdef TRI_SHOW_LOCK_TIME #define WRITE_LOCKER(b) \ triagens::basics::WriteLocker WRITE_LOCKER_VAR_B(__LINE__)(&b, __FILE__, __LINE__) #define WRITE_LOCKER_EVENTUAL(b, t) \ triagens::basics::WriteLocker WRITE_LOCKER_VAR_B(__LINE__)(&b, t, __FILE__, __LINE__) #else #define WRITE_LOCKER(b) \ triagens::basics::WriteLocker WRITE_LOCKER_VAR_B(__LINE__)(&b) #define WRITE_LOCKER_EVENTUAL(b, t) \ triagens::basics::WriteLocker WRITE_LOCKER_VAR_B(__LINE__)(&b, t) #endif // ----------------------------------------------------------------------------- // --SECTION-- class WriteLocker // ----------------------------------------------------------------------------- namespace triagens { namespace basics { //////////////////////////////////////////////////////////////////////////////// /// @brief write locker /// /// A WriteLocker write-locks a read-write lock during its lifetime and unlocks /// the lock when it is destroyed. //////////////////////////////////////////////////////////////////////////////// class WriteLocker { WriteLocker (WriteLocker const&); WriteLocker& operator= (WriteLocker const&); // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors // ----------------------------------------------------------------------------- public: //////////////////////////////////////////////////////////////////////////////// /// @brief aquires a write-lock /// /// The constructors aquires a write lock, the destructors unlocks the lock. //////////////////////////////////////////////////////////////////////////////// #ifdef TRI_SHOW_LOCK_TIME WriteLocker (ReadWriteLock* readWriteLock, char const* file, int line); #else explicit WriteLocker (ReadWriteLock*); #endif //////////////////////////////////////////////////////////////////////////////// /// @brief aquires a write-lock, with periodic sleeps while not acquired /// sleep time is specified in nanoseconds //////////////////////////////////////////////////////////////////////////////// #ifdef TRI_SHOW_LOCK_TIME WriteLocker (ReadWriteLock* readWriteLock, uint64_t sleepDelay, char const* file, int line); #else WriteLocker (ReadWriteLock*, uint64_t); #endif //////////////////////////////////////////////////////////////////////////////// /// @brief releases the write-lock //////////////////////////////////////////////////////////////////////////////// ~WriteLocker (); // ----------------------------------------------------------------------------- // --SECTION-- private variables // ----------------------------------------------------------------------------- private: //////////////////////////////////////////////////////////////////////////////// /// @brief the read-write lock //////////////////////////////////////////////////////////////////////////////// ReadWriteLock* _readWriteLock; #ifdef TRI_SHOW_LOCK_TIME //////////////////////////////////////////////////////////////////////////////// /// @brief file //////////////////////////////////////////////////////////////////////////////// char const* _file; //////////////////////////////////////////////////////////////////////////////// /// @brief line number //////////////////////////////////////////////////////////////////////////////// int _line; //////////////////////////////////////////////////////////////////////////////// /// @brief lock time //////////////////////////////////////////////////////////////////////////////// double _time; #endif }; } } #endif // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // End:
/* mbed Microcontroller Library * Copyright (c) 2015 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FILE_H #define FILE_H #include "filesystem/FileSystem.h" #include "platform/FileHandle.h" namespace mbed { /** \addtogroup filesystem */ /** @{*/ /** File class */ class File : public FileHandle { public: /** Create an uninitialized file * * Must call open to initialize the file on a file system */ File(); /** Create a file on a filesystem * * Creates and opens a file on a filesystem * * @param fs Filesystem as target for the file * @param path The name of the file to open * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND */ File(FileSystem *fs, const char *path, int flags = O_RDONLY); /** Destroy a file * * Closes file if the file is still open */ virtual ~File(); /** Open a file on the filesystem * * @param fs Filesystem as target for the file * @param path The name of the file to open * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND * @return 0 on success, negative error code on failure */ virtual int open(FileSystem *fs, const char *path, int flags = O_RDONLY); /** Close a file * * @return 0 on success, negative error code on failure */ virtual int close(); /** Read the contents of a file into a buffer * * @param buffer The buffer to read in to * @param size The number of bytes to read * @return The number of bytes read, 0 at end of file, negative error on failure */ virtual ssize_t read(void *buffer, size_t size); /** Write the contents of a buffer to a file * * @param buffer The buffer to write from * @param size The number of bytes to write * @return The number of bytes written, negative error on failure */ virtual ssize_t write(const void *buffer, size_t size); /** Flush any buffers associated with the file * * @return 0 on success, negative error code on failure */ virtual int sync(); /** Check if the file in an interactive terminal device * * @return True if the file is a terminal */ virtual int isatty(); /** Move the file position to a given offset from from a given location * * @param offset The offset from whence to move to * @param whence The start of where to seek * SEEK_SET to start from beginning of file, * SEEK_CUR to start from current position in file, * SEEK_END to start from end of file * @return The new offset of the file */ virtual off_t seek(off_t offset, int whence = SEEK_SET); /** Get the file position of the file * * @return The current offset in the file */ virtual off_t tell(); /** Rewind the file position to the beginning of the file * * @note This is equivalent to file_seek(file, 0, FS_SEEK_SET) */ virtual void rewind(); /** Get the size of the file * * @return Size of the file in bytes */ virtual off_t size(); /** Truncate or extend a file. * * The file's length is set to the specified value. The seek pointer is * not changed. If the file is extended, the extended area appears as if * it were zero-filled. * * @param length The requested new length for the file * * @return Zero on success, negative error code on failure */ virtual int truncate(off_t length); private: FileSystem *_fs; fs_file_t _file; }; /** @}*/ } // namespace mbed #endif
/* * This file is a part of the open source stm32plus library. * Copyright (c) 2011,2012,2013,2014 Andy Brown <www.andybrown.me.uk> * Please see website for licensing terms. */ #pragma once #ifndef STM32PLUS_F0 #error This class can only be used with the STM32F0 series #endif namespace stm32plus { /** * Internal flash device features class. This is the class that user * code should instantiate */ template<class... Features> struct InternalFlashDevice : InternalFlashPeripheral,Features... { /** * Constructor */ InternalFlashDevice() : Features(static_cast<InternalFlashPeripheral&>(*this))... { } }; }
/* * Copyright (C) 2018 Marvell International Ltd. * * SPDX-License-Identifier: BSD-3-Clause * https://spdx.org/licenses */ #ifndef PHY_PORTING_LAYER_H #define PHY_PORTING_LAYER_H #define MAX_LANE_NR 6 static const struct xfi_params xfi_static_values_tab[AP_NUM][CP_NUM][MAX_LANE_NR] = { /* AP0 */ { /* CP 0 */ { { 0 }, /* Comphy0 */ { 0 }, /* Comphy1 */ { .g1_ffe_res_sel = 0x3, .g1_ffe_cap_sel = 0xf, .align90 = 0x5f, .g1_dfe_res = 0x2, .g1_amp = 0x1c, .g1_emph = 0xe, .g1_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x1, .g1_tx_emph = 0x0, .g1_rx_selmuff = 0x1, .g1_rx_selmufi = 0x0, .g1_rx_selmupf = 0x2, .g1_rx_selmupi = 0x2, .valid = 0x1 }, /* Comphy2 */ { 0 }, /* Comphy3 */ { .g1_ffe_res_sel = 0x3, .g1_ffe_cap_sel = 0xf, .align90 = 0x5f, .g1_dfe_res = 0x2, .g1_amp = 0x1c, .g1_emph = 0xe, .g1_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x1, .g1_tx_emph = 0x0, .g1_rx_selmuff = 0x1, .g1_rx_selmufi = 0x0, .g1_rx_selmupf = 0x2, .g1_rx_selmupi = 0x2, .valid = 0x1 }, /* Comphy4 */ { 0 }, /* Comphy5 */ }, /* CP 1 */ { { 0 }, /* Comphy0 */ { 0 }, /* Comphy1 */ { .g1_ffe_res_sel = 0x3, .g1_ffe_cap_sel = 0xf, .align90 = 0x5f, .g1_dfe_res = 0x2, .g1_amp = 0x1c, .g1_emph = 0xe, .g1_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x1, .g1_tx_emph = 0x0, .g1_rx_selmuff = 0x1, .g1_rx_selmufi = 0x0, .g1_rx_selmupf = 0x2, .g1_rx_selmupi = 0x2, .valid = 0x1 }, /* Comphy2 */ { 0 }, /* Comphy3 */ { .g1_ffe_res_sel = 0x3, .g1_ffe_cap_sel = 0xf, .align90 = 0x5f, .g1_dfe_res = 0x2, .g1_amp = 0x1c, .g1_emph = 0xe, .g1_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x1, .g1_tx_emph = 0x0, .g1_rx_selmuff = 0x1, .g1_rx_selmufi = 0x0, .g1_rx_selmupf = 0x2, .g1_rx_selmupi = 0x2, .valid = 0x1 }, /* Comphy4 */ { 0 }, /* Comphy5 */ }, }, }; static const struct sata_params sata_static_values_tab[AP_NUM][CP_NUM][MAX_LANE_NR] = { /* AP0 */ { /* CP 0 */ { { 0 }, /* Comphy0 */ { .g1_amp = 0x8, .g2_amp = 0xa, .g3_amp = 0x1e, .g1_emph = 0x1, .g2_emph = 0x2, .g3_emph = 0xe, .g1_emph_en = 0x1, .g2_emph_en = 0x1, .g3_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g2_tx_amp_adj = 0x1, .g3_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x0, .g2_tx_emph_en = 0x0, .g3_tx_emph_en = 0x0, .g1_tx_emph = 0x1, .g2_tx_emph = 0x1, .g3_tx_emph = 0x1, .g3_dfe_res = 0x1, .g3_ffe_res_sel = 0x4, .g3_ffe_cap_sel = 0xf, .align90 = 0x61, .g1_rx_selmuff = 0x3, .g2_rx_selmuff = 0x3, .g3_rx_selmuff = 0x3, .g1_rx_selmufi = 0x0, .g2_rx_selmufi = 0x0, .g3_rx_selmufi = 0x3, .g1_rx_selmupf = 0x1, .g2_rx_selmupf = 0x1, .g3_rx_selmupf = 0x2, .g1_rx_selmupi = 0x0, .g2_rx_selmupi = 0x0, .g3_rx_selmupi = 0x2, .polarity_invert = COMPHY_POLARITY_NO_INVERT, .valid = 0x1 }, /* Comphy1 */ { 0 }, /* Comphy2 */ { .g1_amp = 0x8, .g2_amp = 0xa, .g3_amp = 0x1e, .g1_emph = 0x1, .g2_emph = 0x2, .g3_emph = 0xe, .g1_emph_en = 0x1, .g2_emph_en = 0x1, .g3_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g2_tx_amp_adj = 0x1, .g3_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x0, .g2_tx_emph_en = 0x0, .g3_tx_emph_en = 0x0, .g1_tx_emph = 0x1, .g2_tx_emph = 0x1, .g3_tx_emph = 0x1, .g3_dfe_res = 0x1, .g3_ffe_res_sel = 0x4, .g3_ffe_cap_sel = 0xf, .align90 = 0x61, .g1_rx_selmuff = 0x3, .g2_rx_selmuff = 0x3, .g3_rx_selmuff = 0x3, .g1_rx_selmufi = 0x0, .g2_rx_selmufi = 0x0, .g3_rx_selmufi = 0x3, .g1_rx_selmupf = 0x1, .g2_rx_selmupf = 0x1, .g3_rx_selmupf = 0x2, .g1_rx_selmupi = 0x0, .g2_rx_selmupi = 0x0, .g3_rx_selmupi = 0x2, .polarity_invert = COMPHY_POLARITY_NO_INVERT, .valid = 0x1 }, /* Comphy3 */ { 0 }, /* Comphy4 */ { 0 }, /* Comphy5 */ }, /* CP 1 */ { { 0 }, /* Comphy0 */ { .g1_amp = 0x8, .g2_amp = 0xa, .g3_amp = 0x1e, .g1_emph = 0x1, .g2_emph = 0x2, .g3_emph = 0xe, .g1_emph_en = 0x1, .g2_emph_en = 0x1, .g3_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g2_tx_amp_adj = 0x1, .g3_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x0, .g2_tx_emph_en = 0x0, .g3_tx_emph_en = 0x0, .g1_tx_emph = 0x1, .g2_tx_emph = 0x1, .g3_tx_emph = 0x1, .g3_dfe_res = 0x1, .g3_ffe_res_sel = 0x4, .g3_ffe_cap_sel = 0xf, .align90 = 0x61, .g1_rx_selmuff = 0x3, .g2_rx_selmuff = 0x3, .g3_rx_selmuff = 0x3, .g1_rx_selmufi = 0x0, .g2_rx_selmufi = 0x0, .g3_rx_selmufi = 0x3, .g1_rx_selmupf = 0x1, .g2_rx_selmupf = 0x1, .g3_rx_selmupf = 0x2, .g1_rx_selmupi = 0x0, .g2_rx_selmupi = 0x0, .g3_rx_selmupi = 0x2, .polarity_invert = COMPHY_POLARITY_NO_INVERT, .valid = 0x1 }, /* Comphy1 */ { 0 }, /* Comphy2 */ { .g1_amp = 0x8, .g2_amp = 0xa, .g3_amp = 0x1e, .g1_emph = 0x1, .g2_emph = 0x2, .g3_emph = 0xe, .g1_emph_en = 0x1, .g2_emph_en = 0x1, .g3_emph_en = 0x1, .g1_tx_amp_adj = 0x1, .g2_tx_amp_adj = 0x1, .g3_tx_amp_adj = 0x1, .g1_tx_emph_en = 0x0, .g2_tx_emph_en = 0x0, .g3_tx_emph_en = 0x0, .g1_tx_emph = 0x1, .g2_tx_emph = 0x1, .g3_tx_emph = 0x1, .g3_dfe_res = 0x1, .g3_ffe_res_sel = 0x4, .g3_ffe_cap_sel = 0xf, .align90 = 0x61, .g1_rx_selmuff = 0x3, .g2_rx_selmuff = 0x3, .g3_rx_selmuff = 0x3, .g1_rx_selmufi = 0x0, .g2_rx_selmufi = 0x0, .g3_rx_selmufi = 0x3, .g1_rx_selmupf = 0x1, .g2_rx_selmupf = 0x1, .g3_rx_selmupf = 0x2, .g1_rx_selmupi = 0x0, .g2_rx_selmupi = 0x0, .g3_rx_selmupi = 0x2, .polarity_invert = COMPHY_POLARITY_NO_INVERT, .valid = 0x1 }, /* Comphy3 */ { 0 }, /* Comphy4 */ { 0 }, /* Comphy5 */ }, }, }; static const struct usb_params usb_static_values_tab[AP_NUM][CP_NUM][MAX_LANE_NR] = { [0 ... AP_NUM-1][0 ... CP_NUM-1][0 ... MAX_LANE_NR-1] = { .polarity_invert = COMPHY_POLARITY_NO_INVERT }, }; #endif /* PHY_PORTING_LAYER_H */
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ #include <map> #include <string> #include "base/callback.h" #include "ui/gfx/insets.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" namespace base { class ListValue; } /** * Dispatcher for messages sent from the DevTools frontend running in an * isolated renderer (on chrome-devtools://) to the embedder in the browser. * * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder method. */ class DevToolsEmbedderMessageDispatcher { public: class Delegate { public: virtual ~Delegate() {} virtual void ActivateWindow() = 0; virtual void CloseWindow() = 0; virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0; virtual void SetContentsResizingStrategy( const gfx::Insets& insets, const gfx::Size& min_size) = 0; virtual void InspectElementCompleted() = 0; virtual void InspectedURLChanged(const std::string& url) = 0; virtual void MoveWindow(int x, int y) = 0; virtual void SetIsDocked(bool is_docked) = 0; virtual void OpenInNewTab(const std::string& url) = 0; virtual void SaveToFile(const std::string& url, const std::string& content, bool save_as) = 0; virtual void AppendToFile(const std::string& url, const std::string& content) = 0; virtual void RequestFileSystems() = 0; virtual void AddFileSystem() = 0; virtual void RemoveFileSystem(const std::string& file_system_path) = 0; virtual void UpgradeDraggedFileSystemPermissions( const std::string& file_system_url) = 0; virtual void IndexPath(int request_id, const std::string& file_system_path) = 0; virtual void StopIndexing(int request_id) = 0; virtual void SearchInPath(int request_id, const std::string& file_system_path, const std::string& query) = 0; virtual void SetWhitelistedShortcuts(const std::string& message) = 0; virtual void ZoomIn() = 0; virtual void ZoomOut() = 0; virtual void ResetZoom() = 0; virtual void OpenUrlOnRemoteDeviceAndInspect(const std::string& browser_id, const std::string& url) = 0; virtual void Subscribe(const std::string& event_type) = 0; virtual void Unsubscribe(const std::string& event_type) = 0; }; virtual ~DevToolsEmbedderMessageDispatcher() {} virtual bool Dispatch(const std::string& method, const base::ListValue* params, std::string* error) = 0; static DevToolsEmbedderMessageDispatcher* createForDevToolsFrontend( Delegate* delegate); }; #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <Foundation/Foundation.h> @interface NSCharacterSet (DVTFoundationClassAdditions) @end
// 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 InspectorHighlight_h #define InspectorHighlight_h #include "core/CoreExport.h" #include "core/InspectorTypeBuilder.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/Color.h" #include "platform/heap/Handle.h" namespace blink { class Color; class JSONValue; struct CORE_EXPORT InspectorHighlightConfig { USING_FAST_MALLOC(InspectorHighlightConfig); public: InspectorHighlightConfig(); Color content; Color contentOutline; Color padding; Color border; Color margin; Color eventTarget; Color shape; Color shapeMargin; bool showInfo; bool showRulers; bool showExtensionLines; bool displayAsMaterial; String selectorList; }; class CORE_EXPORT InspectorHighlight { STACK_ALLOCATED(); public: InspectorHighlight(Node*, const InspectorHighlightConfig&, bool appendElementInfo); InspectorHighlight(); ~InspectorHighlight(); static bool getBoxModel(Node*, RefPtr<TypeBuilder::DOM::BoxModel>&); static InspectorHighlightConfig defaultConfig(); static bool buildNodeQuads(Node*, FloatQuad* content, FloatQuad* padding, FloatQuad* border, FloatQuad* margin); void appendPath(PassRefPtr<JSONArrayBase> path, const Color& fillColor, const Color& outlineColor, const String& name = String()); void appendQuad(const FloatQuad&, const Color& fillColor, const Color& outlineColor = Color::transparent, const String& name = String()); void appendEventTargetQuads(Node* eventTargetNode, const InspectorHighlightConfig&); PassRefPtr<JSONObject> asJSONObject() const; private: void appendNodeHighlight(Node*, const InspectorHighlightConfig&); void appendPathsForShapeOutside(Node*, const InspectorHighlightConfig&); RefPtr<JSONObject> m_elementInfo; RefPtr<JSONArray> m_highlightPaths; bool m_showRulers; bool m_showExtensionLines; bool m_displayAsMaterial; }; } // namespace blink #endif // InspectorHighlight_h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CARD_UNMASK_DELEGATE_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_CARD_UNMASK_DELEGATE_H_ #include <string> #include "base/strings/string16.h" namespace autofill { class CardUnmaskDelegate { public: struct UnmaskResponse { UnmaskResponse(); ~UnmaskResponse(); // User input data. base::string16 cvc; // Two digit month. base::string16 exp_month; // Four digit year. base::string16 exp_year; // State of "copy to this device" checkbox. bool should_store_pan; }; // Called when the user has attempted a verification. Prompt is still // open at this point. virtual void OnUnmaskResponse(const UnmaskResponse& response) = 0; // Called when the unmask prompt is closed (e.g., cancelled). virtual void OnUnmaskPromptClosed() = 0; }; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CARD_UNMASK_DELEGATE_H_
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_UPLOADER_H_ #define CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_UPLOADER_H_ #include <memory> #include <string> #include "base/files/file_path.h" #include "base/memory/scoped_refptr.h" #include "base/task/sequenced_task_runner.h" #include "chrome/browser/media/webrtc/webrtc_event_log_history.h" #include "chrome/browser/media/webrtc/webrtc_event_log_manager_common.h" #include "services/network/public/mojom/url_loader_factory.mojom-forward.h" namespace network { class SimpleURLLoader; } // namespace network namespace webrtc_event_logging { // A sublcass of this interface will take ownership of a file, and either // upload it to a remote server (actual implementation), or pretend to do so // (in unit tests). Upon completion, success/failure will be reported by posting // an UploadResultCallback task to the task queue on which this object lives. class WebRtcEventLogUploader { public: using UploadResultCallback = base::OnceCallback<void(const base::FilePath& log_file, bool upload_successful)>; // Since we'll need more than one instance of the abstract // WebRtcEventLogUploader, we'll need an abstract factory for it. class Factory { public: virtual ~Factory() = default; // Creates uploaders. // This takes ownership of the file. The caller must not attempt to access // the file after invoking Create(). Even deleting the file due to // the user clearing cache, is to be done through the uploader's Cancel, // and not through direct access of the caller to the file. The file may // be touched again only after |this| is destroyed. virtual std::unique_ptr<WebRtcEventLogUploader> Create( const WebRtcLogFileInfo& log_file, UploadResultCallback callback) = 0; }; virtual ~WebRtcEventLogUploader() = default; // Getter for the details of the file this uploader is handling. // Can be called for ongoing, completed, failed or cancelled uploads. virtual const WebRtcLogFileInfo& GetWebRtcLogFileInfo() const = 0; // Cancels the upload, then deletes the log file and its history file. // (These files are deleted even if the upload has been completed by the time // Cancel is called.) virtual void Cancel() = 0; }; // Primary implementation of WebRtcEventLogUploader. Uploads log files to crash. // Deletes log files whether they were successfully uploaded or not. class WebRtcEventLogUploaderImpl : public WebRtcEventLogUploader { public: class Factory : public WebRtcEventLogUploader::Factory { public: explicit Factory(scoped_refptr<base::SequencedTaskRunner> task_runner); ~Factory() override; std::unique_ptr<WebRtcEventLogUploader> Create( const WebRtcLogFileInfo& log_file, UploadResultCallback callback) override; protected: friend class WebRtcEventLogUploaderImplTest; std::unique_ptr<WebRtcEventLogUploader> CreateWithCustomMaxSizeForTesting( const WebRtcLogFileInfo& log_file, UploadResultCallback callback, size_t max_remote_log_file_size_bytes); private: scoped_refptr<base::SequencedTaskRunner> task_runner_; }; WebRtcEventLogUploaderImpl( scoped_refptr<base::SequencedTaskRunner> task_runner, const WebRtcLogFileInfo& log_file, UploadResultCallback callback, size_t max_remote_log_file_size_bytes); ~WebRtcEventLogUploaderImpl() override; const WebRtcLogFileInfo& GetWebRtcLogFileInfo() const override; void Cancel() override; private: friend class WebRtcEventLogUploaderImplTest; // Primes the log file for uploading. Returns true if the file could be read, // in which case |upload_data| will be populated with the data to be uploaded // (both the log file's contents as well as history for Crash). // TODO(crbug.com/775415): Avoid reading the entire file into memory. bool PrepareUploadData(std::string* upload_data); // Initiates the file's upload. void StartUpload(const std::string& upload_data); // Callback invoked when the file upload has finished. // If the |url_loader_| instance it was bound to is deleted before // its invocation, the callback will not be called. void OnURLLoadComplete(std::unique_ptr<std::string> response_body); // Cleanup and posting of the result callback. void ReportResult(bool upload_successful, bool delete_history_file = false); // Remove the log file which is owned by |this|. void DeleteLogFile(); // Remove the log file which is owned by |this|. void DeleteHistoryFile(); // The URL used for uploading the logs. static const char kUploadURL[]; // The object lives on this IO-capable task runner. scoped_refptr<base::SequencedTaskRunner> task_runner_; // Housekeeping information about the uploaded file (path, time of last // modification, associated BrowserContext). const WebRtcLogFileInfo log_file_; // Callback posted back to signal success or failure. UploadResultCallback callback_; // Maximum allowed file size. In production code, this is a hard-coded, // but unit tests may set other values. const size_t max_log_file_size_bytes_; // Owns a history file which allows the state of the uploaded log to be // remembered after it has been uploaded and/or deleted. std::unique_ptr<WebRtcEventLogHistoryFileWriter> history_file_writer_; // This object is in charge of the actual upload. std::unique_ptr<network::SimpleURLLoader> url_loader_; // Allows releasing |this| while a task from |url_loader_| is still pending. base::WeakPtrFactory<WebRtcEventLogUploaderImpl> weak_ptr_factory_{this}; }; } // namespace webrtc_event_logging #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_UPLOADER_H_
// Copyright 2018 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_AUTOFILL_PAYMENTS_LOCAL_CARD_MIGRATION_DIALOG_H_ #define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_LOCAL_CARD_MIGRATION_DIALOG_H_ #include "base/callback.h" namespace autofill { // The cross-platform UI interface which displays all the local card migration // dialogs. class LocalCardMigrationDialog { public: LocalCardMigrationDialog(const LocalCardMigrationDialog&) = delete; LocalCardMigrationDialog& operator=(const LocalCardMigrationDialog&) = delete; virtual void ShowDialog() = 0; virtual void CloseDialog() = 0; protected: LocalCardMigrationDialog() = default; virtual ~LocalCardMigrationDialog() = default; }; } // namespace autofill #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_LOCAL_CARD_MIGRATION_DIALOG_H_
/* * AppArmor security module * * This file contains AppArmor auditing functions * * Copyright (C) 1998-2008 Novell/SUSE * Copyright 2009-2010 Canonical Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2 of the * License. */ #include <linux/audit.h> #include <linux/socket.h> #include "include/apparmor.h" #include "include/audit.h" #include "include/policy.h" const char *op_table[] = { "null", "sysctl", "capable", "unlink", "mkdir", "rmdir", "mknod", "truncate", "link", "symlink", "rename_src", "rename_dest", "chmod", "chown", "getattr", "open", "file_perm", "file_lock", "file_mmap", "file_mprotect", "create", "post_create", "bind", "connect", "listen", "accept", "sendmsg", "recvmsg", "getsockname", "getpeername", "getsockopt", "setsockopt", "socket_shutdown", "ptrace", "exec", "change_hat", "change_profile", "change_onexec", "setprocattr", "setrlimit", "profile_replace", "profile_load", "profile_remove" }; const char *audit_mode_names[] = { "normal", "quiet_denied", "quiet", "noquiet", "all" }; static char *aa_audit_type[] = { "AUDIT", "ALLOWED", "DENIED", "HINT", "STATUS", "ERROR", "KILLED" }; /* * Currently AppArmor auditing is fed straight into the audit framework. * * TODO: * netlink interface for complain mode * user auditing, - send user auditing to netlink interface * system control of whether user audit messages go to system log */ /** * audit_base - core AppArmor function. * @ab: audit buffer to fill (NOT NULL) * @ca: audit structure containing data to audit (NOT NULL) * * Record common AppArmor audit data from @sa */ static void audit_pre(struct audit_buffer *ab, void *ca) { struct common_audit_data *sa = ca; struct task_struct *tsk = sa->tsk ? sa->tsk : current; if (aa_g_audit_header) { audit_log_format(ab, "apparmor="); audit_log_string(ab, aa_audit_type[sa->aad.type]); } if (sa->aad.op) { audit_log_format(ab, " operation="); audit_log_string(ab, op_table[sa->aad.op]); } if (sa->aad.info) { audit_log_format(ab, " info="); audit_log_string(ab, sa->aad.info); if (sa->aad.error) audit_log_format(ab, " error=%d", sa->aad.error); } if (sa->aad.profile) { struct aa_profile *profile = sa->aad.profile; pid_t pid; rcu_read_lock(); pid = tsk->real_parent->pid; rcu_read_unlock(); audit_log_format(ab, " parent=%d", pid); if (profile->ns != root_ns) { audit_log_format(ab, " namespace="); audit_log_untrustedstring(ab, profile->ns->base.hname); } audit_log_format(ab, " profile="); audit_log_untrustedstring(ab, profile->base.hname); } if (sa->aad.name) { audit_log_format(ab, " name="); audit_log_untrustedstring(ab, sa->aad.name); } } /** * aa_audit_msg - Log a message to the audit subsystem * @sa: audit event structure (NOT NULL) * @cb: optional callback fn for type specific fields (MAYBE NULL) */ void aa_audit_msg(int type, struct common_audit_data *sa, void (*cb) (struct audit_buffer *, void *)) { sa->aad.type = type; sa->lsm_pre_audit = audit_pre; sa->lsm_post_audit = cb; common_lsm_audit(sa); } /** * aa_audit - Log a profile based audit event to the audit subsystem * @type: audit type for the message * @profile: profile to check against (NOT NULL) * @gfp: allocation flags to use * @sa: audit event (NOT NULL) * @cb: optional callback fn for type specific fields (MAYBE NULL) * * Handle default message switching based off of audit mode flags * * Returns: error on failure */ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, struct common_audit_data *sa, void (*cb) (struct audit_buffer *, void *)) { BUG_ON(!profile); if (type == AUDIT_APPARMOR_AUTO) { if (likely(!sa->aad.error)) { if (AUDIT_MODE(profile) != AUDIT_ALL) return 0; type = AUDIT_APPARMOR_AUDIT; } else if (COMPLAIN_MODE(profile)) type = AUDIT_APPARMOR_ALLOWED; else type = AUDIT_APPARMOR_DENIED; } if (AUDIT_MODE(profile) == AUDIT_QUIET || (type == AUDIT_APPARMOR_DENIED && AUDIT_MODE(profile) == AUDIT_QUIET)) return sa->aad.error; if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED) type = AUDIT_APPARMOR_KILL; if (!unconfined(profile)) sa->aad.profile = profile; aa_audit_msg(type, sa, cb); if (sa->aad.type == AUDIT_APPARMOR_KILL) (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current); if (sa->aad.type == AUDIT_APPARMOR_ALLOWED) return complain_error(sa->aad.error); return sa->aad.error; }
// // QMUIImagePreviewView.h // qmui // // Created by MoLice on 2016/11/30. // Copyright © 2016年 QMUI Team. All rights reserved. // #import <UIKit/UIKit.h> #import "QMUIZoomImageView.h" @class QMUIImagePreviewView; @class QMUICollectionViewPagingLayout; typedef NS_ENUM (NSUInteger, QMUIImagePreviewMediaType) { QMUIImagePreviewMediaTypeImage, QMUIImagePreviewMediaTypeLivePhoto, QMUIImagePreviewMediaTypeVideo, QMUIImagePreviewMediaTypeOthers }; @protocol QMUIImagePreviewViewDelegate <QMUIZoomImageViewDelegate> @required - (NSUInteger)numberOfImagesInImagePreviewView:(QMUIImagePreviewView *)imagePreviewView; - (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView renderZoomImageView:(QMUIZoomImageView *)zoomImageView atIndex:(NSUInteger)index; @optional // 返回要展示的媒体资源的类型(图片、live photo、视频),如果不实现此方法,则 QMUIImagePreviewView 将无法选择最合适的 cell 来复用从而略微增大系统开销 - (QMUIImagePreviewMediaType)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView assetTypeAtIndex:(NSUInteger)index; @optional /** * 当左右的滚动停止时会触发这个方法 * @param imagePreviewView 当前预览的 QMUIImagePreviewView * @param index 当前滚动到的图片所在的索引 */ - (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView didScrollToIndex:(NSUInteger)index; /** * 在滚动过程中,如果某一张图片的边缘(左/右)经过预览控件的中心点时,就会触发这个方法 * @param imagePreviewView 当前预览的 QMUIImagePreviewView * @param index 当前滚动到的图片所在的索引 */ - (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView willScrollHalfToIndex:(NSUInteger)index; @optional @end /** * 查看图片的控件,支持横向滚动、放大缩小、loading 及错误语展示,内部使用 UICollectionView 实现横向滚动及 cell 复用,因此与其他普通的 UICollectionView 一样,也可使用 reloadData、collectionViewLayout 等常用方法。 * * 使用方式: * * 1. 使用 initWithFrame: 或 init 方法初始化。 * 2. 设置 delegate。 * 3. 在 delegate 的 numberOfImagesInImagePreviewView: 方法里返回图片总数。 * 4. 在 delegate 的 imagePreviewView:renderZoomImageView:atIndex: 方法里为 zoomImageView.image 设置图片,如果需要,也可调用 [zoomImageView showLoading] 等方法来显示 loading。 * 5. 由于 QMUIImagePreviewViewDelegate 继承自 QMUIZoomImageViewDelegate,所以若需要响应单击、双击、长按事件,请实现 QMUIZoomImageViewDelegate 里的对应方法。 * 6. 若需要从指定的某一张图片开始查看,可使用 currentImageIndex 属性。 * * @see QMUIImagePreviewViewController */ @interface QMUIImagePreviewView : UIView<UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, QMUIZoomImageViewDelegate> @property(nonatomic, weak) id<QMUIImagePreviewViewDelegate> delegate; @property(nonatomic, strong, readonly) UICollectionView *collectionView; @property(nonatomic, strong, readonly) QMUICollectionViewPagingLayout *collectionViewLayout; /// 获取当前正在查看的图片 index,也可强制将图片滚动到指定的 index @property(nonatomic, assign) NSUInteger currentImageIndex; - (void)setCurrentImageIndex:(NSUInteger)currentImageIndex animated:(BOOL)animated; /// 每一页里的 loading 的颜色,默认为 UIColorWhite @property(nonatomic, strong) UIColor *loadingColor; @end @interface QMUIImagePreviewView (QMUIZoomImageView)<QMUIZoomImageViewDelegate> /** * 获取某个 QMUIZoomImageView 所对应的 index * @return zoomImageView 对应的 index,若当前的 zoomImageView 不可见,会返回 0 */ - (NSUInteger)indexForZoomImageView:(QMUIZoomImageView *)zoomImageView; /** * 获取某个 index 对应的 zoomImageView * @return 指定的 index 所在的 zoomImageView,若该 index 对应的图片当前不可见(不处于可视区域),则返回 nil */ - (QMUIZoomImageView *)zoomImageViewAtIndex:(NSUInteger)index; @end
/* * Copyright 2017 Google * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** @typedef FIRAuthDispatcherImplBlock @brief The type of block which can be set as the implementation for @c dispatchAfterDelay:queue:callback: . @param delay The delay in seconds after which the task will be scheduled to execute. @param queue The dispatch queue on which the task will be submitted. @param task The task (block) to be scheduled for future execution. */ typedef void(^FIRAuthDispatcherImplBlock)(NSTimeInterval delay, dispatch_queue_t queue, void (^task)(void)); /** @class FIRAuthDispatchAfter @brief A utility class used to facilitate scheduling tasks to be executed in the future. */ @interface FIRAuthDispatcher : NSObject /** @property dispatchAfterImplementation @brief Allows custom implementation of dispatchAfterDelay:queue:callback:. @remarks Set to nil to restore default implementation. */ @property(nonatomic, nullable, copy) FIRAuthDispatcherImplBlock dispatchAfterImplementation; /** @fn dispatchAfterDelay:queue:callback: @brief Schedules task in the future after a specified delay. @param delay The delay in seconds after which the task will be scheduled to execute. @param queue The dispatch queue on which the task will be submitted. @param task The task (block) to be scheduled for future execution. */ - (void)dispatchAfterDelay:(NSTimeInterval)delay queue:(dispatch_queue_t)queue task:(void (^)(void))task; /** @fn sharedInstance @brief Gets the shared instance of this class. @returns The shared instance of this clss */ + (instancetype)sharedInstance; @end NS_ASSUME_NONNULL_END
/*************************************************************************** qgsgpsdconnection.h - description ------------------- begin : October 4th, 2010 copyright : (C) 2010 by Jürgen E. Fischer, norBIT GmbH email : jef at norbit dot de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSGPSDCONNECTION_H #define QGSGPSDCONNECTION_H #include "qgsnmeaconnection.h" #include <QAbstractSocket> /** Evaluates NMEA sentences coming from gpsd*/ class CORE_EXPORT QgsGpsdConnection: public QgsNMEAConnection { Q_OBJECT public: QgsGpsdConnection( const QString& host, qint16 port, const QString& device ); ~QgsGpsdConnection(); private slots: void connected(); void error( QAbstractSocket::SocketError ); private: QString mDevice; }; #endif // QGSGPSDCONNECTION_H
/* * Buffering to output and input. * Copyright (C) 1998 Kunihiro Ishiguro * * This file is part of GNU Zebra. * * GNU Zebra 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. * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _ZEBRA_BUFFER_H #define _ZEBRA_BUFFER_H #include <sys/types.h> /* Create a new buffer. Memory will be allocated in chunks of the given size. If the argument is 0, the library will supply a reasonable default size suitable for buffering socket I/O. */ struct buffer *buffer_new(void *ctx, size_t); /* Free all data in the buffer. */ void buffer_reset(struct buffer *); /* This function first calls buffer_reset to release all buffered data. Then it frees the struct buffer itself. */ void buffer_free(struct buffer *); /* Add the given data to the end of the buffer. */ extern void buffer_put(struct buffer *, const void *, size_t); /* Add a single character to the end of the buffer. */ extern void buffer_putc(struct buffer *, u_char); /* Add a NUL-terminated string to the end of the buffer. */ extern void buffer_putstr(struct buffer *, const char *); /* Combine all accumulated (and unflushed) data inside the buffer into a single NUL-terminated string allocated using XMALLOC(MTYPE_TMP). Note that this function does not alter the state of the buffer, so the data is still inside waiting to be flushed. */ char *buffer_getstr(struct buffer *); /* Returns 1 if there is no pending data in the buffer. Otherwise returns 0. */ int buffer_empty(struct buffer *); typedef enum { /* An I/O error occurred. The buffer should be destroyed and the file descriptor should be closed. */ BUFFER_ERROR = -1, /* The data was written successfully, and the buffer is now empty (there is no pending data waiting to be flushed). */ BUFFER_EMPTY = 0, /* There is pending data in the buffer waiting to be flushed. Please try flushing the buffer when select indicates that the file descriptor is writeable. */ BUFFER_PENDING = 1 } buffer_status_t; /* Try to write this data to the file descriptor. Any data that cannot be written immediately is added to the buffer queue. */ extern buffer_status_t buffer_write(struct buffer *, int fd, const void *, size_t); /* This function attempts to flush some (but perhaps not all) of the queued data to the given file descriptor. */ extern buffer_status_t buffer_flush_available(struct buffer *, int fd); /* The following 2 functions (buffer_flush_all and buffer_flush_window) are for use in lib/vty.c only. They should not be used elsewhere. */ /* Call buffer_flush_available repeatedly until either all data has been flushed, or an I/O error has been encountered, or the operation would block. */ extern buffer_status_t buffer_flush_all(struct buffer *, int fd); /* Attempt to write enough data to the given fd to fill a window of the given width and height (and remove the data written from the buffer). If !no_more, then a message saying " --More-- " is appended. If erase is true, then first overwrite the previous " --More-- " message with spaces. Any write error (including EAGAIN or EINTR) will cause this function to return -1 (because the logic for handling the erase and more features is too complicated to retry the write later). */ extern buffer_status_t buffer_flush_window(struct buffer *, int fd, int width, int height, int erase, int no_more); #endif /* _ZEBRA_BUFFER_H */
/* -*- c++ -*- */ /* * Copyright 2014 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_FEC_ASYNC_DECODER_IMPL_H #define INCLUDED_FEC_ASYNC_DECODER_IMPL_H #include <gnuradio/fec/async_decoder.h> #include <gnuradio/blocks/pack_k_bits.h> namespace gr { namespace fec { class FEC_API async_decoder_impl : public async_decoder { private: generic_decoder::sptr d_decoder; size_t d_input_item_size; size_t d_output_item_size; pmt::pmt_t d_in_port; pmt::pmt_t d_out_port; blocks::kernel::pack_k_bits *d_pack; bool d_packed; bool d_rev_pack; int d_max_bits_in; float *d_tmp_f32; int8_t *d_tmp_u8; uint8_t *d_bits_out; void decode_packed(pmt::pmt_t msg); void decode_unpacked(pmt::pmt_t msg); public: async_decoder_impl(generic_decoder::sptr my_decoder, bool packed=false, bool rev_pack=true); ~async_decoder_impl(); int general_work(int noutput_items, gr_vector_int& ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } /* namespace fec */ } /* namespace gr */ #endif /* INCLUDED_FEC_ASYNC_DECODER_IMPL_H */
#ifndef GLW_VERTEXSHADER_H #define GLW_VERTEXSHADER_H #include "./shader.h" namespace glw { class VertexShaderArguments : public ShaderArguments { public: typedef ShaderArguments BaseType; typedef VertexShaderArguments ThisType; VertexShaderArguments(void) : BaseType() { ; } void clear(void) { BaseType::clear(); } }; class VertexShader : public Shader { friend class Context; public: typedef Shader BaseType; typedef VertexShader ThisType; virtual Type type(void) const { return VertexShaderType; } protected: VertexShader(Context * ctx) : BaseType(ctx) { ; } virtual GLenum shaderType(void) const { return GL_VERTEX_SHADER; } bool create(const VertexShaderArguments & args) { return BaseType::create(args); } }; namespace detail { template <> struct BaseOf <VertexShader> { typedef Shader Type; }; }; typedef detail::ObjectSharedPointerTraits <VertexShader> ::Type VertexShaderPtr; class SafeVertexShader : public SafeShader { friend class Context; friend class BoundVertexShader; public: typedef SafeShader BaseType; typedef SafeVertexShader ThisType; protected: SafeVertexShader(const VertexShaderPtr & vertexShader) : BaseType(vertexShader) { ; } const VertexShaderPtr & object(void) const { return static_cast<const VertexShaderPtr &>(BaseType::object()); } VertexShaderPtr & object(void) { return static_cast<VertexShaderPtr &>(BaseType::object()); } }; namespace detail { template <> struct BaseOf <SafeVertexShader> { typedef SafeShader Type; }; }; namespace detail { template <> struct ObjectBase <SafeVertexShader> { typedef VertexShader Type; }; }; namespace detail { template <> struct ObjectSafe <VertexShader > { typedef SafeVertexShader Type; }; }; typedef detail::ObjectSharedPointerTraits <SafeVertexShader> ::Type VertexShaderHandle; class VertexShaderBindingParams : public ShaderBindingParams { public: typedef ShaderBindingParams BaseType; typedef VertexShaderBindingParams ThisType; VertexShaderBindingParams(void) : BaseType(GL_VERTEX_SHADER, 0) { ; } }; class BoundVertexShader : public BoundShader { friend class Context; public: typedef BoundShader BaseType; typedef BoundVertexShader ThisType; const VertexShaderHandle & handle(void) const { return static_cast<const VertexShaderHandle &>(BaseType::handle()); } VertexShaderHandle & handle(void) { return static_cast<VertexShaderHandle &>(BaseType::handle()); } protected: BoundVertexShader(const VertexShaderHandle & handle, const ShaderBindingParams & params) : BaseType(handle, params) { ; } const VertexShaderPtr & object(void) const { return this->handle()->object(); } VertexShaderPtr & object(void) { return this->handle()->object(); } }; namespace detail { template <> struct ParamsOf <BoundVertexShader> { typedef VertexShaderBindingParams Type; }; }; namespace detail { template <> struct BaseOf <BoundVertexShader> { typedef BoundShader Type; }; }; namespace detail { template <> struct ObjectBase <BoundVertexShader> { typedef VertexShader Type; }; }; namespace detail { template <> struct ObjectBound <VertexShader > { typedef BoundVertexShader Type; }; }; typedef detail::ObjectSharedPointerTraits <BoundVertexShader> ::Type BoundVertexShaderHandle; }; #endif // GLW_VERTEXSHADER_H
/****************************************************************/ /* Do NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef RANDOMHITUSEROBJECT_H #define RANDOMHITUSEROBJECT_H #include "GeneralUserObject.h" #include "MooseRandom.h" //Forward Declarations class RandomHitUserObject; template<> InputParameters validParams<RandomHitUserObject>(); class RandomHitUserObject : public GeneralUserObject { public: RandomHitUserObject(const std::string & name, InputParameters parameters); virtual ~RandomHitUserObject() {} /** * Returns true if the element was hit. * @param elem The element to be checked. */ bool elementWasHit(const Elem * elem) const; /** * Returns the hits for this timestep. */ const std::vector<Point> & hits() const { return _hit_positions; } /** * Called before execute() is ever called so that data can be cleared. */ virtual void initialize(){} /** * Compute the hit positions for this timestep */ virtual void execute(); virtual void finalize(){} protected: unsigned int _num_hits; std::vector<Point> _hit_positions; std::vector<unsigned int> _closest_node; MooseRandom _random; }; #endif
/* * File: fbus_service_echo.c * Author: Li XianJing <xianjimli@hotmail.com> * Brief: echo service. * * Copyright (c) 2009 - 2010 Li XianJing <xianjimli@hotmail.com> * * Licensed under the Academic Free License version 2.1 * * 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 */ /* * History: * ================================================================ * 2010-07-25 Li XianJing <xianjimli@hotmail.com> created * */ #include "ftk_log.h" #include "fbus_echo_common.h" #include "fbus_service.h" static const char* fbus_service_echo_get_name(FBusService* thiz) { return FBUS_SERVICE_ECHO; } static Ret fbus_service_echo_on_client_connect(FBusService* thiz, int client_id) { ftk_logd("%s: client_id=%d\n", __func__, client_id); return RET_OK; } static Ret fbus_service_echo_on_client_disconnect(FBusService* thiz, int client_id) { ftk_logd("%s: client_id=%d\n", __func__, client_id); return RET_OK; } static Ret fbus_service_echo_handle_request(FBusService* thiz, int client_id, FBusParcel* req_resp) { int req_code = fbus_parcel_get_int(req_resp); switch(req_code) { case FBUS_ECHO_CHAR: { char data = fbus_parcel_get_char(req_resp); fbus_parcel_reset(req_resp); fbus_parcel_write_int(req_resp, RET_OK); fbus_parcel_write_char(req_resp, data); break; } case FBUS_ECHO_SHORT: { short data = fbus_parcel_get_short(req_resp); fbus_parcel_reset(req_resp); fbus_parcel_write_int(req_resp, RET_OK); fbus_parcel_write_short(req_resp, data); break; } case FBUS_ECHO_INT: { int data = fbus_parcel_get_int(req_resp); fbus_parcel_reset(req_resp); fbus_parcel_write_int(req_resp, RET_OK); fbus_parcel_write_int(req_resp, data); break; } case FBUS_ECHO_STRING: { const char* data = fbus_parcel_get_string(req_resp); fbus_parcel_reset(req_resp); fbus_parcel_write_int(req_resp, RET_OK); fbus_parcel_write_string(req_resp, data); break; } case FBUS_ECHO_BINARY: { int len = fbus_parcel_get_int(req_resp); const char* data = fbus_parcel_get_data(req_resp, len); fbus_parcel_reset(req_resp); fbus_parcel_write_int(req_resp, RET_OK); fbus_parcel_write_data(req_resp, data, len); break; } } //ftk_logd("%s: client_id=%d\n", __func__, client_id); return RET_OK; } static void fbus_service_echo_destroy(FBusService* thiz) { if(thiz != NULL) { FTK_FREE(thiz); } } static FBusService* fbus_service_echo_create(void) { FBusService* thiz = FTK_ZALLOC(sizeof(FBusService)); if(thiz != NULL) { thiz->get_name = fbus_service_echo_get_name; thiz->on_client_connect = fbus_service_echo_on_client_connect; thiz->on_client_disconnect = fbus_service_echo_on_client_disconnect; thiz->handle_request = fbus_service_echo_handle_request; thiz->destroy = fbus_service_echo_destroy; fbus_service_register(thiz); } return thiz; } int main(int argc, char* argv[]) { fbus_service_init(argc, argv); if(fbus_service_echo_create() != NULL) { fbus_service_run(); } else { ftk_loge("Create service echo failed.\n"); } return 0; }
// // RKObjectElementMapping.h // RestKit // // Created by Blake Watters on 4/30/11. // Copyright 2011 Two Toasters. All rights reserved. // #import <Foundation/Foundation.h> // Defines the rules for mapping a particular element @interface RKObjectAttributeMapping : NSObject <NSCopying> { NSString* _sourceKeyPath; NSString* _destinationKeyPath; } @property (nonatomic, retain) NSString* sourceKeyPath; @property (nonatomic, retain) NSString* destinationKeyPath; /** Defines a mapping from one keyPath to another within an object mapping */ + (RKObjectAttributeMapping*)mappingFromKeyPath:(NSString*)sourceKeyPath toKeyPath:(NSString*)destinationKeyPath; @end
/*------------------------------------------------------------------------- * * relfilenode.h * Physical access information for relations. * * * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/relfilenode.h * *------------------------------------------------------------------------- */ #ifndef RELFILENODE_H #define RELFILENODE_H #include "common/relpath.h" #include "storage/backendid.h" /* * RelFileNode must provide all that we need to know to physically access * a relation, with the exception of the backend ID, which can be provided * separately. Note, however, that a "physical" relation is comprised of * multiple files on the filesystem, as each fork is stored as a separate * file, and each fork can be divided into multiple segments. See md.c. * * spcNode identifies the tablespace of the relation. It corresponds to * pg_tablespace.oid. * * dbNode identifies the database of the relation. It is zero for * "shared" relations (those common to all databases of a cluster). * Nonzero dbNode values correspond to pg_database.oid. * * relNode identifies the specific relation. relNode corresponds to * pg_class.relfilenode (NOT pg_class.oid, because we need to be able * to assign new___ physical files to relations in some situations). * Notice that relNode is only unique within a database in a particular * tablespace. * * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is * zero. We support shared relations only in the "global" tablespace. * * Note: in pg_class we allow reltablespace == 0 to denote that the * relation is stored in its database's "default" tablespace (as * identified by pg_database.dattablespace). However this shorthand * is NOT allowed in RelFileNode structs --- the real tablespace ID * must be supplied when setting spcNode. * * Note: in pg_class, relfilenode can be zero to denote that the relation * is a "mapped" relation, whose current true filenode number is available * from relmapper.c. Again, this case is NOT allowed in RelFileNodes. * * Note: various places use RelFileNode in hashtable keys. Therefore, * there *must not* be any unused padding bytes in this struct. That * should be safe as long as all the fields are of type Oid. */ typedef struct RelFileNode { Oid spcNode; /* tablespace */ Oid dbNode; /* database */ Oid relNode; /* relation */ #ifdef __cplusplus RelFileNode() {} RelFileNode (volatile RelFileNode &other) : spcNode(other.spcNode), dbNode(other.dbNode), relNode(other.relNode) {} RelFileNode &operator=(volatile RelFileNode &rhs) { if (this == &rhs) return *this; this->spcNode = rhs.spcNode; this->dbNode = rhs.dbNode; this->relNode = rhs.relNode; return *this; } #endif } RelFileNode; /* * Augmenting a relfilenode with the backend ID provides all the information * we need to locate the physical storage. The backend ID is InvalidBackendId * for regular relations (those accessible to more than one backend), or the * owning backend's ID for backend-local relations. Backend-local relations * are always transient and removed in case of a database crash; they are * never WAL-logged or fsync'd. */ typedef struct RelFileNodeBackend { RelFileNode node; BackendId backend; } RelFileNodeBackend; #define RelFileNodeBackendIsTemp(rnode) \ ((rnode).backend != InvalidBackendId) /* * Note: RelFileNodeEquals and RelFileNodeBackendEquals compare relNode first * since that is most likely to be different in two unequal RelFileNodes. It * is probably redundant to compare spcNode if the other fields are found equal, * but do it anyway to be sure. Likewise for checking the backend ID in * RelFileNodeBackendEquals. */ #define RelFileNodeEquals(node1, node2) \ ((node1).relNode == (node2).relNode && \ (node1).dbNode == (node2).dbNode && \ (node1).spcNode == (node2).spcNode) #define RelFileNodeBackendEquals(node1, node2) \ ((node1).node.relNode == (node2).node.relNode && \ (node1).node.dbNode == (node2).node.dbNode && \ (node1).backend == (node2).backend && \ (node1).node.spcNode == (node2).node.spcNode) #endif /* RELFILENODE_H */
/* * librdkafka - Apache Kafka C library * * Copyright (c) 2016 Magnus Edenhill * 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. */ /** * System portability */ #include "rd.h" #include <stdlib.h> /** * qsort_r substitute * This nicely explains why we wont bother with the native implementation * on Win32 (qsort_s), OSX/FreeBSD (qsort_r with diff args): * http://forum.theorex.tech/t/different-declarations-of-qsort-r-on-mac-and-linux/93/2 */ static RD_TLS int (*rd_qsort_r_cmp) (const void *, const void *, void *); static RD_TLS void *rd_qsort_r_arg; static RD_UNUSED int rd_qsort_r_trampoline (const void *a, const void *b) { return rd_qsort_r_cmp(a, b, rd_qsort_r_arg); } void rd_qsort_r (void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg) { rd_qsort_r_cmp = compar; rd_qsort_r_arg = arg; qsort(base, nmemb, size, rd_qsort_r_trampoline); rd_qsort_r_cmp = NULL; rd_qsort_r_arg = NULL; }
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ #define CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" #include "cc/quads/draw_quad.h" namespace cc { class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { public: enum ColorSpace { REC_601, // SDTV standard with restricted "studio swing" color range. REC_709, // HDTV standard with restricted "studio swing" color range. JPEG, // Full color range [0, 255] JPEG color space. COLOR_SPACE_LAST = JPEG }; ~YUVVideoDrawQuad() override; YUVVideoDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, const gfx::Rect& visible_rect, // |*_tex_coord_rect| contains non-normalized coordinates. // TODO(reveman): Make the use of normalized vs non-normalized // coordinates consistent across all quad types: crbug.com/487370 const gfx::RectF& ya_tex_coord_rect, const gfx::RectF& uv_tex_coord_rect, const gfx::Size& ya_tex_size, const gfx::Size& uv_tex_size, unsigned y_plane_resource_id, unsigned u_plane_resource_id, unsigned v_plane_resource_id, unsigned a_plane_resource_id, ColorSpace color_space); void SetAll(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, const gfx::Rect& visible_rect, bool needs_blending, // |*_tex_coord_rect| contains non-normalized coordinates. // TODO(reveman): Make the use of normalized vs non-normalized // coordinates consistent across all quad types: crbug.com/487370 const gfx::RectF& ya_tex_coord_rect, const gfx::RectF& uv_tex_coord_rect, const gfx::Size& ya_tex_size, const gfx::Size& uv_tex_size, unsigned y_plane_resource_id, unsigned u_plane_resource_id, unsigned v_plane_resource_id, unsigned a_plane_resource_id, ColorSpace color_space); gfx::RectF ya_tex_coord_rect; gfx::RectF uv_tex_coord_rect; gfx::Size ya_tex_size; gfx::Size uv_tex_size; ColorSpace color_space; static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); ResourceId y_plane_resource_id() const { return resources.ids[kYPlaneResourceIdIndex]; } ResourceId u_plane_resource_id() const { return resources.ids[kUPlaneResourceIdIndex]; } ResourceId v_plane_resource_id() const { return resources.ids[kVPlaneResourceIdIndex]; } ResourceId a_plane_resource_id() const { return resources.ids[kAPlaneResourceIdIndex]; } private: static const size_t kYPlaneResourceIdIndex = 0; static const size_t kUPlaneResourceIdIndex = 1; static const size_t kVPlaneResourceIdIndex = 2; static const size_t kAPlaneResourceIdIndex = 3; void ExtendValue(base::trace_event::TracedValue* value) const override; }; } // namespace cc #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_
/***************************************************************************** Copyright (c) 2014, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************** * Contents: Native C interface to LAPACK utility function * Author: Intel Corporation * Created in February, 2010 *****************************************************************************/ #include "lapacke_utils.h" /* Converts input Hessenberg matrix from row-major(C) to column-major(Fortran) * layout or vice versa. */ void LAPACKE_dhs_trans( int matrix_layout, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout ) { if( in == NULL || out == NULL ) return; /* Convert subdiagonal first */ if( matrix_layout == LAPACK_COL_MAJOR ) { LAPACKE_dge_trans( LAPACK_COL_MAJOR, 1, n-1, &in[1], ldin+1, &out[ldout], ldout+1 ); } else if ( matrix_layout == LAPACK_ROW_MAJOR ) { LAPACKE_dge_trans( LAPACK_ROW_MAJOR, n-1, 1, &in[ldin], ldin+1, &out[1], ldout+1 ); } else { return; } /* Convert upper triangular. */ LAPACKE_dtr_trans( matrix_layout, 'u', 'n', n, in, ldin, out, ldout); }
#include "../src/ttemporaryfile.h"
// Copyright 2017 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 THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_MODULE_RECORD_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_MODULE_RECORD_H_ #include "third_party/blink/renderer/bindings/core/v8/module_request.h" #include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_location_type.h" #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/loader/fetch/url_loader/cached_metadata_handler.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h" namespace blink { class ExceptionState; class KURL; class ModuleScriptCreationParams; class ScriptFetchOptions; class ScriptState; class ScriptValue; // ModuleRecordProduceCacheData is a parameter object for // ModuleRecord::ProduceCache(). class CORE_EXPORT ModuleRecordProduceCacheData final : public GarbageCollected<ModuleRecordProduceCacheData> { public: ModuleRecordProduceCacheData(v8::Isolate*, SingleCachedMetadataHandler*, V8CodeCache::ProduceCacheOptions, v8::Local<v8::Module>); void Trace(Visitor*) const; SingleCachedMetadataHandler* CacheHandler() const { return cache_handler_; } V8CodeCache::ProduceCacheOptions GetProduceCacheOptions() const { return produce_cache_options_; } v8::Local<v8::UnboundModuleScript> UnboundScript(v8::Isolate* isolate) const { return unbound_script_.Get(isolate); } private: Member<SingleCachedMetadataHandler> cache_handler_; V8CodeCache::ProduceCacheOptions produce_cache_options_; TraceWrapperV8Reference<v8::UnboundModuleScript> unbound_script_; }; // TODO(rikaf): Add a class level comment class CORE_EXPORT ModuleRecord final { STATIC_ONLY(ModuleRecord); public: static v8::Local<v8::Module> Compile( ScriptState*, const ModuleScriptCreationParams& params, const ScriptFetchOptions&, const TextPosition&, ExceptionState&, mojom::blink::V8CacheOptions = mojom::blink::V8CacheOptions::kDefault, ModuleRecordProduceCacheData** out_produce_cache_data = nullptr); // Returns exception, if any. static ScriptValue Instantiate(ScriptState*, v8::Local<v8::Module> record, const KURL& source_url); static void ReportException(ScriptState*, v8::Local<v8::Value> exception); static Vector<ModuleRequest> ModuleRequests(ScriptState*, v8::Local<v8::Module> record); static v8::Local<v8::Value> V8Namespace(v8::Local<v8::Module> record); // ToBlinkImportAssertions deserializes v8::FixedArray encoded import // assertions to blink::ImportAssertion. When // |v8_import_assertions_has_positions| is set to true, it expects [key1, // value1, position1, key2, value2, position2, ...] encoding used in // v8::ModuleRequest::GetImportAssertions(). When it is set to false, it // expects [key1, value1, key2, value2, ...] encoding used in the // |HostImportModuleDynamically| callback. static Vector<ImportAssertion> ToBlinkImportAssertions( v8::Local<v8::Context> context, v8::Local<v8::Module> record, v8::Local<v8::FixedArray> v8_import_assertions, bool v8_import_assertions_has_positions); private: static v8::MaybeLocal<v8::Module> ResolveModuleCallback( v8::Local<v8::Context>, v8::Local<v8::String> specifier, v8::Local<v8::FixedArray> import_assertions, v8::Local<v8::Module> referrer); }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_MODULE_RECORD_H_
// Copyright 2020 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 IOS_CHROME_BROWSER_UI_MAIN_CONNECTION_INFORMATION_H_ #define IOS_CHROME_BROWSER_UI_MAIN_CONNECTION_INFORMATION_H_ #import <Foundation/Foundation.h> @class AppStartupParameters; // Contains information about the initialization of scenes. @protocol ConnectionInformation <NSObject> // Parameters received when the scene is connected. These parameters are stored // to be executed when the scene reach the required state. @property(nonatomic, strong) AppStartupParameters* startupParameters; // Flag that is set when the |startupParameters| start being handled. // Checking this flag prevents reentrant startup parameter handling. @property(nonatomic, assign) BOOL startupParametersAreBeingHandled; @end #endif // IOS_CHROME_BROWSER_UI_MAIN_CONNECTION_INFORMATION_H_
/* * Copyright (C) 2010, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_ #include "third_party/blink/renderer/modules/webaudio/biquad_processor.h" #include "third_party/blink/renderer/platform/audio/audio_dsp_kernel.h" #include "third_party/blink/renderer/platform/audio/biquad.h" namespace blink { class BiquadProcessor; // BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one // channel of a BiquadProcessor using a Biquad object. class BiquadDSPKernel final : public AudioDSPKernel { public: explicit BiquadDSPKernel(BiquadProcessor* processor) : AudioDSPKernel(processor), biquad_(processor->RenderQuantumFrames()), tail_time_(std::numeric_limits<double>::infinity()) {} // AudioDSPKernel void Process(const float* source, float* dest, uint32_t frames_to_process) override; void Reset() override { biquad_.Reset(); } // Get the magnitude and phase response of the given BiquadDSPKernel at the // given set of frequencies (in Hz). The phase response is in radians. This // must be called from the main thread. static void GetFrequencyResponse(BiquadDSPKernel& kernel, int n_frequencies, const float* frequency_hz, float* mag_response, float* phase_response); bool RequiresTailProcessing() const final; double TailTime() const override; double LatencyTime() const override; // Update the biquad cofficients with the given parameters void UpdateCoefficients(int number_of_frames, const float* frequency, const float* q, const float* gain, const float* detune); protected: Biquad biquad_; BiquadProcessor* GetBiquadProcessor() { return static_cast<BiquadProcessor*>(Processor()); } // To prevent audio glitches when parameters are changed, // dezippering is used to slowly change the parameters. void UpdateCoefficientsIfNecessary(int); private: // Compute the tail time using the BiquadFilter coefficients at // index |coef_index|. void UpdateTailTime(int coef_index); // Synchronize process() with getting and setting the filter coefficients. mutable Mutex process_lock_; // The current tail time for biquad filter. double tail_time_; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_
/*************************************************************************/ /* godotsharp_export.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* 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 GODOTSHARP_EXPORT_H #define GODOTSHARP_EXPORT_H #include "core/error/error_list.h" #include "core/string/ustring.h" #include "core/variant/dictionary.h" #include "../mono_gd/gd_mono_header.h" namespace GodotSharpExport { Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String> &p_search_dirs, Dictionary &r_dependencies); Error get_exported_assembly_dependencies(const Dictionary &p_initial_assemblies, const String &p_build_config, const String &p_custom_lib_dir, Dictionary &r_assembly_dependencies); } // namespace GodotSharpExport #endif // GODOTSHARP_EXPORT_H
/* Copyright (c) 2011 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. */ // // GTLUrlshortenerUrl.h // // ---------------------------------------------------------------------------- // NOTE: This file is generated from Google APIs Discovery Service. // Service: // URL Shortener API (urlshortener/v1) // Description: // Lets you create, inspect, and manage goo.gl short URLs // Documentation: // http://code.google.com/apis/urlshortener/v1/getting_started.html // Classes: // GTLUrlshortenerUrl (0 custom class methods, 6 custom properties) #if GTL_BUILT_AS_FRAMEWORK #import "GTL/GTLObject.h" #else #import "GTLObject.h" #endif @class GTLUrlshortenerAnalyticsSummary; // ---------------------------------------------------------------------------- // // GTLUrlshortenerUrl // @interface GTLUrlshortenerUrl : GTLObject // A summary of the click analytics for the short and long URL. Might not be // present if not requested or currently unavailable. @property (retain) GTLUrlshortenerAnalyticsSummary *analytics; // Time the short URL was created; ISO 8601 representation using the // yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. "2010-10-14T19:01:24.944+00:00". @property (copy) NSString *created; // Short URL, e.g. "http://goo.gl/l6MS". // identifier property maps to 'id' in JSON (to avoid Objective C's 'id'). @property (copy) NSString *identifier; // The fixed string "urlshortener#url". @property (copy) NSString *kind; // Long URL, e.g. "http://www.google.com/". Might not be present if the status // is "REMOVED". @property (copy) NSString *longUrl; // Status of the target URL. Possible values: "OK", "MALWARE", "PHISHING", or // "REMOVED". A URL might be marked "REMOVED" if it was flagged as spam, for // example. @property (copy) NSString *status; @end
/* * Copyright (c) 2010 Erin Catto http://www.box2d.org * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #ifndef B2_GROWABLE_STACK_H #define B2_GROWABLE_STACK_H #include "Box2D/Common/b2Settings.h" #include <string.h> /// This is a growable LIFO stack with an initial capacity of N. /// If the stack size exceeds the initial capacity, the heap is used /// to increase the size of the stack. template <typename T, int32 N> class b2GrowableStack { public: b2GrowableStack() { m_stack = m_array; m_count = 0; m_capacity = N; } ~b2GrowableStack() { if (m_stack != m_array) { b2Free(m_stack); m_stack = nullptr; } } void Push(const T& element) { if (m_count == m_capacity) { T* old = m_stack; m_capacity *= 2; m_stack = (T*)b2Alloc(m_capacity * sizeof(T)); memcpy(m_stack, old, m_count * sizeof(T)); if (old != m_array) { b2Free(old); } } m_stack[m_count] = element; ++m_count; } T Pop() { b2Assert(m_count > 0); --m_count; return m_stack[m_count]; } int32 GetCount() { return m_count; } private: T* m_stack; T m_array[N]; int32 m_count; int32 m_capacity; }; #endif
// [AsmJit] // Complete JIT Assembler for C++ Language. // // [License] // Zlib - See COPYING file in this package. // [Guard] #ifndef _ASMJIT_CORE_MEMORYMARKER_H #define _ASMJIT_CORE_MEMORYMARKER_H // [Dependencies - AsmJit] #include "../core/build.h" #include "../core/defs.h" // [Api-Begin] #include "../core/apibegin.h" namespace AsmJit { //! @addtogroup AsmJit_MemoryManagement //! @{ // ============================================================================ // [AsmJit::MemoryMarker] // ============================================================================ //! @brief Virtual memory marker interface. struct MemoryMarker { ASMJIT_NO_COPY(MemoryMarker) // -------------------------------------------------------------------------- // [Construction / Destruction] // -------------------------------------------------------------------------- ASMJIT_API MemoryMarker(); ASMJIT_API virtual ~MemoryMarker(); // -------------------------------------------------------------------------- // [Interface] // -------------------------------------------------------------------------- virtual void mark(const void* ptr, size_t size) = 0; }; //! @} } // AsmJit namespace // [Api-End] #include "../core/apiend.h" // [Guard] #endif // _ASMJIT_CORE_MEMORYMARKER_H
/*---------------------------------------------------------------*/ /*--- begin libvex_trc_values.h ---*/ /*---------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2004-2012 OpenWorks LLP info@open-works.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. The GNU General Public License is contained in the file COPYING. Neither the names of the U.S. Department of Energy nor the University of California nor the names of its contributors may be used to endorse or promote products derived from this software without prior written permission. */ #ifndef __LIBVEX_TRC_VALUES_H #define __LIBVEX_TRC_VALUES_H /* Magic values that the guest state pointer might be set to when returning to the dispatcher. The only other legitimate value is to point to the start of the thread's VEX guest state. This file may get included in assembly code, so do not put C-specific constructs in it. These values should be 61 or above so as not to conflict with Valgrind's VG_TRC_ values, which are 60 or below. These values *must* be odd (have bit 0 set) because the dispatchers (coregrind/m_dispatch/dispatch-*-*.S) use this fact to distinguish a TRC value from the unchanged baseblock pointer -- which has 0 as its lowest bit. */ #define VEX_TRC_JMP_TINVAL 61 /* invalidate translations before continuing */ #define VEX_TRC_JMP_NOREDIR 81 /* jump to undirected guest addr */ #define VEX_TRC_JMP_SIGTRAP 85 /* deliver trap (SIGTRAP) before continuing */ #define VEX_TRC_JMP_SIGSEGV 87 /* deliver segv (SIGSEGV) before continuing */ #define VEX_TRC_JMP_SIGBUS 93 /* deliver SIGBUS before continuing */ #define VEX_TRC_JMP_EMWARN 63 /* deliver emulation warning before continuing */ #define VEX_TRC_JMP_EMFAIL 83 /* emulation fatal error; abort system */ #define VEX_TRC_JMP_CLIENTREQ 65 /* do a client req before continuing */ #define VEX_TRC_JMP_YIELD 67 /* yield to thread sched before continuing */ #define VEX_TRC_JMP_NODECODE 69 /* next instruction is not decodable */ #define VEX_TRC_JMP_MAPFAIL 71 /* address translation failed */ #define VEX_TRC_JMP_SYS_SYSCALL 73 /* do syscall before continuing */ #define VEX_TRC_JMP_SYS_INT32 75 /* do syscall before continuing */ #define VEX_TRC_JMP_SYS_INT128 77 /* do syscall before continuing */ #define VEX_TRC_JMP_SYS_INT129 89 /* do syscall before continuing */ #define VEX_TRC_JMP_SYS_INT130 91 /* do syscall before continuing */ #define VEX_TRC_JMP_SYS_SYSENTER 79 /* do syscall before continuing */ #define VEX_TRC_JMP_BORING 95 /* return to sched, but just keep going; no special action */ #endif /* ndef __LIBVEX_TRC_VALUES_H */ /*---------------------------------------------------------------*/ /*--- libvex_trc_values.h ---*/ /*---------------------------------------------------------------*/
// -*- C++ -*- /** * \file InsetMathXYArrow.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author André Pönitz * * Full author contact details are available in file CREDITS. */ #ifndef MATH_XYARROWINSET_H #define MATH_ARROWINSET_H #include "InsetMathNest.h" #include "MetricsInfo.h" namespace lyx { // for the \ar stuff in \xymatrix class InsetMathXYMatrix; class InsetMathXYArrow : public InsetMathNest { public: /// InsetMathXYArrow(); /// virtual Inset * clone() const; /// bool metrics(MetricsInfo & mi) const; /// void draw(PainterInfo & pi, int x, int y) const; /// InsetMathXYArrow * asXYArrowInset() { return this; } /// void write(WriteStream & os) const; /// void normalize(NormalStream &) const; /// InsetMathXYMatrix const * targetMatrix() const; /// MathData const & targetCell() const; /// MathData const & sourceCell() const; /// InsetCode lyxCode() const { return MATH_XYARROW_CODE; } /// void mathmlize(MathStream &) const; /// void htmlize(HtmlStream &) const; /// bool up_; /// mutable MetricsInfo mi_; /// mutable Font font_; /// mutable InsetMathXYMatrix const * target_; }; } // namespace lyx #endif
//===-- llvm/CodeGen/DwarfExpression.h - Dwarf Compile Unit ---*- C++ -*--===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file contains support for writing dwarf compile unit. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXPRESSION_H #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXPRESSION_H #include "llvm/IR/DebugInfo.h" #include "llvm/Support/DataTypes.h" namespace llvm { class AsmPrinter; class ByteStreamer; class TargetRegisterInfo; class DwarfUnit; class DIELoc; /// Base class containing the logic for constructing DWARF expressions /// independently of whether they are emitted into a DIE or into a .debug_loc /// entry. class DwarfExpression { protected: // Various convenience accessors that extract things out of AsmPrinter. const TargetRegisterInfo &TRI; unsigned DwarfVersion; public: DwarfExpression(const TargetRegisterInfo &TRI, unsigned DwarfVersion) : TRI(TRI), DwarfVersion(DwarfVersion) {} virtual ~DwarfExpression() {} /// Output a dwarf operand and an optional assembler comment. virtual void EmitOp(uint8_t Op, const char *Comment = nullptr) = 0; /// Emit a raw signed value. virtual void EmitSigned(int64_t Value) = 0; /// Emit a raw unsigned value. virtual void EmitUnsigned(uint64_t Value) = 0; /// Return whether the given machine register is the frame register in the /// current function. virtual bool isFrameRegister(unsigned MachineReg) = 0; /// Emit a dwarf register operation. void AddReg(int DwarfReg, const char *Comment = nullptr); /// Emit an (double-)indirect dwarf register operation. void AddRegIndirect(int DwarfReg, int Offset, bool Deref = false); /// Emit a dwarf register operation for describing /// - a small value occupying only part of a register or /// - a register representing only part of a value. void AddOpPiece(unsigned SizeInBits, unsigned OffsetInBits = 0); /// Emit a shift-right dwarf expression. void AddShr(unsigned ShiftBy); /// Emit an indirect dwarf register operation for the given machine register. /// \return false if no DWARF register exists for MachineReg. bool AddMachineRegIndirect(unsigned MachineReg, int Offset = 0); /// \brief Emit a partial DWARF register operation. /// \param MachineReg the register /// \param PieceSizeInBits size and /// \param PieceOffsetInBits offset of the piece in bits, if this is one /// piece of an aggregate value. /// /// If size and offset is zero an operation for the entire /// register is emitted: Some targets do not provide a DWARF /// register number for every register. If this is the case, this /// function will attempt to emit a DWARF register by emitting a /// piece of a super-register or by piecing together multiple /// subregisters that alias the register. /// /// \return false if no DWARF register exists for MachineReg. bool AddMachineRegPiece(unsigned MachineReg, unsigned PieceSizeInBits = 0, unsigned PieceOffsetInBits = 0); /// Emit a signed constant. void AddSignedConstant(int Value); /// Emit an unsigned constant. void AddUnsignedConstant(unsigned Value); /// \brief Emit an entire expression on top of a machine register location. /// /// \param PieceOffsetInBits If this is one piece out of a fragmented /// location, this is the offset of the piece inside the entire variable. /// \return false if no DWARF register exists for MachineReg. bool AddMachineRegExpression(const DIExpression *Expr, unsigned MachineReg, unsigned PieceOffsetInBits = 0); /// Emit a the operations remaining the DIExpressionIterator I. /// \param PieceOffsetInBits If this is one piece out of a fragmented /// location, this is the offset of the piece inside the entire variable. void AddExpression(DIExpression::expr_op_iterator I, DIExpression::expr_op_iterator E, unsigned PieceOffsetInBits = 0); }; /// DwarfExpression implementation for .debug_loc entries. class DebugLocDwarfExpression : public DwarfExpression { ByteStreamer &BS; public: DebugLocDwarfExpression(const TargetRegisterInfo &TRI, unsigned DwarfVersion, ByteStreamer &BS) : DwarfExpression(TRI, DwarfVersion), BS(BS) {} void EmitOp(uint8_t Op, const char *Comment = nullptr) override; void EmitSigned(int64_t Value) override; void EmitUnsigned(uint64_t Value) override; bool isFrameRegister(unsigned MachineReg) override; }; /// DwarfExpression implementation for singular DW_AT_location. class DIEDwarfExpression : public DwarfExpression { const AsmPrinter &AP; DwarfUnit &DU; DIELoc &DIE; public: DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE); void EmitOp(uint8_t Op, const char *Comment = nullptr) override; void EmitSigned(int64_t Value) override; void EmitUnsigned(uint64_t Value) override; bool isFrameRegister(unsigned MachineReg) override; }; } #endif
/* * This file is part of the coreboot project. * * original idea yhlu 6.2005 (assembler code) * * Copyright (C) 2010 Rudolf Marek <r.marek@assembler.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * be warned, this file will be used other cores and core 0 / node 0 */ #include <cpu/x86/cache.h> static inline __attribute__((always_inline)) void disable_cache_as_ram(void) { msr_t msr; /* disable cache */ write_cr0(read_cr0() | CR0_CacheDisable); msr.lo = 0; msr.hi = 0; wrmsr(MTRRfix4K_C8000_MSR, msr); #if CONFIG_DCACHE_RAM_SIZE > 0x8000 wrmsr(MTRRfix4K_C0000_MSR, msr); #endif /* disable fixed mtrr from now on, it will be enabled by ramstage again*/ msr = rdmsr(SYSCFG_MSR); msr.lo &= ~(SYSCFG_MSR_MtrrFixDramEn | SYSCFG_MSR_MtrrFixDramModEn); wrmsr(SYSCFG_MSR, msr); /* Set the default memory type and disable fixed and enable variable MTRRs */ msr.hi = 0; msr.lo = (1 << 11); wrmsr(MTRRdefType_MSR, msr); enable_cache(); } static void disable_cache_as_ram_bsp(void) { disable_cache_as_ram(); }
/* -*- c++ -*- */ /* * Copyright 2020 Free Software Foundation, Inc. * * This file is part of GNU Radio * * SPDX-License-Identifier: GPL-3.0-or-later * */ #ifndef INCLUDED_DIGITAL_EQUALIZER_H #define INCLUDED_DIGITAL_EQUALIZER_H // Equalizer States: // IDLE -- just FIR filtering using the current taps // TRAINING -- calculating adaptive taps based on training sequence // DD -- calculating adaptive taps based on expected constellation points (in algorithm // object) enum class equalizer_state_t { IDLE, TRAINING, DD }; // TODO: Put a common class for LinearEq/DFE here #endif
/* -*- c++ -*- */ /* * Copyright 2008 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GR_WVPS_FF_H #define INCLUDED_GR_WVPS_FF_H #include <gr_sync_decimator.h> class gr_wvps_ff; typedef boost::shared_ptr<gr_wvps_ff> gr_wvps_ff_sptr; gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); /*! * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients * \ingroup wavelet_blk */ class gr_wvps_ff : public gr_sync_block { friend gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); int d_ilen; int d_olen; protected: gr_wvps_ff(int ilen); public: int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; #endif /* INCLUDED_GR_WVPS_FF_H */
/* -*- c++ -*- */ /* * Copyright 2005,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_H #define INCLUDED_BLOCKS_COMPLEX_TO_MAG_H #include <blocks/api.h> #include <gr_sync_block.h> namespace gr { namespace blocks { /*! * \brief complex in, magnitude out (float) * \ingroup converter_blk * \param vlen vector len (default 1) */ class BLOCKS_API complex_to_mag : virtual public gr_sync_block { public: // gr::blocks::complex_to_mag_ff::sptr typedef boost::shared_ptr<complex_to_mag> sptr; static sptr make(size_t vlen=1); }; } /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_H */
/*********************************************************************** created: Fri Apr 22 2011 author: Paul D Turner <paul@cegui.org.uk> *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team * * 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 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 _BoolArray2D_h_ #define _BoolArray2D_h_ // Start of CEGUI namespace section namespace CEGUI { // Wrapper for a simple bool array. class BoolArray2D { public: BoolArray2D(); BoolArray2D(int width, int height); ~BoolArray2D(); // return the width of the array int width() const; // return the height of the array. int height() const; // get the element at the specified location. bool elementAtLocation(int x, int y) const; // set the element at the specified location. void setElementAtLocation(int x, int y, bool value); // clear the array to the specified value. void clear(bool value = false); // set the array size. content is cleared to 0. void resetSize(int width, int height); private: int d_width; int d_height; bool* d_content; }; } // End of CEGUI namespace section #endif // end of guard _BoolArray2D_h_
// // XMChatBar.h // XMChatBarExample // // Created by shscce on 15/8/17. // Copyright (c) 2015年 xmfraker. All rights reserved. // #define kMaxHeight 80.0f #define kMinHeight 45.0f #define kFunctionViewHeight 210.0f #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> /** * functionView 类型 */ typedef NS_ENUM(NSUInteger, XMFunctionViewShowType){ XMFunctionViewShowNothing /**< 不显示functionView */, XMFunctionViewShowFace /**< 显示表情View */, XMFunctionViewShowVoice /**< 显示录音view */, XMFunctionViewShowMore /**< 显示更多view */, XMFunctionViewShowKeyboard /**< 显示键盘 */, }; @protocol XMChatBarDelegate; /** * 仿微信信息输入框,支持语音,文字,表情,选择照片,拍照 */ @interface XMChatBar : UIView @property (weak, nonatomic) id<XMChatBarDelegate> delegate; /** * 结束输入状态 */ - (void)endInputing; @end /** * XMChatBar代理事件,发送图片,地理位置,文字,语音信息等 */ @protocol XMChatBarDelegate <NSObject> @optional /** * chatBarFrame改变回调 * * @param chatBar */ - (void)chatBarFrameDidChange:(XMChatBar *)chatBar; /** * 发送图片信息,支持多张图片 * * @param chatBar * @param pictures 需要发送的图片信息 */ - (void)chatBar:(XMChatBar *)chatBar sendPictures:(NSArray *)pictures; /** * 发送地理位置信息 * * @param chatBar * @param locationCoordinate 需要发送的地址位置经纬度 * @param locationText 需要发送的地址位置对应信息 */ - (void)chatBar:(XMChatBar *)chatBar sendLocation:(CLLocationCoordinate2D)locationCoordinate locationText:(NSString *)locationText; /** * 发送普通的文字信息,可能带有表情 * * @param chatBar * @param message 需要发送的文字信息 */ - (void)chatBar:(XMChatBar *)chatBar sendMessage:(NSString *)message; /** * 发送语音信息 * * @param chatBar * @param voiceData 语音data数据 * @param seconds 语音时长 */ - (void)chatBar:(XMChatBar *)chatBar sendVoice:(NSData *)voiceData seconds:(NSTimeInterval)seconds; @end
/* * Copyright (C) 2002 Remi Guyomarch <rguyom@pobox.com> * * This file is part of mpv. * * mpv 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. * * mpv 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 mpv. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include "common/msg.h" #include "options/m_option.h" #include "vf.h" #include "vf_lavfi.h" typedef struct FilterParam { int msizeX, msizeY; double amount; } FilterParam; struct vf_priv_s { FilterParam lumaParam; FilterParam chromaParam; struct vf_lw_opts *lw_opts; }; static int vf_open(vf_instance_t *vf) { struct vf_priv_s *p = vf->priv; p->lumaParam.msizeX |= 1; p->lumaParam.msizeY |= 1; p->chromaParam.msizeX |= 1; p->chromaParam.msizeY |= 1; if (vf_lw_set_graph(vf, p->lw_opts, "unsharp", "%d:%d:%f:%d:%d:%f", p->lumaParam.msizeX, p->lumaParam.msizeY, p->lumaParam.amount, p->chromaParam.msizeX, p->chromaParam.msizeY, p->chromaParam.amount) >= 0) { return 1; } MP_FATAL(vf, "This version of libavfilter has no 'unsharp' filter.\n"); return 0; } // same as MIN_/MAX_MATRIX_SIZE #define MIN_SIZE 3 #define MAX_SIZE 63 #define OPT_BASE_STRUCT struct vf_priv_s const vf_info_t vf_info_unsharp = { .description = "unsharp mask & gaussian blur", .name = "unsharp", .open = vf_open, .priv_size = sizeof(struct vf_priv_s), .priv_defaults = &(const struct vf_priv_s){ .lumaParam = {5, 5, 1.0}, .chromaParam = {5, 5, 0.0}, }, .options = (const struct m_option[]){ OPT_INTRANGE("lx", lumaParam.msizeX, 0, MIN_SIZE, MAX_SIZE), OPT_INTRANGE("ly", lumaParam.msizeY, 0, MIN_SIZE, MAX_SIZE), OPT_DOUBLE("la", lumaParam.amount, CONF_RANGE, .min = -2, .max = 6), OPT_INTRANGE("cx", chromaParam.msizeX, 0, MIN_SIZE, MAX_SIZE), OPT_INTRANGE("cy", chromaParam.msizeY, 0, MIN_SIZE, MAX_SIZE), OPT_DOUBLE("ca", chromaParam.amount, CONF_RANGE, .min = -2, .max = 6), OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), {0} }, };
//========================================================================== // // flash_lock_block.c // // Flash programming // //========================================================================== // ####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): gthomas, hmt // Contributors: gthomas // Date: 2001-02-14 // Purpose: // Description: // //####DESCRIPTIONEND#### // //========================================================================== #include "strata.h" int flash_lock_block(volatile flash_t *block) __attribute__ ((section (".2ram.flash_lock_block"))); int flash_lock_block(volatile flash_t *block) { volatile flash_t *ROM; flash_t stat; int timeout = 5000000; // Get base address and map addresses to virtual addresses ROM = FLASH_P2V(CYGNUM_FLASH_BASE_MASK & (unsigned int)block); block = FLASH_P2V(block); // Clear any error conditions ROM[0] = FLASH_Clear_Status; // Set lock bit block[0] = FLASH_Set_Lock; block[0] = FLASH_Set_Lock_Confirm; // Confirmation while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) { if (--timeout == 0) break; } // Restore ROM to "normal" mode ROM[0] = FLASH_Reset; return stat; }
/* * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MANGOS_CONFUSEDMOVEMENTGENERATOR_H #define MANGOS_CONFUSEDMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "Timer.h" template<class T> class MANGOS_DLL_SPEC ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > { public: explicit ConfusedMovementGenerator(): i_x(0.0f), i_y(0.0f), i_z(0.0f) {} void Initialize(T &); void Finalize(T &); void Interrupt(T &); void Reset(T &); bool Update(T &, const uint32 &); MovementGeneratorType GetMovementGeneratorType() const { return CONFUSED_MOTION_TYPE; } private: float i_x, i_y, i_z; }; #endif
/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */ #include "test_sve_acle.h" /* ** qincb_n_1_u64_tied: ** uqincb x0 ** ret */ TEST_UNIFORM_S (qincb_n_1_u64_tied, uint64_t, x0 = svqincb_n_u64 (x0, 1), x0 = svqincb (x0, 1)) /* ** qincb_n_1_u64_untied: ** mov x0, x1 ** uqincb x0 ** ret */ TEST_UNIFORM_S (qincb_n_1_u64_untied, uint64_t, x0 = svqincb_n_u64 (x1, 1), x0 = svqincb (x1, 1)) /* ** qincb_n_2_u64: ** uqincb x0, all, mul #2 ** ret */ TEST_UNIFORM_S (qincb_n_2_u64, uint64_t, x0 = svqincb_n_u64 (x0, 2), x0 = svqincb (x0, 2)) /* ** qincb_n_7_u64: ** uqincb x0, all, mul #7 ** ret */ TEST_UNIFORM_S (qincb_n_7_u64, uint64_t, x0 = svqincb_n_u64 (x0, 7), x0 = svqincb (x0, 7)) /* ** qincb_n_15_u64: ** uqincb x0, all, mul #15 ** ret */ TEST_UNIFORM_S (qincb_n_15_u64, uint64_t, x0 = svqincb_n_u64 (x0, 15), x0 = svqincb (x0, 15)) /* ** qincb_n_16_u64: ** uqincb x0, all, mul #16 ** ret */ TEST_UNIFORM_S (qincb_n_16_u64, uint64_t, x0 = svqincb_n_u64 (x0, 16), x0 = svqincb (x0, 16))
/* * Copyright (C) 2010-2012 OregonCore <http://www.oregoncore.com/> * 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 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _OREGONSOAP_H #define _OREGONSOAP_H #include "Common.h" #include "World.h" #include "AccountMgr.h" #include "Log.h" #include "soapH.h" #include "soapStub.h" #include <ace/Semaphore.h> #include <ace/Task.h> class OCSoapRunnable: public ACE_Based::Runnable { public: OCSoapRunnable() { } void run(); void setListenArguments(std::string host, uint16 port) { m_host = host; m_port = port; } private: std::string m_host; uint16 m_port; }; class SOAPWorkingThread : public ACE_Task<ACE_MT_SYNCH> { public: SOAPWorkingThread () { } virtual int svc (void) { while (1) { ACE_Message_Block *mb = 0; if (this->getq (mb) == -1) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) Shutting down\n"))); break; } // Process the message. process_message (mb); } return 0; } private: void process_message (ACE_Message_Block *mb); }; class SOAPCommand { public: SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands") { } ~SOAPCommand() { } void appendToPrintBuffer(const char* msg) { m_printBuffer += msg; } ACE_Semaphore pendingCommands; void setCommandSuccess(bool val) { m_success = val; } bool hasCommandSucceeded() { return m_success; } static void print(void* callbackArg, const char* msg) { ((SOAPCommand*)callbackArg)->appendToPrintBuffer(msg); } static void commandFinished(void* callbackArg, bool success); bool m_success; std::string m_printBuffer; }; #endif
// Virtio block boot support. // // Copyright (C) 2010 Red Hat Inc. // // Authors: // Gleb Natapov <gnatapov@redhat.com> // // This file may be distributed under the terms of the GNU LGPLv3 license. #include "util.h" // dprintf #include "pci.h" // foreachpci #include "config.h" // CONFIG_* #include "biosvar.h" // GET_GLOBAL #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK #include "pci_regs.h" // PCI_VENDOR_ID #include "boot.h" // boot_add_hd #include "virtio-pci.h" #include "virtio-ring.h" #include "virtio-blk.h" #include "disk.h" struct virtiodrive_s { struct drive_s drive; struct vring_virtqueue *vq; u16 ioaddr; }; static int virtio_blk_op(struct disk_op_s *op, int write) { struct virtiodrive_s *vdrive_g = container_of(op->drive_g, struct virtiodrive_s, drive); struct vring_virtqueue *vq = GET_GLOBAL(vdrive_g->vq); struct virtio_blk_outhdr hdr = { .type = write ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN, .ioprio = 0, .sector = op->lba, }; u8 status = VIRTIO_BLK_S_UNSUPP; struct vring_list sg[] = { { .addr = MAKE_FLATPTR(GET_SEG(SS), &hdr), .length = sizeof(hdr), }, { .addr = op->buf_fl, .length = GET_GLOBAL(vdrive_g->drive.blksize) * op->count, }, { .addr = MAKE_FLATPTR(GET_SEG(SS), &status), .length = sizeof(status), }, }; /* Add to virtqueue and kick host */ if (write) vring_add_buf(vq, sg, 2, 1, 0, 0); else vring_add_buf(vq, sg, 1, 2, 0, 0); vring_kick(GET_GLOBAL(vdrive_g->ioaddr), vq, 1); /* Wait for reply */ while (!vring_more_used(vq)) usleep(5); /* Reclaim virtqueue element */ vring_get_buf(vq, NULL); /* Clear interrupt status register. Avoid leaving interrupts stuck if * VRING_AVAIL_F_NO_INTERRUPT was ignored and interrupts were raised. */ vp_get_isr(GET_GLOBAL(vdrive_g->ioaddr)); return status == VIRTIO_BLK_S_OK ? DISK_RET_SUCCESS : DISK_RET_EBADTRACK; } int process_virtio_blk_op(struct disk_op_s *op) { if (! CONFIG_VIRTIO_BLK) return 0; switch (op->command) { case CMD_READ: return virtio_blk_op(op, 0); case CMD_WRITE: return virtio_blk_op(op, 1); case CMD_FORMAT: case CMD_RESET: case CMD_ISREADY: case CMD_VERIFY: case CMD_SEEK: return DISK_RET_SUCCESS; default: op->count = 0; return DISK_RET_EPARAM; } } static void init_virtio_blk(struct pci_device *pci) { u16 bdf = pci->bdf; dprintf(1, "found virtio-blk at %x:%x\n", pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)); struct virtiodrive_s *vdrive_g = malloc_fseg(sizeof(*vdrive_g)); if (!vdrive_g) { warn_noalloc(); return; } memset(vdrive_g, 0, sizeof(*vdrive_g)); vdrive_g->drive.type = DTYPE_VIRTIO_BLK; vdrive_g->drive.cntl_id = bdf; u16 ioaddr = vp_init_simple(bdf); vdrive_g->ioaddr = ioaddr; if (vp_find_vq(ioaddr, 0, &vdrive_g->vq) < 0 ) { dprintf(1, "fail to find vq for virtio-blk %x:%x\n", pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)); goto fail; } struct virtio_blk_config cfg; vp_get(ioaddr, 0, &cfg, sizeof(cfg)); u32 f = vp_get_features(ioaddr); vdrive_g->drive.blksize = (f & (1 << VIRTIO_BLK_F_BLK_SIZE)) ? cfg.blk_size : DISK_SECTOR_SIZE; vdrive_g->drive.sectors = cfg.capacity; dprintf(3, "virtio-blk %x:%x blksize=%d sectors=%u\n", pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), vdrive_g->drive.blksize, (u32)vdrive_g->drive.sectors); if (vdrive_g->drive.blksize != DISK_SECTOR_SIZE) { dprintf(1, "virtio-blk %x:%x block size %d is unsupported\n", pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), vdrive_g->drive.blksize); goto fail; } vdrive_g->drive.pchs.cylinders = cfg.cylinders; vdrive_g->drive.pchs.heads = cfg.heads; vdrive_g->drive.pchs.spt = cfg.sectors; char *desc = znprintf(MAXDESCSIZE, "Virtio disk PCI:%x:%x", pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)); boot_add_hd(&vdrive_g->drive, desc, bootprio_find_pci_device(pci)); vp_set_status(ioaddr, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK); return; fail: free(vdrive_g->vq); free(vdrive_g); } void virtio_blk_setup(void) { ASSERT32FLAT(); if (! CONFIG_VIRTIO_BLK) return; dprintf(3, "init virtio-blk\n"); struct pci_device *pci; foreachpci(pci) { if (pci->vendor != PCI_VENDOR_ID_REDHAT_QUMRANET || pci->device != PCI_DEVICE_ID_VIRTIO_BLK) continue; init_virtio_blk(pci); } }
/* * Check decoding of prctl PR_GET_TSC/PR_SET_TSC operations. * * Copyright (c) 2016 JingPiao Chen <chenjingpiao@foxmail.com> * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> * Copyright (c) 2016-2017 The strace developers. * 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. */ #include "tests.h" #include <asm/unistd.h> #include <linux/prctl.h> #if defined __NR_prctl && defined PR_GET_TSC && defined PR_SET_TSC # include <stdio.h> # include <unistd.h> int main(void) { static const kernel_ulong_t bogus_tsc = (kernel_ulong_t) 0xdeadc0defacebeefULL; TAIL_ALLOC_OBJECT_CONST_PTR(int, tsc); long rc; rc = syscall(__NR_prctl, PR_SET_TSC, 0); printf("prctl(PR_SET_TSC, 0 /* PR_TSC_??? */) = %s\n", sprintrc(rc)); rc = syscall(__NR_prctl, PR_SET_TSC, bogus_tsc); printf("prctl(PR_SET_TSC, %#x /* PR_TSC_??? */) = %s\n", (unsigned int) bogus_tsc, sprintrc(rc)); rc = syscall(__NR_prctl, PR_SET_TSC, PR_TSC_SIGSEGV); printf("prctl(PR_SET_TSC, PR_TSC_SIGSEGV) = %s\n", sprintrc(rc)); rc = syscall(__NR_prctl, PR_GET_TSC, NULL); printf("prctl(PR_GET_TSC, NULL) = %s\n", sprintrc(rc)); rc = syscall(__NR_prctl, PR_GET_TSC, tsc + 1); printf("prctl(PR_GET_TSC, %p) = %s\n", tsc + 1, sprintrc(rc)); rc = syscall(__NR_prctl, PR_GET_TSC, tsc); if (rc) printf("prctl(PR_GET_TSC, %p) = %s\n", tsc, sprintrc(rc)); else printf("prctl(PR_GET_TSC, [PR_TSC_SIGSEGV]) = %s\n", sprintrc(rc)); puts("+++ exited with 0 +++"); return 0; } #else SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_TSC && PR_SET_TSC") #endif
/* * Check decoding of init_module syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> * Copyright (c) 2016-2017 The strace developers. * 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. */ #include "tests.h" #include <asm/unistd.h> #if defined(__NR_init_module) # include <stdio.h> # include <unistd.h> # include "init_delete_module.h" int main(void) { static const kernel_ulong_t bogus_addr = (kernel_ulong_t) 0xfffffeedfffffaceULL; static const kernel_ulong_t bogus_len = (kernel_ulong_t) 0xfffffca7ffffc0deULL; long rc; char *bogus_param1 = tail_alloc(PARAM1_LEN); char *bogus_param2 = tail_alloc(PARAM2_LEN); const char *errstr; fill_memory_ex(bogus_param1, PARAM1_LEN, PARAM1_BASE, PARAM1_LEN); fill_memory_ex(bogus_param2, PARAM2_LEN, PARAM2_BASE, PARAM2_LEN); rc = syscall(__NR_init_module, NULL, F8ILL_KULONG_MASK, NULL); printf("init_module(NULL, %llu, NULL) = %s\n", (unsigned long long) F8ILL_KULONG_MASK, sprintrc(rc)); rc = syscall(__NR_init_module, bogus_addr, 0, bogus_param1); errstr = sprintrc(rc); printf("init_module(%#llx, 0, \"", (unsigned long long) bogus_addr); print_str(PARAM1_BASE, MAX_STRLEN, false); printf("\"...) = %s\n", errstr); bogus_param1[PARAM1_LEN - 1] = '\0'; rc = syscall(__NR_init_module, bogus_addr, 0, bogus_param1); errstr = sprintrc(rc); printf("init_module(%#llx, 0, \"", (unsigned long long) bogus_addr); print_str(PARAM1_BASE, MAX_STRLEN, false); printf("\") = %s\n", errstr); rc = syscall(__NR_init_module, bogus_addr, bogus_len, bogus_param2 + PARAM2_LEN); printf("init_module(%#llx, %llu, %p) = %s\n", (unsigned long long) bogus_addr, (unsigned long long) bogus_len, bogus_param2 + PARAM2_LEN, sprintrc(rc)); rc = syscall(__NR_init_module, NULL, bogus_len, bogus_param2); printf("init_module(NULL, %llu, %p) = %s\n", (unsigned long long) bogus_len, bogus_param2, sprintrc(rc)); bogus_param2[PARAM2_LEN - 1] = '\0'; rc = syscall(__NR_init_module, NULL, bogus_len, bogus_param2); errstr = sprintrc(rc); printf("init_module(NULL, %llu, \"", (unsigned long long) bogus_len); print_str(PARAM2_BASE, PARAM2_LEN - 1, true); printf("\") = %s\n", errstr); puts("+++ exited with 0 +++"); return 0; } #else SKIP_MAIN_UNDEFINED("__NR_init_module"); #endif
/* File : example.h */ #include <cstdio> #include <iostream> #include <vector> #include <string> #include <cmath> class Employee { private: std::string name; public: Employee(const char* n): name(n) {} virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } virtual ~Employee() { printf("~Employee() @ %p\n", this); } }; class Manager: public Employee { public: Manager(const char* n): Employee(n) {} virtual std::string getPosition() const { return "Manager"; } }; class EmployeeList { std::vector<Employee*> list; public: EmployeeList() { list.push_back(new Employee("Bob")); list.push_back(new Employee("Jane")); list.push_back(new Manager("Ted")); } void addEmployee(Employee *p) { list.push_back(p); std::cout << "New employee added. Current employees are:" << std::endl; std::vector<Employee*>::iterator i; for (i=list.begin(); i!=list.end(); i++) { std::cout << " " << (*i)->getTitle() << std::endl; } } const Employee *get_item(int i) { return list[i]; } ~EmployeeList() { std::vector<Employee*>::iterator i; std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; for (i=list.begin(); i!=list.end(); i++) { delete *i; } std::cout << "~EmployeeList empty." << std::endl; } };
/* GStreamer Adaptive Multi-Rate Narrow-Band (AMR-NB) plugin * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net> * * 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. */ #ifndef __GST_AMRNBENC_H__ #define __GST_AMRNBENC_H__ #include <gst/gst.h> #include <gst/audio/gstaudioencoder.h> #ifdef HAVE_OPENCORE_AMRNB_0_1_3_OR_LATER #include <opencore-amrnb/interf_enc.h> #else #include <interf_enc.h> #endif G_BEGIN_DECLS #define GST_TYPE_AMRNBENC \ (gst_amrnbenc_get_type()) #define GST_AMRNBENC(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AMRNBENC, GstAmrnbEnc)) #define GST_AMRNBENC_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AMRNBENC, GstAmrnbEncClass)) #define GST_IS_AMRNBENC(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AMRNBENC)) #define GST_IS_AMRNBENC_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AMRNBENC)) typedef struct _GstAmrnbEnc GstAmrnbEnc; typedef struct _GstAmrnbEncClass GstAmrnbEncClass; struct _GstAmrnbEnc { GstAudioEncoder element; /* library handle */ void *handle; /* input settings */ gint channels, rate; gint duration; /* property */ enum Mode bandmode; }; struct _GstAmrnbEncClass { GstAudioEncoderClass parent_class; }; GType gst_amrnbenc_get_type (void); G_END_DECLS #endif /* __GST_AMRNBENC_H__ */
// @(#)root/tmva/rmva $Id$ // Author: Omar Zapata,Lorenzo Moneta, Sergei Gleyzer 2015 /********************************************************************************** * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * * Package: TMVA * * Class : RMethodBase * * * * Description: * * Virtual base class for all MVA method based on ROOTR * * * **********************************************************************************/ #ifndef ROOT_TMVA_RMethodBase #define ROOT_TMVA_RMethodBase ////////////////////////////////////////////////////////////////////////// // // // RMethodBase // // // // Virtual base class for all TMVA method based on ROOTR // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TMVA_MethodBase #include "TMVA/MethodBase.h" #endif #ifndef ROOT_R_TRInterface #include<TRInterface.h> #endif class TGraph; class TTree; class TDirectory; class TSpline; class TH1F; class TH1D; namespace TMVA { class Ranking; class PDF; class TSpline1; class MethodCuts; class MethodBoost; class DataSetInfo; class RMethodBase : public MethodBase { friend class Factory; protected: ROOT::R::TRInterface &r; public: // default constructur RMethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption = "", TDirectory *theBaseDir = 0, ROOT::R::TRInterface &_r = ROOT::R::TRInterface::Instance()); // constructor used for Testing + Application of the MVA, only (no training), // using given weight file RMethodBase(Types::EMVA methodType, DataSetInfo &dsi, const TString &weightFile, TDirectory *theBaseDir = 0, ROOT::R::TRInterface &_r = ROOT::R::TRInterface::Instance()); // default destructur virtual ~RMethodBase() {}; virtual void Train() = 0; // options treatment virtual void Init() = 0; virtual void DeclareOptions() = 0; virtual void ProcessOptions() = 0; // create ranking virtual const Ranking *CreateRanking() = 0; virtual Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0) = 0; Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) = 0; protected: // the actual "weights" virtual void AddWeightsXMLTo(void *parent) const = 0; virtual void ReadWeightsFromXML(void *wghtnode) = 0; virtual void ReadWeightsFromStream(std::istream &) = 0; // backward compatibility virtual void ReadWeightsFromStream(TFile &) {} // backward compatibility void LoadData();//Read data from Data() Aand DataInfo() to Dataframes and Vectors protected: ROOT::R::TRDataFrame fDfTrain;//signal and backgrd ROOT::R::TRDataFrame fDfTest; TVectorD fWeightTrain; TVectorD fWeightTest; std::vector<std::string> fFactorTrain; std::vector<std::string> fFactorTest; ROOT::R::TRDataFrame fDfSpectators; private: ClassDef(RMethodBase, 0) // Virtual base class for all TMVA method }; } // namespace TMVA #endif
/* 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_TYPES_H_ #define TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_TYPES_H_ #include "mlir/IR/Attributes.h" // from @llvm-project #include "mlir/IR/BuiltinTypes.h" // from @llvm-project #include "mlir/IR/Diagnostics.h" // from @llvm-project #include "mlir/IR/Location.h" // from @llvm-project #include "mlir/IR/MLIRContext.h" // from @llvm-project #include "mlir/IR/Operation.h" // from @llvm-project #include "mlir/IR/TypeSupport.h" // from @llvm-project #include "mlir/IR/Types.h" // from @llvm-project namespace mlir { namespace TFR { class TFRType : public Type { public: using Type::Type; static bool classof(Type type); }; namespace detail { struct TFRTypeStorage final : public TypeStorage, public llvm::TrailingObjects<TFRTypeStorage, StringAttr> { using KeyTy = ArrayRef<StringAttr>; explicit TFRTypeStorage(unsigned num_attrs) : num_attrs(num_attrs) {} static TFRTypeStorage* construct(TypeStorageAllocator& allocator, KeyTy key) { // Allocate a new storage instance. auto byteSize = TFRTypeStorage::totalSizeToAlloc<StringAttr>(key.size()); auto rawMem = allocator.allocate(byteSize, alignof(TFRTypeStorage)); auto result = ::new (rawMem) TFRTypeStorage(key.size()); // Copy in the string attributes into the trailing storage. std::uninitialized_copy(key.begin(), key.end(), result->getTrailingObjects<StringAttr>()); return result; } bool operator==(const KeyTy& attrs) const { return attrs == GetAttrs(); } KeyTy GetAttrs() const { return {getTrailingObjects<StringAttr>(), num_attrs}; } unsigned num_attrs; }; template <typename Derived> class TFRTypeImpl : public Type::TypeBase<Derived, TFRType, TFRTypeStorage> { public: using Base = Type::TypeBase<Derived, TFRType, TFRTypeStorage>; using TFRBase = TFRTypeImpl<Derived>; using Base::Base; static Derived get(ArrayRef<StringAttr> attrs, MLIRContext* context) { return Base::get(context, attrs); } static Derived getChecked(ArrayRef<StringAttr> attrs, Location loc) { return Base::getChecked(loc, loc.getContext(), attrs); } static Derived getChecked(function_ref<InFlightDiagnostic()> emitError, MLIRContext* context, ArrayRef<StringAttr> attrs) { return Base::getChecked(emitError, context, attrs); } static Derived get(MLIRContext* context) { return get({}, context); } // TODO(fengliuai): fix the implementation static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError, ArrayRef<StringAttr> attrs) { return success(); } ArrayRef<StringAttr> getAttrKeys() { return Base::getImpl()->GetAttrs(); } }; } // namespace detail class TFRTensorType : public detail::TFRTypeImpl<TFRTensorType> { public: using TFRBase::TFRBase; static std::string getTypeName() { return "TFRTensorType"; } }; class TFRTensorListType : public detail::TFRTypeImpl<TFRTensorListType> { public: using TFRBase::TFRBase; static std::string getTypeName() { return "TFRTensorListType"; } }; class TFRAttrType : public Type::TypeBase<TFRAttrType, TFRType, TypeStorage> { public: using Base::Base; static std::string getTypeName() { return "TFRAttrType"; } }; } // namespace TFR } // namespace mlir #endif // TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_TYPES_H_
/* { dg-options "-mabi=n32 -mlong64 addressing=absolute -O2" } */ /* { dg-error "is incompatible with" "" { target *-*-* } 0 } */ #include "abi-main.h"
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <UIAutomation/UIAElement.h> @interface UIAActivityIndicator : UIAElement { } @end
// Copyright 2018 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #include_next <sys/user.h> #include <features.h> // glibc for 64-bit ARM uses different names for these structs prior to 2.20. #if defined(__aarch64__) && defined(__GLIBC__) #if !__GLIBC_PREREQ(2, 20) using user_regs_struct = user_pt_regs; using user_fpsimd_struct = user_fpsimd_state; #endif #endif #endif // CRASHPAD_COMPAT_LINUX_SYS_USER_H_
#ifndef IMAGESTACK_LIGHTFIELD_H #define IMAGESTACK_LIGHTFIELD_H namespace ImageStack { // a LightField is an image which assumes u and v are rolled up into x // and y, like an image of the lenslets in a plenoptic camera class LightField { public: LightField(Image im, int uSize_, int vSize_) : image(im), uSize(uSize_), vSize(vSize_) { assert(im.width % uSize == 0, "width is not a multiple of lenslet width\n"); assert(im.height % vSize == 0, "height is not a multiple of lenslet height\n"); xSize = im.width / uSize; ySize = im.height / vSize; } float &operator()(int x, int y, int u, int v, int c) { return image(x*uSize + u, y*vSize + v, c); } float &operator()(int x, int y, int u, int v, int t, int c) { return image(x*uSize + u, y*vSize + v, t, c); } // quadrilinear 4D sampling (quadriLanczos3 too expensive, 6^4=1296) // x,y,u,v follow the same coordinate conventions as // operator() void sample4D(float x, float y, float u, float v, int t, float *result) { int ix[2], iy[2], iu[2], iv[2]; // integer indices float wx[2], wy[2], wu[2], wv[2]; // weighting factors if ((x < 0 || y < 0 || x > xSize-1 || y > ySize-1) || (u < 0 || v < 0 || u > uSize-1 || v > vSize-1)) { // out of bounds, so return zero for (int c = 0; c < image.channels; c++) { result[c] = 0; } return; } ix[0] = (int)(floor(x)); iy[0] = (int)(floor(y)); iu[0] = (int)(floor(u)); iv[0] = (int)(floor(v)); // clamp against bounds ix[0] = clamp(ix[0],0,xSize-1); iy[0] = clamp(iy[0],0,ySize-1); iu[0] = clamp(iu[0],0,uSize-1); iv[0] = clamp(iv[0],0,vSize-1); ix[1] = ix[0]+1; iy[1] = iy[0]+1; iu[1] = iu[0]+1; iv[1] = iv[0]+1; // clamp against bounds ix[1] = min(ix[1],xSize-1); iy[1] = min(iy[1],ySize-1); iu[1] = min(iu[1],uSize-1); iv[1] = min(iv[1],vSize-1); // calculate the weights for quadrilinear wx[1] = x-ix[0]; wy[1] = y-iy[0]; wu[1] = u-iu[0]; wv[1] = v-iv[0]; wx[0] = 1-wx[1]; wy[0] = 1-wy[1]; wu[0] = 1-wu[1]; wv[0] = 1-wv[1]; // do the computation for (int c = 0; c < image.channels; c++) { result[c] = 0; } for (int i = 0; i < 2; i++) { // go through iu for (int j = 0; j < 2; j++) { // go through ix for (int k = 0; k < 2; k++) { // go through iv for (int l = 0; l < 2; l++) { // go through iy for (int c = 0; c < image.channels; c++) { result[c] += ((*this)(ix[j],iy[l],iu[i],iv[k],t,c) * wx[j]*wy[l]*wu[i]*wv[k]); } } } } } } void sample4D(float x, float y, float u, float v, float *result) { sample4D(x,y,u,v,0,result); } Image image; int uSize, vSize; int xSize, ySize; }; class LFFocalStack : public Operation { public: void help(); bool test(); void parse(vector<string> args); static Image apply(LightField im, float minAlpha, float maxAlpha, float deltaAlpha); }; class LFPoint : public Operation { public: void help(); bool test(); void parse(vector<string> args); static void apply(LightField lf, float x, float y, float z); }; } #endif
/* GWEN Copyright (c) 2010 Facepunch Studios See license in Gwen.h */ #pragma once #ifndef GWEN_CONTROLS_RESIZABLECONTROL_H #define GWEN_CONTROLS_RESIZABLECONTROL_H #include "Gwen/Controls/Base.h" #include "Gwen/Controls/Label.h" #include "Gwen/Controls/Button.h" #include "Gwen/Controls/Dragger.h" #include "Gwen/Controls/Label.h" #include "Gwen/Controls/Resizer.h" #include "Gwen/Gwen.h" #include "Gwen/Skin.h" namespace Gwen { namespace Controls { class GWEN_EXPORT ResizableControl : public Base { public: GWEN_CONTROL( ResizableControl, Base ); virtual void SetClampMovement( bool shouldClamp ) { m_bClampMovement = shouldClamp; } virtual bool GetClampMovement() { return m_bClampMovement; } virtual void SetMinimumSize( const Gwen::Point & minSize ) { m_MinimumSize = minSize; } virtual Gwen::Point GetMinimumSize() { return m_MinimumSize; } virtual void DisableResizing(); virtual bool SetBounds( int x, int y, int w, int h ); virtual void OnResized() {}; Event::Caller onResize; virtual ControlsInternal::Resizer* GetResizer( int iResizer ) { return m_Resizer[iResizer]; } protected: void OnResizedInternal( Controls::Base* pControl ); Gwen::Point m_MinimumSize; bool m_bClampMovement; bool m_bResizable; ControlsInternal::Resizer* m_Resizer[10]; }; } } #endif
/** * (C) 2007-2010 Taobao Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Version: $Id$ * * Authors: * rongxuan <rongxuan.lc@taobao.com> * - some work details if you want */ #ifndef OCEANBASE_UPDATESERVER_OB_UPS_ROLE_MGR_H_ #define OCEANBASE_UPDATESERVER_OB_UPS_ROLE_MGR_H_ #include <stdint.h> #include "common/ob_atomic.h" #include <tbsys.h> #include "ob_ups_utils.h" using namespace oceanbase::common; namespace oceanbase { namespace updateserver { /// @brief ObUpsRoleMgr管理了进程的角色和状态 class ObUpsRoleMgr { public: enum Role { MASTER = 1, SLAVE = 2, STANDALONE = 3, // used for test }; enum State { REPLAYING_LOG = 1, ACTIVE = 2, FATAL = 3, STOP = 4, }; public: ObUpsRoleMgr() { role_ = SLAVE; state_ = REPLAYING_LOG; } virtual ~ObUpsRoleMgr() { } /// @brief 获取Role inline Role get_role() const {return role_;} /// @brief 修改Role inline void set_role(const Role role) { atomic_exchange(reinterpret_cast<uint32_t*>(&role_), role); TBSYS_LOG(INFO, "set_role=%s state=%s", get_role_str(), get_state_str()); } /// 获取State inline State get_state() const {return state_;} /// 修改State inline void set_state(const State state) { atomic_exchange(reinterpret_cast<uint32_t*>(&state_), state); if (FATAL == state) { set_client_mgr_err(OB_IN_FATAL_STATE); TBSYS_LOG(ERROR, "stop client_mgr, enter FATAL state."); } // else if (STOP == state) // { // set_client_mgr_err(OB_IN_STOP_STATE); // TBSYS_LOG(WARN, "stop client_mgr, enter STOP state."); // } TBSYS_LOG(INFO, "set_state=%s role=%s", get_state_str(), get_role_str()); } inline const char* get_role_str() const { switch (role_) { case MASTER: return "MASTER"; case SLAVE: return "SLAVE"; case STANDALONE: return "STANDALONE"; default: return "UNKNOWN"; } } inline const char* get_state_str() const { switch (state_) { case FATAL: return "FATAL"; case REPLAYING_LOG: return "REPLAYING_LOG"; case ACTIVE: return "ACTIVE"; case STOP: return "STOP"; default: return "UNKNOWN"; } } inline bool is_master() const { return (role_ == ObUpsRoleMgr::MASTER) && (state_ == ObUpsRoleMgr::ACTIVE); } int serialize(char* buf, const int64_t len, int64_t& pos) const { int err = OB_SUCCESS; if (OB_SUCCESS != (err = serialization::encode_i64(buf, len, pos, role_)) || OB_SUCCESS != (err = serialization::encode_i64(buf, len, pos, state_))) { TBSYS_LOG(ERROR, "ups_role_mgr.serialize(buf=%p[%ld], pos=%ld)=>%d", buf, len, pos, err); } return err; } int deserialize(const char* buf, const int64_t len, int64_t& pos) { int err = OB_SUCCESS; if (OB_SUCCESS != (err = serialization::decode_i64(buf, len, pos, (int64_t*)&role_)) || OB_SUCCESS != (err = serialization::decode_i64(buf, len, pos, (int64_t*)&state_))) { TBSYS_LOG(ERROR, "ups_role_mgr.deserialize(buf=%p[%ld], pos=%ld)=>%d", buf, len, pos, err); } return err; } private: Role role_; State state_; }; } // end namespace updateserver } // end namespace oceanbase #endif // OCEANBASE_UPDATESERVER_OB_UPS_ROLE_MGR_H_
/***************************************************************************** * fixed32.c : fixed-point software volume ***************************************************************************** * Copyright (C) 2011 Rémi Denis-Courmont * * 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, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_aout.h> #include <vlc_aout_mixer.h> static int Activate (vlc_object_t *); vlc_module_begin () set_category (CAT_AUDIO) set_subcategory (SUBCAT_AUDIO_MISC) set_description (N_("Fixed-point audio mixer")) set_capability ("audio mixer", 9) set_callbacks (Activate, NULL) vlc_module_end () static void FilterFI32 (audio_mixer_t *, block_t *, float); static void FilterS16N (audio_mixer_t *, block_t *, float); static int Activate (vlc_object_t *obj) { audio_mixer_t *mixer = (audio_mixer_t *)obj; switch (mixer->format) { case VLC_CODEC_FI32: mixer->mix = FilterFI32; break; case VLC_CODEC_S16N: mixer->mix = FilterS16N; break; default: return -1; } return 0; } static void FilterFI32 (audio_mixer_t *mixer, block_t *block, float volume) { const int64_t mult = volume * 0x1.p32; if (mult == 0x1.p32) return; int32_t *p = (int32_t *)block->p_buffer; for (size_t n = block->i_buffer / sizeof (*p); n > 0; n--) { *p = (*p * mult) >> INT64_C(32); p++; } (void) mixer; } static void FilterS16N (audio_mixer_t *mixer, block_t *block, float volume) { int32_t mult = volume * 0x1.p16; if (mult == 0x10000) return; int16_t *p = (int16_t *)block->p_buffer; if (mult < 0x10000) { for (size_t n = block->i_buffer / sizeof (*p); n > 0; n--) { *p = (*p * mult) >> 16; p++; } } else { mult >>= 4; for (size_t n = block->i_buffer / sizeof (*p); n > 0; n--) { int32_t v = (*p * mult) >> 12; if (abs (v) > 0x7fff) v = 0x8000; *(p++) = v; } } (void) mixer; }
/* * * cblas_dtrmv.c * This program is a C interface to sgemv. * Written by Keita Teranishi * 4/6/1998 * */ #include "cblas.h" #include "cblas_f77.h" void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const double *A, const int lda, double *X, const int incX) { char TA; char UL; char DI; #ifdef F77_CHAR F77_CHAR F77_TA, F77_UL, F77_DI; #else #define F77_TA &TA #define F77_UL &UL #define F77_DI &DI #endif #ifdef F77_INT F77_INT F77_N=N, F77_lda=lda, F77_incX=incX; #else #define F77_N N #define F77_lda lda #define F77_incX incX #endif if (order == CblasColMajor) { if (Uplo == CblasUpper) UL = 'U'; else if (Uplo == CblasLower) UL = 'L'; else { cblas_xerbla(2, "cblas_dtrmv","Illegal Uplo setting, %d\n", Uplo); return; } if (TransA == CblasNoTrans) TA = 'N'; else if (TransA == CblasTrans) TA = 'T'; else if (TransA == CblasConjTrans) TA = 'C'; else { cblas_xerbla(3, "cblas_dtrmv","Illegal TransA setting, %d\n", TransA); return; } if (Diag == CblasUnit) DI = 'U'; else if (Diag == CblasNonUnit) DI = 'N'; else { cblas_xerbla(4, "cblas_dtrmv","Illegal Diag setting, %d\n", Diag); return; } #ifdef F77_CHAR F77_UL = C2F_CHAR(&UL); F77_TA = C2F_CHAR(&TA); F77_DI = C2F_CHAR(&DI); #endif F77_dtrmv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X, &F77_incX); } else if (order == CblasRowMajor) { if (Uplo == CblasUpper) UL = 'L'; else if (Uplo == CblasLower) UL = 'U'; else { cblas_xerbla(2, "cblas_dtrmv","Illegal Uplo setting, %d\n", Uplo); return; } if (TransA == CblasNoTrans) TA = 'T'; else if (TransA == CblasTrans) TA = 'N'; else if (TransA == CblasConjTrans) TA = 'N'; else { cblas_xerbla(3, "cblas_dtrmv","Illegal TransA setting, %d\n", TransA); return; } if (Diag == CblasUnit) DI = 'U'; else if (Diag == CblasNonUnit) DI = 'N'; else { cblas_xerbla(4, "cblas_dtrmv","Illegal Diag setting, %d\n", Diag); return; } #ifdef F77_CHAR F77_UL = C2F_CHAR(&UL); F77_TA = C2F_CHAR(&TA); F77_DI = C2F_CHAR(&DI); #endif F77_dtrmv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X, &F77_incX); } else cblas_xerbla(1, "cblas_dtrmv", "Illegal order setting, %d\n", order); return; }
/* * Copyright (C) 2011 * Heiko Schocher, DENX Software Engineering, hs@denx.de. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <common.h> #include <nand.h> /* * The main entry for NAND booting. It's necessary that SDRAM is already * configured and available since this code loads the main U-Boot image * from NAND into SDRAM and starts it from there. */ void nand_boot(void) { int ret; __attribute__((noreturn)) void (*uboot)(void); /* * Load U-Boot image from NAND into RAM */ ret = nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); #ifdef CONFIG_NAND_ENV_DST ret = nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, (void *)CONFIG_NAND_ENV_DST); #ifdef CONFIG_ENV_OFFSET_REDUND ret = nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); #endif #endif /* * Jump to U-Boot image */ uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; (*uboot)(); }
#ifndef _KERN_TA_H_ #define _KERN_TA_H_ int ta_create_entry_point( void ); int ep_foo(void); int kern_ta_foo(void); #endif
/* * This confidential and proprietary software may be used only as * authorised by a licensing agreement from AMLOGIC, INC. * (C) COPYRIGHT 2011 AMLOGIC, INC. * ALL RIGHTS RESERVED * The entire notice above must be reproduced on all authorised * copies and copies may only be made to the extent permitted * by a licensing agreement from AMLOGIC, INC. */ #ifndef MALI_POWERON_REG_H #define MALI_POWERON_REG_H #define MALI_PP_PP_VERSION_MAGIC 0xCD070100UL #if defined(IO_APB2_BUS_PHY_BASE) #define WRITE_MALI_REG(reg, val) \ __raw_writel(val, reg - IO_APB2_BUS_PHY_BASE + IO_APB2_BUS_BASE) #define READ_MALI_REG(reg) \ __raw_readl(reg - IO_APB2_BUS_PHY_BASE + IO_APB2_BUS_BASE) #else #define WRITE_MALI_REG(reg, val) \ __raw_writel(val, reg - IO_APB_BUS_PHY_BASE + IO_APB_BUS_BASE) #define READ_MALI_REG(reg) \ __raw_readl(reg - IO_APB_BUS_PHY_BASE + IO_APB_BUS_BASE) #endif #define MALI_APB_GP_VSCL_START 0xd0060000 #define MALI_APB_GP_VSCL_END 0xd0060004 #define MALI_APB_GP_CMD 0xd0060020 #define MALI_APB_GP_INT_STAT 0xd0060024 #define MALI_APB_GP_INT_CLEAR 0xd0060028 #define MALI_APB_GP_INT_MASK 0xd006002c #define MALI_MMU_DTE_ADDR 0xd0063000 #define MALI_MMU_STATUS 0xd0063004 #define MALI_MMU_CMD 0xd0063008 #define MALI_MMU_RAW_STATUS 0xd0064014 #define MALI_MMU_INT_CLEAR 0xd0064018 #define MALI_MMU_INT_MASK 0xd006401c #define MALI_MMU_INT_STATUS 0xd0064020 #define MALI_PP_MMU_DTE_ADDR 0xd0064000 #define MALI_PP_MMU_STATUS 0xd0064004 #define MALI_PP_MMU_CMD 0xd0064008 #define MALI_PP_MMU_RAW_STATUS 0xd0064014 #define MALI_PP_MMU_INT_CLEAR 0xd0064018 #define MALI_PP_MMU_INT_MASK 0xd006401c #define MALI_PP_MMU_INT_STATUS 0xd0064020 #define MALI_APB_PP_REND_LIST_ADDR 0xd0068000 #define MALI_APB_PP_REND_RSW_BASE 0xd0068004 #define MALI_APB_PP_REND_VERTEX_BASE 0xd0068008 #define MALI_APB_PPSUBPIXEL_SPECIFIER 0xd0068048 #define MALI_APB_WB0_SOURCE_SELECT 0xd0068100 #define MALI_APB_WB0_TARGET_ADDR 0xd0068104 #define MALI_APB_WB0_TARGET_SCANLINE_LENGTH 0xd0068114 #define MALI_PP_PP_VERSION 0xd0069000 #define MALI_PP_STATUS 0xd0069008 #define MALI_PP_CTRL_MGMT 0xd006900C #define MALI_PP_INT_RAWSTAT 0xd0069020 #define MALI_PP_INT_CLEAR 0xd0069024 #define MALI_PP_INT_MASK 0xd0069028 #define MALI_PP_INT_STAT 0xd006902C #endif /* MALI_POWERON_REG_H */
/** @file Internal header file for Smbus library. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __INTERNAL_SMBUS_LIB_H_ #define __INTERNAL_SMBUS_LIB_H_ #include <PiPei.h> #include <Ppi/Smbus2.h> #include <Library/SmbusLib.h> #include <Library/DebugLib.h> #include <Library/PeiServicesLib.h> #include <Library/BaseMemoryLib.h> // // Declaration for internal functions // /** Gets Smbus PPIs. This internal function retrieves Smbus PPI from PPI database. @param VOID @return The pointer to Smbus PPI. **/ EFI_PEI_SMBUS2_PPI * InternalGetSmbusPpi ( VOID ); /** Executes an SMBus operation to an SMBus controller. This function provides a standard way to execute Smbus script as defined in the SmBus Specification. The data can either be of the Length byte, word, or a block of data. @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to execute the SMBus transactions. @param SmBusAddress The address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC. @param Length Signifies the number of bytes that this operation will do. The maximum number of bytes can be revision specific and operation specific. @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations require this argument. The length of this buffer is identified by Length. @param Status Return status for the executed command. This is an optional parameter and may be NULL. @return The actual number of bytes that are executed for this operation. **/ UINTN InternalSmBusExec ( IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL ); #endif
/* * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * and/or other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* FUNCTION <<fseek>>, <<fseeko>>---set file position INDEX fseek INDEX fseeko INDEX _fseek_r INDEX _fseeko_r SYNOPSIS #include <stdio.h> int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>); int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>); int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>, long <[offset]>, int <[whence]>); int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, off_t <[offset]>, int <[whence]>); DESCRIPTION Objects of type <<FILE>> can have a ``position'' that records how much of the file your program has already read. Many of the <<stdio>> functions depend on this position, and many change it as a side effect. You can use <<fseek>>/<<fseeko>> to set the position for the file identified by <[fp]>. The value of <[offset]> determines the new position, in one of three ways selected by the value of <[whence]> (defined as macros in `<<stdio.h>>'): <<SEEK_SET>>---<[offset]> is the absolute file position (an offset from the beginning of the file) desired. <[offset]> must be positive. <<SEEK_CUR>>---<[offset]> is relative to the current file position. <[offset]> can meaningfully be either positive or negative. <<SEEK_END>>---<[offset]> is relative to the current end of file. <[offset]> can meaningfully be either positive (to increase the size of the file) or negative. See <<ftell>>/<<ftello>> to determine the current file position. RETURNS <<fseek>>/<<fseeko>> return <<0>> when successful. On failure, the result is <<EOF>>. The reason for failure is indicated in <<errno>>: either <<ESPIPE>> (the stream identified by <[fp]> doesn't support repositioning) or <<EINVAL>> (invalid file position). PORTABILITY ANSI C requires <<fseek>>. <<fseeko>> is defined by the Single Unix specification. Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>, <<read>>, <<sbrk>>, <<write>>. */ #include <_ansi.h> #include <reent.h> #include <stdio.h> #include <errno.h> #include "local.h" int _fseek_r (struct _reent *ptr, register FILE *fp, long offset, int whence) { return _fseeko_r (ptr, fp, offset, whence); } #ifndef _REENT_ONLY int fseek (register FILE *fp, long offset, int whence) { return _fseek_r (_REENT, fp, offset, whence); } #endif /* !_REENT_ONLY */
#ifndef MICROBLAZE_TARGET_SIGNAL_H #define MICROBLAZE_TARGET_SIGNAL_H #include "cpu.h" /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { abi_ulong ss_sp; abi_ulong ss_size; abi_long ss_flags; } target_stack_t; /* * sigaltstack controls */ #define TARGET_SS_ONSTACK 1 #define TARGET_SS_DISABLE 2 #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 static inline abi_ulong get_sp_from_cpustate(CPUMBState *state) { return state->regs[14]; } #endif /* MICROBLAZE_TARGET_SIGNAL_H */
/* * Copyright (C) Xiaozhe Wang (chaoslawful) * Copyright (C) Yichun Zhang (agentzh) */ #ifndef DDEBUG #define DDEBUG 0 #endif #include "ddebug.h" #include <nginx.h> #include "ngx_http_lua_capturefilter.h" #include "ngx_http_lua_util.h" #include "ngx_http_lua_exception.h" #include "ngx_http_lua_subrequest.h" ngx_http_output_header_filter_pt ngx_http_lua_next_header_filter; ngx_http_output_body_filter_pt ngx_http_lua_next_body_filter; static ngx_int_t ngx_http_lua_capture_header_filter(ngx_http_request_t *r); static ngx_int_t ngx_http_lua_capture_body_filter(ngx_http_request_t *r, ngx_chain_t *in); ngx_int_t ngx_http_lua_capture_filter_init(ngx_conf_t *cf) { /* setting up output filters to intercept subrequest responses */ ngx_http_lua_next_header_filter = ngx_http_top_header_filter; ngx_http_top_header_filter = ngx_http_lua_capture_header_filter; ngx_http_lua_next_body_filter = ngx_http_top_body_filter; ngx_http_top_body_filter = ngx_http_lua_capture_body_filter; return NGX_OK; } static ngx_int_t ngx_http_lua_capture_header_filter(ngx_http_request_t *r) { ngx_http_post_subrequest_t *psr; ngx_http_lua_ctx_t *old_ctx; ngx_http_lua_ctx_t *ctx; ngx_http_lua_post_subrequest_data_t *psr_data; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua capture header filter, uri \"%V\"", &r->uri); ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); dd("old ctx: %p", ctx); if (ctx == NULL || ! ctx->capture) { psr = r->post_subrequest; if (psr != NULL && psr->handler == ngx_http_lua_post_subrequest && psr->data != NULL) { /* the lua ctx has been cleared by ngx_http_internal_redirect, * resume it from the post_subrequest data */ psr_data = psr->data; old_ctx = psr_data->ctx; if (ctx == NULL) { ctx = old_ctx; ngx_http_set_ctx(r, ctx, ngx_http_lua_module); } else { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua restoring ctx with capture %d, index %d", old_ctx->capture, old_ctx->index); ctx->capture = old_ctx->capture; ctx->index = old_ctx->index; ctx->body = NULL; ctx->last_body = &ctx->body; psr_data->ctx = ctx; } } } if (ctx && ctx->capture) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua capturing response body"); /* force subrequest response body buffer in memory */ r->filter_need_in_memory = 1; r->header_sent = 1; if (r->method == NGX_HTTP_HEAD) { r->header_only = 1; } return NGX_OK; } return ngx_http_lua_next_header_filter(r); } static ngx_int_t ngx_http_lua_capture_body_filter(ngx_http_request_t *r, ngx_chain_t *in) { int rc; ngx_int_t eof; ngx_http_lua_ctx_t *ctx; ngx_http_lua_ctx_t *pr_ctx; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua capture body filter, uri \"%V\"", &r->uri); if (in == NULL) { return ngx_http_lua_next_body_filter(r, NULL); } ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); if (!ctx || !ctx->capture) { dd("no ctx or no capture %.*s", (int) r->uri.len, r->uri.data); return ngx_http_lua_next_body_filter(r, in); } if (ctx->run_post_subrequest) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua body filter skipped because post subrequest " "already run"); return NGX_OK; } if (r->parent == NULL) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua body filter skipped because no parent request " "found"); return NGX_ERROR; } pr_ctx = ngx_http_get_module_ctx(r->parent, ngx_http_lua_module); if (pr_ctx == NULL) { return NGX_ERROR; } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "lua capture body filter capturing response body, uri " "\"%V\"", &r->uri); rc = ngx_http_lua_add_copy_chain(r, pr_ctx, &ctx->last_body, in, &eof); if (rc != NGX_OK) { return NGX_ERROR; } dd("add copy chain eof: %d, sr: %d", (int) eof, r != r->main); if (eof) { ctx->seen_last_for_subreq = 1; } ngx_http_lua_discard_bufs(r->pool, in); return NGX_OK; } /* vi:set ft=c ts=4 sw=4 et fdm=marker: */
// Copyright (C) 2013 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. // // The interface to be implemented by the user of the library to enable // downloading validation rules from a server. #ifndef I18N_ADDRESSINPUT_DOWNLOADER_H_ #define I18N_ADDRESSINPUT_DOWNLOADER_H_ #include <libaddressinput/callback.h> #include <libaddressinput/util/scoped_ptr.h> #include <string> namespace i18n { namespace addressinput { // Downloads validation rules from the server. Sample usage: // class MyDownloader : public Downloader { // public: // virtual void Download(const std::string& url, // scoped_ptr<Callback> downloaded) const { // bool success = ... // std::string data = ... // (*downloaded)(success, url, data); // } // }; class Downloader { public: typedef i18n::addressinput::ScopedPtrCallback<void(std::string, std::string)> Callback; virtual ~Downloader() {} // Downloads |url| and invokes the |downloaded| callback. virtual void Download(const std::string& url, scoped_ptr<Callback> downloaded) = 0; }; } // namespace addressinput } // namespace i18n #endif // I18N_ADDRESSINPUT_DOWNLOADER_H_
#include "../../../src/multimedia/audio/qaudiooutput_alsa_p.h"
#include "../../../src/scripttools/debugging/qscriptdebuggercommandschedulerinterface_p.h"
// Copyright 2018 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. // Header file that includes libfuzzer_macro.h from libprotobuf-mutator. Useful // for inclusion in fuzz targets that can't include headers from third_party/. #ifndef TESTING_LIBFUZZER_PROTO_LPM_INTERFACE_H_ #define TESTING_LIBFUZZER_PROTO_LPM_INTERFACE_H_ #include "third_party/libprotobuf-mutator/src/src/libfuzzer/libfuzzer_macro.h" // Silence logging from the protobuf library. protobuf_mutator::protobuf::LogSilencer log_silencer; #endif // TESTING_LIBFUZZER_PROTO_LPM_INTERFACE_H_