text
stringlengths
4
6.14k
/* * hi6401.h -- HI6401 ALSA SoC HI6401 codec driver * * Copyright (c) 2013 Hisilicon Technologies CO., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _HI3630_SIO_H #define _HI3630_SIO_H #include <linux/pinctrl/consumer.h> #include <linux/regulator/consumer.h> #define SIO_AUDIO_ADDR 0xE804E800 #define SIO_VOICE_ADDR 0xE804EC00 #define SIO_BT_ADDR 0xE804F000 #define SIO_MODEM_ADDR 0xE804F400 #define SIO_AUDIO_ID 0 #define SIO_VOICE_ID 1 #define SIO_BT_ID 2 #define SIO_MODEM_ID 3 #define SIO_CFG 0x40 #define SIO_CFG_PCM_MODE 1 #define SIO_CFG_SIO_MODE 0 #define SIO_INT_CLR 0x48 #define SIO_CTL_SET 0x5C #define SIO_CTL_CLR 0x60 #define SIO_RX_ENABLE (1 << 13) #define SIO_TX_ENABLE (1 << 12) #define SIO_RX_FIFO_DISABLE (1 << 11) #define SIO_TX_FIFO_DISABLE (1 << 10) #define SIO_RX_DATA_MERGE (1 << 9) #define SIO_TX_DATA_MERGE (1 << 8) #define SIO_RX_FIFO_THRESHOLD (0x5 << 4)/* burst 4 */ #define SIO_TX_FIFO_THRESHOLD (0xB << 0)/* burst 4 */ #define SIO_RX_FIFO_THRESHOLD_CLR (0xF << 4) #define SIO_TX_FIFO_THRESHOLD_CLR (0xF << 0) #define SIO_RX_FIFO_DEPTH 0x68 #define SIO_TX_FIFO_DEPTH 0x6C #define SIO_DATA_WIDTH 0x78 #define SIO_DATA_WIDTH_RX 3 #define SIO_DATA_WIDTH_TX 0 #define SIO_I2S_START_POS 0x7C #define SIO_I2S_POS_MERGE 0x88 #define SIO_INT_MASK 0x8C #define SIO_I2S_RX_CHN 0xA0 #define SIO_I2S_TX_CHN 0xC0 struct hi3630_sio_platform_data { struct device *dev; void __iomem *reg_base_addr; struct resource *res; struct pinctrl *pctrl; struct regulator_bulk_data regu; struct mutex mutex; unsigned int id; bool is_master; bool is_ctrl; bool is_pu; unsigned int pb_active; unsigned int active_count; }; #endif
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2017 UniPro <ugene@unipro.ru> * http://ugene.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. */ #ifndef _HI_GUI_GTKEYBOARDDRIVER_H_ #define _HI_GUI_GTKEYBOARDDRIVER_H_ #include <QMap> #include "GTGlobals.h" #ifdef _WIN32 # include <windows.h> #endif #define ADD_KEY(name, code) insert(name, code) namespace HI { /*! * \brief The base class for keyboard's actions imitation * * Example: * \code {.cpp} * GTKeyboardDriver::keyClick( 'A'); // print 'a' * GTKeyboardDriver::keyClick( 'a'); // print 'a' * * GTKeyboardDriver::keyClick( 'a', GTKeyboardDriver::key[Qt::Key_Shift]); // print 'A' * GTKeyboardDriver::keyClick( 'a', GTKeyboardDriver::key[Qt::Key_Shift]); // print 'A' * //case in ["..."] does not matter * * GTKeyboardDriver::keySequence("ThIs Is a TeSt StRiNg"); // print "ThIs Is a TeSt StRiNg" * //i.e. case sensitive * \endcode */ class HI_EXPORT GTKeyboardDriver { public: // // fails if key == 0 // Linux: fails if there is an opening X display error static bool keyClick(char key, Qt::KeyboardModifiers = Qt::NoModifier, bool waitForMainThread = true); static bool keyClick(Qt::Key, Qt::KeyboardModifiers = Qt::NoModifier, bool waitForMainThread = true); static bool keySequence(const QString &str, Qt::KeyboardModifiers = Qt::NoModifier); static bool keyPress(char key, Qt::KeyboardModifiers = Qt::NoModifier); static bool keyRelease(char key, Qt::KeyboardModifiers = Qt::NoModifier); static bool keyPress(Qt::Key, Qt::KeyboardModifiers = Qt::NoModifier); static bool keyRelease(Qt::Key, Qt::KeyboardModifiers = Qt::NoModifier); class HI_EXPORT keys : private QMap<Qt::Key, int> { public: keys(); int operator[](const Qt::Key &key) const; }; static keys key; private: static QList<Qt::Key> modifiersToKeys(Qt::KeyboardModifiers m); }; } // namespace HI #endif
/** * @file * * @brief Function sets the inheritsched Attribute in the attr Argument * @ingroup POSIXAPI */ /* * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 * * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <pthread.h> #include <errno.h> #include <rtems/system.h> #include <rtems/posix/pthread.h> int pthread_attr_setinheritsched( pthread_attr_t *attr, int inheritsched ) { if ( !attr || !attr->is_initialized ) return EINVAL; switch ( inheritsched ) { case PTHREAD_INHERIT_SCHED: case PTHREAD_EXPLICIT_SCHED: attr->inheritsched = inheritsched; return 0; default: return ENOTSUP; } }
/* * Copyright (C) 2007 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef FontCustomPlatformData_h #define FontCustomPlatformData_h #include "TextFlags.h" #include <CoreFoundation/CFBase.h> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/RetainPtr.h> typedef struct CGFont* CGFontRef; typedef const struct __CTFontDescriptor* CTFontDescriptorRef; namespace WebCore { class FontDescription; class FontPlatformData; class SharedBuffer; template <typename T> class FontTaggedSettings; typedef FontTaggedSettings<int> FontFeatureSettings; struct FontCustomPlatformData { WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); WTF_MAKE_FAST_ALLOCATED; public: explicit FontCustomPlatformData(CTFontDescriptorRef fontDescriptor) : m_fontDescriptor(fontDescriptor) { } ~FontCustomPlatformData(); FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings); static bool supportsFormat(const String&); RetainPtr<CTFontDescriptorRef> m_fontDescriptor; }; std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&); } #endif
/********************************************************************\ * 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, contact: * * * * Free Software Foundation Voice: +1-617-542-5942 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * Boston, MA 02111-1307, USA gnu@gnu.org * * * \********************************************************************/ /** @file debug.c @brief Debug output routines @author Copyright (C) 2004 Philippe April <papril777@yahoo.com> */ #include <stdio.h> #include <errno.h> #include <syslog.h> #include <stdarg.h> #include <time.h> #include <unistd.h> #include <signal.h> #include "util.h" #include "conf.h" #include "debug.h" static int do_log(int level, int debuglevel) { switch (level) { case LOG_EMERG: case LOG_ERR: // quiet return (debuglevel >= 0); case LOG_WARNING: case LOG_NOTICE: // default return (debuglevel >= 1); case LOG_INFO: // verbose return (debuglevel >= 2); case LOG_DEBUG: // debug return (debuglevel >= 3); default: debug(LOG_ERR, "Unhandled debug level: %d", level); return 1; } } /** @internal Do not use directly, use the debug macro */ void _debug(const char filename[], int line, int level, const char *format, ...) { char buf[28]; va_list vlist; s_config *config; FILE *out; time_t ts; sigset_t block_chld; time(&ts); config = config_get_config(); if (do_log(level, config->debuglevel)) { sigemptyset(&block_chld); sigaddset(&block_chld, SIGCHLD); sigprocmask(SIG_BLOCK, &block_chld, NULL); if (config->daemon) { out = stdout; } else { out = stderr; } fprintf(out, "[%d][%.24s][%u](%s:%d) ", level, format_time(ts, buf), getpid(), filename, line); va_start(vlist, format); vfprintf(out, format, vlist); va_end(vlist); fputc('\n', out); fflush(out); if (config->log_syslog) { openlog("nodogsplash", LOG_PID, config->syslog_facility); va_start(vlist, format); vsyslog(level, format, vlist); va_end(vlist); closelog(); } sigprocmask(SIG_UNBLOCK, &block_chld, NULL); } }
#ifndef HEADERS #define HEADERS #include "headers.h" #endif int counter = 0; int parent; int usr2Rec = 0; void r_usr1 () { counter++; if (kill(getppid(), SIGUSR1) < 0) { fprintf(stderr, "Blad przy wyslaniu syngalu SIGUSR1!\n"); } } void r_usr2 () { usr2Rec = 1; } int main () { parent = getppid(); // Ustawienie obslugi sygnalow if (signal(SIGUSR1, r_usr1) == SIG_ERR) { fprintf(stderr, "Blad przy ustawianiu procedury obslugi sygnalu!\n"); exit(-1); } if (signal(SIGUSR2, r_usr2) == SIG_ERR) { fprintf(stderr, "Blad przy ustawianiu procedury obslugi sygnalu!\n"); exit(-1); } // Najpierw odblokujmy syngaly sigset_t set; sigemptyset (&set); // Czekania na sygnaly while (usr2Rec != 1 ) { sigsuspend(&set); } // Teraz oddajemy sygnal if (kill(parent, SIGUSR2) < 0) { fprintf(stderr, "Blad przy wyslaniu syngalu SIGUSR2!\n"); } return(0); }
/******************************************************************************* * File Name: WIZ_RDY.h * Version 2.5 * * Description: * This file containts Control Register function prototypes and register defines * * Note: * ******************************************************************************** * Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. *******************************************************************************/ #if !defined(CY_PINS_WIZ_RDY_ALIASES_H) /* Pins WIZ_RDY_ALIASES_H */ #define CY_PINS_WIZ_RDY_ALIASES_H #include "cytypes.h" #include "cyfitter.h" /*************************************** * Constants ***************************************/ #define WIZ_RDY_0 WIZ_RDY__0__PC #endif /* End Pins WIZ_RDY_ALIASES_H */ /* [] END OF FILE */
/* * 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. * * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology * Author: Fuxin Zhang, zhangfx@lemote.com * Copyright (C) 2009 Lemote, Inc. * Author: Zhangjin Wu, wuzhangjin@gmail.com */ #include <linux/init.h> #include <linux/pm.h> #include <asm/reboot.h> #include <loongson.h> extern unsigned long long poweroff_addr; extern unsigned long long reboot_addr; #ifdef CONFIG_LOONGSON2H_SOC extern void mach_prepare_shutdown(void); extern void mach_prepare_reboot(void); #endif static void loongson_halt(void) { pr_notice("\n\n** You can safely turn off the power now **\n\n"); while (1) { if (cpu_wait) cpu_wait(); } } static int __init mips_reboot_setup(void) { _machine_halt = loongson_halt; #ifndef CONFIG_LOONGSON2H_SOC _machine_restart = (void *)reboot_addr; pm_power_off = (void *)poweroff_addr; #else _machine_restart = (void *)mach_prepare_reboot; pm_power_off = (void *)mach_prepare_shutdown; #endif return 0; } arch_initcall(mips_reboot_setup);
/*********************************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Copyright (C) 2005-2013 University of Muenster, Germany. * * Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> * * For a list of authors please refer to the file "CREDITS.txt". * * * * This file is part of the Voreen software package. Voreen is free software: * * you can redistribute it and/or modify it under the terms of the GNU General * * Public License version 2 as published by the Free Software Foundation. * * * * Voreen is distributed in the hope that it will be useful, but WITHOUT ANY * * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License in the file * * "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. * * * * For non-commercial academic use see the license exception specified in the file * * "LICENSE-academic.txt". To get information about commercial licensing please * * contact the authors. * * * ***********************************************************************************/ #ifndef VRN_DIVIDEIMAGEFILTER_H #define VRN_DIVIDEIMAGEFILTER_H #include "modules/itk/processors/itkprocessor.h" #include "voreen/core/processors/volumeprocessor.h" #include "voreen/core/ports/volumeport.h" #include "voreen/core/ports/geometryport.h" #include <string> namespace voreen { class VolumeBase; class DivideImageFilterITK : public ITKProcessor { public: DivideImageFilterITK(); virtual Processor* create() const; virtual std::string getCategory() const { return "Volume Processing/Filtering/ImageIntensity"; } virtual std::string getClassName() const { return "DivideImageFilterITK"; } virtual CodeState getCodeState() const { return CODE_STATE_STABLE; } protected: virtual void setDescriptions() { setDescription("<a href=\"http://www.itk.org/Doxygen/html/classitk_1_1DivideImageFilter.html\">Go to ITK-Doxygen-Description</a>"); } template<class T, class S> void divideImageFilterITK(); virtual void process(); template<class T> void volumeTypeSwitch1(); private: VolumePort inport1_; VolumePort inport2_; VolumePort outport1_; static const std::string loggerCat_; }; } #endif
#ifdef CONFIG_SCHED_AUTOGROUP #include "sched.h" #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/kallsyms.h> #include <linux/utsname.h> #include <linux/security.h> #include <linux/export.h> unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1; static struct autogroup autogroup_default; static atomic_t autogroup_seq_nr; void __init autogroup_init(struct task_struct *init_task) { autogroup_default.tg = &root_task_group; kref_init(&autogroup_default.kref); init_rwsem(&autogroup_default.lock); init_task->signal->autogroup = &autogroup_default; } void autogroup_free(struct task_group *tg) { kfree(tg->autogroup); } static inline void autogroup_destroy(struct kref *kref) { struct autogroup *ag = container_of(kref, struct autogroup, kref); #ifdef CONFIG_RT_GROUP_SCHED /* We've redirected RT tasks to the root task group... */ ag->tg->rt_se = NULL; ag->tg->rt_rq = NULL; #endif sched_destroy_group(ag->tg); } static inline void autogroup_kref_put(struct autogroup *ag) { kref_put(&ag->kref, autogroup_destroy); } static inline struct autogroup *autogroup_kref_get(struct autogroup *ag) { kref_get(&ag->kref); return ag; } static inline struct autogroup *autogroup_task_get(struct task_struct *p) { struct autogroup *ag; unsigned long flags; if (!lock_task_sighand(p, &flags)) return autogroup_kref_get(&autogroup_default); ag = autogroup_kref_get(p->signal->autogroup); unlock_task_sighand(p, &flags); return ag; } static inline struct autogroup *autogroup_create(void) { struct autogroup *ag = kzalloc(sizeof(*ag), GFP_KERNEL); struct task_group *tg; if (!ag) goto out_fail; tg = sched_create_group(&root_task_group); if (IS_ERR(tg)) goto out_free; kref_init(&ag->kref); init_rwsem(&ag->lock); ag->id = atomic_inc_return(&autogroup_seq_nr); ag->tg = tg; #ifdef CONFIG_RT_GROUP_SCHED /* * Autogroup RT tasks are redirected to the root task group * so we don't have to move tasks around upon policy change, * or flail around trying to allocate bandwidth on the fly. * A bandwidth exception in __sched_setscheduler() allows * the policy change to proceed. Thereafter, task_group() * returns &root_task_group, so zero bandwidth is required. */ free_rt_sched_group(tg); tg->rt_se = root_task_group.rt_se; tg->rt_rq = root_task_group.rt_rq; #endif tg->autogroup = ag; sched_online_group(tg, &root_task_group); return ag; out_free: kfree(ag); out_fail: if (printk_ratelimit()) { printk(KERN_WARNING "autogroup_create: %s failure.\n", ag ? "sched_create_group()" : "kmalloc()"); } return autogroup_kref_get(&autogroup_default); } bool task_wants_autogroup(struct task_struct *p, struct task_group *tg) { if (tg != &root_task_group) return false; if (p->sched_class != &fair_sched_class) return false; /* * We can only assume the task group can't go away on us if * autogroup_move_group() can see us on ->thread_group list. */ if (p->flags & PF_EXITING) return false; return true; } static void autogroup_move_group(struct task_struct *p, struct autogroup *ag) { struct autogroup *prev; struct task_struct *t; unsigned long flags; BUG_ON(!lock_task_sighand(p, &flags)); prev = p->signal->autogroup; if (prev == ag) { unlock_task_sighand(p, &flags); return; } p->signal->autogroup = autogroup_kref_get(ag); if (!ACCESS_ONCE(sysctl_sched_autogroup_enabled)) goto out; t = p; do { sched_move_task(t); } while_each_thread(p, t); out: unlock_task_sighand(p, &flags); autogroup_kref_put(prev); } /* Allocates GFP_KERNEL, cannot be called under any spinlock */ void sched_autogroup_create_attach(struct task_struct *p) { struct autogroup *ag = autogroup_create(); autogroup_move_group(p, ag); /* drop extra reference added by autogroup_create() */ autogroup_kref_put(ag); } EXPORT_SYMBOL(sched_autogroup_create_attach); /* Cannot be called under siglock. Currently has no users */ void sched_autogroup_detach(struct task_struct *p) { autogroup_move_group(p, &autogroup_default); } EXPORT_SYMBOL(sched_autogroup_detach); void sched_autogroup_fork(struct signal_struct *sig) { sig->autogroup = autogroup_task_get(current); } void sched_autogroup_exit(struct signal_struct *sig) { autogroup_kref_put(sig->autogroup); } static int __init setup_autogroup(char *str) { sysctl_sched_autogroup_enabled = 0; return 1; } __setup("noautogroup", setup_autogroup); #ifdef CONFIG_PROC_FS int proc_sched_autogroup_set_nice(struct task_struct *p, int nice) { static unsigned long next = INITIAL_JIFFIES; struct autogroup *ag; int err; if (nice < -20 || nice > 19) return -EINVAL; err = security_task_setnice(current, nice); if (err) return err; if (nice < 0 && !can_nice(current, nice)) return -EPERM; /* this is a heavy operation taking global locks.. */ if (!capable(CAP_SYS_ADMIN) && time_before(jiffies, next)) return -EAGAIN; next = HZ / 10 + jiffies; ag = autogroup_task_get(p); down_write(&ag->lock); err = sched_group_set_shares(ag->tg, prio_to_weight[nice + 20]); if (!err) ag->nice = nice; up_write(&ag->lock); autogroup_kref_put(ag); return err; } void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m) { struct autogroup *ag = autogroup_task_get(p); if (!task_group_is_autogroup(ag->tg)) goto out; down_read(&ag->lock); seq_printf(m, "/autogroup-%ld nice %d\n", ag->id, ag->nice); up_read(&ag->lock); out: autogroup_kref_put(ag); } #endif /* CONFIG_PROC_FS */ #ifdef CONFIG_SCHED_DEBUG int autogroup_path(struct task_group *tg, char *buf, int buflen) { if (!task_group_is_autogroup(tg)) return 0; return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id); } #endif /* CONFIG_SCHED_DEBUG */ #endif /* CONFIG_SCHED_AUTOGROUP */
/****************************************************************************** * Wormux, a free clone of the game Worms from Team17. * Copyright (C) 2001-2004 Lawrence Azzoug. * * 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 ****************************************************************************** * Keyboard managment. Use ClanLIB event. *****************************************************************************/ #ifndef KEYBOARD_H #define KEYBOARD_H //----------------------------------------------------------------------------- #include "../include/base.h" #include <SDL.h> #include <map> #include "../include/action.h" //----------------------------------------------------------------------------- class Clavier { private: std::map<int, Action_t> layout; bool PressedKeys[ACTION_MAX]; private: // Traite une touche relachée void HandleKeyPressed (const Action_t &action); void HandleKeyReleased (const Action_t &action); public: void HandleKeyEvent( const SDL_Event *event) ; Clavier(); void Reset(); // On veut bouger la caméra au clavier ? void TestCamera(); // Refresh des touches du clavier void Refresh(); // Associe une touche à une action. void SetKeyAction(int key, Action_t at); }; extern Clavier clavier; //----------------------------------------------------------------------------- #endif
/* * Virtual Dimension - a free, fast, and feature-full virtual desktop manager * for the Microsoft Windows platform. * Copyright (C) 2003-2008 Francois Ferrand * * 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 __SHELLHOOK_H__ #define __SHELLHOOK_H__ class ShellHook { public: ShellHook(HWND hWnd); ~ShellHook(void); static UINT WM_SHELLHOOK; enum ShellNotifications { WINDOWCREATED = 1, WINDOWDESTROYED = 2, ACTIVATESHELLWINDOW = 3, WINDOWACTIVATED = 4, GETMINRECT = 5, REDRAW = 6, TASKMAN = 7, LANGUAGE = 8, SYSMENU = 9, ENDTASK = 10, ACCESSIBILITYSTATE = 11, APPCOMMAND = 12, WINDOWREPLACED = 13, WINDOWREPLACING = 14, FLASH = (0x8000 | REDRAW), RUDEAPPACTIVATEED = (0x8000 | WINDOWACTIVATED) }; protected: typedef BOOL WINAPI RegisterShellHookProc(HWND,DWORD); static HINSTANCE hinstDLL; static int nbInstance; static RegisterShellHookProc *RegisterShellHook; HWND m_hWnd; }; #endif /*__SHELLHOOK_H__*/
/* This file is part of the KDE project Copyright (C) 2001 George Staikos <staikos@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BLOWFISH_H #define _BLOWFISH_H #include <config.h> #ifdef HAVE_STDINT_H #include <stdint.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_SYS_BITYPES_H #include <sys/bitypes.h> /* For uintXX_t on Tru64 */ #endif #include "blockcipher.h" /* @internal */ class BlowFish : public BlockCipher { public: BlowFish(); virtual ~BlowFish(); virtual bool setKey(void *key, int bitlength); virtual int keyLen() const; virtual bool variableKeyLen() const; virtual bool readyToGo() const; virtual int encrypt(void *block, int len); virtual int decrypt(void *block, int len); private: uint32_t _S[4][256]; uint32_t _P[18]; void *_key; int _keylen; // in bits bool _init; bool init(); uint32_t F(uint32_t x); void encipher(uint32_t *xl, uint32_t *xr); void decipher(uint32_t *xl, uint32_t *xr); }; #endif
/** * @file bswap.h * byte swap. */ #ifndef __BSWAP_H__ #define __BSWAP_H__ #ifdef HAVE_BYTESWAP_H #include <byteswap.h> #else #ifdef ARCH_X86_64 # define LEGACY_REGS "=Q" #else # define LEGACY_REGS "=q" #endif #if defined(ARCH_X86) || defined(ARCH_X86_64) static always_inline uint16_t bswap_16(uint16_t x) { __asm("rorw $8, %0" : LEGACY_REGS (x) : "0" (x)); return x; } static always_inline uint32_t bswap_32(uint32_t x) { #if __CPU__ > 386 __asm("bswap %0": "=r" (x) : #else __asm("xchgb %b0,%h0\n" " rorl $16,%0\n" " xchgb %b0,%h0": LEGACY_REGS (x) : #endif "0" (x)); return x; } static inline uint64_t bswap_64(uint64_t x) { #ifdef ARCH_X86_64 __asm("bswap %0": "=r" (x) : "0" (x)); return x; #else union { uint64_t ll; struct { uint32_t l,h; } l; } r; r.l.l = bswap_32 (x); r.l.h = bswap_32 (x>>32); return r.ll; #endif } #elif defined(ARCH_SH4) static always_inline uint16_t bswap_16(uint16_t x) { __asm__("swap.b %0,%0":"=r"(x):"0"(x)); return x; } static always_inline uint32_t bswap_32(uint32_t x) { __asm__( "swap.b %0,%0\n" "swap.w %0,%0\n" "swap.b %0,%0\n" :"=r"(x):"0"(x)); return x; } static inline uint64_t bswap_64(uint64_t x) { union { uint64_t ll; struct { uint32_t l,h; } l; } r; r.l.l = bswap_32 (x); r.l.h = bswap_32 (x>>32); return r.ll; } #else static always_inline uint16_t bswap_16(uint16_t x){ return (x>>8) | (x<<8); } #ifdef ARCH_ARM static always_inline uint32_t bswap_32(uint32_t x){ uint32_t t; __asm__ ( "eor %1, %0, %0, ror #16 \n\t" "bic %1, %1, #0xFF0000 \n\t" "mov %0, %0, ror #8 \n\t" "eor %0, %0, %1, lsr #8 \n\t" : "+r"(x), "+r"(t)); return x; } #else static always_inline uint32_t bswap_32(uint32_t x){ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } #endif static inline uint64_t bswap_64(uint64_t x) { #if 0 x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); return (x>>32) | (x<<32); #else union { uint64_t ll; uint32_t l[2]; } w, r; w.ll = x; r.l[0] = bswap_32 (w.l[1]); r.l[1] = bswap_32 (w.l[0]); return r.ll; #endif } #endif /* !ARCH_X86 */ #endif /* !HAVE_BYTESWAP_H */ // be2me ... BigEndian to MachineEndian // le2me ... LittleEndian to MachineEndian #ifdef WORDS_BIGENDIAN #define be2me_16(x) (x) #define be2me_32(x) (x) #define be2me_64(x) (x) #define le2me_16(x) bswap_16(x) #define le2me_32(x) bswap_32(x) #define le2me_64(x) bswap_64(x) #else #define be2me_16(x) bswap_16(x) #define be2me_32(x) bswap_32(x) #define be2me_64(x) bswap_64(x) #define le2me_16(x) (x) #define le2me_32(x) (x) #define le2me_64(x) (x) #endif #endif /* __BSWAP_H__ */
/* no_multi_strings.c test contains multiple options none of which are strings inspired by Dave Swegen */ #include <stdlib.h> #include "no_multi_strings_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (no_multi_strings_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; }
/* packet_list.h * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PACKET_LIST_H #define PACKET_LIST_H #include "byte_view_tab.h" #include "packet_list_model.h" #include "proto_tree.h" #include "related_packet_delegate.h" #include <QTreeView> #include <QTreeWidget> #include <QMenu> class PacketList : public QTreeView { Q_OBJECT public: explicit PacketList(QWidget *parent = 0); PacketListModel *packetListModel() const; void setProtoTree(ProtoTree *proto_tree); void setByteViewTab(ByteViewTab *byteViewTab); void freeze(); void thaw(); void clear(); void writeRecent(FILE *rf); bool contextMenuActive(); QString &getFilterFromRowAndColumn(); QString packetComment(); void setPacketComment(QString new_comment); QString allPacketComments(); protected: void showEvent (QShowEvent *event); void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected); void contextMenuEvent(QContextMenuEvent *event); private: PacketListModel *packet_list_model_; ProtoTree *proto_tree_; ByteViewTab *byte_view_tab_; capture_file *cap_file_; QMenu ctx_menu_; QAction *decode_as_; int ctx_column_; RelatedPacketDelegate related_packet_delegate_; void markFramesReady(); void setFrameMark(gboolean set, frame_data *fdata); void setFrameIgnore(gboolean set, frame_data *fdata); void setFrameReftime(gboolean set, frame_data *fdata); void setColumnVisibility(); signals: void packetDissectionChanged(); void packetSelectionChanged(); public slots: void setCaptureFile(capture_file *cf); void setMonospaceFont(const QFont &mono_font); void goNextPacket(); void goPreviousPacket(); void goFirstPacket(); void goLastPacket(); void goToPacket(int packet); void markFrame(); void markAllDisplayedFrames(bool set); void ignoreFrame(); void ignoreAllDisplayedFrames(bool set); void setTimeReference(); void unsetAllTimeReferences(); void redrawVisiblePackets(); private slots: void addRelatedFrame(int related_frame); }; #endif // PACKET_LIST_H /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
/* Copyright (C) 2012 - 2015 Evan Teran evan.teran@gmail.com Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,2010,2011 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 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 ELF_VERDEF_H_20121007_ #define ELF_VERDEF_H_20121007_ #include "elf_types.h" /* Version definition sections. */ struct elf32_verdef { elf32_half vd_version; /* Version revision */ elf32_half vd_flags; /* Version information */ elf32_half vd_ndx; /* Version Index */ elf32_half vd_cnt; /* Number of associated aux entries */ elf32_word vd_hash; /* Version name hash value */ elf32_word vd_aux; /* Offset in bytes to verdaux array */ elf32_word vd_next; /* Offset in bytes to next verdef entry */ }; struct elf64_verdef { elf64_half vd_version; /* Version revision */ elf64_half vd_flags; /* Version information */ elf64_half vd_ndx; /* Version Index */ elf64_half vd_cnt; /* Number of associated aux entries */ elf64_word vd_hash; /* Version name hash value */ elf64_word vd_aux; /* Offset in bytes to verdaux array */ elf64_word vd_next; /* Offset in bytes to next verdef entry */ }; /* Legal values for vd_version (version revision). */ enum { VER_DEF_NONE = 0, /* No version */ VER_DEF_CURRENT = 1, /* Current version */ VER_DEF_NUM = 2 /* Given version number */ }; /* Legal values for vd_flags (version information flags). */ enum { VER_FLG_BASE = 0x1, /* Version definition of file itself */ VER_FLG_WEAK = 0x2 /* Weak version identifier */ }; /* Versym symbol index values. */ enum { VER_NDX_LOCAL = 0, /* Symbol is local. */ VER_NDX_GLOBAL = 1, /* Symbol is global. */ VER_NDX_LORESERVE = 0xff00, /* Beginning of reserved entries. */ VER_NDX_ELIMINATE = 0xff01 /* Symbol is to be eliminated. */ }; #endif
// // This file is part of Gambit // Copyright (c) 1994-2014, The Gambit Project (http://www.gambit-project.org) // // FILE: src/tools/enummixed/vertenum.h // Interface to vertex enumerator // // 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 VERTENUM_H #define VERTENUM_H #include "libgambit/libgambit.h" #include "liblinear/lptab.h" #include "liblinear/bfs.h" // // This class enumerates the vertices of the convex polyhedron // // P = {y:Ay + b <= 0, y>=0 } // // where b <= 0. Enumeration starts from the vertex y = 0. // All computation is done in the class constructor. The // list of vertices can be accessed by VertexList() // // The code is based on the reverse Pivoting algorithm of Avis // and Fukuda, Discrete Computational Geom (1992) 8:295-313. // template <class T> class VertEnum { private: int mult_opt,depth; int n; // N is the number of columns, which is the # of dimensions. int k; // K is the number of inequalities given. // Removed const on A and b (Geoff) const Gambit::Matrix<T> &A; const Gambit::Vector<T> &b; Gambit::Vector<T> btemp,c; Gambit::List<BFS<T> > List; Gambit::List<BFS<T> > DualList; Gambit::List<Gambit::Vector<T> > Verts; long npivots,nodes; Gambit::List<long> visits,branches; void Enum(); void Deeper(); void Report(); void Search(LPTableau<T> &tab); void DualSearch(LPTableau<T> &tab); public: VertEnum(const Gambit::Matrix<T> &, const Gambit::Vector<T> &); VertEnum(LPTableau<T> &); virtual ~VertEnum(); const Gambit::List<BFS<T> > &VertexList() const; const Gambit::List<BFS<T> > &DualVertexList() const; void Vertices(Gambit::List<Gambit::Vector<T> > &verts) const; long NumPivots() const; }; #ifdef _A #undef _A #endif #endif // VERTENUM_H
#include <asm/byteorder.h> #ifndef CONFIG_MTD_CFI_ADV_OPTIONS #define CFI_HOST_ENDIAN #else #ifdef CONFIG_MTD_CFI_NOSWAP #define CFI_HOST_ENDIAN #endif #ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP #define CFI_LITTLE_ENDIAN #endif #ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP #define CFI_BIG_ENDIAN #endif #endif #if defined(CFI_LITTLE_ENDIAN) #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) cpu_to_le16(x) #define cpu_to_cfi32(x) cpu_to_le32(x) #define cpu_to_cfi64(x) cpu_to_le64(x) #define cfi16_to_cpu(x) le16_to_cpu(x) #define cfi32_to_cpu(x) le32_to_cpu(x) #define cfi64_to_cpu(x) le64_to_cpu(x) #elif defined (CFI_BIG_ENDIAN) #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) cpu_to_be16(x) #define cpu_to_cfi32(x) cpu_to_be32(x) #define cpu_to_cfi64(x) cpu_to_be64(x) #define cfi16_to_cpu(x) be16_to_cpu(x) #define cfi32_to_cpu(x) be32_to_cpu(x) #define cfi64_to_cpu(x) be64_to_cpu(x) #elif defined (CFI_HOST_ENDIAN) #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) (x) #define cpu_to_cfi32(x) (x) #define cpu_to_cfi64(x) (x) #define cfi16_to_cpu(x) (x) #define cfi32_to_cpu(x) (x) #define cfi64_to_cpu(x) (x) #else #error No CFI endianness defined #endif
//MTK_SWIP_PROJECT_START #ifndef __APP_TSF_H__ #define __APP_TSF_H__ #include "MTKTsfType.h" #include "MTKTsf.h" /***************************************************************************** Class Define ******************************************************************************/ class AppTsf : public MTKTsf { public: static MTKTsf* getInstance(); virtual void destroyInstance(); AppTsf(); virtual ~AppTsf(); // Process Control MRESULT TsfInit(void *InitInData, void *InitOutData); MRESULT TsfMain(void); // START MRESULT TsfExit(void); // EXIT MRESULT TsfReset(void); // RESET for each image // Feature Control MRESULT TsfFeatureCtrl(MUINT32 FeatureID, void* pParaIn, void* pParaOut); private: MTKTSF_STATE_ENUM m_TsfState; }; #endif //__APP_TSF_H__ //MTK_SWIP_PROJECT_END
/* belle-sip - SIP (RFC3261) library. Copyright (C) 2010-2013 Belledonne Communications SARL 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 _BELLE_SIP_TESTER_H #define _BELLE_SIP_TESTER_H #include "bc_tester_utils.h" #ifdef __cplusplus extern "C" { #endif extern test_suite_t cast_test_suite; extern test_suite_t generic_uri_test_suite; extern test_suite_t sip_uri_test_suite; extern test_suite_t headers_test_suite; extern test_suite_t core_test_suite; extern test_suite_t sdp_test_suite; extern test_suite_t resolver_test_suite; extern test_suite_t message_test_suite; extern test_suite_t authentication_helper_test_suite; extern test_suite_t register_test_suite; extern test_suite_t dialog_test_suite; extern test_suite_t refresher_test_suite; extern test_suite_t http_test_suite; extern int belle_sip_tester_ipv6_available(void); extern const char * belle_sip_tester_get_root_ca_path(void); extern void belle_sip_tester_set_root_ca_path(const char *root_ca_path); extern const char* belle_sip_tester_client_cert; extern const char* belle_sip_tester_client_cert_fingerprint; extern const char* belle_sip_tester_private_key; extern const char* belle_sip_tester_private_key_passwd; #ifdef __cplusplus }; #endif #endif /* _BELLE_SIP_TESTER_H */
/*************************************************************************** * Copyright (C) 2008 by Sindre Aamås * * aamas@stud.ntnu.no * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 2 as * * published by the Free Software Foundation. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License version 2 for more details. * * * * You should have received a copy of the GNU General Public License * * version 2 along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef RECTSINC_H #define RECTSINC_H #include "convoluter.h" #include "subresampler.h" #include "makesinckernel.h" #include "cic2.h" #include "gambatte-array.h" #include <cmath> #include <cstdlib> template<unsigned channels, unsigned phases> class RectSinc : public SubResampler { PolyPhaseConvoluter<channels, phases> convoluters[channels]; Array<short> kernel; static double rectWin(const long /*i*/, const long /*M*/) { return 1; } void init(unsigned div, unsigned phaseLen, double fc); public: enum { MUL = phases }; typedef Cic2<channels> Cic; static float cicLimit() { return 2.0f; } class RollOff { static unsigned toTaps(const float rollOffWidth) { static const float widthTimesTaps = 0.9f; return static_cast<unsigned>(std::ceil(widthTimesTaps / rollOffWidth)); } static float toFc(const float rollOffStart, const int taps) { static const float startToFcDeltaTimesTaps = 0.43f; return startToFcDeltaTimesTaps / taps + rollOffStart; } public: const unsigned taps; const float fc; RollOff(float rollOffStart, float rollOffWidth) : taps(toTaps(rollOffWidth)), fc(toFc(rollOffStart, taps)) {} }; RectSinc(unsigned div, unsigned phaseLen, double fc) { init(div, phaseLen, fc); } RectSinc(unsigned div, RollOff ro) { init(div, ro.taps, ro.fc); } std::size_t resample(short *out, const short *in, std::size_t inlen); void adjustDiv(unsigned div); unsigned mul() const { return MUL; } unsigned div() const { return convoluters[0].div(); } }; template<unsigned channels, unsigned phases> void RectSinc<channels, phases>::init(const unsigned div, const unsigned phaseLen, const double fc) { kernel.reset(phaseLen * phases); makeSincKernel(kernel, phases, phaseLen, fc, rectWin); for (unsigned i = 0; i < channels; ++i) convoluters[i].reset(kernel, phaseLen, div); } template<unsigned channels, unsigned phases> std::size_t RectSinc<channels, phases>::resample(short *const out, const short *const in, const std::size_t inlen) { std::size_t samplesOut; for (unsigned i = 0; i < channels; ++i) samplesOut = convoluters[i].filter(out + i, in + i, inlen); return samplesOut; } template<unsigned channels, unsigned phases> void RectSinc<channels, phases>::adjustDiv(const unsigned div) { for (unsigned i = 0; i < channels; ++i) convoluters[i].adjustDiv(div); } #endif
#ifndef __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__ #define __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__ #define CAPWAP_ELEMENT_DUPLICATEIPV6_VENDOR 0 #define CAPWAP_ELEMENT_DUPLICATEIPV6_TYPE 22 #define CAPWAP_ELEMENT_DUPLICATEIPV6 (struct capwap_message_element_id){ .vendor = CAPWAP_ELEMENT_DUPLICATEIPV6_VENDOR, .type = CAPWAP_ELEMENT_DUPLICATEIPV6_TYPE } #define CAPWAP_DUPLICATEIPv6_CLEARED 0 #define CAPWAP_DUPLICATEIPv6_DETECTED 1 struct capwap_duplicateipv6_element { struct in6_addr address; uint8_t status; uint8_t length; uint8_t* macaddress; }; extern const struct capwap_message_elements_ops capwap_element_duplicateipv6_ops; #endif /* __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__ */
/***************************************************************************** * * \file * * \brief 32-bit LMS filter function optimized for the AVR32 UC3. * * This file contains the code of the LMS filter. * * Copyright (c) 2009 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \asf_license_stop * *****************************************************************************/ #include "dsp.h" #if !defined(FORCE_ALL_GENERICS) && \ !defined(FORCE_GENERIC_FILT32_LMS) && \ defined(TARGET_SPECIFIC_FILT32_LMS) #include "filt_lms.h" void dsp32_filt_lms(dsp32_t *x, dsp32_t *w, int size, dsp32_t new_x, dsp32_t d, dsp32_t *y, dsp32_t *e) { int i = 0; x[0] = new_x; /* // Performed a FIR __asm__ __volatile__ ( "mov %3, 0\n\t" "mov r4, %3\n\t" "mov r5, %3\n\t" "cp.w %4, 0\n\t" "brle _filt_nlms_end_fir\n" "_filt_nlms_loop_fir:\n\t" "ld.d r0, %1[%3 << 2]\n\t" "ld.d r2, %2[%3 << 2]\n\t" "macs.d r4, r0, r2\n\t" "macs.d r4, r1, r3\n\t" "sub %3, -2\n\t" "ld.d r0, %1[%3 << 2]\n\t" "ld.d r2, %2[%3 << 2]\n\t" "macs.d r4, r0, r2\n\t" "macs.d r4, r1, r3\n\t" "sub %3, -2\n\t" "cp.w %4, %3\n\t" "brgt _filt_nlms_loop_fir\n" "_filt_nlms_end_fir:\n\t" "lsr %0, r4, "ASTRINGZ(DSP32_QB)"\n\t" "or %0, %0, r5 << "ASTRINGZ(DSP32_QA)"\n\t" : "=r" (*y) : "r" (w), "r" (x), "r" (i), "r" (size), "0" (*y) : "r0", "r1", "r2", "r3", "r4", "r5", "r8" );*/ dsp32_filt_lms_fir(x, w, size, y, i); // Error calculation *e = d - *y; // Refresh the w coefficients for(i=0; i<size; i+=4) { w[i] += ((((S64) *e)*((S64) x[i]))) >> (DSP_LMS_MU - 1 + DSP32_QB); w[i+1] += ((((S64) *e)*((S64) x[i+1]))) >> (DSP_LMS_MU - 1 + DSP32_QB); w[i+2] += ((((S64) *e)*((S64) x[i+2]))) >> (DSP_LMS_MU - 1 + DSP32_QB); w[i+3] += ((((S64) *e)*((S64) x[i+3]))) >> (DSP_LMS_MU - 1 + DSP32_QB); } // Shift the circular buffer for(i=size-1; i>0; i-=4) { x[i] = x[i-1]; x[i-1] = x[i-2]; x[i-2] = x[i-3]; x[i-3] = x[i-4]; } } #endif
// // Visopsys // Copyright (C) 1998-2015 J. Andrew McLaughlin // // 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. // // kernelSystemDriver.h // #if !defined(_KERNELSYSTEMDRIVER_H) #include "kernelDevice.h" #define BIOSROM_START 0x000E0000 #define BIOSROM_END 0x000FFFFF #define BIOSROM_SIZE ((BIOSROM_END - BIOSROM_START) + 1) #define BIOSROM_SIG_32 "_32_" #define BIOSROM_SIG_PNP "$PnP" #define BIOS_PNP_VERSION 0x10 // The header for a 32-bit BIOS interface typedef struct { char signature[4]; void *entryPoint; unsigned char revision; unsigned char structLen; unsigned char checksum; unsigned char reserved[5]; } __attribute__((packed)) kernelBios32Header; // The header for a Plug and Play BIOS typedef struct { char signature[4]; unsigned char version; unsigned char length; unsigned short control; unsigned char checksum; unsigned eventFlagAddr; unsigned short realModeEntry; unsigned short realModeCodeSeg; unsigned short protModeEntry; unsigned protModeCodeSeg; unsigned oemDevId; unsigned short realModeDataSeg; unsigned protModeDataSeg; } __attribute__((packed)) kernelBiosPnpHeader; typedef struct { void *(*driverGetEntry)(kernelDevice *, unsigned char, int); } kernelMultiProcOps; #define _KERNELSYSTEMDRIVER_H #endif
/* tc-mep.h -- Header file for tc-mep.c. Copyright (C) 2001, 2002, 2005, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS 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. GAS 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 GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define TC_MEP /* Support computed relocations. */ #define OBJ_COMPLEX_RELC /* Support many operands per instruction. */ #define GAS_CGEN_MAX_FIXUPS 10 #define LISTING_HEADER "MEP GAS " /* The target BFD architecture. */ #define TARGET_ARCH bfd_arch_mep #define TARGET_FORMAT (target_big_endian ? "elf32-mep" : "elf32-mep-little") /* This is the default. */ #define TARGET_BYTES_BIG_ENDIAN 1 /* Permit temporary numeric labels. */ #define LOCAL_LABELS_FB 1 /* .-foo gets turned into PC relative relocs. */ #define DIFF_EXPR_OK /* We don't need to handle .word strangely. */ #define WORKING_DOT_WORD /* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 #define MD_APPLY_FIX #define md_apply_fix mep_apply_fix extern void mep_apply_fix (struct fix *, valueT *, segT); /* Call md_pcrel_from_section(), not md_pcrel_from(). */ #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) extern long md_pcrel_from_section (struct fix *, segT); #define tc_frob_file() mep_frob_file () extern void mep_frob_file (void); #define tc_fix_adjustable(fixP) mep_fix_adjustable (fixP) extern bfd_boolean mep_fix_adjustable (struct fix *); /* After creating a fixup for an instruction operand, we need to check for HI16 relocs and queue them up for later sorting. */ #define md_cgen_record_fixup_exp mep_cgen_record_fixup_exp /* When relaxing, we need to emit various relocs we otherwise wouldn't. */ #define TC_FORCE_RELOCATION(fix) mep_force_relocation (fix) extern int mep_force_relocation (struct fix *); #define tc_gen_reloc gas_cgen_tc_gen_reloc extern void gas_cgen_md_operand (expressionS *); #define md_operand(x) gas_cgen_md_operand (x) #define md_flush_pending_output() mep_flush_pending_output() extern int mep_flush_pending_output(void); extern const struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table /* Account for inserting a jmp after the insn. */ #define TC_CGEN_MAX_RELAX(insn, len) ((len) + 4) extern void mep_prepare_relax_scan (fragS *, offsetT *, relax_substateT); #define md_prepare_relax_scan(FRAGP, ADDR, AIM, STATE, TYPE) \ mep_prepare_relax_scan (FRAGP, &AIM, STATE) /* Support for core/vliw mode switching. */ #define CORE 0 #define VLIW 1 #define MAX_PARALLEL_INSNS 56 /* From email from Toshiba. */ #define VTEXT_SECTION_NAME ".vtext" /* Needed to process pending instructions when a label is encountered. */ #define TC_START_LABEL(ch, ptr) ((ch == ':') && mep_flush_pending_output ()) #define tc_unrecognized_line(c) mep_unrecognized_line (c) extern int mep_unrecognized_line (int); #define md_cleanup mep_cleanup extern void mep_cleanup (void); #define md_elf_section_letter mep_elf_section_letter extern int mep_elf_section_letter (int, char **); #define md_elf_section_flags mep_elf_section_flags extern flagword mep_elf_section_flags (flagword, int, int); #define ELF_TC_SPECIAL_SECTIONS \ { VTEXT_SECTION_NAME, SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR|SHF_MEP_VLIW }, /* The values of the following enum are for use with parinsnum, which is a variable in md_assemble that keeps track of whether or not the next instruction is expected to be the first or second instrucion in a parallelization group. */ typedef enum exp_par_insn_{FIRST, SECOND} EXP_PAR_INSN;
#ifndef K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H #define K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.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 /** \file \author Tim Shead (tshead@k-3d.com) */ #include <k3dsdk/iunknown.h> namespace Gtk { class Widget; } namespace k3d { class inode; namespace ngui { class document_state; namespace custom_property_page { /// Abstract interface for a custom "property page", a UI component that can be displayed in-place-of the normal "auto-generated" property page for a specific plugin. class control { public: virtual ~control() {} virtual Gtk::Widget& get_widget(document_state& DocumentState, inode& Node) = 0; protected: control() {} control(const control&) {} control& operator=(const control&) { return *this; } }; } // namespace custom_property_page } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H
/* * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This file was originally distributed by Qualcomm Atheros, Inc. * under proprietary terms before Copyright ownership was assigned * to the Linux Foundation. */ #if !defined( __WLAN_HDD_DP_UTILS_H ) #define __WLAN_HDD_DP_UTILS_H /* */ /* */ /* */ #include <linux/list.h> #include <vos_types.h> #include <linux/kernel.h> #include <i_vos_types.h> #include <vos_status.h> #include <linux/spinlock.h> #include <vos_trace.h> #include <vos_list.h> /* */ /* */ typedef struct list_head hdd_list_node_t; typedef struct hdd_list_s { hdd_list_node_t anchor; v_SIZE_t count; v_SIZE_t max_size; spinlock_t lock; } hdd_list_t; typedef struct { hdd_list_node_t anchor; struct sk_buff *skb; int userPriority; } skb_list_node_t; // /* */ VOS_INLINE_FN v_VOID_t hdd_list_init( hdd_list_t *pList, v_SIZE_t max_size) { INIT_LIST_HEAD( &pList->anchor ); pList->count = 0; pList->max_size = max_size; spin_lock_init(&pList->lock); } VOS_INLINE_FN v_VOID_t hdd_list_destroy( hdd_list_t *pList ) { if ( pList->count !=0 ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s: list length not equal to zero",__func__); } } VOS_INLINE_FN v_VOID_t hdd_list_size( hdd_list_t *pList, v_SIZE_t *pSize ) { *pSize = pList->count; } VOS_STATUS hdd_list_insert_front( hdd_list_t *pList, hdd_list_node_t *pNode ); VOS_STATUS hdd_list_insert_back( hdd_list_t *pList, hdd_list_node_t *pNode ); VOS_STATUS hdd_list_insert_back_size( hdd_list_t *pList, hdd_list_node_t *pNode, v_SIZE_t *pSize ); VOS_STATUS hdd_list_remove_front( hdd_list_t *pList, hdd_list_node_t **ppNode ); VOS_STATUS hdd_list_remove_back( hdd_list_t *pList, hdd_list_node_t **ppNode ); VOS_STATUS hdd_list_remove_node( hdd_list_t *pList, hdd_list_node_t *pNodeToRemove ); VOS_STATUS hdd_list_peek_front( hdd_list_t *pList, hdd_list_node_t **ppNode ); VOS_STATUS hdd_list_peek_next( hdd_list_t *pList, hdd_list_node_t *pNode, hdd_list_node_t **ppNode ); VOS_STATUS hdd_string_to_hex( char *pSrcMac, int length, char *pDescMac ); #endif //
/* * Copyright (C) 2010 HTC, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <asm/uaccess.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/unistd.h> #include <linux/sched.h> #include <linux/fs.h> #include <linux/file.h> #include <linux/mm.h> mm_segment_t oldfs; #define PROCNAME "driver/hdf" #define FLAG_LEN 64 #if 0 #define SECMSG(s...) pr_info("[SECURITY] "s) #else #define SECMSG(s...) do{} while(0) #endif static char htc_debug_flag[FLAG_LEN+1]={0}; extern int get_partition_num_by_name(char *name); static int offset=628; static int first_read=1; static int htc_debug_read(struct seq_file *m, void *v) { char filename[32] = ""; char RfMisc[FLAG_LEN+3]={0}; struct file *filp = NULL; ssize_t nread; int pnum; if(first_read){ pnum = get_partition_num_by_name("misc"); if (pnum < 0) { printk(KERN_ERR"unknown partition number for misc partition\n"); return 0; } snprintf(filename, 32, "/dev/block/mmcblk0p%d", pnum); filp = filp_open(filename, O_RDWR, 0); if (IS_ERR(filp)) { printk(KERN_ERR"unable to open file: %s\n", filename); return PTR_ERR(filp); } SECMSG("%s: offset :%d\n", __func__, offset); filp->f_pos = offset; nread = kernel_read(filp, filp->f_pos, RfMisc, FLAG_LEN+2); memset(htc_debug_flag,0,FLAG_LEN+1); memcpy(htc_debug_flag,RfMisc+2,FLAG_LEN); SECMSG("%s: RfMisc :%s (%zd)\n", __func__,RfMisc, nread); SECMSG("%s: htc_debug_flag:%s \n", __func__, htc_debug_flag); seq_printf(m, "0X%s\n",htc_debug_flag); if (filp) filp_close(filp, NULL); first_read = 0; }else seq_printf(m, "0X%s\n",htc_debug_flag); return 0; } static ssize_t htc_debug_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { char buf[FLAG_LEN+3]; char filename[32] = ""; struct file *filp = NULL; ssize_t nread; int pnum; SECMSG("%s called (count:%d)\n", __func__, (int)count); if (count != sizeof(buf)){ printk(KERN_ERR"count != sizeof(buf)\n"); return -EFAULT; } if (copy_from_user(buf, buffer, count)) return -EFAULT; memset(htc_debug_flag,0,FLAG_LEN+1); memcpy(htc_debug_flag,buf+2,FLAG_LEN); SECMSG("Receive :%s\n",buf); SECMSG("Flag :%s\n",htc_debug_flag); pnum = get_partition_num_by_name("misc"); if (pnum < 0) { printk(KERN_ERR"unknown partition number for misc partition\n"); return 0; } snprintf(filename, 32, "/dev/block/mmcblk0p%d", pnum); filp = filp_open(filename, O_RDWR, 0); if (IS_ERR(filp)) { printk(KERN_ERR"unable to open file: %s\n", filename); return PTR_ERR(filp); } SECMSG("%s: offset :%d\n", __func__, offset); filp->f_pos = offset; nread = kernel_write(filp, buf, FLAG_LEN+2, filp->f_pos); SECMSG("%s:wrire buf: %s (%zd)\n", __func__, buf, nread); if (filp) filp_close(filp, NULL); return count; } static int htc_debug_open(struct inode *inode, struct file *file) { return single_open(file, htc_debug_read, NULL); } static const struct file_operations htc_debug_fops = { .owner = THIS_MODULE, .open = htc_debug_open, .write = htc_debug_write, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int __init sysinfo_proc_init(void) { struct proc_dir_entry *entry = NULL; pr_info("%s: Init HTC Debug Flag proc interface.\r\n", __func__); entry = proc_create_data(PROCNAME, 0660, NULL, &htc_debug_fops, NULL); if (entry == NULL) { printk(KERN_ERR "%s: unable to create /proc%s entry\n", __func__,PROCNAME); return -ENOMEM; } return 0; } module_init(sysinfo_proc_init); MODULE_AUTHOR("Medad Chang <medad_chang@htc.com>"); MODULE_DESCRIPTION("HTC Debug Interface"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL v2");
/* vifm * Copyright (C) 2001 Ken Steen. * Copyright (C) 2011 xaizek. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "find_menu.h" #include <stdlib.h> /* free() */ #include <string.h> /* strdup() */ #include "../cfg/config.h" #include "../modes/dialogs/msg_dialog.h" #include "../ui/statusbar.h" #include "../ui/ui.h" #include "../utils/macros.h" #include "../utils/path.h" #include "../utils/str.h" #include "../macros.h" #include "menus.h" #ifdef _WIN32 #define DEFAULT_PREDICATE "-iname" #else #define DEFAULT_PREDICATE "-name" #endif static int execute_find_cb(FileView *view, menu_info *m); int show_find_menu(FileView *view, int with_path, const char args[]) { enum { M_s, M_a, M_A, M_u, M_U, }; int save_msg; char *custom_args = NULL; char *targets = NULL; char *cmd; custom_macro_t macros[] = { [M_s] = { .letter = 's', .value = NULL, .uses_left = 1, .group = -1 }, [M_a] = { .letter = 'a', .value = NULL, .uses_left = 1, .group = 1 }, [M_A] = { .letter = 'A', .value = NULL, .uses_left = 0, .group = 1 }, [M_u] = { .letter = 'u', .value = "", .uses_left = 1, .group = -1 }, [M_U] = { .letter = 'U', .value = "", .uses_left = 1, .group = -1 }, }; static menu_info m; if(with_path) { macros[M_s].value = args; macros[M_a].value = ""; macros[M_A].value = ""; } else { targets = prepare_targets(view); if(targets == NULL) { show_error_msg("Find", "Failed to setup target directory."); return 0; } macros[M_s].value = targets; macros[M_A].value = args; if(args[0] == '-') { macros[M_a].value = args; } else { char *const escaped_args = shell_like_escape(args, 0); custom_args = format_str("%s %s", DEFAULT_PREDICATE, escaped_args); macros[M_a].value = custom_args; free(escaped_args); } } init_menu_info(&m, format_str("Find %s", args), strdup("No files found")); m.execute_handler = &execute_find_cb; m.key_handler = &filelist_khandler; cmd = expand_custom_macros(cfg.find_prg, ARRAY_LEN(macros), macros); free(targets); free(custom_args); status_bar_message("find..."); save_msg = capture_output(view, cmd, 0, &m, macros[M_u].explicit_use, macros[M_U].explicit_use); free(cmd); return save_msg; } /* Callback that is called when menu item is selected. Should return non-zero * to stay in menu mode. */ static int execute_find_cb(FileView *view, menu_info *m) { (void)goto_selected_file(view, m->items[m->pos], 0); return 0; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set cinoptions+=t0 filetype=c : */
#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/cdev.h> #include <linux/mm.h> #include <asm/io.h> #include <asm/uaccess.h> #include <linux/ioctl.h> #include <linux/xlog.h> #include <linux/device.h> #include <linux/platform_device.h> #include "devinfo.h" #define DEVINFO_TAG "DEVINFO" extern u32 get_devinfo_with_index(u32 index); extern u32 g_devinfo_data_size; struct devinfo_driver { struct device_driver driver; const struct platform_device_id *id_table; }; static struct devinfo_driver dev_info ={ .driver = { .name = "dev_info", .bus = &platform_bus_type, .owner = THIS_MODULE, }, .id_table = NULL, }; static ssize_t devinfo_show(struct device_driver *driver, char *buf) { unsigned int i; unsigned int *output = (unsigned int *)buf; output[0] = g_devinfo_data_size; for(i = 0; i < g_devinfo_data_size; i++) { output[i+1] = get_devinfo_with_index(i); } return (g_devinfo_data_size + 1) * sizeof(unsigned int); } DRIVER_ATTR(dev_info, 0444, devinfo_show, NULL); static ssize_t htc_devinfo_show(struct device_driver *driver, char *buf) { unsigned int i; ssize_t len, ret = 0; for(i = 0; i < g_devinfo_data_size; i++) { len = snprintf(buf + ret, PAGE_SIZE - ret, "[%d] 0x%x\n", i, get_devinfo_with_index(i)); ret += len; } return ret; } DRIVER_ATTR(htc_dev_info, 0444, htc_devinfo_show, NULL); static ssize_t htc_speed_bin_show(struct device_driver *driver, char *buf) { unsigned int seg_code = get_devinfo_with_index(24); unsigned int speed_bin = (seg_code & (0xF << 24)) >> 24; ssize_t size = 0; size += snprintf(buf, PAGE_SIZE, "0x%x\n", speed_bin); return size; } DRIVER_ATTR(htc_speed_bin, 0444, htc_speed_bin_show, NULL); #define _BITMASK_(_bits_) (((unsigned) -1 >> (31 - ((1) ? _bits_))) & ~((1U << ((0) ? _bits_)) - 1)) #define _GET_BITS_VAL_(_bits_, _val_) (((_val_) & (_BITMASK_(_bits_))) >> ((0) ? _bits_)) static ssize_t htc_date_code_show(struct device_driver *driver, char *buf) { unsigned int date_code = get_devinfo_with_index(5); ssize_t size = 0; date_code = _GET_BITS_VAL_(30 : 30, date_code); size += snprintf(buf, PAGE_SIZE, "0x%x\n", date_code); return size; } DRIVER_ATTR(htc_date_code, 0444, htc_date_code_show, NULL); static int __init devinfo_init(void) { int ret = 0; ret = driver_register(&dev_info.driver); if (ret) { printk("fail to register devinfo driver\n"); } ret = driver_create_file(&dev_info.driver, &driver_attr_dev_info); if (ret) { printk("[BOOT INIT] Fail to create devinfo sysfs file\n"); } ret = driver_create_file(&dev_info.driver, &driver_attr_htc_dev_info); if (ret) { printk("[BOOT INIT] Fail to create devinfo sysfs file\n"); } ret = driver_create_file(&dev_info.driver, &driver_attr_htc_speed_bin); if (ret) { printk("[BOOT INIT] Fail to create speed_bin sysfs file\n"); } ret = driver_create_file(&dev_info.driver, &driver_attr_htc_date_code); if (ret) { printk("[BOOT INIT] Fail to create date_code sysfs file\n"); } return 0; } module_init(devinfo_init);
/* $Id: main_console.c 3553 2011-05-05 06:14:19Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.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 */ #include "systest.h" #include "gui.h" #include <stdio.h> #include <pjlib.h> static pj_bool_t console_quit; enum gui_key gui_msgbox(const char *title, const char *message, enum gui_flag flag) { puts(title); puts(message); for (;;) { char input[10], *ret; if (flag == WITH_YESNO) printf("%c:Yes %c:No ", KEY_YES, KEY_NO); else if (flag == WITH_OK) printf("%c:OK ", KEY_OK); else if (flag == WITH_OKCANCEL) printf("%c:OK %c:Cancel ", KEY_OK, KEY_CANCEL); puts(""); ret = fgets(input, sizeof(input), stdin); if (!ret) return KEY_CANCEL; if (input[0]==KEY_NO || input[0]==KEY_YES || input[0]==KEY_CANCEL) return (enum gui_key)input[0]; } } pj_status_t gui_init(gui_menu *menu) { PJ_UNUSED_ARG(menu); return PJ_SUCCESS; } static void print_menu(const char *indent, char *menu_id, gui_menu *menu) { char child_indent[16]; unsigned i; pj_ansi_snprintf(child_indent, sizeof(child_indent), "%s ", indent); printf("%s%s: %s\n", indent, menu_id, menu->title); for (i=0; i<menu->submenu_cnt; ++i) { char child_id[10]; pj_ansi_sprintf(child_id, "%s%u", menu_id, i); if (!menu->submenus[i]) puts(""); else print_menu(child_indent, child_id, menu->submenus[i]); } } pj_status_t gui_start(gui_menu *menu) { while (!console_quit) { unsigned i; char input[10], *p; gui_menu *choice; puts("M E N U :"); puts("---------"); for (i=0; i<menu->submenu_cnt; ++i) { char menu_id[4]; pj_ansi_sprintf(menu_id, "%u", i); print_menu("", menu_id, menu->submenus[i]); } puts(""); printf("Enter the menu number: "); if (!fgets(input, sizeof(input), stdin)) break; p = input; choice = menu; while (*p && *p!='\r' && *p!='\n') { unsigned d = (*p - '0'); if (d < 0 || d >= choice->submenu_cnt) { puts("Invalid selection"); choice = NULL; break; } choice = choice->submenus[d]; ++p; } if (choice && *p!='\r' && *p!='\n') { puts("Invalid characters entered"); continue; } if (choice && choice->handler) (*choice->handler)(); } return PJ_SUCCESS; } void gui_destroy(void) { console_quit = PJ_TRUE; } void gui_sleep(unsigned sec) { pj_thread_sleep(sec * 1000); } int main() { if (systest_init() != PJ_SUCCESS) return 1; systest_run(); systest_deinit(); return 0; }
#include <linux/percpu.h> #include <linux/seq_file.h> #include <linux/proc_fs.h> #include "rds.h" #include "iw.h" DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_iw_statistics, rds_iw_stats); static const char *const rds_iw_stat_names[] = { "iw_connect_raced", "iw_listen_closed_stale", "iw_tx_cq_call", "iw_tx_cq_event", "iw_tx_ring_full", "iw_tx_throttle", "iw_tx_sg_mapping_failure", "iw_tx_stalled", "iw_tx_credit_updates", "iw_rx_cq_call", "iw_rx_cq_event", "iw_rx_ring_empty", "iw_rx_refill_from_cq", "iw_rx_refill_from_thread", "iw_rx_alloc_limit", "iw_rx_credit_updates", "iw_ack_sent", "iw_ack_send_failure", "iw_ack_send_delayed", "iw_ack_send_piggybacked", "iw_ack_received", "iw_rdma_mr_alloc", "iw_rdma_mr_free", "iw_rdma_mr_used", "iw_rdma_mr_pool_flush", "iw_rdma_mr_pool_wait", "iw_rdma_mr_pool_depleted", }; unsigned int rds_iw_stats_info_copy(struct rds_info_iterator *iter, unsigned int avail) { struct rds_iw_statistics stats = {0, }; uint64_t *src; uint64_t *sum; size_t i; int cpu; if (avail < ARRAY_SIZE(rds_iw_stat_names)) goto out; for_each_online_cpu(cpu) { src = (uint64_t *)&(per_cpu(rds_iw_stats, cpu)); sum = (uint64_t *)&stats; for (i = 0; i < sizeof(stats) / sizeof(uint64_t); i++) *(sum++) += *(src++); } rds_stats_info_copy(iter, (uint64_t *)&stats, rds_iw_stat_names, ARRAY_SIZE(rds_iw_stat_names)); out: return ARRAY_SIZE(rds_iw_stat_names); }
/*************************************************************************** NWNXFuncs.cpp - Implementation of the CNWNXFuncs class. Copyright (C) 2007 Doug Swarin (zac@intertex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ #include "NWNXSystem.h" void Func_FileSymlink (CGameObject *ob, char *value) { int ret; char *to = strchr(value, '\n'); if (to == NULL) { snprintf(value, strlen(value), "0"); return; } *to++ = 0; if ((ret = symlink(value, to)) < 0) ret = -errno; else ret = 1; snprintf(value, strlen(value), "%d", ret); } /* vim: set sw=4: */
/* * Copyright (C) 2011 Fujitsu. All rights reserved. * Written by Miao Xie <miaox@cn.fujitsu.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef __DELAYED_TREE_OPERATION_H #define __DELAYED_TREE_OPERATION_H #include <linux/rbtree.h> #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/list.h> #include <linux/wait.h> #include <linux/atomic.h> #include "ctree.h" /* types of the delayed item */ #define BTRFS_DELAYED_INSERTION_ITEM 1 #define BTRFS_DELAYED_DELETION_ITEM 2 struct btrfs_delayed_root { spinlock_t lock; struct list_head node_list; /* * Used for delayed nodes which is waiting to be dealt with by the * worker. If the delayed node is inserted into the work queue, we * drop it from this list. */ struct list_head prepare_list; atomic_t items; /* for delayed items */ int nodes; /* for delayed nodes */ wait_queue_head_t wait; }; struct btrfs_delayed_node { u64 inode_id; u64 bytes_reserved; struct btrfs_root *root; /* Used to add the node into the delayed root's node list. */ struct list_head n_list; /* * Used to add the node into the prepare list, the nodes in this list * is waiting to be dealt with by the async worker. */ struct list_head p_list; struct rb_root ins_root; struct rb_root del_root; struct mutex mutex; struct btrfs_inode_item inode_item; atomic_t refs; u64 index_cnt; bool in_list; bool inode_dirty; int count; }; struct btrfs_delayed_item { struct rb_node rb_node; struct btrfs_key key; struct list_head tree_list; /* used for batch insert/delete items */ struct list_head readdir_list; /* used for readdir items */ u64 bytes_reserved; struct btrfs_delayed_node *delayed_node; atomic_t refs; int ins_or_del; u32 data_len; char data[0]; }; static inline void btrfs_init_delayed_root( struct btrfs_delayed_root *delayed_root) { atomic_set(&delayed_root->items, 0); delayed_root->nodes = 0; spin_lock_init(&delayed_root->lock); init_waitqueue_head(&delayed_root->wait); INIT_LIST_HEAD(&delayed_root->node_list); INIT_LIST_HEAD(&delayed_root->prepare_list); } int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, struct btrfs_root *root, const char *name, int name_len, struct inode *dir, struct btrfs_disk_key *disk_key, u8 type, u64 index); int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *dir, u64 index); int btrfs_inode_delayed_dir_index_count(struct inode *inode); int btrfs_run_delayed_items(struct btrfs_trans_handle *trans, struct btrfs_root *root); void btrfs_balance_delayed_items(struct btrfs_root *root); int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, struct inode *inode); /* Used for evicting the inode. */ void btrfs_remove_delayed_node(struct inode *inode); void btrfs_kill_delayed_inode_items(struct inode *inode); int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode); int btrfs_fill_inode(struct inode *inode, u32 *rdev); /* Used for drop dead root */ void btrfs_kill_all_delayed_nodes(struct btrfs_root *root); /* Used for readdir() */ void btrfs_get_delayed_items(struct inode *inode, struct list_head *ins_list, struct list_head *del_list); void btrfs_put_delayed_items(struct list_head *ins_list, struct list_head *del_list); int btrfs_should_delete_dir_index(struct list_head *del_list, u64 index); int btrfs_readdir_delayed_dir_index(struct file *filp, void *dirent, filldir_t filldir, struct list_head *ins_list, bool *emitted); /* for init */ int __init btrfs_delayed_inode_init(void); void btrfs_delayed_inode_exit(void); /* for debugging */ void btrfs_assert_delayed_root_empty(struct btrfs_root *root); #endif
/* The Butterfly Effect * This file copyright (C) 2011 Klaas van Gend * * 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 * applicable version is GPL version 2 only. * 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-1335, USA. */ #ifndef UNDOSINGLETON_H #define UNDOSINGLETON_H #include "AbstractObject.h" #include "PieMenu.h" #include <QUndoCommand> // forward declarations class QUndoStack; class AbstractUndoCommand; class UndoSingleton { public: /// Factory method for AbstractUndoCommands /// @param anObject /// @param anUndoType /// @returns Pointer to a newly created AbstractUndoCommand. /// @note The newly created command is not put on the stack yet. /// If you want it to, call commit() on the Command. /// The object is now owned by the ViewObject anObject. static AbstractUndoCommand *createUndoCommand(ViewObjectPtr anObject, ActionIcon::ActionType anUndoType); /// Clean up the stack (i.e. start a new level) /// this removes all UndoObjects from the stack static void clear(); /// @returns true if the undo stack is in a clean state, i.e. there are /// no changes since the last save. static bool isClean(); /// Push the UndoCommand on to the UndoStack and delist it from the /// currently active undo commands. static void push(AbstractUndoCommand *anAUCPtr); /// This is a notification that the UndoCommand is deleted and /// no longer exists - delist it from the /// currently active undo commands. static void notifyGone(AbstractUndoCommand *anAUCPtr); static QAction *createRedoAction ( QObject *parent, const QString &prefix = QString() ); static QAction *createUndoAction ( QObject *parent, const QString &prefix = QString() ); public slots: static void setClean(); private: /// private constructor - this is a singleton class! explicit UndoSingleton(void); /// @returns pointer to the existing singleton. static UndoSingleton *me(void); // no copy constructor or assignment operators here! Q_DISABLE_COPY ( UndoSingleton ) QUndoStack theUndoStack; friend class UndoObject; }; #endif // UNDOSINGLETON_H
/* ************************************************************************* * Ralink Tech Inc. * 5F., No.36, Taiyuan St., Jhubei City, * Hsinchu County 302, * Taiwan, R.O.C. * * (c) Copyright 2002-2010, Ralink Technology, 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. * * * * 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. * * * *************************************************************************/ #ifdef RT3070 #include "rt_config.h" #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif /* RTMP_RF_RW_SUPPORT */ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) { int i; UCHAR RFValue; /* Driver must read EEPROM to get RfIcType before initial RF registers Initialize RF register to default value */ if (IS_RT3070(pAd) || IS_RT3071(pAd)) { /* Init RF calibration Driver should toggle RF R30 bit7 before init RF registers */ UINT8 RfReg = 0; UINT32 data; RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); RfReg |= 0x80; RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); RTMPusecDelay(1000); RfReg &= 0x7F; RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); /* set default antenna as main */ if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); /* Initialize RF register to default value */ for (i = 0; i < NUM_RF_3020_REG_PARMS; i++) { RT30xxWriteRFRegister(pAd, RT3020_RFRegTable[i].Register, RT3020_RFRegTable[i].Value); } RT30xxWriteRFRegister(pAd, RF_R31, 0x14); /* add by johnli */ if (IS_RT3070(pAd)) { /* The DAC issue(LDO_CFG0) has been fixed in RT3070(F). The voltage raising patch is no longer needed for RT3070(F) */ if ((pAd->MACVersion & 0xffff) < 0x0201) { /* Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate */ RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xF0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); } } else if (IS_RT3071(pAd)) { /* Driver should set RF R6 bit6 on before init RF registers */ RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); RfReg |= 0x40; RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); /* RT3071 version E has fixed this issue */ if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) { /* patch tx EVM issue temporarily */ RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); } else { RTMP_IO_READ32(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x01000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, data); } /* patch LNA_PE_G1 failed issue */ RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data); data &= ~(0x20); RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data); } /* For RF filter Calibration */ RTMPFilterCalibration(pAd); /* Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). Raising RF voltage is no longer needed for RT3070(F) */ if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); } else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); } /* set led open drain enable */ RTUSBReadMACRegister(pAd, OPT_14, &data); data |= 0x01; RTUSBWriteMACRegister(pAd, OPT_14, data); if (IS_RT3071(pAd)) { /* RF power sequence setup, load RF normal operation-mode setup */ RT30xxLoadRFNormalModeSetup(pAd); } else if (IS_RT3070(pAd)) { /* TX_LO1_en, RF R17 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R17, &RFValue); RFValue &= (~0x08); /* to fix rx long range issue */ if (pAd->NicConfig2.field.ExternalLNAForG == 0) { if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd)) { RFValue |= 0x20; } } /* set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h */ if (pAd->TxMixerGain24G >= 1) { RFValue &= (~0x7); /* clean bit [2:0] */ RFValue |= pAd->TxMixerGain24G; } RT30xxWriteRFRegister(pAd, RF_R17, RFValue); /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */ /* LDORF_VC, RF R27 register Bit 2 to 0 */ RT30xxReadRFRegister(pAd, RF_R27, &RFValue); /* TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). Raising RF voltage is no longer needed for RT3070(F) */ if ((pAd->MACVersion & 0xffff) < 0x0201) RFValue = (RFValue & (~0x77)) | 0x3; else RFValue = (RFValue & (~0x77)); RT30xxWriteRFRegister(pAd, RF_R27, RFValue); /* end johnli */ } } } #endif /* RT3070 */
/* * Copyright (c) 2014 Broadcom Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/netdevice.h> #include <linux/module.h> #include <brcm_hw_ids.h> #include "core.h" #include "bus.h" #include "debug.h" #include "fwil.h" #include "feature.h" /* Module param feature_disable (global for all devices) */ static int brcmf_feature_disable; module_param_named(feature_disable, brcmf_feature_disable, int, 0); MODULE_PARM_DESC(feature_disable, "Disable features"); /* * expand feature list to array of feature strings. */ #define BRCMF_FEAT_DEF(_f) \ #_f, static const char *brcmf_feat_names[] = { BRCMF_FEAT_LIST }; #undef BRCMF_FEAT_DEF #ifdef DEBUG /* * expand quirk list to array of quirk strings. */ #define BRCMF_QUIRK_DEF(_q) \ #_q, static const char * const brcmf_quirk_names[] = { BRCMF_QUIRK_LIST }; #undef BRCMF_QUIRK_DEF /** * brcmf_feat_debugfs_read() - expose feature info to debugfs. * * @seq: sequence for debugfs entry. * @data: raw data pointer. */ static int brcmf_feat_debugfs_read(struct seq_file *seq, void *data) { struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); u32 feats = bus_if->drvr->feat_flags; u32 quirks = bus_if->drvr->chip_quirks; int id; seq_printf(seq, "Features: %08x\n", feats); for (id = 0; id < BRCMF_FEAT_LAST; id++) if (feats & BIT(id)) seq_printf(seq, "\t%s\n", brcmf_feat_names[id]); seq_printf(seq, "\nQuirks: %08x\n", quirks); for (id = 0; id < BRCMF_FEAT_QUIRK_LAST; id++) if (quirks & BIT(id)) seq_printf(seq, "\t%s\n", brcmf_quirk_names[id]); return 0; } #else static int brcmf_feat_debugfs_read(struct seq_file *seq, void *data) { return 0; } #endif /* DEBUG */ /** * brcmf_feat_iovar_int_get() - determine feature through iovar query. * * @ifp: interface to query. * @id: feature id. * @name: iovar name. */ static void brcmf_feat_iovar_int_get(struct brcmf_if *ifp, enum brcmf_feat_id id, char *name) { u32 data; int err; err = brcmf_fil_iovar_int_get(ifp, name, &data); if (err == 0) { brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]); ifp->drvr->feat_flags |= BIT(id); } else { brcmf_dbg(TRACE, "%s feature check failed: %d\n", brcmf_feat_names[id], err); } } /** * brcmf_feat_iovar_int_set() - determine feature through iovar set. * * @ifp: interface to query. * @id: feature id. * @name: iovar name. */ static void brcmf_feat_iovar_int_set(struct brcmf_if *ifp, enum brcmf_feat_id id, char *name, u32 val) { int err; err = brcmf_fil_iovar_int_set(ifp, name, val); if (err == 0) { brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]); ifp->drvr->feat_flags |= BIT(id); } else { brcmf_dbg(TRACE, "%s feature check failed: %d\n", brcmf_feat_names[id], err); } } void brcmf_feat_attach(struct brcmf_pub *drvr) { struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan"); brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn"); if (drvr->bus_if->wowl_supported) brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl"); if ((drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID) && (drvr->bus_if->chip != BRCM_CC_4330_CHIP_ID)) brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0); brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p"); if (brcmf_feature_disable) { brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n", ifp->drvr->feat_flags, brcmf_feature_disable); ifp->drvr->feat_flags &= ~brcmf_feature_disable; } /* set chip related quirks */ switch (drvr->bus_if->chip) { case BRCM_CC_43236_CHIP_ID: drvr->chip_quirks |= BIT(BRCMF_FEAT_QUIRK_AUTO_AUTH); break; case BRCM_CC_4329_CHIP_ID: drvr->chip_quirks |= BIT(BRCMF_FEAT_QUIRK_NEED_MPC); break; default: /* no quirks */ break; } brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); } bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id) { return (ifp->drvr->feat_flags & BIT(id)); } bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp, enum brcmf_feat_quirk quirk) { return (ifp->drvr->chip_quirks & BIT(quirk)); }
#ifndef IRSSI_CORE_CHAT_PROTOCOLS_H #define IRSSI_CORE_CHAT_PROTOCOLS_H struct _CHAT_PROTOCOL_REC { int id; unsigned int not_initialized:1; unsigned int case_insensitive:1; char *name; char *fullname; char *chatnet; CHATNET_REC *(*create_chatnet) (void); SERVER_SETUP_REC *(*create_server_setup) (void); CHANNEL_SETUP_REC *(*create_channel_setup) (void); SERVER_CONNECT_REC *(*create_server_connect) (void); void (*destroy_server_connect) (SERVER_CONNECT_REC *); SERVER_REC *(*server_init_connect) (SERVER_CONNECT_REC *); void (*server_connect) (SERVER_REC *); CHANNEL_REC *(*channel_create) (SERVER_REC *, const char *, const char *, int); QUERY_REC *(*query_create) (const char *, const char *, int); }; extern GSList *chat_protocols; #define PROTO_CHECK_CAST(object, cast, type_field, id) \ ((cast *) chat_protocol_check_cast(object, \ offsetof(cast, type_field), id)) void *chat_protocol_check_cast(void *object, int type_pos, const char *id); #define CHAT_PROTOCOL(object) \ ((object) == NULL ? chat_protocol_get_default() : \ chat_protocol_find_id((object)->chat_type)) /* Register new chat protocol. */ CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec); /* Unregister chat protocol. */ void chat_protocol_unregister(const char *name); /* Find functions */ int chat_protocol_lookup(const char *name); CHAT_PROTOCOL_REC *chat_protocol_find(const char *name); CHAT_PROTOCOL_REC *chat_protocol_find_id(int id); CHAT_PROTOCOL_REC *chat_protocol_find_net(GHashTable *optlist); /* Default chat protocol to use */ void chat_protocol_set_default(CHAT_PROTOCOL_REC *rec); CHAT_PROTOCOL_REC *chat_protocol_get_default(void); /* Return "unknown chat protocol" record. Used when protocol name is specified but it isn't registered yet. */ CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name); void chat_protocols_init(void); void chat_protocols_deinit(void); #endif
/* ************************************************************************** * Copyright (c) 2014, The Linux Foundation. All rights reserved. * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all copies. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************** */ extern struct Qdisc_ops nss_wfq_qdisc_ops;
/* * Convert integer string representation to an integer. * If an integer doesn't fit into specified type, -E is returned. * * Integer starts with optional sign. * kstrtou*() functions do not accept sign "-". * * Radix 0 means autodetection: leading "0x" implies radix 16, * leading "0" implies radix 8, otherwise radix is 10. * Autodetection hints work after optional sign, but not before. * * If -E is returned, result is not touched. */ #include <linux/ctype.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/math64.h> #include <linux/export.h> #include <linux/types.h> #include <asm/uaccess.h> static inline char _tolower(const char c) { return c | 0x20; } static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) { unsigned long long acc; int ok; if (base == 0) { if (s[0] == '0') { if (_tolower(s[1]) == 'x' && isxdigit(s[2])) base = 16; else base = 8; } else base = 10; } if (base == 16 && s[0] == '0' && _tolower(s[1]) == 'x') s += 2; acc = 0; ok = 0; while (*s) { unsigned int val; if ('0' <= *s && *s <= '9') val = *s - '0'; else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') val = _tolower(*s) - 'a' + 10; else if (*s == '\n' && *(s + 1) == '\0') break; else return -EINVAL; if (val >= base) return -EINVAL; if (acc > div_u64(ULLONG_MAX - val, base)) return -ERANGE; acc = acc * base + val; ok = 1; s++; } if (!ok) return -EINVAL; *res = acc; return 0; } int kstrtoull(const char *s, unsigned int base, unsigned long long *res) { if (s[0] == '+') s++; return _kstrtoull(s, base, res); } EXPORT_SYMBOL(kstrtoull); int kstrtoll(const char *s, unsigned int base, long long *res) { unsigned long long tmp; int rv; if (s[0] == '-') { rv = _kstrtoull(s + 1, base, &tmp); if (rv < 0) return rv; if ((long long)(-tmp) >= 0) return -ERANGE; *res = -tmp; } else { rv = kstrtoull(s, base, &tmp); if (rv < 0) return rv; if ((long long)tmp < 0) return -ERANGE; *res = tmp; } return 0; } EXPORT_SYMBOL(kstrtoll); /* Internal, do not use. */ int _kstrtoul(const char *s, unsigned int base, unsigned long *res) { unsigned long long tmp; int rv; rv = kstrtoull(s, base, &tmp); if (rv < 0) return rv; if (tmp != (unsigned long long)(unsigned long)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(_kstrtoul); /* Internal, do not use. */ int _kstrtol(const char *s, unsigned int base, long *res) { long long tmp; int rv; rv = kstrtoll(s, base, &tmp); if (rv < 0) return rv; if (tmp != (long long)(long)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(_kstrtol); int kstrtouint(const char *s, unsigned int base, unsigned int *res) { unsigned long long tmp; int rv; rv = kstrtoull(s, base, &tmp); if (rv < 0) return rv; if (tmp != (unsigned long long)(unsigned int)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtouint); int kstrtoint(const char *s, unsigned int base, int *res) { long long tmp; int rv; rv = kstrtoll(s, base, &tmp); if (rv < 0) return rv; if (tmp != (long long)(int)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtoint); int kstrtou16(const char *s, unsigned int base, u16 *res) { unsigned long long tmp; int rv; rv = kstrtoull(s, base, &tmp); if (rv < 0) return rv; if (tmp != (unsigned long long)(u16)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtou16); int kstrtos16(const char *s, unsigned int base, s16 *res) { long long tmp; int rv; rv = kstrtoll(s, base, &tmp); if (rv < 0) return rv; if (tmp != (long long)(s16)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtos16); int kstrtou8(const char *s, unsigned int base, u8 *res) { unsigned long long tmp; int rv; rv = kstrtoull(s, base, &tmp); if (rv < 0) return rv; if (tmp != (unsigned long long)(u8)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtou8); int kstrtos8(const char *s, unsigned int base, s8 *res) { long long tmp; int rv; rv = kstrtoll(s, base, &tmp); if (rv < 0) return rv; if (tmp != (long long)(s8)tmp) return -ERANGE; *res = tmp; return 0; } EXPORT_SYMBOL(kstrtos8); #define kstrto_from_user(f, g, type) \ int f(const char __user *s, size_t count, unsigned int base, type *res) \ { \ /* sign, base 2 representation, newline, terminator */ \ char buf[1 + sizeof(type) * 8 + 1 + 1]; \ \ count = min(count, sizeof(buf) - 1); \ if (copy_from_user(buf, s, count)) \ return -EFAULT; \ buf[count] = '\0'; \ return g(buf, base, res); \ } \ EXPORT_SYMBOL(f) kstrto_from_user(kstrtoull_from_user, kstrtoull, unsigned long long); kstrto_from_user(kstrtoll_from_user, kstrtoll, long long); kstrto_from_user(kstrtoul_from_user, kstrtoul, unsigned long); kstrto_from_user(kstrtol_from_user, kstrtol, long); kstrto_from_user(kstrtouint_from_user, kstrtouint, unsigned int); kstrto_from_user(kstrtoint_from_user, kstrtoint, int); kstrto_from_user(kstrtou16_from_user, kstrtou16, u16); kstrto_from_user(kstrtos16_from_user, kstrtos16, s16); kstrto_from_user(kstrtou8_from_user, kstrtou8, u8); kstrto_from_user(kstrtos8_from_user, kstrtos8, s8);
/*--------------------------------------------------------------------*/ /*--- User-mode execve(). priv_ume.h ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2000-2013 Julian Seward jseward@acm.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #if defined(VGO_linux) || defined(VGO_darwin) || defined(VGO_solaris) #ifndef __PRIV_UME_H #define __PRIV_UME_H #include "pub_core_ume.h" // ExeInfo extern Int VG_(do_exec_inner)(const HChar *exe, ExeInfo *info); #if defined(VGO_linux) || defined(VGO_solaris) extern Bool VG_(match_ELF) ( const void *hdr, SizeT len ); extern Int VG_(load_ELF) ( Int fd, const HChar *name, ExeInfo *info ); #elif defined(VGO_darwin) extern Bool VG_(match_macho) ( const void *hdr, SizeT len ); extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info ); #else # error Unknown OS #endif extern Bool VG_(match_script) ( const void *hdr, SizeT len ); extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info ); #endif // __PRIV_UME_H #endif // defined(VGO_linux) || defined(VGO_darwin) || defined(VGO_solaris) /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
/* * message.h * * ShowEQ Distributed under GPL * http://seq.sourceforge.net/ * * Copyright 2002-2003 Zaphod (dohpaz@users.sourceforge.net) * */ #ifndef _MESSAGE_H_ #define _MESSAGE_H_ #include <stdint.h> #include <stddef.h> #include <qstring.h> #include <qdatetime.h> #include <qvaluevector.h> //---------------------------------------------------------------------- // constants const uint32_t ME_InvalidColor = 0x000000FF; //---------------------------------------------------------------------- // enumerated types enum MessageType { MT_Guild = 0, MT_Group = 2, MT_Shout = 3, MT_Auction = 4, MT_OOC = 5, MT_Tell = 7, MT_Say = 8, MT_GMSay = 11, MT_GMTell = 14, MT_Raid = 15, MT_Debug, MT_Info, MT_Warning, MT_General, MT_Motd, MT_System, MT_Money, MT_Random, MT_Emote, MT_Time, MT_Spell, MT_Zone, MT_Inspect, MT_Player, MT_Consider, MT_Alert, MT_Danger, MT_Caution, MT_Hunt, MT_Locate, MT_Max = MT_Locate, }; //---------------------------------------------------------------------- // MessageEntry class MessageEntry { public: MessageEntry(MessageType type, const QDateTime& dateTime, const QDateTime& eqDateTime, const QString& text, uint32_t color = ME_InvalidColor, uint32_t filterFlags = 0); MessageEntry(); ~MessageEntry(); MessageType type() const { return m_type; } const QDateTime& dateTime() const { return m_dateTime; } const QDateTime& eqDateTime() const { return m_eqDateTime; } const QString& text() const { return m_text; } const uint32_t color() const { return m_color; } uint32_t filterFlags() const { return m_filterFlags; } void setFilterFlags(uint32_t filterFlags) { m_filterFlags = filterFlags; } static const QString& messageTypeString(MessageType type); protected: MessageType m_type; QDateTime m_dateTime; QDateTime m_eqDateTime; QString m_text; uint32_t m_color; uint32_t m_filterFlags; static QString s_messageTypeStrings[MT_Max+1]; }; inline MessageEntry::MessageEntry(MessageType type, const QDateTime& dateTime, const QDateTime& eqDateTime, const QString& text, uint32_t color, uint32_t filters) : m_type(type), m_dateTime(dateTime), m_eqDateTime(eqDateTime), m_text(text), m_color(color), m_filterFlags(filters) { } inline MessageEntry::MessageEntry() : m_type(MT_Debug), m_color(0x000000FF), m_filterFlags(0) { } inline MessageEntry::~MessageEntry() { } inline const QString& MessageEntry::messageTypeString(MessageType type) { static QString dummy; if (type <= MT_Max) return s_messageTypeStrings[type]; return dummy; } #endif // _MESSAGE_H_
/* * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). * whowas.c: WHOWAS user cache. * * Copyright (C) 2005 by the past and present ircd coders, and others. * * 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 * * $Id$ */ #include "stdinc.h" #include "whowas.h" #include "client.h" #include "common.h" #include "hash.h" #include "irc_string.h" #include "ircd.h" #include "ircd_defs.h" #include "numeric.h" #include "s_serv.h" #include "s_user.h" #include "send.h" #include "s_conf.h" #include "memory.h" /* internally defined function */ static void add_whowas_to_clist(struct Whowas **, struct Whowas *); static void del_whowas_from_clist(struct Whowas **, struct Whowas *); static void add_whowas_to_list(struct Whowas **, struct Whowas *); static void del_whowas_from_list(struct Whowas **, struct Whowas *); struct Whowas WHOWAS[NICKNAMEHISTORYLENGTH]; struct Whowas *WHOWASHASH[HASHSIZE]; static unsigned int whowas_next = 0; void add_history(struct Client *client_p, int online) { struct Whowas *who = &WHOWAS[whowas_next]; assert(client_p && client_p->servptr); if (who->hashv != -1) { if (who->online) del_whowas_from_clist(&(who->online->whowas),who); del_whowas_from_list(&WHOWASHASH[who->hashv], who); } who->hashv = strhash(client_p->name); who->logoff = CurrentTime; /* NOTE: strcpy ok here, the sizes in the client struct MUST * match the sizes in the whowas struct */ strlcpy(who->name, client_p->name, sizeof(who->name)); strcpy(who->username, client_p->username); strcpy(who->hostname, client_p->host); strcpy(who->realname, client_p->info); strlcpy(who->servername, client_p->servptr->name, sizeof(who->servername)); if (online) { who->online = client_p; add_whowas_to_clist(&(client_p->whowas), who); } else who->online = NULL; add_whowas_to_list(&WHOWASHASH[who->hashv], who); whowas_next++; if (whowas_next == NICKNAMEHISTORYLENGTH) whowas_next = 0; } void off_history(struct Client *client_p) { struct Whowas *temp, *next; for (temp = client_p->whowas; temp; temp=next) { next = temp->cnext; temp->online = NULL; del_whowas_from_clist(&(client_p->whowas), temp); } } struct Client * get_history(const char *nick, time_t timelimit) { struct Whowas *temp; timelimit = CurrentTime - timelimit; temp = WHOWASHASH[strhash(nick)]; for (; temp; temp = temp->next) { if (irccmp(nick, temp->name)) continue; if (temp->logoff < timelimit) continue; return(temp->online); } return(NULL); } void count_whowas_memory(int *wwu, unsigned long *wwum) { struct Whowas *tmp; int i; int u = 0; unsigned long um = 0; /* count the number of used whowas structs in 'u' */ /* count up the memory used of whowas structs in um */ for (i = 0, tmp = &WHOWAS[0]; i < NICKNAMEHISTORYLENGTH; i++, tmp++) { if (tmp->hashv != -1) { u++; um += sizeof(struct Whowas); } } *wwu = u; *wwum = um; } void init_whowas(void) { int i; for (i = 0; i < NICKNAMEHISTORYLENGTH; i++) { memset(&WHOWAS[i], 0, sizeof(struct Whowas)); WHOWAS[i].hashv = -1; } for (i = 0; i < HASHSIZE; ++i) WHOWASHASH[i] = NULL; } static void add_whowas_to_clist(struct Whowas **bucket, struct Whowas *whowas) { whowas->cprev = NULL; if ((whowas->cnext = *bucket) != NULL) whowas->cnext->cprev = whowas; *bucket = whowas; } static void del_whowas_from_clist(struct Whowas **bucket, struct Whowas *whowas) { if (whowas->cprev) whowas->cprev->cnext = whowas->cnext; else *bucket = whowas->cnext; if (whowas->cnext) whowas->cnext->cprev = whowas->cprev; } static void add_whowas_to_list(struct Whowas **bucket, struct Whowas *whowas) { whowas->prev = NULL; if ((whowas->next = *bucket) != NULL) whowas->next->prev = whowas; *bucket = whowas; } static void del_whowas_from_list(struct Whowas **bucket, struct Whowas *whowas) { if (whowas->prev) whowas->prev->next = whowas->next; else *bucket = whowas->next; if (whowas->next) whowas->next->prev = whowas->prev; }
/* ev-previewer.c: * * Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> * * Xreader 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. * * Xreader is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include <gtk/gtk.h> #include <glib/gi18n.h> #include <xreader-document.h> #include <xreader-view.h> #include "ev-previewer-window.h" static gboolean unlink_temp_file = FALSE; static const gchar *print_settings; static const gchar **filenames; static const GOptionEntry goption_options[] = { { "unlink-tempfile", 'u', 0, G_OPTION_ARG_NONE, &unlink_temp_file, N_("Delete the temporary file"), NULL }, { "print-settings", 'p', 0, G_OPTION_ARG_FILENAME, &print_settings, N_("Print settings file"), N_("FILE") }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL, N_("FILE") }, { NULL } }; static void ev_previewer_unlink_tempfile (const gchar *filename) { GFile *file, *tempdir; file = g_file_new_for_path (filename); tempdir = g_file_new_for_path (g_get_tmp_dir ()); if (g_file_has_prefix (file, tempdir)) { g_file_delete (file, NULL, NULL); } g_object_unref (file); g_object_unref (tempdir); } static void ev_previewer_load_job_finished (EvJob *job, EvDocumentModel *model) { if (ev_job_is_failed (job)) { g_warning ("%s", job->error->message); g_object_unref (job); return; } ev_document_model_set_document (model, job->document); g_object_unref (job); } static void ev_previewer_load_document (const gchar *filename, EvDocumentModel *model) { EvJob *job; gchar *uri; GFile *file; file = g_file_new_for_commandline_arg (filename); uri = g_file_get_uri (file); g_object_unref (file); job = ev_job_load_new (uri); g_signal_connect (job, "finished", G_CALLBACK (ev_previewer_load_job_finished), model); ev_job_scheduler_push_job (job, EV_JOB_PRIORITY_NONE); g_free (uri); } gint main (gint argc, gchar **argv) { GtkWidget *window; GOptionContext *context; const gchar *filename; EvDocumentModel *model; GError *error = NULL; /* Initialize the i18n stuff */ bindtextdomain (GETTEXT_PACKAGE, XREADER_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (_("Print Preview")); g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_warning ("Error parsing command line arguments: %s", error->message); g_error_free (error); g_option_context_free (context); return 1; } g_option_context_free (context); if (!filenames) { g_warning ("File argument is required"); return 1; } filename = filenames[0]; if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { g_warning ("Filename \"%s\" does not exist or is not a regular file", filename); return 1; } if (!ev_init ()) return 1; ev_stock_icons_init (); g_set_application_name (_("Print Preview")); gtk_window_set_default_icon_name ("xreader"); model = ev_document_model_new (); window = ev_previewer_window_new (model); ev_previewer_window_set_source_file (EV_PREVIEWER_WINDOW (window), filename); ev_previewer_window_set_print_settings (EV_PREVIEWER_WINDOW (window), print_settings); g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show (window); ev_previewer_load_document (filename, model); gtk_main (); if (unlink_temp_file) ev_previewer_unlink_tempfile (filename); if (print_settings) ev_previewer_unlink_tempfile (print_settings); ev_shutdown (); ev_stock_icons_shutdown (); g_object_unref (model); return 0; }
/* * Copyright (c) 2015 Grzegorz Kostka (kostka.grzegorz@gmail.com) * Copyright (c) 2015 Kaho Ng (ngkaho1234@gmail.com) * * 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. * - 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. */ /** @addtogroup lwext4 * @{ */ /** * @file ext4_xattr.h * @brief Extended Attribute manipulation. */ #ifndef EXT4_XATTR_H_ #define EXT4_XATTR_H_ #ifdef __cplusplus extern "C" { #endif #include <ext4_config.h> #include <ext4_types.h> #include <ext4_inode.h> struct ext4_xattr_info { uint8_t name_index; const char *name; size_t name_len; const void *value; size_t value_len; }; struct ext4_xattr_list_entry { uint8_t name_index; char *name; size_t name_len; struct ext4_xattr_list_entry *next; }; struct ext4_xattr_search { /* The first entry in the buffer */ struct ext4_xattr_entry *first; /* The address of the buffer */ void *base; /* The first inaccessible address */ void *end; /* The current entry pointer */ struct ext4_xattr_entry *here; /* Entry not found */ bool not_found; }; const char *ext4_extract_xattr_name(const char *full_name, size_t full_name_len, uint8_t *name_index, size_t *name_len, bool *found); const char *ext4_get_xattr_name_prefix(uint8_t name_index, size_t *ret_prefix_len); int ext4_xattr_list(struct ext4_inode_ref *inode_ref, struct ext4_xattr_list_entry *list, size_t *list_len); int ext4_xattr_get(struct ext4_inode_ref *inode_ref, uint8_t name_index, const char *name, size_t name_len, void *buf, size_t buf_len, size_t *data_len); int ext4_xattr_remove(struct ext4_inode_ref *inode_ref, uint8_t name_index, const char *name, size_t name_len); int ext4_xattr_set(struct ext4_inode_ref *inode_ref, uint8_t name_index, const char *name, size_t name_len, const void *value, size_t value_len); #ifdef __cplusplus } #endif #endif /** * @} */
/* Copyright 2013 David Axmark Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @file VariantResourceLookup.h * @author Florin Leu * @date 22 Nov 2011 * * @brief Class that stores all the variants. * **/ #ifndef __VARIANTRESOURCELOOKUP_H__ #define __VARIANTRESOURCELOOKUP_H__ #include <ma.h> #include <mastring.h> #include "rescompdefines.h" namespace ResourceCompiler { class ResourceSetLookup; class VariantResourceLookup { public: VariantResourceLookup(); ~VariantResourceLookup(); void countResources(); void readVariantMapping(MAHandle handle); void readResourceTypes(MAHandle handle); bool checkVariant(char* variant); void pickResources(); MAHandle getSmartHandle(MAHandle handle); void loadResource(MAHandle handle, byte flag = MA_RESOURCE_OPEN|MA_RESOURCE_CLOSE); void unloadResource(MAHandle handle); void loadResources(bool checkDelayed); private: // The number of variants that has specific resource sets byte numberOfVariants; // The number of resources short numberOfResources; // The number of resources that may have variants. The // resources in the index range [1,(numberOfVariantResources + 1] // are variant resources, the rest are not. short numberOfVariantResources; // The length for each ResourceSetLookup short* resourceSetLookupLengths; // The lookup tables themselves (variable size) ResourceSetLookup** lookupTable; byte* resourceTypes; short* resourceSmartHandles; }; } #endif //__VARIANTRESOURCELOOKUP_H__
/* This file is part of libvcard. Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GEOVALUE_H #define GEOVALUE_H #include <VCardValue.h> namespace VCARD { class KVCARD_EXPORT GeoValue : public Value { #include "GeoValue-generated.h" GeoValue *clone(); void setLatitude( float lat ) { latitude_ = lat; assembled_ = false; } void setLongitude( float lon ) { longitude_ = lon; assembled_ = false; } float latitude() { parse(); return latitude_; } float longitude() { parse(); return longitude_; } private: float latitude_; float longitude_; }; } #endif
#include "libbb.h" #define URANDOM_DEV "/dev/urandom" static char hex_chars[]= "0123456789abcdef"; char *atlas_name_macro(char *str) { unsigned char c; int i, fd; size_t len; char *p, *in, *out; char buf[256]; unsigned char random_buf[8]; p= strchr(str, '$'); if (p == NULL) return strdup(str); in= str; out= buf; while (*in) { p= strchr(in, '$'); if (p == NULL) { strlcpy(out, in, buf+sizeof(buf)-out); break; } if (p != in) { len= p-in; if (len+1 > buf+sizeof(buf)-out) return NULL; memcpy(out, in, len); out[len]= '\0'; out += len; } switch(p[1]) { case 'p': snprintf(out, buf+sizeof(buf)-out, "%d", get_probe_id()); break; case 't': snprintf(out, buf+sizeof(buf)-out, "%ld", (long)time(NULL)); break; case 'r': /* We need to hex digits per byte in random_buf */ if (sizeof(random_buf)*2+1 > buf+sizeof(buf)-out) return NULL; fd= open(URANDOM_DEV, O_RDONLY); /* Best effort, just ignore errors */ if (fd != -1) { read(fd, random_buf, sizeof(random_buf)); close(fd); } for (i= 0; i<sizeof(random_buf); i++) { c= random_buf[i]; out[0]= hex_chars[(c >> 4) & 0xf]; out[1]= hex_chars[c & 0xf]; out += 2; } out[0]= '\0'; break; default: return NULL; } in= p+2; out += strlen(out); } return strdup(buf); }
/* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2016 - 2018 Cavium Inc. * All rights reserved. * www.cavium.com */ #ifndef __ECORE_PROTO_IF_H__ #define __ECORE_PROTO_IF_H__ /* * PF parameters (according to personality/protocol) */ #define ECORE_ROCE_PROTOCOL_INDEX (3) struct ecore_eth_pf_params { /* The following parameters are used during HW-init * and these parameters need to be passed as arguments * to update_pf_params routine invoked before slowpath start */ u16 num_cons; /* per-VF number of CIDs */ u8 num_vf_cons; #define ETH_PF_PARAMS_VF_CONS_DEFAULT (32) /* To enable arfs, previous to HW-init a positive number needs to be * set [as filters require allocated searcher ILT memory]. * This will set the maximal number of configured steering-filters. */ u32 num_arfs_filters; /* To allow VF to change its MAC despite of PF set forced MAC. */ bool allow_vf_mac_change; }; /* Most of the parameters below are described in the FW iSCSI / TCP HSI */ struct ecore_iscsi_pf_params { u64 glbl_q_params_addr; u64 bdq_pbl_base_addr[2]; u16 cq_num_entries; u16 cmdq_num_entries; u32 two_msl_timer; u16 tx_sws_timer; /* The following parameters are used during HW-init * and these parameters need to be passed as arguments * to update_pf_params routine invoked before slowpath start */ u16 num_cons; u16 num_tasks; /* The following parameters are used during protocol-init */ u16 half_way_close_timeout; u16 bdq_xoff_threshold[2]; u16 bdq_xon_threshold[2]; u16 cmdq_xoff_threshold; u16 cmdq_xon_threshold; u16 rq_buffer_size; u8 num_sq_pages_in_ring; u8 num_r2tq_pages_in_ring; u8 num_uhq_pages_in_ring; u8 num_queues; u8 log_page_size; u8 rqe_log_size; u8 max_fin_rt; u8 gl_rq_pi; u8 gl_cmd_pi; u8 debug_mode; u8 ll2_ooo_queue_id; u8 ooo_enable; u8 is_target; u8 bdq_pbl_num_entries[2]; u8 disable_stats_collection; }; enum ecore_rdma_protocol { ECORE_RDMA_PROTOCOL_DEFAULT, ECORE_RDMA_PROTOCOL_ROCE, ECORE_RDMA_PROTOCOL_IWARP, }; struct ecore_rdma_pf_params { /* Supplied to ECORE during resource allocation (may affect the ILT and * the doorbell BAR). */ u32 min_dpis; /* number of requested DPIs */ u32 num_mrs; /* number of requested memory regions*/ u32 num_qps; /* number of requested Queue Pairs */ u32 num_srqs; /* number of requested SRQ */ u8 roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */ u8 gl_pi; /* protocol index */ /* Will allocate rate limiters to be used with QPs */ u8 enable_dcqcn; /* TCP port number used for the iwarp traffic */ u16 iwarp_port; enum ecore_rdma_protocol rdma_protocol; }; struct ecore_pf_params { struct ecore_eth_pf_params eth_pf_params; struct ecore_iscsi_pf_params iscsi_pf_params; struct ecore_rdma_pf_params rdma_pf_params; }; #endif
/* * QEMU Host Memory Backend * * Copyright (C) 2013-2014 Red Hat Inc * * Authors: * Igor Mammedov <imammedo@redhat.com> * * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ #ifndef QEMU_RAM_H #define QEMU_RAM_H #include "sysemu/sysemu.h" /* for MAX_NODES */ #include "qom/object.h" #include "exec/memory.h" #include "qemu/option.h" #include "qemu/bitmap.h" #define TYPE_MEMORY_BACKEND "memory-backend" #define MEMORY_BACKEND(obj) \ OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND) #define MEMORY_BACKEND_GET_CLASS(obj) \ OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND) #define MEMORY_BACKEND_CLASS(klass) \ OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND) typedef struct HostMemoryBackend HostMemoryBackend; typedef struct HostMemoryBackendClass HostMemoryBackendClass; /** * HostMemoryBackendClass: * @parent_class: opaque parent class container */ struct HostMemoryBackendClass { ObjectClass parent_class; void (*alloc)(HostMemoryBackend *backend, Error **errp); }; /** * @HostMemoryBackend * * @parent: opaque parent object container * @size: amount of memory backend provides * @id: unique identification string in memdev namespace * @mr: MemoryRegion representing host memory belonging to backend */ struct HostMemoryBackend { /* private */ Object parent; /* protected */ uint64_t size; bool merge, dump; bool prealloc, force_prealloc; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); HostMemPolicy policy; MemoryRegion mr; }; MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend, Error **errp); #endif
/* serial.c written by Marc Singer 14 Jan 2005 Copyright (C) 2005 Marc Singer 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. Please refer to the file debian/copyright for further details. ----------- DESCRIPTION ----------- Serial driver for the ixp42x UARTs. These appear to be variants of the pl010 PrimeCell. o Need to be careful with the includes. Don't include <debug_ll.h> before the uart register macros as it will interfere with them. Yes, I could also put them in a shared header, I won't do that for the sake of a debug feature. */ #include <config.h> #include <driver.h> #include <service.h> #include "hardware.h" #define UART_DR __REG(UART_PHYS + 0x00) #define UART_DLL __REG(UART_PHYS + 0x00) #define UART_DLH __REG(UART_PHYS + 0x04) #define UART_IER __REG(UART_PHYS + 0x04) /* Interrupt enable */ #define UART_FCR __REG(UART_PHYS + 0x08) /* FIFO control */ #define UART_LCR __REG(UART_PHYS + 0x0c) /* Line control */ #define UART_MCR __REG(UART_PHYS + 0x1c) /* Modem control */ #define UART_LSR __REG(UART_PHYS + 0x14) /* Line status */ #define UART_ISR __REG(UART_PHYS + 0X20) /* Interrupt status */ #define UART_SEC_IER __REG(UART_SEC_PHYS + 0x04) /* UART enable */ #define UART_IER_UUE (1<<6) #define UART_LCR_DLAB (1<<7) #define UART_LCR_WLS_8 (0x3<<0) #define UART_LCR_STB_1 (0<<2) #define UART_FCR_RESETTF (1<<2) #define UART_FCR_RESETRF (1<<1) #define UART_FCR_TRFIFOE (1<<0) #define UART_MCR_RTS (1<<1) #define UART_LSR_TEMT (1<<6) #define UART_LSR_TDRQ (1<<5) #define UART_LSR_FE (1<<3) #define UART_LSR_PE (1<<2) #define UART_LSR_OE (1<<1) #define UART_LSR_DR (1<<0) #define CLK ((uint32_t)(14.7456*1000*1000)) void ixp42x_serial_init (void) { static const uint32_t baudrate = 115200; uint32_t divisor; _L(LED5); divisor = (CLK/baudrate)>>4; _L(LED6); UART_LCR = UART_LCR_WLS_8 | UART_LCR_STB_1 | UART_LCR_DLAB; UART_DLL = divisor & 0xff; UART_DLH = (divisor >> 8) & 0xff; UART_LCR = UART_LCR_WLS_8 | UART_LCR_STB_1; UART_FCR = UART_FCR_TRFIFOE; UART_IER = UART_IER_UUE; /* Enable UART, mask all interrupts */ /* Clear interrupts? */ UART_MCR = UART_MCR_RTS; /* Assert RTS in case someone uses it */ _L(LED7); _L(LED8); #if !defined (DISABLE_SECOND_UART_INIT) UART_SEC_IER = UART_IER_UUE; /* Enable second UART as well */ #endif } ssize_t ixp42x_serial_poll (struct descriptor_d* d, size_t cb) { return cb ? ((UART_LSR & UART_LSR_DR) ? 1 : 0) : 0; } ssize_t ixp42x_serial_read (struct descriptor_d* d, void* pv, size_t cb) { ssize_t cRead = 0; unsigned char* pb; for (pb = (unsigned char*) pv; cb--; ++pb) { u32 v; while ((UART_LSR & UART_LSR_DR) == 0) ; /* block until character is available */ v = UART_DR; if (UART_LSR & (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE)) return -1; /* -ESERIAL */ *pb = v; ++cRead; } return cRead; } ssize_t ixp42x_serial_write (struct descriptor_d* d, const void* pv, size_t cb) { ssize_t cWrote = 0; const unsigned char* pb = pv; for (pb = (unsigned char*) pv; cb--; ++pb) { while (!(UART_LSR & UART_LSR_TDRQ)) ; UART_DR = *pb; ++cWrote; } /* Wait for completion */ while (!(UART_LSR & UART_LSR_TEMT)) ; return cWrote; } static __driver_0 struct driver_d ixp42x_serial_driver = { .name = "serial-ixp42x", .description = "ixp42x serial driver", .flags = DRIVER_SERIAL | DRIVER_CONSOLE, .open = open_helper, /* Always succeed */ .close = close_helper, .read = ixp42x_serial_read, .write = ixp42x_serial_write, .poll = ixp42x_serial_poll, }; static __service_3 struct service_d ixp42x_serial_service = { .init = ixp42x_serial_init, };
/************************************************************************ COPYRIGHT (C) SGS-THOMSON Microelectronics 2006 Source file name : collator_pes_audio_mpeg.h Author : Daniel Definition of the base collator pes class implementation for player 2. Date Modification Name ---- ------------ -------- 19-Apr-07 Created from existing collator_pes_video.h Daniel ************************************************************************/ #ifndef H_COLLATOR_PES_AUDIO_MPEG #define H_COLLATOR_PES_AUDIO_MPEG // ///////////////////////////////////////////////////////////////////// // // Include any component headers #include "collator_pes_audio.h" // ///////////////////////////////////////////////////////////////////////// // // Locally defined structures // // ///////////////////////////////////////////////////////////////////////// // // The class definition // class Collator_PesAudioMpeg_c : public Collator_PesAudio_c { protected: CollatorStatus_t FindNextSyncWord( int *CodeOffset ); CollatorStatus_t DecideCollatorNextStateAndGetLength( unsigned int *FrameLength ); void SetPesPrivateDataLength(unsigned char SpecificCode); public: Collator_PesAudioMpeg_c(); CollatorStatus_t Reset( void ); }; #endif // H_COLLATOR_PES_AUDIO_MPEG
/* * linux/include/asm-sh/microdev.h * * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com) * * Definitions for the SuperH SH4-202 MicroDev board. * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. */ #ifndef __ASM_SH_MICRODEV_H #define __ASM_SH_MICRODEV_H extern void init_microdev_irq(void); extern void microdev_print_fpga_intc_status(void); /* * The following are useful macros for manipulating the interrupt * controller (INTC) on the CPU-board FPGA. should be noted that there * is an INTC on the FPGA, and a separate INTC on the SH4-202 core - * these are two different things, both of which need to be prorammed to * correctly route - unfortunately, they have the same name and * abbreviations! */ #define MICRODEV_FPGA_INTC_BASE 0xa6110000ul /* INTC base address on CPU-board FPGA */ #define MICRODEV_FPGA_INTENB_REG (MICRODEV_FPGA_INTC_BASE+0ul) /* Interrupt Enable Register on INTC on CPU-board FPGA */ #define MICRODEV_FPGA_INTDSB_REG (MICRODEV_FPGA_INTC_BASE+8ul) /* Interrupt Disable Register on INTC on CPU-board FPGA */ #define MICRODEV_FPGA_INTC_MASK(n) (1ul<<(n)) /* Interrupt mask to enable/disable INTC in CPU-board FPGA */ #define MICRODEV_FPGA_INTPRI_REG(n) (MICRODEV_FPGA_INTC_BASE+0x10+((n)/8)*8)/* Interrupt Priority Register on INTC on CPU-board FPGA */ #define MICRODEV_FPGA_INTPRI_LEVEL(n,x) ((x)<<(((n)%8)*4)) /* MICRODEV_FPGA_INTPRI_LEVEL(int_number, int_level) */ #define MICRODEV_FPGA_INTPRI_MASK(n) (MICRODEV_FPGA_INTPRI_LEVEL((n),0xful)) /* Interrupt Priority Mask on INTC on CPU-board FPGA */ #define MICRODEV_FPGA_INTSRC_REG (MICRODEV_FPGA_INTC_BASE+0x30ul) /* Interrupt Source Register on INTC on CPU-board FPGA */ #define MICRODEV_FPGA_INTREQ_REG (MICRODEV_FPGA_INTC_BASE+0x38ul) /* Interrupt Request Register on INTC on CPU-board FPGA */ /* * The following are the IRQ numbers for the Linux Kernel for external * interrupts. i.e. the numbers seen by 'cat /proc/interrupt'. */ #define MICRODEV_LINUX_IRQ_KEYBOARD 1 /* SuperIO Keyboard */ #define MICRODEV_LINUX_IRQ_SERIAL1 2 /* SuperIO Serial #1 */ #define MICRODEV_LINUX_IRQ_ETHERNET 3 /* on-board Ethnernet */ #define MICRODEV_LINUX_IRQ_SERIAL2 4 /* SuperIO Serial #2 */ #define MICRODEV_LINUX_IRQ_USB_HC 7 /* on-board USB HC */ #define MICRODEV_LINUX_IRQ_MOUSE 12 /* SuperIO PS/2 Mouse */ #define MICRODEV_LINUX_IRQ_IDE2 13 /* SuperIO IDE #2 */ #define MICRODEV_LINUX_IRQ_IDE1 14 /* SuperIO IDE #1 */ /* * The following are the IRQ numbers for the INTC on the FPGA for * external interrupts. i.e. the bits in the INTC registers in the * FPGA. */ #define MICRODEV_FPGA_IRQ_KEYBOARD 1 /* SuperIO Keyboard */ #define MICRODEV_FPGA_IRQ_SERIAL1 3 /* SuperIO Serial #1 */ #define MICRODEV_FPGA_IRQ_SERIAL2 4 /* SuperIO Serial #2 */ #define MICRODEV_FPGA_IRQ_MOUSE 12 /* SuperIO PS/2 Mouse */ #define MICRODEV_FPGA_IRQ_IDE1 14 /* SuperIO IDE #1 */ #define MICRODEV_FPGA_IRQ_IDE2 15 /* SuperIO IDE #2 */ #define MICRODEV_FPGA_IRQ_USB_HC 16 /* on-board USB HC */ #define MICRODEV_FPGA_IRQ_ETHERNET 18 /* on-board Ethnernet */ #define MICRODEV_IRQ_PCI_INTA 8 #define MICRODEV_IRQ_PCI_INTB 9 #define MICRODEV_IRQ_PCI_INTC 10 #define MICRODEV_IRQ_PCI_INTD 11 #define __IO_PREFIX microdev #include <asm/io_generic.h> #endif /* __ASM_SH_MICRODEV_H */
#include <stdio.h> #include <stdlib.h> #include "msg.h" #include "config.h" #include "net.h" #include "netsetup.h" extern int sensor_pid; void net_send(float relhum, float relhum_temp, float temperature) { static int seq = 0; sense_data_t sensor_data; sensor_data.id = CONFIG_OWN_ADDRESS; sensor_data.seq = seq++; sensor_data.humidity = (uint32_t) (relhum * 1000); sensor_data.temperature = (uint32_t) (temperature * 1000); int size = sizeof(sense_data_t); char *data = (char *)&sensor_data; netsetup_send_to(CONFIG_SINK, data, size); vtimer_usleep(10 * 1000); } void net_receive(char *data, int length) { #if 0 net_cmd_t *cmd; msg_t msg; if (length == sizeof(net_cmd_t)) { cmd = (net_cmd_t*)data; printf("net: got command - player: %i; msg: %i; content: %i\n", cmd->player, cmd->msg, cmd->value); msg.type = cmd->msg; msg.content.value = (uint32_t)cmd->value; msg_send(&msg, game_pid, 1); } #endif }
/* $Id: _cdio_stdio.h,v 1.2 2005/01/20 01:00:52 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003 Rocky Bernstein <rocky@panix.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 __CDIO_STDIO_H__ #define __CDIO_STDIO_H__ #include "_cdio_stream.h" /*! Initialize a new stdio stream reading from pathname. A pointer to the stream is returned or NULL if there was an error. cdio_stream_free should be called on the returned value when you don't need the stream any more. No other finalization is needed. */ CdioDataSource_t * cdio_stdio_new(const char psz_path[]); /*! Deallocate resources assocaited with obj. After this obj is unusable. */ void cdio_stdio_destroy(CdioDataSource_t *p_obj); #endif /* __CDIO_STREAM_STDIO_H__ */ /* * Local variables: * c-file-style: "gnu" * tab-width: 8 * indent-tabs-mode: nil * End: */
/* Copyright (c) 2002-2011 by XMLVM.org * * Project Info: http://www.xmlvm.org * * 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 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. */ #import "xmlvm.h" #import "org_xmlvm_iphone_CGPoint.h" #import "org_xmlvm_iphone_UIView.h" #import "org_xmlvm_iphone_UIWindow.h" // UITouch //---------------------------------------------------------------------------- typedef UITouch org_xmlvm_iphone_UITouch; @interface UITouch (cat_org_xmlvm_iphone_UITouch) - (org_xmlvm_iphone_CGPoint*) locationInView___org_xmlvm_iphone_UIView :(org_xmlvm_iphone_UIView*) view; - (org_xmlvm_iphone_UIView*) getView__; - (int) getPhase__; - (int) getTapCount__; - (double) getTimestamp__; - (org_xmlvm_iphone_UIWindow*) getWindow__; @end
#ifndef __SHNOMMU_MMAN_H__ #define __SHNOMMU_MMAN_H__ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ #define PROT_NONE 0x0 /* page can not be accessed */ #define MAP_SHARED 0x01 /* Share changes */ #define MAP_PRIVATE 0x02 /* Changes are private */ #define MAP_TYPE 0x0f /* Mask for type of mapping */ #define MAP_FIXED 0x10 /* Interpret addr exactly */ #define MAP_ANONYMOUS 0x20 /* don't use a file */ #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as a executable */ #define MAP_LOCKED 0x2000 /* pages are locked */ #define MS_ASYNC 1 /* sync memory asynchronously */ #define MS_INVALIDATE 2 /* invalidate the caches */ #define MS_SYNC 4 /* synchronous memory sync */ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ /* compatibility flags */ #define MAP_ANON MAP_ANONYMOUS #define MAP_FILE 0 #endif /* __SHNOMMU_MMAN_H__ */
/* * xrick/src/scr_xrick.c * * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved. * * The use and distribution terms for this software are contained in the file * named README, which can be found in the root of this distribution. By * using this software in any fashion, you are agreeing to be bound by the * terms of this license. * * You must not remove this notice, or any other, from this software. */ #include "system.h" #include "game.h" #include "screens.h" #include "draw.h" #include "control.h" #include "img.h" #include "img_splash.e" /* * Display XRICK splash screen * * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT */ U8 screen_xrick(void) { static U8 seq = 0; static U8 wait = 0; if (seq == 0) { sysvid_clear(); draw_img(IMG_SPLASH); game_rects = &draw_SCREENRECT; seq = 1; } switch (seq) { case 1: /* wait */ if (wait++ > 0x2) { #ifdef ENABLE_SOUND game_setmusic("sounds/bullet.wav", 1); #endif seq = 2; wait = 0; } break; case 2: /* wait */ if (wait++ > 0x20) { seq = 99; wait = 0; } } if (control_status & CONTROL_EXIT) /* check for exit request */ return SCREEN_EXIT; if (seq == 99) { /* we're done */ sysvid_clear(); sysvid_setGamePalette(); seq = 0; return SCREEN_DONE; } return SCREEN_RUNNING; } /* eof */
#ifndef MYSQL_PLUGIN_AUTH_INCLUDED /* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab Copyright (c) 2010, Oracle and/or its affiliates. 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-1335 USA */ /** @file Authentication Plugin API. This file defines the API for server authentication plugins. */ #define MYSQL_PLUGIN_AUTH_INCLUDED #include <mysql/plugin.h> #define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0202 #include <mysql/plugin_auth_common.h> #ifdef __cplusplus extern "C" { #endif /* defines for MYSQL_SERVER_AUTH_INFO.password_used */ #define PASSWORD_USED_NO 0 #define PASSWORD_USED_YES 1 #define PASSWORD_USED_NO_MENTION 2 /** Provides server plugin access to authentication information */ typedef struct st_mysql_server_auth_info { /** User name as sent by the client and shown in USER(). NULL if the client packet with the user name was not received yet. */ const char *user_name; /** Length of user_name */ unsigned int user_name_length; /** A corresponding column value from the mysql.user table for the matching account name or the preprocessed value, if preprocess_hash method is not NULL */ const char *auth_string; /** Length of auth_string */ unsigned long auth_string_length; /** Matching account name as found in the mysql.user table. A plugin can override it with another name that will be used by MySQL for authorization, and shown in CURRENT_USER() */ char authenticated_as[MYSQL_USERNAME_LENGTH+1]; /** The unique user name that was used by the plugin to authenticate. Not used by the server. Available through the @@EXTERNAL_USER variable. */ char external_user[MYSQL_USERNAME_LENGTH+1]; /** This only affects the "Authentication failed. Password used: %s" error message. has the following values : 0 : %s will be NO. 1 : %s will be YES. 2 : there will be no %s. Set it as appropriate or ignore at will. */ int password_used; /** Set to the name of the connected client host, if it can be resolved, or to its IP address otherwise. */ const char *host_or_ip; /** Length of host_or_ip */ unsigned int host_or_ip_length; /** Current THD pointer (to use with various services) */ MYSQL_THD thd; } MYSQL_SERVER_AUTH_INFO; /** Server authentication plugin descriptor */ struct st_mysql_auth { int interface_version; /**< version plugin uses */ /** A plugin that a client must use for authentication with this server plugin. Can be NULL to mean "any plugin". */ const char *client_auth_plugin; /** Function provided by the plugin which should perform authentication (using the vio functions if necessary) and return 0 if successful. The plugin can also fill the info.authenticated_as field if a different username should be used for authorization. */ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); /** Create a password hash (or digest) out of a plain-text password Used in SET PASSWORD, GRANT, and CREATE USER to convert user specified plain-text password into a value that will be stored in mysql.user table. @see preprocess_hash @param password plain-text password @param password_length plain-text password length @param hash the digest will be stored there @param hash_length in: hash buffer size out: the actual length of the hash @return 0 for ok, 1 for error Can be NULL, in this case one will not be able to use SET PASSWORD or PASSWORD('...') in GRANT, CREATE USER, ALTER USER. */ int (*hash_password)(const char *password, size_t password_length, char *hash, size_t *hash_length); /** Prepare the password hash for authentication. Password hash is stored in the authentication_string column of the mysql.user table in a text form. If a plugin needs to preprocess the value somehow before the authentication (e.g. convert from hex or base64 to binary), it can do it in this method. This way the conversion will happen only once, not for every authentication attempt. The value written to the out buffer will be cached and later made available to the authenticate_user() method in the MYSQL_SERVER_AUTH_INFO::auth_string[] buffer. @return 0 for ok, 1 for error Can be NULL, in this case the mysql.user.authentication_string value will be given to the authenticate_user() method as is, unconverted. */ int (*preprocess_hash)(const char *hash, size_t hash_length, unsigned char *out, size_t *out_length); }; #ifdef __cplusplus } #endif #endif
/******************************************************************************* Copyright (C) Marvell International Ltd. and its affiliates ******************************************************************************** Marvell GPL License Option If you received this File from Marvell, you may opt to use, redistribute and/or modify this File in accordance with the terms and conditions of the General Public License Version 2, June 1991 (the "GPL License"), a copy of which is available along with the File in the license.txt file or by writing to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt. THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. The GPL License provides additional details about this warranty disclaimer. *******************************************************************************/ #include "mvOsSata.h" MV_U16 mvSwapShort(MV_U16 data) { return MV_CPU_TO_LE16(data); } MV_U32 mvSwapWord(MV_U32 data) { return MV_CPU_TO_LE32(data); }
/************************************************************************ * * io_edgeport.h Edgeport Linux Interface definitions * * Copyright (C) 2000 Inside Out Networks, 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. * * ************************************************************************/ #if !defined(_IO_EDGEPORT_H_) #define _IO_EDGEPORT_H_ #define MAX_RS232_PORTS 8 /* Max # of RS-232 ports per device */ /* typedefs that the insideout headers need */ #ifndef LOW8 #define LOW8(a) ((unsigned char)(a & 0xff)) #endif #ifndef HIGH8 #define HIGH8(a) ((unsigned char)((a & 0xff00) >> 8)) #endif #ifndef __KERNEL__ #define __KERNEL__ #endif #include "io_usbvend.h" /* The following table is used to map the USBx port number to * the device serial number (or physical USB path), */ #define MAX_EDGEPORTS 64 struct comMapper { char SerialNumber[MAX_SERIALNUMBER_LEN+1]; /* Serial number/usb path */ int numPorts; /* Number of ports */ int Original[MAX_RS232_PORTS]; /* Port numbers set by IOCTL */ int Port[MAX_RS232_PORTS]; /* Actual used port numbers */ }; #define EDGEPORT_CONFIG_DEVICE "/proc/edgeport" /* /proc/edgeport Interface * This interface uses read/write/lseek interface to talk to the edgeport driver * the following read functions are supported: */ #define PROC_GET_MAPPING_TO_PATH 1 #define PROC_GET_COM_ENTRY 2 #define PROC_GET_EDGE_MANUF_DESCRIPTOR 3 #define PROC_GET_BOOT_DESCRIPTOR 4 #define PROC_GET_PRODUCT_INFO 5 #define PROC_GET_STRINGS 6 #define PROC_GET_CURRENT_COM_MAPPING 7 /* The parameters to the lseek() for the read is: */ #define PROC_READ_SETUP(Command, Argument) ((Command) + ((Argument)<<8)) /* the following write functions are supported: */ #define PROC_SET_COM_MAPPING 1 #define PROC_SET_COM_ENTRY 2 /* The following structure is passed to the write */ struct procWrite { int Command; union { struct comMapper Entry; int ComMappingBasedOnUSBPort; /* Boolean value */ } u; }; /* * Product information read from the Edgeport */ struct edgeport_product_info { __u16 ProductId; /* Product Identifier */ __u8 NumPorts; /* Number of ports on edgeport */ __u8 ProdInfoVer; /* What version of structure is this? */ __u32 IsServer :1; /* Set if Server */ __u32 IsRS232 :1; /* Set if RS-232 ports exist */ __u32 IsRS422 :1; /* Set if RS-422 ports exist */ __u32 IsRS485 :1; /* Set if RS-485 ports exist */ __u32 IsReserved :28; /* Reserved for later expansion */ __u8 RomSize; /* Size of ROM/E2PROM in K */ __u8 RamSize; /* Size of external RAM in K */ __u8 CpuRev; /* CPU revision level (chg only if s/w visible) */ __u8 BoardRev; /* PCB revision level (chg only if s/w visible) */ __u8 BootMajorVersion; /* Boot Firmware version: xx. */ __u8 BootMinorVersion; /* yy. */ __le16 BootBuildNumber; /* zzzz (LE format) */ __u8 FirmwareMajorVersion; /* Operational Firmware version:xx. */ __u8 FirmwareMinorVersion; /* yy. */ __le16 FirmwareBuildNumber; /* zzzz (LE format) */ __u8 ManufactureDescDate[3]; /* MM/DD/YY when descriptor template was compiled */ __u8 HardwareType; __u8 iDownloadFile; /* What to download to EPiC device */ __u8 EpicVer; /* What version of EPiC spec this device supports */ struct edge_compatibility_bits Epic; }; /* * Edgeport Stringblock String locations */ #define EDGESTRING_MANUFNAME 1 /* Manufacture Name */ #define EDGESTRING_PRODNAME 2 /* Product Name */ #define EDGESTRING_SERIALNUM 3 /* Serial Number */ #define EDGESTRING_ASSEMNUM 4 /* Assembly Number */ #define EDGESTRING_OEMASSEMNUM 5 /* OEM Assembly Number */ #define EDGESTRING_MANUFDATE 6 /* Manufacture Date */ #define EDGESTRING_ORIGSERIALNUM 7 /* Serial Number */ struct string_block { __u16 NumStrings; /* Number of strings in block */ __u16 Strings[1]; /* Start of string block */ }; #endif
/* This file is part of the KDE project Copyright (C) 2006 Stefan Nikolaus <stefan.nikolaus@kdemail.net> (C) 1999-2004 Laurent Montel <montel@kde.org> (C) 2003 Norbert Andres <nandres@web.de> (C) 2002 Philipp Mueller <philipp.mueller@gmx.de> (C) 2002 John Dailey <dailey@vt.edu> (C) 1998-1999 Torben Weis <weis@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KSPREAD_SPECIAL_PASTE_DIALOG #define KSPREAD_SPECIAL_PASTE_DIALOG #include <kdialog.h> #include "ui_SpecialPasteWidget.h" namespace KSpread { class Selection; /** * \ingroup UI * Dialog for the special paste action. */ class SpecialPasteDialog : public KDialog, public Ui::SpecialPasteWidget { Q_OBJECT public: explicit SpecialPasteDialog(QWidget* parent, Selection* selection); public slots: void slotOk(); void slotToggled(bool); private: Selection* m_selection; }; } // namespace KSpread #endif // KSPREAD_SPECIAL_PASTE_DIALOG
#ifndef __ASM_X8664_BUG_H #define __ASM_X8664_BUG_H 1 #include <linux/stringify.h> /* * Tell the user there is some problem. The exception handler decodes * this frame. */ struct bug_frame { unsigned char ud2[2]; unsigned char mov; /* should use 32bit offset instead, but the assembler doesn't like it */ char *filename; unsigned char ret; unsigned short line; } __attribute__((packed)); #ifdef CONFIG_BUG #define HAVE_ARCH_BUG /* We turn the bug frame into valid instructions to not confuse the disassembler. Thanks to Jan Beulich & Suresh Siddha for nice instruction selection. The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ #define BUG() \ asm volatile( \ "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ "i"(__LINE__), "i" (__stringify(__FILE__))) void out_of_line_bug(void); #else static inline void out_of_line_bug(void) { } #endif #include <asm-generic/bug.h> #endif
#include <iostream> class IPv4Address { public: IPv4Address() { for (int i = 0; i < 3; i++) { num[i] = 0; } } IPv4Address(int a, int b, int c, int d) { num[0] = a; num[1] = b; num[2] = c; num[3] = d; } IPv4Address(const IPv4Address &ip) { *this = ip; } IPv4Address &operator++(int) { for (int i = 3; i > -1; i--) { num[i] = (num[i] + 1) % 256; if (num[i] != 0) { break; } } return *this; } IPv4Address operator++() { IPv4Address ip = *this; ++(*this); return ip; } IPv4Address &operator=(const IPv4Address &ip) { for (int i = 0; i < 4; i++) { num[i] = ip[i]; } return *this; } bool operator==(const IPv4Address &ip) const { bool equal = true; for (int i = 0; i < 3; i++) { if (num[0] != ip[0]) { equal = false; break; } } return equal; } bool operator!=(const IPv4Address &ip) const { return !(*this == ip); } const int &operator[](const int &i) const { return num[i]; } friend std::ostream &operator<<(std::ostream &stream, const IPv4Address &ip) { stream << ip[0] << ':' << ip[1] << ':' << ip[2] << ':' << ip[3]; return stream; } private: int num[4]; };
#ifndef __EXTRACTDIALOG_H__ #define __EXTRACTDIALOG_H__ #include <QDialog> #include "ui_extract_dialog.h" using namespace Ui; class ExtractDialog:public QDialog { Q_OBJECT UiExtractDialog ui; QString version; public: ExtractDialog(QWidget *parent = 0); void setModel(QAbstractListModel *model); public slots: void select_callback(); void activated_version( const QModelIndex & index ); inline QString getVersion() {return version;} inline QString getPath() {return ui.lineEdit->text();} }; #endif
/** * @file list.h * @brief This file contains a primitive list implementation - which exactly a list. */ #ifndef LIST_H #define LIST_H #include <stdbool.h> #include <stdlib.h> /******************************************************************************/ /* MACROS */ /******************************************************************************/ /******************************************************************************/ /* TYPES */ /******************************************************************************/ /** * Element of the list. */ struct list_NODE { /** The content */ void* element; /** Pointer to the next element */ struct list_NODE* next; }; /******************************************************************************/ /** * The list representation. */ typedef struct { /** Private members */ struct list_PRIVATE* _private; /** pointer to the first element */ struct list_NODE* first_element; } list_LIST; /*****************************************************************************/ /** * @brief callback function to destroy an element * @param element the destroyable element */ typedef void (*list_DESTROY)(void* element); /*****************************************************************************/ /** * @brief callback function to clone an element * @param dest the destination of the copy * @param element the element to copy * @param size size of the element * @param returns pointer to destination */ typedef void* (*list_COPY)(void* dest, const void* element, size_t size); /*****************************************************************************/ /******************************************************************************/ /* FUNCTIONS */ /******************************************************************************/ /** * Initialize function for the list * @param element_size the size of one element in the list * @param list the list to initialize * @param destroy_func Destroy function for an element. If this pointer is NULL * @param copy_func copy function for an element. If this pointer is NULL * the default behavior is memcpy. */ void list_init_list(list_LIST* list, unsigned element_size, list_DESTROY destroy_func, list_COPY copy_func); /******************************************************************************/ /** * Initialize a list like another one. * @param list: list to initialize * @param other: list to clone basic structure */ void list_init_like(list_LIST* list, const list_LIST* other); /******************************************************************************/ /** * Add a new element to the list * @details The element will be copied * The element will be copied with the copy function which was given during * initialization. * This function insert the element to the begining of the list * @param list list to increase * @param element the element to push */ void list_add_element(list_LIST* list, const void* element); /******************************************************************************/ /** * Returns the size of the given list. * @param list the given list */ unsigned list_size(const list_LIST* list); /******************************************************************************/ /** * Returns the size of the element in the list. * @param list the given list */ unsigned list_element_size(const list_LIST* list); /******************************************************************************/ /** * Returns true if the list is empty * @param list the given list */ bool list_is_empty(const list_LIST* list); /******************************************************************************/ /** * Free the memory of the current list */ void list_destroy(list_LIST* list); /******************************************************************************/ /** * @param list: List to copy * @return a copy of the input list */ list_LIST list_copy(const list_LIST* list); /******************************************************************************/ /** * Concatenate two list. * @param dest list to extends * @param source list which is the source * @warning This function does not copy the source list, only makes connection * between theme. */ void list_concat_list(list_LIST* dest, const list_LIST* source); /******************************************************************************/ /** * Revert the order of the list. * This list representation is a chained list, but the chaining is only done * to one direction. Sometimes it is not enough, but it has better performance. * To solve some problem sometimes it is enough if we can revert the list. * This function change the directio of the elements, and in that way the * first element will be the last and the last will be the first. * @param list: list to revert */ void list_revert(list_LIST* list); #endif
/* * Author: MontaVista Software, Inc. <source@mvista.com> * * 2006 (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/init.h> #include <linux/mvl_patch.h> static __init int regpatch(void) { return mvl_register_patch(517); } module_init(regpatch);
/* Copyright (C) 1996-1997 Id 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. 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. */ // d_modech.c: called when mode has just changed #include "quakedef.h" #include "d_local.h" #include "sys.h" /* Sys_MakeCodeWriteable() */ int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift; int d_scantable[MAXHEIGHT]; short *zspantable[MAXHEIGHT]; /* ================ D_Patch ================ */ void D_Patch(void) { #ifdef USE_X86_ASM static qboolean protectset8 = false; if (!protectset8) { Sys_MakeCodeWriteable((unsigned long)D_PolysetAff8Start, (unsigned long)D_PolysetAff8End - (unsigned long)D_PolysetAff8Start); protectset8 = true; } #endif /* USE_X86_ASM */ } /* ================ D_ViewChanged ================ */ void D_ViewChanged(void) { int rowbytes; if (r_dowarp) rowbytes = WARP_WIDTH; else rowbytes = vid.rowbytes; scale_for_mip = xscale; if (yscale > xscale) scale_for_mip = yscale; d_zrowbytes = vid.width * 2; d_zwidth = vid.width; d_pix_min = r_refdef.vrect.width / 320; if (d_pix_min < 1) d_pix_min = 1; d_pix_max = (int)((float)r_refdef.vrect.width / (320.0 / 4.0) + 0.5); d_pix_shift = 8 - (int)((float)r_refdef.vrect.width / 320.0 + 0.5); if (d_pix_max < 1) d_pix_max = 1; if (pixelAspect > 1.4) d_y_aspect_shift = 1; else d_y_aspect_shift = 0; d_vrectx = r_refdef.vrect.x; d_vrecty = r_refdef.vrect.y; d_vrectright_particle = r_refdef.vrectright - d_pix_max; d_vrectbottom_particle = r_refdef.vrectbottom - (d_pix_max << d_y_aspect_shift); { int i; for (i = 0; i < vid.height; i++) { d_scantable[i] = i * rowbytes; zspantable[i] = d_pzbuffer + i * d_zwidth; } } D_Patch(); }
/****************************************************************************************************** * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * ******************************************************************************************************/ #ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK_H #define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK_H #include "GuidelineStateDeployedConstantYAbstract.h" /// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK class GuidelineStateDeployedConstantYUnselectLock : public GuidelineStateDeployedConstantYAbstract { public: /// Single constructor. GuidelineStateDeployedConstantYUnselectLock(GuidelineStateContext &context); virtual ~GuidelineStateDeployedConstantYUnselectLock(); virtual void begin (); virtual bool doPaint () const; virtual void end (); virtual void handleActiveChange (bool active); virtual void handleGuidelineMode (bool visible, bool locked); virtual void handleHoverEnterEvent (); virtual void handleHoverLeaveEvent (); virtual void handleMousePress (const QPointF &posScene); virtual QString stateName () const; private: GuidelineStateDeployedConstantYUnselectLock(); }; #endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_UNSELECT_LOCK_H
/* * Program: BSI login * * Author: Mark Crispin * Networks and Distributed Computing * Computing & Communications * University of Washington * Administration Building, AG-44 * Seattle, WA 98195 * Internet: MRC@CAC.Washington.EDU * * Date: 1 August 1988 * Last Edited: 24 October 2000 * * The IMAP toolkit provided in this Distribution is * Copyright 2000 University of Washington. * The full text of our legal notices is contained in the file called * CPYRIGHT, included with this Distribution. */ /* Log in * Accepts: login passwd struct * argument count * argument vector * Returns: T if success, NIL otherwise */ long loginpw (struct passwd *pw,int argc,char *argv[]) { long ret = NIL; uid_t euid = geteuid (); login_cap_t *lc = login_getclass (pw->pw_class); /* have class and can become user? */ if (lc && !seteuid (pw->pw_uid)) { /* ask for approval */ if (auth_approve (lc,pw->pw_name, (char *) mail_parameters (NIL,GET_SERVICENAME,NIL)) <= 0) seteuid (euid); /* not approved, restore root euid */ else { /* approved */ seteuid (euid); /* restore former root euid first */ setsid (); /* ensure we are session leader */ /* log the guy in */ ret = !setusercontext (lc,pw,pw->pw_uid,LOGIN_SETALL&~LOGIN_SETPATH); } } return ret; }
#ifndef AssCompressor_pipeError_H #define AssCompressor_pipeError_H #define CURL_INIT_FAIL "Unable to init curl" #define CURL_TIMEOUT "Timeout during fetching" #define CURL_EXCEPTION "Unexpected result during fetching" #define BILIBILIWEBMANAGER_REGEX_FAIL "BilibiliWebManager Regex Fail" #define BILIBILIWEBMANAGER_ROLLBACKJSON_FAIL "BilibiliWebManager Rollback Fail" #define BILIBILIWEBMANAGER_INTERFACE_FAIL "BilibiliWebManager Interface Fail" #define BILIBILICOMMENTCONTAINER_PARSE_ERROR "BilibiliCommentContainer Parse Error" #define BILIBILICOMMENTCONTAINER_NOTSUPPORT "BilibiliCommentContainer Not Support" #define COMMENTPLACESTREAM_NOT_ENOUGH_ROOM "CommentPlaceStream Not Enough Room" #define ASSCONVERTER_NOT_ENGOUTH_ROOM "AssConverter Not Enough Room" #define ASSCONVERTER_BAD_XML "AssConverter Bad XML" #endif
/* * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This 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 Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM__H # define CRM__H /** * \file * \brief A dumping ground * \ingroup core */ # include <crm_config.h> # include <stdlib.h> # include <glib.h> # include <stdbool.h> # undef MIN # undef MAX # include <string.h> # include <libxml/tree.h> # define CRM_FEATURE_SET "3.0.10" # define EOS '\0' # define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) # ifndef MAX_NAME # define MAX_NAME 256 # endif # ifndef __GNUC__ # define __builtin_expect(expr, result) (expr) # endif /* Some handy macros used by the Linux kernel */ # define __likely(expr) __builtin_expect(expr, 1) # define __unlikely(expr) __builtin_expect(expr, 0) # define CRM_META "CRM_meta" extern char *crm_system_name; /* *INDENT-OFF* */ /* Clean these up at some point, some probably should be runtime options */ # define SOCKET_LEN 1024 # define APPNAME_LEN 256 # define MAX_IPC_FAIL 5 # define MAX_IPC_DELAY 120 # define DAEMON_RESPAWN_STOP 100 # define MSG_LOG 1 # define DOT_FSA_ACTIONS 1 # define DOT_ALL_FSA_INPUTS 1 /* #define FSA_TRACE 1 */ # define INFINITY_S "INFINITY" # define MINUS_INFINITY_S "-INFINITY" # define INFINITY 1000000 /* Sub-systems */ # define CRM_SYSTEM_DC "dc" # define CRM_SYSTEM_DCIB "dcib" /* The master CIB */ # define CRM_SYSTEM_CIB "cib" # define CRM_SYSTEM_CRMD "crmd" # define CRM_SYSTEM_LRMD "lrmd" # define CRM_SYSTEM_PENGINE "pengine" # define CRM_SYSTEM_TENGINE "tengine" # define CRM_SYSTEM_STONITHD "stonithd" # define CRM_SYSTEM_MCP "pacemakerd" /* Valid operations */ # define CRM_OP_NOOP "noop" # define CRM_OP_JOIN_ANNOUNCE "join_announce" # define CRM_OP_JOIN_OFFER "join_offer" # define CRM_OP_JOIN_REQUEST "join_request" # define CRM_OP_JOIN_ACKNAK "join_ack_nack" # define CRM_OP_JOIN_CONFIRM "join_confirm" # define CRM_OP_DIE "die_no_respawn" # define CRM_OP_RETRIVE_CIB "retrieve_cib" # define CRM_OP_PING "ping" # define CRM_OP_THROTTLE "throttle" # define CRM_OP_VOTE "vote" # define CRM_OP_NOVOTE "no-vote" # define CRM_OP_HELLO "hello" # define CRM_OP_HBEAT "dc_beat" # define CRM_OP_PECALC "pe_calc" # define CRM_OP_ABORT "abort" # define CRM_OP_QUIT "quit" # define CRM_OP_LOCAL_SHUTDOWN "start_shutdown" # define CRM_OP_SHUTDOWN_REQ "req_shutdown" # define CRM_OP_SHUTDOWN "do_shutdown" # define CRM_OP_FENCE "stonith" # define CRM_OP_EVENTCC "event_cc" # define CRM_OP_TEABORT "te_abort" # define CRM_OP_TEABORTED "te_abort_confirmed" /* we asked */ # define CRM_OP_TE_HALT "te_halt" # define CRM_OP_TECOMPLETE "te_complete" # define CRM_OP_TETIMEOUT "te_timeout" # define CRM_OP_TRANSITION "transition" # define CRM_OP_REGISTER "register" # define CRM_OP_IPC_FWD "ipc_fwd" # define CRM_OP_DEBUG_UP "debug_inc" # define CRM_OP_DEBUG_DOWN "debug_dec" # define CRM_OP_INVOKE_LRM "lrm_invoke" # define CRM_OP_LRM_REFRESH "lrm_refresh" /* Deprecated */ # define CRM_OP_LRM_QUERY "lrm_query" # define CRM_OP_LRM_DELETE "lrm_delete" # define CRM_OP_LRM_FAIL "lrm_fail" # define CRM_OP_PROBED "probe_complete" # define CRM_OP_NODES_PROBED "probe_nodes_complete" # define CRM_OP_REPROBE "probe_again" # define CRM_OP_CLEAR_FAILCOUNT "clear_failcount" # define CRM_OP_RELAXED_SET "one-or-more" # define CRM_OP_RELAXED_CLONE "clone-one-or-more" # define CRM_OP_RM_NODE_CACHE "rm_node_cache" # define CRMD_JOINSTATE_DOWN "down" # define CRMD_JOINSTATE_PENDING "pending" # define CRMD_JOINSTATE_MEMBER "member" # define CRMD_JOINSTATE_NACK "banned" # define CRMD_ACTION_DELETE "delete" # define CRMD_ACTION_CANCEL "cancel" # define CRMD_ACTION_MIGRATE "migrate_to" # define CRMD_ACTION_MIGRATED "migrate_from" # define CRMD_ACTION_START "start" # define CRMD_ACTION_STARTED "running" # define CRMD_ACTION_STOP "stop" # define CRMD_ACTION_STOPPED "stopped" # define CRMD_ACTION_PROMOTE "promote" # define CRMD_ACTION_PROMOTED "promoted" # define CRMD_ACTION_DEMOTE "demote" # define CRMD_ACTION_DEMOTED "demoted" # define CRMD_ACTION_NOTIFY "notify" # define CRMD_ACTION_NOTIFIED "notified" # define CRMD_ACTION_STATUS "monitor" /* short names */ # define RSC_DELETE CRMD_ACTION_DELETE # define RSC_CANCEL CRMD_ACTION_CANCEL # define RSC_MIGRATE CRMD_ACTION_MIGRATE # define RSC_MIGRATED CRMD_ACTION_MIGRATED # define RSC_START CRMD_ACTION_START # define RSC_STARTED CRMD_ACTION_STARTED # define RSC_STOP CRMD_ACTION_STOP # define RSC_STOPPED CRMD_ACTION_STOPPED # define RSC_PROMOTE CRMD_ACTION_PROMOTE # define RSC_PROMOTED CRMD_ACTION_PROMOTED # define RSC_DEMOTE CRMD_ACTION_DEMOTE # define RSC_DEMOTED CRMD_ACTION_DEMOTED # define RSC_NOTIFY CRMD_ACTION_NOTIFY # define RSC_NOTIFIED CRMD_ACTION_NOTIFIED # define RSC_STATUS CRMD_ACTION_STATUS /* *INDENT-ON* */ typedef GList *GListPtr; # include <crm/common/logging.h> # include <crm/common/util.h> # include <crm/error.h> # define crm_str_hash g_str_hash_traditional guint crm_strcase_hash(gconstpointer v); guint g_str_hash_traditional(gconstpointer v); #endif
#define DISCUZ_PASSWD_LENGTH 32 #define DISCUZ_SALT_LENGTH 6 // for post judgement #define NEWTHREAD 0 #define REPLY 1 struct threaddiscuzxytht { int discuzxtid; int ythttid; // for discuzx and ytht thread id mapping };
/* PSPPIRE - a graphical user interface for PSPP. Copyright (C) 2013 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PAGE_FIRST_LINE_H #define PAGE_FIRST_LINE_H struct first_line_page ; struct import_assistant; struct string; struct first_line_page *first_line_page_create (struct import_assistant *ia); void first_line_append_syntax (const struct import_assistant *ia, struct string *s); #endif
#include "ch.h" #include "hal.h" #include "math.h" #include "main.h" #include "algebra.h" #include "sensors/imu_mpu6050.h" float iq0, iq1, iq2, iq3; float exInt, eyInt, ezInt; // scaled integral error volatile float twoKp; // 2 * proportional gain (Kp) volatile float twoKi; // 2 * integral gain (Ki) extern float q0, q1, q2, q3; volatile float integralFBx, integralFBy, integralFBz; float sampleFreq; // half the sample period expressed in seconds systime_t now, lastupdate; extern float q[4]; extern imu_data_t imu_data; extern EventSource imu_event; float invSqrt(float x) { float halfx = 0.5f * x; float y = x; long i = *(long*)&y; i = 0x5f3759df - (i>>1); y = *(float*)&i; y = y * (1.5f - (halfx * y * y)); return y; } void AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz) { float recipNorm; float q0q0, q0q1, q0q2, q0q3, q1q1, q1q2, q1q3, q2q2, q2q3, q3q3; float halfex = 0.0f, halfey = 0.0f, halfez = 0.0f; float qa, qb, qc; // Auxiliary variables to avoid repeated arithmetic q0q0 = q0 * q0; q0q1 = q0 * q1; q0q2 = q0 * q2; q0q3 = q0 * q3; q1q1 = q1 * q1; q1q2 = q1 * q2; q1q3 = q1 * q3; q2q2 = q2 * q2; q2q3 = q2 * q3; q3q3 = q3 * q3; // Use magnetometer measurement only when valid (avoids NaN in magnetometer normalisation) if((mx != 0.0f) && (my != 0.0f) && (mz != 0.0f)) { float hx, hy, bx, bz; float halfwx, halfwy, halfwz; // Normalise magnetometer measurement recipNorm = invSqrt(mx * mx + my * my + mz * mz); mx *= recipNorm; my *= recipNorm; mz *= recipNorm; // Reference direction of Earth's magnetic field hx = 2.0f * (mx * (0.5f - q2q2 - q3q3) + my * (q1q2 - q0q3) + mz * (q1q3 + q0q2)); hy = 2.0f * (mx * (q1q2 + q0q3) + my * (0.5f - q1q1 - q3q3) + mz * (q2q3 - q0q1)); bx = sqrt(hx * hx + hy * hy); bz = 2.0f * (mx * (q1q3 - q0q2) + my * (q2q3 + q0q1) + mz * (0.5f - q1q1 - q2q2)); // Estimated direction of magnetic field halfwx = bx * (0.5f - q2q2 - q3q3) + bz * (q1q3 - q0q2); halfwy = bx * (q1q2 - q0q3) + bz * (q0q1 + q2q3); halfwz = bx * (q0q2 + q1q3) + bz * (0.5f - q1q1 - q2q2); // Error is sum of cross product between estimated direction and measured direction of field vectors halfex = (my * halfwz - mz * halfwy); halfey = (mz * halfwx - mx * halfwz); halfez = (mx * halfwy - my * halfwx); } // Compute feedback only if accelerometer measurement valid (avoids NaN in accelerometer normalisation) if((ax != 0.0f) && (ay != 0.0f) && (az != 0.0f)) { float halfvx, halfvy, halfvz; // Normalise accelerometer measurement recipNorm = invSqrt(ax * ax + ay * ay + az * az); ax *= recipNorm; ay *= recipNorm; az *= recipNorm; // Estimated direction of gravity halfvx = q1q3 - q0q2; halfvy = q0q1 + q2q3; halfvz = q0q0 - 0.5f + q3q3; // Error is sum of cross product between estimated direction and measured direction of field vectors halfex += (ay * halfvz - az * halfvy); halfey += (az * halfvx - ax * halfvz); halfez += (ax * halfvy - ay * halfvx); } // Apply feedback only when valid data has been gathered from the accelerometer or magnetometer if(halfex != 0.0f && halfey != 0.0f && halfez != 0.0f) { // Compute and apply integral feedback if enabled if(twoKi > 0.0f) { integralFBx += twoKi * halfex * (1.0f / sampleFreq); // integral error scaled by Ki integralFBy += twoKi * halfey * (1.0f / sampleFreq); integralFBz += twoKi * halfez * (1.0f / sampleFreq); gx += integralFBx; // apply integral feedback gy += integralFBy; gz += integralFBz; } else { integralFBx = 0.0f; // prevent integral windup integralFBy = 0.0f; integralFBz = 0.0f; } // Apply proportional feedback gx += twoKp * halfex; gy += twoKp * halfey; gz += twoKp * halfez; } // Integrate rate of change of quaternion gx *= (0.5f * (1.0f / sampleFreq)); // pre-multiply common factors gy *= (0.5f * (1.0f / sampleFreq)); gz *= (0.5f * (1.0f / sampleFreq)); qa = q0; qb = q1; qc = q2; q0 += (-qb * gx - qc * gy - q3 * gz); q1 += (qa * gx + qc * gz - q3 * gy); q2 += (qa * gy - qb * gz + q3 * gx); q3 += (qa * gz + qb * gy - qc * gx); // Normalise quaternion recipNorm = invSqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3); q0 *= recipNorm; q1 *= recipNorm; q2 *= recipNorm; q3 *= recipNorm; } static WORKING_AREA(waThreadQ, 512); static msg_t ThreadQ(void *arg) { (void)arg; chRegSetThreadName("Algebra"); struct EventListener self_el; chEvtRegister(&imu_event, &self_el, 4); now = chTimeNow(); while (TRUE) { chEvtWaitAll(EVENT_MASK(2) && EVENT_MASK(3) && EVENT_MASK(5)); now = chTimeNow(); sampleFreq = 1.0 / ((now-lastupdate) / (CH_FREQUENCY / 1.0)); lastupdate = now; // gyro values are expressed in deg/sec, the * M_PI/180 will convert it to radians/sec AHRSupdate(imu_data.gyro_x * M_PI/180, imu_data.gyro_y * M_PI/180, imu_data.gyro_z * M_PI/180, imu_data.acc_x, imu_data.acc_y, imu_data.acc_z, imu_data.mag_x, imu_data.mag_y, imu_data.mag_z); chEvtBroadcastFlags(&imu_event, EVENT_MASK(4)); //chThdSleepUntil(now); } return 0; } void algebra_start(void) { q0 = 1.0f; q1 = 0.0f; q2 = 0.0f; q3 = 0.0f; exInt = 0.0; eyInt = 0.0; ezInt = 0.0; twoKp = twoKpDef; twoKi = twoKiDef; integralFBx = 0.0f, integralFBy = 0.0f, integralFBz = 0.0f; chThdSleepMilliseconds(200); chThdCreateStatic(waThreadQ, sizeof(waThreadQ), NORMALPRIO, ThreadQ, NULL); }
#include <stdlib.h> #include <math.h> #include <string.h> /** Ahhh - the joys of comparing floating point numbers .... http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm */ int memcmp_double(const double * p1 , const double *p2 , size_t num_elements) { if (memcmp(p1 , p2 , num_elements * sizeof * p1) == 0) return 0; else { const double abs_epsilon = 1e-8; const double rel_epsilon = 1e-5; size_t index; for (index = 0; index < num_elements; index++) { double diff = fabs(p1[index] - p2[index]); if (diff > abs_epsilon) { double sum = fabs(p1[index]) + fabs(p2[index]); if (diff > sum * rel_epsilon) return 1; } } return 0; } }
/* * Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <algorithm> #include <cassert> #include <cstddef> #include <cstdlib> #include <functional> #include <random> #include <vector> #include <qnnpack/params.h> class RMaxMicrokernelTester { public: inline RMaxMicrokernelTester& n(size_t n) { assert(n != 0); this->n_ = n; return *this; } inline size_t n() const { return this->n_; } inline RMaxMicrokernelTester& iterations(size_t iterations) { this->iterations_ = iterations; return *this; } inline size_t iterations() const { return this->iterations_; } void test(pytorch_u8rmax_ukernel_function u8rmax) const { std::random_device randomDevice; auto rng = std::mt19937(randomDevice()); auto u8rng = std::bind(std::uniform_int_distribution<uint8_t>(), rng); std::vector<uint8_t> x(n()); for (size_t iteration = 0; iteration < iterations(); iteration++) { std::generate(x.begin(), x.end(), std::ref(u8rng)); /* Compute reference results */ uint8_t yRef = 0; for (size_t i = 0; i < n(); i++) { yRef = std::max(yRef, x[i]); } /* Call optimized micro-kernel */ const uint8_t y = u8rmax(n(), x.data()); /* Verify results */ ASSERT_EQ(yRef, y) << "n = " << n(); } } private: size_t n_{1}; size_t iterations_{15}; };
/* Free Download Manager Copyright (c) 2003-2014 FreeDownloadManager.ORG */ #if !defined(AFX_VMSDOWNLOADSGROUPSMGR_H__C90C07E2_3147_4BB8_A890_781C75428830__INCLUDED_) #define AFX_VMSDOWNLOADSGROUPSMGR_H__C90C07E2_3147_4BB8_A890_781C75428830__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif #include "tree.h" #include "vmsPersistObject.h" #define GRP_OTHER_ID ((UINT)0) typedef bool (*GroupLoadEventHandler)(void* pvData); struct vmsDownloadsGroup : public vmsObject, public vmsPersistObject { fsString strName; fsString strOutFolder; fsString strExts; size_t cDownloads; bool bAboutToBeDeleted; UINT nId; int nChildren; void* pvData; GroupLoadEventHandler glehEventHandler; virtual void getObjectItselfStateBuffer(LPBYTE pb, LPDWORD pdwSize, bool bSaveToStorage); virtual bool loadObjectItselfFromStateBuffer(LPBYTE pb, LPDWORD pdwSize, DWORD dwVer); }; typedef vmsObjectSmartPtr <vmsDownloadsGroup> vmsDownloadsGroupSmartPtr; typedef fs::ListTree <vmsDownloadsGroupSmartPtr>* PDLDS_GROUPS_TREE; #define DLDSGRPSFILE_CURRENT_VERSION ((WORD)1) #define DLDSGRPSFILE_SIG "FDM Groups" struct vmsDownloadsGroupsFileHdr { char szSig [sizeof (DLDSGRPSFILE_SIG) + 1]; WORD wVer; vmsDownloadsGroupsFileHdr () { strcpy (szSig, DLDSGRPSFILE_SIG); wVer = DLDSGRPSFILE_CURRENT_VERSION; } }; class vmsDownloadsGroupsMgr; struct TGroupLoadEventData { TGroupLoadEventData() : pdgmGroupsMgr(0), pgtParent(0), bIsGroupLoaded(true) {} vmsDownloadsGroupsMgr* pdgmGroupsMgr; PDLDS_GROUPS_TREE pgtParent; vmsDownloadsGroupSmartPtr pGroupPtr; bool bIsGroupLoaded; }; class vmsDownloadsGroupsMgr : public vmsPersistObject { public: static LPCSTR GetAudioExts(); static LPCSTR GetVideoExts (); PDLDS_GROUPS_TREE Add (vmsDownloadsGroupSmartPtr pGroup, vmsDownloadsGroupSmartPtr pParentGroup, BOOL bKeepIdAsIs = FALSE, bool bDontQueryStoringGroupsInformation = false); PDLDS_GROUPS_TREE Add (vmsDownloadsGroupSmartPtr grp, PDLDS_GROUPS_TREE pParentGroup, BOOL bKeepIdAsIs = FALSE, bool bDontQueryStoringGroupsInformation = false); void DeleteGroup (vmsDownloadsGroupSmartPtr pGroup); size_t GetTotalCount(); vmsDownloadsGroupSmartPtr GetGroup (size_t nIndex); PDLDS_GROUPS_TREE GetGroupsTree(); BOOL SaveToDisk(); BOOL LoadFromDisk(); vmsDownloadsGroupSmartPtr FindGroup (UINT nId); vmsDownloadsGroupSmartPtr FindGroupByName (LPCSTR pszName); vmsDownloadsGroupSmartPtr FindGroupByExt (LPCSTR pszExt); fsString GetGroupFullName (UINT nId); PDLDS_GROUPS_TREE FindGroupInTree (vmsDownloadsGroupSmartPtr pGroup); void SetGroupsRootOutFolder (LPCSTR psz); fsString GetGroupsRootOutFolder(); void GetGroupWithSubgroups (vmsDownloadsGroupSmartPtr pGroup, std::vector <vmsDownloadsGroupSmartPtr> &v); virtual void getObjectItselfStateBuffer(LPBYTE pb, LPDWORD pdwSize, bool bSaveToStorage); virtual bool loadObjectItselfFromStateBuffer(LPBYTE pb, LPDWORD pdwSize, DWORD dwVer); TGroupLoadEventData& AddGroupLoadEventData(const TGroupLoadEventData& gledData); void RemoveGroupCreators(); void UpdateIdForNextGroup(int nId); vmsDownloadsGroupsMgr(); virtual ~vmsDownloadsGroupsMgr(); protected: void RebuildGroupsList (PDLDS_GROUPS_TREE pRoot, std::vector <fs::ListTree <vmsDownloadsGroupSmartPtr>::ListTreePtr> &v); void RebuildGroupsList(); BOOL SaveGroupToFile (HANDLE hFile, vmsDownloadsGroupSmartPtr pGroup); BOOL SaveGroupsTreeToFile(HANDLE hFile, PDLDS_GROUPS_TREE pRoot); vmsDownloadsGroupSmartPtr FindGroupByName (LPCSTR pszName, PDLDS_GROUPS_TREE pRoot); BOOL LoadGroupFromFile (HANDLE hFile, vmsDownloadsGroupSmartPtr pGroup); BOOL LoadGroupsTreeFromFile (HANDLE hFile, PDLDS_GROUPS_TREE pRoot); void SetGroupsRootOutFolder (PDLDS_GROUPS_TREE pRoot, LPCSTR pszFolder); void GetSubgroups (PDLDS_GROUPS_TREE pGroup, std::vector <vmsDownloadsGroupSmartPtr> &v); UINT m_nGrpNextId; void CreateDefaultGroups(); void SaveGroupsTreeToBuffer(LPBYTE& pbtCurrentPos, LPBYTE pbtBuffer, DWORD dwBufferSizeSize, DWORD* pdwSizeReuiqred, PDLDS_GROUPS_TREE pRoot); void SaveGroupToBuffer(LPBYTE& pbtCurrentPos, LPBYTE pbtBuffer, DWORD dwBufferSizeSize, DWORD* pdwSizeReuiqred, vmsDownloadsGroupSmartPtr pGroup); bool LoadGroupsTreeFromBuffer(LPBYTE& pbtCurrentPos, LPBYTE pbtBuffer, DWORD dwBufferSize, PDLDS_GROUPS_TREE pRoot); bool LoadGroupFromBuffer(LPBYTE& pbtCurrentPos, LPBYTE pbtBuffer, DWORD dwBufferSize, vmsDownloadsGroupSmartPtr pGroup); fs::ListTree <vmsDownloadsGroupSmartPtr>::ListTreePtr m_tGroups; std::vector <fs::ListTree <vmsDownloadsGroupSmartPtr>::ListTreePtr> m_vGroups; bool m_bIsGroupsInformationChanged; vmsCriticalSection m_csGroupsInformationChangeGuard; std::list<TGroupLoadEventData> m_lstGroupLoadEventData; }; bool FdmGroupLoadEventHandler(void* pvData); #endif
/** * Author: Martin K. Schröder * Date: 2014 * * info@fortmax.se */ #include <stdint.h> #include <time.h> #include <sys/timeb.h> #include "time.h" // update this for correct amount of ticks in microsecon #define TICKS_PER_US 1 void time_init(void){ } void time_reset(void){ } timeout_t time_us_to_clock(timeout_t us){ return TICKS_PER_US * us; } timeout_t time_clock_to_us(timeout_t clock){ return clock / TICKS_PER_US; } timeout_t time_get_clock(void){ struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); return (timeout_t)ts.tv_sec * 1000000LL + (timeout_t)ts.tv_nsec / 1000LL; /*unsigned a, d; asm volatile("rdtsc" : "=a" (a), "=d" (d)); return (((unsigned long long)a) | (((unsigned long long)d) << 32)); */ //return TCNT1 + _timer1_ovf * 65535; } timeout_t time_clock_since(timeout_t clock){ return time_get_clock() - clock; }
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-avx2-128.h" #include "../common/n2bv_2.c"
#include "config.h" #include "filebundle.h" filebundle_entry_t *filebundle_root = NULL; const char *tvheadend_dataroot(void) { return TVHEADEND_DATADIR; }
/* * See Licensing and Copyright notice in naev.h */ #ifndef NLUA_VEC2_H # define NLUA_VEC2_H #include <lua.h> #include "physics.h" #define VECTOR_METATABLE "vec2" /**< Vector metatable identifier. */ /* * Vector library. */ int nlua_loadVector( lua_State *L ); /* * Vector operations. */ Vector2d* lua_tovector( lua_State *L, int ind ); Vector2d* luaL_checkvector( lua_State *L, int ind ); Vector2d* lua_pushvector( lua_State *L, Vector2d vec ); int lua_isvector( lua_State *L, int ind ); #endif /* NLUA_VEC2_H */
/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * * PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE Ogg123 SOURCE CODE IS (C) COPYRIGHT 2000-2001 * * by Stan Seibert <volsung@xiph.org> AND OTHER CONTRIBUTORS * * http://www.xiph.org/ * * * ******************************************************************** last mod: $Id$ ********************************************************************/ #ifndef __STATUS_H__ #define __STATUS_H__ #include <stdarg.h> #include "buffer.h" #include "transport.h" #include "format.h" typedef struct { int verbosity; char enabled; const char *formatstr; enum { stat_noarg = 0, stat_intarg, stat_stringarg, stat_floatarg, stat_doublearg } type; union { int intarg; char *stringarg; float floatarg; double doublearg; } arg; } stat_format_t; /* Status options: * stats[0] - currently playing file / stream * stats[1] - current playback time * stats[2] - remaining playback time * stats[3] - total playback time * stats[4] - instantaneous bitrate * stats[5] - average bitrate (not yet implemented) * stats[6] - input buffer fill % * stats[7] - input buffer state * stats[8] - output buffer fill % * stats[9] - output buffer state * stats[10] - Null format string to mark end of array */ stat_format_t *stat_format_create (); void stat_format_cleanup (stat_format_t *stats); void status_set_verbosity (int verbosity); void status_reset_output_lock (); void status_clear_line (); void status_print_statistics (stat_format_t *stats, buffer_stats_t *audio_statistics, data_source_stats_t *data_source_statistics, decoder_stats_t *decoder_statistics); void status_message (int verbosity, const char *fmt, ...); void vstatus_message (int verbosity, const char *fmt, va_list ap); void status_error (const char *fmt, ...); void vstatus_error (const char *fmt, va_list); #endif /* __STATUS_H__ */
/* Copyright (C) 2013-2015 Yubico AB 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, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include "internal.h" #include <unistd.h> #include <json.h> #include "b64/cencode.h" #include "b64/cdecode.h" #include "sha256.h" static int prepare_response2 (const char *encstr, const char *bdstr, const char *input, char **response) { int rc = U2FH_JSON_ERROR; struct json_object *jo = NULL, *enc = NULL, *bd = NULL, *key = NULL; char keyb64[256]; size_t keylen = sizeof (keyb64); enc = json_object_new_string (encstr); if (enc == NULL) goto done; bd = json_object_new_string (bdstr); if (bd == NULL) goto done; rc = get_fixed_json_data (input, "keyHandle", keyb64, &keylen); if (rc != U2FH_OK) { goto done; } rc = U2FH_JSON_ERROR; key = json_object_new_string (keyb64); if (key == NULL) goto done; jo = json_object_new_object (); if (jo == NULL) goto done; json_object_object_add (jo, "signatureData", enc); json_object_object_add (jo, "clientData", bd); json_object_object_add (jo, "keyHandle", key); *response = strdup (json_object_to_json_string (jo)); if (*response == NULL) rc = U2FH_MEMORY_ERROR; else rc = U2FH_OK; done: json_object_put (jo); json_object_put (enc); json_object_put (bd); json_object_put (key); return rc; } static int prepare_response (const unsigned char *buf, int len, const char *bd, const char *input, char **response) { base64_encodestate b64ctx; char b64enc[2048]; char bdstr[2048]; int cnt; if (len > 2048) return U2FH_MEMORY_ERROR; if (strlen (bd) > 2048) return U2FH_MEMORY_ERROR; base64_init_encodestate (&b64ctx); cnt = base64_encode_block (buf, len, b64enc, &b64ctx); base64_encode_blockend (b64enc + cnt, &b64ctx); base64_init_encodestate (&b64ctx); cnt = base64_encode_block (bd, strlen (bd), bdstr, &b64ctx); base64_encode_blockend (bdstr + cnt, &b64ctx); return prepare_response2 (b64enc, bdstr, input, response); } #define CHALLBINLEN 32 #define HOSIZE 32 #define MAXKHLEN 128 #define NOTSATISFIED "\x69\x85" /** * u2fh_authenticate: * @devs: a device handle, from u2fh_devs_init() and u2fh_devs_discover(). * @challenge: string with JSON data containing the challenge. * @origin: U2F origin URL. * @response: pointer to output string with JSON data. * @flags: set of ORed #u2fh_cmdflags values. * * Perform the U2F Authenticate operation. * * Returns: On success %U2FH_OK (integer 0) is returned, and on errors * an #u2fh_rc error code. */ u2fh_rc u2fh_authenticate (u2fh_devs * devs, const char *challenge, const char *origin, char **response, u2fh_cmdflags flags) { unsigned char data[CHALLBINLEN + HOSIZE + MAXKHLEN + 1]; unsigned char buf[MAXDATASIZE]; char bd[2048]; size_t bdlen = sizeof (bd); size_t len; int rc; char chalb64[256]; size_t challen = sizeof (chalb64); char khb64[256]; size_t kh64len = sizeof (khb64); base64_decodestate b64; size_t khlen; int skip_devices[devs->num_devices]; int skipped = 0; int iterations = 0; memset (skip_devices, 0, sizeof (skip_devices)); rc = get_fixed_json_data (challenge, "challenge", chalb64, &challen); if (rc != U2FH_OK) return rc; rc = prepare_browserdata (chalb64, origin, AUTHENTICATE_TYP, bd, &bdlen); if (rc != U2FH_OK) return rc; sha256_buffer (bd, bdlen, data); prepare_origin (challenge, data + CHALLBINLEN); /* confusion between key_handle and keyHandle */ rc = get_fixed_json_data (challenge, "keyHandle", khb64, &kh64len); if (rc != U2FH_OK) return rc; base64_init_decodestate (&b64); khlen = base64_decode_block (khb64, kh64len, data + HOSIZE + CHALLBINLEN + 1, &b64); data[HOSIZE + CHALLBINLEN] = khlen; /* FIXME: Support asynchronous usage, through a new u2fh_cmdflags flag. */ do { int i; if (iterations++ > 15) { return U2FH_TIMEOUT_ERROR; } for (i = 0; i < devs->num_devices; i++) { unsigned char tmp_buf[MAXDATASIZE]; if (skip_devices[i] != 0) { continue; } if (!devs->devs[i].is_alive) { skipped++; skip_devices[i] = 1; continue; } len = MAXDATASIZE; rc = send_apdu (devs, i, U2F_AUTHENTICATE, data, HOSIZE + CHALLBINLEN + khlen + 1, flags & U2FH_REQUEST_USER_PRESENCE ? 3 : 7, tmp_buf, &len); if (rc != U2FH_OK) { return rc; } else if (len != 2) { memcpy (buf, tmp_buf, len); break; } else if (memcmp (tmp_buf, NOTSATISFIED, 2) != 0) { skipped++; skip_devices[i] = 2; continue; } memcpy (buf, tmp_buf, len); } if (len == 2 && memcmp (buf, NOTSATISFIED, 2) == 0) { Sleep (1000); } } while ((flags & U2FH_REQUEST_USER_PRESENCE) && len == 2 && memcmp (buf, NOTSATISFIED, 2) == 0); if (len == 2 && memcmp (buf, NOTSATISFIED, 2) != 0) { return U2FH_AUTHENTICATOR_ERROR; } if (len != 2) { prepare_response (buf, len - 2, bd, challenge, response); } return U2FH_OK; }
#include <string.h> #include <format.h> #include <endian.h> #include <util.h> #include "dns.h" #include "lookup.h" static void output(CTX, char* str, int len) { bufout(&ctx->bo, str, len); } static void outstr(CTX, char* str) { output(ctx, str, strlen(str)); } static void maybe_reverse(char* p, char* e) { char* suff = ".in-addr.arpa"; int slen = strlen(suff); char* q; byte rev[4], ip[4]; if(p >= e) return; if(e - p < slen) return; char* rest = e - slen; if(strncmp(rest, suff, slen)) return; if(!(q = parseip(p, rev)) || (q != rest)) return; ip[0] = rev[3]; ip[1] = rev[2]; ip[2] = rev[1]; ip[3] = rev[0]; p = fmtip(p, e, ip); *p = '\0'; } static int skip_name(CTX, uint start) { uint ptr = start; uint end = ctx->len; while(ptr < end) { uint tag = ctx->data[ptr]; if(!tag) return ptr + 1; int type = (tag >> 6) & 3; if(type == 3) { /* reference */ return ptr + 2; } else if(!type) { /* string */ ptr += tag + 1; } else { return 0; /* reserved */ } } return 0; } static void prep_name(CTX, uint off, char* buf, int len) { char* s = buf; char* p = buf; char* e = buf + len - 1; uint ptr = off; uint end = ctx->len; uint next; while(ptr < end) { uint tag = ctx->data[ptr]; if(!tag) break; int type = (tag >> 6) & 3; if(type == 3) { if(ptr + 1 >= end) break; next = ((tag & 0x3F) << 8) | ctx->data[ptr+1]; if(next >= ptr) break; /* fwd reference */ ptr = next; } else if(!type) { /* string */ if(ptr + 1 + tag >= end) break; if(p > s) p = fmtchar(p, e, '.'); p = fmtraw(p, e, ctx->data + ptr + 1, tag); ptr += tag + 1; } else { break; } if(p >= e) break; } *p = '\0'; maybe_reverse(buf, p); } static void address(CTX, char* name, struct dnsres* dr) { byte* ip = dr->data; int iplen = ntohs(dr->length); if(iplen != 4) return; FMTBUF(p, e, ipstr, 40); p = fmtip(p, e, ip); FMTEND(p, e); outstr(ctx, name); output(ctx, " ", 1); outstr(ctx, ipstr); output(ctx, "\n", 1); } static void dblname(CTX, char* name, char* rel, uint doff) { char buf[256]; prep_name(ctx, doff, buf, sizeof(buf)); outstr(ctx, name); output(ctx, " ", 1); outstr(ctx, rel); output(ctx, " ", 1); outstr(ctx, buf); output(ctx, "\n", 1); } static void dump_resource(CTX, uint start, uint doff, struct dnsres* dr) { int type = ntohs(dr->type); int class = ntohs(dr->class); char name[256]; if(class != DNS_CLASS_IN) return; prep_name(ctx, start, name, sizeof(name)); switch(type) { case DNS_TYPE_A: return address(ctx, name, dr); case DNS_TYPE_CNAME: return dblname(ctx, name, "=", doff); case DNS_TYPE_SOA: return dblname(ctx, name, "::", doff); case DNS_TYPE_PTR: return dblname(ctx, name, "<-", doff); default: warn("unknown resource type", NULL, type); } } static int parse_resource(CTX) { uint start = ctx->ptr; uint droff = skip_name(ctx, start); int drlen = sizeof(struct dnsres); if(droff <= start) return 0; if(ctx->len < droff + drlen) return 0; struct dnsres* dr = (struct dnsres*)(ctx->data + droff); uint dataoff = droff + drlen; uint datalen = ntohs(dr->length); uint nextoff = droff + drlen + datalen; if(nextoff > ctx->len) return 0; dump_resource(ctx, start, dataoff, dr); return nextoff - start; } static void use_nameserver(CTX, struct dnsres* dr) { int type = ntohs(dr->type); int class = ntohs(dr->class); int drlen = ntohs(dr->length); if(class != DNS_CLASS_IN) return; if(type != DNS_TYPE_A) return; if(drlen != 4) return; if(ctx->nscount >= ARRAY_SIZE(ctx->nsaddr)) return; int c = ctx->nscount; memcpy(ctx->nsaddr[c++], dr->data, 4); ctx->nscount = c; } static int parse_nsaddrs(CTX) { uint start = ctx->ptr; uint droff = skip_name(ctx, start); int drlen = sizeof(struct dnsres); if(droff <= start) return 0; if(ctx->len < droff + drlen) return 0; struct dnsres* dr = (struct dnsres*)(ctx->data + droff); uint datalen = ntohs(dr->length); uint nextoff = droff + drlen + datalen; if(nextoff > ctx->len) return 0; use_nameserver(ctx, dr); return nextoff - start; } static int skip_question(CTX) { uint start = ctx->ptr; uint droff = skip_name(ctx, start); if(droff <= start) return 0; uint nextoff = droff + 4; if(nextoff > ctx->len) return 0; return nextoff - start; } static void parse_section(CTX, ushort ncount, int (*call)(CTX)) { uint i, len; uint count = ntohs(ncount); if(!count || !ctx->ptr) return; for(i = 0; i < count; i++) { if((len = call(ctx))) { ctx->ptr += len; continue; } else { ctx->ptr = 0; break; } } } void dump_answers(CTX, struct dnshdr* dh) { parse_section(ctx, dh->qdcount, skip_question); parse_section(ctx, dh->ancount, parse_resource); parse_section(ctx, dh->nscount, parse_resource); parse_section(ctx, dh->arcount, parse_resource); } void fill_nsaddrs(CTX, struct dnshdr* dh) { parse_section(ctx, dh->qdcount, skip_question); parse_section(ctx, dh->ancount, parse_nsaddrs); }
/* XiVO Client * Copyright (C) 2007-2014 Avencall * * This file is part of XiVO Client. * * XiVO Client 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, with a Section 7 Additional * Permission as follows: * This notice constitutes a grant of such permission as is necessary * to combine or link this software, or a modified version of it, with * the OpenSSL project's "OpenSSL" library, or a derivative work of it, * and to copy, modify, and distribute the resulting work. This is an * extension of the special permission given by Trolltech to link the * Qt code with the OpenSSL library (see * <http://doc.trolltech.com/4.4/gpl.html>). The OpenSSL library is * licensed under a dual license: the OpenSSL License and the original * SSLeay license. * * XiVO Client 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 XiVO Client. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINE_DIRECTORY_ENTRY_H_ #define _LINE_DIRECTORY_ENTRY_H_ #include <dao/userdaoimpl.h> #include <xletlib/xletlib_export.h> #include <xletlib/directory_entry.h> class QPixmap; class PhoneInfo; class QString; class UserDAO; class PhoneDAO; class XLETLIB_EXPORT LineDirectoryEntry: public DirectoryEntry { public: LineDirectoryEntry(const PhoneInfo &phone, const UserDAO &user_dao, const PhoneDAO &phone_dao); QString number() const; QString name() const; QPixmap statusIcon() const; QString statusText() const; bool hasSource(const PhoneInfo *phone) const; bool operator==(const LineDirectoryEntry & other) const; LineDirectoryEntry & operator=(const LineDirectoryEntry & other); ~LineDirectoryEntry() {} private: const PhoneInfo &m_phone; const UserDAO &m_user_dao; const PhoneDAO &m_phone_dao; }; #endif /* _LINE_DIRECTORY_ENTRY_H_ */
#pragma once namespace weasel { class Deserializr; } class Styler : public weasel::Deserializer { public: Styler(weasel::ResponseParser* pTarget); virtual ~Styler(); // store data virtual void Store(weasel::Deserializer::KeyType const& key, std::wstring const& value); // factory method static weasel::Deserializer::Ptr Create(weasel::ResponseParser* pTarget); };
/* -*- Mode: C++; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*- ******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * THIS IS UNPUBLISHED SOURCE CODE OF create3000. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 1999, 2016 Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the Titania Project. * * Titania is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * Titania 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 version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with Titania. If not, see <http://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ #ifndef __TITANIA_X3D_JAVA_SCRIPT_SPIDER_MONKEY_JS_STRING_H__ #define __TITANIA_X3D_JAVA_SCRIPT_SPIDER_MONKEY_JS_STRING_H__ #include <jsapi.h> #include <string> namespace titania { namespace X3D { namespace spidermonkey { JS::Value StringValue (JSContext* const cx, const std::string & string); // to_string std::string to_string (JSContext* const cx, JSString* const); std::string to_string (JSContext* const cx, const JS::HandleValue & value); inline std::string to_string (JSContext* const cx, JS::HandleId value) { return to_string (cx, JSID_TO_STRING (value)); } std::string to_string (const char16_t* ucstring, const size_t length); } // spidermonkey } // X3D } // titania #endif
/* * Gamma Combination * Author: Till Moritz Karbach, moritz.karbach@cern.ch * Date: August 2012 * */ #ifndef MethodProb_h #define MethodProb_h #include <iostream> #include <stdlib.h> #include "RooGlobalFunc.h" #include "RooWorkspace.h" #include "RooDataSet.h" #include "RooRealVar.h" #include "RooConstVar.h" #include "RooAddition.h" #include "RooMultiVarGaussian.h" #include "RooSlimFitResult.h" #include "RooRandom.h" #include "RooDataHist.h" #include "RooGaussian.h" #include "RooPoisson.h" #include "RooProdPdf.h" #include "RooPlot.h" #include "RooArgSet.h" #include "TCanvas.h" #include "TTree.h" #include "TH1F.h" #include "TH2F.h" #include "TMarker.h" #include "TStopwatch.h" #include "TMath.h" #include "TStyle.h" #include "TGaxis.h" #include "TRandom3.h" #include "TLegend.h" #include "MethodAbsScan.h" #include "PDF_Generic_Abs.h" #include "Utils.h" using namespace RooFit; using namespace std; using namespace Utils; class MethodProbScan : public MethodAbsScan { public: MethodProbScan(Combiner *comb); MethodProbScan(PDF_Generic_Abs* PDF, OptParser* opt, TH1F* hcl, const TString &fname = "GenericScan"); MethodProbScan(); ~MethodProbScan(); float getChi2min(float scanpoint); inline TH1F* getHChi2min(){return hChi2min;}; void saveSolutions(); void saveSolutions2d(); int scan1d(bool fast=false, bool reverse=false); int scan2d(); inline void setScanDisableDragMode(bool f=true){scanDisableDragMode = f;}; private: bool computeInnerTurnCoords(const int iStart, const int jStart, const int i, const int j, int &iResult, int &jResult, int nTurn); bool deleteIfNotInCurveResults2d(RooSlimFitResult *r); void sanityChecks(); bool scanDisableDragMode; int nScansDone; // count the number of times a scan was done }; #endif
/* This file is part of Darling. Copyright (C) 2017 Lubos Dolezel Darling 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. Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>. */ #include <Foundation/Foundation.h> @interface CNCreationDateDescription : NSObject @end
// // BAGEL - Brilliantly Advanced General Electronic Structure Library // Filename: rhf_london.h // Copyright (C) 2014 Toru Shiozaki // // Author: Ryan D. Reynolds <RyanDReynolds@u.northwestern.edu> // Maintainer: Shiozaki group // // This file is part of the BAGEL package. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef __BAGEL_SRC_LONDON_RHF_LONDON_H #define __BAGEL_SRC_LONDON_RHF_LONDON_H #include <src/scf/scf_base.h> #include <src/scf/levelshift.h> #include <src/scf/giaohf/fock_london.h> #include <src/util/math/diis.h> #include <src/wfn/method.h> namespace bagel { class RHF_London : public SCF_base_London { protected: double lshift_; std::shared_ptr<LevelShift<DistZMatrix>> levelshift_; bool dodf_; bool restarted_; std::shared_ptr<DIIS<DistZMatrix,ZMatrix>> diis_; private: // serialization friend class boost::serialization::access; template<class Archive> void save(Archive& ar, const unsigned int) const { ar << boost::serialization::base_object<SCF_base_London>(*this); ar << lshift_ << dodf_ << diis_; } template<class Archive> void load(Archive& ar, const unsigned int) { ar >> boost::serialization::base_object<SCF_base_London>(*this); ar >> lshift_ >> dodf_ >> diis_; if (lshift_ != 0.0) levelshift_ = std::make_shared<ShiftVirtual<DistZMatrix>>(nocc_, lshift_); restarted_ = true; } template<class Archive> void serialize(Archive& ar, const unsigned int file_version) { boost::serialization::split_member(ar, *this, file_version); } public: RHF_London() { } RHF_London(const std::shared_ptr<const PTree> idata_, const std::shared_ptr<const Geometry> geom, const std::shared_ptr<const Reference> re = nullptr); virtual ~RHF_London() { } void compute() override; std::shared_ptr<const Reference> conv_to_ref() const override; bool dodf() const { return dodf_; } }; } #include <src/util/archive.h> BOOST_CLASS_EXPORT_KEY(bagel::RHF_London) #endif
/* * Copyright (c) Facebook, Inc. and its affiliates. * * 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. */ #pragma once #include <type_traits> #include <utility> #include <folly/functional/Invoke.h> #include <folly/synchronization/DelayedInit.h> namespace folly { /* * ConcurrentLazy is for thread-safe, delayed initialization of a value. This * combines the benefits of both `folly::Lazy` and `folly::DelayedInit` to * compute the value, once, at access time. * * There are a few differences between the non-concurrent Lazy, most notably: * * - this only safely initializes the value; thread-safety of the underlying * value is left up to the caller. * - the underlying types are not copyable or moveable, which means that this * type is also not copyable or moveable. * * Otherwise, all design considerations from `folly::Lazy` are reflected here. */ template <class Ctor> struct ConcurrentLazy { using result_type = invoke_result_t<Ctor>; static_assert( !std::is_const<Ctor>::value, "Func should not be a const-qualified type"); static_assert( !std::is_reference<Ctor>::value, "Func should not be a reference type"); template < typename F, std::enable_if_t<std::is_constructible_v<Ctor, F>, int> = 0> explicit ConcurrentLazy(F&& f) noexcept( std::is_nothrow_constructible_v<Ctor, F>) : ctor_(static_cast<F&&>(f)) {} const result_type& operator()() const { return value_.try_emplace_with(std::ref(ctor_)); } result_type& operator()() { return value_.try_emplace_with(std::ref(ctor_)); } private: mutable folly::DelayedInit<result_type> value_; mutable Ctor ctor_; }; template <class Func> ConcurrentLazy<remove_cvref_t<Func>> concurrent_lazy(Func&& func) { return ConcurrentLazy<remove_cvref_t<Func>>(static_cast<Func&&>(func)); } } // namespace folly
#pragma once #include "DomoticzHardware.h" #include <iosfwd> class CDummy : public CDomoticzHardwareBase { public: explicit CDummy(const int ID); ~CDummy(void); bool WriteToHardware(const char *pdata, const unsigned char length) override; private: void Init(); bool StartHardware() override; bool StopHardware() override; };
//////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / // \ \ \/ // \ \ Copyright (c) 2003-2004 Xilinx, Inc. // / / All Right Reserved. // /---/ /\ // \ \ / \ // \___\/\___\ //////////////////////////////////////////////////////////////////////////////// #ifndef H_Work_wave_testbench_arch_H #define H_Work_wave_testbench_arch_H #ifdef __MINGW32__ #include "xsimMinGW.h" #else #include "xsim.h" #endif class Work_wave_testbench_arch: public HSim__s6 { public: HSimFileVar Results; HSim__s1 SA[2]; Work_wave_testbench_arch(const char * name); ~Work_wave_testbench_arch(); void constructObject(); void constructPorts(); void reset(); void architectureInstantiate(HSimConfigDecl* cfg); virtual void vhdlArchImplement(); }; HSim__s6 *createWork_wave_testbench_arch(const char *name); #endif
/* * Copyright 2010-2015 OpenXcom Developers. * * This file is part of OpenXcom. * * OpenXcom 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. * * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OPENXCOM_RULECRAFT_H #define OPENXCOM_RULECRAFT_H #include <vector> #include <string> #include <yaml-cpp/yaml.h> namespace OpenXcom { class RuleTerrain; class Ruleset; /** * Represents a specific type of craft. * Contains constant info about a craft like * costs, speed, capacities, consumptions, etc. * @sa Craft */ class RuleCraft { private: std::string _type; std::vector<std::string> _requires; int _sprite, _marker; int _fuelMax, _damageMax, _speedMax, _accel, _weapons, _soldiers, _vehicles, _costBuy, _costRent, _costSell; std::string _refuelItem; int _repairRate, _refuelRate, _radarRange, _sightRange, _transferTime, _score; RuleTerrain *_battlescapeTerrainData; bool _spacecraft; int _listOrder, _maxItems, _maxDepth; std::vector<std::vector <int> > _deployment; public: /// Creates a blank craft ruleset. RuleCraft(const std::string &type); /// Cleans up the craft ruleset. ~RuleCraft(); /// Loads craft data from YAML. void load(const YAML::Node& node, Ruleset *ruleset, int modIndex, int nextCraftIndex); /// Gets the craft's type. std::string getType() const; /// Gets the craft's requirements. const std::vector<std::string> &getRequirements() const; /// Gets the craft's sprite. int getSprite() const; /// Gets the craft's globe marker. int getMarker() const; /// Gets the craft's maximum fuel. int getMaxFuel() const; /// Gets the craft's maximum damage. int getMaxDamage() const; /// Gets the craft's maximum speed. int getMaxSpeed() const; /// Gets the craft's acceleration. int getAcceleration() const; /// Gets the craft's weapon capacity. unsigned int getWeapons() const; /// Gets the craft's soldier capacity. int getSoldiers() const; /// Gets the craft's vehicle capacity. int getVehicles() const; /// Gets the craft's cost. int getBuyCost() const; /// Gets the craft's rent for a month. int getRentCost() const; /// Gets the craft's value. int getSellCost() const; /// Gets the craft's refuel item. std::string getRefuelItem() const; /// Gets the craft's repair rate. int getRepairRate() const; /// Gets the craft's refuel rate. int getRefuelRate() const; /// Gets the craft's radar range. int getRadarRange() const; /// Gets the craft's sight range. int getSightRange() const; /// Gets the craft's transfer time. int getTransferTime() const; /// Gets the craft's score. int getScore() const; /// Gets the craft's terrain data. RuleTerrain *getBattlescapeTerrainData(); /// Checks if this craft is capable of travelling to mars. bool getSpacecraft() const; /// Gets the list weight for this craft. int getListOrder() const; /// Gets the deployment priority for the craft. std::vector<std::vector<int> > &getDeployment(); /// Gets the item limit for this craft. int getMaxItems() const; /// checks how deep this craft can go. int getMaxDepth() const; }; } #endif
//////////////////////////////////////////////////////////////////////////////// // // B L I N K // // Copyright (C) 2016-2018 Blink Mobile Shell Project // // This file is part of Blink. // // Blink 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. // // Blink 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 Blink. If not, see <http://www.gnu.org/licenses/>. // // In addition, Blink is also subject to certain additional terms under // GNU GPL version 3 section 7. // // You should have received a copy of these additional terms immediately // following the terms and conditions of the GNU General Public License // which accompanied the Blink Source Code. If not, see // <http://www.github.com/blinksh/blink>. // //////////////////////////////////////////////////////////////////////////////// #import <UIKit/UIKit.h> @interface BKSecurityConfigurationViewController : UITableViewController @end
//===- ADCE.h - Aggressive dead code elimination --------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file provides the interface for the Aggressive Dead Code Elimination // pass. This pass optimistically assumes that all instructions are dead until // proven otherwise, allowing it to eliminate dead computations that other DCE // passes do not catch, particularly involving loop computations. // //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_SCALAR_ADCE_H #define LLVM_TRANSFORMS_SCALAR_ADCE_H #include "llvm/IR/Function.h" #include "llvm/IR/PassManager.h" namespace llvm { /// A DCE pass that assumes instructions are dead until proven otherwise. /// /// This pass eliminates dead code by optimistically assuming that all /// instructions are dead until proven otherwise. This allows it to eliminate /// dead computations that other DCE passes do not catch, particularly involving /// loop computations. struct ADCEPass : PassInfoMixin<ADCEPass> { PreservedAnalyses run(Function &F); }; } #endif // LLVM_TRANSFORMS_SCALAR_ADCE_H
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_HTMLTableCaptionElement_h #define mozilla_dom_HTMLTableCaptionElement_h #include "mozilla/Attributes.h" #include "nsGenericHTMLElement.h" #include "nsIDOMHTMLTableCaptionElem.h" namespace mozilla { namespace dom { class HTMLTableCaptionElement MOZ_FINAL : public nsGenericHTMLElement, public nsIDOMHTMLTableCaptionElement { public: HTMLTableCaptionElement(already_AddRefed<nsINodeInfo>& aNodeInfo) : nsGenericHTMLElement(aNodeInfo) { SetHasWeirdParserInsertionMode(); } virtual ~HTMLTableCaptionElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED // nsIDOMHTMLTableCaptionElement NS_DECL_NSIDOMHTMLTABLECAPTIONELEMENT void GetAlign(nsString& aAlign) { GetHTMLAttr(nsGkAtoms::align, aAlign); } void SetAlign(const nsAString& aAlign, ErrorResult& aError) { SetHTMLAttr(nsGkAtoms::align, aAlign, aError); } virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE; virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE; private: static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData); }; } // namespace dom } // namespace mozilla #endif /* mozilla_dom_HTMLTableCaptionElement_h */
///////////// Copyright © 2008, Goldeneye: Source All rights reserved. ///////////// // // File: npc_tknife.h // Description: // Weapon Throwing Knife Projectile definition. *shing shing* // // Created On: 11/23/2008 // Created By: Killermonkey ///////////////////////////////////////////////////////////////////////////// #ifndef NPC_TKNIFE_H #define NPC_TKNIFE_H #include "grenade_gebase.h" #include "ge_player.h" class CGETKnife : public CGEBaseGrenade { public: DECLARE_CLASS( CGETKnife, CGEBaseGrenade ); CGETKnife( void ); DECLARE_DATADESC(); virtual bool IsInAir( void ) { return m_bInAir; }; virtual GEWeaponID GetWeaponID( void ) { return WEAPON_KNIFE_THROWING; }; virtual const char *GetPrintName( void ) { return "#GE_ThrowingKnife"; }; virtual void Spawn( void ); virtual void Precache( void ); virtual void SoundThink( void ); virtual void RemoveThink( void ); virtual void SetVelocity( const Vector &velocity, const AngularImpulse &angVelocity ); virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent ); virtual void CollisionEventToTrace( int index, gamevcollisionevent_t *pEvent, trace_t &tr ); virtual void DamageTouch( CBaseEntity *pOther ); virtual void PickupTouch( CBaseEntity *pOther ); virtual bool MyTouch( CBaseCombatCharacter *pToucher ); virtual float GetDamage() { return m_flDamage; } virtual void SetDamage(float flDamage) { m_flDamage = flDamage; } private: bool m_bInAir; float m_flDamage; float m_flStopFlyingTime; }; #endif