text
stringlengths
4
6.14k
#if defined(LANG_SLOVENE) //slovenian const unsigned char TestRunning[] MEM_TEXT = "Testiranje"; const unsigned char BatWeak[] MEM_TEXT = "slaba!"; const unsigned char BatEmpty[] MEM_TEXT = "prazna!"; const unsigned char TestFailed2[] MEM_TEXT = "pokvarjen "; const unsigned char Bauteil[] MEM_TEXT = "del"; // const unsigned char Diode[] MEM_TEXT = "Dioda: "; const unsigned char Triac[] MEM_TEXT = "Triak"; const unsigned char Thyristor[] MEM_TEXT = "Tiristor"; const unsigned char Unknown[] MEM_TEXT = " neznan"; const unsigned char TestFailed1[] MEM_TEXT = "Ni, neznan, ali"; const unsigned char Detected[] MEM_TEXT = " detektira"; const unsigned char TestTimedOut[] MEM_TEXT = "Timeout!"; #define Cathode_char 'C' #ifdef WITH_SELFTEST const unsigned char SELFTEST[] MEM_TEXT = "Selftest mode.."; const unsigned char RELPROBE[] MEM_TEXT = "isolate Probes!"; const unsigned char ATE[] MEM_TEXT = "Test End"; #endif #ifdef WITH_MENU const unsigned char SELECTION_str[] MEM2_TEXT = "Izbor:"; const unsigned char TESTER_str[] MEM2_TEXT = "Tranzistor"; #ifndef NO_FREQ_COUNTER const unsigned char FREQ_str[] MEM2_TEXT = "Frekvenca"; #endif const unsigned char VOLTAGE_str[] MEM2_TEXT = "Voltage"; const unsigned char SHOW_str[] MEM2_TEXT = "Prikazi podatke"; // "Show data" const unsigned char OFF_str[] MEM2_TEXT = "izklopi"; const unsigned char F_GEN_str[] MEM2_TEXT = "f-Generator"; #ifdef PWM_SERVO const unsigned char PWM_10bit_str[] MEM2_TEXT = "Servo PWM"; #else const unsigned char PWM_10bit_str[] MEM2_TEXT = "10-bit PWM"; #endif #ifdef WITH_ROTARY_CHECK const unsigned char RotaryEncoder_str[] MEM2_TEXT = "rotary encoder"; #endif const unsigned char SetCapCorr_str[] MEM2_TEXT = {'C','(',LCD_CHAR_U,'F',')','-','k','o','r','r','e','k','c','i','j','a',0}; const unsigned char TURN_str[] MEM2_TEXT = "turn!"; const unsigned char FULLCHECK_str[] MEM2_TEXT = "Selftest"; const unsigned char SHORT_PROBES_str[] MEM2_TEXT = "short Probes!"; #if PROCESSOR_TYP == 644 const unsigned char HFREQ_str[] MEM2_TEXT = "Frekvenca > 2MHz"; const unsigned char H_CRYSTAL_str[] MEM2_TEXT = "HF kristal"; const unsigned char L_CRYSTAL_str[] MEM2_TEXT = "LF kristal"; #endif #if ((LCD_ST_TYPE == 7565) || (LCD_ST_TYPE == 1306) || (LCD_ST_TYPE == 8812) || (LCD_ST_TYPE == 8814) || (LCD_ST_TYPE == 8814) || defined(LCD_DOGM)) const unsigned char CONTRAST_str[] MEM2_TEXT = "Kontrast"; #endif #endif /* WITH_MENU */ #ifdef WITH_XTAL const unsigned char cerres_str[] MEM_TEXT = "Cer.resonator "; const unsigned char xtal_str[] MEM_TEXT = "Kristal "; #endif #define LANG_SELECTED #endif /* LANG SLOVENE */
/* This file is part of the KDE project * Copyright (C) 2006 Thomas Zander <zander@kde.org> * Copyright (C) 2007 Sebastian Sauer <mail@dipe.org> * Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org> * Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in> * Copyright (C) 2009-2011 KO GmbH <cbo@kogmbh.com> * Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.com> * Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@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; 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 KOSTYLETHUMBNAILER_H #define KOSTYLETHUMBNAILER_H #include "textlayout_export.h" #include <QSize> class KoCharacterStyle; class KoParagraphStyle; class QImage; class QTextDocument; /** * Helper class to create (and cache) thumbnails of styles */ class TEXTLAYOUT_EXPORT KoStyleThumbnailer { public: enum KoStyleThumbnailerFlag { NoFlags = 0, CenterAlignThumbnail = 1, ///< Vertically Center Align the layout of the thumbnail /// i.e the layout is done at the center of the area UseStyleNameText = 2, ///< Use the style name as the text that is layouted inside the thumbnail ScaleThumbnailFont = 4 ///< If set, then when the layout size is more than the size avaliable /// the font size is scaled down to fit the space availiable }; Q_DECLARE_FLAGS(KoStyleThumbnailerFlags, KoStyleThumbnailerFlag) /** * Create a new style thumbnailer. */ explicit KoStyleThumbnailer(); /** * Destructor. */ virtual ~KoStyleThumbnailer(); /** * @returns a thumbnail representing the @param style, constrained into the @param size. * If there is no specified @param size, the thunbnail is the size specified with @fn setThumbnailSize or 250*48 pt if no size was provided. * If the given @param size is too small, the font size will be decreased, so the thumbnail fits. * The real font size is indicated in this case. * If @param recreateThumbnail is true, do not return the cached thumbnail if it exist, but recreate a new one. * The created thumbnail is cached. */ QImage thumbnail(KoParagraphStyle *style, QSize size = QSize(), bool recreateThumbnail = false, KoStyleThumbnailerFlags flags = KoStyleThumbnailerFlags(CenterAlignThumbnail | UseStyleNameText | ScaleThumbnailFont)); /** * @returns a thumbnail representing the @param characterStyle applied on the given @param paragraphStyle, constrained into the @param size. * If there is no specified @param size, the thunbnail is the size specified with @fn setThumbnailSize or 250*48 pt if no size was provided. * If the given @param size is too small, the font size will be decreased, so the thumbnail fits. * The real font size is indicated in this case. * If @param recreateThumbnail is true, do not return the cached thumbnail if it exist, but recreate a new one. * The created thumbnail is cached. */ QImage thumbnail(KoCharacterStyle *characterStyle, KoParagraphStyle *paragraphStyle = 0, QSize size = QSize(), bool recreateThumbnail = false, KoStyleThumbnailerFlags flags = KoStyleThumbnailerFlags(CenterAlignThumbnail | UseStyleNameText | ScaleThumbnailFont)); /** * Sets the size of the thumbnails returned by the @fn thumbnail with no size arguments. */ void setThumbnailSize(QSize size); /** * Sets the text that will be layouted. * @param text The text that will be layouted inside the thumbnail *If the UseStyleNameText flag is set then this text will not be used */ void setText(const QString &text); /** * remove all occurences of the style from the cache */ void removeFromCache(KoParagraphStyle *style); /** * remove all occurences of the style from the cache */ void removeFromCache(KoCharacterStyle *style); private: void layoutThumbnail(QSize size, QImage *im, KoStyleThumbnailerFlags flags); void removeFromCache(const QString &expr); class Private; Private* const d; }; #endif
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:35 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm/user_32.h */ #ifndef _I386_USER_H #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define _I386_USER_H #include <asm/page.h> /* Core file format: The core file is written in such a way that gdb can understand it and provide useful information to the user (under linux we use the 'trad-core' bfd). There are quite a number of obstacles to being able to view the contents of the floating point registers, and until these are solved you will not be able to view the contents of them. Actually, you can read in the core file and look at the contents of the user struct to find out what the floating point registers contain. The actual file contents are as follows: UPAGE: 1 page consisting of a user struct that tells gdb what is present in the file. Directly after this is a copy of the task_struct, which is currently not used by gdb, but it may come in useful at some point. All of the registers are stored as part of the upage. The upage should always be only one page. DATA: The data area is stored. We use current->end_text to current->brk to pick up all of the user variables, plus any memory that may have been malloced. No attempt is made to determine if a page is demand-zero or if a page is totally unused, we just cover the entire range. All of the addresses are rounded in such a way that an integral number of pages is written. STACK: We need the stack information in order to get a meaningful backtrace. We need to write the data from (esp) to current->start_stack, so we round each of these off in order to be able to write an integer number of pages. The minimum core file size is 3 pages, or 12288 bytes. */ /* * Pentium III FXSR, SSE support * Gareth Hughes <gareth@valinux.com>, May 2000 * * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for * interacting with the FXSR-format floating point environment. Floating * point data can be accessed in the regular format in the usual manner, * and both the standard and SIMD floating point data can be accessed via * the new ptrace requests. In either case, changes to the FPU environment * will be reflected in the task's state as expected. */ struct user_i387_struct { long cwd; long swd; long twd; long fip; long fcs; long foo; long fos; long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ }; struct user_fxsr_struct { unsigned short cwd; unsigned short swd; unsigned short twd; unsigned short fop; long fip; long fcs; long foo; long fos; long mxcsr; long reserved; long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ long padding[56]; }; /* * This is the old layout of "struct pt_regs", and * is still the layout used by user mode (the new * pt_regs doesn't have all registers as the kernel * doesn't use the extra segment registers) */ struct user_regs_struct { unsigned long bx; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long bp; unsigned long ax; unsigned long ds; unsigned long es; unsigned long fs; unsigned long gs; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; }; /* When the kernel dumps core, it starts by dumping the user struct - this will be used by gdb to figure out where the data and stack segments are within the file, and what virtual addresses to use. */ struct user{ /* We start with the registers, to mimic the way that "memory" is returned from the ptrace(3,...) function. */ struct user_regs_struct regs; /* Where the registers are actually stored */ /* ptrace does not yet supply these. Someday.... */ int u_fpvalid; /* True if math co-processor being used. */ /* for this mess. Not yet used. */ struct user_i387_struct i387; /* Math Co-processor registers. */ /* The rest of this junk is to help gdb figure out what goes where */ unsigned long int u_tsize; /* Text segment size (pages). */ unsigned long int u_dsize; /* Data segment size (pages). */ unsigned long int u_ssize; /* Stack segment size (pages). */ unsigned long start_code; /* Starting virtual address of text. */ unsigned long start_stack; /* Starting virtual address of stack area. This is actually the bottom of the stack, the top of the stack is always found in the esp register. */ long int signal; /* Signal that caused the core dump. */ int reserved; /* No longer used */ unsigned long u_ar0; /* Used by gdb to help find the values for */ /* the registers. */ struct user_i387_struct *u_fpstate; /* Math Co-processor pointer. */ unsigned long magic; /* To uniquely identify a core file */ char u_comm[32]; /* User command that was responsible */ int u_debugreg[8]; }; #define NBPG PAGE_SIZE #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) #endif /* _I386_USER_H */
/****************************************************************************** * * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved. * * Portions of this file are derived from the ipw3945 project, as well * as portions of the ieee80211 subsystem header files. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * Intel Linux Wireless <ilw@linux.intel.com> * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *****************************************************************************/ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <net/mac80211.h> #include "iwl-eeprom.h" #include "iwl-dev.h" #include "iwl-core.h" /* software rf-kill from user */ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state) { struct iwl_priv *priv = data; int err = 0; if (!priv->rfkill) return 0; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return 0; IWL_DEBUG_RF_KILL(priv, "we received soft RFKILL set to state %d\n", state); mutex_lock(&priv->mutex); switch (state) { case RFKILL_STATE_UNBLOCKED: if (iwl_is_rfkill_hw(priv)) { /* pass error to rfkill core, make it state HARD * BLOCKED (rfkill->mutex taken) and disable * software kill switch */ err = -EBUSY; priv->rfkill->state = RFKILL_STATE_HARD_BLOCKED; } iwl_radio_kill_sw_enable_radio(priv); break; case RFKILL_STATE_SOFT_BLOCKED: iwl_radio_kill_sw_disable_radio(priv); /* rfkill->mutex is taken */ if (priv->rfkill->state == RFKILL_STATE_HARD_BLOCKED) { /* force rfkill core state to be SOFT BLOCKED, * otherwise core will be unable to disable software * kill switch */ priv->rfkill->state = RFKILL_STATE_SOFT_BLOCKED; } break; default: IWL_WARN(priv, "we received unexpected RFKILL state %d\n", state); break; } mutex_unlock(&priv->mutex); return err; } int iwl_rfkill_init(struct iwl_priv *priv) { struct device *device = wiphy_dev(priv->hw->wiphy); int ret = 0; BUG_ON(device == NULL); IWL_DEBUG_RF_KILL(priv, "Initializing RFKILL.\n"); priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); if (!priv->rfkill) { IWL_ERR(priv, "Unable to allocate RFKILL device.\n"); ret = -ENOMEM; goto error; } priv->rfkill->name = priv->cfg->name; priv->rfkill->data = priv; priv->rfkill->state = RFKILL_STATE_UNBLOCKED; priv->rfkill->toggle_radio = iwl_rfkill_soft_rf_kill; priv->rfkill->user_claim_unsupported = 1; priv->rfkill->dev.class->suspend = NULL; priv->rfkill->dev.class->resume = NULL; ret = rfkill_register(priv->rfkill); if (ret) { IWL_ERR(priv, "Unable to register RFKILL: %d\n", ret); goto free_rfkill; } IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n"); return ret; free_rfkill: if (priv->rfkill != NULL) rfkill_free(priv->rfkill); priv->rfkill = NULL; error: IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n"); return ret; } EXPORT_SYMBOL(iwl_rfkill_init); void iwl_rfkill_unregister(struct iwl_priv *priv) { if (priv->rfkill) rfkill_unregister(priv->rfkill); priv->rfkill = NULL; } EXPORT_SYMBOL(iwl_rfkill_unregister); /* set RFKILL to the right state. */ void iwl_rfkill_set_hw_state(struct iwl_priv *priv) { if (!priv->rfkill) return; if (iwl_is_rfkill_sw(priv)) rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED); else if (iwl_is_rfkill_hw(priv)) rfkill_force_state(priv->rfkill, RFKILL_STATE_HARD_BLOCKED); else rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED); } EXPORT_SYMBOL(iwl_rfkill_set_hw_state);
/** * @file * * LEON3 SMP BSP Support */ /* * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #include <rtems.h> #include <bsp.h> #include <rtems/bspIo.h> #include <rtems/bspsmp.h> #include <stdlib.h> #define RTEMS_DEBUG static inline void sparc_leon3_set_cctrl( unsigned int val ) { __asm__ volatile( "sta %0, [%%g0] 2" : : "r" (val) ); } static inline unsigned int sparc_leon3_get_cctrl( void ) { unsigned int v = 0; __asm__ volatile( "lda [%%g0] 2, %0" : "=r" (v) : "0" (v) ); return v; } rtems_isr bsp_ap_ipi_isr( rtems_vector_number vector ) { LEON_Clear_interrupt(LEON3_MP_IRQ); rtems_smp_process_interrupt(); } void bsp_smp_secondary_cpu_initialize(int cpu) { sparc_leon3_set_cctrl( 0x80000F ); LEON_Unmask_interrupt(LEON3_MP_IRQ); LEON3_IrqCtrl_Regs->mask[cpu] |= 1 << LEON3_MP_IRQ; } /* * Used to pass information to start.S when bringing secondary CPUs * out of reset. */ void *bsp_ap_stack; void *bsp_ap_entry; static void bsp_smp_delay( int ); int bsp_smp_initialize( int maximum ) { int cpu; int found_cpus = 0; sparc_leon3_set_cctrl( 0x80000F ); found_cpus = ((LEON3_IrqCtrl_Regs->mpstat >> LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1; #if defined(RTEMS_DEBUG) printk( "Found %d CPUs\n", found_cpus ); #endif if ( found_cpus > rtems_configuration_get_maximum_processors() ) { printk( "%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n", found_cpus, rtems_configuration_get_maximum_processors() ); found_cpus = rtems_configuration_get_maximum_processors(); } if ( found_cpus == 1 ) return 1; for ( cpu=1 ; cpu < found_cpus ; cpu++ ) { #if defined(RTEMS_DEBUG) printk( "Waking CPU %d\n", cpu ); #endif bsp_ap_stack = _Per_CPU_Information[cpu].interrupt_stack_high - CPU_MINIMUM_STACK_FRAME_SIZE; bsp_ap_entry = rtems_smp_secondary_cpu_initialize; LEON3_IrqCtrl_Regs->mpstat = 1 << cpu; bsp_smp_delay( 1000000 ); #if defined(RTEMS_DEBUG) printk( "CPU %d is %s\n", cpu, ((_Per_CPU_Information[cpu].state == RTEMS_BSP_SMP_CPU_INITIALIZED) ? "online" : "offline") ); #endif } if ( found_cpus > 1 ) { LEON_Unmask_interrupt(LEON3_MP_IRQ); set_vector(bsp_ap_ipi_isr, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1); } return found_cpus; } void bsp_smp_interrupt_cpu( int cpu ) { /* send interrupt to destination CPU */ LEON3_IrqCtrl_Regs->force[cpu] = 1 << LEON3_MP_IRQ; } void bsp_smp_broadcast_interrupt(void) { int dest_cpu; int cpu; int max_cpus; cpu = bsp_smp_processor_id(); max_cpus = rtems_smp_get_number_of_processors(); for ( dest_cpu=0 ; dest_cpu < max_cpus ; dest_cpu++ ) { if ( cpu == dest_cpu ) continue; bsp_smp_interrupt_cpu( dest_cpu ); /* this is likely needed due to the ISR code not being SMP aware yet */ bsp_smp_delay( 100000 ); } } extern __inline__ void __delay(unsigned long loops) { __asm__ __volatile__("cmp %0, 0\n\t" "1: bne 1b\n\t" "subcc %0, 1, %0\n" : "=&r" (loops) : "0" (loops) : "cc" ); } /* * Kill time without depending on the timer being present or programmed. * * This is not very sophisticated. */ void bsp_smp_delay( int max ) { __delay( max ); } void bsp_smp_wait_for( volatile unsigned int *address, unsigned int desired, int maximum_usecs ) { int iterations; volatile unsigned int *p = address; for (iterations=0 ; iterations < maximum_usecs ; iterations++ ) { if ( *p == desired ) break; bsp_smp_delay( 5000 ); } }
/* * Copyright (C) 2015-2016 Yizhou Shan <shan13@purdue.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, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _ASM_X86_PGTABLE_3LEVEL_TYPES_H_ #define _ASM_X86_PGTABLE_3LEVEL_TYPES_H_ /* * Three-level paging is enabled when PAE is enabled in 32-bit x86. PAE paging * translates 32-bit linear address to 52-bit physical address. If MAXPHYADDR < 52, * bits in the range 51:MAXPHYADDR will be 0 in any physical address used by PAE * paging. The MAXPHYADDR depends on each processor. Normally, 36-bit(?). */ #ifndef __ASSEMBLY__ #include <sandix/types.h> typedef u64 pteval_t; typedef u64 pmdval_t; typedef u64 pudval_t; typedef u64 pgdval_t; typedef u64 pgprotval_t; typedef union { struct { unsigned long pte_low, pte_high; }; pteval_t pte; } pte_t; #endif #define SHARED_KERNEL_PMD 1 /* * PGDIR_SHIFT determines the size of the area a top-level page table entry can * map. */ #define PGDIR_SHIFT 30 #define PTRS_PER_PGD 4 /* * x86_32 PAE uses three-level paging, so we do not really have any PUD * directory physically. */ /* * PMD_SHIFT determines the size of the area a middle-level page table entry can * map. */ #define PMD_SHIFT 21 #define PTRS_PER_PMD 512 #define PTRS_PER_PTE 512 #endif /* _ASM_X86_PGTABLE_3LEVEL_TYPES_H_ */
/* * Copyright (C) 2007 Philippe Gerum <rpm@xenomai.org>. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <uitron/uitron.h> extern int __uitron_muxid; ER cre_flg(ID flgid, T_CFLG *pk_cflg) { return XENOMAI_SKINCALL2(__uitron_muxid, __uitron_cre_flg, flgid, pk_cflg); } ER del_flg(ID flgid) { return XENOMAI_SKINCALL1(__uitron_muxid, __uitron_del_flg, flgid); } ER set_flg(ID flgid, UINT setptn) { return XENOMAI_SKINCALL2(__uitron_muxid, __uitron_set_flg, flgid, setptn); } ER clr_flg(ID flgid, UINT clrptn) { return XENOMAI_SKINCALL2(__uitron_muxid, __uitron_clr_flg, flgid, clrptn); } ER wai_flg(UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode) { return XENOMAI_SKINCALL4(__uitron_muxid, __uitron_wai_flg, p_flgptn, flgid, waiptn, wfmode); } ER pol_flg(UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode) { return XENOMAI_SKINCALL4(__uitron_muxid, __uitron_pol_flg, p_flgptn, flgid, waiptn, wfmode); } ER twai_flg(UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode, TMO tmout) { return XENOMAI_SKINCALL5(__uitron_muxid, __uitron_twai_flg, p_flgptn, flgid, waiptn, wfmode, tmout); } ER ref_flg(T_RFLG *pk_rflg, ID flgid) { return XENOMAI_SKINCALL2(__uitron_muxid, __uitron_ref_flg, pk_rflg, flgid); }
/* ----------------------------------------------------------------------- * * * Copyright 2011 Intel Corporation; author: H. Peter Anvin * * 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, Inc., 51 Franklin St, Fifth Floor, * Boston MA 02110-1301, USA; either version 2 of the License, or * (at your option) any later version; incorporated herein by reference. * * ----------------------------------------------------------------------- */ /* * tcp.c * * Common operations for TCP-based network protocols */ #include "core_pxe.h" #include "net.h" const struct pxe_conn_ops tcp_conn_ops = { .fill_buffer = core_tcp_fill_buffer, .close = core_tcp_close_file, };
#ifndef _CPOINTBUFFER_ #define _CPOINTBUFFER_ #include "CBuffer.h" struct SPointVertex { float position[4]; }; class CPointVertexBuffer : public CVertexBuffer { public: CPointVertexBuffer(void * data, uint32 size); ~CPointVertexBuffer(); virtual void setup() const; }; #endif
/* * This file represents the smallest possible Alliance * OS LM module. */ #include <lm.h> /* LM description structure */ PUBLIC LMDescription lmDescription= { "Bare bone LM", /* Descriptive name for this LM */ "The null element in LM field", /* A more complete description of it */ LMIOSK|LMFSSK|LMNETSK|LMGRSK|LMSNDSK|LMSSK|LMUISK, /* Any SK can load it */ { 1, 0, 0 }, /* LM version */ };
#include <obs-module.h> OBS_DECLARE_MODULE() OBS_MODULE_USE_DEFAULT_LOCALE("obs-track-out", "en-US") struct track_out_data { obs_source_t *source; }; const char *track_out_name(void *type_data) { UNUSED_PARAMETER(type_data); return obs_module_text("Track"); } void *track_out_create(obs_data_t *settings, obs_source_t *source) { UNUSED_PARAMETER(settings); struct track_out_data *data = bzalloc(sizeof(struct track_out_data)); data->source = source; return data; } void track_out_destroy(void *data) { struct track_out_data *src = (struct track_out_data *)data; bfree(src); src = NULL; } struct obs_source_info track_out = {.id = "obs_track_out", .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_TRACK, .get_name = track_out_name, .create = track_out_create, .destroy = track_out_destroy, .update = NULL, .get_properties = NULL}; bool obs_module_load(void) { obs_register_source(&track_out); return true; }
/* vim: set ts=8 sw=8 sts=8 noet tw=78: * * tup - A file-based build system * * Copyright (C) 2009-2018 Mike Shal <marfey@gmail.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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef entry_h #define entry_h #include "tupid_tree.h" #include "string_tree.h" #include "db_types.h" #include "bsd/queue.h" #include <stdio.h> #include <time.h> #include <pcre.h> struct variant; struct estring; /* Local cache of the entries in the 'node' database table */ struct tup_entry { struct tupid_tree tnode; tupid_t dt; struct tup_entry *parent; enum TUP_NODE_TYPE type; time_t mtime; tupid_t srcid; struct variant *variant; struct string_tree name; struct string_entries entries; struct tupid_entries stickies; struct tupid_entries group_stickies; int retrieved_stickies; struct tup_entry *incoming; /* For exclusions */ pcre *re; /* For command strings */ char *flags; int flagslen; char *display; int displaylen; LIST_ENTRY(tup_entry) ghost_list; /* Only valid inside of get/release list. The next pointer is used to * determine whether or not it is in the list (next==NULL means it * isn't in the list). */ LIST_ENTRY(tup_entry) list; }; LIST_HEAD(tup_entry_head, tup_entry); struct re_entry { /* Points to the re from tup_entry */ pcre *re; /* Points to name.s from tup_entry */ const char *s; LIST_ENTRY(re_entry) list; }; LIST_HEAD(re_entry_head, re_entry); int tup_entry_init(void); int tup_entry_add(tupid_t tupid, struct tup_entry **dest); int tup_entry_find_name_in_dir(struct tup_entry *tent, const char *name, int len, struct tup_entry **dest); int tup_entry_find_name_in_dir_dt(tupid_t dt, const char *name, int len, struct tup_entry **dest); int tup_entry_add_to_dir(tupid_t dt, tupid_t tupid, const char *name, int len, const char *display, int displaylen, const char *flags, int flagslen, enum TUP_NODE_TYPE type, time_t mtime, tupid_t srcid, struct tup_entry **dest); int tup_entry_add_all(tupid_t tupid, tupid_t dt, enum TUP_NODE_TYPE type, time_t mtime, tupid_t srcid, const char *name, const char *display, const char *flags, struct tup_entry **dest); int tup_entry_resolve_dirs(void); int tup_entry_change_name_dt(tupid_t tupid, const char *new_name, tupid_t dt); int tup_entry_change_display(struct tup_entry *tent, const char *display, int displaylen); int tup_entry_change_flags(struct tup_entry *tent, const char *flags, int flagslen); int tup_entry_open(struct tup_entry *tent); int tup_entry_openat(int root_dfd, struct tup_entry *tent); int tup_entry_create_dirs(int root_dfd, struct tup_entry *tent); struct variant *tup_entry_variant(struct tup_entry *tent); struct variant *tup_entry_variant_null(struct tup_entry *tent); tupid_t tup_entry_vardt(struct tup_entry *tent); int tup_entry_rm(tupid_t tupid); struct tup_entry *tup_entry_get(tupid_t tupid); struct tup_entry *tup_entry_find(tupid_t tupid); int tup_entry_sym_follow(struct tup_entry *tent); void tup_entry_set_verbose(int verbose); void print_tup_entry(FILE *f, struct tup_entry *tent); void print_tupid(FILE *f, tupid_t tupid); int snprint_tup_entry(char *dest, int len, struct tup_entry *tent); int tup_entry_clear(void); struct tup_entry_head *tup_entry_get_list(void); void tup_entry_release_list(void); void tup_entry_list_add(struct tup_entry *tent, struct tup_entry_head *head); void tup_entry_list_del(struct tup_entry *tent); int tup_entry_in_list(struct tup_entry *tent); void tup_entry_add_ghost_list(struct tup_entry *tent, struct tup_entry_head *head); int tup_entry_del_ghost_list(struct tup_entry *tent); int tup_entry_debug_add_all_ghosts(struct tup_entry_head *head); int tup_entry_get_dir_tree(struct tup_entry *tent, struct tupid_entries *root); void dump_tup_entry(void); struct tent_list { TAILQ_ENTRY(tent_list) list; struct tup_entry *tent; }; TAILQ_HEAD(tent_list_head, tent_list); void del_tent_list_entry(struct tent_list_head *head, struct tent_list *tlist); void free_tent_list(struct tent_list_head *head); int get_relative_dir(FILE *f, struct estring *e, tupid_t start, tupid_t end); int exclusion_root_to_list(struct tupid_entries *root, struct re_entry_head *head); int re_entries_match(FILE *f, struct re_entry_head *head, const char *s, int *match); void free_re_list(struct re_entry_head *head); #endif
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: bing.wei.liu 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. * Test that pthread_mutexattr_gettype() * * It shall fail if: * * [EINVAL] - The value specified by 'attr' is invalid. * * * Steps: * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() * 2. Call pthread_mutexattr_gettype() with an invalid 'attr'. * */ #define _XOPEN_SOURCE 600 #include <pthread.h> #include <stdio.h> #include <string.h> #include "posixtest.h" #include <errno.h> int main() { pthread_mutexattr_t mta; int type, ret; /* Make 'attr' invalid by not initializing it and using memset. */ memset(&mta, 0, sizeof(mta)); /* Pass an invalid 'attr'. */ ret = pthread_mutexattr_gettype(&mta, &type); if (ret != EINVAL) { printf ("Test FAILED: Incorrect return code. Expected EINVAL, but got: %d\n", ret); return PTS_FAIL; } printf("Test PASSED\n"); return PTS_PASS; }
/*************************************************************************** taxeditdialog.h - edit tax rates ------------------- begin : Apr 9 2009 copyright : (C) 2009 by Klaas Freitag email : freitag@kde.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 TAXEDITDIALOG_H #define TAXEDITDIALOG_H #include <QObject> #include <QSqlTableModel> #include <QDataWidgetMapper> #include <QDialog> #include "ui_taxeditbase.h" /** * @author Klaas Freitag */ // ################################################################################ class TaxEditDialog: public QDialog, protected Ui::TaxEditBase { Q_OBJECT public: TaxEditDialog( QSqlTableModel *taxModel, QWidget *parent ); public slots: void accept(); void reject(); private: Ui::TaxEditBase *mBaseWidget; QDataWidgetMapper *mapper; QSqlTableModel *model; }; #endif
#include "string_tests.h" void strlcat_fits() { char buf[20]; strcpy(buf, "First"); Assert(strlcat(buf, "Last", sizeof(buf)) == 9, "Should be == 9"); Assert(strcmp(buf, "FirstLast") == 0, "Incorrect contents"); } void strlcat_short() { char buf[8]; int ret; strcpy(buf, "First"); Assert(strlcat(buf, "Last", sizeof(buf)) == 9, "Should be == 9"); Assert(strcmp(buf, "FirstLa") == 0, "Incorrect contents"); } void strlcat_empty_string() { char buf[20]; buf[0] = 0; Assert(strlcat(buf, "Last", sizeof(buf)) == 4, "Should be == 4"); Assert(strcmp(buf, "Last") == 0, "Incorrect contents"); } int test_strlcat() { suite_setup("Strlcat Tests"); suite_add_test(strlcat_fits); suite_add_test(strlcat_short); suite_add_test(strlcat_empty_string); return suite_run(); }
/* $Id: vcd_stream.h,v 1.3 2001/08/21 15:01:24 hvr Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@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. 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 __VCD_STREAM_H__ #define __VCD_STREAM_H__ #include <libvcd/vcd_types.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* typedef'ed IO functions prototypes */ typedef int(*vcd_data_open_t)(void *user_data); typedef long(*vcd_data_read_t)(void *user_data, void *buf, long count); typedef long(*vcd_data_write_t)(void *user_data, const void *buf, long count); typedef long(*vcd_data_seek_t)(void *user_data, long offset); typedef long(*vcd_data_stat_t)(void *user_data); typedef int(*vcd_data_close_t)(void *user_data); typedef void(*vcd_data_free_t)(void *user_data); /* abstract data sink */ typedef struct _VcdDataSink VcdDataSink; typedef struct { vcd_data_open_t open; vcd_data_seek_t seek; vcd_data_write_t write; vcd_data_close_t close; vcd_data_free_t free; } vcd_data_sink_io_functions; VcdDataSink* vcd_data_sink_new(void *user_data, const vcd_data_sink_io_functions *funcs); long vcd_data_sink_write(VcdDataSink* obj, const void *ptr, long size, long nmemb); long vcd_data_sink_printf (VcdDataSink *obj, const char format[], ...) GNUC_PRINTF(2, 3); long vcd_data_sink_seek(VcdDataSink* obj, long offset); void vcd_data_sink_destroy(VcdDataSink* obj); void vcd_data_sink_close(VcdDataSink* obj); /* abstract data source */ typedef struct _VcdDataSource VcdDataSource; typedef struct { vcd_data_open_t open; vcd_data_seek_t seek; vcd_data_stat_t stat; vcd_data_read_t read; vcd_data_close_t close; vcd_data_free_t free; } vcd_data_source_io_functions; VcdDataSource* vcd_data_source_new(void *user_data, const vcd_data_source_io_functions *funcs); long vcd_data_source_read(VcdDataSource* obj, void *ptr, long size, long nmemb); long vcd_data_source_seek(VcdDataSource* obj, long offset); long vcd_data_source_stat(VcdDataSource* obj); void vcd_data_source_destroy(VcdDataSource* obj); void vcd_data_source_close(VcdDataSource* obj); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __VCD_STREAM_H__ */ /* * Local variables: * c-file-style: "gnu" * tab-width: 8 * indent-tabs-mode: nil * End: */
/* * PROJECT: ReactOS SDK Library * LICENSE: LGPL, see LGPL.txt in top level directory. * FILE: lib/sdk/delayimp/delayimp.c * PURPOSE: Library for delay importing from dlls * PROGRAMMERS: Timo Kreuzer <timo.kreuzer@reactos.org> * Mark Jansen * */ #include <stdarg.h> #include <windef.h> #include <winbase.h> #include <delayimp.h> /**** Linker magic: provide a default (NULL) pointer, but allow the user to override it ****/ #if defined(__GNUC__) PfnDliHook __pfnDliNotifyHook2; PfnDliHook __pfnDliFailureHook2; #else /* The actual items we use */ extern PfnDliHook __pfnDliNotifyHook2; extern PfnDliHook __pfnDliFailureHook2; /* The fallback symbols */ extern PfnDliHook __pfnDliNotifyHook2Default = NULL; extern PfnDliHook __pfnDliFailureHook2Default = NULL; /* Tell the linker to use the fallback symbols */ #if defined (_M_IX86) #pragma comment(linker, "/alternatename:___pfnDliNotifyHook2=___pfnDliNotifyHook2Default") #pragma comment(linker, "/alternatename:___pfnDliFailureHook2=___pfnDliFailureHook2Default") #elif defined (_M_IA64) || defined (_M_AMD64) #pragma comment(linker, "/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default") #pragma comment(linker, "/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default") #else #error Unsupported platform, please find the correct decoration for your arch! #endif #endif /**** Helper functions to convert from RVA to address ****/ FORCEINLINE unsigned IndexFromPImgThunkData(PCImgThunkData pData, PCImgThunkData pBase) { return pData - pBase; } extern const IMAGE_DOS_HEADER __ImageBase; FORCEINLINE PVOID PFromRva(RVA rva) { return (PVOID)(((ULONG_PTR)(rva)) + ((ULONG_PTR)&__ImageBase)); } /**** load helper ****/ FARPROC WINAPI __delayLoadHelper2(PCImgDelayDescr pidd, PImgThunkData pIATEntry) { DelayLoadInfo dli = {0}; int index; PImgThunkData pIAT; PImgThunkData pINT; HMODULE *phMod; pIAT = PFromRva(pidd->rvaIAT); pINT = PFromRva(pidd->rvaINT); phMod = PFromRva(pidd->rvaHmod); index = IndexFromPImgThunkData(pIATEntry, pIAT); dli.cb = sizeof(dli); dli.pidd = pidd; dli.ppfn = (FARPROC*)&pIAT[index].u1.Function; dli.szDll = PFromRva(pidd->rvaDLLName); dli.dlp.fImportByName = !IMAGE_SNAP_BY_ORDINAL(pINT[index].u1.Ordinal); if (dli.dlp.fImportByName) { /* u1.AdressOfData points to a IMAGE_IMPORT_BY_NAME struct */ PIMAGE_IMPORT_BY_NAME piibn = PFromRva((RVA)pINT[index].u1.AddressOfData); dli.dlp.szProcName = (LPCSTR)&piibn->Name; } else { dli.dlp.dwOrdinal = IMAGE_ORDINAL(pINT[index].u1.Ordinal); } if (__pfnDliNotifyHook2) { dli.pfnCur = __pfnDliNotifyHook2(dliStartProcessing, &dli); if (dli.pfnCur) { pIAT[index].u1.Function = (DWORD_PTR)dli.pfnCur; if (__pfnDliNotifyHook2) __pfnDliNotifyHook2(dliNoteEndProcessing, &dli); return dli.pfnCur; } } dli.hmodCur = *phMod; if (dli.hmodCur == NULL) { if (__pfnDliNotifyHook2) dli.hmodCur = (HMODULE)__pfnDliNotifyHook2(dliNotePreLoadLibrary, &dli); if (dli.hmodCur == NULL) { dli.hmodCur = LoadLibraryA(dli.szDll); if (dli.hmodCur == NULL) { dli.dwLastError = GetLastError(); if (__pfnDliFailureHook2) dli.hmodCur = (HMODULE)__pfnDliFailureHook2(dliFailLoadLib, &dli); if (dli.hmodCur == NULL) { ULONG_PTR args[] = { (ULONG_PTR)&dli }; RaiseException(VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND), 0, 1, args); /* If we survive the exception, we are expected to use pfnCur directly.. */ return dli.pfnCur; } } } *phMod = dli.hmodCur; } dli.dwLastError = ERROR_SUCCESS; if (__pfnDliNotifyHook2) dli.pfnCur = (FARPROC)__pfnDliNotifyHook2(dliNotePreGetProcAddress, &dli); if (dli.pfnCur == NULL) { /* dli.dlp.szProcName might also contain the ordinal */ dli.pfnCur = GetProcAddress(dli.hmodCur, dli.dlp.szProcName); if (dli.pfnCur == NULL) { dli.dwLastError = GetLastError(); if (__pfnDliFailureHook2) dli.pfnCur = __pfnDliFailureHook2(dliFailGetProc, &dli); if (dli.pfnCur == NULL) { ULONG_PTR args[] = { (ULONG_PTR)&dli }; RaiseException(VcppException(ERROR_SEVERITY_ERROR, ERROR_PROC_NOT_FOUND), 0, 1, args); } //return NULL; } } pIAT[index].u1.Function = (DWORD_PTR)dli.pfnCur; dli.dwLastError = ERROR_SUCCESS; if (__pfnDliNotifyHook2) __pfnDliNotifyHook2(dliNoteEndProcessing, &dli); return dli.pfnCur; }
/* arch/arm/plat-s5pv2xx/irq-eint.c * * Copyright 2008 Openmoko, Inc. * Copyright 2008 Simtec Electronics * Ben Dooks <ben@simtec.co.uk> * http://armlinux.simtec.co.uk/ * * S5PV2XX - Interrupt handling for IRQ_EINT(x) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> #include <linux/sysdev.h> #include <asm/hardware/vic.h> #include <plat/regs-irqtype.h> #include <mach/map.h> #include <plat/cpu.h> #include <plat/pm.h> #include <mach/gpio.h> #include <plat/gpio-cfg.h> #include <plat/regs-gpio.h> static inline void s3c_irq_eint_mask(unsigned int irq) { u32 mask; mask = __raw_readl(S5PV2XX_EINTMASK(eint_mask_reg(irq))); mask |= eint_irq_to_bit(irq); __raw_writel(mask, S5PV2XX_EINTMASK(eint_mask_reg(irq))); #if defined(CONFIG_CPU_S5PV210_EVT0) mask = __raw_readl(S5PV2XX_EINTMASK(eint_mask_reg(irq))); #endif } static void s3c_irq_eint_unmask(unsigned int irq) { u32 mask; mask = __raw_readl(S5PV2XX_EINTMASK(eint_mask_reg(irq))); mask &= ~(eint_irq_to_bit(irq)); __raw_writel(mask, S5PV2XX_EINTMASK(eint_mask_reg(irq))); #if defined(CONFIG_CPU_S5PV210_EVT0) mask = __raw_readl(S5PV2XX_EINTMASK(eint_mask_reg(irq))); #endif } static inline void s3c_irq_eint_ack(unsigned int irq) { #if defined(CONFIG_CPU_S5PV210_EVT0) unsigned long tmp; #endif __raw_writel(eint_irq_to_bit(irq), S5PV2XX_EINTPEND(eint_pend_reg(irq))); #if defined(CONFIG_CPU_S5PV210_EVT0) tmp = __raw_readl(S5PV2XX_EINTMASK(eint_mask_reg(irq))); #endif } static void s3c_irq_eint_maskack(unsigned int irq) { /* compiler should in-line these */ s3c_irq_eint_mask(irq); s3c_irq_eint_ack(irq); } static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) { int offs = eint_offset(irq); int shift; u32 ctrl, mask; u32 newvalue = 0; switch (type) { case IRQ_TYPE_NONE: printk(KERN_WARNING "No edge setting!\n"); break; case IRQ_TYPE_EDGE_RISING: newvalue = S5P_EXTINT_RISEEDGE; break; case IRQ_TYPE_EDGE_FALLING: newvalue = S5P_EXTINT_FALLEDGE; break; case IRQ_TYPE_EDGE_BOTH: newvalue = S5P_EXTINT_BOTHEDGE; break; case IRQ_TYPE_LEVEL_LOW: newvalue = S5P_EXTINT_LOWLEV; break; case IRQ_TYPE_LEVEL_HIGH: newvalue = S5P_EXTINT_HILEV; break; default: printk(KERN_ERR "No such irq type %d", type); return -1; } shift = (offs & 0x7) * 4; mask = 0x7 << shift; ctrl = __raw_readl(S5PV2XX_EINTCON(eint_conf_reg(irq))); ctrl &= ~mask; ctrl |= newvalue << shift; __raw_writel(ctrl, S5PV2XX_EINTCON(eint_conf_reg(irq))); #if defined(CONFIG_CPU_S5PV210_EVT0) ctrl = __raw_readl(S5PV2XX_EINTCON(eint_conf_reg(irq))); #endif ctrl = __raw_readl(S5PV2XX_EINTFLTCON(offs / 4)); ctrl &= ~(0xff << ((offs & 3) * 8)); ctrl |= (0x80 << ((offs & 3) * 8)); __raw_writel(ctrl, S5PV2XX_EINTFLTCON(offs / 4)); #if defined(CONFIG_CPU_S5PV210_EVT0) ctrl = __raw_readl(S5PV2XX_EINTFLTCON(offs / 4)); #endif if ((0 <= offs) && (offs < 8)) s3c_gpio_cfgpin(S5PV2XX_GPH0(offs&0x7), 0xf<<((offs&0x7)*4)); else if ((8 <= offs) && (offs < 16)) s3c_gpio_cfgpin(S5PV2XX_GPH1(offs&0x7), 0xf<<((offs&0x7)*4)); else if ((16 <= offs) && (offs < 24)) s3c_gpio_cfgpin(S5PV2XX_GPH2(offs&0x7), 0xf<<((offs&0x7)*4)); else if ((24 <= offs) && (offs < 32)) s3c_gpio_cfgpin(S5PV2XX_GPH3(offs&0x7), 0xf<<((offs&0x7)*4)); else printk(KERN_ERR "No such irq number %d", offs); return 0; } static struct irq_chip s3c_irq_eint = { .name = "s3c-eint", .mask = s3c_irq_eint_mask, .unmask = s3c_irq_eint_unmask, .mask_ack = s3c_irq_eint_maskack, .ack = s3c_irq_eint_ack, .set_type = s3c_irq_eint_set_type, .set_wake = s3c_irqext_wake, }; /* s3c_irq_demux_eint * * This function demuxes the IRQ from the group0 external interrupts, * from IRQ_EINT(16) to IRQ_EINT(31). It is designed to be inlined into * the specific handlers s3c_irq_demux_eintX_Y. */ static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end) { u32 status = __raw_readl(S5PV2XX_EINTPEND((start >> 3))); u32 mask = __raw_readl(S5PV2XX_EINTMASK((start >> 3))); unsigned int irq; status &= ~mask; status &= (1 << (end - start + 1)) - 1; for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) { if (status & 1) generic_handle_irq(irq); status >>= 1; } } static void s3c_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) { s3c_irq_demux_eint(16, 23); s3c_irq_demux_eint(24, 31); } /*------------- EINT0 ~ EINT15 ---------------*/ static void s3c_irq_vic_eint_mask(unsigned int irq) { void __iomem *base = get_irq_chip_data(irq); s3c_irq_eint_mask(irq); irq &= 31; writel(1 << irq, base + VIC_INT_ENABLE_CLEAR); } static void s3c_irq_vic_eint_unmask(unsigned int irq) { void __iomem *base = get_irq_chip_data(irq); s3c_irq_eint_unmask(irq); irq &= 31; writel(1 << irq, base + VIC_INT_ENABLE); } static inline void s3c_irq_vic_eint_ack(unsigned int irq) { __raw_writel(eint_irq_to_bit(irq), S5PV2XX_EINTPEND(eint_pend_reg(irq))); } static void s3c_irq_vic_eint_maskack(unsigned int irq) { /* compiler should in-line these */ s3c_irq_vic_eint_mask(irq); s3c_irq_vic_eint_ack(irq); } static struct irq_chip s3c_irq_vic_eint = { .name = "s3c_vic_eint", .mask = s3c_irq_vic_eint_mask, .unmask = s3c_irq_vic_eint_unmask, .mask_ack = s3c_irq_vic_eint_maskack, .ack = s3c_irq_vic_eint_ack, .set_type = s3c_irq_eint_set_type, }; int __init s5pv2xx_init_irq_eint(void) { int irq; for (irq = IRQ_EINT0; irq <= IRQ_EINT15; irq++) set_irq_chip(irq, &s3c_irq_vic_eint); for (irq = IRQ_EINT(16); irq <= IRQ_EINT(31); irq++) { set_irq_chip(irq, &s3c_irq_eint); set_irq_handler(irq, handle_level_irq); set_irq_flags(irq, IRQF_VALID); } set_irq_chained_handler(IRQ_EINT16_31, s3c_irq_demux_eint16_31); return 0; } arch_initcall(s5pv2xx_init_irq_eint);
/* auxio.c: Probing for the Sparc AUXIO register at boot time. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) */ #include <linux/stddef.h> #include <linux/init.h> #include <linux/spinlock.h> #include <linux/of.h> #include <linux/of_device.h> #include <asm/oplib.h> #include <asm/io.h> #include <asm/auxio.h> #include <asm/string.h> /* memset(), Linux has no bzero() */ #include <asm/cpu_type.h> /* Probe and map in the Auxiliary I/O register */ /* auxio_register is not static because it is referenced * in entry.S::floppy_tdone */ void __iomem *auxio_register = NULL; static DEFINE_SPINLOCK(auxio_lock); void __init auxio_probe(void) { phandle node, auxio_nd; struct linux_prom_registers auxregs[1]; struct resource r; switch (sparc_cpu_model) { case sparc_leon: case sun4d: case sun4: return; default: break; } node = prom_getchild(prom_root_node); auxio_nd = prom_searchsiblings(node, "auxiliary-io"); if(!auxio_nd) { node = prom_searchsiblings(node, "obio"); node = prom_getchild(node); auxio_nd = prom_searchsiblings(node, "auxio"); if(!auxio_nd) { #ifdef CONFIG_PCI /* There may be auxio on Ebus */ return; #else if(prom_searchsiblings(node, "leds")) { /* VME chassis sun4m machine, no auxio exists. */ return; } prom_printf("Cannot find auxio node, cannot continue...\n"); prom_halt(); #endif } } if(prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs)) <= 0) return; prom_apply_obio_ranges(auxregs, 0x1); /* Map the register both read and write */ r.flags = auxregs[0].which_io & 0xF; r.start = auxregs[0].phys_addr; r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1; auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio"); /* Fix the address on sun4m and sun4c. */ if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 || sparc_cpu_model == sun4c) auxio_register += (3 - ((unsigned long)auxio_register & 3)); set_auxio(AUXIO_LED, 0); } unsigned char get_auxio(void) { if(auxio_register) return sbus_readb(auxio_register); return 0; } EXPORT_SYMBOL(get_auxio); void set_auxio(unsigned char bits_on, unsigned char bits_off) { unsigned char regval; unsigned long flags; spin_lock_irqsave(&auxio_lock, flags); switch(sparc_cpu_model) { case sun4c: regval = sbus_readb(auxio_register); sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN, auxio_register); break; case sun4m: if(!auxio_register) break; /* VME chassis sun4m, no auxio. */ regval = sbus_readb(auxio_register); sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M, auxio_register); break; case sun4d: break; default: panic("Can't set AUXIO register on this machine."); } spin_unlock_irqrestore(&auxio_lock, flags); } EXPORT_SYMBOL(set_auxio); /* sun4m power control register (AUXIO2) */ volatile unsigned char * auxio_power_register = NULL; void __init auxio_power_probe(void) { struct linux_prom_registers regs; phandle node; struct resource r; /* Attempt to find the sun4m power control node. */ node = prom_getchild(prom_root_node); node = prom_searchsiblings(node, "obio"); node = prom_getchild(node); node = prom_searchsiblings(node, "power"); if (node == 0 || (s32)node == -1) return; /* Map the power control register. */ if (prom_getproperty(node, "reg", (char *)&regs, sizeof(regs)) <= 0) return; prom_apply_obio_ranges(&regs, 1); memset(&r, 0, sizeof(r)); r.flags = regs.which_io & 0xF; r.start = regs.phys_addr; r.end = regs.phys_addr + regs.reg_size - 1; auxio_power_register = (unsigned char *) of_ioremap(&r, 0, regs.reg_size, "auxpower"); /* Display a quick message on the console. */ if (auxio_power_register) printk(KERN_INFO "Power off control detected.\n"); }
const static unsigned int mxts_keys[NUM_KEY_TYPE][MAX_KEYS_SUPPORTED_IN_DRIVER] = { //T15_T97_KEY {KEY_MENU/*KEY_APP_SWITCH*/,KEY_HOMEPAGE,KEY_BACK,KEY_WAKEUP,KEY_POWER}, //T19_KEY, {KEY_POWER}, //T24_KEY, {KEY_F8}, //T61_KEY, {KEY_F9}, //T81_KEY, {KEY_F8,KEY_F9}, //T92_KEY, {KEY_F8,KEY_F9,KEY_F10,KEY_F11}, //T93_KEY, {KEY_POWER}, //{KEY_F9}, //T99_KEY, {KEY_F10}, //T115_KEY, {KEY_F11}, //T116_KEY, {KEY_F12} }; const static u8 mxts_num_keys[NUM_KEY_TYPE] = { //T15_T97_KEY 5, //T19_KEY, 0, //T24_KEY, 1, //T61_KEY, 1, //T81_KEY, 2, //T92_KEY, 4, //T93_KEY, 1, //T99_KEY, 1, //T115_KEY, 1, //T116_KEY, 1, }; static struct mxt_config_info mxt_config_array[1] = { { .self_chgtime_max = 120, .self_chgtime_min = 60, }, }; static struct mxt_platform_data mxt_platform_data = { .irqflags = IRQF_TRIGGER_LOW/*IRQF_TRIGGER_FALLING*/, //the flag here should be matched with board_init_irq() irq triggle method .num_keys = mxts_num_keys, .keymap = mxts_keys, #if defined(CONFIG_MXT_REPORT_VIRTUAL_KEY_SLOT_NUM) .max_y_t = 1919, //Max value of Touch AA, asix more than this value will process by VirtualKeyHit .vkey_space_ratio = {5,8,15,10}, #endif #if defined(CONFIG_MXT_SELFCAP_TUNE) .config_array = mxt_config_array, #endif }; static struct i2c_board_info __initdata mxt_i2c_tpd={ I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), .platform_data = &mxt_platform_data, /*.irq = 0*/}; static int tpd_probe(struct i2c_client *client, const struct i2c_device_id *id) //__devinit { int ret; printk("mxt tpd_probe\n"); ret = mxt_probe(client,id); if(ret){ printk("mxt_probe failed\n"); return ret; } tpd_load_status = 1; return 0; } static int tpd_remove(struct i2c_client *client) //__devexit { tpd_load_status = 0; printk("mxt tpd_remove\n"); return mxt_remove(client); } static struct i2c_driver tpd_driver = { .driver = { .name = "atmel_mxt_ts", .owner = THIS_MODULE, #if !(defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB_PM)) .pm = &mxt_pm_ops, #endif }, .probe = tpd_probe, .remove = tpd_remove,//__devexit_p(), .shutdown = mxt_shutdown, .id_table = mxt_id, }; static int tpd_local_init(void) { printk("Atmel MXT I2C Touchscreen Driver (Built %s @ %s)\n", __DATE__, __TIME__); if(i2c_add_driver(&tpd_driver)!=0) { printk("mxt error unable to add i2c driver.\n"); return -1; } if(tpd_load_status == 0) { // disable auto load touch driver for linux3.0 porting printk("mxt atmel add error touch panel driver.\n"); i2c_del_driver(&tpd_driver); return -1; } printk("%s, success %d\n", __FUNCTION__, __LINE__); tpd_type_cap = 1; return 0; } static void tpd_suspend(struct early_suspend *h) { // here you should call mxt_early_suspend() above if you don't use stand power interface // you can refer to below code or you self mind #if !defined(CONFIG_HAS_EARLYSUSPEND) struct mxt_data *data = mxt_g_data; printk("[mxt] tpd_suspend\n"); if(data) mxt_suspend(&data->client->dev); #endif } static void tpd_resume(struct early_suspend *h) { // here you should call mxt_late_resume() above if you don't use stand power interface // you can refer to below code or you self mind #if !defined(CONFIG_HAS_EARLYSUSPEND) struct mxt_data *data = mxt_g_data; printk("[mxt] tpd_resume\n"); if(data) mxt_resume(&data->client->dev); #endif } static struct tpd_driver_t tpd_device_driver = { .tpd_device_name = "atmel_mxt_ts", .tpd_local_init = tpd_local_init, .suspend =tpd_suspend, .resume = tpd_resume, //.tpd_have_button = 0, }; /* called when loaded into kernel */ static int __init tpd_driver_init(void) { printk("mxt tpd_driver_init\n"); //i2c_register_board_info(1, &mxt_i2c_tpd, 1); if(tpd_driver_add(&tpd_device_driver) < 0) printk("tpd_driver_init failed\n"); return 0; } /* should never be called */ static void __exit tpd_driver_exit(void) { printk("mxt tpd_driver_exit\n"); tpd_driver_remove(&tpd_device_driver); } module_init(tpd_driver_init); module_exit(tpd_driver_exit);
/* * External program function for the ESP Package Manager (EPM). * * Copyright 1999-2014 by Michael R Sweet * Copyright 1999-2005 by Easy Software Products. * * 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. */ /* * Include necessary headers... */ #include "epm.h" #include <stdarg.h> #include <fcntl.h> #include <sys/wait.h> /* * 'run_command()' - Run an external program. */ int /* O - Exit status */ run_command(const char *directory, /* I - Directory for command or NULL */ const char *command, /* I - Command string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Argument pointer */ int pid, /* Child process ID */ status, /* Status of child */ argc; /* Number of arguments */ char argbuf[10240], /* Argument buffer */ *argptr, /* Argument string pointer */ *argv[100]; /* Argument strings */ /* * Format the command string... */ va_start(ap, command); vsnprintf(argbuf, sizeof(argbuf) - 1, command, ap); argbuf[sizeof(argbuf) - 1] = '\0'; if (Verbosity > 1) puts(argbuf); /* * Parse the argument string; arguments can be separated by whitespace * and quoted by " and '... */ argv[0] = argbuf; for (argptr = argbuf, argc = 1; *argptr != '\0' && argc < 99; argptr ++) if (isspace(*argptr & 255)) { *argptr++ = '\0'; while (isspace(*argptr & 255)) argptr ++; if (*argptr != '\0') { argv[argc] = argptr; argc ++; } argptr --; } else if (*argptr == '\'') { if (argptr == argv[argc - 1]) argv[argc - 1] ++; for (argptr ++; *argptr && *argptr != '\''; argptr ++) if (*argptr == '\\' && argptr[1]) memmove(argptr, argptr + 1, strlen(argptr)); if (*argptr == '\'') memmove(argptr, argptr + 1, strlen(argptr)); argptr --; } else if (*argptr == '\"') { if (argptr == argv[argc - 1]) argv[argc - 1] ++; for (argptr ++; *argptr && *argptr != '\"'; argptr ++) if (*argptr == '\\' && argptr[1]) memmove(argptr, argptr + 1, strlen(argptr)); if (*argptr == '\"') memmove(argptr, argptr + 1, strlen(argptr)); argptr --; } argv[argc] = NULL; /* * Execute the command... */ if ((pid = fork()) == 0) { /* * Child comes here... Redirect stdin, stdout, and stderr to /dev/null * if !Verbosity... */ if (Verbosity < 2) { close(0); close(1); close(2); open("/dev/null", O_RDWR); dup(0); dup(0); } /* * Change directories... */ if (directory) chdir(directory); /* * Execute the program; if an error occurs, exit with the UNIX error... */ execvp(argv[0], argv); fprintf(stderr, "epm: Unable to execute \"%s\" program: %s\n", argv[0], strerror(errno)); exit(errno); } else if (pid < 0) { /* * Error - can't fork! */ perror("epm: fork failed"); return (1); } /* * Fork successful - wait for the child and return the error status... */ if (wait(&status) != pid) { fputs("epm: Got exit status from wrong program!\n", stderr); return (1); } else if (WIFSIGNALED(status)) return (-WTERMSIG(status)); else return (WEXITSTATUS(status)); }
#pragma once /* * Copyright (C) 2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "input/touch/ITouchActionHandler.h" /*! * \ingroup touch_generic * \brief Generic implementation of ITouchActionHandler to translate * touch actions into XBMC specific and mappable actions. * * \sa ITouchActionHandler */ class CGenericTouchActionHandler : public ITouchActionHandler { public: /*! \brief Get an instance of the touch input manager */ static CGenericTouchActionHandler &GetInstance(); // implementation of ITouchActionHandler void OnTouchAbort() override; bool OnSingleTouchStart(float x, float y) override; bool OnSingleTouchHold(float x, float y) override; bool OnSingleTouchMove(float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override; bool OnSingleTouchEnd(float x, float y) override; bool OnMultiTouchDown(float x, float y, int32_t pointer) override; bool OnMultiTouchHold(float x, float y, int32_t pointers = 2) override; bool OnMultiTouchMove(float x, float y, float offsetX, float offsetY, float velocityX, float velocityY, int32_t pointer) override; bool OnMultiTouchUp(float x, float y, int32_t pointer) override; bool OnTouchGestureStart(float x, float y) override; bool OnTouchGesturePan(float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override; bool OnTouchGestureEnd(float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override; // convenience events void OnTap(float x, float y, int32_t pointers = 1) override; void OnLongPress(float x, float y, int32_t pointers = 1) override; void OnSwipe(TouchMoveDirection direction, float xDown, float yDown, float xUp, float yUp, float velocityX, float velocityY, int32_t pointers = 1) override; void OnZoomPinch(float centerX, float centerY, float zoomFactor) override; void OnRotate(float centerX, float centerY, float angle) override; /*! \brief Asks the control at the given coordinates for a list of the supported gestures. \param x The x coordinate (with sub-pixel) of the touch \param y The y coordinate (with sub-pixel) of the touch \return EVENT_RESULT value of bitwise ORed gestures. */ int QuerySupportedGestures(float x, float y); private: // private construction, and no assignments; use the provided singleton methods CGenericTouchActionHandler() = default; CGenericTouchActionHandler(const CGenericTouchActionHandler&); CGenericTouchActionHandler const& operator=(CGenericTouchActionHandler const&); ~CGenericTouchActionHandler() override = default; void sendEvent(int actionId, float x, float y, float x2 = 0.0f, float y2 = 0.0f, float x3 = 0.0f, float y3 = 0.0f, int pointers = 1); void focusControl(float x, float y); };
#include "../../openexr-2.5.7/OpenEXR/IlmImf/ImfInt64.h"
#include <stdio.h> #include <stdlib.h> #include <pthread.h> void* compute_prime (void* arg) { int candidate = 2; int n = *((int*) arg); while(1){ int factor; int is_prime = 1; for(factor = 2; factor < candidate; ++factor){ if(candidate % factor == 0){ is_prime = 0; break; } } if(is_prime) if(--n == 0) return (void*) candidate; ++candidate; } return NULL; } int main(int argc, char *argv[]) { pthread_t thread; int which_prime = 5000; int prime; pthread_create (&thread, NULL, &compute_prime, &which_prime); pthread_join(thread, (void*) &prime); printf("The %dth prime number is %d. \n", which_prime, prime); return EXIT_SUCCESS; }
#define NUM_THREADS 10 #define NUM_BARISTAS 2 /* definition of a customer, contains id (order generated), cost of the customer's order, type (simple or complex) and a pointer to the next guy (or girl ;) ) in the line */ typedef struct _customer { int id; int cost; int type; struct _customer *next; } customer; /* keeps track of the front and back of the queue */ typedef struct _customer_queue { customer *first; // pointer to the first item customer *last; // pointer to the last item } customer_queue; void *barista_func(void *sharedQ); int insert_customer(customer_queue *q, customer *data); customer* peek_customer(customer_queue *q); void serve(customer *q); void pay_func(customer *curr_customer); void add_customer_time(customer *curr_customer); // declare locks pthread_mutex_t order_queue_lock; pthread_mutex_t free_baristas_lock; pthread_mutex_t baristas[NUM_BARISTAS]; pthread_mutex_t time_lock[NUM_BARISTAS]; // start off with all baristas free int free_baristas = NUM_BARISTAS; // global order queue customer_queue *order_queue; // money made int money_earned; // global time variables struct timeval end_times[NUM_THREADS]; struct timeval start_times[NUM_THREADS]; long int simple_total = 0; long int complex_total = 0;
/* icon.c definitions. Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab 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. alttab 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 alttab. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ICON_H #define ICON_H #include <stdbool.h> #include <unistd.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xft/Xft.h> #include <X11/xpm.h> #include <uthash.h> #include <sys/types.h> #include <sys/stat.h> #include <err.h> #include <fts.h> #include <stdio.h> #include <ctype.h> #define MAXICONDIRS 64 #define MAXAPPLEN 64 #define MAXICONPATHLEN 1024 #define MAXICONDIMLEN 5 typedef struct { char app[MAXAPPLEN]; // application name; uthash key char src_path[MAXICONPATHLEN]; // \0 -if not initialized or loaded from X window properties unsigned int src_w, src_h; // width/height of source (not resized) icon. may be 1x1 if unknown, so use it only for better icon selection, not for allocations Pixmap drawable; // resized (ready to use) Pixmap mask; bool drawable_allocated; // we must free drawable (but not mask), because we created it #define ICON_EXT_UNKNOWN 0 #define ICON_EXT_PNG 2 #define ICON_EXT_XPM 3 unsigned int ext; #define ICON_DIR_FREEDESKTOP 0 // in WxH/apps/ #define ICON_DIR_LEGACY 1 unsigned int dir; UT_hash_handle hh; } icon_t; icon_t *initIcon(); void deleteIcon(icon_t * ic); int initIconHash(icon_t ** ihash); int allocIconDirs(char ** icon_dirs); void destroyIconDirs(char ** icon_dirs); int updateIconsFromFile(icon_t ** ihash); // load all icons into hash (no pixmaps, just path and dimension) int inspectIconMeta(FTSENT * pe); // check if file pe has better icon than we have in g.ic int loadIconContentPNG(icon_t * ic); int loadIconContentXPM(icon_t * ic); int loadIconContent(icon_t * ic); // update drawable icon_t *lookupIcon(char *app); // search app icon in hash bool iconMatchBetter(int new_w, int new_h, int old_w, int old_h); void deleteIconHash(icon_t **ihash); #endif
/* * (C) 2003-2006 Gabest * (C) 2006-2013, 2015-2016 see Authors.txt * * This file is part of MPC-HC. * * MPC-HC 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. * * MPC-HC 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/>. * */ #pragma once #include "CMPCThemePPageBase.h" #include "FloatEdit.h" #include "DropTarget.h" #include "CMPCThemePlayerListCtrl.h" #include "CMPCThemeTreeCtrl.h" class CPPageExternalFiltersListBox : public CMPCThemePlayerListCtrl { DECLARE_DYNAMIC(CPPageExternalFiltersListBox) public: CPPageExternalFiltersListBox(); protected: virtual void PreSubclassWindow(); virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; DECLARE_MESSAGE_MAP() afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult); }; // CPPageExternalFilters dialog class CPPageExternalFilters : public CMPCThemePPageBase, public CDropClient { DECLARE_DYNAMIC(CPPageExternalFilters) public: CPPageExternalFilters(); virtual ~CPPageExternalFilters(); // Dialog Data enum { IDD = IDD_PPAGEEXTERNALFILTERS }; private: CAutoPtrList<FilterOverride> m_pFilters; FilterOverride* m_pLastSelFilter; CPPageExternalFiltersListBox m_filters; int m_iLoadType; CMPCThemeHexEdit m_dwMerit; CMPCThemeTreeCtrl m_tree; CDropTarget m_dropTarget; void OnDropFiles(CAtlList<CString>& slFiles, DROPEFFECT) override; DROPEFFECT OnDropAccept(COleDataObject*, DWORD, CPoint) override; void Exchange(CListCtrl& list, int i, int j); void StepUp(CListCtrl& list); void StepDown(CListCtrl& list); FilterOverride* GetCurFilter(); void SetupMajorTypes(CAtlArray<GUID>& guids); void SetupSubTypes(CAtlArray<GUID>& guids); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog(); virtual BOOL OnApply(); DECLARE_MESSAGE_MAP() afx_msg void OnUpdateFilter(CCmdUI* pCmdUI); afx_msg void OnUpdateFilterUp(CCmdUI* pCmdUI); afx_msg void OnUpdateFilterDown(CCmdUI* pCmdUI); afx_msg void OnUpdateFilterMerit(CCmdUI* pCmdUI); afx_msg void OnUpdateSubType(CCmdUI* pCmdUI); afx_msg void OnUpdateDeleteType(CCmdUI* pCmdUI); afx_msg void OnAddRegistered(); afx_msg void OnRemoveFilter(); afx_msg void OnMoveFilterUp(); afx_msg void OnMoveFilterDown(); void OnDoubleClickFilter(NMHDR* pNMHDR, LRESULT* pResult); afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex); afx_msg void OnAddMajorType(); afx_msg void OnAddSubType(); afx_msg void OnDeleteType(); afx_msg void OnResetTypes(); void OnFilterChanged(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnFilterSelectionChange(); afx_msg void OnFilterCheckChange(); afx_msg void OnClickedMeritRadioButton(); afx_msg void OnChangeMerit(); afx_msg void OnDoubleClickType(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnKeyDownType(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnDestroy(); afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult); };
/* ======================================================================== D O O M R e t r o The classic, refined DOOM source port. For Windows PC. ======================================================================== Copyright © 1993-2012 id Software LLC, a ZeniMax Media company. Copyright © 2013-2017 Brad Harding. DOOM Retro is a fork of Chocolate DOOM. For a list of credits, see <http://wiki.doomretro.com/credits>. This file is part of DOOM Retro. DOOM Retro 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. DOOM Retro 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 DOOM Retro. If not, see <https://www.gnu.org/licenses/>. DOOM is a registered trademark of id Software LLC, a ZeniMax Media company, in the US and/or other countries and is used without permission. All other trademarks are the property of their respective holders. DOOM Retro is in no way affiliated with nor endorsed by id Software. ======================================================================== */ #if !defined(__P_TICK_H__) #define __P_TICK_H__ #if defined(__GNUG__) #pragma interface #endif void P_Ticker(void); void P_InitThinkers(void); void P_AddThinker(thinker_t *thinker); void P_RemoveThinker(thinker_t *thinker); void P_RemoveThinkerDelayed(thinker_t *thinker); // killough 4/25/98 void P_UpdateThinker(thinker_t *thinker); // killough 8/29/98 void P_SetTarget(mobj_t **mop, mobj_t *targ); // killough 11/98 // killough 8/29/98: threads of thinkers, for more efficient searches // cph 2002/01/13: for consistency with the main thinker list, keep objects // pending deletion on a class list too enum { th_delete, th_mobj, th_misc, NUMTHCLASS, th_all = NUMTHCLASS }; extern thinker_t thinkerclasscap[]; #define thinkercap thinkerclasscap[th_all] #endif
/*************************************************************************** * This file is part of the Lime Report project * * Copyright (C) 2015 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** * * * This library is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * ** GNU Lesser General Public License ** * * * This library is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * * License along with this library. * * If not, see <http://www.gnu.org/licenses/>. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * ****************************************************************************/ #ifndef LRXMLWRITER_H #define LRXMLWRITER_H #include "lrbasedesignintf.h" #include "serializators/lrstorageintf.h" #include "serializators/lrxmlserializatorsfactory.h" #include <QtXml> namespace LimeReport { class XMLWriter : public ItemsWriterIntf { public: XMLWriter(); XMLWriter(QSharedPointer<QDomDocument> doc); ~XMLWriter() {} private: // ItemsWriterIntf interface void putItem(QObject *item); bool saveToFile(QString fileName); QString saveToString(); QByteArray saveToByteArray(); void setPassPhrase(const QString &passPhrase); void init(); QDomElement putQObjectItem(QString name, QObject *item); void putChildQObjectItem(QString name, QObject *item, QDomElement *parentNode); void putCollectionItem(QObject *item, QDomElement *parentNode = 0); void putQObjectProperty(QString propertyName, QObject *item, QDomElement *parentNode = 0); void saveProperties(QObject *item, QDomElement *node); bool setContent(QString fileName); void saveProperty(QString name, QObject *item, QDomElement *node); bool enumOrFlag(QString name, QObject *item); QString extractClassName(QObject *item); bool isCollection(QString propertyName, QObject *item); bool isTranslation(QString propertyName, QObject *item); void saveCollection(QString propertyName, QObject *item, QDomElement *node); void saveTranslation(QString propertyName, QObject *item, QDomElement *node); bool isQObject(QString propertyName, QObject *item); bool replaceNode(QDomElement node, QObject *item); private: QSharedPointer<QDomDocument> m_doc; QString m_fileName; QDomElement m_rootElement; QString m_passPhrase; }; } // namespace LimeReport #endif // LRXMLWRITER_H
#include <stdio.h> #define ARR_NUMBER 5 int main() { int x[ARR_NUMBER]; for (int i = 0; i < ARR_NUMBER; i++) { printf("Write the number %i: ", (i+1)); scanf("%i", &x[i]); } // processing for (int i = 0; i < ARR_NUMBER; i++) { printf("The number in the position %i is %i\n", (i+1), x[i]); } return 0; }
/** * OSM * Copyright (C) 2018 Pavel Smokotnin * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLOT_H #define PLOT_H #include <QtQuick/QQuickItem> #include "axis.h" #include "source.h" #include "palette.h" #include "cursorhelper.h" #include "common/settings.h" #ifdef GRAPH_METAL #include "seriesitem.h" using SeriesItem = chart::SeriesItem; #elif defined(GRAPH_OPENGL) #include "seriesfbo.h" using SeriesItem = chart::SeriesFBO; #else #pragma message("GRAPH backend not setted") #endif namespace chart { class Plot : public QQuickItem { Q_OBJECT Q_PROPERTY(QList<chart::Source *> selected READ selected WRITE setSelected NOTIFY selectedChanged) Q_PROPERTY(QString xLabel READ xLabel NOTIFY xLabelChanged) Q_PROPERTY(QString yLabel READ yLabel NOTIFY yLabelChanged) Q_PROPERTY(QString rendererError READ rendererError NOTIFY rendererErrorChanged) public: explicit Plot(Settings *settings, QQuickItem *parent); void clear(); void disconnectFromParent(); QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); virtual void appendDataSource(Source *source); virtual void removeDataSource(Source *source); virtual void setSourceZIndex(Source *source, int index); virtual void setHighlighted(Source *source); Q_INVOKABLE virtual void setHelper(qreal x, qreal y) noexcept = 0; Q_INVOKABLE virtual void unsetHelper() noexcept = 0; Q_INVOKABLE virtual qreal x2v(qreal x) const noexcept = 0; Q_INVOKABLE virtual qreal y2v(qreal y) const noexcept = 0; virtual QString xLabel() const = 0; virtual QString yLabel() const = 0; virtual void setSettings(Settings *settings) noexcept; virtual void storeSettings() noexcept = 0; const Palette &palette() const noexcept; bool darkMode() const noexcept; void setDarkMode(bool darkMode) noexcept; QString rendererError() const; void setRendererError(QString error); QList<chart::Source *> selected() const; void select(Source *source); void setSelected(const QList<chart::Source *> selected); bool isSelected(chart::Source *source) const; void setSelectAppended(bool selectAppended); signals: void updated(); void rendererErrorChanged(); void xLabelChanged(); void yLabelChanged(); void selectedChanged(); public slots: void parentWidthChanged(); void parentHeightChanged(); void update(); protected: virtual SeriesItem *createSeriesFromSource(Source *source) = 0; void applyWidthForSeries(SeriesItem *s); void applyHeightForSeries(SeriesItem *s); CursorHelper *cursorHelper() const noexcept; const struct Padding { float left = 50.f, right = 10.f, top = 10.f, bottom = 20.f; } m_padding; QList<SeriesItem *> m_serieses; Settings *m_settings; Palette m_palette; QList<QPointer<chart::Source>> m_selected; QString m_rendererError; static CursorHelper *s_cursorHelper; private: bool m_selectAppended; }; } #endif // PLOT_H
#ifndef __STM32_VSERPOG_USB_CDC_H__ #define __STM32_VSERPOG_USB_CDC_H__ #include <stdint.h> #include <stddef.h> #define USBCDC_PKT_SIZE_DAT 64 #define USBCDC_PKT_SIZE_INT 16 extern char usbcdc_rxbuf[USBCDC_PKT_SIZE_DAT]; /* DMA needs access */ extern volatile bool usb_ready; void usbcdc_init(void); uint16_t usbcdc_write(void *buf, size_t len); uint16_t usbcdc_putc(char c); uint16_t usbcdc_putu32(uint32_t word); uint16_t usbcdc_fetch_packet(void); char usbcdc_getc(void); uint32_t usbcdc_getu24(void); uint32_t usbcdc_getu32(void); uint8_t usbcdc_get_remainder(char **bufpp); #endif /* __STM32_VSERPOG_USB_CDC_H__ */
#ifndef TEST_SIMPLE_LOG_OUTPUT_HELPER_DEBUG_CALL_VALUE_ISTYPE_H_ #define TEST_SIMPLE_LOG_OUTPUT_HELPER_DEBUG_CALL_VALUE_ISTYPE_H_ #include "test\Configure.h" #if defined(_USING_TEST_) #if defined(_USING_TEST_SIMPLE_LOG_OUTPUT_DEBUG_) #include <utility> #include "test\simple\log\output\call\Value.h" namespace BrainMuscles { namespace test { namespace simple { namespace log { namespace output { namespace helper { namespace debug { namespace call { namespace value { template<typename TYPE> class IsType { private: template<typename CALLER_TYPE> static std::true_type IsTypeImpl(const BrainMuscles::test::simple::log::output::call::Value<CALLER_TYPE>&); static std::false_type IsTypeImpl(...); public: static constexpr bool Value = decltype(IsTypeImpl(std::declval<TYPE>()))::value; }; } } } } } } } } } #endif #endif #endif //!TEST_SIMPLE_LOG_OUTPUT_HELPER_DEBUG_CALL_VALUE_ISTYPE_H_
/** * \file * * Copyright (c) 2012 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \asf_license_stop * */ #ifndef _SAM3U_MATRIX_INSTANCE_ #define _SAM3U_MATRIX_INSTANCE_ /* ========== Register definition for MATRIX peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_MATRIX_MCFG (0x400E0200U) /**< \brief (MATRIX) Master Configuration Register */ #define REG_MATRIX_SCFG (0x400E0240U) /**< \brief (MATRIX) Slave Configuration Register */ #define REG_MATRIX_PRAS0 (0x400E0280U) /**< \brief (MATRIX) Priority Register A for Slave 0 */ #define REG_MATRIX_PRAS1 (0x400E0288U) /**< \brief (MATRIX) Priority Register A for Slave 1 */ #define REG_MATRIX_PRAS2 (0x400E0290U) /**< \brief (MATRIX) Priority Register A for Slave 2 */ #define REG_MATRIX_PRAS3 (0x400E0298U) /**< \brief (MATRIX) Priority Register A for Slave 3 */ #define REG_MATRIX_PRAS4 (0x400E02A0U) /**< \brief (MATRIX) Priority Register A for Slave 4 */ #define REG_MATRIX_PRAS5 (0x400E02A8U) /**< \brief (MATRIX) Priority Register A for Slave 5 */ #define REG_MATRIX_PRAS6 (0x400E02B0U) /**< \brief (MATRIX) Priority Register A for Slave 6 */ #define REG_MATRIX_PRAS7 (0x400E02B8U) /**< \brief (MATRIX) Priority Register A for Slave 7 */ #define REG_MATRIX_PRAS8 (0x400E02C0U) /**< \brief (MATRIX) Priority Register A for Slave 8 */ #define REG_MATRIX_PRAS9 (0x400E02C8U) /**< \brief (MATRIX) Priority Register A for Slave 9 */ #define REG_MATRIX_MRCR (0x400E0300U) /**< \brief (MATRIX) Master Remap Control Register */ #define REG_MATRIX_WPMR (0x400E03E4U) /**< \brief (MATRIX) Write Protect Mode Register */ #define REG_MATRIX_WPSR (0x400E03E8U) /**< \brief (MATRIX) Write Protect Status Register */ #else #define REG_MATRIX_MCFG (*(RwReg*)0x400E0200U) /**< \brief (MATRIX) Master Configuration Register */ #define REG_MATRIX_SCFG (*(RwReg*)0x400E0240U) /**< \brief (MATRIX) Slave Configuration Register */ #define REG_MATRIX_PRAS0 (*(RwReg*)0x400E0280U) /**< \brief (MATRIX) Priority Register A for Slave 0 */ #define REG_MATRIX_PRAS1 (*(RwReg*)0x400E0288U) /**< \brief (MATRIX) Priority Register A for Slave 1 */ #define REG_MATRIX_PRAS2 (*(RwReg*)0x400E0290U) /**< \brief (MATRIX) Priority Register A for Slave 2 */ #define REG_MATRIX_PRAS3 (*(RwReg*)0x400E0298U) /**< \brief (MATRIX) Priority Register A for Slave 3 */ #define REG_MATRIX_PRAS4 (*(RwReg*)0x400E02A0U) /**< \brief (MATRIX) Priority Register A for Slave 4 */ #define REG_MATRIX_PRAS5 (*(RwReg*)0x400E02A8U) /**< \brief (MATRIX) Priority Register A for Slave 5 */ #define REG_MATRIX_PRAS6 (*(RwReg*)0x400E02B0U) /**< \brief (MATRIX) Priority Register A for Slave 6 */ #define REG_MATRIX_PRAS7 (*(RwReg*)0x400E02B8U) /**< \brief (MATRIX) Priority Register A for Slave 7 */ #define REG_MATRIX_PRAS8 (*(RwReg*)0x400E02C0U) /**< \brief (MATRIX) Priority Register A for Slave 8 */ #define REG_MATRIX_PRAS9 (*(RwReg*)0x400E02C8U) /**< \brief (MATRIX) Priority Register A for Slave 9 */ #define REG_MATRIX_MRCR (*(RwReg*)0x400E0300U) /**< \brief (MATRIX) Master Remap Control Register */ #define REG_MATRIX_WPMR (*(RwReg*)0x400E03E4U) /**< \brief (MATRIX) Write Protect Mode Register */ #define REG_MATRIX_WPSR (*(RoReg*)0x400E03E8U) /**< \brief (MATRIX) Write Protect Status Register */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #endif /* _SAM3U_MATRIX_INSTANCE_ */
/* * (C) 2003-2006 Gabest * (C) 2006-2014 see Authors.txt * * This file is part of WinnerMediaPlayer. * * WinnerMediaPlayer 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. * * WinnerMediaPlayer 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/>. * */ #pragma once #include "ISubPic.h" class CSubPicQueueImpl : public CUnknown, public ISubPicQueue { CCritSec m_csSubPicProvider; CComPtr<ISubPicProvider> m_pSubPicProvider; protected: double m_fps; REFERENCE_TIME m_rtNow; REFERENCE_TIME m_rtNowLast; CComPtr<ISubPicAllocator> m_pAllocator; HRESULT RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps, BOOL bIsAnimated); public: CSubPicQueueImpl(ISubPicAllocator* pAllocator, HRESULT* phr); virtual ~CSubPicQueueImpl(); DECLARE_IUNKNOWN; STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); // ISubPicQueue STDMETHODIMP SetSubPicProvider(ISubPicProvider* pSubPicProvider); STDMETHODIMP GetSubPicProvider(ISubPicProvider** pSubPicProvider); STDMETHODIMP SetFPS(double fps); STDMETHODIMP SetTime(REFERENCE_TIME rtNow); /* STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1) = 0; STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic) = 0; STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop) = 0; STDMETHODIMP GetStats(int nSubPics, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop) = 0; */ }; class CSubPicQueue : public CSubPicQueueImpl, private CAMThread { int m_nMaxSubPic; BOOL m_bDisableAnim; CInterfaceList<ISubPic> m_Queue; CCritSec m_csQueueLock; // for protecting CInterfaceList<ISubPic> REFERENCE_TIME UpdateQueue(); void AppendQueue(ISubPic* pSubPic); int GetQueueCount(); REFERENCE_TIME m_rtQueueMin; REFERENCE_TIME m_rtQueueMax; REFERENCE_TIME m_rtInvalidate; // CAMThread bool m_fBreakBuffering; enum {EVENT_EXIT, EVENT_TIME, EVENT_COUNT}; // IMPORTANT: _EXIT must come before _TIME if we want to exit fast from the destructor HANDLE m_ThreadEvents[EVENT_COUNT]; DWORD ThreadProc(); public: CSubPicQueue(int nMaxSubPic, BOOL bDisableAnim, ISubPicAllocator* pAllocator, HRESULT* phr); virtual ~CSubPicQueue(); // ISubPicQueue STDMETHODIMP SetFPS(double fps); STDMETHODIMP SetTime(REFERENCE_TIME rtNow); STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1); STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &pSubPic); STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop); STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop); }; class CSubPicQueueNoThread : public CSubPicQueueImpl { CCritSec m_csLock; CComPtr<ISubPic> m_pSubPic; public: CSubPicQueueNoThread(ISubPicAllocator* pAllocator, HRESULT* phr); virtual ~CSubPicQueueNoThread(); // ISubPicQueue STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1); STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &pSubPic); STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop); STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop); };
#include <errno.h> #include "hsi_nfs3.h" #include "hsx_fuse.h" #include "acl.h" void hsx_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name, size_t size) { struct hsfs_inode *hsfs_node; struct hsfs_super *sb; int mask = 0; struct posix_acl *acl = NULL; char *buf = NULL; int type,real_size = 0,err = 0; DEBUG_IN("The inode number : ino = %lu,name : %s",ino,name); if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) type = ACL_TYPE_ACCESS; else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) { type = ACL_TYPE_DEFAULT; } else { err = ENOTSUP; goto out; } sb = fuse_req_userdata(req); if((hsfs_node=hsx_fuse_iget(sb,ino)) == NULL) { err = ENOENT; goto out; } if (type == ACL_TYPE_ACCESS) mask |= NA_ACLCNT | NA_ACL; if(type == ACL_TYPE_DEFAULT) { mask |= NA_DFACLCNT | NA_DFACL; } if ((err=hsi_nfs3_getxattr(hsfs_node,mask,&acl,type))) { goto out ; } buf = (char *)calloc(1,size); if(buf == NULL && size) { err = ENOMEM; free(acl); acl =NULL; goto out; } real_size = posix_acl_to_xattr(acl, (void *)buf, size); if(size == 0) { free(acl); acl = NULL; fuse_reply_xattr(req,real_size); DEBUG_OUT("%s","success exit"); return ; } if(real_size == ERANGE) { err = ERANGE; free(buf); free(acl); buf = NULL; acl = NULL; goto out; } fuse_reply_buf(req,buf,real_size); free(buf); free(acl); buf = NULL; acl = NULL; DEBUG_OUT("%s","success exit"); return ; out : fuse_reply_err(req,err); DEBUG_OUT("failed,with errno %d",err); }
#ifndef AI_OBJECTIVE_H #define AI_OBJECTIVE_H #include <string> #include "pompelmous.h" #include "ai-orders.h" typedef std::map<unsigned int, orders*> ordersmap_t; typedef bool(*unit_comp_func_t)(const unit_configuration& lhs, const unit_configuration& rhs); typedef bool(*unit_accept_func_t)(const unit_configuration& uc); class objective { public: objective(pompelmous* r_, civilization* myciv_, const std::string& obj_name_); virtual ~objective(); virtual int get_unit_points(const unit& u) const = 0; virtual int improvement_value(const city_improvement& ci) const = 0; virtual city_production get_city_production(const city& c, int* points) const; virtual bool add_unit(unit* u) = 0; virtual void process(std::set<unsigned int>* freed_units); const std::string& get_name() const; virtual void forget_everything(); protected: virtual bool compare_units(const unit_configuration& lhs, const unit_configuration& rhs) const = 0; virtual bool usable_unit(const unit_configuration& uc) const = 0; std::list<unsigned int> used_units; std::list<objective*> missions; pompelmous* r; civilization* myciv; ordersmap_t ordersmap; std::string obj_name; private: city_production best_unit_production(const city& c, int* points) const; city_production best_improv_production(const city& c, int* points) const; unit_configuration_map::const_iterator choose_best_unit(const pompelmous& r, const civilization& myciv, const city& c) const; }; #endif
/*======================================================== * Time_fwd.h * @author Sergey Mikhtonyuk * @date 28 May 2009 =========================================================*/ /** @defgroup Time Time * @ingroup Core */ #ifndef _TIME_FWD_H__ #define _TIME_FWD_H__ namespace Time { class ITimeSource; class IClock; enum ETimeMode; enum EInterpolatorType; class IInterpolator; class IInterpolatorVec3; } // namespace #endif // _TIME_FWD_H__
/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ /* ===FileName: === Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. ===Notice 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 AUTHOR 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 AUTHOR 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. Major Release ID: X-TrueType Server Version 1.3 [Aoi MATSUBARA Release 3] Notice=== This table data derived from Unicode, Inc. (ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT) */ #include "xttversion.h" static char const * const releaseID = _XTT_RELEASE_NAME; #include "xttcommon.h" #include "xttcap.h" #include "xttcconv.h" #include "xttcconvP.h" #define ALTCHR 0x0020 static ucs2_t tblIso8859_7ToUcs2[] = { /* 0x00A0 - 0x00FF */ 0x00A0, 0x02BD, 0x02BC, 0x00A3, ALTCHR, ALTCHR, 0x00A6, 0x00A7, 0x00A8, 0x00A9, ALTCHR, 0x00AB, 0x00AC, 0x00AD, ALTCHR, 0x2015, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, ALTCHR, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, ALTCHR, }; CODE_CONV_ISO8859_TO_UCS2(cc_iso8859_7_to_ucs2, /* function name */ tblIso8859_7ToUcs2, /* table name */ ALTCHR /* alt char code (on UCS2) */ ) /* end of file */
// // cast.h // altair // // Auther: // ned rihine <ned.rihine@gmail.com> // // Copyright (c) 2012 rihine 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 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // /** * @file cast.h * @breif C++ 風のキャストを C 風のキャストとスイッチできるエクステンション */ #if !defined(__CSTYLE_CAST) //////////////////////////////////////////////////////////////////////////////// // // C スタイルのキャストを行う関数型プリプロセッサ。 // # define __CSTYLE_CAST(_type_, _expression_) ((_type_)_expression_) # ifdef __cplusplus /* * _ALTI_NON_STANDALONE_MODULE が定義されていなかったら、デフォルトとして * _ALTI_USE_CPPSTYLE_CAST を定義します。 */ # if !defined(_ALTI_NON_STANDALONE_MODULE) # define _ALTI_USE_CPPSTYLE_CAST # else /* * 定義されており、_USE_CPPSTYLE_CAST が定義されていたら * _ALTI_USE_CPPSTYLE_CAST を定義します。 */ # if defined(_USE_CPPSTYLE_CAST) # define _ALTI_USE_CPPSTYLE_CAST # endif /* defined(_USE_CPPSTYLE_CAST) */ # endif /* !defined(_ALTI_NON_STANDALONE_MODULE) */ # endif /* def __cplusplus */ //////////////////////////////////////////////////////////////////////////////// // // C++ スタイルのキャストを行う関数型プリプロセッサ。 // # if defined(_ALTI_USE_CPPSTYLE_CAST) # define __DYNAMIC_CAST(_type_, _expression_) dynamic_cast<_type_>(_expression_) # define __STATIC_CAST(_type_, _expression_) static_cast<_type_>(_expression_) # define __REINTERPRET_CAST(_type_, _expression_) reinterpret_cast<_type_>(_expression_) # define __CONST_CAST(_type_, _expression_) const_cast<_type_>(_expression_) # else # define __DYNAMIC_CAST(_type_, _expression_) __CSTYLE_CAST(_type_, _expression_) # define __STATIC_CAST(_type_, _expression_) __CSTYLE_CAST(_type_, _expression_) # define __REINTERPRET_CAST(_type_, _expression_) __CSTYLE_CAST(_type_, _expression_) # define __CONST_CAST(_type_, _expression_) __CSTYLE_CAST(_type_, _expression_) # endif /* defined(_ALTI_USE_CPPSTYLE_CAST) */ #endif /* !defined(__CSTYLE_CAST) */
#ifndef IQMOL_SGESERVER_H #define IQMOL_SGESERVER_H /******************************************************************************* Copyright (C) 2011-2013 Andrew Gilbert This file is part of IQmol, a free molecular visualization program. See <http://iqmol.org> for more details. IQmol 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. IQmol 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 IQmol. If not, see <http://www.gnu.org/licenses/>. ********************************************************************************/ #include "ServerDelegate.h" #include "ServerQueue.h" #include "QCProcess.h" namespace IQmol { class Server; class ServerQueueDialog; namespace ServerTask { class Base; } class SGEServer : public ServerDelegate { Q_OBJECT public: SGEServer(Server* server, QVariantMap const& defaults); ~SGEServer(); Process::Status parseQueryString(QString const& query, Process*); bool configureJob(Process*); QVariantMap delegateDefaults() const { return m_defaults; } /// Sets the queue list from the output of the command given by the /// ${QUEUE_INFO} command. Returns the number of queues found. int setQueuesFromQueueInfo(QString const& info); ServerTask::Base* testConfiguration(); ServerTask::Base* submit(Process*); private: QueueList m_queues; ServerQueueDialog* m_dialog; QVariantMap m_defaults; }; } // end namespace IQmol #endif
#include <stdio.h> #include <stdlib.h> #include <string.h> char * sacar(float, char *); int main() { char A[5]; int x; float dato; scanf("%f",&dato); // capturamos una frecuencia para hacer pruebas //itypeof(sacar(dato,A)); x = sacar(dato,A); printf("%d", x); puts(sacar(dato, A)); return 0; } char * sacar(float dato, char * A){ int i, B[5]={0,0,0,0,0}; dato/=10000; //primer paso dividimos el numero for(i = 0; dato>=0; ++i){ //recorremos el arreglo hasta que frecuencia = 0 B[i]=dato; //comparamos el valor ya vididio con B[i] que trunca el flotante dato=dato-B[i];//le restamos el valor que truncamos al flotante y lo igualamos dato*=10; //lo multiplicamos por 10 para recorrerlo y truncar de nuevo en siguiente ciclo } for(i = 0; B[i] >= 0 && B[i] <= 9; ++i)//siempre y cuando este en el rango A[i]=(B[i]+'0'); // se iguala a un arreglo tipo caracter sumandole 48 o '0' //para que se convierta en caracter //puts(A);//imprimios la cadena tipo caracter, tu sabes como imprimirla en tu display... return A; }
#ifndef _DATASET_MAGNETOMETER_ #define _DATASET_MAGNETOMETER_ #include "dataset_interface.h" #include "filter.h" class CDatasetMagnetometer: public CDatasetInterface { private: std::vector<sDatasetItem> stream; std::vector<class CFilter*> filters_lp, filters_hp; public: CDatasetMagnetometer(std::string file_name, float testing_ratio = 0.2); ~CDatasetMagnetometer(); void save_events_plotting(std::string file_name); private: void car_type_dataset(float testing_ratio); struct sDatasetItem parse_line(std::string line); std::vector<float> parse_input(std::string str); std::vector<float> parse_output(std::string str); void load_stream(std::string file_name); struct sDatasetItem make_item(unsigned int offset); void add(struct sDatasetItem result, float testing_ratio); }; #endif
/** * @file hashmap.h * * @author TacOS developers * * @section LICENSE * * Copyright (C) 2010-2015 TacOS developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details at * http://www.gnu.org/copyleft/gpl.html * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses>. * * @section DESCRIPTION * * Hashmap générique. Des tests un peu plus poussés sont à faire. */ #ifndef _HASHMAP_H #define _HASHMAP_H // Types incomplets, juste pour y voir plus clair. struct hashmap_key_t; struct hashmap_value_t; /** * Pour chaque valeur de hash, on retrouve une liste chainée dont les * éléments sont du type hashmap_cell_t. */ struct hashmap_cell_t { struct hashmap_key_t *key; /**< Clef. */ struct hashmap_value_t *value; /**< Valeur. */ struct hashmap_cell_t *next; /**< Élement suivant. */ }; /** * Structure représentant une hashmap. */ typedef struct __hashmap_t { int size; /**< Taile de la table. */ struct hashmap_cell_t** table; /**< Table de liste d'éléments ayant le même hash. */ int (*equal)(struct hashmap_key_t*, struct hashmap_key_t*); /**< Fonction de comparaison de clefs. */ int (*hash)(struct hashmap_key_t*); /**< Fonction de hashage. */ } hashmap_t; /** * Crée et initialise une nouvelle hashmap. * * @param size La taille de la table, correspond à la valeur maximale - 1 que peut * retourner la fonction de hash. * @param equal Fonction qui retourne 1 si 2 clefs sont identiques. * @param hash Fonction de hash. * * @return Pointeur vers la hashmap. */ hashmap_t* hashmap_create(int size, int (*equal)(struct hashmap_key_t*, struct hashmap_key_t*), int (*hash)(struct hashmap_key_t*)); /** * Ajoute ou modifie une valeur dans la hashmap. * * @param this Pointeur vers la hashmap à utiliser. * @param key La clef. * @param value La valeur. */ void hashmap_set(hashmap_t* this, struct hashmap_key_t* key, struct hashmap_value_t* value); /** * Supprime un élément de la hashmap. Attention, seule la cellule est freed. * * @param this Pointeur vers la hashmap à utiliser. * @param key La clef de l'élément à supprimer. * * @return Pointeur vers la valeur enlevée de la hashmap, NULL si non trouvée. */ struct hashmap_value_t* hashmap_remove(hashmap_t* this, struct hashmap_key_t *key); /** * Lit un élément de la hashmap. * * @param this Pointeur vers la hashmap à utiliser. * @param key La clef de l'élément à lire. * * @return Pointeur vers la valeur, NULL si non trouvée. */ struct hashmap_value_t* hashmap_get(hashmap_t* this, struct hashmap_key_t *key); #endif
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #ifndef __GLADE_EDITOR_PROPERTY_H__ #define __GLADE_EDITOR_PROPERTY_H__ G_BEGIN_DECLS #define GLADE_TYPE_EDITOR_PROPERTY (glade_editor_property_get_type()) #define GLADE_EDITOR_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EDITOR_PROPERTY, GladeEditorProperty)) #define GLADE_EDITOR_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EDITOR_PROPERTY, GladeEditorPropertyClass)) #define GLADE_IS_EDITOR_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EDITOR_PROPERTY)) #define GLADE_IS_EDITOR_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_EDITOR_PROPERTY)) #define GLADE_EDITOR_PROPERTY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_EDITOR_PROPERTY, GladeEditorPropertyClass)) typedef struct _GladeEditorProperty GladeEditorProperty; typedef struct _GladeEditorPropertyClass GladeEditorPropertyClass; struct _GladeEditorProperty { GtkHBox parent_instance; GladePropertyClass *klass; /* The property class this GladeEditorProperty was created for */ GladeProperty *property; /* The currently loaded property */ GtkWidget *item_label; /* Name of property (need a handle to set visual insensitive state) */ GtkWidget *input; /* Input part of property (need to set sensitivity seperately) */ GtkWidget *check; /* Check button for optional properties. */ GtkWidget *info; /* Informational button */ gulong tooltip_id; /* signal connection id for tooltip changes */ gulong sensitive_id; /* signal connection id for sensitivity changes */ gulong changed_id; /* signal connection id for value changes */ gulong enabled_id; /* signal connection id for enable/disable changes */ gboolean loading; /* True during glade_editor_property_load calls, this * is used to avoid feedback from input widgets. */ gboolean use_command; /* Whether we should use the glade command interface * or skip directly to GladeProperty interface. * (used for query dialogs). */ gboolean show_info; /* Whether we should show an informational button * for this property */ }; struct _GladeEditorPropertyClass { GtkHBoxClass parent_class; void (* load) (GladeEditorProperty *, GladeProperty *); /* private */ GtkWidget *(* create_input) (GladeEditorProperty *); void (* gtk_doc_search)(GladeEditorProperty *, const gchar *, const gchar *, const gchar *); }; GType glade_editor_property_get_type (void); GladeEditorProperty *glade_editor_property_new (GladePropertyClass *klass, gboolean use_command); GladeEditorProperty *glade_editor_property_new_from_widget (GladeWidget *widget, const gchar *property, gboolean packing, gboolean use_command); void glade_editor_property_load (GladeEditorProperty *eprop, GladeProperty *property); void glade_editor_property_load_by_widget (GladeEditorProperty *eprop, GladeWidget *widget); gboolean glade_editor_property_supported (GParamSpec *pspec); void glade_editor_property_show_info (GladeEditorProperty *eprop); void glade_editor_property_hide_info (GladeEditorProperty *eprop); G_END_DECLS #endif /* __GLADE_EDITOR_PROPERTY_H__ */
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "DecFile.h" @class NSDate, NSString; __attribute__((visibility("hidden"))) @interface XMPPClient : NSObject { unsigned int _lastPresence; unsigned int _lastSentChatState; unsigned int _lastReceivedChatState; NSDate *_lastActivity; NSString *_jid; } @property(retain) NSString *jid; // @synthesize jid=_jid; @property(retain) NSDate *lastActivity; // @synthesize lastActivity=_lastActivity; @property unsigned int lastReceivedChatState; // @synthesize lastReceivedChatState=_lastReceivedChatState; @property unsigned int lastSentChatState; // @synthesize lastSentChatState=_lastSentChatState; @property unsigned int lastPresence; // @synthesize lastPresence=_lastPresence; - (id)initWithJID:(id)arg1; @end
/* * integration_check.c * * Check reflection integration * * Copyright © 2013 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * * CrystFEL 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. * * CrystFEL 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 CrystFEL. If not, see <http://www.gnu.org/licenses/>. * */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdlib.h> #include <stdio.h> #include <image.h> #include <utils.h> #include <histogram.h> #include "../libcrystfel/src/integration.c" int main(int argc, char *argv[]) { struct image image; int fs, ss; FILE *fh; unsigned long int seed; int fail = 0; const int w = 128; const int h = 128; RefList *list; Reflection *refl; UnitCell *cell; struct intcontext ic; const int ir_inn = 2; const int ir_mid = 4; const int ir_out = 6; int i; Histogram *hi; double esd_sum = 0.0; gsl_rng *rng; rng = gsl_rng_alloc(gsl_rng_mt19937); fh = fopen("/dev/urandom", "r"); fread(&seed, sizeof(seed), 1, fh); fclose(fh); gsl_rng_set(rng, seed); image.flags = NULL; image.beam = NULL; image.lambda = ph_eV_to_lambda(9000.0); image.det = calloc(1, sizeof(struct detector)); image.det->n_panels = 1; image.det->panels = calloc(1, sizeof(struct panel)); image.det->panels[0].min_fs = 0; image.det->panels[0].max_fs = w; image.det->panels[0].min_ss = 0; image.det->panels[0].max_ss = h; image.det->panels[0].w = w; image.det->panels[0].h = h; image.det->panels[0].fsx = 1.0; image.det->panels[0].fsy = 0.0; image.det->panels[0].ssx = 0.0; image.det->panels[0].ssy = 1.0; image.det->panels[0].xfs = 1.0; image.det->panels[0].yfs = 0.0; image.det->panels[0].xss = 0.0; image.det->panels[0].yss = 1.0; image.det->panels[0].cnx = -w/2; image.det->panels[0].cny = -h/2; image.det->panels[0].clen = 60.0e-3; image.det->panels[0].res = 100000; /* 10 px per mm */ image.det->panels[0].adu_per_eV = 10.0/9000.0; /* 10 adu/ph */ image.det->panels[0].max_adu = +INFINITY; /* No cutoff */ image.width = w; image.height = h; image.dp = malloc(sizeof(float *)); image.dp[0] = malloc(w*h*sizeof(float)); memset(image.dp[0], 0, w*h*sizeof(float)); image.bad = malloc(sizeof(int *)); image.bad[0] = malloc(w*h*sizeof(int)); memset(image.bad[0], 0, w*h*sizeof(int)); image.n_crystals = 0; image.crystals = NULL; hi = histogram_init(); for ( i=0; i<300; i++ ) { for ( fs=0; fs<w; fs++ ) { for ( ss=0; ss<h; ss++ ) { image.dp[0][fs+w*ss] = 10.0*poisson_noise(rng, 40); if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 2 ) continue; //image.dp[0][fs+w*ss] += 10.0*poisson_noise(10); } } list = reflist_new(); refl = add_refl(list, 0, 0, 0); set_detector_pos(refl, 0.0, 64, 64); cell = cell_new(); cell_set_lattice_type(cell, L_CUBIC); cell_set_centering(cell, 'P'); cell_set_parameters(cell, 800.0e-10, 800.0e-10, 800.0e-10, deg2rad(90.0), deg2rad(90.0), deg2rad(90.0)); cell = cell_rotate(cell, random_quaternion(rng)); ic.halfw = ir_out; ic.image = &image; ic.k = 1.0/image.lambda; ic.n_saturated = 0; ic.n_implausible = 0; ic.cell = cell; ic.ir_inn = ir_inn; ic.ir_mid = ir_mid; ic.ir_out = ir_out; ic.meth = INTEGRATION_RINGS; ic.int_diag = INTDIAG_NONE; ic.masks = NULL; if ( init_intcontext(&ic) ) { ERROR("Failed to initialise integration.\n"); return 1; } setup_ring_masks(&ic, ir_inn, ir_mid, ir_out); integrate_rings_once(refl, &image, &ic, cell, 0); cell_free(cell); histogram_add_value(hi, get_intensity(refl)); esd_sum += get_esd_intensity(refl); } printf("Mean calculated sigma(I) = %.2f\n", esd_sum / 300); histogram_show(hi); histogram_free(hi); free(image.beam); free(image.det->panels); free(image.det); free(image.dp[0]); free(image.dp); if ( fail ) return 1; return 0; }
/* Copyright 2016, Austen Satterlee This file is part of VOSIMProject. VOSIMProject 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. VOSIMProject 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 VOSIMProject. If not, see <http://www.gnu.org/licenses/>. */ /** * \file units/StateVariableFilter.h * \brief * \details * \author Austen Satterlee * \date March 11, 2016 */ #ifndef __STATEVARIABLEFILTER__ #define __STATEVARIABLEFILTER__ #include "vosimlib/Unit.h" namespace syn { class VOSIMLIB_API StateVariableFilter : public Unit { DERIVE_UNIT(StateVariableFilter) public: const int c_oversamplingFactor = 8; enum Param { pFc = 0, pRes }; enum Input { iAudioIn = 0, iFcAdd, iFcMul, iResAdd, iResMul }; enum Output { oLP = 0, oBP, oN, oHP }; explicit StateVariableFilter(const string& a_name); StateVariableFilter(const StateVariableFilter& a_rhs) : StateVariableFilter(a_rhs.name()) {} void reset() override; protected: void process_() override; void onNoteOn_() override; double m_prevBPOut, m_prevLPOut; double m_F, m_damp; const double c_minRes = 1.0; const double c_maxRes = 10.0; }; class VOSIMLIB_API TrapStateVariableFilter : public StateVariableFilter { DERIVE_UNIT(TrapStateVariableFilter) public: explicit TrapStateVariableFilter(const string& a_name); TrapStateVariableFilter(const TrapStateVariableFilter& a_rhs) : TrapStateVariableFilter(a_rhs.name()) {} void reset() override; protected: void process_() override; protected: double m_prevInput; }; /** * 1 Pole "TPT" implementation */ struct VOSIMLIB_API OnePoleLP { /** * Set forward gain by specifying cutoff frequency. */ void setFc(double a_fc); /** * Set sampling frequency */ void setFs(double a_fs); double process(double a_input); void reset(); double m_state = 0.0; double m_G = 0.0; /// feed forward gain double m_fcScale = 1.0; }; /** * 1 Pole "TPT" unit wrapper */ class VOSIMLIB_API OnePoleLPUnit : public Unit { DERIVE_UNIT(OnePoleLPUnit) public: enum Param { pFc = 0 }; enum Input { iAudioIn = 0, iFcAdd, iFcMul, iSync }; enum Output { oLP = 0, oHP = 1 }; explicit OnePoleLPUnit(const string& a_name); OnePoleLPUnit(const OnePoleLPUnit& a_rhs) : OnePoleLPUnit(a_rhs.name()) {}; double getState() const; void reset() override;; protected: void process_() override; void onFsChange_() override; private: OnePoleLP implem; double m_lastSync; }; class LadderFilterBase : public Unit { public: explicit LadderFilterBase(const string& a_name); protected: void onNoteOn_() override; public: const int c_oversamplingFactor = 8; enum Param { pFc = 0, pFb, pDrv }; enum Input { iAudioIn = 0, iFcAdd, iFcMul, iFbAdd, iDrvAdd }; }; class VOSIMLIB_API LadderFilterA : public LadderFilterBase { DERIVE_UNIT(LadderFilterA) public: explicit LadderFilterA(const string& a_name); LadderFilterA(const LadderFilterA& a_rhs) : LadderFilterA(a_rhs.name()) {}; void reset() override; protected: void process_() override; protected: const double VT = 0.312; std::array<double, 4> m_V; std::array<double, 4> m_dV; std::array<double, 4> m_tV; }; class VOSIMLIB_API LadderFilterB : public LadderFilterBase { DERIVE_UNIT(LadderFilterB) public: explicit LadderFilterB(const string& a_name); LadderFilterB(const LadderFilterB& a_rhs) : LadderFilterB(a_rhs.name()) {}; void reset() override; protected: void process_() override; void onFsChange_() override; protected: OnePoleLP m_LP[4]; }; } #endif
/************************************************************************ ** ** @file vtoolarc.h ** @author Roman Telezhynskyi <dismine(at)gmail.com> ** @date November 15, 2013 ** ** @brief ** @copyright ** This source code is part of the Valentina project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2013-2015 Valentina project ** <https://bitbucket.org/dismine/valentina> All Rights Reserved. ** ** Valentina 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. ** ** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ #ifndef VTOOLARC_H #define VTOOLARC_H #include <qcompilerdetection.h> #include <QGraphicsItem> #include <QMetaObject> #include <QObject> #include <QString> #include <QtGlobal> #include "../ifc/xml/vabstractpattern.h" #include "../vmisc/def.h" #include "vabstractspline.h" class VFormula; template <class T> class QSharedPointer; struct VToolArcInitData : VAbstractSplineInitData { VToolArcInitData() : VAbstractSplineInitData(), center(NULL_ID), radius('0'), f1('0'), f2('0') {} quint32 center; QString radius; QString f1; QString f2; }; /** * @brief The VToolArc class tool for creation arc. */ class VToolArc :public VToolAbstractArc { Q_OBJECT public: virtual void setDialog() override; static VToolArc* Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolArc* Create(VToolArcInitData &initData); static const QString ToolType; virtual int type() const override {return Type;} enum { Type = UserType + static_cast<int>(Tool::Arc)}; virtual QString getTagName() const override; VFormula GetFormulaRadius() const; void SetFormulaRadius(const VFormula &value); VFormula GetFormulaF1() const; void SetFormulaF1(const VFormula &value); VFormula GetFormulaF2() const; void SetFormulaF2(const VFormula &value); qreal GetApproximationScale() const; void SetApproximationScale(qreal value); virtual void ShowVisualization(bool show) override; protected slots: virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) override; protected: virtual void RemoveReferens() override; virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies) override; virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override; virtual void SetVisualization() override; virtual QString MakeToolTip() const override; private: Q_DISABLE_COPY(VToolArc) VToolArc(const VToolArcInitData &initData, QGraphicsItem * parent = nullptr); virtual ~VToolArc()=default; }; #endif // VTOOLARC_H
// Pekka Pirila's sports timekeeping program (Finnish: tulospalveluohjelma) // Copyright (C) 2015 Pekka Pirila // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //--------------------------------------------------------------------------- #ifndef VertAikaUnitH #define VertAikaUnitH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Menus.hpp> //--------------------------------------------------------------------------- class TVertAikaFrm : public TForm { __published: // IDE-managed Components TButton *OKBtn; TButton *PeruutaBtn; TGroupBox *GroupBox1; TLabel *Label6; TEdit *EdMaxLkm; TLabel *Label7; TLabel *Label8; TEdit *EdMaxPros; TLabel *Label9; TLabel *Label10; TCheckBox *SeurLstVal; TCheckBox *SeurGrVal; TCheckBox *TlsLuetVal; TMainMenu *MainMenu1; TMenuItem *Nytt1; TMenuItem *Luekorostustiedot1; TMenuItem *Muitaasetuksia1; TMenuItem *Kuuluttajarajoitukset1; TMenuItem *Maksimikesto1; void __fastcall OKBtnClick(TObject *Sender); void __fastcall PeruutaBtnClick(TObject *Sender); void __fastcall Luekorostustiedot1Click(TObject *Sender); void __fastcall Kuuluttajarajoitukset1Click(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall Maksimikesto1Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TVertAikaFrm(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TVertAikaFrm *VertAikaFrm; //--------------------------------------------------------------------------- #endif
/**** DIAMOND protein aligner Copyright (C) 2013-2017 Benjamin Buchfink <buchfink@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ****/ #include <vector> #include <memory> #include <math.h> #include "value.h" #include "score_matrix.h" #include "../basic/sequence.h" #include "../lib/tantan/tantan.hh" #include "../data/sequence_set.h" using std::vector; using std::auto_ptr; struct Masking { Masking(const Score_matrix &score_matrix); void operator()(Letter *seq, size_t len) const; void mask_bit(Letter *seq, size_t len) const; void bit_to_hard_mask(Letter *seq, size_t len, size_t &n) const; void remove_bit_mask(Letter *seq, size_t len) const; static const Masking& get() { return *instance; } static auto_ptr<Masking> instance; static const uint8_t bit_mask; private: enum { size = 64 }; double likelihoodRatioMatrix_[size][size], *probMatrixPointers_[size], firstGapProb_, otherGapProb_; char mask_table_x_[size], mask_table_bit_[size]; }; void mask_seqs(Sequence_set &seqs, const Masking &masking, bool hard_mask = true);
#define _GNU_SOURCE #include <arpa/inet.h> #include <errno.h> #include <netinet/in.h> #include <poll.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/epoll.h> #include <sys/fcntl.h> #include <sys/ioctl.h> #include <sys/sendfile.h> #include <sys/select.h> #include <sys/socket.h> #include <sys/uio.h> #include <sys/unistd.h> #include <sys/wait.h> #include <unistd.h> int main(void) { int sock; if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { fprintf(stderr, "socket() failed: %s\n.", strerror(errno)); return(EXIT_FAILURE); } struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(8000); inet_aton("127.0.0.1", &addr.sin_addr); if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { fprintf(stderr, "connect() failed: %s\n.", strerror(errno)); return(EXIT_FAILURE); } char *iovec_buf0 = "short string\n"; char *iovec_buf1 = "This is a longer string\n"; char *iovec_buf2 = "This is the longest string in this example\n"; struct iovec iovec[3]; iovec[0].iov_base = iovec_buf0; iovec[0].iov_len = strlen(iovec_buf0); iovec[1].iov_base = iovec_buf1; iovec[1].iov_len = strlen(iovec_buf1); iovec[2].iov_base = iovec_buf2; iovec[2].iov_len = strlen(iovec_buf2); if (writev(sock, iovec, -1) != -1) return(EXIT_FAILURE); return(EXIT_SUCCESS); }
/* ******************************************************************************* \file g12s_test.c \brief Tests for GOST R 34.10-2012 (Russia) \project bee2/test \author (C) Sergey Agievich [agievich@{bsu.by|gmail.com}] \created 2014.04.07 \version 2016.07.15 \license This program is released under the GNU General Public License version 3. See Copyright Notices in bee2/info.h. ******************************************************************************* */ #include <bee2/core/mem.h> #include <bee2/core/hex.h> #include <bee2/core/prng.h> #include <bee2/core/util.h> #include <bee2/crypto/g12s.h> /* ******************************************************************************* Самотестирование -# Выполняются тесты из приложения A к ГОСТ Р 34.10-2012. -# Дополнительно проверяются стандартные кривые. ******************************************************************************* */ bool_t g12sTest() { g12s_params params[1]; octet buf[G12S_ORDER_SIZE]; octet privkey[G12S_ORDER_SIZE]; octet pubkey[2 * G12S_FIELD_SIZE]; octet hash[64]; octet sig[2 * G12S_ORDER_SIZE]; octet echo[64]; // тест A.1 [загрузка параметров] if (g12sStdParams(params, "1.2.643.2.2.35.0") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // тест A.1 [генерация ключей] hexToRev(buf, "7A929ADE789BB9BE10ED359DD39A72C1" "1B60961F49397EEE1D19CE9891EC3B28"); ASSERT(sizeof(echo) >= prngEcho_keep()); prngEchoStart(echo, buf, 32); if (g12sGenKeypair(privkey, pubkey, params, prngEchoStepR, echo) != ERR_OK || !hexEqRev(privkey, "7A929ADE789BB9BE10ED359DD39A72C1" "1B60961F49397EEE1D19CE9891EC3B28") || !hexEqRev(pubkey, "26F1B489D6701DD185C8413A977B3CBB" "AF64D1C593D26627DFFB101A87FF77DA" "7F2B49E270DB6D90D8595BEC458B50C5" "8585BA1D4E9B788F6689DBD8E56FD80B")) return FALSE; // тест A.1 [выработка ЭЦП] hexTo(hash, "2DFBC1B372D89A1188C09C52E0EEC61F" "CE52032AB1022E8E67ECE6672B043EE5"); hexToRev(buf, "77105C9B20BCD3122823C8CF6FCC7B95" "6DE33814E95B7FE64FED924594DCEAB3"); if (g12sSign(sig, params, hash, privkey, prngEchoStepR, echo) != ERR_OK || !hexEq(sig, "41AA28D2F1AB148280CD9ED56FEDA419" "74053554A42767B83AD043FD39DC0493" "01456C64BA4642A1653C235A98A60249" "BCD6D3F746B631DF928014F6C5BF9C40")) return FALSE; // тест A.1 [проверка ЭЦП] if (g12sVerify(params, hash, sig, pubkey) != ERR_OK || (sig[0] ^= 1, g12sVerify(params, hash, sig, pubkey) == ERR_OK)) return FALSE; // тест A.2 [загрузка параметров] if (g12sStdParams(params, "1.2.643.7.1.2.1.2.0") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // тест A.2 [генерация ключей] hexToRev(buf, "0BA6048AADAE241BA40936D47756D7C9" "3091A0E8514669700EE7508E508B1020" "72E8123B2200A0563322DAD2827E2714" "A2636B7BFD18AADFC62967821FA18DD4"); ASSERT(sizeof(echo) >= prngEcho_keep()); prngEchoStart(echo, buf, 64); if (g12sGenKeypair(privkey, pubkey, params, prngEchoStepR, echo) != ERR_OK || !hexEqRev(privkey, "0BA6048AADAE241BA40936D47756D7C9" "3091A0E8514669700EE7508E508B1020" "72E8123B2200A0563322DAD2827E2714" "A2636B7BFD18AADFC62967821FA18DD4") || !hexEqRev(pubkey, "37C7C90CD40B0F5621DC3AC1B751CFA0" "E2634FA0503B3D52639F5D7FB72AFD61" "EA199441D943FFE7F0C70A2759A3CDB8" "4C114E1F9339FDF27F35ECA93677BEEC" "115DC5BC96760C7B48598D8AB9E740D4" "C4A85A65BE33C1815B5C320C854621DD" "5A515856D13314AF69BC5B924C8B4DDF" "F75C45415C1D9DD9DD33612CD530EFE1")) return FALSE; // тест A.2 [выработка ЭЦП] hexTo(hash, "3754F3CFACC9E0615C4F4A7C4D8DAB53" "1B09B6F9C170C533A71D147035B0C591" "7184EE536593F4414339976C647C5D5A" "407ADEDB1D560C4FC6777D2972075B8C"); hexToRev(buf, "0359E7F4B1410FEACC570456C6801496" "946312120B39D019D455986E364F3658" "86748ED7A44B3E794434006011842286" "212273A6D14CF70EA3AF71BB1AE679F1"); if (g12sSign(sig, params, hash, privkey, prngEchoStepR, echo) != ERR_OK || !hexEq(sig, "2F86FA60A081091A23DD795E1E3C689E" "E512A3C82EE0DCC2643C78EEA8FCACD3" "5492558486B20F1C9EC197C906998502" "60C93BCBCD9C5C3317E19344E173AE36" "1081B394696FFE8E6585E7A9362D26B6" "325F56778AADBC081C0BFBE933D52FF5" "823CE288E8C4F362526080DF7F70CE40" "6A6EEB1F56919CB92A9853BDE73E5B4A")) return FALSE; // тест A.2 [проверка ЭЦП] if (g12sVerify(params, hash, sig, pubkey) != ERR_OK || (sig[0] ^= 1, g12sVerify(params, hash, sig, pubkey) == ERR_OK)) return FALSE; // проверить кривую cryptoproA if (g12sStdParams(params, "1.2.643.2.2.35.1") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // проверить кривую cryptoproB if (g12sStdParams(params, "1.2.643.2.2.35.2") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // проверить кривую cryptoproC if (g12sStdParams(params, "1.2.643.2.2.35.3") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // проверить кривую cryptocom if (g12sStdParams(params, "1.2.643.2.9.1.8.1") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // проверить кривую paramsetA512 if (g12sStdParams(params, "1.2.643.7.1.2.1.2.1") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // проверить кривую paramsetB512 if (g12sStdParams(params, "1.2.643.7.1.2.1.2.2") != ERR_OK || g12sValParams(params) != ERR_OK) return FALSE; // все нормально return TRUE; }
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <assert.h> #include "matrix.h" void pmat(Matrix *m) { int r, c; for (r = 0; r < m->rows; r++) { printf("|"); for (c = 0; c < m->cols; c++) { printf("%s%.2f", c==0?"":"\t", mat_get_cell(m, c, r)); } printf("|\n"); } } double mat_get_cell(struct matrix *mat, int c, int r) { assert(r < mat->rows); assert(c < mat->cols); return mat->cells[c][r]; } void mat_set_cell(struct matrix *mat, int c, int r, double val) { assert(r < mat->rows); assert(c < mat->cols); mat->cells[c][r] = val; } // number of columns to add struct matrix * mat_construct(int c, int r) { struct matrix *ret = malloc(sizeof(struct matrix)); ret->cols = c; ret->rows = r; ret->cells = (double **)malloc(c * sizeof(double *)); int i; char success = ret->cells != NULL; if (success) { for (i = 0; i < c; i++) { ret->cells[i] = (double *)calloc(r, sizeof(double)); success = success && ret->cells[i]; } } if (!success) { printf("Ran out of memory allocating new Matrix (%dx%d)\n", c, r); abort(); } return ret; } void mat_destruct(struct matrix *mat) { int i; for (i = 0; i < mat->cols; i++) free(mat->cells[i]); free(mat->cells); free(mat); } void mat_add_column(struct matrix *mat, double *col) { int c = mat->cols; mat->cols++; mat->cells = realloc(mat->cells, mat->cols * sizeof(double *)); mat->cells[c] = malloc(mat->rows * sizeof(double)); memcpy(mat->cells[c], col, mat->rows * sizeof(double)); } void mat_get_column(struct matrix *mat, int c, double *col) { assert(mat->cols > c); memcpy(col, mat->cells[c], mat->rows * sizeof(double)); } void mat_set_column(struct matrix *mat, int c, double *col) { assert(mat->cols > c); memcpy(mat->cells[c], col, mat->rows * sizeof(double)); } struct matrix *mat_multiply(struct matrix *a, struct matrix *b) { assert(a->cols == b->rows); struct matrix *ret = mat_construct(b->cols, a->rows); int r, c, j; double val = 0; for (c = 0; c < ret->cols; c++) { for (r = 0; r < ret->rows; r++) { for (j = 0; j < ret->rows; j++) { val += mat_get_cell(a, j, r) * mat_get_cell(b, c, j); } mat_set_cell(ret, c, r, val); val = 0; } } return ret; } // res must be right size void mat_multinmat(struct matrix *a, struct matrix *b, struct matrix *res) { assert(a->cols == b->rows); mat_resize(res, b->cols, a->rows); int r, c, j; double val = 0; for (c = 0; c < res->cols; c++) { for (r = 0; r < res->rows; r++) { for (j = 0; j < res->rows; j++) { val += mat_get_cell(a, j, r) * mat_get_cell(b, c, j); } mat_set_cell(res, c, r, val); val = 0; } } } void mat_extend(struct matrix *dest, struct matrix *src) { int oldc = dest->cols; mat_resize(dest, dest->cols + src->cols, dest->rows); int c; for (c = oldc; c < dest->cols; c++) { memcpy(dest->cells[c], src->cells[c - oldc], dest->rows * sizeof(double)); } } void mat_resize(struct matrix *mat, int c, int r) { int newcols = c - mat->cols; mat->cols = c; mat->rows = r; mat->cells = realloc(mat->cells, mat->cols * sizeof(double *)); char success = mat->cells != NULL; if (success) { int i; for (i = 0; i < newcols; i++) { mat->cells[c - newcols + i] = calloc(r, sizeof(double)); success = success && mat->cells[c-newcols+i]; } } if (!success) { printf("Ran out of memory resizing Matrix (to %dx%d)\n", c, r); abort(); } }
///////////////////////////////////////////////////////////////////////// /// BeBlob /// Copyright (C) 2014 Jérôme Béchu /// /// This program is free software: you can redistribute it and/or modify /// it under the terms of the GNU General Public License as published by /// the Free Software Foundation, either version 3 of the License, or /// (at your option) any later version. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program. If not, see <http://www.gnu.org/licenses/>. ///////////////////////////////////////////////////////////////////////// #ifndef BEBLOB_ZIP_STREAM_H #define BEBLOB_ZIP_STREAM_H #include <string> #include <vector> #include <zip.h> #include <SFML/System/InputStream.hpp> namespace sf { //////////////////////////////////////////////////////////// /// \brief zip stream implementation //////////////////////////////////////////////////////////// class ZipStream : public sf::InputStream { public: //////////////////////////////////////////////////////////// /// \brief constructor /// /// \param path the zip path (with no password) //////////////////////////////////////////////////////////// ZipStream(const std::string& path); //////////////////////////////////////////////////////////// /// \brief desctructor : close the zip handle //////////////////////////////////////////////////////////// virtual ~ZipStream(); //////////////////////////////////////////////////////////// /// \brief open a particular file in the zip /// /// \param filename name of the file to use //////////////////////////////////////////////////////////// bool open(const std::string& filename); //////////////////////////////////////////////////////////// /// \brief read data from the buffer /// /// \param data container /// \param size number of bytes /// /// \return Int64 the size readed //////////////////////////////////////////////////////////// sf::Int64 read(void* data, sf::Int64 size); //////////////////////////////////////////////////////////// /// \brief move the cursor /// /// \param position new position of the cursor /// /// \return current cursor position //////////////////////////////////////////////////////////// sf::Int64 seek(sf::Int64 position); //////////////////////////////////////////////////////////// /// \brief get the cursor value /// /// \return current cursor position //////////////////////////////////////////////////////////// sf::Int64 tell(); //////////////////////////////////////////////////////////// /// \brief get the buffer size /// /// \return buffer size //////////////////////////////////////////////////////////// sf::Int64 getSize(); private: /// handle of the zip zip* handle_ = 0; /// current position in the file sf::Uint64 cursor_ = 0; /// the buffer (contains data of the file opened) std::vector<char> buffer_; }; } #endif // BEBLOB_ZIP_STREAM_H
//============================================================================= // // plf_stub.h // // Platform header for GDB stub support. // //============================================================================= //####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 or (at your option) any later version. // // eCos is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License along // with eCos; if not, write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // // As a special exception, if other files instantiate templates or use macros // or inline functions from this file, or you compile this file and link it // with other works to produce a work based on this file, this file does not // by itself cause the resulting work to be covered by the GNU General Public // License. However the source code for this file must still be made available // in accordance with section (3) of the GNU General Public License. // // This exception does not invalidate any other reasons why a work based on // this file might be covered by the GNU General Public License. // // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. // at http://sources.redhat.com/ecos/ecos-license/ // ------------------------------------------- //####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // // Author(s): sfurman // Contributors:jskov // Date: 2003-02-28 // Purpose: Platform HAL stub support for PowerPC/VIPER board. // Usage: #include <cyg/hal/plf_stub.h> // //####DESCRIPTIONEND#### // //============================================================================= #ifndef CYGONCE_HAL_PLF_STUB_H #define CYGONCE_HAL_PLF_STUB_H #include <pkgconf/hal.h> #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS #include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM #include <cyg/hal/openrisc_stub.h> //---------------------------------------------------------------------------- // Stub initializer. #endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS //----------------------------------------------------------------------------- #endif // CYGONCE_HAL_PLF_STUB_H // End of plf_stub.h
#pragma once template<typename T> void InsertionSort(T *array, int length) { T key; auto j = 0; for (auto i=1; i<length; ++i) { key = array[i]; j = i - 1; while (j >= 0 && array[j] > key) { array[j+1] = array[j]; --j; } array[j+1] = key; } } template<typename T> void Merge(T *array, int p, int q, int r) { auto n1 = q - p + 1; auto n2 = r - q; T leftArray[n1]; T rightArray[n2]; for (auto i=0; i<n1; ++i) { leftArray[i] = array[p+i]; } for (auto i=0; i<n2; ++i) { rightArray[i] = array[q+i+1]; } auto i = 0, j = 0, k = p; while (i < n1 && j < n2) { if (leftArray[i] < rightArray[j]) { array[k] = leftArray[i]; ++i; } else { array[k] = rightArray[j]; ++j; } ++k; } while (i < n1) { array[k] = leftArray[i]; ++i; ++k; } while (j < n2) { array[k] = rightArray[j]; ++j; ++k; } } // p is array lower position, r is array upper position template<typename T> void MergeSort(T *array, int p, int r) { if (p < r) { auto q = (p + r - 1) / 2; MergeSort(array, p, q); MergeSort(array, q+1, r); Merge(array, p, q, r); } }
#pragma once #include <list> #include <Windows.h> #include <d3d11_1.h> #include "Types.h" #include <d2d1_1.h> class D2DView; class D2DSubView { public: D2DSubView( D2DView* view, D2DSubView* parent ); virtual ~D2DSubView(); /** Initializes the controls of this view */ virtual XRESULT InitControls() { return XR_SUCCESS; } /** Adds a child to this subview */ void AddChild( D2DSubView* child ); /** Deletes a child from this subview */ void DeleteChild( D2DSubView* child ); /** Sets the position and size of this sub-view */ virtual void SetRect( const D2D1_RECT_F& rect ); /** Returns the rect of this control */ const D2D1_RECT_F& GetRect() const; /** Sets the position and size */ void SetPositionAndSize( const D2D1_POINT_2F& position, const D2D1_SIZE_F& size ); /** Sets the position of the control */ void SetPosition( const D2D1_POINT_2F& position ); /** Sets the size of this control */ void SetSize( const D2D1_SIZE_F& size ); /** Returns the size of this control */ D2D1_SIZE_F GetSize() const; /** Returns the position of this control */ D2D1_POINT_2F GetPosition() const; /** Aligns this control right under the specified */ void AlignUnder( D2DSubView* view, float space = 0.0f ); /** Aligns this control right next to the specified */ void AlignRightTo( D2DSubView* view, float space = 0.0f ); /** Aligns this control left to the specified */ void AlignLeftTo( D2DSubView* view, float space = 0.0f ); /** Draws this sub-view */ virtual void Draw( const D2D1_RECT_F& clientRectAbs, float deltaTime ); /** Updates the subview */ virtual void Update( float deltaTime ); /** Processes a window-message. Return false to stop the message from going to children */ virtual bool OnWindowMessage( HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam, const D2D1_RECT_F& clientRectAbs ); /** Returns the parent of this subview */ D2DSubView* GetParent() const { return Parent; } /** Point inside rect? */ static bool PointInsideRect( const D2D1_POINT_2F& p, const D2D1_RECT_F& r ); static bool PointInsideRect( const POINT& p, const D2D1_RECT_F& r ); /** Sets the level on this */ void SetLevel( int level ); /** Sets if this control is hidden */ virtual void SetHidden( bool hidden ); /** Returns if this control is hidden */ bool IsHidden() const; virtual void SetDisabled( bool disabled ); bool IsDisabled() const; protected: /** List of children */ std::list<D2DSubView*> Children; /** Destination of this subview */ D2D1_RECT_F ViewRect; /** Layer of this subview */ ID2D1Layer* Layer; /** Pointer to the main-view */ D2DView* MainView; /** Parent of this subview */ D2DSubView* Parent; /** Level of this subview in the tree */ int Level; /** If true, the object will not render or process inputs */ bool Hidden; bool Disabled; };
/** ****************************************************************************** * @file LibJPEG/LibJPEG_Decoding/Src/decode.c * @author MCD Application Team * @version V1.4.0 * @date 17-February-2017 * @brief This file contain the decompress method. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V. * All rights reserved.</center></h2> * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution 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 other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "decode.h" /* Private typedef -----------------------------------------------------------*/ /* This struct contains the JPEG decompression parameters */ struct jpeg_decompress_struct cinfo; /* This struct represents a JPEG error handler */ struct jpeg_error_mgr jerr; /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Decode * @param callback: line decoding callback * @param file1: pointer to the jpg file * @param width: image width * @param buff: pointer to the image line * @retval None */ void jpeg_decode(JFILE *file, uint32_t width, uint8_t * buff, uint8_t (*callback)(uint8_t*, uint32_t)) { /* Decode JPEG Image */ JSAMPROW buffer[2] = {0}; /* Output row buffer */ uint32_t row_stride = 0; /* physical row width in image buffer */ buffer[0] = buff; /* Step 1: allocate and initialize JPEG decompression object */ cinfo.err = jpeg_std_error(&jerr); /* Initialize the JPEG decompression object */ jpeg_create_decompress(&cinfo); jpeg_stdio_src (&cinfo, file); /* Step 3: read image parameters with jpeg_read_header() */ jpeg_read_header(&cinfo, TRUE); /* Step 4: set parameters for decompression */ cinfo.dct_method = JDCT_FLOAT; /* Step 5: start decompressor */ jpeg_start_decompress(&cinfo); row_stride = width * 3; while (cinfo.output_scanline < cinfo.output_height) { (void) jpeg_read_scanlines(&cinfo, buffer, 1); if (callback(buffer[0], row_stride) != 0) { break; } } /* Step 6: Finish decompression */ jpeg_finish_decompress(&cinfo); /* Step 7: Release JPEG decompression object */ jpeg_destroy_decompress(&cinfo); } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* * Copyright (C) 2016 Dan Rulos. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <curl/curl.h> #include "gnusocial.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stddef.h> #include "constants.h" extern int loglevel; struct Chunk { char *memory; size_t size; }; /* This in-memory cURL callback is from https://curl.haxx.se/libcurl/c/getinmemory.html */ static size_t cb_writeXmlChunk(void *contents, size_t size, size_t nmemb, void *userp) { size_t realsize = size * nmemb; struct Chunk *mem = (struct Chunk *)userp; mem->memory = realloc(mem->memory, mem->size + realsize + 1); if(mem->memory == NULL) { /* out of memory! */ printf("not enough memory (realloc returned NULL)\n"); return 0; } memcpy(&(mem->memory[mem->size]), contents, realsize); mem->size += realsize; mem->memory[mem->size] = 0; return realsize; } char *send_to_api(struct gss_account account, char *send, char *xml_doc) { CURLcode err; char url[MAX_URL]; char userpwd[129]; snprintf(userpwd, 129, "%s:%s", account.user, account.password); snprintf(url, MAX_URL, "%s://%s/api/%s", account.protocol, account.server, xml_doc); struct Chunk xml; xml.memory = (char *)malloc(1); xml.size = 0; CURL *curl = curl_easy_init(); // libcurl never reads .curlrc: curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/ssl/certs/" ); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb_writeXmlChunk); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&xml); if (send != NULL) { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, send); } if (loglevel > LOG_NONE) { char errbuf[CURL_ERROR_SIZE]; err = curl_easy_perform(curl); size_t len = strlen(errbuf); switch (err) { case CURLE_OK: break; default: fprintf(stderr, "\nlibcurl: error (%d) ", err); if(len) fprintf(stderr, "%s%s", errbuf, ((errbuf[len - 1] != '\n') ? "\n" : "")); else fprintf(stderr, "%s\n", curl_easy_strerror(err)); } } else { curl_easy_perform(curl); } curl_easy_cleanup(curl); return xml.memory; }
#ifndef SCOLL_MPI_DTYPES_H #define SCOLL_MPI_DTYPES_H #include "oshmem/op/op.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" static struct ompi_datatype_t* shmem_dtype_to_ompi_dtype(oshmem_op_t *op) { int dtype = op->dt; int dtsize = op->dt_size * 8; switch (dtype) { case OSHMEM_OP_TYPE_FLOAT: return &ompi_mpi_float.dt; case OSHMEM_OP_TYPE_DOUBLE: return &ompi_mpi_double.dt; case OSHMEM_OP_TYPE_LDOUBLE: return &ompi_mpi_long_double.dt; case OSHMEM_OP_TYPE_FCOMPLEX: return &ompi_mpi_c_float_complex.dt; case OSHMEM_OP_TYPE_DCOMPLEX: return &ompi_mpi_c_double_complex.dt; case OSHMEM_OP_TYPE_FINT4: return &ompi_mpi_integer4.dt; case OSHMEM_OP_TYPE_FINT8: return &ompi_mpi_integer8.dt; case OSHMEM_OP_TYPE_FREAL4: return &ompi_mpi_real4.dt; case OSHMEM_OP_TYPE_FREAL8: return &ompi_mpi_real8.dt; case OSHMEM_OP_TYPE_FREAL16: return &ompi_mpi_real16.dt; default: switch (dtsize) { case 64: return &ompi_mpi_int64_t.dt; case 32: return &ompi_mpi_int32_t.dt; case 16: return &ompi_mpi_int16_t.dt; case 8: return &ompi_mpi_int8_t.dt; default: return &ompi_mpi_datatype_null.dt; } } } static struct ompi_op_t* shmem_op_to_ompi_op(int op) { switch (op) { case OSHMEM_OP_AND: return &(ompi_mpi_op_band.op); case OSHMEM_OP_OR: return &(ompi_mpi_op_bor.op); case OSHMEM_OP_XOR: return &(ompi_mpi_op_bxor.op); case OSHMEM_OP_MAX: return &(ompi_mpi_op_max.op); case OSHMEM_OP_MIN: return &(ompi_mpi_op_min.op); case OSHMEM_OP_SUM: return &(ompi_mpi_op_sum.op); case OSHMEM_OP_PROD: return &(ompi_mpi_op_prod.op); default: return &(ompi_mpi_op_null.op); } } #endif /* SCOLL_MPI_DTYPES_H */
#ifndef LAYOUTIMPMAC_H #define LAYOUTIMPMAC_H #include "layoutimp.h" #include "layoutimpmac.h" class LayoutImpMac : public LayoutImp { public: LayoutImpMac(); std::string getKeyboardLanguageCode() const; }; #endif // LAYOUTIMPMAC_H
/* Copyright (C) 2018 Fredrik Öhrström This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "always.h" #include "configuration.h" #include "monitor.h" #include "system.h" #include "tarfile.h" #include <map> #include <string> #include <vector> RC rsyncListBeakFiles(Storage *storage, std::vector<TarFileName> *files, std::vector<TarFileName> *bad_files, std::vector<std::string> *other_files, std::map<Path*,FileStat> *contents, ptr<System> sys, ProgressStatistics *progress); RC rsyncFetchFiles(Storage *storage, std::vector<Path*> *files, Path *dir, System *sys, FileSystem *local_fs, ProgressStatistics *progress); RC rsyncSendFiles(Storage *storage, std::vector<Path*> *files, Path *dir, FileSystem *local_fs, ptr<System> sys, ProgressStatistics *progress); RC rsyncDeleteFiles(Storage *storage, std::vector<Path*> *files, FileSystem *local_fs, ptr<System> sys, ProgressStatistics *progress);
/* This function compares two strings in reverse */ #include "mystring.h" int str_r_cmp(char *f_src_str, char *f_rot_str) { int i; int length; int flag; flag = 0; if (((length = str_len(f_src_str)) == str_len(f_rot_str))) { for (i = 0; *(f_src_str+i) != '\n'; i++) { if (((*(f_src_str+i)) != (*(f_rot_str+length-i-1)))) { flag = 1; } } } else { flag = 1; } return flag; }
/* * Copyright (C) 2016 Patrick Steinhardt * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \defgroup cpn-list Doubly linked list * \ingroup cpn-lib * * @brief Implementation for a doubly linked list * * @{ */ #ifndef CAPONE_LIST_H #define CAPONE_LIST_H #include <inttypes.h> /** @brief A single element of the list */ struct cpn_list_entry { void *data; struct cpn_list_entry *prev; struct cpn_list_entry *next; }; /** @brief A doubly-linked list */ struct cpn_list { struct cpn_list_entry *head; struct cpn_list_entry *tail; }; /** @brief Statically initialize a list */ #define CPN_LIST_INIT { NULL, NULL } /** @brief Initialize a list * * Initializing a list will overwrite its contents and reset all * pointers to `NULL`. * * @param[in] list List to initialize * @return <code>0</code> on success, <code>-1</code> otherwise */ int cpn_list_init(struct cpn_list *list); /** @brief Append an entry to a list * * Put a new entry at the end of the list. * * @param[in] list List to append entry to * @param[in] data Data entry to put into the element * @return <code>0</code> on success, <code>-1</code> otherwise */ int cpn_list_append(struct cpn_list *list, void *data); /** @brief Remove a list entry * * Remove the list entry of it is contained inside the list. The * entry will be freed and cannot be used after successfully * removing the entry. * * Note that the data element is not freed and has to be manually * freed by its users. * * @param[in] list List to remove entry from * @param[in] entry Entry to remove. Will be freed * @return <code>0</code> on success, <code>-1</code> otherwise */ int cpn_list_remove(struct cpn_list *list, struct cpn_list_entry *entry); /** @brief Clear all list entries * * Remove all entries from the list, essentially resetting it to * its initial state. All entries are freed in the process. * * Note that data elements are not freed and are require to be * manually freed by its users. * * @param[in] list List to clear * @return <code>0</code> on success, <code>-1</code> otherwise */ int cpn_list_clear(struct cpn_list *list); /** @brief Get entry at an index * * Return the `i`th element of the list. If the list has less * than `i` elements, `NULL` is returned. * * @param[in] list List to search * @param[in] i Index of the entry to get * @return pointer to the `i`th entry or `NULL` */ struct cpn_list_entry *cpn_list_get(struct cpn_list *list, uint32_t i); /** @brief Get number of list entries */ uint32_t cpn_list_count(const struct cpn_list *list); #define cpn_list_foreach_entry(l, it) \ for ((it) = (l)->head; (it); (it) = (it)->next) #define cpn_list_foreach(l, it, ptr) \ for ((it) = (l)->head, (ptr) = (it) ? (it)->data : NULL; \ (it); \ (it) = (it)->next, (ptr) = (it) ? (it)->data : NULL) #endif /* @} */
/** * @file auth.h * Authentication provider. */ #ifndef AUTH_H #define AUTH_H #include "mhd.h" #include "sqlite.h" /** Struct for authentication. */ struct Auth { /** user name */ char user[128]; /** roles granted */ int roles; }; /** Constructor of Auth struct. */ struct Auth *construct_auth(); int auth_iterator(void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size); int auth_user(struct Auth *auth, const char *password); int init_auth(); #endif
/**************************************************************************** ** ** Copyright (C) G. Allen Morris III, All rights reserved. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ /*! \file timeedit.h * \brief The Main Window Object for tlist. * * This is the window that lists all the available projects that * that can be controled. */ #ifndef TIMEEDIT_H #define TIMEEDIT_H #include <QMainWindow> #include <QModelIndex> #include <QtGui> #include <QKeyEvent> #include <QMouseEvent> #include "ui_timeedit.h" #include "ttcp.h" class TimeEdit:public QMainWindow, private Ui::TimeEdit { Q_OBJECT public: TimeEdit(TTCP * ttcp, QWidget * parent = 0); ~TimeEdit(); protected: TTCP * ttcp; public slots: void hide(); void myShow(void); void dateChanged(const QDate & date); void setDateToday(); void refresh(void); void hourly(void); // update maxDate etc. void timesliceChangeProject(int, int, int); void timesliceChangeTime(int, const QDateTime&, const QDateTime&); void timesliceSplitTime(int); private: QSize saveSize; QPoint savePos; void mousePressEvent(QMouseEvent *) { qWarning("m_event"); }; void keyPressEvent(QKeyEvent *) { qWarning("k_event"); }; }; #endif
#include <ets_sys.h> #include <osapi.h> #include "user_interface.h" #include <os_type.h> #include "driver/pwm.h" #define PWM_0_OUT_IO_MUX PERIPHS_IO_MUX_MTDI_U #define PWM_0_OUT_IO_NUM 12 #define PWM_0_OUT_IO_FUNC FUNC_GPIO12 #define PWM_1_OUT_IO_MUX PERIPHS_IO_MUX_MTDO_U #define PWM_1_OUT_IO_NUM 15 #define PWM_1_OUT_IO_FUNC FUNC_GPIO15 #define PWM_2_OUT_IO_MUX PERIPHS_IO_MUX_MTCK_U #define PWM_2_OUT_IO_NUM 13 #define PWM_2_OUT_IO_FUNC FUNC_GPIO13 uint32 io_info[][3] = { {PWM_0_OUT_IO_MUX,PWM_0_OUT_IO_FUNC,PWM_0_OUT_IO_NUM}, {PWM_1_OUT_IO_MUX,PWM_1_OUT_IO_FUNC,PWM_1_OUT_IO_NUM}, {PWM_2_OUT_IO_MUX,PWM_2_OUT_IO_FUNC,PWM_2_OUT_IO_NUM}, }; u32 duty[3] = {600,604,634}; /****************************************************************************** * FunctionName : user_rf_cal_sector_set * Description : SDK just reversed 4 sectors, used for rf init data and paramters. * We add this function to force users to set rf cal sector, since * we don't know which sector is free in user's application. * sector map for last several sectors : ABCCC * A : rf cal * B : rf init data * C : sdk parameters * Parameters : none * Returns : rf cal sector *******************************************************************************/ uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void) { enum flash_size_map size_map = system_get_flash_size_map(); uint32 rf_cal_sec = 0; switch (size_map) { case FLASH_SIZE_4M_MAP_256_256: rf_cal_sec = 128 - 5; break; case FLASH_SIZE_8M_MAP_512_512: rf_cal_sec = 256 - 5; break; case FLASH_SIZE_16M_MAP_512_512: case FLASH_SIZE_16M_MAP_1024_1024: rf_cal_sec = 512 - 5; break; case FLASH_SIZE_32M_MAP_512_512: case FLASH_SIZE_32M_MAP_1024_1024: rf_cal_sec = 1024 - 5; break; case FLASH_SIZE_64M_MAP_1024_1024: rf_cal_sec = 2048 - 5; break; case FLASH_SIZE_128M_MAP_1024_1024: rf_cal_sec = 4096 - 5; break; default: rf_cal_sec = 0; break; } return rf_cal_sec; } void ICACHE_FLASH_ATTR user_rf_pre_init(void) { } void ICACHE_FLASH_ATTR user_init(void) { pwm_init(1000, duty, 3, io_info); pwm_start(); }
/** * This file is part of the "clip" project * Copyright (c) 2020 Paul Asmuth * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <stdlib.h> #include <string> #include <vector> #include "layer.h" #include "graphics/path.h" #include "style.h" namespace clip::draw { struct path_op { Path path; draw_style::compound style; Option<AntialiasingMode> antialiasing_mode; }; /** * Draw a path */ ReturnCode path(const path_op& op, Layer* l); } // namespace clip::draw
/** * \file IMP/rotamer/RotamerLibrary.h * \brief Object representing rotamer library. * * Copyright 2007-2017 IMP Inventors. All rights reserved. * */ #ifndef IMPROTAMER_ROTAMER_LIBRARY_H #define IMPROTAMER_ROTAMER_LIBRARY_H #include <string> #include <vector> #include <boost/range/iterator_range.hpp> #include <IMP/Object.h> #include <IMP/atom/Residue.h> #include <IMP/rotamer/rotamer_config.h> IMPROTAMER_BEGIN_NAMESPACE //! A simple class storing chi angles and their probability class IMPROTAMEREXPORT RotamerAngleTuple { public: //! default constructor. Build identity rotations with zero probability RotamerAngleTuple() : chi1_(0), chi2_(0), chi3_(0), chi4_(0), probability_(0) {} //! constructor. build rotamer data corresponding to 1 line from // the library file RotamerAngleTuple(float chi1, float chi2, float chi3, float chi4, float probability) : chi1_(chi1), chi2_(chi2), chi3_(chi3), chi4_(chi4), probability_(probability) {} //! query the chi1 angle float get_chi1() const { return chi1_; } //! query the chi2 angle float get_chi2() const { return chi2_; } //! query the chi3 angle float get_chi3() const { return chi3_; } //! query the chi4 angle float get_chi4() const { return chi4_; } //! query the probability float get_probability() const { return probability_; } IMP_SHOWABLE_INLINE(RotamerAngleTuple, { out << "RotamerAngleTuple: " << chi1_ << ' ' << chi2_ << ' ' << chi3_ << ' ' << chi4_ << ' ' << probability_; }); private: float chi1_; float chi2_; float chi3_; float chi4_; float probability_; }; IMP_VALUES(RotamerAngleTuple, RotamerAngleTuples); //! A class storing a whole rotamer library read from a file class IMPROTAMEREXPORT RotamerLibrary : public IMP::Object { public: //! constructor. Build an empty library object /** \param[in] angle_step bucket size in degrees */ RotamerLibrary(unsigned angle_step = 10); #ifndef SWIG typedef RotamerAngleTuples::const_iterator RotamerIterator; typedef boost::iterator_range<RotamerIterator> RotamerRange; //! query the rotamer library for the rotamer data /** This function returns a range of iterators to the queried contents. The range can be used in the following way: \code{.cpp} RotamerLibrary rl; // .... RotamerLibrary::RotamerRange r = rl.get_rotamers_fast(...); for ( RotamerLibrary::RotamerIterator p = r.begin(); p != r.end(); ++p ) { const RotamerAngleTuple &ra = *p; // process ra ... } \endcode \param[in] residue the residue to query about \param[in] phi first backbone angle \param[in] psi second backbone angle \param[in] probability_thr threshold on the sum of probabilities. */ RotamerRange get_rotamers_fast(IMP::atom::ResidueType residue, float phi, float psi, float probability_thr) const; #endif //! query the rotamer library for the rotamer data /** This function returns a vector with the queried contents (and is therefore slower than get_rotamers_fast). It is however more useful in Python code \param[in] residue the residue to query about \param[in] phi first backbone angle \param[in] psi second backbone angle \param[in] probability_thr threshold on the sum of probabilities. */ RotamerAngleTuples get_rotamers(IMP::atom::ResidueType residue, float phi, float psi, float probability_thr) const; //! load the library from file /** \param[in] lib_file_name file name */ void read_library_file(const std::string &lib_file_name); IMP_OBJECT_METHODS(RotamerLibrary); private: unsigned backbone_angle_to_index(float phi, float psi) const; typedef std::vector<RotamerAngleTuples> RotamerAngleTuplesByBackbone; typedef std::vector<RotamerAngleTuplesByBackbone> RotamersByResidue; RotamersByResidue library_; unsigned angle_step_; unsigned rotamers_by_backbone_size_; }; IMPROTAMER_END_NAMESPACE #endif /* IMPROTAMER_ROTAMER_LIBRARY_H */
/* usb.h - The header file for usb.h. * * Copyright (C) 2009 Rosales Victor (todoesverso@gmail.com) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef USB_H #define USB_H /** * Convert pointers to fit PIC memory type **/ #define PTR16(x) ((unsigned int)(((unsigned long)x) & 0xFFFF)) /** * Define two new types of variables **/ typedef unsigned char byte; typedef unsigned int word; /** * Separate words into 2 varialbes type byte **/ #define LSB(x) (x & 0xFF) #define MSB(x) ((x & 0xFF00) >> 8) /** * Standard Request Codes USB 2.0 Spec Ref Table 9-4 **/ #define GET_STATUS 0 #define CLEAR_FEATURE 1 #define SET_FEATURE 3 #define SET_ADDRESS 5 #define GET_DESCRIPTOR 6 #define SET_DESCRIPTOR 7 #define GET_CONFIGURATION 8 #define SET_CONFIGURATION 9 #define GET_INTERFACE 10 #define SET_INTERFACE 11 #define SYNCH_FRAME 12 /** * Descriptors Types **/ #define DEVICE_DESCRIPTOR 0x01 #define CONFIGURATION_DESCRIPTOR 0x02 #define STRING_DESCRIPTOR 0x03 #define INTERFACE_DESCRIPTOR 0x04 #define ENDPOINT_DESCRIPTOR 0x05 /** * Standard Feature Selectors **/ #define DEVICE_REMOTE_WAKEUP 0x01 #define ENDPOINT_HALT 0x00 /** * Buffer Descriptor bit masks (from PIC datasheet) **/ #define UOWN 0x80 /* USB Own Bit */ #define DTS 0x40 /* Data Toggle Synchronization Bit */ #define KEN 0x20 /* BD Keep Enable Bit */ #define INCDIS 0x10 /* Address Increment Disable Bit */ #define DTSEN 0x08 /* Data Toggle Synchronization Enable Bit */ #define BSTALL 0x04 /* Buffer Stall Enable Bit */ #define BC9 0x02 /* Byte count bit 9 */ #define BC8 0x01 /* Byte count bit 8 */ /** * Device states (USB spec Chap 9.1.1) **/ #define DETACHED 0 #define ATTACHED 1 #define POWERED 2 #define DEFAULT 3 #define ADDRESS 4 #define CONFIGURED 5 /** * BDT - Buffer Descriptor Table * @stat: * @Cnt: * @ADDR: * **/ typedef struct _BDT { byte Stat; byte Cnt; word ADDR; } BDT; /** * Global Variables **/ extern byte deviceState; /* Visible device states (from USB 2.0, chap 9.1.1) */ extern byte selfPowered; extern byte remoteWakeup; extern byte currentConfiguration; extern volatile BDT at 0x0400 ep0Bo; /* Endpoint #0 BD Out */ extern volatile BDT at 0x0404 ep0Bi; /* Endpoint #0 BD In */ extern volatile BDT at 0x0408 ep1Bo; /* Endpoint #1 BD Out */ extern volatile BDT at 0x040C ep1Bi; /* Endpoint #1 BD In */ extern volatile BDT at 0x0410 ep2Bo; /* Endpoint #2 BD Out */ extern volatile BDT at 0x0414 ep2Bi; /* Endpoint #2 BD In */ /** * setupPacketStruct - * * Every device request starts with an 8 byte setup packet (USB 2.0, chap 9.3) * with a standard layout. The meaning of wValue and wIndex will * vary depending on the request type and specific request. **/ typedef struct _setupPacketStruct { byte bmRequestType; /* D7: Direction, D6..5: Type, D4..0: Recipient */ byte bRequest; /* Specific request */ byte wValue0; /* LSB of wValue */ byte wValue1; /* MSB of wValue */ byte wIndex0; /* LSB of wIndex */ byte wIndex1; /* MSB of wIndex */ word wLength; /* Number of bytes to transfer if a data stage */ byte extra[56]; /* Fill out to same size as Endpoint 0 max buffer */ } setupPacketStruct; /** * Variable for Setup Packets **/ extern volatile setupPacketStruct SetupPacket; /** * Size of the buffer for endpoint 0 **/ #define E0SZ 64 /** * Size of data for BulkIN and BulkOut **/ #define INPUT_BYTES 7 #define OUTPUT_BYTES 7 /** * IN/OUT Buffers * RxBuffer2 is only 1 byte long. **/ extern volatile byte TxBuffer[OUTPUT_BYTES]; extern volatile byte RxBuffer[INPUT_BYTES]; extern volatile byte TxBuffer2[OUTPUT_BYTES]; extern volatile byte RxBuffer2; /** * Pointers inPtr and outPtr are used to move data between buffers from user * memory to dual port buffers of the USB module **/ extern byte *outPtr; extern byte *inPtr; extern unsigned int wCount; /* Total number of bytes to move */ // Funciones para uso del USB /** * User functions to process USB transactions **/ void EnableUSBModule(void); void ProcessUSBTransactions(void); /** * Functions to read and write bulk endpoints **/ byte BulkOut(byte ep_num, byte *buffer, byte len); byte BulkIn(byte ep_num, byte *buffer, byte len); #endif /* USB_H */
/* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or 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/. */ /* * cannotRegisterEquationAfterInitializationException.h * * Created on: 27.11.2013 * Author: chris */ #ifndef CANNOTREGISTEREQUATIONAFTERINITIALIZATIONEXCEPTION_H_ #define CANNOTREGISTEREQUATIONAFTERINITIALIZATIONEXCEPTION_H_ #include <exception> namespace systm { /// Exception for registering a new equation after the initialization of a StateSystem class CannotRegisterEquationAfterInitializationException : public std::exception { public: CannotRegisterEquationAfterInitializationException() {} virtual ~CannotRegisterEquationAfterInitializationException() throw() {} virtual const char* what() const throw() { return "Cannot register a new equation after the system is initialized"; } }; } /* namespace systm */ #endif /* CANNOTREGISTEREQUATIONAFTERINITIALIZATIONEXCEPTION_H_ */
/************************************************************************** This file is part of JahshakaVR, VR Authoring Toolkit http://www.jahshaka.com Copyright (c) 2016 GPLv3 Jahshaka LLC <coders@jahshaka.com> This is free software: you may copy, redistribute and/or modify it under the terms of the GPLv3 License For more information see the LICENSE file *************************************************************************/ #ifndef TRANSFORMEDITOR_H #define TRANSFORMEDITOR_H #include <QWidget> #include <QSharedPointer> namespace iris { class SceneNode; } namespace Ui { class TransformEditor; } class TransformEditor : public QWidget { Q_OBJECT public: explicit TransformEditor(QWidget *parent = 0); ~TransformEditor(); /** * sects active scene node * @param sceneNode */ void setSceneNode(QSharedPointer<iris::SceneNode> sceneNode); protected slots: /** * should be triggered when active scene node's properties gets * updated externally (from gizmo, scripts, etc) */ // void sceneNodeUpdated(); void xPosChanged(double value); void yPosChanged(double value); void zPosChanged(double value); void xRotChanged(double value); void yRotChanged(double value); void zRotChanged(double value); void xScaleChanged(double value); void yScaleChanged(double value); void zScaleChanged(double value); void onResetBtnClicked(); private: QSharedPointer<iris::SceneNode> sceneNode; QSharedPointer<iris::SceneNode> defaultStateNode; Ui::TransformEditor* ui; }; #endif // TRANSFORMEDITOR_H
/* * See Licensing and Copyright notice in naev.h */ #ifndef MISSION_H # define MISSION_H #include "claim.h" #include "commodity.h" #include "nlua.h" #include "nxml.h" #include "opengl.h" /* availability by location */ enum { MIS_AVAIL_NONE, /**< Mission isn't available. */ MIS_AVAIL_COMPUTER, /**< Mission is available at mission computer. */ MIS_AVAIL_BAR, /**< Mission is available at bar. */ MIS_AVAIL_OUTFIT, /**< Mission is available at outfitter. */ MIS_AVAIL_SHIPYARD, /**< Mission is available at shipyard. */ MIS_AVAIL_LAND, /**< Mission is available on landing. */ MIS_AVAIL_COMMODITY, /**< Mission is available at commodity exchange. */ MIS_AVAIL_SPACE /**< Mission is available in space. */ }; /* flag functions */ #define mis_isFlag(m,f) ((m)->flags & (f)) #define mis_setFlag(m,f) ((m)->flags |= (f)) #define mis_rmFlag(m,f) ((m)->flags &= ~(f)) /* actual flags */ #define MISSION_UNIQUE (1<<0) /**< Unique missions can't be repeated */ /** * @brief Different type of system markers. */ typedef enum SysMarker_ { SYSMARKER_COMPUTER, /**< Marker is for mission computer missions. */ SYSMARKER_LOW, /**< Marker is for low priority mission targets. */ SYSMARKER_HIGH, /**< Marker is for high priority mission targets. */ SYSMARKER_PLOT /**< Marker is for plot priority (ultra high) mission targets. */ } SysMarker; /** * @brief Defines the availability of a mission. */ typedef struct MissionAvail_s { int loc; /**< Location of the mission. */ int chance; /**< Chance of it appearing, last two digits represent %, first digit represents times it can appear (if 0 it behaves like once). */ /* for specific cases */ char *planet; /**< Planet name. */ char *system; /**< System name. */ /* for generic cases */ int* factions; /**< Array (array.h): To certain factions. */ char* cond; /**< Condition that must be met (Lua). */ char* done; /**< Previous mission that must have been done. */ int priority; /**< Mission priority: 0 = main plot, 50 = default, 100 = insignificant. */ } MissionAvail_t; /** * @struct MissionData * * @brief Static mission data. */ typedef struct MissionData_ { char *name; /**< The name of the mission. */ MissionAvail_t avail; /**< Mission availability. */ unsigned int flags; /**< Flags to store binary properties */ char* lua; /**< Lua data to use. */ char* sourcefile; /**< Source file name. */ } MissionData; /** * @brief Mission system marker. */ typedef struct MissionMarker_ { int id; /**< ID of the mission marker. */ int sys; /**< ID of marked system. */ SysMarker type; /**< Marker type. */ } MissionMarker; /** * @struct Mission * * @brief Represents an active mission. */ typedef struct Mission_ { MissionData *data; /**< Data to use. */ unsigned int id; /**< Unique mission identifier, used for keeping track of hooks. */ int accepted; /**< Mission is a player mission. */ char *title; /**< Not to be confused with name */ char *desc; /**< Description of the mission */ char *reward; /**< Rewards in text */ glTexture *portrait; /**< Portrait of the mission giver if applicable. */ char *npc; /**< Name of the NPC giving the mission. */ char *npc_desc; /**< Description of the giver NPC. */ /* mission cargo given to the player - need to cleanup */ unsigned int *cargo; /**< Array (array.h): Cargos given to player. */ /* Markers. */ MissionMarker *markers; /**< Markers array. */ /* OSD. */ unsigned int osd; /**< On-Screen Display ID. */ int osd_set; /**< OSD was set explicitly. */ /* Claims. */ Claim_t *claims; /**< System claims. */ nlua_env env; /**< The environment of the running Lua code. */ } Mission; /* * current player missions */ #define MISSION_MAX 12 /**< No sense in allowing the player have infinite missions. */ extern Mission *player_missions[MISSION_MAX]; /**< Player's active missions. */ /* * creates missions for a planet and such */ Mission* missions_genList( int *n, int faction, const char* planet, const char* sysname, int loc ); int mission_accept( Mission* mission ); /* player accepted mission for computer/bar */ void missions_run( int loc, int faction, const char* planet, const char* sysname ); int mission_start( const char *name, unsigned int *id ); /* * misc */ int mission_alreadyRunning( MissionData* misn ); int mission_getID( const char* name ); MissionData* mission_get( int id ); MissionData* mission_getFromName( const char* name ); int mission_addMarker( Mission *misn, int id, int sys, SysMarker type ); void mission_sysMark (void); void mission_sysComputerMark( Mission* misn ); /* * cargo stuff */ int mission_linkCargo( Mission* misn, unsigned int cargo_id ); int mission_unlinkCargo( Mission* misn, unsigned int cargo_id ); /* * load/quit */ int missions_load (void); int missions_loadActive( xmlNodePtr parent ); int missions_loadCommodity( xmlNodePtr parent ); Commodity* missions_loadTempCommodity( xmlNodePtr parent ); int missions_saveActive( xmlTextWriterPtr writer ); int missions_saveTempCommodity( xmlTextWriterPtr writer, const Commodity* c ); void mission_cleanup( Mission* misn ); void mission_shift( int pos ); void missions_free (void); void missions_cleanup (void); /* * Actually in nlua_misn.h */ int misn_tryRun( Mission *misn, const char *func ); void misn_runStart( Mission *misn, const char *func ); int misn_runFunc( Mission *misn, const char *func, int nargs ); int misn_run( Mission *misn, const char *func ); /* * Claims. */ void missions_activateClaims (void); #endif /* MISSION_H */
#ifndef QUERY_H #define QUERY_H struct q_pair { char *field; char *value; }; struct q_container { struct q_pair *queries; unsigned count; }; typedef struct q_container query_t; void query_parse(query_t *self, char *str); char *query_search(query_t *self, const char *searchstr); void query_free(query_t *self); #endif
#ifndef _APP_H_ #define _APP_H_ #ifndef ONLY_OFFICIAL_CALLS extern int App_CONICS(int, int); extern int App_DYNA(int, int); extern int App_EACT(int, int); extern int App_EQUA(int, int); extern int App_PROG(int, int); extern int App_FINANCE(int, int); extern int App_GRAPH_TABLE(int, int); extern int App_LINK(int, int); extern int App_MEMORY(int, int); extern int App_RECUR(int, int); extern int App_RUN_MAT(int, int); extern int App_RUN_STAT(int, int); extern int App_SYSTEM(int, int); #endif #endif
#include <openssl/hmac.h> #include <openssl/sha.h> #include <openssl/evp.h> /* great part of this function is taken from aircrack-ng suite source code. * derive the PMK from the passphrase and the essid */ unsigned char *calc_pmk( char *essid_pre, char *key ) { int i, j, slen; unsigned char buffer[65],*pmk; char essid[33+4]; SHA_CTX ctx_ipad; SHA_CTX ctx_opad; SHA_CTX sha1_ctx; if(key == NULL || essid_pre == NULL) { print(error,"called with NULL argument."); return NULL; } pmk = malloc(40*sizeof(unsigned char)); memset(essid, 0, sizeof(essid)); memcpy(essid, essid_pre, strlen(essid_pre)); slen = strlen( essid ) + 4; /* setup the inner and outer contexts */ memset( buffer, 0, sizeof( buffer ) ); strncpy( (char *) buffer, key, sizeof( buffer ) - 1 ); for( i = 0; i < 64; i++ ) buffer[i] ^= 0x36; SHA1_Init( &ctx_ipad ); SHA1_Update( &ctx_ipad, buffer, 64 ); for( i = 0; i < 64; i++ ) buffer[i] ^= 0x6A; SHA1_Init( &ctx_opad ); SHA1_Update( &ctx_opad, buffer, 64 ); /* iterate HMAC-SHA1 over itself 8192 times */ essid[slen - 1] = '\1'; HMAC(EVP_sha1(), (unsigned char *)key, strlen(key), (unsigned char*)essid, slen, pmk, NULL); memcpy( buffer, pmk, 20 ); for( i = 1; i < 4096; i++ ) { memcpy( &sha1_ctx, &ctx_ipad, sizeof( sha1_ctx ) ); SHA1_Update( &sha1_ctx, buffer, 20 ); SHA1_Final( buffer, &sha1_ctx ); memcpy( &sha1_ctx, &ctx_opad, sizeof( sha1_ctx ) ); SHA1_Update( &sha1_ctx, buffer, 20 ); SHA1_Final( buffer, &sha1_ctx ); for( j = 0; j < 20; j++ ) pmk[j] ^= buffer[j]; } essid[slen - 1] = '\2'; HMAC(EVP_sha1(), (unsigned char *)key, strlen(key), (unsigned char*)essid, slen, pmk+20, NULL); memcpy( buffer, pmk + 20, 20 ); for( i = 1; i < 4096; i++ ) { memcpy( &sha1_ctx, &ctx_ipad, sizeof( sha1_ctx ) ); SHA1_Update( &sha1_ctx, buffer, 20 ); SHA1_Final( buffer, &sha1_ctx ); memcpy( &sha1_ctx, &ctx_opad, sizeof( sha1_ctx ) ); SHA1_Update( &sha1_ctx, buffer, 20 ); SHA1_Final( buffer, &sha1_ctx ); for( j = 0; j < 20; j++ ) pmk[j + 20] ^= buffer[j]; } return pmk; }
/* MicroBuild Copyright (C) 2016 TwinDrills This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "Schemas/Project/ProjectFile.h" #include "App/Builder/Toolchains/Toolchain.h" #include "App/Builder/Tasks/BuildTask.h" namespace MicroBuild { // Compiles an individual translation unit. class CompileTask : public BuildTask { private: Toolchain* m_toolchain; BuilderFileInfo m_file; BuilderFileInfo m_pchFile; public: CompileTask(Toolchain* toolchain, ProjectFile& project, BuilderFileInfo& file, BuilderFileInfo pchFile); virtual BuildAction GetAction() override; }; }; // namespace MicroBuild
/* Simple Chat * Copyright (c) 2008-2014 Alexander Sedov <imp@schat.me> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef HTTPDOWNLOADITEM_H_ #define HTTPDOWNLOADITEM_H_ #include "GenericDownloadItem.h" class HttpDownloadItem : public GenericDownloadItem { public: HttpDownloadItem(const QUrl &url, const QString &fileName); }; #endif // HTTPDOWNLOADITEM_H_
/* gb-editor-view-private.h * * Copyright (C) 2015 Christian Hergert <christian@hergert.me> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GB_EDITOR_VIEW_PRIVATE_H #define GB_EDITOR_VIEW_PRIVATE_H #include <ide.h> #include <libpeas/peas.h> #include "gb-editor-document.h" #include "gb-editor-frame.h" #include "gb-editor-tweak-widget.h" #include "gb-simple-popover.h" #include "gb-view.h" G_BEGIN_DECLS struct _GbEditorView { GbView parent_instance; GbEditorDocument *document; PeasExtensionSet *extensions; GSettings *settings; gchar *title; GtkLabel *cursor_label; GbEditorFrame *frame1; GbEditorFrame *frame2; GtkButton *modified_cancel_button; GtkRevealer *modified_revealer; GtkPaned *paned; GtkProgressBar *progress_bar; GtkMenuButton *tweak_button; GbEditorTweakWidget *tweak_widget; GtkMenuButton *goto_line_button; GbSimplePopover *goto_line_popover; }; G_END_DECLS #endif /* GB_EDITOR_VIEW_PRIVATE_H */
#include "general.h" #include "string.h" #include "read.h" #include "entry.h" extern parserDefinition** LanguageTable; extern void initCtags() { initializeParsing(); installLanguageMapDefaults(); } extern void deInitCtags() { freeParserResources(); } extern TagEntryListItem* createTagEntryListItem( const char* fileName, const char* langName ) { const parserDefinition* language; langType lang; unsigned int passCount; boolean retried; firstTagEntry = NULL; // generate new list if ( ( langName != NULL ) && ( strlen( langName ) != 0 ) ) { lang = getNamedLanguage( langName ); } else { lang = getFileLanguage( fileName ); } if ( lang <= 0 ) { //printf( "Will not parse %s\n",fileName ); return NULL; } language = LanguageTable[ lang ]; if ( language == NULL ) { return NULL; } if ( !fileOpen( fileName, lang ) ) { return NULL; } passCount = 0; retried = FALSE; if ( language->parser != NULL ) { language->parser(); } else if ( language->parser2 != NULL ) { do { retried = language->parser2( ++passCount ); } while ( retried ); } return firstTagEntry; } extern void freeTagEntryListItem( TagEntryListItem* item ) { while ( item != NULL ) { TagEntryListItem* temp = 0; tagEntryInfo* entry = &item->tag; if ( entry->language ) free( (char*)entry->language ); if ( entry->sourceFileName ) free( (char*)entry->sourceFileName ); if ( entry->name) free( (char*)entry->name ); if ( entry->kindName ) free( (char*)entry->kindName ); if ( entry->extensionFields.access ) free( (char*)entry->extensionFields.access ); if ( entry->extensionFields.fileScope ) free( (char*)entry->extensionFields.fileScope ); if ( entry->extensionFields.implementation ) free( (char*)entry->extensionFields.implementation ); if ( entry->extensionFields.inheritance ) free( (char*)entry->extensionFields.inheritance ); if ( entry->extensionFields.scope[0] ) free( (char*)entry->extensionFields.scope[0] ); if ( entry->extensionFields.scope[1] ) free( (char*)entry->extensionFields.scope[1] ); if ( entry->extensionFields.typeRef[0] ) free( (char*)entry->extensionFields.typeRef[0] ); if ( entry->extensionFields.typeRef[1] ) free( (char*)entry->extensionFields.typeRef[1] ); if ( entry->extensionFields.signature ) free( (char*)entry->extensionFields.signature ); temp = item->next; free( item ); item = temp; } } extern void setLanguageTypeKinds( const langType language, const char* kinds ) { parserDefinition* parser = LanguageTable[ language ]; if ( parser != NULL ) { unsigned int i; for ( i = 0; i < parser->kindCount; ++i ) { parser->kinds[ i ].enabled = strchr( kinds, parser->kinds[ i ].letter ) != NULL; } } } extern void setLanguageKinds( const char *const language, const char* kinds ) { setLanguageTypeKinds( getNamedLanguage( language ), kinds ); } extern const char* getFileNameLanguageName( const char* fileName ) { return getLanguageName( getFileLanguage( fileName ) ); }
#ifndef COMPLEXDOUBLE_H #define COMPLEXDOUBLE_H #endif
#pragma once #define _CRT_SECURE_NO_WARNINGS #include <Windows.h> #include <string> struct strview { const wchar_t* buf; size_t len; strview(const wchar_t* str); strview(const wchar_t* str, size_t len); }; template <size_t N> struct strbuilder { wchar_t buf[N]; size_t len = 0; void append(const wchar_t* str, size_t n) { if (len + n >= sizeof buf / sizeof buf[0]) { return; } wcsncpy(buf + len, str, n); len += n; } template <class T, size_t n> void operator +=(T(&str)[n]) { append(str, n - 1); } template <size_t n> void operator +=(const strbuilder<n>& str) { append(str.buf, str.len); } void operator +=(const strview& str) { append(str.buf, str.len); } void push_string(const strview& str) { if (str.len > 0 && str.buf[str.len - 1] == '\\' && (str.len == 1 || str.buf[str.len - 2] != '\\')) { *this += L"\""; *this += str; *this += L"\\\""; } else { *this += L"\""; *this += str; *this += L"\""; } } strview get_strview() { return strview(buf, len); } wchar_t* string() { buf[len] = L'\0'; return buf; } }; struct path : public strbuilder<MAX_PATH> { path(); template <class T, size_t n> path& operator /(T(&str)[n]) { *this += L"\\"; *this += str; return *this; } }; struct pipe { ~pipe(); bool open(int type); void close(); size_t read(char* buf, size_t len); size_t write(const char* buf, size_t len); HANDLE f = NULL; HANDLE h = NULL; }; bool execute_lua(const wchar_t* who, pipe* out, pipe* err); bool execute_crashreport(const wchar_t* who, pipe* in, pipe* err, bool silent); bool execute_crashreport(const wchar_t* who, const std::string& errmessage, bool silent);
/* * This project is licensed under the MIT license. For more information see the * LICENSE file. */ #pragma once // ----------------------------------------------------------------------------- #include <functional> #include <regex> #include <string> #include "maddy/blockparser.h" // ----------------------------------------------------------------------------- namespace maddy { // ----------------------------------------------------------------------------- /** * OrderedListParser * * @class */ class OrderedListParser : public BlockParser { public: /** * ctor * * @method * @param {std::function<void(std::string&)>} parseLineCallback * @param {std::function<std::shared_ptr<BlockParser>(const std::string& line)>} getBlockParserForLineCallback */ OrderedListParser( std::function<void(std::string&)> parseLineCallback, std::function<std::shared_ptr<BlockParser>(const std::string& line)> getBlockParserForLineCallback ) : BlockParser(parseLineCallback, getBlockParserForLineCallback) , isStarted(false) , isFinished(false) {} /** * IsStartingLine * * An ordered list starts with `1. `. * * @method * @param {const std::string&} line * @return {bool} */ static bool IsStartingLine(const std::string& line) { static std::regex re("^1\\. .*"); return std::regex_match(line, re); } /** * IsFinished * * @method * @return {bool} */ bool IsFinished() const override { return this->isFinished; } protected: bool isInlineBlockAllowed() const override { return true; } bool isLineParserAllowed() const override { return true; } void parseBlock(std::string& line) override { bool isStartOfNewListItem = this->isStartOfNewListItem(line); uint32_t indentation = getIndentationWidth(line); static std::regex orderedlineRegex("^1\\. "); line = std::regex_replace(line, orderedlineRegex, ""); static std::regex unorderedlineRegex("^(\\* )"); line = std::regex_replace(line, unorderedlineRegex, ""); if (!this->isStarted) { line = "<ol><li>" + line; this->isStarted = true; return; } if (indentation >= 2) { line = line.substr(2); return; } if ( line.empty() || line.find("</li><li>") != std::string::npos || line.find("</li></ol>") != std::string::npos || line.find("</li></ul>") != std::string::npos ) { line = "</li></ol>" + line; this->isFinished = true; return; } if (isStartOfNewListItem) { line = "</li><li>" + line; } } private: bool isStarted; bool isFinished; bool isStartOfNewListItem(const std::string& line) const { static std::regex re("^(?:1\\. |\\* ).*"); return std::regex_match(line, re); } }; // class OrderedListParser // ----------------------------------------------------------------------------- } // namespace maddy
#ifndef _KERNEL_INC_CU_ #define _KERNEL_INC_CU_ #include <vector_types.h> #include <complex_type.h> /********************************** Kernels ***********************************/ extern "C" void copy_kernel(complex *dst, complex *src, int size); extern "C" void multiply_kernel(complex *a, complex *b, int size); extern "C" void multiply_complex_kernel(complex *a, complex c, int size); extern "C" void multiply_double_kernel(complex *a, double d, int size); extern "C" void divide_kernel(complex *a, complex *b, int size); extern "C" void divide_complex_kernel(complex *a, complex c, int size); extern "C" void add_kernel(complex *a, complex *b, int size); extern "C" void add_complex_kernel(complex *a, complex c, int size); extern "C" void sub_kernel(complex *a, complex *b, int size); extern "C" complex scalar_product_kernel(complex *a, complex *b, complex *tmp, int size, complex *reduced_block, int reduced_block_size, complex *reduced_value); #endif
/****************************************************************************** * Copyright (C) 2013 Marc Villacorta Morera * * Authors: Marc Villacorta Morera <marc.villacorta@gmail.com> * * This file is part of SlideTail. * * SlideTail 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. * * SlideTail 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 SlideTail. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ //----------------------------------------------------------------------------- // Includes: //----------------------------------------------------------------------------- #include "st_main.h" //----------------------------------------------------------------------------- // Globals: //----------------------------------------------------------------------------- CBUF cbuf; char dir[128]; //----------------------------------------------------------------------------- // W_Tail: //----------------------------------------------------------------------------- void *W_Tail(void *arg) { // Variables: int fd, ifd, wd, len; char path[256], buf[EVENT_BUF_LEN]; int id = (int)(intptr_t)arg; struct stat finfo; // Full path to watched file: if(strcpy(path, dir) != (char *) &path) MyDBG(end0); if(strcat(path, cbuf.elems[id].name) != (char *) &path) MyDBG(end0); // Open file for reading only and get status: if((fd = open(path, O_RDONLY)) < 0) MyDBG(end0); if(fstat(fd, &finfo) < 0) MyDBG(end1); if(!IS_TAILABLE(finfo.st_mode)) MyDBG(end1); // Setup the notify watch: if((ifd = inotify_init()) < 0) MyDBG(end1); if((wd = inotify_add_watch(ifd, path, WATCH_MASK)) < 0) MyDBG(end2); // Follow the file:: while(1) { // Blocking read: if((len = read(ifd, buf, EVENT_BUF_LEN)) < 0) MyDBG(end3); printf("Slot[%d]: Activity\n", id); } // Return on error: end3: inotify_rm_watch(ifd, wd); end2: close(ifd); end1: close(fd); end0: pthread_exit(NULL); } //----------------------------------------------------------------------------- // Entry point: //----------------------------------------------------------------------------- int main(int argc, char *argv[]) { // Variables: int i,j,k,fd,wd,len; char buf[EVENT_BUF_LEN]; struct inotify_event *event; ELEM elem; // Arguments: j = atoi(argv[1]); strcpy(dir, argv[2]); // Setup the notify watch: if((fd = inotify_init()) < 0) MyDBG(end0); if((wd = inotify_add_watch(fd, dir, IN_CREATE)) < 0) MyDBG(end1); // Initialize the circular buffer: st_cbuf_new(&cbuf, j); // Main loop: while(1) { // Blocking read: i=0; if((len = read(fd, buf, EVENT_BUF_LEN)) < 0) MyDBG(end2); // Incoming: while(i<len) { // Get one event: event = (struct inotify_event *) &buf[i]; i += EVENT_SIZE + event->len; if(event->mask & IN_ISDIR) continue; // New file: create a thread and add it to the queue: k = (cbuf.start + cbuf.count) % cbuf.size; if(pthread_create(&elem.thread, NULL, W_Tail, (void *)(intptr_t) k) != 0) MyDBG(end2); strcpy(elem.name, event->name); st_cbuf_write(&cbuf, k, &elem); } // Print the current window of files: printf("\n"); for(k=0; k<j; k++) { printf("Slot [%d]: %s\n", k, cbuf.elems[k].name); } printf("\n"); } // Return on error: end2: inotify_rm_watch(fd, wd); end1: close(fd); end0: return -1; }
/* * main.c * * * Created by Earl Lawrence on 9/17/09. * * This program was prepared by Los Alamos National Security, LLC at Los Alamos National Laboratory (LANL) * under contract No. DE-AC52-06NA25396 with the U.S. Department of Energy (DOE). All rights in the program * are reserved by the DOE and Los Alamos National Security, LLC. Permission is granted to the public to * copy and use this software without charge, provided that this Notice and any statement of authorship are * reproduced on all copies. Neither the U.S. Government nor LANS makes any warranty, express or implied, * or assumes any liability or responsibility for the use of this software. * */ #include "stdio.h" #include "math.h" #include "stdlib.h" #include "string.h" main(int argc, char **argv) { int i,j,type=2, writeout=0; double xstar[7], ystar[2*582], stuff[4], xstarcmb[6]; FILE *fp; char fname_nl[256]; int cmbh=1; // My code int model = 0; FIRST_OPTION: printf("Enter model (1 = wmap7, 2=wmap9, 3=planck)\n"); scanf("%i",&model); printf("You chose model %i\n", model); switch(model) { case 1: xstar[0]=0.02258; xstar[1]=0.1334; xstar[2]=0.963; xstar[3]=70.8; xstar[4]=-1; xstar[5]=0.801; xstar[6]=0; break; case 2: xstar[0]=0.02256; xstar[1]=0.1364; xstar[2]=0.9710; xstar[3]=69.7; xstar[4]=-1; xstar[5]=0.820; xstar[6]=0; break; case 3: xstar[0]=0.02227; xstar[1]=0.1413; xstar[2]=0.9681; xstar[3]=67.9; xstar[4]=-1; xstar[5]=0.8154; xstar[6]=0; break; default: printf("Choose a model between 1 and 3\n\n\n"); goto FIRST_OPTION; } printf("Enter filename for output : "); scanf("%s",fname_nl); printf("Output will be written to: %s.\n", fname_nl); printf("Will you be using h as derived from CMB constraints (0 for no, 1 for yes)?\n"); scanf("%d", &cmbh); /* printf("Enter omega_b (= Omega_b*h^2): "); scanf("%lf",&xstar[0]); printf("%g\n",xstar[0]); printf("Enter omega_m (= Omega_m*h^2): "); scanf("%lf",&xstar[1]); printf("%g\n",xstar[1]); printf("Enter n_s: "); scanf("%lf",&xstar[2]); printf("%g\n",xstar[2]); if(cmbh == 0) { printf("Enter H0: "); scanf("%lf",&xstar[3]); printf("%g\n",xstar[3]); } printf("Enter w: "); scanf("%lf",&xstar[4]); printf("%g\n",xstar[4]); printf("Enter sigma_8: "); scanf("%lf",&xstar[5]); printf("%g\n",xstar[5]); printf("Enter z: "); scanf("%lf",&xstar[6]); printf("%g\n",xstar[6]); */ printf("Enter output type (0: Delta^2/k^1.5; 1: Delta^2; 2: P(k)): "); scanf("%i",&type); printf("%i\n", type); if(cmbh == 1) { xstarcmb[0] = xstar[0]; xstarcmb[1] = xstar[1]; xstarcmb[2] = xstar[2]; xstarcmb[3] = xstar[4]; xstarcmb[4] = xstar[5]; xstarcmb[5] = xstar[6]; emu_noh(xstarcmb, ystar, &type); getH0fromCMB(xstarcmb, stuff); xstar[3] = 100.*stuff[3]; } else { emu(xstar, ystar, &type); } // Write the nonlinear file if ((fp = fopen(fname_nl,"w"))==NULL) { printf("cannot open %s \n",fname_nl); exit(1); } fprintf(fp, "# Parameters:\n"); fprintf(fp, "# omega_b = %f, omega_m = %f, n_s = %f, h = %f, w = %f, sigma_8 = %f\n", xstar[0], xstar[1], xstar[2], xstar[3], xstar[4], xstar[5]); fprintf(fp, "# z = %f\n", xstar[6]); fprintf(fp, "#\n"); fprintf(fp, "# k[1/Mpc] "); switch(type) { default: fprintf(fp, "# Delta^2 / k^1.5:\n"); break; case 1: fprintf(fp, "# Delta^2:\n"); break; case 2: fprintf(fp, "# P(k):\n"); break; } for(j=0; j<582; j++) { fprintf(fp ,"%e %e \n", ystar[j], ystar[582+j]); } fclose(fp); }
/* Copyright (C) 2006, 2007 Sony Computer Entertainment Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sony Computer Entertainment Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _VECTORMATH_AOS_CPP_H #define _VECTORMATH_AOS_CPP_H #include "VML_fwd.h" // Forward declarations #if defined(__SPU__) # include "spu/vectormath_aos.h" // SPU stands for Synergistic Processing Unit (PS3 processor) #elif defined(__SSE__) # include "SSE/AllignedAllocator.h" // aligned allocation for SSE objects # include "SSE/vectormath_aos.h" // Regular processor with SSE support #else # include "scalar/vectormath_aos.h" // Worst case - no optimizations #endif #include "scalar/pnt2_aos.h" // Point2 not optimized (x64 doesn't support __m64) #include "scalar/vec2_aos.h" // Point2 not optimized (x64 doesn't support __m64) #endif
/* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2008 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "orte_config.h" #include "orte/constants.h" #include <string.h> #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_NETDB_H #include <netdb.h> #endif #include <errno.h> #include "opal/util/basename.h" #include "opal/util/path.h" #include "opal/util/opal_environ.h" #include "orte/runtime/orte_globals.h" #include "orte/util/context_fns.h" int orte_util_check_context_cwd(orte_app_context_t *context, bool want_chdir) { bool good = true; const char *tmp; /* If we want to chdir and the chdir fails (for any reason -- such as if the dir doesn't exist, it isn't a dir, we don't have permissions, etc.), then set good to false. */ if (want_chdir && 0 != chdir(context->cwd)) { good = false; } /* If either of the above failed, go into this block */ if (!good) { /* See if the directory was a user-specified directory. If it was, barf because they specifically asked for something we can't provide. */ if (orte_get_attribute(&context->attributes, ORTE_APP_USER_CWD, NULL, OPAL_BOOL)) { return ORTE_ERR_WDIR_NOT_FOUND; } /* If the user didn't specifically ask for it, then it was a system-supplied default directory, so it's ok to not go there. Try to go to the $HOME directory instead. */ tmp = opal_home_directory(); if (NULL != tmp) { /* Try $HOME. Same test as above. */ good = true; if (want_chdir && 0 != chdir(tmp)) { good = false; } if (!good) { return ORTE_ERR_WDIR_NOT_FOUND; } /* Reset the pwd in this local copy of the context */ if (NULL != context->cwd) free(context->cwd); context->cwd = strdup(tmp); } /* If we couldn't find $HOME, then just take whatever the default directory is -- assumedly there *is* one, or we wouldn't be running... */ } /* All happy */ return ORTE_SUCCESS; } int orte_util_check_context_app(orte_app_context_t *context, char **env) { char *tmp; /* If the app is a naked filename, we need to do a path search for it. orterun will send in whatever the user specified (e.g., "orterun -np 2 uptime"), so in some cases, we need to search the path to verify that we can find it. Here's the possibilities: 1. The user specified an absolute pathname for the executable. We simply need to verify that it exists and we can run it. 2. The user specified a relative pathname for the executable. Ditto with #1 -- based on the cwd, we need to verify that it exists and we can run it. 3. The user specified a naked filename. We need to search the path, find a match, and verify that we can run it. Note that in some cases, we won't be doing this work here -- bproc, for example, does not use the fork pls for launching, so it does this same work over there. */ tmp = opal_basename(context->argv[0]); if (strlen(tmp) == strlen(context->argv[0])) { /* If this is a naked executable -- no relative or absolute pathname -- then search the PATH for it */ free(tmp); tmp = opal_path_findv(context->argv[0], X_OK, env, context->cwd); if (NULL == tmp) { return ORTE_ERR_EXE_NOT_FOUND; } if (NULL != context->app) free(context->app); context->app = tmp; } else { free(tmp); if (0 != access(context->app, X_OK)) { return ORTE_ERR_EXE_NOT_ACCESSIBLE; } } /* All was good */ return ORTE_SUCCESS; }
/************************************************************************ * Copyright (C) 2013 by Max Reitz * * * * This file is part of µxoµcota. * * * * µxoµcota 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. * * * * µxoµcota 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 µxoµcota. If not, see <http://www.gnu.org/licenses/>. * ************************************************************************/ #include <boot.h> #include <isr.h> #include <platform.h> #include <pmm.h> #include <prime-procs.h> #include <process.h> #include <stdbool.h> #include <string.h> #include <system-timer.h> #include <vmem.h> void main(void *boot_info) { init_virtual_memory(); init_platform(); // Sollte auch Informationen zur Memory Map abrufen und die primordialen // Prozessimages laden (bspw. Multibootmodule) if (!get_boot_info(boot_info)) return; init_pmm(); init_interrupts(); init_system_timer(); char *cmdline = strdup(get_kernel_command_line()); char *prime = NULL; for (char *tok = strtok(cmdline, " "); tok != NULL; tok = strtok(NULL, " ")) if (!strncmp(tok, "prime=", 6)) prime = tok + 6; int prime_proc_load_count = (prime == NULL) ? 0 : strtok_count(prime, ","); char *prime_proc_names[prime_proc_load_count]; if (prime != NULL) strtok_array(prime_proc_names, prime, ","); int prime_procs = prime_process_count(); for (int i = 0; i < prime_procs; i++) { void *img_start; size_t img_size; char name_arr[256]; fetch_prime_process(i, &img_start, &img_size, name_arr, sizeof(name_arr)); int argc = strtok_count(name_arr, " "); const char *argv[argc]; strtok_array((char **)argv, name_arr, " "); if (prime == NULL) create_process_from_image(argc, argv, img_start); else { bool found = false; for (int j = 0; j < prime_proc_load_count; j++) if (!strcmp(argv[0], prime_proc_names[j])) found = true; if (found) create_process_from_image(argc, argv, img_start); } release_prime_process(i, img_start, img_size); } enter_idle_process(); }
#include "cli/val/byte.h" extern inline struct cli_val_byte *cli_val_byte_create(void); extern inline struct cli_val_byte *cli_val_byte_create_clone(struct cli_val_byte *v); extern inline void cli_val_byte_destroy(struct cli_val_byte *v); extern inline void *cli_val_byte_data(struct cli_val_byte *v); extern inline int cli_val_byte_parse_binary(struct cli_val_byte *v, const void *b, size_t length); extern inline int cli_val_byte_add(struct cli_val_byte *v, struct cli_val_byte *other_v); extern inline int cli_val_byte_sub(struct cli_val_byte *v, struct cli_val_byte *other_v); extern inline int cli_val_byte_cmp(struct cli_val_byte *v, struct cli_val_byte *other_v); extern inline struct cli_val_byte *cli_val_byte_create_clone(struct cli_val_byte *other_v); int cli_val_byte_print(struct cli_val_byte *v, FILE *f) { return fprintf(f, "%02X", v->byte); } int cli_val_byte_scan(struct cli_val_byte *v, FILE *f) { return fscanf(f, "%hhx", &v->byte) == 1 ? 1 : 0; } int cli_val_byte_parse_text(struct cli_val_byte *v, const char *s) { return sscanf(s, "%hhx", &v->byte) == 1 ? 1 : 0; }
/* * Copyright (C) 2004, 2006, 2007, 2009, 2011, 2013-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Id: ntservice.c,v 1.16 2011/01/13 08:50:29 tbox Exp $ */ #include <config.h> #include <stdio.h> #include <isc/app.h> #include <isc/commandline.h> #include <isc/log.h> #include <isc/print.h> #include <named/globals.h> #include <named/ntservice.h> #include <named/main.h> #include <named/server.h> /* Handle to SCM for updating service status */ static SERVICE_STATUS_HANDLE hServiceStatus = 0; static BOOL foreground = FALSE; static char ConsoleTitle[128]; /* * Forward declarations */ void ServiceControl(DWORD dwCtrlCode); int bindmain(int, char *[]); /* From main.c */ /* * Initialize the Service by registering it. */ void ntservice_init(void) { if (!foreground) { /* Register handler with the SCM */ hServiceStatus = RegisterServiceCtrlHandler(BIND_SERVICE_NAME, (LPHANDLER_FUNCTION)ServiceControl); if (!hServiceStatus) { ns_main_earlyfatal( "could not register service control handler"); UpdateSCM(SERVICE_STOPPED); exit(1); } UpdateSCM(SERVICE_RUNNING); } else { strcpy(ConsoleTitle, "BIND Version "); strcat(ConsoleTitle, VERSION); SetConsoleTitle(ConsoleTitle); } } void ntservice_shutdown(void) { UpdateSCM(SERVICE_STOPPED); } /* * Routine to check if this is a service or a foreground program */ BOOL ntservice_isservice(void) { return(!foreground); } /* * ServiceControl(): Handles requests from the SCM and passes them on * to named. */ void ServiceControl(DWORD dwCtrlCode) { /* Handle the requested control code */ switch(dwCtrlCode) { case SERVICE_CONTROL_INTERROGATE: UpdateSCM(0); break; case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: ns_server_flushonshutdown(ns_g_server, ISC_TRUE); isc_app_shutdown(); UpdateSCM(SERVICE_STOPPED); break; default: break; } } /* * Tell the Service Control Manager the state of the service. */ void UpdateSCM(DWORD state) { SERVICE_STATUS ss; static DWORD dwState = SERVICE_STOPPED; if (hServiceStatus) { if (state) dwState = state; memset(&ss, 0, sizeof(SERVICE_STATUS)); ss.dwServiceType |= SERVICE_WIN32_OWN_PROCESS; ss.dwCurrentState = dwState; ss.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ss.dwCheckPoint = 0; ss.dwServiceSpecificExitCode = 0; ss.dwWin32ExitCode = NO_ERROR; ss.dwWaitHint = dwState == SERVICE_STOP_PENDING ? 10000 : 1000; if (!SetServiceStatus(hServiceStatus, &ss)) { ss.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(hServiceStatus, &ss); } } } /* unhook main */ #undef main /* * This is the entry point for the executable * We can now call bindmain() explicitly or via StartServiceCtrlDispatcher() * as we need to. */ int main(int argc, char *argv[]) { int rc, ch; /* Command line users should put -f in the options. */ isc_commandline_errprint = ISC_FALSE; while ((ch = isc_commandline_parse(argc, argv, NS_MAIN_ARGS)) != -1) { switch (ch) { case 'f': case 'g': case 'v': case 'V': foreground = TRUE; break; default: break; } } isc_commandline_reset = ISC_TRUE; if (foreground) { /* run in console window */ exit(bindmain(argc, argv)); } else { /* Start up as service */ char *SERVICE_NAME = BIND_SERVICE_NAME; SERVICE_TABLE_ENTRY dispatchTable[] = { { TEXT(SERVICE_NAME), (LPSERVICE_MAIN_FUNCTION)bindmain }, { NULL, NULL } }; rc = StartServiceCtrlDispatcher(dispatchTable); if (!rc) { fprintf(stderr, "Use -f to run from the command line.\n"); /* will be 1063 when launched as a console app */ exit(GetLastError()); } } exit(0); }
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef BT_DEFAULT_COLLISION_CONFIGURATION #define BT_DEFAULT_COLLISION_CONFIGURATION #include "btCollisionConfiguration.h" class btVoronoiSimplexSolver; class btConvexPenetrationDepthSolver; struct btDefaultCollisionConstructionInfo { btStackAlloc* m_stackAlloc; btPoolAllocator* m_persistentManifoldPool; btPoolAllocator* m_collisionAlgorithmPool; int m_defaultMaxPersistentManifoldPoolSize; int m_defaultMaxCollisionAlgorithmPoolSize; int m_customCollisionAlgorithmMaxElementSize; int m_defaultStackAllocatorSize; int m_useEpaPenetrationAlgorithm; btDefaultCollisionConstructionInfo() :m_stackAlloc(0), m_persistentManifoldPool(0), m_collisionAlgorithmPool(0), m_defaultMaxPersistentManifoldPoolSize(4096), m_defaultMaxCollisionAlgorithmPoolSize(4096), m_customCollisionAlgorithmMaxElementSize(0), m_defaultStackAllocatorSize(0), m_useEpaPenetrationAlgorithm(true) { } }; ///btCollisionConfiguration allows to configure Bullet collision detection ///stack allocator, pool memory allocators ///@todo: describe the meaning class btDefaultCollisionConfiguration : public btCollisionConfiguration { protected: int m_persistentManifoldPoolSize; btStackAlloc* m_stackAlloc; bool m_ownsStackAllocator; btPoolAllocator* m_persistentManifoldPool; bool m_ownsPersistentManifoldPool; btPoolAllocator* m_collisionAlgorithmPool; bool m_ownsCollisionAlgorithmPool; //default simplex/penetration depth solvers btVoronoiSimplexSolver* m_simplexSolver; btConvexPenetrationDepthSolver* m_pdSolver; //default CreationFunctions, filling the m_doubleDispatch table btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc; btCollisionAlgorithmCreateFunc* m_convexConcaveCreateFunc; btCollisionAlgorithmCreateFunc* m_swappedConvexConcaveCreateFunc; btCollisionAlgorithmCreateFunc* m_compoundCreateFunc; btCollisionAlgorithmCreateFunc* m_swappedCompoundCreateFunc; btCollisionAlgorithmCreateFunc* m_emptyCreateFunc; btCollisionAlgorithmCreateFunc* m_sphereSphereCF; #ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM btCollisionAlgorithmCreateFunc* m_sphereBoxCF; btCollisionAlgorithmCreateFunc* m_boxSphereCF; #endif //USE_BUGGY_SPHERE_BOX_ALGORITHM btCollisionAlgorithmCreateFunc* m_boxBoxCF; btCollisionAlgorithmCreateFunc* m_sphereTriangleCF; btCollisionAlgorithmCreateFunc* m_triangleSphereCF; btCollisionAlgorithmCreateFunc* m_planeConvexCF; btCollisionAlgorithmCreateFunc* m_convexPlaneCF; public: btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo& constructionInfo = btDefaultCollisionConstructionInfo()); virtual ~btDefaultCollisionConfiguration(); ///memory pools virtual btPoolAllocator* getPersistentManifoldPool() { return m_persistentManifoldPool; } virtual btPoolAllocator* getCollisionAlgorithmPool() { return m_collisionAlgorithmPool; } virtual btStackAlloc* getStackAllocator() { return m_stackAlloc; } virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1); ///Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm. ///By default, this feature is disabled for best performance. ///@param numPerturbationIterations controls the number of collision queries. Set it to zero to disable the feature. ///@param minimumPointsPerturbationThreshold is the minimum number of points in the contact cache, above which the feature is disabled ///3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first. ///See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points. ///@todo we could add a per-object setting of those parameters, for level-of-detail collision detection. void setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3); }; #endif //BT_DEFAULT_COLLISION_CONFIGURATION
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <pthread.h> int n; void funcThread(void *argp) { printf("bloqueando...\n"); sleep(20); printf("\ndesbloqueado\n"); } void calcThread(void *argp) { int i; sleep(1); for (i = 0; i < 10000000; i++) { printf("%d\r", i); } } int main(void) { pthread_t t1, t2; int rc; n = 7; rc = pthread_create(&t1, NULL, (void *)funcThread, (void *) "Baiacu"); rc = pthread_create(&t2, NULL, (void *)calcThread, (void *) "Bagre"); rc = pthread_join(t1, NULL); rc = pthread_join(t2, NULL); return 0; }
#ifndef PROGRESSDIALOG_H #define PROGRESSDIALOG_H #include <QDialog> #include <Shared.h> namespace Ui { class ProgressDialog; } class ProgressDialog : public QDialog { Q_OBJECT public: explicit ProgressDialog(Shared::Type type, uint32_t max_value, uint32_t init_value = 0, QWidget *parent = nullptr); ~ProgressDialog() override; private: Ui::ProgressDialog *ui; //char *buffer; Shared::Type type; public slots: void next(); void setLabel(const QString &text); }; #endif // PROGRESSDIALOG_H
/************************************************************************************************************************ ** ** Copyright 2015-2021 Daniel Nikpayuk, Inuit Nunangat, The Inuit Nation ** ** This file is part of nik. ** ** nik 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. ** ** nik 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 nik. If not, see ** <http://www.gnu.org/licenses/>. ** ************************************************************************************************************************/ #include nik_size_type(define) using snk_signed_long_long_judgment_as = nik_module(straticum, natural, kernel, signed_long_long_judgment, assemblic, semiotic); #include nik_size_type(undef)
#ifndef FX_SUDOKU_FX_H #define FX_SUDOKU_FX_H #include "fx_sudoku_base.h" class FXCell; class FXSudokuFX : public FXSudokuBase { public: FXSudokuFX(bool main = false); ~FXSudokuFX(); bool Decode() override; private: bool CalcMaybeNumber(); bool TryCellMaybeNumber(); BYTE CheckCellMaybeNumber(); BYTE GetTriedCellIndexCount(); bool CheckCellMaybeNumberOnlyOne(); bool CheckCellMaybeNumberOnlyOne(const std::vector<FXCell*> & pCells); FXCell * GetBestMaybeNumberCell(BYTE * idxX, BYTE * idxY); bool RemoveCellMaybeNumbers(const BYTE & idxX, const BYTE & idxY, const BYTE & number); bool GetCellOutNumber(const BYTE & idxX, const BYTE & idxY, std::unordered_set<BYTE> & outNumSet); void AddTriedCellIndex(const BYTE & idxX, const BYTE & idxY); bool IsCellTried(const BYTE & idxX, const BYTE & idxY); bool Sync(FXSudokuFX * pSudoku); FXSudokuFX * Clone(); void Destroy(); private: std::unordered_set<short> m_triedCellIndexes; bool m_main; }; #endif // !FX_SUDOKU_FX_H
/* * Copyright 2012-2015 Falltergeist Developers. * * This file is part of Falltergeist. * * Falltergeist 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. * * Falltergeist 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 Falltergeist. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FALLTERGEIST_GAMEWALLOBJECT_H #define FALLTERGEIST_GAMEWALLOBJECT_H // C++ standard includes // Falltergeist includes #include "Object.h" // Third party includes namespace Falltergeist { namespace Game { /** * Walls */ class GameWallObject : public GameObject { protected: public: GameWallObject(); virtual ~GameWallObject(); }; } } #endif // FALLTERGEIST_GAMEWALLOBJECT_H
/* simple.h * * Copyright (C) 2008, 2009 libvtemm Development Team * * This file is part of Terminal Example. * * Terminal Example 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. * * Terminal Example 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 Terminal Example. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBVTEMM_EXAMPLE_SIMPLE_H_ #define _LIBVTEMM_EXAMPLE_SIMPLE_H_ #include <gtkmm.h> #include <libvtemm/terminal.h> class Simple : public Gtk::Window { public: Simple(); virtual ~Simple(); protected: //Signal handlers: virtual void on_child_exited(); private: //Member widgets: Gtk::HBox m_box; Gnome::Vte::Terminal m_terminal; Gtk::VScrollbar m_scrollbar; }; #endif // _LIBVTEMM_EXAMPLE_SIMPLE_H_
#pragma once #include <string> #include <variant> namespace rwe { struct MouseButtonEvent { enum class MouseButton { Left, Middle, Right }; int x; int y; MouseButton button; MouseButtonEvent(int x, int y, MouseButton button); }; struct KeyEvent { int keyCode; explicit KeyEvent(int keyCode); }; struct MouseMoveEvent { int x; int y; explicit MouseMoveEvent(int x, int y); }; struct MouseWheelEvent { int x; int y; MouseWheelEvent(int x, int y); }; struct ScrollPositionMessage { float scrollViewportPercent; float scrollPosition; }; struct ScrollUpMessage { }; struct ScrollDownMessage { }; struct ActivateMessage { enum class Type { Primary, Secondary }; Type type{Type::Primary}; }; using ControlMessage = std::variant<ScrollPositionMessage, ScrollUpMessage, ScrollDownMessage, ActivateMessage>; struct GroupMessage { std::string topic; unsigned int group; std::string controlName; ControlMessage message; GroupMessage(const std::string& topic, unsigned int group, const std::string& controlName, const ControlMessage& message); GroupMessage(const std::string& topic, unsigned int group, const std::string& controlName, const ScrollPositionMessage& message); GroupMessage(const std::string& topic, unsigned int group, const std::string& controlName, const ScrollUpMessage& message); GroupMessage(const std::string& topic, unsigned int group, const std::string& controlName, const ScrollDownMessage& message); }; struct ButtonClickEvent { enum class Source { LeftMouseButton, MiddleMouseButton, RightMouseButton, Keyboard, Other }; Source source; }; ActivateMessage::Type sourceToType(const ButtonClickEvent::Source& s); }