text
stringlengths
4
6.14k
/* * Mach Operating System * Copyright (c) 1993 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * File: strings.c * Author: Robert V. Baron, Carnegie Mellon University * Date: ??/92 * * String functions. */ #include <string.h> #ifdef strcpy #undef strcmp #undef strncmp #undef strcpy #undef strncpy #undef strlen #endif /* * Abstract: * strcmp (s1, s2) compares the strings "s1" and "s2". * It returns 0 if the strings are identical. It returns * > 0 if the first character that differs in the two strings * is larger in s1 than in s2 or if s1 is longer than s2 and * the contents are identical up to the length of s2. * It returns < 0 if the first differing character is smaller * in s1 than in s2 or if s1 is shorter than s2 and the * contents are identical upto the length of s1. */ int strcmp( register const char *s1, register const char *s2) { register unsigned int a, b; do { a = *s1++; b = *s2++; if (a != b) return a-b; /* includes case when 'a' is zero and 'b' is not zero or vice versa */ } while (a != '\0'); return 0; /* both are zero */ } /* * Abstract: * strncmp (s1, s2, n) compares the strings "s1" and "s2" * in exactly the same way as strcmp does. Except the * comparison runs for at most "n" characters. */ int strncmp( register const char *s1, register const char *s2, size_t n) { register unsigned int a, b; while (n != 0) { a = *s1++; b = *s2++; if (a != b) return a-b; /* includes case when 'a' is zero and 'b' is not zero or vice versa */ if (a == '\0') return 0; /* both are zero */ n--; } return 0; } /* * Abstract: * strcpy copies the contents of the string "from" including * the null terminator to the string "to". A pointer to "to" * is returned. */ char * strcpy( register char *to, register const char *from) { register char *ret = to; while ((*to++ = *from++) != '\0') continue; return ret; } /* * Abstract: * strncpy copies "count" characters from the "from" string to * the "to" string. If "from" contains less than "count" characters * "to" will be padded with null characters until exactly "count" * characters have been written. The return value is a pointer * to the "to" string. */ char * strncpy( register char *to, register const char *from, register size_t count) { register char *ret = to; while (count != 0) { count--; if ((*to++ = *from++) == '\0') break; } while (count != 0) { *to++ = '\0'; count--; } return ret; } /* * Abstract: * strlen returns the number of characters in "string" preceeding * the terminating null character. */ size_t strlen( register const char *string) { register const char *ret = string; while (*string++ != '\0') continue; return string - 1 - ret; }
#ifndef SDM_BITSTRING_H #define SDM_BITSTRING_H #include <stdint.h> typedef uint64_t bitstring_t; void bs_init_bitcount_table(void); bitstring_t* bs_alloc(const unsigned int len); void bs_free(bitstring_t *bs); void bs_init_zeros(bitstring_t *bs, unsigned int len, unsigned int bits_remaining); void bs_init_ones(bitstring_t *bs, unsigned int len, unsigned int bits_remaining); void bs_init_random(bitstring_t *bs, unsigned int len, unsigned int bits_remaining); void bs_init_b64(bitstring_t *bs, char *b64); void bs_copy(bitstring_t *dst, const bitstring_t *src, unsigned int len); void bs_to_hex(char *buf, bitstring_t *bs, unsigned int len); void bs_to_b64(char *buf, bitstring_t *bs, unsigned int len); inline unsigned int bs_distance_popcount(const bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); inline unsigned int bs_distance_lookup16(const bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); inline unsigned int bs_distance_naive(const bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); int unsigned bs_distance(const bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); unsigned int bs_get_bit(bitstring_t *this, unsigned int bit); void bs_set_bit(bitstring_t *bs, unsigned int bit, unsigned int value); void bs_flip_bit(bitstring_t *bs, unsigned int bit); int bs_flip_random_bits(bitstring_t *bs, unsigned int bits, unsigned int flips); void bs_xor(bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); void bs_and(bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); void bs_or(bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); void bs_average(bitstring_t *bs1, const bitstring_t *bs2, const unsigned int len); #endif
#ifndef SERVER_BROWSE_MENU_H #define SERVER_BROWSE_MENU_H #include "gui/gui2_canvas.h" class GuiTextEntry; class GuiButton; class GuiListbox; class GuiSelector; class ServerBrowserMenu : public GuiCanvas { public: enum SearchSource { Local, Internet }; private: GuiTextEntry* manual_ip; GuiButton* connect_button; GuiListbox* server_list; GuiSelector* lan_internet_selector; P<ServerScanner> scanner; public: ServerBrowserMenu(SearchSource source); virtual ~ServerBrowserMenu(); }; #endif//SERVER_BROWSE_MENU_H
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:41 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm-x86/mach-voyager/do_timer.h */ #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif /* defines for inline arch setup functions */ #include <linux/clockchips.h> #include <asm/voyager.h> #include <asm/i8253.h> /** * do_timer_interrupt_hook - hook into timer tick * * Call the pit clock event handler. see asm/i8253.h **/ static inline void do_timer_interrupt_hook(void) { global_clock_event->event_handler(global_clock_event); voyager_timer_interrupt(); }
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:39 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm-generic/bitops/sched.h */ #ifndef _ASM_GENERIC_BITOPS_SCHED_H_ #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define _ASM_GENERIC_BITOPS_SCHED_H_ #include <linux/compiler.h> /* unlikely() */ #include <asm/types.h> /* * Every architecture must define this function. It's the fastest * way of searching a 100-bit bitmap. It's guaranteed that at least * one of the 100 bits is cleared. */ static inline int sched_find_first_bit(const unsigned long *b) { #if BITS_PER_LONG == 64 if (b[0]) return __ffs(b[0]); return __ffs(b[1]) + 64; #elif BITS_PER_LONG == 32 if (b[0]) return __ffs(b[0]); if (b[1]) return __ffs(b[1]) + 32; if (b[2]) return __ffs(b[2]) + 64; return __ffs(b[3]) + 96; #else #error BITS_PER_LONG not defined #endif } #endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */
/*************************************************************************** * Copyright (C) 2010 by Naomasa Matsubayashi * * fadis@quaternion.sakura.ne.jp * * * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions are * * met: * * * * 1. Redistributions of source code must retain the above copyright * * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution.* * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ***************************************************************************/ #ifndef EUC2PNG_MAP_H #define EUC2PNG_MAP_H #include <stdint.h> extern const uint16_t ascii_map[ 6 * 16 ]; extern const uint16_t kana_map[ 4 * 16 ]; extern const const uint16_t eucjp_map0[ 7 ][ 94 ]; extern const const uint16_t eucjp_map1[ 32 ][ 94 ]; uint16_t getGlyphEUC( uint8_t *_head ); int getCharSizeEUC( uint8_t *_head ); uint8_t *nextCharEUC( uint8_t *_head ); #endif
#ifndef RAND_H #define RAND_H class Rand { public: Rand(); virtual ~Rand(); protected: private: }; #endif // RAND_H
/* * \brief Munich - starts Linux * \date 2006-06-28 * \author Bernhard Kauer <kauer@tudos.org> */ /* * Copyright (C) 2006,2007,2010 Bernhard Kauer <kauer@tudos.org> * Technische Universitaet Dresden, Operating Systems Research Group * * This file is part of the OSLO package, which is distributed under * the terms of the GNU General Public Licence 2. Please see the * COPYING file for details. */ #include "version.h" #include "util.h" #include "munich.h" #include "boot_linux.h" const char *message_label = "MUNICH: "; const unsigned REALMODE_STACK = 0x49000; const unsigned REALMODE_IMAGE = 0x40000; // TODO why do we have to define it ourself here and not in util.c? void *memcpy(void *dst, const void *src, unsigned long len) { char *d = (char*)dst; const char *s = (const char*)src; while(len-- > 0) *d++ = *s++; return dst; } /** * Starts a linux from multiboot modules. Treats the first module as * linux kernel and the optional second module as initrd. */ __attribute__ ((noreturn)) int start_linux(struct mbi *mbi) { struct module *m = (struct module *)(mbi->mods_addr); struct linux_kernel_header *hdr = (struct linux_kernel_header *)(m->mod_start + 0x1f1); // sanity checks ERROR(-11, ~mbi->flags & MBI_FLAG_MODS, "module flag missing"); ERROR(-12, !mbi->mods_count, "no kernel to start"); ERROR(-13, 2 < mbi->mods_count, "do not know what to do with that many modules"); ERROR(-14, LINUX_BOOT_FLAG_MAGIC != hdr->boot_flag, "boot flag does not match"); ERROR(-15, LINUX_HEADER_MAGIC != hdr->header, "too old linux version?"); ERROR(-16, 0x202 > hdr->version, "can not start linux pre 2.4.0"); ERROR(-17, !(hdr->loadflags & 0x01), "not a bzImage?"); // filling out the header hdr->type_of_loader = 0x7; // fake GRUB here hdr->cmd_line_ptr = REALMODE_STACK; // enable heap hdr->heap_end_ptr = (REALMODE_STACK - 0x200) & 0xffff; hdr->loadflags |= 0x80; // output kernel version string if(hdr->kernel_version) { ERROR(-18, hdr->setup_sects << 9 < hdr->kernel_version, "version pointer invalid"); out_info((char *)(m->mod_start + hdr->kernel_version + 0x200)); } char *cmdline = (char *)m->string, *cmd, *tok; // remove kernel image name from cmdline get_arg(&cmdline, ' '); // parse remaining cmdline into whitespace-separated tokens for(cmd = cmdline; (tok = get_arg(&cmd, ' ')); *tok ? *--tok = '=' : 0, *cmd ? *--cmd = ' ' : 0) { // parse tokens into "arg=val" pairs char *arg = get_arg(&tok, '='); if(!strcmp(arg, "vga")) { hdr->vid_mode = strtoul(tok, 0, 0); out_description("video mode", hdr->vid_mode); } } out_info(cmdline); // handle initrd if(1 < mbi->mods_count) { hdr->ramdisk_size = (m + 1)->mod_end - (m + 1)->mod_start; hdr->ramdisk_image = (m + 1)->mod_start; if(hdr->ramdisk_image + hdr->ramdisk_size > hdr->initrd_addr_max) { unsigned long dst = (hdr->initrd_addr_max - hdr->ramdisk_size + 0xfff) & ~0xfff; out_description("relocating initrd", dst); memcpy((char *)dst, (char *)hdr->ramdisk_image, hdr->ramdisk_size); hdr->ramdisk_image = dst; } out_description("initrd", hdr->ramdisk_image); } out_info("copy image"); memcpy((char *)REALMODE_IMAGE, (char *)m->mod_start, (hdr->setup_sects + 1) << 9); memcpy((char *)hdr->cmd_line_ptr, cmdline, strlen(cmdline) + 1); memcpy((char *)hdr->code32_start, (char *)m->mod_start + ((hdr->setup_sects + 1) << 9), hdr->syssize * 16); out_info("start kernel"); jmp_kernel(REALMODE_IMAGE / 16 + 0x20, REALMODE_STACK); } /** * Start a linux from a multiboot structure. */ __attribute__ ((noreturn)) void __main(struct mbi *mbi, unsigned flags) { #ifndef NDEBUG serial_init(); #endif out_info(VERSION " starts Linux"); ERROR(10, !mbi || flags != MBI_MAGIC, "Not loaded via multiboot"); ERROR(11, start_linux(mbi), "start linux failed"); }
#include "xml/Node.h" #include "xml/DOMParser.h" #include "xml/DOMHelper.h" #include "mpd/MPD.h" #include "mpd/AdaptationSet.h" #include "mpd/Period.h" #include "mpd/Representation.h" #include "mpd/Segment.h" #include <cstdlib> #include <sstream> using namespace comcast_dash; using namespace comcast_dash::xml; using namespace comcast_dash::mpd; class Parser { public: Node * root; stream_t * p_stream; std::vector<Node *> periods; Parser(Node * root, stream_t * p_stream); virtual ~Parser(); MPD * parse(); std::vector<Node *> getRepresentations(Node *); std::vector<Node *> getSegments(Node *); };
/* * python-krb5.h - common module header file * * Copyright 2009 - Benjamin Montgomery (bmontgom@montynet.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PYTHON_KRB5_H #define PYTHON_KRB5_H #include <krb5.h> #include "Python.h" /* module kerberos context */ extern krb5_context module_context; /* hack for python 2.3 compat */ #if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 3) #define Py_RETURN_FALSE Py_INCREF(Py_False); return Py_False #define Py_RETURN_TRUE Py_INCREF(Py_True); return Py_True #endif #endif /* PYTHON_KRB5_H */
#ifndef ROUTER_H #define ROUTER_H #include "module.h" class Router : public Module { public: enum RouterRegister { BUFFER,SPIKE_OUT} ; enum RouterParams {PROBA,PRECISION_PROBA}; Router(int row=0,int col=0); virtual void computeState() override; virtual void setDefaultParams(Module::ParamsPtr params) override; protected: /** * @brief generate a stochastic bit following a bernouilli trial * @params proba : float probability of high bit * @precision_proba: int precision mask for the probability */ virtual bool bernouilliTrial(float proba,int precision_proba); }; #endif // ROUTER_H
/* * Copyright (C) 2002-2010 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DOSBOX_FPU_H #define DOSBOX_FPU_H #ifndef DOSBOX_MEM_H #include "mem.h" #endif void FPU_ESC0_Normal(Bitu rm); void FPU_ESC0_EA(Bitu func,PhysPt ea); void FPU_ESC1_Normal(Bitu rm); void FPU_ESC1_EA(Bitu func,PhysPt ea); void FPU_ESC2_Normal(Bitu rm); void FPU_ESC2_EA(Bitu func,PhysPt ea); void FPU_ESC3_Normal(Bitu rm); void FPU_ESC3_EA(Bitu func,PhysPt ea); void FPU_ESC4_Normal(Bitu rm); void FPU_ESC4_EA(Bitu func,PhysPt ea); void FPU_ESC5_Normal(Bitu rm); void FPU_ESC5_EA(Bitu func,PhysPt ea); void FPU_ESC6_Normal(Bitu rm); void FPU_ESC6_EA(Bitu func,PhysPt ea); void FPU_ESC7_Normal(Bitu rm); void FPU_ESC7_EA(Bitu func,PhysPt ea); typedef union { double d; #ifndef WORDS_BIGENDIAN struct { Bit32u lower; Bit32s upper; } l; #else struct { Bit32s upper; Bit32u lower; } l; #endif Bit64s ll; } FPU_Reg; typedef struct { Bit32u m1; Bit32u m2; Bit16u m3; Bit16u d1; Bit32u d2; } FPU_P_Reg; enum FPU_Tag { TAG_Valid = 0, TAG_Zero = 1, TAG_Weird = 2, TAG_Empty = 3 }; enum FPU_Round { ROUND_Nearest = 0, ROUND_Down = 1, ROUND_Up = 2, ROUND_Chop = 3 }; typedef struct { FPU_Reg regs[9]; FPU_P_Reg p_regs[9]; FPU_Tag tags[9]; Bit16u cw,cw_mask_all; Bit16u sw; Bit32u top; FPU_Round round; } FPU_rec; //get pi from a real library #define PI 3.14159265358979323846 #define L2E 1.4426950408889634 #define L2T 3.3219280948873623 #define LN2 0.69314718055994531 #define LG2 0.3010299956639812 extern FPU_rec fpu; #define TOP fpu.top #define STV(i) ( (fpu.top+ (i) ) & 7 ) Bit16u FPU_GetTag(void); void FPU_FLDCW(PhysPt addr); static INLINE void FPU_SetTag(Bit16u tag){ for(Bitu i=0;i<8;i++) fpu.tags[i] = static_cast<FPU_Tag>((tag >>(2*i))&3); } static INLINE void FPU_SetCW(Bitu word){ fpu.cw = (Bit16u)word; fpu.cw_mask_all = (Bit16u)(word | 0x3f); fpu.round = (FPU_Round)((word >> 10) & 3); } static INLINE Bitu FPU_GET_TOP(void) { return (fpu.sw & 0x3800)>>11; } static INLINE void FPU_SET_TOP(Bitu val){ fpu.sw &= ~0x3800; fpu.sw |= (val&7)<<11; } static INLINE void FPU_SET_C0(Bitu C){ fpu.sw &= ~0x0100; if(C) fpu.sw |= 0x0100; } static INLINE void FPU_SET_C1(Bitu C){ fpu.sw &= ~0x0200; if(C) fpu.sw |= 0x0200; } static INLINE void FPU_SET_C2(Bitu C){ fpu.sw &= ~0x0400; if(C) fpu.sw |= 0x0400; } static INLINE void FPU_SET_C3(Bitu C){ fpu.sw &= ~0x4000; if(C) fpu.sw |= 0x4000; } #endif
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #pragma once #include "Common/CommonTypes.h" #include "Core/HW/SI_Device.h" class PointerWrap; class ISIDevice; namespace MMIO { class Mapping; } // SI number of channels enum { MAX_SI_CHANNELS = 0x04 }; namespace SerialInterface { void Init(); void Shutdown(); void DoState(PointerWrap &p); void RegisterMMIO(MMIO::Mapping* mmio, u32 base); void UpdateDevices(); void RemoveDevice(int _iDeviceNumber); void AddDevice(const SIDevices _device, int _iDeviceNumber); void AddDevice(ISIDevice* pDevice); void ChangeDeviceCallback(u64 userdata, int cyclesLate); void ChangeDevice(SIDevices device, int channel); int GetTicksToNextSIPoll(); }; // end of namespace SerialInterface
#include "leds_sw.h" #include <cust_leds.h> #include <cust_leds_def.h> #define AAAAAAAAAAAAAAAAAAAA /**************************************************************************** * LED HAL functions ***************************************************************************/ extern void mt_leds_wake_lock_init(void); extern unsigned int mt_get_bl_brightness(void); extern unsigned int mt_get_bl_duty(void); extern unsigned int mt_get_bl_div(void); extern unsigned int mt_get_bl_frequency(void); extern unsigned int *mt_get_div_array(void); extern void mt_set_bl_duty(unsigned int level); extern void mt_set_bl_div(unsigned int div); extern void mt_set_bl_frequency(unsigned int freq); extern void mt_led_pwm_disable(int pwm_num); extern int mt_brightness_set_pmic_duty_store(u32 level, u32 div); extern void mt_backlight_set_pwm_duty(int pwm_num, u32 level, u32 div, struct PWM_config *config_data); extern void mt_backlight_set_pwm_div(int pwm_num, u32 level, u32 div, struct PWM_config *config_data); extern void mt_backlight_get_pwm_fsel(unsigned int bl_div, unsigned int *bl_frequency); extern void mt_store_pwm_register(unsigned int addr, unsigned int value); extern unsigned int mt_show_pwm_register(unsigned int addr); extern int mt_led_set_pwm(int pwm_num, struct nled_setting* led); extern int mt_led_blink_pmic(enum mt65xx_led_pmic pmic_type, struct nled_setting* led); extern int mt_backlight_set_pwm(int pwm_num, u32 level, u32 div, struct PWM_config *config_data); extern int mt_brightness_set_pmic(enum mt65xx_led_pmic pmic_type, u32 level, u32 div); extern int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level); extern void mt_mt65xx_led_work(struct work_struct *work); extern void mt_mt65xx_led_set(struct led_classdev *led_cdev, enum led_brightness level); extern int mt_mt65xx_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off); struct cust_mt65xx_led* mt_get_cust_led_list(void); extern void mt_mt65xx_breath_mode(); extern void mt_mt65xx_breath_mode_1(); /* PWR on, off */ extern int mt_mt65xx_breath_mode_2(int freq, int duty, int trf, int ton,int toff); extern int mt_mt65xx_breath_mode_alarm(); extern int mt_mt65xx_breath_mode_incomming_call();
#ifndef _SDM_XTEDS_VERIFICATION_H_ #define _SDM_XTEDS_VERIFICATION_H_ #include <stdlib.h> #include <stdio.h> #include <string.h> extern "C" { #include "xTEDSParser.h" } class SDMLIB_API xTEDSVerification { public: static bool VerifyQualifiers(const char* ItemName, const char* Interface, qualifier_type* QualifierList); static bool VerifyOrientation(const variable* var); static bool VerifyLocation(const variable* var, const location* loc); static bool VerifyCurve (const variable* var); static bool VerifyDrange (const variable* var); static bool VerifyVarRefs(const char* MsgName, var_ref* VarRefs); static bool VerifyVariable(variable* var); static bool VerifyDataMsg(const data_msg* dat); static bool VerifyCommandMsg(const cmd_msg* cmd); static bool VerifyFaultMsg(const fault_msg* fault); static bool VerifyInterface(const interface* Interface); }; #endif
/* * arch/arm/plat-omap/include/mach/common.h * * Header for code common to all OMAP machines. * * 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 SOFTWARE IS PROVIDED ``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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ARCH_ARM_MACH_OMAP_COMMON_H #define __ARCH_ARM_MACH_OMAP_COMMON_H #include <plat/i2c.h> struct sys_timer; extern void omap_map_common_io(void); extern struct sys_timer omap_timer; extern void omap_reserve(void); /* * IO bases for various OMAP processors * Except the tap base, rest all the io bases * listed are physical addresses. */ struct omap_globals { u32 class; /* OMAP class to detect */ void __iomem *tap; /* Control module ID code */ unsigned long sdrc; /* SDRAM Controller */ unsigned long sms; /* SDRAM Memory Scheduler */ unsigned long ctrl; /* System Control Module */ unsigned long prm; /* Power and Reset Management */ unsigned long cm; /* Clock Management */ unsigned long cm2; unsigned long uart1_phys; unsigned long uart2_phys; unsigned long uart3_phys; unsigned long uart4_phys; }; void omap2_set_globals_242x(void); void omap2_set_globals_243x(void); void omap2_set_globals_343x(void); void omap2_set_globals_36xx(void); void omap2_set_globals_443x(void); /* These get called from omap2_set_globals_xxxx(), do not call these */ void omap2_set_globals_tap(struct omap_globals *); void omap2_set_globals_sdrc(struct omap_globals *); void omap2_set_globals_control(struct omap_globals *); void omap2_set_globals_prcm(struct omap_globals *); void omap2_set_globals_uart(struct omap_globals *); /** * omap_test_timeout - busy-loop, testing a condition * @cond: condition to test until it evaluates to true * @timeout: maximum number of microseconds in the timeout * @index: loop index (integer) * * Loop waiting for @cond to become true or until at least @timeout * microseconds have passed. To use, define some integer @index in the * calling code. After running, if @index == @timeout, then the loop has * timed out. */ #define omap_test_timeout(cond, timeout, index) \ ({ \ for (index = 0; index < timeout; index++) { \ if (cond) \ break; \ udelay(1); \ } \ }) #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
#define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 3 #define __BUILD_NUM 2 #include <stdver.h> #define __PLUGIN_NAME "Tox protocol" #define __FILENAME "Tox.dll" #define __DESCRIPTION "Tox protocol support for Miranda NG." #define __AUTHOR "Miranda NG team" #define __AUTHORWEB "https://miranda-ng.org/p/Tox/" #define __COPYRIGHT "© 2014-22 Miranda NG team"
#pragma once /* * Copyright (C) 2010-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "cores/AudioEngine/Utils/AEAudioFormat.h" #include "cores/AudioEngine/Interfaces/AE.h" #include "cores/AudioEngine/DSPAddons/ActiveAEDSP.h" #include <atomic> #include <deque> extern "C" { #include "libavutil/avutil.h" #include "libswresample/swresample.h" } namespace ActiveAE { struct SampleConfig { AVSampleFormat fmt; uint64_t channel_layout; int channels; int sample_rate; int bits_per_sample; int dither_bits; }; /** * the variables here follow ffmpeg naming */ class CSoundPacket { public: CSoundPacket(SampleConfig conf, int samples); ~CSoundPacket(); uint8_t **data; // array with pointers to planes of data SampleConfig config; int bytes_per_sample; // bytes per sample and per channel int linesize; // see ffmpeg, required for planar formats int planes; // 1 for non planar formats, #channels for planar int nb_samples; // number of frames used int max_nb_samples; // max number of frames this packet can hold }; class CActiveAEBufferPool; class CSampleBuffer { public: CSampleBuffer(); ~CSampleBuffer(); CSampleBuffer *Acquire(); void Return(); CSoundPacket *pkt; CActiveAEBufferPool *pool; int64_t timestamp; int clockId; int pkt_start_offset; std::atomic<int> refCount; }; class CActiveAEBufferPool { public: CActiveAEBufferPool(AEAudioFormat format); virtual ~CActiveAEBufferPool(); virtual bool Create(unsigned int totaltime); CSampleBuffer *GetFreeBuffer(); void ReturnBuffer(CSampleBuffer *buffer); AEAudioFormat m_format; std::deque<CSampleBuffer*> m_allSamples; std::deque<CSampleBuffer*> m_freeSamples; }; class IAEResample; class CActiveAEBufferPoolResample : public CActiveAEBufferPool { public: CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality); virtual ~CActiveAEBufferPoolResample(); virtual bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true, bool useDSP = false); void SetExtraData(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type); void ChangeResampler(); void ChangeAudioDSP(); bool ResampleBuffers(int64_t timestamp = 0); float GetDelay(); void Flush(); AEAudioFormat m_inputFormat; AEAudioFormat m_dspFormat; std::deque<CSampleBuffer*> m_inputSamples; std::deque<CSampleBuffer*> m_outputSamples; CSampleBuffer *m_procSample; IAEResample *m_resampler; CSampleBuffer *m_dspSample; CActiveAEBufferPool *m_dspBuffer; CActiveAEDSPProcessPtr m_processor; uint8_t *m_planes[16]; bool m_fillPackets; bool m_drain; bool m_empty; bool m_useResampler; bool m_useDSP; bool m_bypassDSP; bool m_changeResampler; bool m_forceResampler; bool m_changeDSP; double m_resampleRatio; AEQuality m_resampleQuality; bool m_stereoUpmix; bool m_normalize; bool m_remap; int64_t m_lastSamplePts; unsigned int m_streamId; enum AVMatrixEncoding m_MatrixEncoding; enum AVAudioServiceType m_AudioServiceType; int m_Profile; }; }
/** * This function basically deals with the display function realted to the vectors. * Usage: display(_NAME_OF_THE_ARRAY) * VARIABLES USED: * 1.) vector<double> GivenVector: This is the variable used to take the vector argument provided by the user. * 2.) int CurrentElement: This is the variable which acts as an counter to traverse from the start to the end of the vector. * * FUNCTIONS USED: * 1.)void display(vector<double> & GivenVector): This is the main functional part of the code. **/ #include <vector> #include <cstdio> #include <cmath> #ifndef ArrayDisplay_H #define ArrayDisplay_H #endif using namespace std; void display(vector<double> ); void display(vector< vector<double> >); void sparseDisplay(vector< vector<double> >); /**END OF FILE.**/
/* * Linux ethernet bridge * * Authors: * Lennert Buytenhek <buytenh@gnu.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. */ #ifndef _LINUX_IF_BRIDGE_H #define _LINUX_IF_BRIDGE_H #include <linux/netdevice.h> #include <uapi/linux/if_bridge.h> extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); typedef int br_should_route_hook_t(struct sk_buff *skb); extern br_should_route_hook_t __rcu *br_should_route_hook; #endif
/* * arch/powerpc/math-emu/efdcmpeq.c * * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved. * * Author: Ebony Zhu, ebony.zhu@freescale.com * * Description: * This file is the implementation of SPE instruction "efdcmpeq" * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/types.h> #include <linux/errno.h> #include <asm/uaccess.h> #include "spe.h" #include "soft-fp.h" #include "double.h" int efdcmpeq(u32 *ccr, int crD, void *rA, void *rB) { FP_DECL_D(A); FP_DECL_D(B); long cmp; int ret = 0; #ifdef DEBUG printk("%s: %p (%08x) %d %p %p\n", __FUNCTION__, ccr, *ccr, crD, rA, rB); #endif __FP_UNPACK_D(A, rA); __FP_UNPACK_D(B, rB); #ifdef DEBUG printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); #endif FP_CMP_D(cmp, A, B, 2); if (cmp == 0) { cmp = 0x4; } else { cmp = 0; } *ccr &= ~(15 << ((7 - crD) << 2)); *ccr |= (cmp << ((7 - crD) << 2)); #ifdef DEBUG printk("CR: %08x\n", *ccr); #endif return ret; }
#include "ls.h" static unsigned int line_number = 0; int dump(char *line, unsigned int len, void *user) { printf("%u\t", ++line_number); fwrite(line, len, 1, stdout); return 0; } int main(int argc, char *argv[]) { if (file_each_line(argv[1], dump, NULL)) return EXIT_FAILURE; return EXIT_SUCCESS; }
#pragma once /* * Copyright (C) 2005-2010 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #ifndef CLIENT_H #define CLIENT_H #include "p8-platform/util/StdString.h" #include "libXBMC_addon.h" #include "libXBMC_pvr.h" #define DEFAULT_HOST "127.0.0.1" #define DEFAULT_PORT 49943 #define DEFAULT_RADIO true #define DEFAULT_TIMEOUT 10 #define DEFAULT_USER "Guest" #define DEFAULT_PASS "" #define DEFAULT_TUNEDELAY 200 #define DEFAULT_USEFOLDER false extern bool g_bCreated; ///< Shows that the Create function was successfully called extern std::string g_szUserPath; ///< The Path to the user directory inside user profile extern std::string g_szClientPath; ///< The Path where this driver is located /* Client Settings */ extern std::string g_szHostname; extern int g_iPort; extern int g_iConnectTimeout; extern bool g_bRadioEnabled; extern std::string g_szUser; extern std::string g_szPass; extern int g_iTuneDelay; extern bool g_bUseFolder; extern std::string g_szBaseURL; extern ADDON::CHelper_libXBMC_addon *XBMC; extern CHelper_libXBMC_pvr *PVR; /*! * @brief PVR macros for string exchange */ #define PVR_STRCPY(dest, source) do { strncpy(dest, source, sizeof(dest)-1); dest[sizeof(dest)-1] = '\0'; } while(0) #define PVR_STRCLR(dest) memset(dest, 0, sizeof(dest)) #endif /* CLIENT_H */
#ifndef _LINUX_NAMEI_H #define _LINUX_NAMEI_H #include <linux/dcache.h> #include <linux/errno.h> #include <linux/linkage.h> #include <linux/path.h> struct vfsmount; enum { MAX_NESTED_LINKS = 8 }; struct nameidata { struct path path; struct qstr last; struct path root; struct inode *inode; /* path.dentry.d_inode */ unsigned int flags; unsigned seq, m_seq; int last_type; unsigned depth; char *saved_names[MAX_NESTED_LINKS + 1]; }; /* * Type of the last component on LOOKUP_PARENT */ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; /* * The bitmask for a lookup event: * - follow links at the end * - require a directory * - ending slashes ok even for nonexistent files * - internal "there are more path components" flag * - dentry cache is untrusted; force a real lookup * - suppress terminal automount */ #define LOOKUP_FOLLOW 0x0001 #define LOOKUP_DIRECTORY 0x0002 #define LOOKUP_AUTOMOUNT 0x0004 #define LOOKUP_PARENT 0x0010 #define LOOKUP_REVAL 0x0020 #define LOOKUP_RCU 0x0040 /* * Intent data */ #define LOOKUP_OPEN 0x0100 #define LOOKUP_CREATE 0x0200 #define LOOKUP_EXCL 0x0400 #define LOOKUP_RENAME_TARGET 0x0800 #define LOOKUP_JUMPED 0x1000 #define LOOKUP_ROOT 0x2000 #define LOOKUP_EMPTY 0x4000 #define LOOKUP_NOCASE 0x8000 extern int user_path_at(int, const char __user *, unsigned, struct path *); extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty); #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) #define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) #define user_path_dir(name, path) \ user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) extern int kern_path(const char *, unsigned, struct path *); extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int); extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); extern void done_path_create(struct path *, struct dentry *); extern struct dentry *kern_path_locked(const char *, struct path *); extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct path *); extern struct dentry *lookup_one_len(const char *, struct dentry *, int); extern int follow_down_one(struct path *); extern int follow_down(struct path *); extern int follow_up(struct path *); extern struct dentry *lock_rename(struct dentry *, struct dentry *); extern void unlock_rename(struct dentry *, struct dentry *); extern void nd_jump_link(struct nameidata *nd, struct path *path); static inline void nd_set_link(struct nameidata *nd, char *path) { nd->saved_names[nd->depth] = path; } static inline char *nd_get_link(struct nameidata *nd) { return nd->saved_names[nd->depth]; } static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) { ((char *) name)[min(len, maxlen)] = '\0'; } /** * retry_estale - determine whether the caller should retry an operation * @error: the error that would currently be returned * @flags: flags being used for next lookup attempt * * Check to see if the error code was -ESTALE, and then determine whether * to retry the call based on whether "flags" already has LOOKUP_REVAL set. * * Returns true if the caller should try the operation again. */ static inline bool retry_estale(const long error, const unsigned int flags) { return error == -ESTALE && !(flags & LOOKUP_REVAL); } #endif /* _LINUX_NAMEI_H */
/* DB API */ #include "csync2.h" #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <time.h> #include "db_api.h" #include "db_mysql.h" #include "db_postgres.h" #include "db_sqlite.h" #include "db_sqlite2.h" #define DEADLOCK_MESSAGE \ "Database backend is exceedingly busy => Terminating (requesting retry).\n" int db_sqlite_open(const char *file, db_conn_p *db); int db_mysql_open(const char *file, db_conn_p *db); int db_detect_type(const char **db_str, int type) { const char *db_types[] = { "mysql://", "sqlite3://", "sqlite2://", "pgsql://", 0 }; int types[] = { DB_MYSQL, DB_SQLITE3, DB_SQLITE2, DB_PGSQL }; int index; for (index = 0; 1 ; index++) { if (db_types[index] == 0) break; if (!strncmp(*db_str, db_types[index], strlen(db_types[index]))) { *db_str += strlen(db_types[index]); return types[index]; } } return type; } int db_open(const char *file, int type, db_conn_p *db) { int rc = DB_ERROR; const char *db_str; db_str = file; type = db_detect_type(&db_str, type); /* Switch between implementation */ switch (type) { case DB_SQLITE2: rc = db_sqlite2_open(db_str, db); if (rc != DB_OK && db_str[0] != '/') fprintf(csync_debug_out, "Cannot open database file: %s, maybe you need three slashes (like sqlite:///var/lib/csync2/csync2.db)\n", db_str); break; case DB_SQLITE3: rc = db_sqlite_open(db_str, db); if (rc != DB_OK && db_str[0] != '/') fprintf(csync_debug_out, "Cannot open database file: %s, maybe you need three slashes (like sqlite:///var/lib/csync2/csync2.db)\n", db_str); break; #ifdef HAVE_MYSQL case DB_MYSQL: rc = db_mysql_open(db_str, db); break; #else case DB_MYSQL: csync_fatal("No Mysql support configured. Please reconfigure with --enable-mysql (database is %s).\n", file); rc = DB_ERROR; break; #endif #ifdef HAVE_POSTGRES case DB_PGSQL: rc = db_postgres_open(db_str, db); break; #else case DB_PGSQL: csync_fatal("No Postgres SQL support configured. Please reconfigure with --enable-postgres (database is %s).\n", file); rc = DB_ERROR; break; #endif default: csync_fatal("Database type not found. Can't open database %s\n", file); rc = DB_ERROR; } if (*db) (*db)->logger = 0; return rc; } void db_set_logger(db_conn_p conn, void (*logger)(int lv, const char *fmt, ...)) { if (conn == NULL) csync_fatal("No connection in set_logger.\n"); conn->logger = logger; } void db_close(db_conn_p conn) { if (!conn || !conn->close) return; conn->close(conn); } const char *db_errmsg(db_conn_p conn) { if (conn && conn->errmsg) return conn->errmsg(conn); return "(no error message function available)"; } int db_exec(db_conn_p conn, const char *sql) { if (conn && conn->exec) return conn->exec(conn, sql); csync_debug(0, "No exec function in db_exec.\n"); return DB_ERROR; } int db_prepare_stmt(db_conn_p conn, const char *sql, db_stmt_p *stmt, char **pptail) { if (conn && conn->prepare) return conn->prepare(conn, sql, stmt, pptail); csync_debug(0, "No prepare function in db_prepare_stmt.\n"); return DB_ERROR; } const char *db_stmt_get_column_text(db_stmt_p stmt, int column) { if (stmt && stmt->get_column_text) return stmt->get_column_text(stmt, column); csync_debug(0, "No stmt in db_stmt_get_column_text / no function.\n"); return NULL; } int db_stmt_get_column_int(db_stmt_p stmt, int column) { if (stmt && stmt->get_column_int) return stmt->get_column_int(stmt, column); csync_debug(0, "No stmt in db_stmt_get_column_int / no function.\n"); return 0; } int db_stmt_next(db_stmt_p stmt) { if (stmt && stmt->next) return stmt->next(stmt); csync_debug(0, "No stmt in db_stmt_next / no function.\n"); return DB_ERROR; } int db_stmt_close(db_stmt_p stmt) { if (stmt && stmt->close) return stmt->close(stmt); csync_debug(0, "No stmt in db_stmt_close / no function.\n"); return DB_ERROR; } int db_schema_version(db_conn_p db) { int version = -1; SQL_BEGIN(NULL, /* ignore errors */ "SELECT count(*) from file") { version = 0; } SQL_END; return version; } int db_upgrade_to_schema(db_conn_p db, int version) { if (db && db->upgrade_to_schema) return db->upgrade_to_schema(version); return DB_ERROR; }
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _list_h_ #define _list_h_ #ifdef __cplusplus extern "C" { #endif typedef struct st_list { struct st_list *prev,*next; void *data; } LIST; typedef int (*list_walk_action)(void *,void *); extern LIST *list_add(LIST *root,LIST *element); extern LIST *list_delete(LIST *root,LIST *element); extern LIST *list_cons(void *data,LIST *root); extern LIST *list_reverse(LIST *root); extern void list_free(LIST *root,unsigned int free_data); extern unsigned int list_length(LIST *); extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); extern LIST *list_link(LIST *, LIST *); #define list_rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } #ifdef __cplusplus } #endif #endif
/* * csync2 - cluster synchronization tool, 2nd generation * LINBIT Information Technologies GmbH <http://www.linbit.com> * Copyright (C) 2004, 2005, 2006 Clifford Wolf <clifford@clifford.at> * * 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 "csync2.h" #include <fnmatch.h> int csync_compare_mode = 0; int match_pattern_list( const char *filename, const char *basename, const struct csync_group_pattern *p) { int match_path = 0, match_base = 1; while (p) { int matched = 0; if ( p->iscompare && !csync_compare_mode ) goto next_pattern; if ( p->pattern[0] != '/' && p->pattern[0] != '%' ) { if ( !fnmatch(p->pattern, basename, 0) ) { match_base = p->isinclude; matched = 1; } } else { int fnm_pathname = p->star_matches_slashes ? 0 : FNM_PATHNAME; if ( !fnmatch(p->pattern, filename, FNM_LEADING_DIR|fnm_pathname) ) { match_path = p->isinclude; matched = 1; } } if ( matched ) { csync_debug(2, "Match (%c): %s on %s\n", p->isinclude ? '+' : '-', p->pattern, filename); } next_pattern: p = p->next; } return match_path && match_base; } const struct csync_group *csync_find_next( const struct csync_group *g, const char *file) { const char *basename = strrchr(file, '/'); if ( basename ) basename++; else basename = file; for (g = g==0 ? csync_group : g->next; g; g = g->next) { if ( !g->myname ) continue; if ( csync_compare_mode && !g->hasactivepeers ) continue; if ( match_pattern_list(file, basename, g->pattern) ) break; } return g; } int csync_step_into(const char *file) { const struct csync_group_pattern *p; const struct csync_group *g; if ( !strcmp(file, "/") ) return 1; for (g=csync_group; g; g=g->next) { if ( !g->myname ) continue; if ( csync_compare_mode && !g->hasactivepeers ) continue; for (p=g->pattern; p; p=p->next) { if ( p->iscompare && !csync_compare_mode ) continue; if ( (p->pattern[0] == '/' || p->pattern[0] == '%') && p->isinclude ) { char t[strlen(p->pattern)+1], *l; int fnm_pathname = p->star_matches_slashes ? 0 : FNM_PATHNAME; strcpy(t, p->pattern); while ( (l=strrchr(t, '/')) != 0 ) { *l = 0; if ( !fnmatch(t, file, fnm_pathname) ) return 1; } } } } return 0; } int csync_match_file(const char *file) { if ( csync_find_next(0, file) ) return 2; if ( csync_step_into(file) ) return 1; return 0; } void csync_check_usefullness(const char *file, int recursive) { struct csync_prefix *p = csync_prefix; if ( csync_find_next(0, file) ) return; if ( recursive && csync_step_into(file) ) return; if (*file == '/') while (p) { if (p->path) { int p_len = strlen(p->path); int f_len = strlen(file); if (p_len <= f_len && !strncmp(p->path, file, p_len) && (file[p_len] == '/' || !file[p_len])) { char new_file[strlen(p->name) + strlen(file+p_len) + 10]; sprintf(new_file, "%%%s%%%s", p->name, file+p_len); if ( csync_find_next(0, new_file) ) return; if ( recursive && csync_step_into(new_file) ) return; } } p = p->next; } csync_debug(0, "WARNING: Parameter will be ignored: %s\n", file); } int csync_match_file_host(const char *file, const char *myname, const char *peername, const char **keys) { const struct csync_group *g = NULL; while ( (g=csync_find_next(g, file)) ) { struct csync_group_host *h = g->host; if ( strcmp(myname, g->myname) ) continue; if (keys) { const char **k = keys; while (*k && **k) if ( !strcmp(*(k++), g->key) ) goto found_key; continue; } found_key: while (h) { if ( !strcmp(h->hostname, peername) ) return 1; h = h->next; } } return 0; } struct peer *csync_find_peers(const char *file, const char *thispeer) { const struct csync_group *g = NULL; struct peer *plist = 0; int pl_size = 0; while ( (g=csync_find_next(g, file)) ) { struct csync_group_host *h = g->host; if (thispeer) { while (h) { if ( !strcmp(h->hostname, thispeer) ) break; h = h->next; } if (!h) goto next_group; h = g->host; } while (h) { int i=0; while (plist && plist[i].peername) if ( !strcmp(plist[i++].peername, h->hostname) ) goto next_host; plist = realloc(plist, sizeof(struct peer)*(++pl_size+1)); plist[pl_size-1].peername = h->hostname; plist[pl_size-1].myname = g->myname; plist[pl_size].peername = 0; next_host: h = h->next; } next_group: ; } return plist; } const char *csync_key(const char *hostname, const char *filename) { const struct csync_group *g = NULL; struct csync_group_host *h; while ( (g=csync_find_next(g, filename)) ) for (h = g->host; h; h = h->next) if (!strcmp(h->hostname, hostname)) return g->key; return 0; } int csync_perm(const char *filename, const char *key, const char *hostname) { const struct csync_group *g = NULL; struct csync_group_host *h; int false_retcode = 1; while ( (g=csync_find_next(g, filename)) ) { if ( !hostname ) continue; for (h = g->host; h; h = h->next) if (!strcmp(h->hostname, hostname) && !strcmp(g->key, key)) { if (!h->slave) return 0; else false_retcode = 2; } } return false_retcode; }
/** * \file openssl.h * * Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org> * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* * OpenSSL wrapper contributed by David Barett */ #ifndef POLARSSL_OPENSSL_H #define POLARSSL_OPENSSL_H #include "polarssl/aes.h" #include "polarssl/md5.h" #include "polarssl/rsa.h" #include "polarssl/sha1.h" #define AES_SIZE 16 #define AES_BLOCK_SIZE 16 #define AES_KEY aes_context #define MD5_CTX md5_context #define SHA_CTX sha1_context #define SHA1_Init( CTX ) \ sha1_starts( (CTX) ) #define SHA1_Update( CTX, BUF, LEN ) \ sha1_update( (CTX), (unsigned char *)(BUF), (LEN) ) #define SHA1_Final( OUT, CTX ) \ sha1_finish( (CTX), (OUT) ) #define MD5_Init( CTX ) \ md5_starts( (CTX) ) #define MD5_Update( CTX, BUF, LEN ) \ md5_update( (CTX), (unsigned char *)(BUF), (LEN) ) #define MD5_Final( OUT, CTX ) \ md5_finish( (CTX), (OUT) ) #define AES_set_encrypt_key( KEY, KEYSIZE, CTX ) \ aes_setkey_enc( (CTX), (KEY), (KEYSIZE) ) #define AES_set_decrypt_key( KEY, KEYSIZE, CTX ) \ aes_setkey_dec( (CTX), (KEY), (KEYSIZE) ) #define AES_cbc_encrypt( INPUT, OUTPUT, LEN, CTX, IV, MODE ) \ aes_crypt_cbc( (CTX), (MODE), (LEN), (IV), (INPUT), (OUTPUT) ) /* * RSA stuff follows. TODO: needs cleanup */ inline int __RSA_Passthrough( void *output, void *input, int size ) { memcpy( output, input, size ); return size; } inline rsa_context* d2i_RSA_PUBKEY( void *ignore, unsigned char **bufptr, int len ) { unsigned char *buffer = *(unsigned char **) bufptr; rsa_context *rsa; /* * Not a general-purpose parser: only parses public key from *exactly* * openssl genrsa -out privkey.pem 512 (or 1024) * openssl rsa -in privkey.pem -out privatekey.der -outform der * openssl rsa -in privkey.pem -out pubkey.der -outform der -pubout * * TODO: make a general-purpose parse */ if( ignore != 0 || ( len != 94 && len != 162 ) ) return( 0 ); rsa = (rsa_context *) malloc( sizeof( rsa_rsa ) ); if( rsa == NULL ) return( 0 ); memset( rsa, 0, sizeof( rsa_context ) ); if( ( len == 94 && mpi_read_binary( &rsa->N, &buffer[ 25], 64 ) == 0 && mpi_read_binary( &rsa->E, &buffer[ 91], 3 ) == 0 ) || ( len == 162 && mpi_read_binary( &rsa->N, &buffer[ 29], 128 ) == 0 ) && mpi_read_binary( &rsa->E, &buffer[159], 3 ) == 0 ) { /* * key read successfully */ rsa->len = ( mpi_msb( &rsa->N ) + 7 ) >> 3; return( rsa ); } else { memset( rsa, 0, sizeof( rsa_context ) ); free( rsa ); return( 0 ); } } #define RSA rsa_context #define RSA_PKCS1_PADDING 1 /* ignored; always encrypt with this */ #define RSA_size( CTX ) (CTX)->len #define RSA_free( CTX ) rsa_free( CTX ) #define ERR_get_error( ) "ERR_get_error() not supported" #define RSA_blinding_off( IGNORE ) #define d2i_RSAPrivateKey( a, b, c ) new rsa_context /* TODO: C++ bleh */ inline int RSA_public_decrypt ( int size, unsigned char* input, unsigned char* output, RSA* key, int ignore ) { int outsize=size; if( !rsa_pkcs1_decrypt( key, RSA_PUBLIC, &outsize, input, output ) ) return outsize; else return -1; } inline int RSA_private_decrypt( int size, unsigned char* input, unsigned char* output, RSA* key, int ignore ) { int outsize=size; if( !rsa_pkcs1_decrypt( key, RSA_PRIVATE, &outsize, input, output ) ) return outsize; else return -1; } inline int RSA_public_encrypt ( int size, unsigned char* input, unsigned char* output, RSA* key, int ignore ) { if( !rsa_pkcs1_encrypt( key, RSA_PUBLIC, size, input, output ) ) return RSA_size(key); else return -1; } inline int RSA_private_encrypt( int size, unsigned char* input, unsigned char* output, RSA* key, int ignore ) { if( !rsa_pkcs1_encrypt( key, RSA_PRIVATE, size, input, output ) ) return RSA_size(key); else return -1; } #ifdef __cplusplus } #endif #endif /* openssl.h */
/* ** Zabbix ** Copyright (C) 2001-2014 Zabbix SIA ** ** 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 ZABBIX_CONTROL_H #define ZABBIX_CONTROL_H #include "common.h" #include "zbxself.h" int get_log_level_message(const char *opt, int command, int *message); #endif
/* * $Id$ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * 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, USA. * */ #ifndef SQUID_MEMOBJECT_H #define SQUID_MEMOBJECT_H #include "StoreIOBuffer.h" #include "StoreIOState.h" #include "stmem.h" #include "CommRead.h" #include "RemovalPolicy.h" #include "HttpRequestMethod.h" typedef void STMCB (void *data, StoreIOBuffer wroteBuffer); class store_client; #if DELAY_POOLS #include "DelayId.h" #endif class MemObject { public: static size_t inUseCount(); MEMPROXY_CLASS(MemObject); void dump() const; MemObject(char const *, char const *); ~MemObject(); void write(StoreIOBuffer, STMCB *, void *); void unlinkRequest(); HttpReply const *getReply() const; void replaceHttpReply(HttpReply *newrep); void stat (MemBuf * mb) const; int64_t endOffset () const; int64_t size() const; void reset(); int64_t lowestMemReaderOffset() const; bool readAheadPolicyCanRead() const; void addClient(store_client *); /* XXX belongs in MemObject::swapout, once swaphdrsz is managed * better */ int64_t objectBytesOnDisk() const; int64_t policyLowestOffsetToKeep() const; void trimSwappable(); void trimUnSwappable(); bool isContiguous() const; int mostBytesWanted(int max) const; void setNoDelay(bool const newValue); #if DELAY_POOLS DelayId mostBytesAllowed() const; #endif #if URL_CHECKSUM_DEBUG void checkUrlChecksum() const; #endif HttpRequestMethod method; char *url; mem_hdr data_hdr; int64_t inmem_lo; dlink_list clients; /** \todo move into .cc or .cci */ size_t clientCount() const {return nclients;} bool clientIsFirst(void *sc) const {return (clients.head && sc == clients.head->data);} int nclients; class SwapOut { public: int64_t queue_offset; /* relative to in-mem data */ mem_node *memnode; /* which node we're currently paging out */ StoreIOState::Pointer sio; }; SwapOut swapout; /* Read only - this reply must be preserved by store clients */ /* The original reply. possibly with updated metadata. */ HttpRequest *request; struct timeval start_ping; IRCB *ping_reply_callback; void *ircb_data; struct { STABH *callback; void *data; } abort; char *log_url; RemovalPolicyNode repl; int id; int64_t object_sz; size_t swap_hdr_sz; #if URL_CHECKSUM_DEBUG unsigned int chksum; #endif const char *vary_headers; void delayRead(DeferredRead const &); void kickReads(); private: HttpReply *_reply; DeferredReadManager deferredReads; }; MEMPROXY_CLASS_INLINE(MemObject); /** global current memory removal policy */ extern RemovalPolicy *mem_policy; #endif /* SQUID_MEMOBJECT_H */
// Copyright 2010 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. // TODO: Merge this with the original VideoConfigDiag or something // This is an awful way of managing a separate video backend. #pragma once #include <string> #include <vector> #include <wx/dialog.h> #include "Core/ConfigManager.h" #include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoConfig.h" class SoftwareVideoConfigDialog : public wxDialog { public: SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& ininame); ~SoftwareVideoConfigDialog(); void Event_Backend(wxCommandEvent& ev) { auto& new_backend = g_available_video_backends[ev.GetInt()]; if (g_video_backend != new_backend.get()) { Close(); g_video_backend = new_backend.get(); SConfig::GetInstance().m_strVideoBackend = g_video_backend->GetName(); g_video_backend->ShowConfig(GetParent()); } ev.Skip(); } };
/* * Hyves Desktop, Copyright (C) 2008-2009 Hyves (Startphone Ltd.) * http://www.hyves.nl/ * * 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 US */ #ifndef TRANSLATOR_H #define TRANSLATOR_H #include <QObject> #include "hyveslib_export.h" namespace Translator { class HYVESLIB_EXPORT Translator : public QObject { Q_OBJECT public: static Translator *instance(); static void destroy(); public slots: /** * Translates the given @p string. * * @return The translated string. */ QString tr(const QString &string); /** * Returns the ISO 639-2 code for the current language, like ENG or NLD. */ QString iso6392Language() const; /** * Returns the language code as a combination of language and locale, * like en_GB or nl_NL. */ QString locale() const; /** * Set the language of the application, plugins and dynamically * loaded .ui files to the language by their ISO 639-2 code. * * All language files in the install dir of the application will be loaded, * one after another, in an unspecified order. * * This _will_ lead to a flurry of change events and flickering. * * Note: in the future, will make language files bundling with plugins and * content bundles possible. */ void setLanguage(const QString &iso6392Language); /** * Returns the translated rich text in html */ QString trHtml(const QString& string); /** * Returns the javascript code that can add the * translated rich text as leading children of jsObject */ QString trHtmlJs(const QString& string, const QString& jsObject); /** * Returns the accessKey for the translated string. * Returns null if there isn't any accessKey. */ QString trAccessKey(const QString& string); private: static Translator *s_instance; struct Private; Private *const m_d; Translator(); virtual ~Translator(); }; } // namespace Translator #endif // TRANSLATOR_H
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); __visible struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; MODULE_INFO(intree, "Y"); static const struct modversion_info ____versions[] __used __attribute__((section("__versions"))) = { { 0xb95b937f, __VMLINUX_SYMBOL_STR(module_layout) }, { 0xfd6293c2, __VMLINUX_SYMBOL_STR(boot_tvec_bases) }, { 0x9264d222, __VMLINUX_SYMBOL_STR(seq_release) }, { 0x5e03596d, __VMLINUX_SYMBOL_STR(seq_read) }, { 0x2d7fd92f, __VMLINUX_SYMBOL_STR(seq_lseek) }, { 0xb1184c61, __VMLINUX_SYMBOL_STR(remove_proc_entry) }, { 0xd5f2172f, __VMLINUX_SYMBOL_STR(del_timer_sync) }, { 0xa9d09347, __VMLINUX_SYMBOL_STR(init_net) }, { 0x4ef4fb73, __VMLINUX_SYMBOL_STR(free_netdev) }, { 0x77f1f9a9, __VMLINUX_SYMBOL_STR(unregister_netdev) }, { 0x5d5c1efc, __VMLINUX_SYMBOL_STR(proc_create_data) }, { 0xbded9953, __VMLINUX_SYMBOL_STR(register_netdev) }, { 0xa5a13a99, __VMLINUX_SYMBOL_STR(alloc_netdev_mqs) }, { 0x91715312, __VMLINUX_SYMBOL_STR(sprintf) }, { 0x16305289, __VMLINUX_SYMBOL_STR(warn_slowpath_null) }, { 0x3b8e878, __VMLINUX_SYMBOL_STR(consume_skb) }, { 0x676bbc0f, __VMLINUX_SYMBOL_STR(_set_bit) }, { 0xf20dabd8, __VMLINUX_SYMBOL_STR(free_irq) }, { 0xaeb7451e, __VMLINUX_SYMBOL_STR(ax25_defaddr) }, { 0x6d602494, __VMLINUX_SYMBOL_STR(ax25_header_ops) }, { 0xac93ae05, __VMLINUX_SYMBOL_STR(ax25_bcast) }, { 0xc7944d35, __VMLINUX_SYMBOL_STR(__rt_spin_lock_init) }, { 0x6b3e609d, __VMLINUX_SYMBOL_STR(__rt_mutex_init) }, { 0xcce0378d, __VMLINUX_SYMBOL_STR(netif_rx) }, { 0x40d9bc6f, __VMLINUX_SYMBOL_STR(skb_put) }, { 0xed19a60d, __VMLINUX_SYMBOL_STR(__netdev_alloc_skb) }, { 0x7e51a024, __VMLINUX_SYMBOL_STR(__dev_kfree_skb_any) }, { 0x2c4d70ed, __VMLINUX_SYMBOL_STR(skb_dequeue) }, { 0x59d8223a, __VMLINUX_SYMBOL_STR(ioport_resource) }, { 0x49ebacbd, __VMLINUX_SYMBOL_STR(_clear_bit) }, { 0xd6b8e852, __VMLINUX_SYMBOL_STR(request_threaded_irq) }, { 0x9bce482f, __VMLINUX_SYMBOL_STR(__release_region) }, { 0xadf42bd5, __VMLINUX_SYMBOL_STR(__request_region) }, { 0x2196324, __VMLINUX_SYMBOL_STR(__aeabi_idiv) }, { 0x472668d0, __VMLINUX_SYMBOL_STR(skb_queue_tail) }, { 0x37a0cba, __VMLINUX_SYMBOL_STR(kfree) }, { 0x67c2fa54, __VMLINUX_SYMBOL_STR(__copy_to_user) }, { 0xfa2a45e, __VMLINUX_SYMBOL_STR(__memzero) }, { 0xc6cbbc89, __VMLINUX_SYMBOL_STR(capable) }, { 0xfbc74f64, __VMLINUX_SYMBOL_STR(__copy_from_user) }, { 0xd01d57ff, __VMLINUX_SYMBOL_STR(kmalloc_caches) }, { 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) }, { 0x715652ca, __VMLINUX_SYMBOL_STR(platform_device_unregister) }, { 0xdd52e418, __VMLINUX_SYMBOL_STR(request_firmware) }, { 0xe5026343, __VMLINUX_SYMBOL_STR(platform_device_register_full) }, { 0xfa6adb64, __VMLINUX_SYMBOL_STR(release_firmware) }, { 0x1b056ec3, __VMLINUX_SYMBOL_STR(kmem_cache_alloc_trace) }, { 0x9d669763, __VMLINUX_SYMBOL_STR(memcpy) }, { 0xa735db59, __VMLINUX_SYMBOL_STR(prandom_u32) }, { 0xbe2c0274, __VMLINUX_SYMBOL_STR(add_timer) }, { 0xac1c6b4a, __VMLINUX_SYMBOL_STR(seq_printf) }, { 0x6eac0dd, __VMLINUX_SYMBOL_STR(seq_open) }, { 0x2e5810c6, __VMLINUX_SYMBOL_STR(__aeabi_unwind_cpp_pr1) }, { 0x7d11c268, __VMLINUX_SYMBOL_STR(jiffies) }, { 0xb1ad28e0, __VMLINUX_SYMBOL_STR(__gnu_mcount_nc) }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends=ax25"; MODULE_INFO(srcversion, "17B6F4963FE3EC141E1C3FC");
#undef DEBUG #include <linux/interrupt.h> #include <linux/oom.h> #include <linux/suspend.h> #include <linux/module.h> #include <linux/syscalls.h> #include <linux/freezer.h> #include <linux/wakelock.h> #define TIMEOUT (20 * HZ) static inline int freezeable(struct task_struct * p) { if ((p == current) || (p->flags & PF_NOFREEZE) || (p->exit_state != 0)) return 0; return 1; } static int try_to_freeze_tasks(bool sig_only) { struct task_struct *g, *p; unsigned long end_time; unsigned int todo; struct timeval start, end; u64 elapsed_csecs64; unsigned int elapsed_csecs; unsigned int wakeup = 0; do_gettimeofday(&start); end_time = jiffies + TIMEOUT; do { todo = 0; read_lock(&tasklist_lock); do_each_thread(g, p) { if (frozen(p) || !freezeable(p)) continue; if (!freeze_task(p, sig_only)) continue; if (!task_is_stopped_or_traced(p) && !freezer_should_skip(p)) todo++; } while_each_thread(g, p); read_unlock(&tasklist_lock); yield(); if (todo && has_wake_lock(WAKE_LOCK_SUSPEND)) { wakeup = 1; break; } if (time_after(jiffies, end_time)) break; } while (todo); do_gettimeofday(&end); elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start); do_div(elapsed_csecs64, NSEC_PER_SEC / 100); elapsed_csecs = elapsed_csecs64; if (todo) { printk("\n"); printk(KERN_ERR "Freezing of tasks %s after %d.%02d seconds " "(%d tasks refusing to freeze):\n", wakeup ? "aborted" : "failed", elapsed_csecs / 100, elapsed_csecs % 100, todo); if(!wakeup) show_state(); read_lock(&tasklist_lock); do_each_thread(g, p) { task_lock(p); if (freezing(p) && !freezer_should_skip(p) && elapsed_csecs > 100) printk(KERN_ERR " %s\n", p->comm); cancel_freezing(p); task_unlock(p); } while_each_thread(g, p); read_unlock(&tasklist_lock); } else { printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100, elapsed_csecs % 100); } return todo ? -EBUSY : 0; } int freeze_processes(void) { int error; printk("Freezing user space processes ... "); error = try_to_freeze_tasks(true); if (error) goto Exit; printk("done.\n"); printk("Freezing remaining freezable tasks ... "); error = try_to_freeze_tasks(false); if (error) goto Exit; printk("done."); oom_killer_disable(); Exit: BUG_ON(in_atomic()); printk("\n"); return error; } static void thaw_tasks(bool nosig_only) { struct task_struct *g, *p; read_lock(&tasklist_lock); do_each_thread(g, p) { if (!freezeable(p)) continue; if (nosig_only && should_send_signal(p)) continue; if (cgroup_frozen(p)) continue; thaw_process(p); } while_each_thread(g, p); read_unlock(&tasklist_lock); } void thaw_processes(void) { oom_killer_enable(); printk("Restarting tasks ... "); thaw_tasks(true); thaw_tasks(false); schedule(); printk("done.\n"); }
/* This file is part of the KDE libraries Copyright (C) 2002 Hans Petter bieker <bieker@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 version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 __KTIMEWIDGET__ #define __KTIMEWIDGET__ #include <tqwidget.h> #include <tqdatetime.h> #include <tdelibs_export.h> /** * @short A time selection widget. * * This widget can be used to display or allow user selection of time. * * \image html ktimewidget.png "KDE Time Widget" * * @author Hans Petter Bieker <bieker@kde.org> * @since 3.2 */ class TDEUI_EXPORT KTimeWidget : public TQWidget { Q_OBJECT TQ_PROPERTY( TQTime time READ time WRITE setTime ) public: /** * Constructs a time selection widget. */ KTimeWidget(TQWidget * parent = 0, const char * name = 0); /** * Constructs a time selection widget with the initial time set to * @p time. */ KTimeWidget(const TQTime & time, TQWidget * parent = 0, const char * name = 0 ); /** * Destructs the time selection widget. */ virtual ~KTimeWidget(); /** * Returns the currently selected time. */ TQTime time() const; public slots: /** * Changes the selected time to @p time. */ void setTime(const TQTime & time); signals: /** * Emitted whenever the time of the widget * is changed, either with setTime() or via user selection. */ void valueChanged(const TQTime & time); private: void init(); private: class KTimeWidgetPrivate; KTimeWidgetPrivate *d; }; #endif
/* * app-data-container.h * Copyright (C) 2010-2018 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _L_APP_DATA_CONTAINER_H_ #define _L_APP_DATA_CONTAINER_H_ #include <string> #include <unordered_map> #include "linphone/utils/general.h" // ============================================================================= LINPHONE_BEGIN_NAMESPACE class AppDataContainerPrivate; class LINPHONE_PUBLIC AppDataContainer { public: AppDataContainer (); AppDataContainer (const AppDataContainer &other); virtual ~AppDataContainer (); AppDataContainer &operator= (const AppDataContainer &other); const std::unordered_map<std::string, std::string> &getAppDataMap () const; const std::string &getAppData (const std::string &name) const; void setAppData (const std::string &name, const std::string &appData); void setAppData (const std::string &name, std::string &&appData); private: AppDataContainerPrivate *mPrivate = nullptr; L_DECLARE_PRIVATE(AppDataContainer); }; LINPHONE_END_NAMESPACE #endif // ifndef _L_APP_DATA_CONTAINER_H_
#include "seatest.h" #include "../../src/engine/keys.h" static void treat_full_commands_right(void) { assert_int_equal(KEYS_WAIT, execute_keys(L"\"")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a1")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a1d")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a1d\"")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a1d\"r")); assert_int_equal(KEYS_WAIT, execute_keys(L"\"a1d\"r1")); assert_false(IS_KEYS_RET_CODE(execute_keys(L"\"a1d\"r1k"))); } void longest(void) { test_fixture_start(); run_test(treat_full_commands_right); test_fixture_end(); } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab : */
/** * Copyright (C) 2012 Konstantin Mosesov * * This file is part of Kamailio, a free SIP server. * * This file 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 file 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 * */ // Python includes #include <Python.h> #include "structmember.h" // Other/system includes #include <libgen.h> // router includes #include "../../str.h" #include "../../sr_module.h" // local includes #include "python_exec.h" #include "app_python_mod.h" #include "python_iface.h" #include "python_msgobj.h" #include "python_support.h" #include "mod_Router.h" #include "mod_Logger.h" PyObject *_sr_apy_logger_module = NULL; /* * Python method: LM_GEN1(self, int log_level, str msg) */ static PyObject *logger_LM_GEN1(PyObject *self, PyObject *args) { int log_level; char *msg; if (!PyArg_ParseTuple(args, "is:LM_GEN1", &log_level, &msg)) return NULL; LM_GEN1(log_level, "%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_GEN2(self, int log_facility, int log_level, str msg) */ static PyObject *logger_LM_GEN2(PyObject *self, PyObject *args) { int log_facility; int log_level; char *msg; if(!PyArg_ParseTuple(args, "iis:LM_GEN2", &log_facility, &log_level, &msg)) return NULL; LM_GEN2(log_facility, log_level, "%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_ALERT(self, str msg) */ static PyObject *logger_LM_ALERT(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_ALERT", &msg)) return NULL; LM_ALERT("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_CRIT(self, str msg) */ static PyObject *logger_LM_CRIT(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_CRIT", &msg)) return NULL; LM_CRIT("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_WARN(self, str msg) */ static PyObject *logger_LM_WARN(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_WARN", &msg)) return NULL; LM_WARN("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_NOTICE(self, str msg) */ static PyObject *logger_LM_NOTICE(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_NOTICE", &msg)) return NULL; LM_NOTICE("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_ERR(self, str msg) */ static PyObject *logger_LM_ERR(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_ERR", &msg)) return NULL; LM_ERR("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_INFO(self, str msg) */ static PyObject *logger_LM_INFO(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_INFO", &msg)) return NULL; LM_INFO("%s", msg); Py_INCREF(Py_None); return Py_None; } /* * Python method: LM_DBG(self, str msg) */ static PyObject *logger_LM_DBG(PyObject *self, PyObject *args) { char *msg; if(!PyArg_ParseTuple(args, "s:LM_DBG", &msg)) return NULL; LM_DBG("%s", msg); Py_INCREF(Py_None); return Py_None; } PyMethodDef LoggerMethods[] = { {"LM_GEN1", (PyCFunction)logger_LM_GEN1, METH_VARARGS, "Print GEN1 message."}, {"LM_GEN2", (PyCFunction)logger_LM_GEN2, METH_VARARGS, "Print GEN2 message."}, {"LM_ALERT", (PyCFunction)logger_LM_ALERT, METH_VARARGS, "Print alert message."}, {"LM_CRIT", (PyCFunction)logger_LM_CRIT, METH_VARARGS, "Print critical message."}, {"LM_ERR", (PyCFunction)logger_LM_ERR, METH_VARARGS, "Print error message."}, {"LM_WARN", (PyCFunction)logger_LM_WARN, METH_VARARGS, "Print warning message."}, {"LM_NOTICE", (PyCFunction)logger_LM_NOTICE, METH_VARARGS, "Print notice message."}, {"LM_INFO", (PyCFunction)logger_LM_INFO, METH_VARARGS, "Print info message."}, {"LM_DBG", (PyCFunction)logger_LM_DBG, METH_VARARGS, "Print debug message."}, {NULL, NULL, 0, NULL} }; void init_mod_Logger(void) { _sr_apy_logger_module = Py_InitModule("Router.Logger", LoggerMethods); PyDict_SetItemString(_sr_apy_main_module_dict, "Logger", _sr_apy_logger_module); /* * Log levels * Reference: dprint.h */ PyModule_AddObject(_sr_apy_logger_module, "L_ALERT", PyInt_FromLong((long)L_ALERT)); PyModule_AddObject(_sr_apy_logger_module, "L_BUG", PyInt_FromLong((long)L_BUG)); PyModule_AddObject(_sr_apy_logger_module, "L_CRIT2", PyInt_FromLong((long)L_CRIT2)); /* like L_CRIT, but adds prefix */ PyModule_AddObject(_sr_apy_logger_module, "L_CRIT", PyInt_FromLong((long)L_CRIT)); /* no prefix added */ PyModule_AddObject(_sr_apy_logger_module, "L_ERR", PyInt_FromLong((long)L_ERR)); PyModule_AddObject(_sr_apy_logger_module, "L_WARN", PyInt_FromLong((long)L_WARN)); PyModule_AddObject(_sr_apy_logger_module, "L_NOTICE", PyInt_FromLong((long)L_NOTICE)); PyModule_AddObject(_sr_apy_logger_module, "L_INFO", PyInt_FromLong((long)L_INFO)); PyModule_AddObject(_sr_apy_logger_module, "L_DBG", PyInt_FromLong((long)L_DBG)); /* * Facility * Reference: dprint.h */ PyModule_AddObject(_sr_apy_logger_module, "DEFAULT_FACILITY", PyInt_FromLong((long)DEFAULT_FACILITY)); Py_INCREF(_sr_apy_logger_module); #ifdef WITH_EXTRA_DEBUG LM_ERR("Module 'Router.Logger' has been initialized\n"); #endif } void destroy_mod_Logger(void) { Py_XDECREF(_sr_apy_logger_module); #ifdef WITH_EXTRA_DEBUG LM_ERR("Module 'Router.Logger' has been destroyed\n"); #endif }
/* * Copyright (C) 2012 Peter Christensen <pch@ordbogen.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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef INCLUDE_TELNETSESSION_H #define INCLUDE_TELNETSESSION_H #include "ipaddress.h" #include <cstdint> #include <vector> class TelnetServer; class VrrpService; class TelnetSession { public: TelnetSession (int fd, TelnetServer *server); ~TelnetSession (); private: static void onIncomingData (int fd, void *userData); void receiveChunk (); bool handleCommand (char *command, unsigned int size); bool onCommand (const std::vector<char *> &argv); void onAddCommand (const std::vector<char *> &argv); void onAddRouterCommand (const std::vector<char *> &argv); void onAddAddressCommand (const std::vector<char *> &argv); void onRemoveCommand (const std::vector<char *> &argv); void onRemoveRouterCommand (const std::vector<char *> &argv); void onRemoveAddressCommand (const std::vector<char *> &argv); void onSetCommand (const std::vector<char *> &argv); void onSetRouterCommand (const std::vector<char *> &argv); void onEnableCommand (const std::vector<char *> &argv); void onDisableCommand (const std::vector<char *> &argv); void onShowCommand (const std::vector<char *> &argv); void onShowRouterCommand (const std::vector<char *> &argv); void onShowStatsCommand (const std::vector<char *> &argv); void onSaveCommand (const std::vector<char *> &argv); void showRouter (const VrrpService *service); void showRouterStats (const VrrpService *service); void sendFormatted (const char *templ, ...); static std::vector<char *> splitCommand (char *command); VrrpService *getService (const std::vector<char *> &argv, bool create = false); private: int m_socket; unsigned int m_bufferSize; TelnetServer *m_server; char m_buffer[1024]; bool m_overflow; }; #endif
/* -*- mode:c++ -*- ******************************************************** * file: TestParam.h * * author: Andreas Koepke * * copyright: (C) 2004 Telecommunication Networks Group (TKN) at * Technische Universitaet Berlin, Germany. * * 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. * For further information see file COPYING * in the top level directory *************************************************************************** * part of: framework implementation developed by tkn * description: Blackboard parameter for test purposes *************************************************************************** * changelog: $Revision: 1.3 $ * last modified: $Date: 2004/02/09 13:59:33 $ * by: $Author: omfw-willkomm $ **************************************************************************/ #ifndef TESTPARAM_H #define TESTPARAM_H #include <Blackboard.h> class TestParam : public BBItem { BBITEM_METAINFO(BBItem) public: enum States { BLUE, RED, GREEN }; private: States state; public: States getState() const { return state; } void setState(States s) { state = s; } TestParam(States s=BLUE) : BBItem(), state(s){}; }; #endif
/* Test exception in current environment. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <fenv_libc.h> int fetestexcept (int excepts) { unsigned long f; /* Get the current state. */ f = fegetenv_register (); return f & excepts; } libm_hidden_def (fetestexcept)
/** * @file functions.h * @author hbuyse * @date 10/11/2015 */ #ifndef __FUNCTIONS_H__ #define __FUNCTIONS_H__ #include <fcgiapp.h> // FCGX_GetParam, FCGX_Request #include <stdbool.h> // bool typedef struct Request_s Request_t; /** * @brief Another request structure to stock the FCGX request * */ struct Request_s { char *content_length; char *content_string; char *content_type; char *method; char *path_info; char *query_string; char *remote_addr; char *remote_port; char *script_filename; char *script_name; char *server_name; char *uri; bool is_multipart; }; /** * @brief Parse a FCGX request and store its elements in an request structure * * @param[in] request The FCGX request to parse * @param[out] req The request structure to fill * * @return Error code */ short request_fill(FCGX_Request request, Request_t *req); /** * @brief Display all the elements of an request structure * * @param[in] req The request structure to display * @param[in] request_nb The number of the FCGX request */ void request_display(Request_t req, unsigned int request_nb); /** * @brief Get the content_string from the FCGX request * * @param[in] request The FCGX request from which we get the CONTENT_STRING * @param[in,out] req The request structure to fill with the CONTENT_STRING * * @return Error code */ short get_content_string(FCGX_Request request, Request_t *req); /** * @brief Check if the FCGX request is a multipart * * @param[in,out] req The request structure to fill */ void is_request_multipart(Request_t *req); #endif // __FUNCTIONS_H__
/* Transfer the receive right from one port structure to another Copyright (C) 1996, 2003 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. The GNU Hurd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU Hurd 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, USA. */ #include "ports.h" #include <assert.h> #include <hurd/ihash.h> error_t ports_transfer_right (void *tostruct, void *fromstruct) { struct port_info *topi = tostruct; struct port_info *frompi = fromstruct; mach_port_t port; int dereffrompi = 0; int dereftopi = 0; int hassendrights = 0; error_t err; pthread_mutex_lock (&_ports_lock); /* Fetch the port in FROMPI and clear its use */ port = frompi->port_right; if (port != MACH_PORT_NULL) { pthread_rwlock_wrlock (&_ports_htable_lock); hurd_ihash_locp_remove (&_ports_htable, frompi->ports_htable_entry); hurd_ihash_locp_remove (&frompi->bucket->htable, frompi->hentry); pthread_rwlock_unlock (&_ports_htable_lock); frompi->port_right = MACH_PORT_NULL; if (frompi->flags & PORT_HAS_SENDRIGHTS) { frompi->flags &= ~PORT_HAS_SENDRIGHTS; hassendrights = 1; dereffrompi = 1; } } /* Destroy the existing right in TOPI. */ if (topi->port_right != MACH_PORT_NULL) { pthread_rwlock_wrlock (&_ports_htable_lock); hurd_ihash_locp_remove (&_ports_htable, topi->ports_htable_entry); hurd_ihash_locp_remove (&topi->bucket->htable, topi->hentry); pthread_rwlock_unlock (&_ports_htable_lock); err = mach_port_mod_refs (mach_task_self (), topi->port_right, MACH_PORT_RIGHT_RECEIVE, -1); assert_perror (err); if ((topi->flags & PORT_HAS_SENDRIGHTS) && !hassendrights) { dereftopi = 1; topi->flags &= ~PORT_HAS_SENDRIGHTS; } else if (((topi->flags & PORT_HAS_SENDRIGHTS) == 0) && hassendrights) { topi->flags |= PORT_HAS_SENDRIGHTS; refcounts_ref (&topi->refcounts, NULL); } } /* Install the new right in TOPI. */ topi->port_right = port; topi->cancel_threshold = frompi->cancel_threshold; topi->mscount = frompi->mscount; pthread_mutex_unlock (&_ports_lock); if (port) { pthread_rwlock_wrlock (&_ports_htable_lock); err = hurd_ihash_add (&_ports_htable, port, topi); assert_perror (err); err = hurd_ihash_add (&topi->bucket->htable, port, topi); pthread_rwlock_unlock (&_ports_htable_lock); assert_perror (err); if (topi->bucket != frompi->bucket) { err = mach_port_move_member (mach_task_self (), port, topi->bucket->portset); assert_perror (err); } } /* Take care of any lowered reference counts. */ if (dereffrompi) ports_port_deref (frompi); if (dereftopi) ports_port_deref (topi); return 0; }
/* * bc - bc module for eiwic * * by lordi@styleliga.org | http://lordi.styleliga.org/ * * 'bc' is copyrighted * 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <signal.h> #include <sys/wait.h> #include <arpa/inet.h> #include <sys/time.h> #include <ctype.h> #include <dlfcn.h> #include <time.h> #include "eiwic.h" #include "plugins.h" EP_SETNAME("bc"); /* two defines which make the working with pipes more easier ;) */ #define R 0 #define W 1 #define BC_TIMEOUT 2 /* bc timeout in seconds */ #define BC_MAXLINES 4 /* lines of bc result that are printed out maximally */ /* function to be called on '!bc' or '!calc' */ int on_bc(char *a, OUTPUT *out, MSG *m) { FILE *f; char buf[1025]; /* read buffer */ int version = 0; int lines = 0, success = 0; int pid = 0; /* child pid */ int fdin[2], fdout[2]; /* our pipes */ fd_set readfd; struct timeval tv; if (a == NULL) /* if no parameter is given */ { version = 1; } else { if (strchr(a, '\"') || strchr(a, '\\')) return 0; if (strcasecmp(a, "version") == 0) version = 1; } /* create the in and out pipes for the execution of 'bc' */ if ((pipe(fdin) < 0) || (pipe(fdout) < 0)) { eiwic->log(LOG_ERROR, "Unable to create pipe"); return 0; } eiwic->log(LOG_DEBUG, "Forking.."); if ((pid = fork()) == 0) { /* set up stdin/out/err and execute bc */ close(fdout[R]); close(fdin[W]); dup2(fdin[R], STDIN_FILENO); dup2(fdout[W], STDOUT_FILENO); dup2(fdout[W], STDERR_FILENO); if (version) execlp("bc", "bc", "--version", NULL); else execlp("bc", "bc", "-q", "-l", NULL); /* we should never come here */ close(fdout[W]); close(fdin[R]); exit(1); } if (pid == -1) { eiwic->log(LOG_ERROR, "fork() failed"); return 0; } /* set up in and out pipes */ close(fdout[W]); close(fdin[R]); /* write the parameter to bc */ if (version == 0) { f = fdopen(fdin[W], "w"); fprintf(f, "%s\n", a); fclose(f); } close(fdin[W]); if (fcntl(fdout[R], F_SETFL, O_NONBLOCK) == -1) { eiwic->log(LOG_ERROR, "fcntl() failed"); return 0; } f = fdopen(fdout[R], "r"); FD_ZERO(&readfd); FD_SET(fdout[R], &readfd); tv.tv_sec = BC_TIMEOUT; tv.tv_usec = 0; /* select loop */ while (select(FD_SETSIZE, &readfd, NULL, NULL, &tv) > 0 && lines < BC_MAXLINES) { if (FD_ISSET(fdout[R], &readfd)) { if (fgets(buf, 1024, f) == NULL) { success = 1; break; } if (lines == 0 && a != NULL) { eiwic->output_printf(out, "%s = %s\n", a, strtok(buf, "\r\n")); } else { eiwic->output_printf(out, "| %s\n", strtok(buf, "\r\n")); } lines++; } FD_ZERO(&readfd); FD_SET(fdout[R], &readfd); tv.tv_sec = BC_TIMEOUT; tv.tv_usec = 0; } fclose(f); close(fdout[R]); eiwic->log(LOG_DEBUG, "Finished."); kill(pid, 9); waitpid(pid, NULL, 0); if (success == 0) { if (lines >= BC_MAXLINES) { eiwic->output_print(out, "(..)\n"); } else { eiwic->output_print(out, "bc: Timeout waiting for a response :(\n"); } } return 1; } int ep_help(OUTPUT *out) { eiwic->output_print(out, "bc is a module which brings the output of the\n"); eiwic->output_print(out, "GNU bc program to IRC. It can calculate complex\n"); eiwic->output_print(out, "mathematical tasks.\n"); eiwic->output_print(out, "More information: http://www.gnu.org/software/bc/\n"); eiwic->output_print(out, "Just call '!bc <something>', where <something> is\n"); eiwic->output_print(out, "a mathematical task (eg. '!bc (2.75/43)^8').\n"); } int ep_main(OUTPUT *out) { /* TODO: return 0; if command line tool 'bc' is not available */ /* register triggers */ eiwic->plug_trigger_reg("!bc", TRIG_PUBLIC, on_bc); return 1; }
#include "sensors/battery_voltage.h" #include "sensors/adc_sensor.h" struct measurable batt_v_measurables[] = { {.id = 0, .name = "battery voltage", .unit = "Volts"} }; struct sensor_type batt_v_sensor_type = { .sample_fn = &batt_v_sample, /* We are using the bus clock therefore we must not enter STOP */ .no_stop = true, .n_measurables = 1, .measurables = batt_v_measurables }; static void batt_v_sample_done(uint16_t codepoint, int error, void *cbdata) { struct sensor *sensor = cbdata; struct batt_v_sensor_data *sd = sensor->sensor_data; gpio_write(sd->enable_pin, GPIO_HIGH); sd->value = adc_as_voltage(codepoint) * sd->divider; sensor_new_sample(sensor, &sd->value); } void batt_v_sample(struct sensor *sensor) { struct batt_v_sensor_data *sd = sensor->sensor_data; adc_sensor_init(); gpio_dir(sd->enable_pin, GPIO_OUTPUT); gpio_write(sd->enable_pin, GPIO_LOW); adc_queue_sample(&sd->ctx, sd->channel, ADC_MODE_AVG_32, batt_v_sample_done, sensor); } void batt_v_init(struct sensor *sensor) { struct batt_v_sensor_data *sd = sensor->sensor_data; enum gpio_pin_id pin = sd->enable_pin; gpio_dir(pin, GPIO_DISABLE); pin_mode(pin, PIN_MODE_MUX_GPIO | PIN_MODE_PULLUP); }
/* * Copyright (c) 2004, Bull SA. All rights reserved. * Created by: Laurent.Vivier@bull.net * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * assertion: * * aio_fsync() shall asynchronously force I/O operations associated * with aio_fildes. * * method: * * UNTESTED * * We are not able to check if I/O operations have been forced. * */ #define _XOPEN_SOURCE 600 #include <stdlib.h> #include <unistd.h> #include "posixtest.h" int main() { if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L) exit(PTS_UNSUPPORTED); exit(PTS_UNTESTED); }
#ifndef EDITWINDOW_H #define EDITWINDOW_H #include <QMainWindow> class Highlighter; namespace Ui { class EditWindow; } class EditWindow : public QMainWindow { Q_OBJECT public: explicit EditWindow(QWidget *parent = 0,QString filePath = QString(),bool m_creation=false); ~EditWindow(); private: Ui::EditWindow *ui; bool readFile(); QString filePath; bool creation; Highlighter * highlighter; QAction * saveAct; QAction * updateAct; QToolBar * toolBar; void createActions(); void createToolBar(); bool maybeSave(); void closeEvent(QCloseEvent *e); private slots: bool fileSave(); bool fileUpdate(); signals: void updated(); void created(const QString & path); }; #endif // EDITWINDOW_H
/* * Copyright (c) 2012-2014 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( __VOS_GETBIN_H ) #define __VOS_GETBIN_H /**========================================================================= \file vos_getBin.h \brief virtual Operating System Services (vOSS) binary APIs Binary retrieval definitions and APIs. These APIs allow components to retrieve binary contents (firmware, configuration data, etc.) from a storage medium on the platform. ========================================================================*/ /* $Header$ */ /*-------------------------------------------------------------------------- Include Files ------------------------------------------------------------------------*/ #include <vos_types.h> #include <vos_status.h> /*-------------------------------------------------------------------------- Preprocessor definitions and constants ------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------- Type declarations ------------------------------------------------------------------------*/ /// Binary IDs typedef enum { /// Binary ID for firmware VOS_BINARY_ID_FIRMWARE, /// Binary ID for Configuration data VOS_BINARY_ID_CONFIG, /// Binary ID for country code to regulatory domain mapping VOS_BINARY_ID_COUNTRY_INFO, /// Binary ID for Handoff Configuration data VOS_BINARY_ID_HO_CONFIG, /// Binary ID for Dictionary Configuration data VOS_BINARY_ID_DICT_CONFIG } VOS_BINARY_ID; /*------------------------------------------------------------------------- Function declarations and documenation ------------------------------------------------------------------------*/ /**--------------------------------------------------------------------------- \brief vos_get_binary_blob() - get binary data from platform This API allows components to get binary data from the platform independent of where the data is stored on the device. <ul> <li> Firmware <li> Configuration Data </ul> \param binaryId - identifies the binary data to return to the caller. \param pBuffer - a pointer to the buffer where the binary data will be retrieved. Memory for this buffer is allocated by the caller and free'd by the caller. vOSS will fill this buffer with raw binary data and update the *pBufferSize with the exact size of the data that has been retreived. Input value of NULL is valid and will cause the API to return the size of the binary data in *pBufferSize. \param pBufferSize - pointer to a variable that upon input contains the size of the data buffer available at pBuffer. Upon success, this variable is updated with the size of the binary data that was retreived and written to the buffer at pBuffer. Input value of 0 is valid and will cause the API to return the size of the binary data in *pBufferSize. \return VOS_STATUS_SUCCESS - the binary data has been successfully retreived and written to the buffer. VOS_STATUS_E_INVAL - The value specified by binaryId does not refer to a valid VOS Binary ID. VOS_STATUS_E_FAULT - pBufferSize is not a valid pointer to a variable that the API can write to. VOS_STATUS_E_NOMEM - the memory referred to by pBuffer and *pBufferSize is not big enough to contain the binary. \sa --------------------------------------------------------------------------*/ VOS_STATUS vos_get_binary_blob( VOS_BINARY_ID binaryId, v_VOID_t *pBuffer, v_SIZE_t *pBufferSize ); /**---------------------------------------------------------------------------- \brief vos_get_conparam()- function to read the insmod parameters -----------------------------------------------------------------------------*/ tVOS_CON_MODE vos_get_conparam( void ); tVOS_CONCURRENCY_MODE vos_get_concurrency_mode( void ); v_BOOL_t vos_concurrent_open_sessions_running(void); v_BOOL_t vos_max_concurrent_connections_reached(void); #endif // !defined __VOS_GETBIN_H
/* * Unitlist * * $Id: units.c,v 1.12 1995/06/21 18:55:37 carnil Exp $ * */ /* System includes */ #include <assert.h> #include <string.h> /* Local includes */ #include "units.h" #include "mem.h" #include "lane.h" #include "load.h" #include "dump.h" #include "connect.h" #include "timers.h" #include "events.h" #include "atm.h" /* Type definitions */ /* Local function prototypes */ /* Data */ const Unit_t *unitlist[] = { &dump_unit, &mem_unit, &load_unit, &conn_unit, &main_unit, &timer_unit, &events_unit, &atm_unit, NULL }; const unsigned int num_units = sizeof(unitlist)/sizeof(Unit_t *)-1; /* Functions */ const Unit_t * find_unit(const char *name) { const Unit_t *tmp; unsigned int i; assert(name != NULL); for (i = 0; unitlist[i] != NULL; i++) { tmp = unitlist[i]; assert (tmp->name != NULL); if (strcmp(tmp->name, name) == 0) { return tmp; } } return NULL; }
#include <element.h> /*these are the count values of where the particle gets stored, depending on where it came from 0 1 2 7 . 3 6 5 4 PRTO does (count+4)%8, so that it will come out at the opposite place to where it came in PRTO does +/-1 to the count, so it doesn't jam as easily */ int update_PRTO(UPDATE_FUNC_ARGS) { int r, nnx, rx, ry, np, fe = 0; int count = 0; parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1); if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1; else if (parts[i].tmp<0) parts[i].tmp = 0; for (count=0; count<8; count++) { rx = portal_rx[count]; ry = portal_ry[count]; if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { r = pmap[y+ry][x+rx]; if (!r) fe = 1; if (r) continue; if (!r) { for ( nnx =0 ; nnx<80; nnx++) { int randomness = (count + rand()%3-1 + 4)%8;//add -1,0,or 1 to count if (portalp[parts[i].tmp][randomness][nnx].type==PT_SPRK)// TODO: make it look better, spark creation { create_part(-1,x+1,y,PT_SPRK); create_part(-1,x+1,y+1,PT_SPRK); create_part(-1,x+1,y-1,PT_SPRK); create_part(-1,x,y-1,PT_SPRK); create_part(-1,x,y+1,PT_SPRK); create_part(-1,x-1,y+1,PT_SPRK); create_part(-1,x-1,y,PT_SPRK); create_part(-1,x-1,y-1,PT_SPRK); portalp[parts[i].tmp][randomness][nnx] = emptyparticle; break; } else if (portalp[parts[i].tmp][randomness][nnx].type) { if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM) player.spwn = 0; if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2) player2.spwn = 0; if (portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH) { fighcount--; fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 0; } np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness][nnx].type); if (np<0) { if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM) player.spwn = 1; if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2) player2.spwn = 1; if (portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH) { fighcount++; fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1; } continue; } if (parts[np].type==PT_FIGH) { // Release the fighters[] element allocated by create_part, the one reserved when the fighter went into the portal will be used fighters[(unsigned char)parts[np].tmp].spwn = 0; fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1; } parts[np] = portalp[parts[i].tmp][randomness][nnx]; parts[np].x = x+rx; parts[np].y = y+ry; portalp[parts[i].tmp][randomness][nnx] = emptyparticle; break; } } } } } if (fe) { int orbd[4] = {0, 0, 0, 0}; //Orbital distances int orbl[4] = {0, 0, 0, 0}; //Orbital locations if (!parts[i].life) parts[i].life = rand()*rand()*rand(); if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand(); orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl); for (r = 0; r < 4; r++) { if (orbd[r]<254) { orbd[r] += 16; if (orbd[r]>254) { orbd[r] = 0; orbl[r] = rand()%255; } else { orbl[r] += 1; orbl[r] = orbl[r]%255; } } else { orbd[r] = 0; orbl[r] = rand()%255; } } orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl); } else { parts[i].life = 0; parts[i].ctype = 0; } return 0; }
#import "xmlvm.h" #import "android_widget_LinearLayout.h" // For circular include: @class java_lang_StringBuilder; @class android_view_View; @class android_internal_ViewHandler; @class android_view_ViewParent; @class android_widget_RadioButton; @class android_internal_Assert; @class org_xmlvm_iphone_UIFont; @class android_widget_RadioGroup; @class java_lang_Class; @class org_xmlvm_iphone_CGSize; @class android_widget_LinearLayout; @class org_xmlvm_iphone_NSString; @class java_util_ArrayList; @class java_lang_Object; @class java_util_List; @class android_view_ViewGroup_LayoutParams; @class android_widget_RadioGroup_1; @class java_lang_String; @class org_xmlvm_iphone_UIView; @class java_util_Iterator; @class android_content_Context; @class org_xmlvm_iphone_UISegmentedControl; @class android_util_AttributeSet; @class org_xmlvm_iphone_UIControlDelegate; @class android_view_View_MeasureSpec; @class java_lang_Math; // Automatically generated by xmlvm2obj. Do not edit! @interface android_widget_RadioGroup : android_widget_LinearLayout { @public java_util_List* radioButtons_java_util_List; } + (void) initialize; - (id) init; + (int) _GET_INTERNAL_PADDING_X; + (void) _PUT_INTERNAL_PADDING_X: (int) v; + (int) _GET_INTERNAL_PADDING_y; + (void) _PUT_INTERNAL_PADDING_y: (int) v; - (void) __init_android_widget_RadioGroup___android_content_Context :(android_content_Context*)n1; - (void) __init_android_widget_RadioGroup___android_content_Context_android_util_AttributeSet :(android_content_Context*)n1 :(android_util_AttributeSet*)n2; - (void) initRadioGroup___android_content_Context_android_util_AttributeSet :(android_content_Context*)n1 :(android_util_AttributeSet*)n2; - (void) addView___android_view_View_int :(android_view_View*)n1 :(int)n2; - (void) addView___android_view_View_android_view_ViewGroup_LayoutParams :(android_view_View*)n1 :(android_view_ViewGroup_LayoutParams*)n2; - (void) addView___android_view_View :(android_view_View*)n1; - (void) parseRadioGroupAttributes___android_util_AttributeSet :(android_util_AttributeSet*)n1; - (void) onMeasure___int_int :(int)n1 :(int)n2; - (org_xmlvm_iphone_CGSize*) getTextSize___java_lang_String :(java_lang_String*)n1; - (android_view_View*) findViewTraversal___int :(int)n1; - (org_xmlvm_iphone_UIView*) xmlvmNewUIView___android_util_AttributeSet :(android_util_AttributeSet*)n1; - (void) distributeOnClick__; - (void) setChecked___android_widget_RadioButton :(android_widget_RadioButton*)n1; - (void) setText___android_widget_RadioButton_java_lang_String :(android_widget_RadioButton*)n1 :(java_lang_String*)n2; - (android_widget_RadioButton*) getSelectedRadioButton__; + (void) access$000___android_widget_RadioGroup :(android_widget_RadioGroup*)n1; @end
#ifndef _HARDWARE_H #define _HARDWARE_H 1 #define PIN_TFT_RST 5 #define PIN_TFT_LIGHT 6 #define PIN_TFT_RD 7 #define PIN_TFT_WR 8 #define PIN_TFT_CD 9 #define PIN_TFT_CS 11 #define PIN_I2CRST 53 #define PIN_IRQ0 22 #define PIN_IRQ1 23 #define PIN_IRQ2 24 #define PIN_IRQ3 25 #define PIN_IRQ4 26 #define PIN_IRQ5 27 #define PIN_IRQ6 28 #define PIN_IRQ7 29 #define I2C_MCP23017_0 0x20 #define I2C_MCP23017_1 0x21 #define I2C_MCP23017_2 0x22 #define I2C_MCP23017_3 0x23 #define I2C_EEPROM 0x50 #define APIN_BUTTON_PREV 1 #define APIN_BUTTON_OK_MENU 2 #define APIN_BUTTON_NEXT 3 #define APIN_BUTTON_TRIGGER_TEMPO 4 #define APIN_BUTTON_LAYER_STOP 5 #endif
/* * Copyright (C) 2003 Robert Kooima * * NEVERBALL 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. */ #include "item.h" #include "glext.h" #include "vec3.h" #include "solid_gl.h" #include "image.h" #include "config.h" /*---------------------------------------------------------------------------*/ static struct s_file item_coin_file; static struct s_file item_grow_file; static struct s_file item_shrink_file; void item_color(const struct s_item *hp, float *c) { switch (hp->t) { case ITEM_COIN: if (hp->n >= 1) { c[0] = 1.0f; c[1] = 1.0f; c[2] = 0.2f; } if (hp->n >= 5) { c[0] = 1.0f; c[1] = 0.2f; c[2] = 0.2f; } if (hp->n >= 10) { c[0] = 0.2f; c[1] = 0.2f; c[2] = 1.0f; } break; case ITEM_GROW: c[0] = 0.00f; c[1] = 0.51f; c[2] = 0.80f; break; case ITEM_SHRINK: c[0] = 1.00f; c[1] = 0.76f; c[2] = 0.00f; break; default: c[0] = 1.0f; c[1] = 1.0f; c[2] = 1.0f; break; } } void item_init(void) { int T = config_get_d(CONFIG_TEXTURES); sol_load_gl(&item_coin_file, "item/coin/coin.sol", T, 0); sol_load_gl(&item_grow_file, "item/grow/grow.sol", T, 0); sol_load_gl(&item_shrink_file, "item/shrink/shrink.sol", T, 0); } void item_free(void) { sol_free_gl(&item_coin_file); sol_free_gl(&item_grow_file); sol_free_gl(&item_shrink_file); } void item_push(int type) { //glEnable(GL_COLOR_MATERIAL); FIXME } void item_draw(const struct s_item *hp, float r) { float c[3]; struct s_file *fp = NULL; switch (hp->t) { case ITEM_COIN: fp = &item_coin_file; break; case ITEM_GROW: fp = &item_grow_file; break; case ITEM_SHRINK: fp = &item_shrink_file; break; } item_color(hp, c); glColor3fv(c); sol_draw(fp, 0, 1); } void item_pull(void) { glColor3f(1.0f, 1.0f, 1.0f); //glDisable(GL_COLOR_MATERIAL); FIXME } /*---------------------------------------------------------------------------*/
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD 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. * OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file date_func.h Functions related to dates. */ #ifndef DATE_FUNC_H #define DATE_FUNC_H #include "date_type.h" extern Year _cur_year; extern Month _cur_month; extern Date _date; extern DateFract _date_fract; extern uint16 _tick_counter; void SetDate(Date date); void ConvertDateToYMD(Date date, YearMonthDay *ymd); Date ConvertYMDToDate(Year year, Month month, Day day); static inline bool IsLeapYear(Year yr) { return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0); } #endif /* DATE_FUNC_H */
/* * GStreamer * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __GST_GL_WINDOW_COCOA_H__ #define __GST_GL_WINDOW_COCOA_H__ #include <gst/gst.h> #include <gst/gl/gl.h> G_BEGIN_DECLS #define GST_GL_TYPE_WINDOW_COCOA (gst_gl_window_cocoa_get_type()) #define GST_GL_WINDOW_COCOA(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_COCOA, GstGLWindowCocoa)) #define GST_GL_WINDOW_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_COCOA, GstGLWindowCocoaClass)) #define GST_GL_IS_WINDOW_COCOA(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_COCOA)) #define GST_GL_IS_WINDOW_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_COCOA)) #define GST_GL_WINDOW_COCOA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_COCOA, GstGLWindowCocoaClass)) typedef struct _GstGLWindowCocoa GstGLWindowCocoa; typedef struct _GstGLWindowCocoaPrivate GstGLWindowCocoaPrivate; typedef struct _GstGLWindowCocoaClass GstGLWindowCocoaClass; struct _GstGLWindowCocoa { /*< private >*/ GstGLWindow parent; /*< private >*/ GstGLWindowCocoaPrivate *priv; gpointer _reserved[GST_PADDING]; }; struct _GstGLWindowCocoaClass { /*< private >*/ GstGLWindowClass parent_class; /*< private >*/ gpointer _reserved[GST_PADDING_LARGE]; }; GType gst_gl_window_cocoa_get_type (void); GstGLWindowCocoa * gst_gl_window_cocoa_new (void); void gst_gl_window_cocoa_draw_thread (GstGLWindowCocoa *window_cocoa); G_END_DECLS #endif /* __GST_GL_WINDOW_COCOA_H__ */
/* * defs.h * Contains the global definitions. * * Author: RPS * * Created: Jan/96 * Copyright (c) 1999 by Richard J. Cook, University of Waterloo */ #ifndef __DEFS_H__ #define __DEFS_H__ /* * Boolean definitions */ #define BOOL int #define FALSE 0 #define TRUE (!FALSE) #define Inf 1e308 /* * File defintions * MAX_DATALINE = maximum characters per line */ #define MAX_DATALINE 256 #ifndef _MAX_PATH #define _MAX_PATH 512 #endif /* * Default settings * TOLERANCE = floating point tolerance * MAX_ITER = maximum number of iterations to perform */ #define TOLERANCE 10E-10 #define MAX_ITER 100 #define NUM_IDENTIFIERS 3 /* Subject ID, Gap ID, Gap Time */ #define MAX_STATES 2 /* maximum number of states */ #define MAX_COVARIATES 1 /* maximum number of covariates */ #define MIN_NUM_COLUMNS NUM_IDENTIFIERS + MAX_STATES * MAX_STATES #define MAX_NUM_COLUMNS MIN_NUM_COLUMNS + MAX_COVARIATES #define COL_SUBJECT_ID 0 #define COL_GAP_ID 1 #define COL_GAP_TIME 2 #define COL_RESPONSES 3 #define COL_COVARIATE MIN_NUM_COLUMNS #define NUM_FACTORS 3 #define FACTOR_A 0 #define FACTOR_B 1 #define FACTOR_C 2 #define SIZE_SUBJECT_BLOCKS 100 #define SIZE_BRANCH_BLOCKS 100 #define ID_NO_ERROR 0 #define ID_ERR_MEMORY 1000 #define ID_ERR_NOFILENAME 2000 #define ID_ERR_NOFILE 2001 #define ID_ERR_INCORRECTFORMAT 2100 #endif
#ifndef _MYADNS_H # define _MYADNS_H #define TRACK_REQUESTS 1 #define TRACK_FWD 1 #define TRACK_REV 2 int myadns_init(void (* /* callback */)(int /* type */, const void *, const void *), unsigned int /* concurrency */); void myadns_fini(void); int myadns_fwdlookup(const char *); int myadns_alllookup(const char *); int myadns_revlookup(const struct sockaddr *); int myadns_gather(void); void myadns_track_dump(void); int myadns_track_pending(int /* type */, const void * /* data */); #endif
/** * Mupen64 - rom.h * Copyright (C) 2002 Hacktarux * * Mupen64 homepage: http://mupen64.emulation64.com * email address: hacktarux@yahoo.fr * * If you want to contribute to the project please contact * me first (maybe someone is already making what you are * planning to do). * * * This program is free software; you can redistribute it and/ * or modify it under the terms of the GNU General Public Li- * cence as published by the Free Software Foundation; either * version 2 of the Licence, or any later version. * * This program is distributed in the hope that it will be use- * ful, but WITHOUT ANY WARRANTY; without even the implied war- * ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public Licence for more details. * * You should have received a copy of the GNU General Public * Licence along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, * USA. * **/ #ifndef ROM_H #define ROM_H #include "winlnxdefs.h" int rom_read(const char *argv); int fill_header(const char *argv); void calculateMD5(const char *argv, u8 digest[16]); extern u8 *rom; extern int taille_rom; typedef struct _rom_header { u8 init_PI_BSB_DOM1_LAT_REG; u8 init_PI_BSB_DOM1_PGS_REG; u8 init_PI_BSB_DOM1_PWD_REG; u8 init_PI_BSB_DOM1_PGS_REG2; u32 ClockRate; u32 PC; u32 Release; u32 CRC1; u32 CRC2; u32 Unknown[2]; u8 nom[20]; u32 unknown; u32 Manufacturer_ID; u16 Cartridge_ID; u16 Country_code; u32 Boot_Code[1008]; } rom_header; extern rom_header *ROM_HEADER; typedef struct _rom_settings { char goodname[256]; int eeprom_16kb; char MD5[33]; } rom_settings; extern rom_settings ROM_SETTINGS; #endif
/* * MD header for contrib/gdtoa * * This file can be generated by compiling and running contrib/gdtoa/qnan.c * on the target architecture after arith.h has been generated. * * $FreeBSD: release/8.2.0/lib/libc/mips/gd_qnan.h 178580 2008-04-26 12:08:02Z imp $ */ #include <machine/endian.h> #if BYTE_ORDER == BIG_ENDIAN /* These values were gained on a running * Octeon in Big Endian order. They were gotten * by running ./qnan after arithchk was ran and * got us the proper values for arith.h. */ #define f_QNAN 0x7f900000 #define d_QNAN0 0x7ff80000 #define d_QNAN1 0x0 #define ld_QNAN0 0x7ff80000 #define ld_QNAN1 0x0 #define ld_QNAN2 0x0 #define ld_QNAN3 0x0 #define ldus_QNAN0 0x7ff8 #define ldus_QNAN1 0x0 #define ldus_QNAN2 0x0 #define ldus_QNAN3 0x0 #define ldus_QNAN4 0x0 #else /* FIX FIX, need to run this on a Little Endian * machine and get the proper values, these here * were stolen fromn i386/gd_qnan.h */ #define f_QNAN 0x7fc00000 #define d_QNAN0 0x0 #define d_QNAN1 0x7ff80000 #define ld_QNAN0 0x0 #define ld_QNAN1 0xc0000000 #define ld_QNAN2 0x7fff #define ld_QNAN3 0x0 #define ldus_QNAN0 0x0 #define ldus_QNAN1 0x0 #define ldus_QNAN2 0x0 #define ldus_QNAN3 0xc000 #define ldus_QNAN4 0x7fff #endif
/* * CATPS.C: concat a series of PostScript files produced by yapp_pgplot. * * * 22-jun-97 cloned off catps, but made the last ps file the main one? */ #include <stdinc.h> #define STARTPAGE "%%PageBoundingBox: (atend)\n" #define SHOWPAGE "PGPLOT restore showpage\n" #define LBUF 256 void myerror(string msg,string p1); bool readline(string buf, stream str); main(int argc, string argv[]) { int i; stream s; bool inprolog; char buf[LBUF]; if (argc < 2) myerror("Usage: %s file1 file2 ...\n", argv[0]); for (i = 1; i < argc; i++) { s = fopen(argv[i], "r"); if (s == NULL) myerror("### Fatal error: File %s not found\n", argv[i]); inprolog = TRUE; while (readline(buf, s)) /* loop reading lines */ if (inprolog) { /* reading file header? */ if (i == 1) /* first input file? */ printf("%s", buf); /* copy to output */ if (streq(buf, STARTPAGE)) /* end of header? */ inprolog = FALSE; /* new input state */ } else { if (streq(buf, SHOWPAGE) && i < argc-1) { /* end of frame? */ (void) readline(buf, s); /* get restore cmmd */ printf("%s", buf); /* and copy it out */ break; /* exit while loop */ } printf("%s", buf); /* copy to output */ } fclose(s); } } bool readline(string buf, stream str) { return (fgets(buf, LBUF, str) != NULL); } /* * Cannot use the NEMO error() call, since it assumes * the user interface initparam() */ void myerror(string msg,string p1) { fprintf(stderr,msg,p1); exit(-1); }
/***************************************************************************** * GraphicsEffectItem.h: Represent an effect in the timeline. ***************************************************************************** * Copyright (C) 2008-2014 VideoLAN * * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr> * * 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 GRAPHICSEFFECTITEM_H #define GRAPHICSEFFECTITEM_H #include "AbstractGraphicsItem.h" #include "EffectsEngine/EffectsEngine.h" class EffectUser; class AbstractGraphicsMediaItem; class GraphicsEffectItem : public AbstractGraphicsItem { Q_OBJECT public: enum { Type = UserType + 3 }; GraphicsEffectItem( Effect *effect ); GraphicsEffectItem( EffectHelper *helper ); virtual const QUuid& uuid() const; virtual int type() const; virtual bool expandable() const; virtual bool moveable() const; virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ); virtual Workflow::TrackType trackType() const; EffectHelper* effectHelper(); virtual qint64 begin() const; virtual qint64 end() const; virtual qint64 maxBegin() const; virtual qint64 maxEnd() const; virtual Workflow::Helper *helper(); virtual void triggerMove( EffectUser *target, qint64 startPos ); virtual void triggerResize( EffectUser *tw, Workflow::Helper *helper, qint64 newBegin, qint64 newEnd, qint64 pos ); virtual qint64 itemHeight() const; virtual qint32 zSelected() const; virtual qint32 zNotSelected() const; void setContainer( AbstractGraphicsMediaItem *item ); const AbstractGraphicsMediaItem *container() const; virtual void setStartPos( qint64 position ); protected: virtual bool hasResizeBoundaries() const; virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ); /** * \brief Paint the item's rectangle. * \param painter Pointer to a QPainter. * \param option Painting options. */ void paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option ); /** * \brief Paint the item's title. * \param painter Pointer to a QPainter. * \param option Painting options. */ void paintTitle( QPainter* painter, const QStyleOptionGraphicsItem* option ); private slots: void containerMoved( qint64 pos ); private: Effect *m_effect; EffectHelper *m_effectHelper; AbstractGraphicsMediaItem *m_container; }; #endif // GRAPHICSEFFECTITEM_H
#ifndef __TCPFileDown_H #define __TCPFileDown_H class CTCPFileClient { PropertyMember(std::string,OptDir); //²Ù×÷Ŀ¼ public: CTCPFileClient(); ~CTCPFileClient(); public: int SetSockKeepAlive(SOCKET socket,DWORD dwHeartBeatTimeInterval,DWORD dwWaitTimeOfNoData); BOOL Connect(const std::string& sIp,WORD wPort); BOOL ReportOnlineSvrInfo(); BOOL DownFileIndex(const std::string & sFileName , const std::string& sLocalName); BOOL DownFile(const std::string & sFileName , const std::string& sLocalName); void Close(); BOOL OperDataCode(char * buffer,DWORD len); int SendData(DWORD dwMsg,const std::string& sXml); std::vector<char> DownFile(std::string& sFileName); protected: yCTcp mTcp; std::string mIp; WORD mPort; CDebugLog m_save_log; DWORD dwRSyncTime; WORD wServerPort; private: std::string _work_key; }; #endif //__TCPFileDown_H
#pragma once // CClyCoffDlg dialog class CClyCoffDlg : public CDialog { DECLARE_DYNAMIC(CClyCoffDlg) public: CClyCoffDlg(CWnd* pParent = NULL); // standard constructor virtual ~CClyCoffDlg(); // Dialog Data enum { IDD = IDD_DIALOG_CLY_COFF_ATTR }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: _RecordsetPtr pRsDev; CString strSQL; CStringArray ColNameArray; public: void SQL(void); void AddList(void); private: CXTListCtrl ListCtrl; public: virtual BOOL OnInitDialog(); void AddListHeader(void); afx_msg void OnNMCustomdrawListCoff(NMHDR *pNMHDR, LRESULT *pResult); };
#ifndef __HPSJ5S_MIDDLE_LEVEL_API_HEADER__ #define __HPSJ5S_MIDDLE_LEVEL_API_HEADER__ #include <ieee1284.h> /*Scanner hardware registers*/ #define REGISTER_FUNCTION_CODE 0x70 /*Here goes function code */ #define REGISTER_FUNCTION_PARAMETER 0x60 /*Here goes function param */ #define ADDRESS_RESULT 0x20 /*Here we get result */ /*Scanner functions (not all - some of them I cann't identify)*/ #define FUNCTION_SETUP_HARDWARE 0xA0 /*Scanner hardware control flags:*/ /*Set this flag and non-zero speed to start rotation*/ #define FLAGS_HW_MOTOR_READY 0x1 /*Set this flag to turn on lamp*/ #define FLAGS_HW_LAMP_ON 0x2 /*Set this flag to turn indicator lamp off*/ #define FLAGS_HW_INDICATOR_OFF 0x4 /* Types: */ /*Color modes we support: 1-bit Drawing, 2-bit Halftone, 8-bit Gray Scale, 24-bt True Color*/ typedef enum { Drawing, Halftone, GrayScale, TrueColor } enumColorDepth; /*Middle-level API:*/ static int OpenScanner(const char *scanner_path); static void CloseScanner(int handle); static int DetectScanner(void); static void StandByScanner(void); static void SwitchHardwareState(SANE_Byte mask, SANE_Byte invert_mask); static int CheckPaperPresent(void); static int ReleasePaper(void); static int PaperFeed(SANE_Word wLinesToFeed); static void TransferScanParameters(enumColorDepth enColor, SANE_Word wResolution, SANE_Word wCorrectedLength); static void TurnOnPaperPulling(enumColorDepth enColor, SANE_Word wResolution); static void TurnOffPaperPulling(void); static SANE_Byte GetCalibration(void); static void CalibrateScanElements(void); /*Internal-use functions:*/ static int OutputCheck(void); static int InputCheck(void); static int CallCheck(void); static void LoadingPaletteToScanner(void); /*Low level warappers:*/ static void WriteAddress(SANE_Byte Address); static void WriteData(SANE_Byte Data); static void WriteScannerRegister(SANE_Byte Address, SANE_Byte Data); static void CallFunctionWithParameter(SANE_Byte Function, SANE_Byte Parameter); static SANE_Byte CallFunctionWithRetVal(SANE_Byte Function); static SANE_Byte ReadDataByte(void); static void ReadDataBlock(SANE_Byte * Buffer, int lenght); /*Daisy chaining API: (should be moved to ieee1284 library in future)*/ /*Deselect all devices in chain on this port.*/ static void daisy_deselect_all(struct parport *port); /*Select device with number 'daisy' in 'mode'.*/ static int daisy_select(struct parport *port, int daisy, int mode); /*Setup address for device in chain on this port*/ static int assign_addr(struct parport *port, int daisy); /* Send a daisy-chain-style CPP command packet. */ static int cpp_daisy(struct parport *port, int cmd); #endif
// // AvatarSync // Copyright (C) 2014-2015 Wolf Posdorfer // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // #import <UIKit/UIKit.h> #import "BigImageCell.h" #import "ASPerson.h" @protocol GenericTableOwner <NSObject> /** * Tells the controller to reload the table and refresh the Header View */ -(void) reloadTableData; @end @protocol GenericTableDelegate <NSObject> /** * Init this Delegate with a person * * @param person the person for which to update images * * @return initialized object */ -(id) initWithContact:(ASPerson*) person; /** * @return Title for the Navigation Controller */ -(NSString*) navTitle; /** * @return Title for the Header view */ -(NSString*) titleForHeader; /** * @return Description for the Header view */ -(NSString*) descriptionForHeader; /** * number of rows in section * * @param section section index * * @return number of rows */ -(NSInteger) numberOfRowsInSection:(NSInteger) section; /** * Number of Sections * * @return num_sec */ -(NSInteger) numberOfSections; /** * Apply stuff to the cell */ -(void) updateCell:(BigImageCell**) cell atIndex:(NSIndexPath*) indexpath; /** * Table was clicked at index from controller * * @param indexpath clicked index * @param controller owning controller */ -(void) clickedIndexAt:(NSIndexPath*) indexpath from:(UIViewController*) controller; /** * Title for table section * * @param section section index * * @return title */ -(NSString*) titleForSection:(NSInteger) section; @optional /** * The alertview was clicked * * @param buttonIndex clicked button * @param controller the owning controller */ -(void)alertViewClickedButtonAtIndex:(NSInteger)buttonIndex controller:(UIViewController*) controller; /** * Sets the delegate owner protocol stuff, useful for callbacks * * @param owner the GenericTable */ -(void) setOwner:(id<GenericTableOwner>) owner; /** * Called when the controller will disapper */ -(void) controllerWillDisapper; /** * Called when the controller will appear */ -(void) controllerWillAppear; @end
// // This file is part of Gambit // Copyright (c) 1994-2016, The Gambit Project (http://www.gambit-project.org) // // FILE: src/tools/enumpoly/nfgensup.h // Enumerate undominated subsupports of a support // // 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 "gambit/gambit.h" using namespace Gambit; // Produce all subsupports that could // host the path of a behavioral Nash equilibrium. These are subsupports // that have no strategy, at an active infoset, that is weakly dominated by // another active strategy, either in the conditional sense (for any active // node in the infoset) or the unconditional sense. In addition we // check for domination by strategys that are inactive, but whose activation // would not activate any currently inactive infosets, so that the // subsupport resulting from activation is consistent, in the sense // of having active strategys at all active infosets, and not at other // infosets. List<StrategySupportProfile> PossibleNashSubsupports(const StrategySupportProfile &S);
/* Authorg - a GNOME DVD authoring tool * * Copyright (C) 2005 Jens Georg <mail@jensge.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 Street #330, Boston, MA 02111-1307, USA. */ #ifndef _VIDEO_FILE_MPEG_H #define _VIDEO_FILE_MPEG_H #include <glib-object.h> #include <glib.h> #include "video-file.h" #define AUTHORG_TYPE_VIDEO_FILE_MPEG (authorg_video_file_mpeg_get_type()) #define AUTHORG_VIDEO_FILE_MPEG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUTHORG_TYPE_VIDEO_FILE_MPEG, AuthorgVideoFileMpeg)) #define AUTHORG_VIDEO_FILE_MPEG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUTHORG_TYPE_VIDEO_FILE_MPEG, AuthorgVideoFileMpegClass)) #define AUTHORG_IS_VIDEO_FILE_MPEG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUTHORG_TYPE_VIDEO_FILE_MPEG)) #define AUTHORG_IS_VIDEO_FILE_MPEG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), AUTHORG_TYPE_VIDEO_FILE_MPEG)) #define AUTHORG_VIDEO_FILE_MPEG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AUTHORG_TYPE_VIDEO_FILE_MPEG, VideoFileMpegClass)) typedef struct AuthorgVideoFileMpeg AuthorgVideoFileMpeg; typedef struct AuthorgVideoFileMpegClass AuthorgVideoFileMpegClass; typedef struct AuthorgVideoFileMpegPrivate AuthorgVideoFileMpegPrivate; struct AuthorgVideoFileMpeg { AuthorgVideoFile parent; }; struct AuthorgVideoFileMpegClass { AuthorgVideoFileClass parent; }; GType authorg_video_file_mpeg_get_type (void); AuthorgVideoFile *authorg_video_file_mpeg_new (const gchar *filename); #endif /* _VIDEO_FILE_MPEG_H */
#ifndef AL_RADIXSORT_H #define AL_RADIXSORT_H #include <iterator> #include <algorithm> #include <vector> #include <type_traits> #include <limits> namespace al { template<typename cont> // only allow containers containing unsigned integral types typename std::enable_if< std::is_integral<typename cont::value_type>::value && std::is_unsigned<typename cont::value_type>::value, void >::type radixsort(cont& values) { typedef typename cont::value_type value_type; typedef std::numeric_limits<value_type> value_limits; typedef std::vector<std::vector<value_type>> bucket_container; constexpr unsigned int base_ten = 10U; constexpr value_type max_digits = value_limits::digits10 + 1; value_type shift_width = 1; for(value_type digit_index = 1; digit_index <= max_digits; ++digit_index) { // performance assumption: declaring the bucket_container inside the loop // is faster than placing it outside the loop and resetting its // contents on every iteration bucket_container buckets(base_ten); bool is_all_done = true; for(const auto& value : values) { // shift value to the left by shift_width (base 10) const value_type base_ten_shifted = ( value / shift_width ); // if we shifted so far that there's no value left we can // return early is_all_done &= ( base_ten_shifted == 0 ); const unsigned int bucket_index = static_cast<unsigned int>( // extract last digit base_ten_shifted % base_ten ); buckets .at(bucket_index) .push_back(value) ; } typename cont::iterator it(values.begin()); for(const auto& bucket : buckets) { it = std::copy(bucket.begin(), bucket.end(), it); } if( is_all_done ) return; shift_width *= base_ten; } } } #endif // AL_RADIXSORT_H
/** * @file linux/include/asm-arm/arch-parrot/memory.h * * Copyright (C) 2007 Parrot S.A. * * @author ivan.djelic@parrot.com * @date 2007-06-11 * * 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 __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H #include <mach/platform.h> #ifdef CONFIG_ARCH_PARROT5 /* Physical memory offset for P5/P5+ family */ #define PHYS_OFFSET UL(0x10000000) #else /* Physical memory offset for P6 family */ #define PHYS_OFFSET UL(0x40000000) #endif /* * Virtual view <-> DMA view memory address translations * virt_to_bus: Used to translate the virtual address to an * address suitable to be passed to set_dma_addr * bus_to_virt: Used to convert an address for DMA operations * to an address that the kernel can use. */ #define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET) #define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET) /* define DMA address size */ #define CONSISTENT_DMA_SIZE (SZ_2M*7) #endif
#include "cache.h" #include "exec_cmd.h" #include "quote.h" #define MAX_ARGS 32 static const char *argv_exec_path; static const char *argv0_path; const char *system_path(const char *path) { #ifdef RUNTIME_PREFIX static const char *prefix; #else static const char *prefix = PREFIX; #endif struct strbuf d = STRBUF_INIT; if (is_absolute_path(path)) return path; #ifdef RUNTIME_PREFIX assert(argv0_path); assert(is_absolute_path(argv0_path)); if (!prefix && !(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) && !(prefix = strip_path_suffix(argv0_path, BINDIR)) && !(prefix = strip_path_suffix(argv0_path, "git"))) { prefix = PREFIX; trace_printf("RUNTIME_PREFIX requested, " "but prefix computation failed. " "Using static fallback '%s'.\n", prefix); } #endif strbuf_addf(&d, "%s/%s", prefix, path); path = strbuf_detach(&d, NULL); return path; } const char *git_extract_argv0_path(const char *argv0) { const char *slash; if (!argv0 || !*argv0) return NULL; slash = argv0 + strlen(argv0); while (argv0 <= slash && !is_dir_sep(*slash)) slash--; if (slash >= argv0) { argv0_path = xstrndup(argv0, slash - argv0); return slash + 1; } return argv0; } void git_set_argv_exec_path(const char *exec_path) { argv_exec_path = exec_path; /* * Propagate this setting to external programs. */ setenv(EXEC_PATH_ENVIRONMENT, exec_path, 1); } /* Returns the highest-priority, location to look for git programs. */ const char *git_exec_path(void) { const char *env; if (argv_exec_path) return argv_exec_path; env = getenv(EXEC_PATH_ENVIRONMENT); if (env && *env) { return env; } return system_path(GIT_EXEC_PATH); } static void add_path(struct strbuf *out, const char *path) { if (path && *path) { if (is_absolute_path(path)) strbuf_addstr(out, path); else strbuf_addstr(out, make_nonrelative_path(path)); strbuf_addch(out, PATH_SEP); } } void setup_path(void) { const char *old_path = getenv("PATH"); struct strbuf new_path = STRBUF_INIT; add_path(&new_path, git_exec_path()); add_path(&new_path, argv0_path); if (old_path) strbuf_addstr(&new_path, old_path); else strbuf_addstr(&new_path, _PATH_DEFPATH); setenv("PATH", new_path.buf, 1); strbuf_release(&new_path); } const char **prepare_git_cmd(const char **argv) { int argc; const char **nargv; for (argc = 0; argv[argc]; argc++) ; /* just counting */ nargv = xmalloc(sizeof(*nargv) * (argc + 2)); nargv[0] = "git"; for (argc = 0; argv[argc]; argc++) nargv[argc + 1] = argv[argc]; nargv[argc + 1] = NULL; return nargv; } int execv_git_cmd(const char **argv) { const char **nargv = prepare_git_cmd(argv); trace_argv_printf(nargv, "trace: exec:"); /* execvp() can only ever return if it fails */ execvp("git", (char **)nargv); trace_printf("trace: exec failed: %s\n", strerror(errno)); free(nargv); return -1; } int execl_git_cmd(const char *cmd,...) { int argc; const char *argv[MAX_ARGS + 1]; const char *arg; va_list param; va_start(param, cmd); argv[0] = cmd; argc = 1; while (argc < MAX_ARGS) { arg = argv[argc++] = va_arg(param, char *); if (!arg) break; } va_end(param); if (MAX_ARGS <= argc) return error("too many args to run %s", cmd); argv[argc] = NULL; return execv_git_cmd(argv); }
/* * BlizzLikeCore integrates as part of this file: CREDITS.md and LICENSE.md */ #ifndef BLIZZLIKE_MOVEMENTGENERATOR_IMPL_H #define BLIZZLIKE_MOVEMENTGENERATOR_IMPL_H #include "MovementGenerator.h" template<class MOVEMENT_GEN> inline MovementGenerator* MovementGeneratorFactory<MOVEMENT_GEN>::Create(void* /*data*/) const { return (new MOVEMENT_GEN()); } #endif
// // AKAvatarSupport.h // Avatar Support // // Created by Alexander Kempgen on 27.02.07. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @protocol MVChatPlugin; @class MVChatUser; @interface AKAvatarSupport : NSObject <MVChatPlugin> {} - (IBAction) requestAvatarMenuItemAction:(id) sender; - (IBAction) offerAvatarMenuItemAction:(id) sender; - (void) requestAvatarFromUser:(MVChatUser *)chatUser; - (void) offerAvatarToUser:(MVChatUser *)chatUser; - (void) saveAvatar:(NSImage *)anImage forUser:(MVChatUser *)chatUser; - (void) addAvatarToUser:(MVChatUser *)chatUser; - (NSImage *) avatarForUser:(MVChatUser *)chatUser; @end
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ /*** This file is part of systemd. Copyright 2012 Lennart Poettering systemd 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. systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <stdio.h> #include "log.h" #include "sd-journal.h" int main(int argc, char *argv[]) { unsigned n = 0; sd_journal *j; log_set_max_level(LOG_DEBUG); assert_se(sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY) >= 0); assert_se(sd_journal_add_match(j, "_TRANSPORT=syslog", 0) >= 0); assert_se(sd_journal_add_match(j, "_UID=0", 0) >= 0); SD_JOURNAL_FOREACH_BACKWARDS(j) { const void *d; size_t l; assert_se(sd_journal_get_data(j, "MESSAGE", &d, &l) >= 0); printf("%.*s\n", (int) l, (char*) d); n ++; if (n >= 10) break; } sd_journal_close(j); return 0; }
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: salwan.searty REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. This program tests the assertion that oss points to the alternate structure that was in effect prior to the call to sigaltstack. */ #define _XOPEN_SOURCE 600 #include <signal.h> #include <stdio.h> #include <stdlib.h> #include "posixtest.h" #define SIGTOTEST SIGUSR1 void handler(int signo) { printf("Do nothing useful\n"); } int main() { stack_t alternate_s, current_s; struct sigaction act; act.sa_flags = SA_ONSTACK; act.sa_handler = handler; sigemptyset(&act.sa_mask); if (sigaction(SIGUSR1, &act, 0) == -1) { perror ("Unexpected error while attempting to setup test pre-conditions"); return PTS_UNRESOLVED; } if ((alternate_s.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { perror ("Unexpected error while attempting to setup test pre-conditions"); return PTS_UNRESOLVED; } alternate_s.ss_flags = 0; alternate_s.ss_size = SIGSTKSZ; if (sigaltstack(&alternate_s, (stack_t *) 0) == -1) { perror ("Unexpected error while attempting to setup test pre-conditions"); return PTS_UNRESOLVED; } if (sigaltstack((stack_t *) 0, &current_s) == -1) { perror ("Unexpected error while attempting to setup test pre-conditions"); return PTS_UNRESOLVED; } if (current_s.ss_sp != alternate_s.ss_sp) { printf ("Test FAILED: ss_sp of the alternate stack is not same as the defined one\n"); exit(PTS_FAIL); } if (current_s.ss_size != alternate_s.ss_size) { printf ("Test FAILED: ss_size of the alternate stack is not same as the defined one\n"); exit(PTS_FAIL); } printf("Test PASSED\n"); return PTS_PASS; }
/* * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.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, see <http://www.gnu.org/licenses/>. */ #ifndef DEF_BLACKROCK_SPIRE_H #define DEF_BLACKROCK_SPIRE_H enum Data { DATA_OMOKK, DATA_SHADOW_HUNTER_VOSHGAJIN, DATA_WARMASTER_VOONE, DATA_MOTHER_SMOLDERWEB, DATA_UROK_DOOMHOWL, // not scripted DATA_QUARTERMASTER_ZIGRIS, DATA_GIZRUL_THE_SLAVENER, // not scripted DATA_HALYCON, DATA_OVERLORD_WYRMTHALAK, DATA_PYROGAURD_EMBERSEER, DATA_WARCHIEF_REND_BLACKHAND, DATA_GYTH, DATA_THE_BEAST, DATA_GENERAL_DRAKKISATH, DATA_WHELP_DEATH_COUNT }; enum Npc { NPC_OMOKK = 9196, NPC_SHADOW_HUNTER_VOSHGAJIN = 9236, NPC_WARMASTER_VOONE = 9237, NPC_MOTHER_SMOLDERWEB = 10596, NPC_UROK_DOOMHOWL = 10584, NPC_QUARTERMASTER_ZIGRIS = 9736, NPC_GIZRUL_THE_SLAVENER = 10268, NPC_HALYCON = 10220, NPC_OVERLORD_WYRMTHALAK = 9568, NPC_PYROGAURD_EMBERSEER = 9816, NPC_WARCHIEF_REND_BLACKHAND = 10429, NPC_GYTH = 10339, NPC_THE_BEAST = 10430, NPC_GENERAL_DRAKKISATH = 10363, }; enum AdditionalData { SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, }; enum GameObjects { GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124 }; #endif
#include "b43legacy.h" #include "leds.h" #include "rfkill.h" static void b43legacy_led_turn_on(struct b43legacy_wldev *dev, u8 led_index, bool activelow) { struct b43legacy_wl *wl = dev->wl; unsigned long flags; u16 ctl; spin_lock_irqsave(&wl->leds_lock, flags); ctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL); if (activelow) ctl &= ~(1 << led_index); else ctl |= (1 << led_index); b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ctl); spin_unlock_irqrestore(&wl->leds_lock, flags); } static void b43legacy_led_turn_off(struct b43legacy_wldev *dev, u8 led_index, bool activelow) { struct b43legacy_wl *wl = dev->wl; unsigned long flags; u16 ctl; spin_lock_irqsave(&wl->leds_lock, flags); ctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL); if (activelow) ctl |= (1 << led_index); else ctl &= ~(1 << led_index); b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ctl); spin_unlock_irqrestore(&wl->leds_lock, flags); } static void b43legacy_led_brightness_set(struct led_classdev *led_dev, enum led_brightness brightness) { struct b43legacy_led *led = container_of(led_dev, struct b43legacy_led, led_dev); struct b43legacy_wldev *dev = led->dev; bool radio_enabled; radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable); if (brightness == LED_OFF || !radio_enabled) b43legacy_led_turn_off(dev, led->index, led->activelow); else b43legacy_led_turn_on(dev, led->index, led->activelow); } static int b43legacy_register_led(struct b43legacy_wldev *dev, struct b43legacy_led *led, const char *name, const char *default_trigger, u8 led_index, bool activelow) { int err; b43legacy_led_turn_off(dev, led_index, activelow); if (led->dev) return -EEXIST; if (!default_trigger) return -EINVAL; led->dev = dev; led->index = led_index; led->activelow = activelow; strncpy(led->name, name, sizeof(led->name)); led->led_dev.name = led->name; led->led_dev.default_trigger = default_trigger; led->led_dev.brightness_set = b43legacy_led_brightness_set; err = led_classdev_register(dev->dev->dev, &led->led_dev); if (err) { b43legacywarn(dev->wl, "LEDs: Failed to register %s\n", name); led->dev = NULL; return err; } return 0; } static void b43legacy_unregister_led(struct b43legacy_led *led) { if (!led->dev) return; led_classdev_unregister(&led->led_dev); b43legacy_led_turn_off(led->dev, led->index, led->activelow); led->dev = NULL; } static void b43legacy_map_led(struct b43legacy_wldev *dev, u8 led_index, enum b43legacy_led_behaviour behaviour, bool activelow) { struct ieee80211_hw *hw = dev->wl->hw; char name[B43legacy_LED_MAX_NAME_LEN + 1]; switch (behaviour) { case B43legacy_LED_INACTIVE: break; case B43legacy_LED_OFF: b43legacy_led_turn_off(dev, led_index, activelow); break; case B43legacy_LED_ON: b43legacy_led_turn_on(dev, led_index, activelow); break; case B43legacy_LED_ACTIVITY: case B43legacy_LED_TRANSFER: case B43legacy_LED_APTRANSFER: snprintf(name, sizeof(name), "b43legacy-%s::tx", wiphy_name(hw->wiphy)); b43legacy_register_led(dev, &dev->led_tx, name, ieee80211_get_tx_led_name(hw), led_index, activelow); snprintf(name, sizeof(name), "b43legacy-%s::rx", wiphy_name(hw->wiphy)); b43legacy_register_led(dev, &dev->led_rx, name, ieee80211_get_rx_led_name(hw), led_index, activelow); break; case B43legacy_LED_RADIO_ALL: case B43legacy_LED_RADIO_A: case B43legacy_LED_RADIO_B: case B43legacy_LED_MODE_BG: snprintf(name, sizeof(name), "b43legacy-%s::radio", wiphy_name(hw->wiphy)); b43legacy_register_led(dev, &dev->led_radio, name, ieee80211_get_radio_led_name(hw), led_index, activelow); if (dev->phy.radio_on && b43legacy_is_hw_radio_enabled(dev)) b43legacy_led_turn_on(dev, led_index, activelow); break; case B43legacy_LED_WEIRD: case B43legacy_LED_ASSOC: snprintf(name, sizeof(name), "b43legacy-%s::assoc", wiphy_name(hw->wiphy)); b43legacy_register_led(dev, &dev->led_assoc, name, ieee80211_get_assoc_led_name(hw), led_index, activelow); break; default: b43legacywarn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n", behaviour); break; } } void b43legacy_leds_init(struct b43legacy_wldev *dev) { struct ssb_bus *bus = dev->dev->bus; u8 sprom[4]; int i; enum b43legacy_led_behaviour behaviour; bool activelow; sprom[0] = bus->sprom.gpio0; sprom[1] = bus->sprom.gpio1; sprom[2] = bus->sprom.gpio2; sprom[3] = bus->sprom.gpio3; for (i = 0; i < 4; i++) { if (sprom[i] == 0xFF) { activelow = 0; switch (i) { case 0: behaviour = B43legacy_LED_ACTIVITY; activelow = 1; if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) behaviour = B43legacy_LED_RADIO_ALL; break; case 1: behaviour = B43legacy_LED_RADIO_B; if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) behaviour = B43legacy_LED_ASSOC; break; case 2: behaviour = B43legacy_LED_RADIO_A; break; case 3: behaviour = B43legacy_LED_OFF; break; default: B43legacy_WARN_ON(1); return; } } else { behaviour = sprom[i] & B43legacy_LED_BEHAVIOUR; activelow = !!(sprom[i] & B43legacy_LED_ACTIVELOW); } b43legacy_map_led(dev, i, behaviour, activelow); } } void b43legacy_leds_exit(struct b43legacy_wldev *dev) { b43legacy_unregister_led(&dev->led_tx); b43legacy_unregister_led(&dev->led_rx); b43legacy_unregister_led(&dev->led_assoc); b43legacy_unregister_led(&dev->led_radio); }
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings */ #import <AccountSettings/AccountsManager.h> @class NSMutableDictionary, NSMutableArray, NSArray; @interface AccountsManager : NSObject { NSMutableDictionary *_topLevelAccountsByID; // 4 = 0x4 NSMutableArray *_orderedTopLevelAccounts; // 8 = 0x8 NSMutableDictionary *_childAccountsByID; // 12 = 0xc NSMutableDictionary *_childAccountIDToParentAccountID; // 16 = 0x10 @private NSMutableDictionary *_originalAccountsByID; // 20 = 0x14 unsigned _dataVersion; // 24 = 0x18 NSArray *_runtimeFixers; // 28 = 0x1c } + (void)_migrateAccountsIfNeeded; // 0x45dd + (void)accountWillChange:(id)account forDataclass:(id)dataclass; // 0x4439 + (void)accountDidChange:(id)account forDataclass:(id)dataclass; // 0x4295 + (id)displayNameForGroupOfAccountType:(id)accountType forBeginningOfSentence:(BOOL)sentence; // 0x3de5 + (id)_notifierClassNamesForAccountType:(id)accountType dataclass:(id)dataclass; // 0x3eb5 - (id)init; // 0x3851 - (void)dealloc; // 0x7751 - (id)accountWithIdentifier:(id)identifier; // 0x388d - (id)displayAccountWithSyncIdentifier:(id)syncIdentifier; // 0x3919 - (id)syncableAccountWithSyncIdentifier:(id)syncIdentifier; // 0x7581 - (id)allBasicAccounts; // 0x3961 - (id)allBasicSyncableAccounts; // 0x3999 - (id)basicAccountsWithTypes:(id)types; // 0x7475 - (id)fullDeviceLocalAccount; // 0x72b1 - (id)fullAccountWithIdentifier:(id)identifier loader:(id)loader; // 0x3a09 - (id)allMailAccounts; // 0x3a85 - (id)accountsWithTypes:(id)types; // 0x3b21 - (id)accountsWithTypes:(id)types withLoader:(id)loader; // 0x7029 - (unsigned)count; // 0x3b35 - (void)updateAccount:(id)account; // 0x6efd - (void)insertAccount:(id)account; // 0x6e2d - (void)deleteAccount:(id)account; // 0x6cf5 - (void)deleteAccountWithIdentifier:(id)identifier; // 0x3b55 - (void)replaceAccount:(id)account withAccount:(id)account2; // 0x3b95 - (void)replaceAccountsWithTypes:(id)types withAccounts:(id)accounts; // 0x679d - (void)removeChildWithIdentifier:(id)identifier fromAccount:(id)account; // 0x6621 - (void)addChild:(id)child toAccount:(id)account; // 0x3c99 - (id)mergeInMemoryProperties:(id)memoryProperties originalProperties:(id)properties onDiskProperties:(id)properties3; // 0x63a1 - (void)saveAllAccounts; // 0x5cad - (void)_removeChildrenForAccountWithIdentifier:(id)identifier; // 0x5b25 - (void)_loadChildrenFromAccount:(id)account; // 0x5971 - (id)_initWithAccountsInfo:(id)accountsInfo; // 0x5549 - (id)_createRuntimeFixers; // 0x3d75 - (unsigned)countOfBasicAccountsWithTypes:(id)types; // 0x5469 - (void)_setOriginalAccountDictionaries; // 0x52e9 - (void)_addNotificationToDictionary:(id)dictionary forChangeType:(int)changeType originalProperties:(id)properties currentProperties:(id)properties4; // 0x4be9 - (void)_sendNotificationsForChangedAccounts; // 0x472d @end @interface AccountsManager (MigrationSupport) + (void)killDataAccessIfNecessary; // 0x7e31 + (id)createAndLockMigrationLock; // 0x78f5 + (void)releaseMigrationLock:(id)lock; // 0x7945 + (void)waitForMigrationToFinish; // 0x7975 + (void)removeNewAccountSettingsToMigrateOldAccountInformation; // 0x7c81 + (void)shouldMigrateOldMailAccounts:(BOOL *)accounts oldDAAccounts:(BOOL *)accounts2 newAccountSettings:(BOOL *)settings; // 0x79e9 + (BOOL)accountSettingsNeedsToBeMigrated; // 0x7bd1 + (BOOL)_oldDAAccountsInformationFound; // 0x7fb9 + (BOOL)_oldMailAccountsInformationFound; // 0x8049 - (void)setDataVersion:(unsigned)version; // 0x3841 @end @interface AccountsManager (Private) + (unsigned)currentVersion; // 0x381d + (id)fullPathToAccountSettingsPlist; // 0x7d1d + (void)_setShouldSkipNotifications:(BOOL)_set; // 0x3831 - (id)initWithAccounsInfoArray:(id)accounsInfoArray; // 0x7801 - (id)initInsideOfMigration; // 0x7811 - (unsigned)dataVersion; // 0x3821 @end
/* * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. * * This program is free software; you may 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. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #include <linux/debugfs.h> #include <linux/module.h> #include "usnic.h" #include "usnic_log.h" #include "usnic_debugfs.h" static struct dentry *debugfs_root; static ssize_t usnic_debugfs_buildinfo_read(struct file *f, char __user *data, size_t count, loff_t *ppos) { char buf[500]; int res; if (*ppos > 0) return 0; res = scnprintf(buf, sizeof(buf), "version: %s\n" "build date: %s\n", DRV_VERSION, DRV_RELDATE); return simple_read_from_buffer(data, count, ppos, buf, res); } static const struct file_operations usnic_debugfs_buildinfo_ops = { .owner = THIS_MODULE, .open = simple_open, .read = usnic_debugfs_buildinfo_read }; void usnic_debugfs_init(void) { debugfs_root = debugfs_create_dir(DRV_NAME, NULL); if (IS_ERR(debugfs_root)) { usnic_err("Failed to create debugfs root dir, check if debugfs is enabled in kernel configuration\n"); debugfs_root = NULL; return; } debugfs_create_file("build-info", S_IRUGO, debugfs_root, NULL, &usnic_debugfs_buildinfo_ops); } void usnic_debugfs_exit(void) { if (!debugfs_root) return; debugfs_remove_recursive(debugfs_root); debugfs_root = NULL; }
#ifndef __GSL_MATRIX_H__ #define __GSL_MATRIX_H__ /* #include <gsl/gsl_matrix_complex_long_double.h> */ /* #include <gsl/gsl_matrix_complex_double.h> */ /* #include <gsl/gsl_matrix_complex_float.h> */ //#include <gsl/gsl_matrix_long_double.h> #include "gsl_matrix_double.h" //#include <gsl/gsl_matrix_float.h> /* #include <gsl/gsl_matrix_ulong.h> */ /* #include <gsl/gsl_matrix_long.h> */ /* #include <gsl/gsl_matrix_uint.h> */ /* #include <gsl/gsl_matrix_int.h> */ /* #include <gsl/gsl_matrix_ushort.h> */ /* #include <gsl/gsl_matrix_short.h> */ /* #include <gsl/gsl_matrix_uchar.h> */ /* #include <gsl/gsl_matrix_char.h> */ #endif /* __GSL_MATRIX_H__ */
/** ****************************************************************************** * @file SPI/SPI_FullDuplex_ComDMA/Inc/stm32f4xx_it.h * @author MCD Application Team * @version V1.0.1 * @date 09-October-2015 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void SPIx_DMA_RX_IRQHandler(void); void SPIx_DMA_TX_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#include "unicorn_test.h" #include <unicorn/unicorn.h> #include <assert.h> #include <string.h> #include <stdlib.h> static void test_idt_gdt_i386(/*void **state*/) { uc_engine *uc; uc_err err; uint8_t buf[6]; uc_x86_mmr idt; uc_x86_mmr gdt; uc_x86_mmr ldt; uc_x86_mmr tr; struct stat info; char * code = read_file("gdt_idx.bin", &info); const uint64_t address = 0x1000000; int r_esp = address + 0x1000 - 0x100; // initial esp idt.base = 0x12345678; idt.limit = 0xabcd; gdt.base = 0x87654321; gdt.limit = 0xdcba; ldt.base = 0xfedcba98; ldt.limit = 0x11111111; ldt.selector = 0x3333; ldt.flags = 0x55555555; tr.base = 0x22222222; tr.limit = 0x33333333; tr.selector = 0x4444; tr.flags = 0x66666666; // Initialize emulator in X86-32bit mode err = uc_open(UC_ARCH_X86, UC_MODE_32, &uc); uc_assert_success(err); // map 1 page memory for this emulation err = uc_mem_map(uc, address, 0x1000, UC_PROT_ALL); uc_assert_success(err); // write machine code to be emulated to memory err = uc_mem_write(uc, address, code, info.st_size); uc_assert_success(err); // initialize machine registers err = uc_reg_write(uc, UC_X86_REG_ESP, &r_esp); uc_assert_success(err); err = uc_reg_write(uc, UC_X86_REG_IDTR, &idt); uc_assert_success(err); err = uc_reg_write(uc, UC_X86_REG_GDTR, &gdt); uc_assert_success(err); err = uc_reg_write(uc, UC_X86_REG_LDTR, &ldt); uc_assert_success(err); err = uc_reg_write(uc, UC_X86_REG_TR, &tr); uc_assert_success(err); memset(&idt, 0, sizeof(idt)); memset(&gdt, 0, sizeof(gdt)); memset(&ldt, 0, sizeof(ldt)); memset(&tr, 0, sizeof(tr)); // emulate machine code in infinite time err = uc_emu_start(uc, address, address+sizeof(code)-1, 0, 0); uc_assert_success(err); uc_reg_read(uc, UC_X86_REG_IDTR, &idt); assert(idt.base == 0x12345678); assert(idt.limit == 0xabcd); uc_reg_read(uc, UC_X86_REG_GDTR, &gdt); assert(gdt.base == 0x87654321); assert(gdt.limit == 0xdcba); //userspace can only set ldt selector, remainder are loaded from //GDT/LDT, but we allow all to emulator user uc_reg_read(uc, UC_X86_REG_LDTR, &ldt); assert(ldt.base == 0xfedcba98); assert(ldt.limit == 0x11111111); assert(ldt.selector == 0x3333); assert(ldt.flags = 0x55555555); //userspace can only set tr selector, remainder are loaded from //GDT/LDT, but we allow all to emulator user uc_reg_read(uc, UC_X86_REG_TR, &tr); assert(tr.base == 0x22222222); assert(tr.limit == 0x33333333); assert(tr.selector == 0x4444); assert(tr.flags = 0x66666666); // read from memory err = uc_mem_read(uc, r_esp, buf, 6); uc_assert_success(err); assert(memcmp(buf, "\xcd\xab\x78\x56\x34\x12", 6) == 0); // read from memory err = uc_mem_read(uc, r_esp + 6, buf, 6); uc_assert_success(err); assert(memcmp(buf, "\xba\xdc\x21\x43\x65\x87", 6) == 0); uc_close(uc); free(code); } /******************************************************************************/ int main(void) { /* const struct CMUnitTest tests[] = { cmocka_unit_test(test_idt_gdt_i386) }; return cmocka_run_group_tests(tests, NULL, NULL); */ test_idt_gdt_i386(); fprintf(stderr, "success\n"); return 0; }
/********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef QPEDEBUG_H #define QPEDEBUG_H #define QPE_DEBUGTIMEDESC(X) qpe_debugTime( __FILE__, __LINE__, X ); #define QPE_DEBUGTIME qpe_debugTime( __FILE__, __LINE__ ); void qpe_debugTime( const char *file, int line, const char *desc=0 ); #endif
#if !defined(GVPARSER_H) #define GVPARSER_H /// \file GVparser.h /// \brief header file for XML parser interface in GalaxyView // GVparser.h -- header file for XML parser interface in GalaxyView // // Copyright 2003, Quarterflash Design Group // // Licensed under GPL version 2 - see COPYING for details // // 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 "wx/wxprec.h" #if !defined(WX_PREC) #include "wx/wx.h" #endif #include "expat.h" /// \brief this class is the interface to the expat parser // class GVparser { public: GVParser (); ~GVParser (); /// callback for a tag start virtual void Start (void *data, const char *el, const char **attr); /// callback for tag end virtual void End (void *data, const char *el); /// set alternate element handlers - setting a new handler will return the old one virtual XML_StartElementHandler StartElementHandler (XML_StartElementHandler start); virtual XML_StartElementHandler StartElementHandler (); virtual XML_EndElementHandler EndElementHandler (XML_EndElementHandler end); virtual XML_EndElementHandler EndElementHandler (); private: XML_parser m_parser; }; #endif
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * viking * Copyright (C) 2009-2010, Guilhem Bonnefille <guilhem.bonnefille@gmail.com> * * viking 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. * * viking 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 _VIK_MAP_SOURCE_H_ #define _VIK_MAP_SOURCE_H_ #include <glib-object.h> #include "vikviewport.h" #include "vikcoord.h" #include "mapcoord.h" #include "bbox.h" G_BEGIN_DECLS #define VIK_TYPE_MAP_SOURCE (vik_map_source_get_type ()) #define VIK_MAP_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIK_TYPE_MAP_SOURCE, VikMapSource)) #define VIK_MAP_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIK_TYPE_MAP_SOURCE, VikMapSourceClass)) #define VIK_IS_MAP_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIK_TYPE_MAP_SOURCE)) #define VIK_IS_MAP_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIK_TYPE_MAP_SOURCE)) #define VIK_MAP_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIK_TYPE_MAP_SOURCE, VikMapSourceClass)) typedef struct _VikMapSourceClass VikMapSourceClass; typedef struct _VikMapSource VikMapSource; struct _VikMapSourceClass { GObjectClass parent_class; /* Legal info */ void (* get_copyright) (VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data); const gchar *(* get_license) (VikMapSource * self); const gchar *(* get_license_url) (VikMapSource * self); const GdkPixbuf *(* get_logo) (VikMapSource * self); guint16 (* get_uniq_id) (VikMapSource * self); const gchar * (* get_label) (VikMapSource * self); guint16 (* get_tilesize_x) (VikMapSource * self); guint16 (* get_tilesize_y) (VikMapSource * self); VikViewportDrawMode (* get_drawmode) (VikMapSource * self); gboolean (* is_direct_file_access) (VikMapSource * self); gboolean (* is_mbtiles) (VikMapSource * self); gboolean (* supports_download_only_new) (VikMapSource * self); gboolean (* coord_to_mapcoord) (VikMapSource * self, const VikCoord * src, gdouble xzoom, gdouble yzoom, MapCoord * dest); void (* mapcoord_to_center_coord) (VikMapSource * self, MapCoord * src, VikCoord * dest); int (* download) (VikMapSource * self, MapCoord * src, const gchar * dest_fn, void * handle); void * (* download_handle_init) (VikMapSource * self); void (* download_handle_cleanup) (VikMapSource * self, void * handle); }; struct _VikMapSource { GObject parent_instance; }; GType vik_map_source_get_type (void) G_GNUC_CONST; void vik_map_source_get_copyright (VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data); const gchar *vik_map_source_get_license (VikMapSource * self); const gchar *vik_map_source_get_license_url (VikMapSource * self); const GdkPixbuf *vik_map_source_get_logo (VikMapSource * self); guint16 vik_map_source_get_uniq_id (VikMapSource * self); const gchar *vik_map_source_get_label (VikMapSource * self); guint16 vik_map_source_get_tilesize_x (VikMapSource * self); guint16 vik_map_source_get_tilesize_y (VikMapSource * self); VikViewportDrawMode vik_map_source_get_drawmode (VikMapSource * self); gboolean vik_map_source_is_direct_file_access (VikMapSource * self); gboolean vik_map_source_is_mbtiles (VikMapSource * self); gboolean vik_map_source_supports_download_only_new (VikMapSource * self); gboolean vik_map_source_coord_to_mapcoord (VikMapSource * self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest ); void vik_map_source_mapcoord_to_center_coord (VikMapSource * self, MapCoord *src, VikCoord *dest); int vik_map_source_download (VikMapSource * self, MapCoord * src, const gchar * dest_fn, void * handle); void * vik_map_source_download_handle_init (VikMapSource * self); void vik_map_source_download_handle_cleanup (VikMapSource * self, void * handle); G_END_DECLS #endif /* _VIK_MAP_SOURCE_H_ */
// // HFSystemUtil.h // HFToolKit // // Created by crazylhf on 15/10/12. // Copyright © 2015年 crazylhf. All rights reserved. // #import <Foundation/Foundation.h> ///================================================================= #pragma mark - IOS System Version Macro #define HF_IOSSystem6_0Later ([HFSystemUtil systemVersion].doubleValue >= 6.0) #define HF_IOSSystem7_0Later ([HFSystemUtil systemVersion].doubleValue >= 7.0) #define HF_IOSSystem8_0Later ([HFSystemUtil systemVersion].doubleValue >= 8.0) #define HF_IOSSystem9_0Later ([HFSystemUtil systemVersion].doubleValue >= 9.0) ///================================================================= #pragma mark - HFSystemUtil @interface HFSystemUtil : NSObject + (NSString *)systemVersion; + (NSString *)processName; + (uint32_t)processID; + (uint64_t)threadID; @end
/* * Copyright 2015 Freescale Semiconductor, Inc. * * Freescale DCU drm device driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include <linux/clk.h> #include <linux/regmap.h> #include <drm/drmP.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include "fsl_dcu_drm_crtc.h" #include "fsl_dcu_drm_drv.h" #include "fsl_dcu_drm_plane.h" static void fsl_dcu_drm_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { } static int fsl_dcu_drm_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { return 0; } static void fsl_dcu_drm_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { } static void fsl_dcu_drm_disable_crtc(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE, DCU_MODE_DCU_MODE_MASK, DCU_MODE_DCU_MODE(DCU_MODE_OFF)); regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG); } static void fsl_dcu_drm_crtc_enable(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE, DCU_MODE_DCU_MODE_MASK, DCU_MODE_DCU_MODE(DCU_MODE_NORMAL)); regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG); } static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; struct drm_display_mode *mode = &crtc->state->mode; unsigned int hbp, hfp, hsw, vbp, vfp, vsw, index, pol = 0; index = drm_crtc_index(crtc); clk_set_rate(fsl_dev->pix_clk, mode->clock * 1000); /* Configure timings: */ hbp = mode->htotal - mode->hsync_end; hfp = mode->hsync_start - mode->hdisplay; hsw = mode->hsync_end - mode->hsync_start; vbp = mode->vtotal - mode->vsync_end; vfp = mode->vsync_start - mode->vdisplay; vsw = mode->vsync_end - mode->vsync_start; if (mode->flags & DRM_MODE_FLAG_NHSYNC) pol |= DCU_SYN_POL_INV_HS_LOW; if (mode->flags & DRM_MODE_FLAG_NVSYNC) pol |= DCU_SYN_POL_INV_VS_LOW; regmap_write(fsl_dev->regmap, DCU_HSYN_PARA, DCU_HSYN_PARA_BP(hbp) | DCU_HSYN_PARA_PW(hsw) | DCU_HSYN_PARA_FP(hfp)); regmap_write(fsl_dev->regmap, DCU_VSYN_PARA, DCU_VSYN_PARA_BP(vbp) | DCU_VSYN_PARA_PW(vsw) | DCU_VSYN_PARA_FP(vfp)); regmap_write(fsl_dev->regmap, DCU_DISP_SIZE, DCU_DISP_SIZE_DELTA_Y(mode->vdisplay) | DCU_DISP_SIZE_DELTA_X(mode->hdisplay)); regmap_write(fsl_dev->regmap, DCU_SYN_POL, pol); regmap_write(fsl_dev->regmap, DCU_BGND, DCU_BGND_R(0) | DCU_BGND_G(0) | DCU_BGND_B(0)); regmap_write(fsl_dev->regmap, DCU_DCU_MODE, DCU_MODE_BLEND_ITER(1) | DCU_MODE_RASTER_EN); regmap_write(fsl_dev->regmap, DCU_THRESHOLD, DCU_THRESHOLD_LS_BF_VS(BF_VS_VAL) | DCU_THRESHOLD_OUT_BUF_HIGH(BUF_MAX_VAL) | DCU_THRESHOLD_OUT_BUF_LOW(BUF_MIN_VAL)); regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG); return; } static const struct drm_crtc_helper_funcs fsl_dcu_drm_crtc_helper_funcs = { .atomic_begin = fsl_dcu_drm_crtc_atomic_begin, .atomic_check = fsl_dcu_drm_crtc_atomic_check, .atomic_flush = fsl_dcu_drm_crtc_atomic_flush, .disable = fsl_dcu_drm_disable_crtc, .enable = fsl_dcu_drm_crtc_enable, .mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb, }; static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs = { .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .destroy = drm_crtc_cleanup, .page_flip = drm_atomic_helper_page_flip, .reset = drm_atomic_helper_crtc_reset, .set_config = drm_atomic_helper_set_config, }; int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev) { struct drm_plane *primary; struct drm_crtc *crtc = &fsl_dev->crtc; unsigned int i, j, reg_num; int ret; primary = fsl_dcu_drm_primary_create_plane(fsl_dev->drm); if (!primary) return -ENOMEM; ret = drm_crtc_init_with_planes(fsl_dev->drm, crtc, primary, NULL, &fsl_dcu_drm_crtc_funcs, NULL); if (ret) { primary->funcs->destroy(primary); return ret; } drm_crtc_helper_add(crtc, &fsl_dcu_drm_crtc_helper_funcs); if (!strcmp(fsl_dev->soc->name, "ls1021a")) reg_num = LS1021A_LAYER_REG_NUM; else reg_num = VF610_LAYER_REG_NUM; for (i = 0; i < fsl_dev->soc->total_layer; i++) { for (j = 1; j <= reg_num; j++) regmap_write(fsl_dev->regmap, DCU_CTRLDESCLN(i, j), 0); } regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE, DCU_MODE_DCU_MODE_MASK, DCU_MODE_DCU_MODE(DCU_MODE_OFF)); regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG); return 0; }
/****************************************************************************** * compare_rating.h * * Source of KaHIP -- Karlsruhe High Quality Partitioning. * ****************************************************************************** * Copyright (C) 2013-2015 Christian Schulz <christian.schulz@kit.edu> * * 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 COMPARE_RATING_750FUZ7Z #define COMPARE_RATING_750FUZ7Z #include "data_structure/graph_access.h" #include "definitions.h" class compare_rating : public std::binary_function<EdgeRatingType, EdgeRatingType, bool> { public: compare_rating(graph_access * pG) : G(pG) {}; virtual ~compare_rating() {}; bool operator() (const EdgeRatingType left, const EdgeRatingType right ) { return G->getEdgeRating(left) > G->getEdgeRating(right); } private: graph_access * G; }; #endif /* end of include guard: COMPARE_RATING_750FUZ7Z */
/* Power management interface routines. Written by Mariusz Matuszek. This code is currently just a placeholder for later work and does not do anything useful. This is part of rtl8180 OpenSource driver. Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> Released under the terms of GPL (General Public Licence) */ #include "r8192E.h" #include "r8192E_hw.h" #include "r8192_pm.h" #include "r8190_rtl8256.h" int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state) { printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event); return -EAGAIN; } int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); struct r8192_priv *priv = ieee80211_priv(dev); u32 ulRegRead; RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n"); if (!netif_running(dev)) goto out_pci_suspend; if (dev->netdev_ops->ndo_stop) dev->netdev_ops->ndo_stop(dev); // Call MgntActSet_RF_State instead to prevent RF config race condition. if(!priv->ieee80211->bSupportRemoteWakeUp) { MgntActSet_RF_State(priv, eRfOff, RF_CHANGE_BY_INIT); // 2006.11.30. System reset bit ulRegRead = read_nic_dword(priv, CPU_GEN); ulRegRead|=CPU_GEN_SYSTEM_RESET; write_nic_dword(priv, CPU_GEN, ulRegRead); } else { //2008.06.03 for WOL write_nic_dword(priv, WFCRC0, 0xffffffff); write_nic_dword(priv, WFCRC1, 0xffffffff); write_nic_dword(priv, WFCRC2, 0xffffffff); //Write PMR register write_nic_byte(priv, PMR, 0x5); //Disable tx, enanble rx write_nic_byte(priv, MacBlkCtrl, 0xa); } out_pci_suspend: RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n"); if(priv->ieee80211->bSupportRemoteWakeUp) { RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); } netif_device_detach(dev); pci_save_state(pdev); pci_disable_device(pdev); pci_enable_wake(pdev, pci_choose_state(pdev,state), priv->ieee80211->bSupportRemoteWakeUp?1:0); pci_set_power_state(pdev,pci_choose_state(pdev,state)); return 0; } int rtl8192E_resume (struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); int err; u32 val; RT_TRACE(COMP_POWER, "================>r8192E resume call.\n"); pci_set_power_state(pdev, PCI_D0); err = pci_enable_device(pdev); if(err) { printk(KERN_ERR "%s: pci_enable_device failed on resume\n", dev->name); return err; } pci_restore_state(pdev); /* * Suspend/Resume resets the PCI configuration space, so we have to * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries * from interfering with C3 CPU state. pci_restore_state won't help * here since it only restores the first 64 bytes pci config header. */ pci_read_config_dword(pdev, 0x40, &val); if ((val & 0x0000ff00) != 0) { pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); } pci_enable_wake(pdev, PCI_D0, 0); if(!netif_running(dev)) goto out; netif_device_attach(dev); if (dev->netdev_ops->ndo_open) dev->netdev_ops->ndo_open(dev); out: RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); return 0; } int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable) { printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n", state.event, enable); return -EAGAIN; }
#ifndef _ASM_X86_SIGNAL_H #define _ASM_X86_SIGNAL_H #ifndef __ASSEMBLY__ #include <linux/linkage.h> /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ #define _NSIG 64 #ifdef __i386__ # define _NSIG_BPW 32 #else # define _NSIG_BPW 64 #endif #define _NSIG_WORDS (_NSIG / _NSIG_BPW) typedef unsigned long old_sigset_t; /* at least 32 bits */ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; #ifndef CONFIG_COMPAT typedef sigset_t compat_sigset_t; #endif #endif /* __ASSEMBLY__ */ #include <uapi/asm/signal.h> #ifndef __ASSEMBLY__ extern void do_notify_resume(struct pt_regs *, void *, __u32); #define __ARCH_HAS_SA_RESTORER <<<<<<< HEAD #ifdef __i386__ # ifdef __KERNEL__ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; unsigned long sa_flags; __sigrestore_t sa_restorer; }; struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; /* mask last for extensibility */ }; struct k_sigaction { struct sigaction sa; }; # else /* __KERNEL__ */ /* Here we must cater to libcs that poke about in kernel headers. */ struct sigaction { union { __sighandler_t _sa_handler; void (*_sa_sigaction)(int, struct siginfo *, void *); } _u; sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; #define sa_handler _u._sa_handler #define sa_sigaction _u._sa_sigaction # endif /* ! __KERNEL__ */ #else /* __i386__ */ ======= >>>>>>> common/android-3.10.y #include <asm/sigcontext.h> #ifdef __i386__ #define __HAVE_ARCH_SIG_BITOPS #define sigaddset(set,sig) \ (__builtin_constant_p(sig) \ ? __const_sigaddset((set), (sig)) \ : __gen_sigaddset((set), (sig))) static inline void __gen_sigaddset(sigset_t *set, int _sig) { asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); } static inline void __const_sigaddset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW); } #define sigdelset(set, sig) \ (__builtin_constant_p(sig) \ ? __const_sigdelset((set), (sig)) \ : __gen_sigdelset((set), (sig))) static inline void __gen_sigdelset(sigset_t *set, int _sig) { asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); } static inline void __const_sigdelset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW)); } static inline int __const_sigismember(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); } static inline int __gen_sigismember(sigset_t *set, int _sig) { int ret; asm("btl %2,%1\n\tsbbl %0,%0" : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc"); return ret; } #define sigismember(set, sig) \ (__builtin_constant_p(sig) \ ? __const_sigismember((set), (sig)) \ : __gen_sigismember((set), (sig))) static inline int sigfindinword(unsigned long word) { asm("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc"); return word; } struct pt_regs; #else /* __i386__ */ #undef __HAVE_ARCH_SIG_BITOPS #endif /* !__i386__ */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SIGNAL_H */
#include<stdio.h> int main() { int num, i; int pac_mass = 1; scanf("%d", &num); float x_man, y_man, vector_x = 0.0, vector_y = 0.0; scanf("%f %f", &x_man, &y_man); float x[num]; float y[num]; for(i=0; i<num; i++) { scanf("%f %f", &x[i], &y[i]); } for(i=0; i<num; i++) { vector_x = (x[i] - x_man) + (x[i] - x_man) / pac_mass; vector_y = (y[i] - y_man) + (y[i] - y_man) / pac_mass; printf("%.2f %.2f\n",vector_x,vector_y); pac_mass = pac_mass * 2; x_man = x_man + vector_x; y_man = y_man + vector_y; } printf("%.2f %.2f", x_man, y_man); return 0; }
/* * SDLRoids - An Astroids clone. * * Copyright (c) 2000 David Hedbor <david@hedbor.org> * based on xhyperoid by Russel Marks. * xhyperoid is based on a Win16 game, Hyperoid by Edward Hutchins * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * rand.h - random number function prototypes. */ void my_srand(long seed); unsigned long my_rand(unsigned long range);
// rdslotoptions.h // // Container class for RDCartSlot options // // (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // #ifndef RDSLOTOPTIONS_H #define RDSLOTOPTIONS_H #include <qstring.h> #include <qvariant.h> class RDSlotOptions { public: enum Mode {CartDeckMode=0,BreakawayMode=1,LastMode=2}; enum StopAction {UnloadOnStop=0,RecueOnStop=1,LoopOnStop=2,LastStop=3}; RDSlotOptions(const QString &stationname,unsigned slotno); RDSlotOptions::Mode mode() const; void setMode(RDSlotOptions::Mode mode); bool hookMode() const; void setHookMode(bool state); RDSlotOptions::StopAction stopAction() const; void setStopAction(RDSlotOptions::StopAction action); int cartNumber() const; void setCartNumber(int cart); QString service() const; void setService(const QString &str); int card() const; int inputPort() const; int outputPort() const; bool load(); void save() const; void clear(); static QString modeText(RDSlotOptions::Mode mode); static QString stopActionText(RDSlotOptions::StopAction action); private: Mode set_mode; bool set_hook_mode; StopAction set_stop_action; int set_cart_number; QString set_service; int set_card; int set_input_port; int set_output_port; QString set_stationname; unsigned set_slotno; }; #endif // RDSLOTOPTIONS_H
/* * Created by Eda Yildirim * (2014 DESY) * * email:eda.yildirim@cern.ch */ #ifndef ALIBAVACLUSTERCONVERTER_H #define ALIBAVACLUSTERCONVERTER_H 1 // alibava includes ".h" #include "AlibavaBaseProcessor.h" // marlin includes ".h" #include "marlin/Processor.h" // lcio includes <.h> #include <IMPL/LCRunHeaderImpl.h> #include <IMPL/TrackerDataImpl.h> // ROOT includes <> #include "TObject.h" // system includes <> #include <string> #include <list> namespace alibava { //! Example Alibava processor for Marlin. class AlibavaClusterConverter:public alibava::AlibavaBaseProcessor { public: //! Returns a new instance of AlibavaClusterConverter /*! This method returns an new instance of the this processor. It * is called by Marlin execution framework and it shouldn't be * called/used by the final user. * * @return a new AlibavaClusterConverter. */ virtual Processor * newProcessor () { return new AlibavaClusterConverter; } //! Default constructor AlibavaClusterConverter (); //! Called at the job beginning. virtual void init (); //! Called for every run. virtual void processRunHeader (LCRunHeader * run); //! Called every event virtual void processEvent (LCEvent * evt); //! Check event method virtual void check (LCEvent * evt); //! Book histograms /*! This method is used to book histograms */ void bookHistos(); //! Fill histograms /*! This method is used to fill in histograms for each channel. * */ void fillHistos(TrackerDataImpl * trkdata); //! Called after data processing. /*! This method is called when the loop on events is finished. It * is checking whether the calculation is properly finished or * not. */ virtual void end(); // cluster collection names for EUTel // The collection name of cluster pulse std::string _pulseCollectionName; // The collection name of sparse cluster std::string _sparseCollectionName; // SensorID int _sensorIDStartsFrom; // missing coordinate value // The value that should be stored in missing coordinate. // This number has to be integer since it will be used as channel number of the missing coordinate int _missingCorrdinateValue; protected: }; //! A global instance of the processor AlibavaClusterConverter gAlibavaClusterConverter; } #endif
/* * Incubator * * Adrian Bowyer * 14 June 2004 * */ #ifndef INCUBATOR_H #define INCUBATOR_H #include "stdlib.h" // System library #include "stdio.h" // Standard input/output definitions #include "string.h" // String function definitions #include "unistd.h" // UNIX standard function definitions #include "sys/stat.h" // Env stuff... #include "sys/types.h"// ...and the like #include "fcntl.h" // File control definitions #include "errno.h" // Error number definitions #include "termios.h" // POSIX terminal control definitions #include "ctype.h" // Useful character stuff #include "iostream.h" // C++ console i/o #include "fstream.h" // C++ file i/o #include "strstream.h"// String i/o #include "math.h" // Sine cos etc #define PORT "/dev/ttyS0" // Port minicom talks to // Turn n into hex in array h void n2hex(int n, char* h); // Turn hex in h into a number and return it int hex2n(char* h); #define ST_LEN 200 // Maximum command string length #endif
// // ZoomStoryOrganiser.h // ZoomCocoa // // Created by Andrew Hunter on Thu Jan 22 2004. // Copyright (c) 2004 Andrew Hunter. All rights reserved. // #import <Foundation/Foundation.h> #import "ZoomStory.h" #import "ZoomStoryID.h" #import "ZoomBlorbFile.h" @protocol ZoomStoryIDFetcherProtocol - (out bycopy ZoomStoryID*) idForFile: (in bycopy NSString*) filename; - (void) renamedIdent: (in bycopy ZoomStoryID*) ident toFilename: (in bycopy NSString*) filename; @end // The story organiser is used to store story locations and identifications // (Mainly to build up the iFiction window) // Notifications extern NSString* ZoomStoryOrganiserChangedNotification; extern NSString* ZoomStoryOrganiserProgressNotification; @interface ZoomStoryOrganiser : NSObject<ZoomStoryIDFetcherProtocol> { // Arrays of the stories and their idents NSMutableArray* storyFilenames; NSMutableArray* storyIdents; // Dictionaries associating them NSMutableDictionary* filenamesToIdents; NSMutableDictionary* identsToFilenames; // Preference loading/checking thread NSPort* port1; NSPort* port2; NSConnection* mainThread; NSConnection* subThread; NSLock* storyLock; // Story organising thread BOOL alreadyOrganising; } // The shared organiser + (ZoomStoryOrganiser*) sharedStoryOrganiser; // Image management + (NSImage*) frontispieceForBlorb: (ZoomBlorbFile*) decodedFile; + (NSImage*) frontispieceForFile: (NSString*) filename; // Storing stories - (void) addStory: (NSString*) filename withIdent: (ZoomStoryID*) ident; - (void) addStory: (NSString*) filename withIdent: (ZoomStoryID*) ident organise: (BOOL) organise; - (void) removeStoryWithIdent: (ZoomStoryID*) ident deleteFromMetadata: (BOOL) delete; // Sending notifications - (void) organiserChanged; // Retrieving story information - (NSString*) filenameForIdent: (ZoomStoryID*) ident; - (ZoomStoryID*) identForFilename: (NSString*) filename; - (NSArray*) storyFilenames; - (NSArray*) storyIdents; // Story-specific data - (NSString*) directoryForIdent: (ZoomStoryID*) ident create: (BOOL) create; // Progress - (void) startedActing; - (void) endedActing; // Organising stories - (void) organiseStory: (ZoomStory*) story; - (void) organiseStory: (ZoomStory*) story withIdent: (ZoomStoryID*) ident; - (void) organiseAllStories; - (void) reorganiseStoriesTo: (NSString*) newStoryDirectory; @end
/*************************************************************************** * * * $Id: saveme.c,v 1.2 2008-07-06 15:17:35 hoganrobert Exp $ * * * * Copyright (C) 2008 by Robert Hogan * * robert@roberthogan.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. * *************************************************************************** * * * This is a modified version of a source file from the tsocks project. * * Original copyright notice from tsocks source file follows: * * * ***************************************************************************/ /* SAVEME - Part of the tsocks package This program is designed to be statically linked so that if a user breaks their ld.so.preload file and cannot run any dynamically linked program it can delete the offending ld.so.preload 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> #include <unistd.h> int main() { unlink("/etc/ld.so.preload"); return(0); }
#ifndef __LINUX_TEXTSEARCH_H #define __LINUX_TEXTSEARCH_H #include <linux/types.h> #include <linux/list.h> #include <linux/kernel.h> #include <linux/err.h> #include <linux/slab.h> struct module; struct ts_config; #define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */ #define TS_IGNORECASE 2 /* Searches string case insensitively */ /** * struct ts_state - search state * @offset: offset for next match * @cb: control buffer, for persistent variables of get_next_block() */ struct ts_state { unsigned int offset; char cb[40]; }; /** * struct ts_ops - search module operations * @name: name of search algorithm * @init: initialization function to prepare a search * @find: find the next occurrence of the pattern * @destroy: destroy algorithm specific parts of a search configuration * @get_pattern: return head of pattern * @get_pattern_len: return length of pattern * @owner: module reference to algorithm */ struct ts_ops { const char *name; struct ts_config * (*init)(const void *, unsigned int, gfp_t, int); unsigned int (*find)(struct ts_config *, struct ts_state *); void (*destroy)(struct ts_config *); void * (*get_pattern)(struct ts_config *); unsigned int (*get_pattern_len)(struct ts_config *); struct module *owner; struct list_head list; }; /** * struct ts_config - search configuration * @ops: operations of chosen algorithm * @flags: flags * @get_next_block: callback to fetch the next block to search in * @finish: callback to finalize a search */ struct ts_config { struct ts_ops *ops; int flags; /** * get_next_block - fetch next block of data * @consumed: number of bytes consumed by the caller * @dst: destination buffer * @conf: search configuration * @state: search state * * Called repeatedly until 0 is returned. Must assign the * head of the next block of data to &*dst and return the length * of the block or 0 if at the end. consumed == 0 indicates * a new search. May store/read persistent values in state->cb. */ unsigned int (*get_next_block)(unsigned int consumed, const u8 **dst, struct ts_config *conf, struct ts_state *state); /** * finish - finalize/clean a series of get_next_block() calls * @conf: search configuration * @state: search state * * Called after the last use of get_next_block(), may be used * to cleanup any leftovers. */ void (*finish)(struct ts_config *conf, struct ts_state *state); }; /** * textsearch_next - continue searching for a pattern * @conf: search configuration * @state: search state * * Continues a search looking for more occurrences of the pattern. * textsearch_find() must be called to find the first occurrence * in order to reset the state. * * Returns the position of the next occurrence of the pattern or * UINT_MAX if not match was found. */ static inline unsigned int textsearch_next(struct ts_config *conf, struct ts_state *state) { unsigned int ret = conf->ops->find(conf, state); if (conf->finish) conf->finish(conf, state); return ret; } /** * textsearch_find - start searching for a pattern * @conf: search configuration * @state: search state * * Returns the position of first occurrence of the pattern or * UINT_MAX if no match was found. */ static inline unsigned int textsearch_find(struct ts_config *conf, struct ts_state *state) { state->offset = 0; return textsearch_next(conf, state); } /** * textsearch_get_pattern - return head of the pattern * @conf: search configuration */ static inline void *textsearch_get_pattern(struct ts_config *conf) { return conf->ops->get_pattern(conf); } /** * textsearch_get_pattern_len - return length of the pattern * @conf: search configuration */ static inline unsigned int textsearch_get_pattern_len(struct ts_config *conf) { return conf->ops->get_pattern_len(conf); } extern int textsearch_register(struct ts_ops *); extern int textsearch_unregister(struct ts_ops *); extern struct ts_config *textsearch_prepare(const char *, const void *, unsigned int, gfp_t, int); extern void textsearch_destroy(struct ts_config *conf); extern unsigned int textsearch_find_continuous(struct ts_config *, struct ts_state *, const void *, unsigned int); #define TS_PRIV_ALIGNTO 8 #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) static inline struct ts_config *alloc_ts_config(size_t payload, gfp_t gfp_mask) { struct ts_config *conf; conf = kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); if (conf == NULL) return ERR_PTR(-ENOMEM); return conf; } static inline void *ts_config_priv(struct ts_config *conf) { return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); } #endif
/* * @File: lab_b.c * * Sinopsis: Laboratorio B * * Programa que responde a las funcionalidades planteadas en el laboratorio B de programación. * * @author: Santiago Hoyos Zea * * fecha: 16/05/2017 * * @version 0.1 - Entrega 1 */ #include <stdio.h> #define n 5 void getns(char *cadena); void scanfns(char *); void pideNombreArchivo(char *); void muestraFichero24(FILE *); /** * Funcion programa principal. * @return estado de salida. */ int main() { FILE *fichero; char nombreFichero[n]; pideNombreArchivo(nombreFichero); fichero = fopen(nombreFichero, "r"); if (fichero != NULL) { muestraFichero24(fichero); fclose(fichero); } else { printf("Error no se ha podido abrir el fichero."); } return 0; } /** * Lee una cadena de la entrada estandar y la devuelve, pitando por cada carater de más * leido superior a n. * @param cadena /E/S cadena leida */ void getns(char *cadena) { char tmp; int contador = 0; //<-- primera asignación while (scanf("%c", &tmp) > 0 && tmp != '\n') { //<-- cada comprobacion de bucle son 1 asignacion y 2 comparaciones if (contador < n - 1) { //<-- otra comparación cadena[contador] = tmp; //<-- asignación++ } else { printf("\a"); } contador++; // <-- entendemos esto como un contador = contador +1; por tanto una asignación más. } cadena[n - 1] = '\0'; //<-- asignación++; /* * (al pasar la referencia a tmp se le asigna valor dentro de la funnción scanf lo cuento como un =) * para la primera letra dentro del rango son 4 asignaciones y 3 comparaciones * para una letra distinta de la primera dentro del rango son 3 asignaciones y 3 comparaciones * para una letra distinta de la primera fuera del rango son 2 asignaciones y 3 comparaciones. * para el salto de linea son 2 asignaciones y 2 comparaciones * ------------------------------------------------------------------------- * | n teclado asigna compara pitidos | * | 5 <enter> | 3 2 0 | * | 5 a<enter> | 6 5 0 | * | 5 hola<enter> | 15 14 0 | * | 5 adios<enter> | 17 17 1 | * | 5 Barcelona 1 - Real Madrid 1<enter> | 61 83 23 | * ------------------------------------------------------------------------- */ } /** * Lee una cadena hasta tabulador, espacio, o salto de linea y pita por cada * caracter de más leido. * @param cadena */ void scanfns(char *cadena) { char tmp; int contador = 0; while (scanf("%c", &tmp) > 0 && tmp != ' ' && tmp != '\t' && tmp != '\n') { if (contador < n - 1) { cadena[contador] = tmp; } else { printf("\a"); } contador++; } cadena[n - 1] = '\0'; } /** * Pide el nombre del archivo. Lee hasta un salto de linea. * @param nombreArchivo /E/S nombre del archivo leido de n-1 caracteres. * Pita por los caracteres sobreante mayores que N-1 */ void pideNombreArchivo(char *nombreArchivo) { printf("Introduce el nombre del archivo: "); getns(nombreArchivo); } /** * Muestra un fichero abierto paginado a 24 lineas por página. * @param ficheroAbierto fichero ABIERTO. */ void muestraFichero24(FILE *ficheroAbierto) { char siguiente = NULL; char tmp[n] = ""; int leidos = 0; int i; do { for (i = 0; i < 24 && tmp != NULL; ++i) { if (fgets(tmp, n, ficheroAbierto) != NULL) { printf(tmp); } } printf("mostrar siguiente página(s) salir(otro): "); leidos = scanf("%c", &siguiente); getchar(); } while (leidos > 0 && siguiente == 's'); }
/* * Copyright 2001-2006 Adrian Thurston <thurston@complang.org> * 2004 Erich Ocean <eric.ocean@ampede.com> * 2005 Alan West <alan@alanz.com> */ /* This file is part of Ragel. * * Ragel 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. * * Ragel 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 Ragel; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CDGOTO_H #define _CDGOTO_H #include <iostream> #include "cdcodegen.h" /* Forwards. */ struct CodeGenData; struct NameInst; struct RedTransAp; struct RedStateAp; struct GenStateCond; /* * Goto driven fsm. */ class GotoCodeGen : virtual public FsmCodeGen { public: GotoCodeGen( ostream &out ) : FsmCodeGen(out) {} std::ostream &TO_STATE_ACTION_SWITCH(); std::ostream &FROM_STATE_ACTION_SWITCH(); std::ostream &EOF_ACTION_SWITCH(); std::ostream &ACTION_SWITCH(); std::ostream &STATE_GOTOS(); std::ostream &TRANSITIONS(); std::ostream &EXEC_FUNCS(); std::ostream &FINISH_CASES(); void GOTO( ostream &ret, int gotoDest, bool inFinish ); void CALL( ostream &ret, int callDest, int targState, bool inFinish ); void NEXT( ostream &ret, int nextDest, bool inFinish ); void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ); void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ); void CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, bool inFinish ); void CURS( ostream &ret, bool inFinish ); void TARGS( ostream &ret, bool inFinish, int targState ); void RET( ostream &ret, bool inFinish ); void BREAK( ostream &ret, int targState, bool csForced ); virtual unsigned int TO_STATE_ACTION( RedStateAp *state ); virtual unsigned int FROM_STATE_ACTION( RedStateAp *state ); virtual unsigned int EOF_ACTION( RedStateAp *state ); std::ostream &TO_STATE_ACTIONS(); std::ostream &FROM_STATE_ACTIONS(); std::ostream &EOF_ACTIONS(); void COND_TRANSLATE( GenStateCond *stateCond, int level ); void emitCondBSearch( RedStateAp *state, int level, int low, int high ); void STATE_CONDS( RedStateAp *state, bool genDefault ); virtual std::ostream &TRANS_GOTO( RedTransAp *trans, int level ); void emitSingleSwitch( RedStateAp *state ); void emitRangeBSearch( RedStateAp *state, int level, int low, int high ); /* Called from STATE_GOTOS just before writing the gotos */ virtual void GOTO_HEADER( RedStateAp *state ); virtual void STATE_GOTO_ERROR(); virtual void writeData(); virtual void writeExec(); }; /* * class CGotoCodeGen */ struct CGotoCodeGen : public GotoCodeGen, public CCodeGen { CGotoCodeGen( ostream &out ) : FsmCodeGen(out), GotoCodeGen(out), CCodeGen(out) {} }; /* * class DGotoCodeGen */ struct DGotoCodeGen : public GotoCodeGen, public DCodeGen { DGotoCodeGen( ostream &out ) : FsmCodeGen(out), GotoCodeGen(out), DCodeGen(out) {} }; #endif
/* * Seahorse * * Copyright (C) 2008 Stefan Walter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef SEAPGPKEYSETS_H_ #define SEAPGPKEYSETS_H_ #include "seahorse-set.h" /* ----------------------------------------------------------------------------- * SOME COMMON KEYSETS */ SeahorseSet* seahorse_keyset_pgp_signers_new (); #endif /*SEAPGPKEYSETS_H_*/