text
stringlengths
4
6.14k
/* gnome-rr-labeler.h - Utility to label monitors to identify them * while they are being configured. * * Copyright 2008, Novell, Inc. * * This file is part of the Gnome Library. * * The Gnome 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. * * The Gnome 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 the Gnome 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. * * Author: Federico Mena-Quintero <federico@novell.com> */ #ifndef CC_RR_LABELER_H #define CC_RR_LABELER_H #define GNOME_DESKTOP_USE_UNSTABLE_API #include <libgnome-desktop/gnome-rr-config.h> #define GNOME_TYPE_RR_LABELER (cc_rr_labeler_get_type ()) #define CC_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_LABELER, CcRRLabeler)) #define CC_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_RR_LABELER, CcRRLabelerClass)) #define GNOME_IS_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RR_LABELER)) #define GNOME_IS_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_RR_LABELER)) #define CC_RR_LABELER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_RR_LABELER, CcRRLabelerClass)) typedef struct _CcRRLabeler CcRRLabeler; typedef struct _CcRRLabelerClass CcRRLabelerClass; typedef struct _CcRRLabelerPrivate CcRRLabelerPrivate; struct _CcRRLabeler { GObject parent; /*< private >*/ CcRRLabelerPrivate *priv; }; struct _CcRRLabelerClass { GObjectClass parent_class; }; GType cc_rr_labeler_get_type (void); CcRRLabeler *cc_rr_labeler_new (GnomeRRConfig *config); void cc_rr_labeler_show (CcRRLabeler *labeler); void cc_rr_labeler_hide (CcRRLabeler *labeler); #endif
/* mkvmerge -- utility for splicing together matroska files from component media subtypes Distributed under the GPL v2 see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html definition for the split point class Written by Moritz Bunkus <moritz@bunkus.org>. */ #pragma once #include "common/common_pch.h" class split_point_c { public: enum type_e { duration, size, timestamp, chapter, parts, parts_frame_field, frame_field, }; int64_t m_point; type_e m_type; bool m_use_once, m_discard, m_create_new_file; public: split_point_c(int64_t point, type_e type, bool use_once, bool discard = false, bool create_new_file = true) : m_point{point} , m_type{type} , m_use_once{use_once} , m_discard{discard} , m_create_new_file{create_new_file} { } bool operator <(split_point_c const &rhs) const { return m_point < rhs.m_point; } std::string str() const; };
/* * arch/arm/mach-pxa/time.c * * Author: Nicolas Pitre * Created: Jun 15, 2001 * Copyright: MontaVista Software Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/signal.h> #include <linux/errno.h> #include <linux/sched.h> #include <asm/system.h> #include <asm/hardware.h> #include <asm/io.h> #include <asm/leds.h> #include <asm/irq.h> #include <asm/mach/irq.h> #include <asm/mach/time.h> #include <asm/arch/pxa-regs.h> static inline unsigned long pxa_get_rtc_time(void) { return RCNR; } static int pxa_set_rtc(void) { unsigned long current_time = xtime.tv_sec; if (RTSR & RTSR_ALE) { /* make sure not to forward the clock over an alarm */ unsigned long alarm = RTAR; if (current_time >= alarm && alarm >= RCNR) return -ERESTARTSYS; } RCNR = current_time; return 0; } /* IRQs are disabled before entering here from do_gettimeofday() */ static unsigned long pxa_gettimeoffset (void) { long ticks_to_match, elapsed, usec; /* Get ticks before next timer match */ ticks_to_match = OSMR0 - OSCR; /* We need elapsed ticks since last match */ elapsed = LATCH - ticks_to_match; /* don't get fooled by the workaround in pxa_timer_interrupt() */ if (elapsed <= 0) return 0; /* Now convert them to usec */ usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH; return usec; } static irqreturn_t pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { int next_match; write_seqlock(&xtime_lock); /* Loop until we get ahead of the free running timer. * This ensures an exact clock tick count and time accuracy. * IRQs are disabled inside the loop to ensure coherence between * lost_ticks (updated in do_timer()) and the match reg value, so we * can use do_gettimeofday() from interrupt handlers. * * HACK ALERT: it seems that the PXA timer regs aren't updated right * away in all cases when a write occurs. We therefore compare with * 8 instead of 0 in the while() condition below to avoid missing a * match if OSCR has already reached the next OSMR value. * Experience has shown that up to 6 ticks are needed to work around * this problem, but let's use 8 to be conservative. Note that this * affect things only when the timer IRQ has been delayed by nearly * exactly one tick period which should be a pretty rare event. */ do { timer_tick(regs); OSSR = OSSR_M0; /* Clear match on timer 0 */ next_match = (OSMR0 += LATCH); } while( (signed long)(next_match - OSCR) <= 8 ); write_sequnlock(&xtime_lock); return IRQ_HANDLED; } static struct irqaction pxa_timer_irq = { .name = "PXA Timer Tick", .flags = SA_INTERRUPT | SA_TIMER, .handler = pxa_timer_interrupt, }; static void __init pxa_timer_init(void) { struct timespec tv; set_rtc = pxa_set_rtc; tv.tv_nsec = 0; tv.tv_sec = pxa_get_rtc_time(); do_settimeofday(&tv); OSMR0 = 0; /* set initial match at 0 */ OSSR = 0xf; /* clear status on all timers */ setup_irq(IRQ_OST0, &pxa_timer_irq); OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */ OSCR = 0; /* initialize free-running timer, force first match */ } #ifdef CONFIG_PM static unsigned long osmr[4], oier; static void pxa_timer_suspend(void) { osmr[0] = OSMR0; osmr[1] = OSMR1; osmr[2] = OSMR2; osmr[3] = OSMR3; oier = OIER; } static void pxa_timer_resume(void) { OSMR0 = osmr[0]; OSMR1 = osmr[1]; OSMR2 = osmr[2]; OSMR3 = osmr[3]; OIER = oier; /* * OSMR0 is the system timer: make sure OSCR is sufficiently behind */ OSCR = OSMR0 - LATCH; } #else #define pxa_timer_suspend NULL #define pxa_timer_resume NULL #endif struct sys_timer pxa_timer = { .init = pxa_timer_init, .suspend = pxa_timer_suspend, .resume = pxa_timer_resume, .offset = pxa_gettimeoffset, };
/*============================================================================= Copyright (C) 2009-2011 WebOS Internals <support@webos-internals.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. =============================================================================*/ #ifndef LUNA_SERVICE_H_ #define LUNA_SERVICE_H_ #include <stdbool.h> #include <lunaservice.h> LSPalmService *serviceHandle; LSHandle *pub_serviceHandle; LSHandle *priv_serviceHandle; bool luna_service_initialize(const char *); void luna_service_start(void); void luna_service_cleanup(void); #endif /* LUNA_SERVICE_H_ */
/* * foo-tools, a collection of utilities for glftpd users. * Copyright (C) 2003 Tanesha FTPD Project, www.tanesha.net * * This file is part of foo-tools. * * foo-tools 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. * * foo-tools 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 foo-tools; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "linereaderbuffer.h" #include <stdlib.h> int lrb_initialize(linereaderbuffer_t *lrb) { lrb->data = 0; lrb->offset = lrb->len = 0; } int lrb_add_data(linereaderbuffer_t *lrb, char *data, int len) { char *tmp; if (lrb->data == 0) { lrb->len = len; lrb->data = malloc(len); memcpy(lrb->data, data, len); return 0; } tmp = malloc(lrb->len + len); memcpy(tmp, lrb->data, lrb->len); memcpy(tmp + lrb->len, data, len); free(lrb->data); lrb->data = tmp; lrb->len += len; return 0; } int lrb_add_eof(linereaderbuffer_t *lrb) { lrb_add_data(lrb, "", 1); return 0; } int lrb_getline(linereaderbuffer_t *lrb, char *buf, int len) { char *tmp, *nbuf; int outlen; tmp = lrb->data; if (!tmp) return LRB_NO_DATA; if (*tmp == 0) return LRB_EOF; while (tmp < (lrb->data + lrb->len)) { if (*tmp == '\n' || *tmp == '\r' || *tmp == 0) break; tmp++; } if ((*tmp != '\n') && (*tmp != '\r') && (*tmp != 0)) return LRB_NO_DATA; outlen = (tmp - lrb->data > len) ? len : tmp - lrb->data; strncpy(buf, lrb->data, outlen); buf[outlen] = 0; // move past the crlf. if (*tmp == '\r' && *(tmp + 1) == '\n') tmp += 2; else if (*tmp != 0) tmp++; outlen = lrb->len - (tmp - lrb->data); if (outlen == 0) { free(lrb->data); lrb->data = 0; lrb->len = 0; } else { nbuf = malloc(outlen); memcpy(nbuf, tmp, outlen); free(lrb->data); lrb->data = nbuf; lrb->len = outlen; } return strlen(buf); } int lrb_finalize(linereaderbuffer_t *lrb) { if (lrb->data) free(lrb->data); lrb->len = 0; lrb->data = 0; } /** * Test of the main functionality. int main(int argc, char *argv[]) { linereaderbuffer_t lrb; char buf[300]; int rc; lrb_initialize(&lrb); lrb_add_data(&lrb, "hello\n", strlen("hello\n")); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); lrb_add_data(&lrb, "sup today?\n maye nothing?\n", strlen("sup today?\n maye nothing?\n")); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); rc = lrb_getline(&lrb, buf, 300); printf("rc = %d, buf = %s\n", rc, buf); lrb_add_data(&lrb, "sup today?\n maye nothing?\n", strlen("sup today?\n maye nothing?\n")); lrb_add_data(&lrb, "sup today?\n maye nothing?\n", strlen("sup today?\n maye nothing?\n")); lrb_add_data(&lrb, "sup today?\n maye nothing?\r\n", strlen("sup today?\n maye nothing?\r\n")); lrb_add_eof(&lrb); while (1) { rc = lrb_getline(&lrb, buf, 300); printf("rc = %d\n", rc); if (rc == LRB_EOF) break; printf("Line: %s\n", buf); } } */
#ifndef __HAL8192E_DEF_H__ #define __HAL8192E_DEF_H__ /*++ Copyright (c) Realtek Semiconductor Corp. All rights reserved. Module Name: Hal8192EDef.h Abstract: Defined HAL 8192E data structure & Define Major Change History: When Who What ---------- --------------- ------------------------------- 2012-04-16 Filen Create. --*/ extern u1Byte *data_AGC_TAB_8192E_start, *data_AGC_TAB_8192E_end; extern u1Byte *data_MAC_REG_8192E_start, *data_MAC_REG_8192E_end; extern u1Byte *data_PHY_REG_8192E_start, *data_PHY_REG_8192E_end; //extern u1Byte *data_PHY_REG_1T_8192E_start, *data_PHY_REG_1T_8192E_end; extern u1Byte *data_PHY_REG_MP_8192E_start, *data_PHY_REG_MP_8192E_end; #ifdef TXPWR_LMT extern u1Byte *data_PHY_REG_PG_8192E_new_start, *data_PHY_REG_PG_8192E_new_end; #endif extern u1Byte *data_PHY_REG_PG_8192E_start, *data_PHY_REG_PG_8192E_end; extern u1Byte *data_RadioA_8192E_start, *data_RadioA_8192E_end; extern u1Byte *data_RadioB_8192E_start, *data_RadioB_8192E_end; //High Power #if CFG_HAL_HIGH_POWER_EXT_PA extern u1Byte *data_AGC_TAB_8192E_hp_start, *data_AGC_TAB_8192E_hp_end; extern u1Byte *data_PHY_REG_8192E_hp_start, *data_PHY_REG_8192E_hp_end; extern u1Byte *data_RadioA_8192E_hp_start, *data_RadioA_8192E_hp_end; extern u1Byte *data_RadioB_8192E_hp_start, *data_RadioB_8192E_hp_end; #endif // B-cut support extern u1Byte *data_MAC_REG_8192Eb_start, *data_MAC_REG_8192Eb_end; extern u1Byte *data_PHY_REG_8192Eb_start, *data_PHY_REG_8192Eb_end; extern u1Byte *data_RadioA_8192Eb_start, *data_RadioA_8192Eb_end; extern u1Byte *data_RadioB_8192Eb_start, *data_RadioB_8192Eb_end; // // MP chip extern u1Byte *data_AGC_TAB_8192Emp_start, *data_AGC_TAB_8192Emp_end; extern u1Byte *data_PHY_REG_MP_8192Emp_start, *data_PHY_REG_MP_8192Emp_end; extern u1Byte *data_PHY_REG_PG_8192Emp_start, *data_PHY_REG_PG_8192Emp_end; extern u1Byte *data_MAC_REG_8192Emp_start, *data_MAC_REG_8192Emp_end; extern u1Byte *data_PHY_REG_8192Emp_start, *data_PHY_REG_8192Emp_end; extern u1Byte *data_RadioA_8192Emp_start, *data_RadioA_8192Emp_end; extern u1Byte *data_RadioB_8192Emp_start, *data_RadioB_8192Emp_end; // FW extern u1Byte *data_rtl8192Efw_start, *data_rtl8192Efw_end; extern u1Byte *data_rtl8192EfwMP_start, *data_rtl8192EfwMP_end; // Power Tracking extern u1Byte *data_TxPowerTrack_AP_start, *data_TxPowerTrack_AP_end; #endif //__HAL8192E_DEF_H__
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.String struct String_t; // UnityEngine.Texture2D struct Texture2D_t32; #include "mscorlib_System_Object.h" // UnityEngine.SocialPlatforms.Impl.AchievementDescription struct AchievementDescription_t235 : public Object_t { // System.String UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_Title String_t* ___m_Title_0; // UnityEngine.Texture2D UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_Image Texture2D_t32 * ___m_Image_1; // System.String UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_AchievedDescription String_t* ___m_AchievedDescription_2; // System.String UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_UnachievedDescription String_t* ___m_UnachievedDescription_3; // System.Boolean UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_Hidden bool ___m_Hidden_4; // System.Int32 UnityEngine.SocialPlatforms.Impl.AchievementDescription::m_Points int32_t ___m_Points_5; // System.String UnityEngine.SocialPlatforms.Impl.AchievementDescription::<id>k__BackingField String_t* ___U3CidU3Ek__BackingField_6; };
//********************************************************************* //* C_Base64 - a simple base64 encoder and decoder. //* //* Copyright (c) 1999, Bob Withers - bwit@pobox.com //* //* This code may be freely used for any purpose, either personal //* or commercial, provided the authors copyright notice remains //* intact. //********************************************************************* #ifndef Base64_H #define Base64_H #include <string> using std::string; // comment if your compiler doesn't use namespaces class Base64 { public: static string encode(const string & data); static string decode(const string & data); static string encodeFromArray(const char * data, size_t len); private: static const string Base64Table; static const string::size_type DecodeTable[]; }; #endif
#include "GCMBnrInfo.h" #include <stdlib.h> void GCMFreeBnrInfoStruct(GCMBnrInfoStruct *r) { /* ** recursively frees the BNR infos... */ if (r->next) { GCMFreeBnrInfoStruct(r->next); } free(r); } int GCMBnrInfoCount(GCMBnrInfoStruct *r) { /* ** returns the number of info records in the record chain including r */ if (r->next) { return 1 + GCMBnrInfoCount(r->next); } else { return 1; } } GCMBnrInfoStruct *GCMBnrGetNthInfo(GCMBnrInfoStruct *r, int n) { /* ** returns the nth info record starting at r ** if n == 0, assume you want THIS record. ** if there's no next, there must be an error... return NULL */ if (n == 0) { return r; } else if (r->next) { return GCMBnrGetNthInfo(r->next, n - 1); } else { return NULL; } }
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "gsl/gsl_math.h" #include "gsl/gsl_sf_ellint.h" //for elliptic integrals #include "gsl/gsl_sf_gamma.h" //for gamma func, beta func, factorials, Pochhammer symbol #include "mconf.h" #define MODE GSL_PREC_DOUBLE #define TOL 2e-12 #define POW2( x ) ( ( x ) * ( x ) ) #define DOUBLE_EQ( x, v ) ( ( ( v - TOL ) < x ) && ( x < ( v + TOL ) ) ) double F_quad( double NormSep, double RpRs, double gam1, double gam2 ) ; double F_nonlin( double NormSep, double RpRs, double c1, double c2, double c3, double c4 ) ; double kappa_0( double NormSep, double RpRs ) ; double kappa_1( double NormSep, double RpRs ) ; double lambda_e_pi_funct( double NormSep, double RpRs) ; double lambda_1( double NormSep, double RpRs, double a, double b, double q, double k ) ; double lambda_2( double NormSep, double RpRs, double a, double b, double q, double k ) ; double lambda_3( double RpRs, double k ) ; double lambda_4( double RpRs, double k ) ; double lambda_5( double RpRs) ; double lambda_6( double RpRs) ; double eta_1( double NormSep, double RpRs, double a, double b ) ; double eta_2( double NormSep, double RpRs ) ; double Omega( double * C ) ; double Nfunc( double NormSep, double RpRs, int n, double a, double b ) ; double Mfunc( double NormSep, double RpRs, int n, double a, double b ) ; // Neale's code did some hackwork to define the Gauss hypergeometric and Appell hypergeomtric functions; // I'm not quite sure why he didn't use the GSL versions, but he probably had a good reason; I'm going to // try them anyway just in case. double hypappell( double a, double b1, double b2, double c, double x, double y ) ; void swap_double( double *x1, double *x2 ) ; //swap doubles #define ETOL_APPELL 1e-8 #define MAX_ITER_APPELL 50 #define ETOL_HYPER 1e-8 #define MAX_ITER_HYPER 50
/* * fs/partitions/bubl */ int bubl_partition(struct parsed_partitions *state, struct block_device *bdev);
/* * Ingenic burner setup code * * Copyright (c) 2013 Ingenic Semiconductor Co.,Ltd * Author: Zoro <ykli@ingenic.cn> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <common.h> #include <nand.h> #include <net.h> #include <netdev.h> #include <asm/gpio.h> #include <asm/arch/cpm.h> #include <asm/arch/mmc.h> #include <asm/jz_uart.h> #include <asm/arch/clk.h> #ifndef CONFIG_SPL_BUILD DECLARE_GLOBAL_DATA_PTR; struct global_info ginfo __attribute__ ((section(".data"))); extern struct jz_uart *uart; #endif struct cgu_clk_src cgu_clk_src[] = { {MSC, MPLL}, {SFC, MPLL}, {SRC_EOF,SRC_EOF} }; int board_early_init_f(void) { #ifndef CONFIG_SPL_BUILD gd->arch.gi = (struct global_info *)CONFIG_SPL_GINFO_BASE; uart = (struct jz_uart *)(UART0_BASE + gd->arch.gi->uart_idx * 0x1000); #endif return 0; } #ifdef CONFIG_USB_GADGET int jz_udc_probe(void); void board_usb_init(void) { printf("USB_udc_probe\n"); jz_udc_probe(); } #endif /* CONFIG_USB_GADGET */ int misc_init_r(void) { return 0; } #ifdef CONFIG_MMC int board_mmc_init(bd_t *bd) { jz_mmc_init(); return 0; } #endif #ifdef CONFIG_DRIVER_DM9000 int board_eth_init(bd_t *bis) { return 0; } #endif /* CONFIG_DRIVER_DM9000 */ /* U-Boot common routines */ int checkboard(void) { puts("Board: burner_x1000 (Ingenic XBurst X1000 SoC)\n"); return 0; } #ifdef CONFIG_SPL_BUILD void spl_board_init(void) { } #endif /* CONFIG_SPL_BUILD */
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_BROWSER_SCHEME_REGISTRATION_H_ #define CEF_LIBCEF_BROWSER_SCHEME_REGISTRATION_H_ #pragma once #include <string> #include <vector> #include "include/cef_frame.h" #include "content/public/browser/content_browser_client.h" #include "googleurl/src/gurl.h" namespace net { class URLRequestJobFactoryImpl; } namespace scheme { // Add internal standard schemes. void AddInternalStandardSchemes(std::vector<std::string>* standard_schemes); // Returns true if the specified |scheme| is handled internally and should not // be explicitly registered or unregistered with the URLRequestJobFactory. A // registered handler for one of these schemes (like "chrome") may still be // triggered via chaining from an existing ProtocolHandler. |scheme| should // always be a lower-case string. bool IsInternalProtectedScheme(const std::string& scheme); // Install the internal scheme handlers provided by Chromium that cannot be // overridden. void InstallInternalProtectedHandlers( net::URLRequestJobFactoryImpl* job_factory, content::ProtocolHandlerMap* protocol_handlers); // Register the internal scheme handlers that can be overridden. void RegisterInternalHandlers(); // Used to fire any asynchronous content updates. void DidFinishLoad(CefRefPtr<CefFrame> frame, const GURL& validated_url); } // namespace scheme #endif // CEF_LIBCEF_BROWSER_SCHEME_REGISTRATION_H_
/* sigprocmask wrapper for gdb Copyright (C) 2019-2020 Free Software Foundation, Inc. This file is part of GDB. 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 GDBSUPPORT_GDB_SIGMASK_H #define GDBSUPPORT_GDB_SIGMASK_H #include <signal.h> #ifdef HAVE_SIGPROCMASK #ifdef HAVE_PTHREAD_SIGMASK #define gdb_sigmask pthread_sigmask #else #define gdb_sigmask sigprocmask #endif #else /* HAVE_SIGPROCMASK */ /* Other code checks HAVE_SIGPROCMASK, but if there happened to be a system that only had pthread_sigmask, we could still use it with some extra changes. */ #ifdef HAVE_PTHREAD_SIGMASK #error pthread_sigmask available without sigprocmask - please report #endif #endif /* HAVE_SIGPROCMASK */ #endif /* GDBSUPPORT_GDB_SIGMASK_H */
/* blake_large.h */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.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 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 blake_large.h * \author Daniel Otte * \email bg@nerilex.org * \date 2009-05-08 * \license GPLv3 or later * */ #ifndef BLAKE_LARGE_H_ #define BLAKE_LARGE_H_ #include <stdint.h> #define BLAKE_LARGE_BLOCKSIZE 1024 #define BLAKE_LARGE_BLOCKSIZE_B ((BLAKE_LARGE_BLOCKSIZE+7)/8) #define BLAKE384_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE #define BLAKE384_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B #define BLAKE512_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE #define BLAKE512_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B typedef struct { uint64_t h[8]; uint64_t s[4]; uint32_t counter; uint8_t appendone; } blake_large_ctx_t; typedef blake_large_ctx_t blake384_ctx_t; typedef blake_large_ctx_t blake512_ctx_t; void blake384_init(blake384_ctx_t *ctx); void blake512_init(blake512_ctx_t *ctx); void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *block); void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *block, uint16_t length_b); void blake384_nextBlock(blake384_ctx_t *ctx, const void *block); void blake384_lastBlock(blake384_ctx_t *ctx, const void *block, uint16_t length_b); void blake512_nextBlock(blake512_ctx_t *ctx, const void *block); void blake512_lastBlock(blake512_ctx_t *ctx, const void *block, uint16_t length_b); void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx); void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx); void blake384(void *dest, const void *msg, uint32_t length_b); void blake512(void *dest, const void *msg, uint32_t length_b); #endif /* BLAKE_LARGE_H_ */
/* * Multimedia device API * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_MEDIA_H #define __LINUX_MEDIA_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/version.h> #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) struct media_device_info { char driver[16]; char model[32]; char serial[40]; char bus_info[32]; __u32 media_version; __u32 hw_revision; __u32 driver_version; __u32 reserved[31]; }; #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) #define MEDIA_ENT_TYPE_SHIFT 16 #define MEDIA_ENT_TYPE_MASK 0x00ff0000 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff #define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) #define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) #define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) #define MEDIA_ENT_FL_DEFAULT (1 << 0) struct media_entity_desc { __u32 id; char name[32]; __u32 type; __u32 revision; __u32 flags; __u32 group_id; __u16 pads; __u16 links; __u32 reserved[4]; union { /* */ struct { __u32 major; __u32 minor; } v4l; struct { __u32 major; __u32 minor; } fb; struct { __u32 card; __u32 device; __u32 subdevice; } alsa; int dvb; /* */ /* */ __u8 raw[184]; }; }; #define MEDIA_PAD_FL_SINK (1 << 0) #define MEDIA_PAD_FL_SOURCE (1 << 1) struct media_pad_desc { __u32 entity; /* */ __u16 index; /* */ __u32 flags; /* */ __u32 reserved[2]; }; #define MEDIA_LNK_FL_ENABLED (1 << 0) #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) #define MEDIA_LNK_FL_DYNAMIC (1 << 2) struct media_link_desc { struct media_pad_desc source; struct media_pad_desc sink; __u32 flags; __u32 reserved[2]; }; struct media_links_enum { __u32 entity; /* */ struct media_pad_desc __user *pads; /* */ struct media_link_desc __user *links; __u32 reserved[4]; }; #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) /* */ #define MEDIA_IOC_SUB_CAM_ID _IOWR('|', 0x04, int) /* */ #endif /* */
/* KDevelop CMake Support * * Copyright 2014 Aleix Pol <aleixpol@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. * * 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 DECLARATIONBUILDER_H #define DECLARATIONBUILDER_H #include <cmakelistsparser.h> #include "contextbuilder.h" #include <language/duchain/topducontext.h> #include <language/duchain/builders/abstractdeclarationbuilder.h> typedef KDevelop::AbstractDeclarationBuilder<CMakeContentIterator, CMakeFunctionDesc, ContextBuilder> DeclarationBuilderBase; class DeclarationBuilder : public DeclarationBuilderBase { public: // virtual KDevelop::ReferencedTopDUContext build(const KDevelop::IndexedString& url, CMakeFunctionDesc* node, KDevelop::ReferencedTopDUContext updateContext); virtual void startVisiting(CMakeContentIterator* node) override; }; #endif // DECLARATIONBUILDER_H
/* AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson 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. The original version of this library can be located at: http://www.angelcode.com/angelscript/ Andreas Jonsson andreas@angelcode.com */ // // as_criticalsection.h // // Classes for multi threading support // #ifndef AS_CRITICALSECTION_H #define AS_CRITICALSECTION_H #include "as_config.h" BEGIN_AS_NAMESPACE #ifdef AS_NO_THREADS #define DECLARECRITICALSECTION(x) #define ENTERCRITICALSECTION(x) #define LEAVECRITICALSECTION(x) #else #define DECLARECRITICALSECTION(x) asCThreadCriticalSection x #define ENTERCRITICALSECTION(x) x.Enter() #define LEAVECRITICALSECTION(x) x.Leave() #ifdef AS_POSIX_THREADS END_AS_NAMESPACE #include <pthread.h> BEGIN_AS_NAMESPACE class asCThreadCriticalSection { public: asCThreadCriticalSection(); ~asCThreadCriticalSection(); void Enter(); void Leave(); protected: pthread_mutex_t criticalSection; }; #elif defined(AS_WINDOWS_THREADS) END_AS_NAMESPACE #define WIN32_LEAN_AND_MEAN #include <windows.h> BEGIN_AS_NAMESPACE // Undefine macros that cause problems in our code #undef GetObject class asCThreadCriticalSection { public: asCThreadCriticalSection(); ~asCThreadCriticalSection(); void Enter(); void Leave(); protected: CRITICAL_SECTION criticalSection; }; #endif #endif END_AS_NAMESPACE #endif
#include<stdio.h> extern int file_processing(FILE*);
/* Copyright (c) 2001, Stanford University * All rights reserved. * * See the file LICENSE.txt for information on redistributing this software. */ #ifndef CR_STATE_BUFFEROBJECT_H #define CR_STATE_BUFFEROBJECT_H #include "cr_hash.h" #include "state/cr_statetypes.h" #include "state/cr_statefuncs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { CRbitvalue dirty[CR_MAX_BITARRAY]; CRbitvalue arrayBinding[CR_MAX_BITARRAY]; CRbitvalue elementsBinding[CR_MAX_BITARRAY]; CRbitvalue packBinding[CR_MAX_BITARRAY]; CRbitvalue unpackBinding[CR_MAX_BITARRAY]; } CRBufferObjectBits; /* * Buffer object, like a texture object, but encapsulates arbitrary * data (vertex, image, etc). */ typedef struct { GLuint refCount; GLuint id; GLuint hwid; GLenum usage; GLenum access; GLuint size; /* buffer size in bytes */ GLvoid *pointer; /* only valid while buffer is mapped */ GLvoid *data; /* the buffer data, if retainBufferData is true */ GLboolean bResyncOnRead; /* buffer data could be changed on server side, so we need to resync every time guest wants to read from it*/ CRbitvalue dirty[CR_MAX_BITARRAY]; /* dirty data or state */ GLintptrARB dirtyStart, dirtyLength; /* dirty region */ #ifndef IN_GUEST /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */ CRbitvalue ctxUsage[CR_MAX_BITARRAY]; #endif } CRBufferObject; typedef struct { GLboolean retainBufferData; /* should state tracker retain buffer data? */ CRBufferObject *arrayBuffer; CRBufferObject *elementsBuffer; CRBufferObject *packBuffer; CRBufferObject *unpackBuffer; CRBufferObject *nullBuffer; /* name = 0 */ } CRBufferObjectState; DECLEXPORT(CRBufferObject *) crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b); DECLEXPORT(GLboolean) crStateIsBufferBound(GLenum target); struct CRContext; DECLEXPORT(GLboolean) crStateIsBufferBoundForCtx(struct CRContext *g, GLenum target); DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID(GLuint hwid); DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID(GLuint id); DECLEXPORT(void) crStateRegBuffers(GLsizei n, GLuint *buffers); #ifdef __cplusplus } #endif #endif /* CR_STATE_BUFFEROBJECT_H */
/* ---------------------------------------------------------------------------- */ /* Atmel Microcontroller Software Support */ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2015, Atmel Corporation */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following condition is met: */ /* */ /* - Redistributions of source code must retain the above copyright notice, */ /* this list of conditions and the disclaimer below. */ /* */ /* Atmel's name may not be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* DISCLAIMER: 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 */ /* 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. */ /* ---------------------------------------------------------------------------- */ #ifndef PIO_CAPTURE_H #define PIO_CAPTURE_H /*---------------------------------------------------------------------------- * Types *----------------------------------------------------------------------------*/ /** \brief PIO Parallel Capture structure for initialize. * * At the end of the transfer, the callback is invoked by the interrupt handler. */ typedef struct _SpioCaptureInit { /** PIO_PCRHR register is a BYTE, HALF-WORD or WORD */ uint8_t dsize; /** PDC size, data to be received */ uint16_t dPDCsize; /** Data to be received */ uint32_t *pData; /** Parallel Capture Mode Always Sampling */ uint8_t alwaysSampling; /** Parallel Capture Mode Half Sampling */ uint8_t halfSampling; /** Parallel Capture Mode First Sample */ uint8_t modeFirstSample; /** Callback function invoked at Mode Data Ready */ void (*CbkDataReady)(struct _SpioCaptureInit *); /** Callback function invoked at Mode Overrun Error */ void (*CbkOverrun)(struct _SpioCaptureInit *); /** Callback function invoked at End of Reception Transfer */ void (*CbkEndReception)(struct _SpioCaptureInit *); /** Callback function invoked at Reception Buffer Full */ void (*CbkBuffFull)(struct _SpioCaptureInit *); /** Callback arguments.*/ void *pParam; } SpioCaptureInit; /*---------------------------------------------------------------------------- * Global Functions *----------------------------------------------------------------------------*/ extern void PIO_CaptureDisableIt(uint32_t itToDisable); extern void PIO_CaptureEnableIt(uint32_t itToEnable); extern void PIO_CaptureEnable(void); extern void PIO_CaptureDisable(void); extern void PIO_CaptureInit(SpioCaptureInit *pInit); #endif /* #ifndef PIO_CAPTURE_H */
/* addressvalidator.h * * Copyright (c) 2000, Alexander Neundorf * neundorf@kde.org * * You may distribute under the terms of the GNU General Public * License as specified in the COPYING file. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef ADDRESSVALIDATOR_H #define ADDRESSVALIDATOR_H #include "lisadefines.h" #include "mystring.h" #include "configfile.h" #define NO_SPEC 0 #define NETMASK_SPEC 1 #define EXACTADDR_SPEC 2 #define RANGE_SPEC 3 #define MULTIRANGE_SPEC 4 struct AddressSpec { int address; int mask; int typeOfSpec; }; class AddressValidator { public: AddressValidator(const MyString& addressSpecs); AddressValidator(); ~AddressValidator(); void configure(Config& config); void setValidAddresses(MyString addressSpecs); void clearSpecs(); int isValid(int addressNBO); MyString validAddresses() {return allowedHosts;}; private: int localhostNet; int localhostMask; MyString allowedHosts; void addSpec(int type, int address, int mask=0); AddressSpec specs[MAX_SPECS]; }; #endif
/* * tcbm-resources.c * * Written by * Andreas Boose <viceteam@t-online.de> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #include "vice.h" #include <stdio.h> #include "lib.h" #include "resources.h" #include "tcbm-resources.h" #include "tcbmrom.h" #include "util.h" static char *dos_rom_name_1551 = NULL; static int set_dos_rom_name_1551(const char *val, void *param) { if (util_string_set(&dos_rom_name_1551, val)) { return 0; } return tcbmrom_load_1551(); } static const resource_string_t resources_string[] = { { "DosName1551", "dos1551", RES_EVENT_NO, NULL, &dos_rom_name_1551, set_dos_rom_name_1551, NULL }, { NULL } }; int tcbm_resources_init(void) { return resources_register_string(resources_string); } void tcbm_resources_shutdown(void) { lib_free(dos_rom_name_1551); }
#ifndef AUTOBOOT_H #define AUTOBOOT_H #include <QFile> #include "sioworker.h" class AtariExeChunk { public: int address; QByteArray data; }; class AutoBoot : public SioDevice { Q_OBJECT private: QByteArray bootSectors; QList <AtariExeChunk> chunks; int sectorCount; SioDevice *oldDevice; bool started, loaded; bool readExecutable(const QString &fileName); public: AutoBoot(SioWorker *worker, SioDevice *aOldDevice): SioDevice(worker) {oldDevice = aOldDevice; started = loaded = false;} ~AutoBoot(); void handleCommand(quint8 command, quint16 aux); void passToOldHandler(quint8 command, quint16 aux); bool open(const QString &fileName, bool highSpeed); void close(); bool readSector(quint16 sector, QByteArray &data); QString deviceName(); signals: void booterStarted(); void booterLoaded(); void blockRead(int current, int all); void loaderDone(); }; #endif // AUTOBOOT_H
#include <stdio.h> #include <stdlib.h> #include <string.h> int main (int argc, char *argv[]) { int i; char command[128]; if (argc < 2) { printf("Dette programet kjører en komando igjen og igjen\n\n\teverrun kamando\n\n"); exit(0); } command[0] = '\0'; for(i=1;i<argc;i++) { strcat(command,argv[i]); strcat(command," "); //printf("%s %s\n",argv[i],command); } printf("do: %s\n",command); while (1) { system(command); //dont hamer sleep(5); } }
/* * Copyright (c) 2012, The Linux Foundation. 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 version 2 and * only 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. */ #ifndef __MSM_RTB_H__ #define __MSM_RTB_H__ enum logk_event_type { LOGK_NONE = 0, LOGK_READL = 1, LOGK_WRITEL = 2, LOGK_LOGBUF = 3, LOGK_HOTPLUG = 4, LOGK_CTXID = 5, LOGK_TIMESTAMP = 6, LOGK_IRQ = 10, LOGK_DIE = 11, }; #define LOGTYPE_NOPC 0x80 struct msm_rtb_platform_data { unsigned long buffer_start_addr; unsigned int size; }; #if defined(CONFIG_MSM_RTB) int msm_rtb_enabled(void); void msm_rtb_disable(void); unsigned long get_current_timestamp(void); int uncached_logk_pc(enum logk_event_type log_type, void *caller, void *data); int uncached_logk(enum logk_event_type log_type, void *data); #define ETB_WAYPOINT do { \ BRANCH_TO_NEXT_ISTR; \ nop(); \ BRANCH_TO_NEXT_ISTR; \ nop(); \ } while (0) #define BRANCH_TO_NEXT_ISTR asm volatile("b .+4\n" : : : "memory") #define LOG_BARRIER do { \ mb(); \ isb();\ } while (0) #else static inline int msm_rtb_enabled(void) { return 0; } static inline void msm_rtb_disable(void) { return; } static inline unsigned long get_current_timestamp(void) { return 0; } static inline int uncached_logk_pc(enum logk_event_type log_type, void *caller, void *data) { return 0; } static inline int uncached_logk(enum logk_event_type log_type, void *data) { return 0; } #define ETB_WAYPOINT #define BRANCH_TO_NEXT_ISTR #define LOG_BARRIER nop() #endif #endif
/* * ALSA driver for ICEnsemble ICE1712 (Envy24) * * AK4524 / AK4528 / AK4529 / AK4355 / AK4381 interface * * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <sound/driver.h> #include <asm/io.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/init.h> #include <sound/core.h> #include <sound/initval.h> #include "ice1712.h" MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); MODULE_DESCRIPTION("ICEnsemble ICE17xx <-> AK4xxx AD/DA chip interface"); MODULE_LICENSE("GPL"); MODULE_CLASSES("{sound}"); static void snd_ice1712_akm4xxx_lock(akm4xxx_t *ak, int chip) { ice1712_t *ice = ak->private_data[0]; snd_ice1712_save_gpio_status(ice); } static void snd_ice1712_akm4xxx_unlock(akm4xxx_t *ak, int chip) { ice1712_t *ice = ak->private_data[0]; snd_ice1712_restore_gpio_status(ice); } /* * write AK4xxx register */ static void snd_ice1712_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char addr, unsigned char data) { unsigned int tmp; int idx; unsigned int addrdata; struct snd_ak4xxx_private *priv = (void *)ak->private_value[0]; ice1712_t *ice = ak->private_data[0]; snd_assert(chip >= 0 && chip < 4, return); tmp = snd_ice1712_gpio_read(ice); tmp |= priv->add_flags; tmp &= ~priv->mask_flags; if (priv->cs_mask == priv->cs_addr) { if (priv->cif) { tmp |= priv->cs_mask; /* start without chip select */ } else { tmp &= ~priv->cs_mask; /* chip select low */ snd_ice1712_gpio_write(ice, tmp); udelay(1); } } else { /* doesn't handle cf=1 yet */ tmp &= ~priv->cs_mask; tmp |= priv->cs_addr; snd_ice1712_gpio_write(ice, tmp); udelay(1); } /* build I2C address + data byte */ addrdata = (priv->caddr << 6) | 0x20 | (addr & 0x1f); addrdata = (addrdata << 8) | data; for (idx = 15; idx >= 0; idx--) { /* drop clock */ tmp &= ~priv->clk_mask; snd_ice1712_gpio_write(ice, tmp); udelay(1); /* set data */ if (addrdata & (1 << idx)) tmp |= priv->data_mask; else tmp &= ~priv->data_mask; snd_ice1712_gpio_write(ice, tmp); udelay(1); /* raise clock */ tmp |= priv->clk_mask; snd_ice1712_gpio_write(ice, tmp); udelay(1); } if (priv->cs_mask == priv->cs_addr) { if (priv->cif) { /* assert a cs pulse to trigger */ tmp &= ~priv->cs_mask; snd_ice1712_gpio_write(ice, tmp); udelay(1); } tmp |= priv->cs_mask; /* chip select high to trigger */ } else { tmp &= ~priv->cs_mask; tmp |= priv->cs_none; /* deselect address */ } snd_ice1712_gpio_write(ice, tmp); udelay(1); } /* * initialize the akm4xxx_t record with the template */ int snd_ice1712_akm4xxx_init(akm4xxx_t *ak, const akm4xxx_t *temp, const struct snd_ak4xxx_private *_priv, ice1712_t *ice) { struct snd_ak4xxx_private *priv; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; *ak = *temp; ak->card = ice->card; *priv = *_priv; ak->private_value[0] = (unsigned long)priv; ak->private_data[0] = ice; if (ak->ops.lock == NULL) ak->ops.lock = snd_ice1712_akm4xxx_lock; if (ak->ops.unlock == NULL) ak->ops.unlock = snd_ice1712_akm4xxx_unlock; if (ak->ops.write == NULL) ak->ops.write = snd_ice1712_akm4xxx_write; snd_akm4xxx_init(ak); return 0; } void snd_ice1712_akm4xxx_free(ice1712_t *ice) { unsigned int akidx; if (ice->akm == NULL) return; for (akidx = 0; akidx < ice->akm_codecs; akidx++) { akm4xxx_t *ak = &ice->akm[akidx]; if (ak->private_value[0]) kfree((void *)ak->private_value[0]); } kfree(ice->akm); } /* * build AK4xxx controls */ int snd_ice1712_akm4xxx_build_controls(ice1712_t *ice) { unsigned int akidx; int err; for (akidx = 0; akidx < ice->akm_codecs; akidx++) { akm4xxx_t *ak = &ice->akm[akidx]; err = snd_akm4xxx_build_controls(ak); if (err < 0) return err; } return 0; } static int __init alsa_ice1712_akm4xxx_module_init(void) { return 0; } static void __exit alsa_ice1712_akm4xxx_module_exit(void) { } module_init(alsa_ice1712_akm4xxx_module_init) module_exit(alsa_ice1712_akm4xxx_module_exit) EXPORT_SYMBOL(snd_ice1712_akm4xxx_init); EXPORT_SYMBOL(snd_ice1712_akm4xxx_free); EXPORT_SYMBOL(snd_ice1712_akm4xxx_build_controls);
/* * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> * Copyright (C) 2008-2009 PetaLogix * Copyright (C) 2006 Atmark Techno, Inc. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #ifndef _ASM_MICROBLAZE_PROCESSOR_H #define _ASM_MICROBLAZE_PROCESSOR_H #include <asm/ptrace.h> #include <asm/setup.h> #include <asm/registers.h> #include <asm/entry.h> #include <asm/current.h> # ifndef __ASSEMBLY__ /* from kernel/cpu/mb.c */ extern const struct seq_operations cpuinfo_op; # define cpu_relax() barrier() # define cpu_sleep() do {} while (0) #define task_pt_regs(tsk) \ (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1) /* Do necessary setup to start up a newly executed thread. */ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); extern void ret_from_fork(void); # endif /* __ASSEMBLY__ */ # ifndef CONFIG_MMU /* * User space process size: memory size * * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both * user processes and the kernel is on the same memory region. They * both share the memory space and that is limited by the amount of * physical memory. thus, we set TASK_SIZE == amount of total memory. */ # define TASK_SIZE (0x81000000 - 0x80000000) /* * Default implementation of macro that returns current * instruction pointer ("program counter"). */ # define current_text_addr() ({ __label__ _l; _l: &&_l; }) /* * This decides where the kernel will search for a free chunk of vm * space during mmap's. We won't be using it */ # define TASK_UNMAPPED_BASE 0 /* definition in include/linux/sched.h */ struct task_struct; /* thread_struct is gone. use thread_info instead. */ struct thread_struct { }; # define INIT_THREAD { } /* Free all resources held by a thread. */ static inline void release_thread(struct task_struct *dead_task) { } /* Free all resources held by a thread. */ static inline void exit_thread(void) { } extern unsigned long thread_saved_pc(struct task_struct *t); extern unsigned long get_wchan(struct task_struct *p); /* * create a kernel thread without removing it from tasklists */ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); # define KSTK_EIP(tsk) (0) # define KSTK_ESP(tsk) (0) # else /* CONFIG_MMU */ /* * This is used to define STACK_TOP, and with MMU it must be below * kernel base to select the correct PGD when handling MMU exceptions. */ # define TASK_SIZE (CONFIG_KERNEL_START) /* * This decides where the kernel will search for a free chunk of vm * space during mmap's. */ # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) # define THREAD_KSP 0 # ifndef __ASSEMBLY__ /* * Default implementation of macro that returns current * instruction pointer ("program counter"). */ # define current_text_addr() ({ __label__ _l; _l: &&_l; }) /* If you change this, you must change the associated assembly-languages * constants defined below, THREAD_*. */ struct thread_struct { /* kernel stack pointer (must be first field in structure) */ unsigned long ksp; unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */ void *pgdir; /* root of page-table tree */ struct pt_regs *regs; /* Pointer to saved register state */ }; # define INIT_THREAD { \ .ksp = sizeof init_stack + (unsigned long)init_stack, \ .pgdir = swapper_pg_dir, \ } /* Free all resources held by a thread. */ extern inline void release_thread(struct task_struct *dead_task) { } extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); /* Free current thread data structures etc. */ static inline void exit_thread(void) { } /* Return saved (kernel) PC of a blocked thread. */ # define thread_saved_pc(tsk) \ ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0) unsigned long get_wchan(struct task_struct *p); /* The size allocated for kernel stacks. This _must_ be a power of two! */ # define KERNEL_STACK_SIZE 0x2000 /* Return some info about the user process TASK. */ # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE) # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) # define task_pt_regs_plus_args(tsk) \ ((void *)task_pt_regs(tsk)) # define task_sp(task) (task_regs(task)->r1) # define task_pc(task) (task_regs(task)->pc) /* Grotty old names for some. */ # define KSTK_EIP(task) (task_pc(task)) # define KSTK_ESP(task) (task_sp(task)) /* FIXME */ # define deactivate_mm(tsk, mm) do { } while (0) # define STACK_TOP TASK_SIZE # define STACK_TOP_MAX STACK_TOP void default_idle(void); #ifdef CONFIG_DEBUG_FS extern struct dentry *of_debugfs_root; #endif # endif /* __ASSEMBLY__ */ # endif /* CONFIG_MMU */ #endif /* _ASM_MICROBLAZE_PROCESSOR_H */
/* * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions. * * Copyright (C) 2011, Broadcom Corporation. All Rights Reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * $Id: sbmemc.h 241182 2011-02-17 21:50:03Z $ */ #ifndef _SBMEMC_H #define _SBMEMC_H #ifdef _LANGUAGE_ASSEMBLY #define MEMC_CONTROL 0x00 #define MEMC_CONFIG 0x04 #define MEMC_REFRESH 0x08 #define MEMC_BISTSTAT 0x0c #define MEMC_MODEBUF 0x10 #define MEMC_BKCLS 0x14 #define MEMC_PRIORINV 0x18 #define MEMC_DRAMTIM 0x1c #define MEMC_INTSTAT 0x20 #define MEMC_INTMASK 0x24 #define MEMC_INTINFO 0x28 #define MEMC_NCDLCTL 0x30 #define MEMC_RDNCDLCOR 0x34 #define MEMC_WRNCDLCOR 0x38 #define MEMC_MISCDLYCTL 0x3c #define MEMC_DQSGATENCDL 0x40 #define MEMC_SPARE 0x44 #define MEMC_TPADDR 0x48 #define MEMC_TPDATA 0x4c #define MEMC_BARRIER 0x50 #define MEMC_CORE 0x54 #else /* !_LANGUAGE_ASSEMBLY */ /* Sonics side: MEMC core registers */ typedef volatile struct sbmemcregs { uint32 control; uint32 config; uint32 refresh; uint32 biststat; uint32 modebuf; uint32 bkcls; uint32 priorinv; uint32 dramtim; uint32 intstat; uint32 intmask; uint32 intinfo; uint32 reserved1; uint32 ncdlctl; uint32 rdncdlcor; uint32 wrncdlcor; uint32 miscdlyctl; uint32 dqsgatencdl; uint32 spare; uint32 tpaddr; uint32 tpdata; uint32 barrier; uint32 core; } sbmemcregs_t; #endif /* _LANGUAGE_ASSEMBLY */ /* MEMC Core Init values (OCP ID 0x80f) */ /* For sdr: */ #define MEMC_SD_CONFIG_INIT 0x00048000 #define MEMC_SD_DRAMTIM2_INIT 0x000754d8 #define MEMC_SD_DRAMTIM3_INIT 0x000754da #define MEMC_SD_RDNCDLCOR_INIT 0x00000000 #define MEMC_SD_WRNCDLCOR_INIT 0x49351200 #define MEMC_SD1_WRNCDLCOR_INIT 0x14500200 /* For corerev 1 (4712) */ #define MEMC_SD_MISCDLYCTL_INIT 0x00061c1b #define MEMC_SD1_MISCDLYCTL_INIT 0x00021416 /* For corerev 1 (4712) */ #define MEMC_SD_CONTROL_INIT0 0x00000002 #define MEMC_SD_CONTROL_INIT1 0x00000008 #define MEMC_SD_CONTROL_INIT2 0x00000004 #define MEMC_SD_CONTROL_INIT3 0x00000010 #define MEMC_SD_CONTROL_INIT4 0x00000001 #define MEMC_SD_MODEBUF_INIT 0x00000000 #define MEMC_SD_REFRESH_INIT 0x0000840f /* This is for SDRM8X8X4 */ #define MEMC_SDR_INIT 0x0008 #define MEMC_SDR_MODE 0x32 #define MEMC_SDR_NCDL 0x00020032 #define MEMC_SDR1_NCDL 0x0002020f /* For corerev 1 (4712) */ /* For ddr: */ #define MEMC_CONFIG_INIT 0x00048000 #define MEMC_DRAMTIM2_INIT 0x000754d8 #define MEMC_DRAMTIM25_INIT 0x000754d9 #define MEMC_RDNCDLCOR_INIT 0x00000000 #define MEMC_RDNCDLCOR_SIMINIT 0xf6f6f6f6 /* For hdl sim */ #define MEMC_WRNCDLCOR_INIT 0x49351200 #define MEMC_1_WRNCDLCOR_INIT 0x14500200 #define MEMC_DQSGATENCDL_INIT 0x00030000 #define MEMC_MISCDLYCTL_INIT 0x21061c1b #define MEMC_1_MISCDLYCTL_INIT 0x21021400 #define MEMC_NCDLCTL_INIT 0x00002001 #define MEMC_CONTROL_INIT0 0x00000002 #define MEMC_CONTROL_INIT1 0x00000008 #define MEMC_MODEBUF_INIT0 0x00004000 #define MEMC_CONTROL_INIT2 0x00000010 #define MEMC_MODEBUF_INIT1 0x00000100 #define MEMC_CONTROL_INIT3 0x00000010 #define MEMC_CONTROL_INIT4 0x00000008 #define MEMC_REFRESH_INIT 0x0000840f #define MEMC_CONTROL_INIT5 0x00000004 #define MEMC_MODEBUF_INIT2 0x00000000 #define MEMC_CONTROL_INIT6 0x00000010 #define MEMC_CONTROL_INIT7 0x00000001 /* This is for DDRM16X16X2 */ #define MEMC_DDR_INIT 0x0009 #define MEMC_DDR_MODE 0x62 #define MEMC_DDR_NCDL 0x0005050a #define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */ /* mask for sdr/ddr calibration registers */ #define MEMC_RDNCDLCOR_RD_MASK 0x000000ff #define MEMC_WRNCDLCOR_WR_MASK 0x000000ff #define MEMC_DQSGATENCDL_G_MASK 0x000000ff /* masks for miscdlyctl registers */ #define MEMC_MISC_SM_MASK 0x30000000 #define MEMC_MISC_SM_SHIFT 28 #define MEMC_MISC_SD_MASK 0x0f000000 #define MEMC_MISC_SD_SHIFT 24 /* hw threshhold for calculating wr/rd for sdr memc */ #define MEMC_CD_THRESHOLD 128 /* Low bit of init register says if memc is ddr or sdr */ #define MEMC_CONFIG_DDR 0x00000001 #endif /* _SBMEMC_H */
#ifndef FTM_CUST_H #define FTM_CUST_H #define FEATURE_FTM_MAIN_CAMERA #define FEATURE_FTM_SUB_CAMERA #define FEATURE_FTM_STROBE #define FEATURE_FTM_TOUCH #define FEATURE_FTM_KEYS #define FEATURE_FTM_BATTERY #define FEATURE_FTM_PMIC_632X #define BATTERY_TYPE_Z3 #define FEATURE_FTM_SWCHR_I_68mohm #define FEATURE_FTM_RTC /* //#define FEATURE_DUMMY_AUDIO //#define FEATURE_FTM_HW_CANNOT_MEASURE_CURRENT #define FEATURE_FTM_FM //#define FEATURE_FTM_FMTX #define FEATURE_FTM_STROBE #ifdef MTK_EMMC_SUPPORT #define FEATURE_FTM_EMMC #define FEATURE_FTM_CLEAREMMC #else #define FEATURE_FTM_FLASH #define FEATURE_FTM_CLEARFLASH #endif #define FEATURE_FTM_MEMCARD */ #define FEATURE_FTM_LCD #define FEATURE_FTM_LED #define FEATURE_FTM_BT #define FEATURE_FTM_GPS #if defined(MTK_WLAN_SUPPORT) #define FEATURE_FTM_WIFI #endif #define FEATURE_FTM_IDLE #define FEATURE_FTM_AUDIO #define FEATURE_FTM_VIBRATOR #define FEATURE_FTM_HEADSET #define FEATURE_FTM_SPK_OC #define FEATURE_FTM_WAVE_PLAYBACK #define FEATURE_FTM_ACCDET #define HEADSET_BUTTON_DETECTION /* //#define FEATURE_FTM_CLEARFLASH //#ifdef HAVE_MATV_FEATURE //#define FEATURE_FTM_MATV //#endif //#define FEATURE_FTM_FONT_10x18 #define FEATURE_FTM_USB //#define FEATURE_FTM_OTG #define FEATURE_FTM_SIM */ #include "cust_font.h" /* common part */ #include "cust_keys.h" /* custom part */ #include "cust_lcd.h" /* custom part */ #include "cust_led.h" /* custom part */ #include "cust_touch.h" /* custom part */ #endif /* FTM_CUST_H */
/* Test of vasnprintf() and asnprintf() functions. Copyright (C) 2007 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "vasnprintf.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define ASSERT(expr) \ do \ { \ if (!(expr)) \ { \ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ abort (); \ } \ } \ while (0) static char * my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *ret; va_start (args, format); ret = vasnprintf (resultbuf, lengthp, format, args); va_end (args); return ret; } static void test_vasnprintf () { char buf[8]; int size; for (size = 0; size <= 8; size++) { size_t length = size; char *result = my_asnprintf (NULL, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); free (result); } for (size = 0; size <= 8; size++) { size_t length; char *result; memcpy (buf, "DEADBEEF", 8); length = size; result = my_asnprintf (buf, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); if (size < 6) ASSERT (result != buf); ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); if (result != buf) free (result); } } static void test_asnprintf () { char buf[8]; int size; for (size = 0; size <= 8; size++) { size_t length = size; char *result = asnprintf (NULL, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); free (result); } for (size = 0; size <= 8; size++) { size_t length; char *result; memcpy (buf, "DEADBEEF", 8); length = size; result = asnprintf (buf, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); if (size < 6) ASSERT (result != buf); ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); if (result != buf) free (result); } } int main (int argc, char *argv[]) { test_vasnprintf (); test_asnprintf (); return 0; }
/* * ircd-ratbox: A slightly useful ircd. * spy_info_notice.c: Sends a notice when someone uses INFO. * * Copyright (C) 2002 by the past and present ircd coders, and others. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #include "stdinc.h" #include "modules.h" #include "hook.h" #include "client.h" #include "ircd.h" #include "send.h" void show_info(hook_data *); mapi_hfn_list_av1 info_hfnlist[] = { {"doing_info", (hookfn) show_info}, {NULL, NULL} }; DECLARE_MODULE_AV1(info_spy, NULL, NULL, NULL, NULL, info_hfnlist, "$Revision$"); void show_info(hook_data *data) { sendto_realops_snomask(SNO_SPY, L_ALL, "info requested by %s (%s@%s) [%s]", data->client->name, data->client->username, data->client->host, data->client->servptr->name); }
/* Copyright (C) 1999 Paul Barton-Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __gtkmm2ext_click_box_h__ #define __gtkmm2ext_click_box_h__ #include <string> #include <gtkmm.h> #include <gtkmm2ext/auto_spin.h> namespace Gtkmm2ext { class ClickBox : public Gtk::DrawingArea, public AutoSpin { public: ClickBox (Gtk::Adjustment *adj, const std::string &name, bool round_to_steps = false); ~ClickBox (); /** Set a slot to `print' the value to put in the box. * The slot should write the value of the Gtk::Adjustment * into the char array, and should return true if it has done the printing, * or false to use the ClickBox's default printing method. */ void set_printer (sigc::slot<bool, char *, Gtk::Adjustment &>); protected: bool on_expose_event (GdkEventExpose*); private: Glib::RefPtr<Pango::Layout> layout; int twidth; int theight; void set_label (); void style_changed (const Glib::RefPtr<Gtk::Style> &); bool button_press_handler (GdkEventButton *); bool button_release_handler (GdkEventButton *); sigc::slot<bool, char *, Gtk::Adjustment &> _printer; }; } /* namespace */ #endif /* __gtkmm2ext_click_box_h__ */
/* * Performance event support - hardware-specific disambiguation * * For now this is a compile-time decision, but eventually it should be * runtime. This would allow multiplatform perf event support for e300 (fsl * embedded perf counters) plus server/classic, and would accommodate * devices other than the core which provide their own performance counters. * * Copyright 2010 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifdef CONFIG_PPC_PERF_CTRS #include <asm/perf_event_server.h> #endif #ifdef CONFIG_FSL_EMB_PERF_EVENT #include <asm/perf_event_fsl_emb.h> #endif #ifdef CONFIG_PERF_EVENTS #include <asm/ptrace.h> #include <asm/reg.h> #define perf_arch_fetch_caller_regs(regs, __ip) \ do { \ (regs)->nip = __ip; \ (regs)->gpr[1] = *(unsigned long *)__get_SP(); \ asm volatile("mfmsr %0" : "=r" ((regs)->msr)); \ } while (0) #endif
/* This file is part of the KDE project * * Copyright (C) 2014 Inge Wallin <inge@lysator.liu.se> * * 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 KOODF_PAGE_LAYOUT_H #define KOODF_PAGE_LAYOUT_H #include "KoOdfStyleBase.h" #include "koodf2_export.h" #include <QHash> class QString; class KoXmlStreamReader; class KoOdfStyleProperties; class KoOdfPageLayoutProperties; class KoOdfHeaderFooterProperties; class KoXmlWriter; class KOODF2_EXPORT KoOdfPageLayout : public KoOdfStyleBase { public: KoOdfPageLayout(); ~KoOdfPageLayout(); QString pageUsage() const; void setPageUsage(const QString &family); /** * @brief Return the page layout properties of this page layout style. */ KoOdfPageLayoutProperties *pageLayoutProperties() const; /** * @brief Return the header properties of this page layout style. */ KoOdfHeaderFooterProperties *headerProperties() const; /** * @brief Return the footer properties of this page layout style. */ KoOdfHeaderFooterProperties *footerProperties() const; // Reimplemented from KoOdfStyleBase bool readOdf(KoXmlStreamReader &reader); bool saveOdf(KoXmlWriter *writer); private: class Private; Private * const d; }; #endif
/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J 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. * * SDR-J 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 SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __DAB_AUDIO #define __DAB_AUDIO #include "dab-virtual.h" #include <memory> #include <atomic> #include <vector> #include <thread> #include <mutex> #include <condition_variable> #include <cstdio> #include "ringbuffer.h" #include "energy_dispersal.h" #include "radio-controller.h" class DabProcessor; class Protection; class DabAudio : public DabVirtual { public: DabAudio(AudioServiceComponentType dabModus, int16_t fragmentSize, int16_t bitRate, ProtectionSettings protection, ProgrammeHandlerInterface& phi, const std::string& dumpFileName); virtual ~DabAudio(void); DabAudio(const DabAudio&) = delete; DabAudio& operator=(const DabAudio&) = delete; int32_t process(const softbit_t *v, int16_t cnt); protected: ProgrammeHandlerInterface& myProgrammeHandler; private: void run(void); std::atomic<bool> running; AudioServiceComponentType dabModus; int16_t fragmentSize; int16_t bitRate; std::vector<uint8_t> outV; std::vector<softbit_t> interleaveData[16]; EnergyDispersal energyDispersal; std::condition_variable mscDataAvailable; std::mutex ourMutex; std::thread ourThread; std::unique_ptr<Protection> protectionHandler; std::unique_ptr<DabProcessor> our_dabProcessor; RingBuffer<softbit_t> mscBuffer; const std::string dumpFileName; }; #endif
/* * This file is part of Rabbits * Copyright (C) 2015 Clement Deschamps and Luc Michel * * 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 _DEBUG_INITIATOR_H #define _DEBUG_INITIATOR_H #include "rabbits-common.h" #include <tlm_utils/simple_initiator_socket.h> class DebugInitiator : public sc_module { public: DebugInitiator(sc_module_name n); virtual ~DebugInitiator(); uint64_t debug_read(uint64_t addr, void *buf, uint64_t size); uint64_t debug_write(uint64_t addr, void *buf, uint64_t size); tlm_utils::simple_initiator_socket<DebugInitiator> socket; }; #endif
// -*- C++ -*- #ifndef __LEMGA_MULTICLASS_ADABOOST_ECOC_H__ #define __LEMGA_MULTICLASS_ADABOOST_ECOC_H__ /** @file * @brief Declare @link lemga::AdaBoost_ECOC AdaBoost_ECOC@endlink class. * * $Id: adaboost_ecoc.h 2696 2006-04-05 20:10:13Z ling $ */ #include "multiclass_ecoc.h" #include "shared_ptr.h" namespace lemga { typedef std::vector<DataWgt> JointWgt; typedef const_shared_ptr<JointWgt> pJointWgt; /** @brief AdaBoost.ECC with exponential cost and Hamming distance. */ class AdaBoost_ECOC : public MultiClass_ECOC { public: enum PARTITION_METHOD { RANDOM_HALF, MAX_CUT, MAX_CUT_GREEDY, RANDOM_2, MAX_2 }; protected: PARTITION_METHOD par_method; public: AdaBoost_ECOC () : MultiClass_ECOC(), par_method(MAX_CUT_GREEDY) {} AdaBoost_ECOC (const MultiClass_ECOC& s) : MultiClass_ECOC(s), par_method(MAX_CUT_GREEDY) {} explicit AdaBoost_ECOC (std::istream& is) { is >> *this; } virtual const id_t& id () const; virtual AdaBoost_ECOC* create () const { return new AdaBoost_ECOC(); } virtual AdaBoost_ECOC* clone () const { return new AdaBoost_ECOC(*this); } void set_partition_method (PARTITION_METHOD m) { par_method = m; } protected: /// set up by setup_aux(); updated by update_aux(); /// used by a lot of functions here. JointWgt joint_wgt; /// set up by train_with_partition(); /// used by assign_weight() and update_aux(). mutable std::vector<bool> cur_err; /// set up by train_with_partition(); used by assign_weight(). mutable pDataWgt cur_smpwgt; pDataWgt smpwgt_with_partition (const ECOC_VECTOR&) const; pLearnModel train_with_full_partition (const ECOC_VECTOR&) const; virtual void setup_aux (); virtual bool ECOC_partition (UINT, ECOC_VECTOR&) const; virtual pLearnModel train_with_partition (ECOC_VECTOR&) const; virtual REAL assign_weight (const ECOC_VECTOR&, const LearnModel&) const; virtual void update_aux (const ECOC_VECTOR&); std::vector<std::vector<REAL> > confusion_matrix () const; ECOC_VECTOR max_cut (UINT) const; ECOC_VECTOR max_cut_greedy (UINT) const; ECOC_VECTOR random_half (UINT) const; }; } // namespace lemga #ifdef __ADABOOST_ECOC_H__ #warning "This header file may conflict with another `adaboost_ecoc.h' file." #endif #define __ADABOOST_ECOC_H__ #endif
// // GlyphKey.h // iTerm2SharedARC // // Created by George Nachman on 11/19/17. // #import <Foundation/Foundation.h> #import "iTermMetalGlyphKey.h" namespace iTerm2 { template <class T> inline void hash_combine(std::size_t& seed, const T& v) { std::hash<T> hasher; seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); } class GlyphKey { private: iTermMetalGlyphKey _repr; std::size_t _hash; public: explicit GlyphKey(const iTermMetalGlyphKey *repr) : _repr(*repr) { _hash = compute_hash(); } GlyphKey() : _hash(0) { } // Copy constructor GlyphKey(const GlyphKey &other) { _repr = other._repr; _hash = other._hash; } inline bool operator==(const GlyphKey &other) const { return (_repr.code == other._repr.code && _repr.isComplex == other._repr.isComplex && _repr.boxDrawing == other._repr.boxDrawing && _repr.thinStrokes == other._repr.thinStrokes && _repr.typeface == other._repr.typeface); } inline std::size_t get_hash() const { return _hash; } NSString *description() const { return [NSString stringWithFormat:@"[GlyphKey: code=%@ complex=%@ boxdrawing=%@ thinstrokes=%@ drawable=%@ typeface=%@]", @(_repr.code), @(_repr.isComplex), @(_repr.boxDrawing), @(_repr.thinStrokes), @(_repr.drawable), @(_repr.typeface)]; } private: inline std::size_t compute_hash() const { std::size_t seed = 0; hash_combine(seed, _repr.code); hash_combine(seed, _repr.isComplex); hash_combine(seed, _repr.boxDrawing); hash_combine(seed, _repr.thinStrokes); // No need to include _repr.drawable because we just skip those glyphs. hash_combine(seed, _repr.typeface); return seed; } }; } namespace std { template <> struct hash<iTerm2::GlyphKey> { std::size_t operator()(const iTerm2::GlyphKey& glyphKey) const { return glyphKey.get_hash(); } }; }
/* * Suspend support specific for power. * * Distribute under GPLv2 * * Copyright (c) 2002 Pavel Machek <pavel@ucw.cz> * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> */ #include <linux/mm.h> #include <asm/page.h> /* References to section boundaries */ extern const void __nosave_begin, __nosave_end; /* * pfn_is_nosave - check if given pfn is in the 'nosave' section */ int pfn_is_nosave(unsigned long pfn) { unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT; unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) >> PAGE_SHIFT; return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); }
/* * $Id$ * * This file is part of the bip project * Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez * * 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. * See the file "COPYING" for the exact licensing terms. */ #include "config.h" #include "line.h" #include "util.h" void irc_line_init(struct line *l) { memset(l, 0, sizeof(struct line)); array_init(&l->words); } void _irc_line_deinit(struct line *l) { array_deinit(&l->words); } struct line *irc_line_new() { struct line *l; l = bip_malloc(sizeof(struct line)); irc_line_init(l); return l; } void irc_line_write(struct line *l, connection_t *c) { char *bytes = irc_line_to_string(l); write_line(c, bytes); free(bytes); } struct line *irc_line_dup(struct line *line) { int i; struct line *nl = irc_line_new(); char *ptr; nl->origin = line->origin ? bip_strdup(line->origin) : NULL; array_each(&line->words, i, ptr) array_set(&nl->words, i, bip_strdup(ptr)); nl->colon = line->colon; return nl; } char *irc_line_pop(struct line *l) { return (char *)array_pop(&l->words); } void _irc_line_append(struct line *l, const char *s) { array_push(&l->words, (char *)s); } void irc_line_append(struct line *l, const char *s) { _irc_line_append(l, bip_strdup(s)); } char *irc_line_to_string(struct line *l) { size_t len = 0; int i; char *ret; if (l->origin) len = strlen(l->origin) + 2; for (i = 0; i < array_count(&l->words); i++) len += strlen(array_get(&l->words, i)) + 1; len += 1; /* remove one trailing space and add \r\n */ len++; /* last args ":" */ ret = bip_malloc(len + 1); ret[0] = 0; if (l->origin) { strcat(ret, ":"); strcat(ret, l->origin); strcat(ret, " "); } for (i = 0; i < array_count(&l->words) - 1; i++) { strcat(ret, array_get(&l->words, i)); strcat(ret, " "); } if (strchr(array_get(&l->words, i), ' ') || l->colon) strcat(ret, ":"); strcat(ret, array_get(&l->words, i)); strcat(ret, "\r\n"); return ret; } char *irc_line_to_string_to(struct line *line, char *nick) { char *tmp; char *l; tmp = (char *)irc_line_elem(line, 1); array_set(&line->words, 1, nick); l = irc_line_to_string(line); array_set(&line->words, 1, tmp); return l; } int irc_line_count(struct line *line) { return array_count(&line->words); } int irc_line_includes(struct line *line, int elem) { return array_includes(&line->words, elem); } const char *irc_line_elem(struct line *line, int elem) { return array_get(&line->words, elem); } void irc_line_drop(struct line *line, int elem) { free(array_drop(&line->words, elem)); } int irc_line_elem_equals(struct line *line, int elem, const char *cmp) { return !strcmp(irc_line_elem(line, elem), cmp); } int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp) { return !strcasecmp(irc_line_elem(line, elem), cmp); } /* * takes a null terminated string as input w/o \r\n */ struct line *irc_line_new_from_string(char *str) { struct line *line; char *space; size_t len; line = irc_line_new(); if (str[0] == ':') { space = str + 1; while (*space && *space != ' ') space++; if (!*space) { irc_line_free(line); return NULL; } len = space - str - 1; /* leading ':' */ line->origin = bip_malloc(len + 1); memcpy(line->origin, str + 1, len); line->origin[len] = 0; str = space; } while (*str == ' ') str++; while (*str) { char *tmp; space = str; if (*space == ':') { line->colon = 1; str++; while (*space) space++; } else { while (*space && *space != ' ') space++; } len = space - str; tmp = bip_malloc(len + 1); memcpy(tmp, str, len); tmp[len] = 0; if (array_count(&line->words) == 0) strucase(tmp); array_push(&line->words, tmp); str = space; while (*str == ' ') str++; } return line; } void irc_line_free(struct line *l) { int i; for (i = 0; i < array_count(&l->words); i++) free(array_get(&l->words, i)); array_deinit(&l->words); if (l->origin) free(l->origin); free(l); } void irc_line_free_args(char **elemv, int elemc) { int i; if (elemc == 0) return; for (i = 0; i < elemc; i++) free(elemv[i]); free(elemv); }
/* * Copyright 2012, Intel Corporation * * This program file is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License * along with this program in a file named COPYING; if not, write to the * Free Software Foundation, Inc, * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * or just google for it. * * Authors: * Chen Guobing <guobing.chen@intel.com> */ #ifndef GENFPS_H #define GENFPS_H #include <X11/Xlib.h> #include <X11/extensions/XTest.h> #include <X11/extensions/Xdamage.h> #include <signal.h> #include <vector> #define SAMPLE_FPS 0 #define SAMPLE_TIMESTAMP 1 class EffectHunter { public: static EffectHunter * genInstance(long winId, int mode, int sampleCount); ~EffectHunter(); void collectFPS(); public: void processAlarm(); static void stop(); private: EffectHunter(long winId, int mode, int sampleCount); void printEvent(XEvent * event); private: long mWinId; int mScreen; Display * mXWindowDisplay; int mMode; int mSampleCount; int mFPSCount; int mFPS; float mAvgFPS; bool mTermFlag; std::vector<int> mFPSs; struct timeval * mLastXDamageEventTimeStamp; struct timeval * mFirstXDamageEventTimeStamp; static EffectHunter * smObject; }; #endif
/* * Mathlib : A C Library of Special Functions * Copyright (C) 2000-2018 The R Core Team * Copyright (C) 1998 Ross Ihaka * * 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, a copy is available at * https://www.R-project.org/Licenses/ * * SYNOPSIS * * #include <Rmath.h> * double lgammafn_sign(double x, int *sgn); * double lgammafn(double x); * * DESCRIPTION * * The function lgammafn computes log|gamma(x)|. The function * lgammafn_sign in addition assigns the sign of the gamma function * to the address in the second argument if this is not NULL. * * NOTES * * This routine is a translation into C of a Fortran subroutine * by W. Fullerton of Los Alamos Scientific Laboratory. * * The accuracy of this routine compares (very) favourably * with those of the Sun Microsystems portable mathematical * library. */ #include "nmath.h" double lgammafn_sign(double x, int *sgn) { double ans, y, sinpiy; #ifdef NOMORE_FOR_THREADS static double xmax = 0.; static double dxrel = 0.; if (xmax == 0) {/* initialize machine dependent constants _ONCE_ */ xmax = d1mach(2)/log(d1mach(2));/* = 2.533 e305 for IEEE double */ dxrel = sqrt (d1mach(4));/* sqrt(Eps) ~ 1.49 e-8 for IEEE double */ } #else /* For IEEE double precision DBL_EPSILON = 2^-52 = 2.220446049250313e-16 : xmax = DBL_MAX / log(DBL_MAX) = 2^1024 / (1024 * log(2)) = 2^1014 / log(2) dxrel = sqrt(DBL_EPSILON) = 2^-26 = 5^26 * 1e-26 (is *exact* below !) */ #define xmax 2.5327372760800758e+305 #define dxrel 1.490116119384765625e-8 #endif if (sgn != NULL) *sgn = 1; #ifdef IEEE_754 if(ISNAN(x)) return x; #endif if (sgn != NULL && x < 0 && fmod(floor(-x), 2.) == 0) *sgn = -1; if (x <= 0 && x == trunc(x)) { /* Negative integer argument */ // No warning: this is the best answer; was ML_WARNING(ME_RANGE, "lgamma"); return ML_POSINF;/* +Inf, since lgamma(x) = log|gamma(x)| */ } y = fabs(x); if (y < 1e-306) return -log(y); // denormalized range, R change if (y <= 10) return log(fabs(gammafn(x))); /* ELSE y = |x| > 10 ---------------------- */ if (y > xmax) { // No warning: +Inf is the best answer return ML_POSINF; } if (x > 0) { /* i.e. y = x > 10 */ #ifdef IEEE_754 if(x > 1e17) return(x*(log(x) - 1.)); else if(x > 4934720.) return(M_LN_SQRT_2PI + (x - 0.5) * log(x) - x); else #endif return M_LN_SQRT_2PI + (x - 0.5) * log(x) - x + lgammacor(x); } /* else: x < -10; y = -x */ sinpiy = fabs(sinpi(y)); if (sinpiy == 0) { /* Negative integer argument === Now UNNECESSARY: caught above */ MATHLIB_WARNING(" ** should NEVER happen! *** [lgamma.c: Neg.int, y=%g]\n",y); ML_WARN_return_NAN; } ans = M_LN_SQRT_PId2 + (x - 0.5) * log(y) - x - log(sinpiy) - lgammacor(y); if(fabs((x - trunc(x - 0.5)) * ans / x) < dxrel) { /* The answer is less than half precision because * the argument is too near a negative integer. */ ML_WARNING(ME_PRECISION, "lgamma"); } return ans; } double lgammafn(double x) { return lgammafn_sign(x, NULL); }
/* Copyright 2006-2012 Xavier Guerrin This file is part of QElectroTech. QElectroTech 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. QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TITLEBLOCK_SLASH_INTEGRATION_MOVE_TEMPLATES_HANDLER_H #define TITLEBLOCK_SLASH_INTEGRATION_MOVE_TEMPLATES_HANDLER_H #include "movetemplateshandler.h" #include <QtGui> /** This class implements the interface defined by MoveTitleBlockTemplatesHandler to ease the integration of title block templates from files-based collections into projects. */ class IntegrationMoveTitleBlockTemplatesHandler : public MoveTitleBlockTemplatesHandler { Q_OBJECT // constructors, destructor public: IntegrationMoveTitleBlockTemplatesHandler(QWidget * = 0); virtual ~IntegrationMoveTitleBlockTemplatesHandler(); private: IntegrationMoveTitleBlockTemplatesHandler(const IntegrationMoveTitleBlockTemplatesHandler &); // methods public: virtual QET::Action templateAlreadyExists(const TitleBlockTemplateLocation &src, const TitleBlockTemplateLocation &dst); virtual QET::Action errorWithATemplate(const TitleBlockTemplateLocation &, const QString &); virtual QString nameForRenamingOperation(); private: QString dateString() const; QString newNameForTemplate(const TitleBlockTemplateLocation &); QET::Action askUser(const TitleBlockTemplateLocation &, const TitleBlockTemplateLocation &); void initDialog(); void radioButtonleftMargin(QRadioButton *); private slots: void correctRadioButtons(); // attributes private: QWidget *parent_widget_; ///< Widget used as parent to display dialogs QString rename_; ///< Name to be used when renaming a title block template QDialog *integ_dialog_; ///< Dialog in case of conflict when integrating a title block template QLabel *dialog_label_; QVBoxLayout *dialog_vlayout_; QGridLayout *dialog_glayout; QDialogButtonBox *buttons_; QRadioButton *use_existing_template_; ///< Radio button the user may click to use the existing template and stop the integration QRadioButton *integrate_new_template_; ///< Radio button the user may click to integrate the template QRadioButton *erase_template_; ///< Radio button the user may click for the integrated template to erase the existing one /* Radio button the user may click for the integrated template to be automatically renamed in order to be stored along with the existing one. */ QRadioButton *integrate_both_; QButtonGroup *button_group1_; QButtonGroup *button_group2_; }; #endif
/****************************************************************************** * machine_kexec.c * * Xen port written by: * - Simon 'Horms' Horman <horms@verge.net.au> * - Magnus Damm <magnus@valinux.co.jp> */ #ifndef CONFIG_COMPAT #include <xen/types.h> #include <asm/page.h> #include <public/kexec.h> int machine_kexec_get_xen(xen_kexec_range_t *range) { range->start = xenheap_phys_start; range->size = (unsigned long)xenheap_phys_end - (unsigned long)range->start; return 0; } #endif /* * Local variables: * mode: C * c-set-style: "BSD" * c-basic-offset: 4 * tab-width: 4 * indent-tabs-mode: nil * End: */
/* * This library is licensed under 2 different licenses and you * can choose to use it under the terms of either one of them. The * two licenses are the MPL 1.1 and the LGPL. * * MPL: * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * LGPL: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * The Original Code is Fluendo MPEG Demuxer plugin. * * The Initial Developer of the Original Code is Fluendo, S.L. * Portions created by Fluendo, S.L. are Copyright (C) 2005 * Fluendo, S.L. All Rights Reserved. * * Contributor(s): Jan Schmidt <jan@fluendo.com> */ #ifndef __FLUTS_PMT_INFO_H__ #define __FLUTS_PMT_INFO_H__ #include <glib.h> #include "flutspmtstreaminfo.h" G_BEGIN_DECLS typedef struct FluTsPmtInfoClass { GObjectClass parent_class; } FluTsPmtInfoClass; typedef struct FluTsPmtInfo { GObject parent; guint16 program_no; guint16 pcr_pid; guint8 version_no; GValueArray *descriptors; GValueArray *streams; } FluTsPmtInfo; FluTsPmtInfo *fluts_pmt_info_new (guint16 program_no, guint16 pcr_pid, guint8 version); void fluts_pmt_info_add_stream (FluTsPmtInfo *pmt_info, FluTsPmtStreamInfo *stream); void fluts_pmt_info_add_descriptor (FluTsPmtInfo *pmt_info, const gchar *descriptor, guint length); GType fluts_pmt_info_get_type (void); #define FLUTS_TYPE_PMT_INFO (fluts_pmt_info_get_type ()) #define FLUTS_IS_PMT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), FLUTS_TYPE_PMT_INFO)) #define FLUTS_PMT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),FLUTS_TYPE_PMT_INFO, FluTsPmtInfo)) G_END_DECLS #endif
/* * @OPENGROUP_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. * * This software is subject to an open license. It may only be * used on, with or for operating systems which are themselves open * source systems. You must contact The Open Group for a license * allowing distribution and sublicensing of this software on, with, * or for operating systems which are not Open Source programs. * * See http://www.opengroup.org/openmotif/license for full * details of the license agreement. Any use, reproduction, or * distribution of the program constitutes recipient's acceptance of * this agreement. * * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS * PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY * WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY * OR FITNESS FOR A PARTICULAR PURPOSE * * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT * NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE * EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * */ /* * HISTORY */ /* $XConsortium: MenuShellI.h /main/5 1995/07/13 17:36:29 drk $ */ #ifndef _XmMenuShellI_h #define _XmMenuShellI_h #include <Xm/MenuShellP.h> #ifdef __cplusplus extern "C" { #endif /******** Private Function Declarations ********/ extern void _XmEnterRowColumn( Widget widget, XtPointer closure, XEvent *event, Boolean *cont) ; extern void _XmClearTraversal( Widget wid, XEvent *event, String *params, Cardinal *num_params) ; extern void _XmSetLastManagedMenuTime( Widget wid, Time newTime ) ; extern void _XmPopupSpringLoaded( Widget shell ) ; extern void _XmPopdown( Widget shell ) ; /******** End Private Function Declarations ********/ #ifdef __cplusplus } /* Close scope of 'extern "C"' declaration which encloses file. */ #endif #endif /* _XmMenuShellI_h */ /* DON'T ADD ANYTHING AFTER THIS #endif */
/* Copyright (C) 2014 Aseman http://aseman.co This project 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 project 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 ASEMANQUICKVIEW_H #define ASEMANQUICKVIEW_H #include <QQuickView> #include <QQmlEngine> #ifdef ASEMAN_QML_PLUGIN #define INHERIT_VIEW QObject #else #define INHERIT_VIEW QQuickView #endif class AsemanBackHandler; class AsemanDesktopTools; class AsemanDevices; class AsemanJavaLayer; class AsemanQtLogger; class AsemanTools; class AsemanCalendarConverter; class AsemanQuickViewPrivate; class AsemanQuickView : public INHERIT_VIEW { Q_OBJECT Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged) Q_PROPERTY(qreal statusBarHeight READ statusBarHeight NOTIFY statusBarHeightChanged) Q_PROPERTY(qreal navigationBarHeight READ navigationBarHeight NOTIFY navigationBarHeightChanged) Q_PROPERTY(QObject* root READ root WRITE setRoot NOTIFY rootChanged) Q_PROPERTY(QQuickItem* focusedText READ focusedText WRITE setFocusedText NOTIFY focusedTextChanged) Q_PROPERTY(int layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(qreal flickVelocity READ flickVelocity NOTIFY fakeSignal) public: enum OptionsFlag { None = 0, DesktopTools = 1, Devices = 2, JavaLayer = 4, QtLogger = 8, Tools = 16, Calendar = 32, BackHandler = 64, AllComponents = 127, AllExceptLogger = 119 }; #ifdef ASEMAN_QML_PLUGIN AsemanQuickView(QQmlEngine *engine, QObject *parent = 0); #else AsemanQuickView( int options = Devices|BackHandler, QWindow *parent = 0); #endif ~AsemanQuickView(); AsemanDesktopTools *desktopTools() const; AsemanDevices *devices() const; AsemanQtLogger *qtLogger() const; AsemanTools *tools() const; #ifdef Q_OS_ANDROID AsemanJavaLayer *javaLayer() const; #endif AsemanCalendarConverter *calendar() const; AsemanBackHandler *backHandler() const; void setFullscreen( bool stt ); bool fullscreen() const; qreal statusBarHeight() const; qreal navigationBarHeight() const; void setRoot( QObject *root ); QObject *root() const; void setFocusedText( QQuickItem *item ); QQuickItem *focusedText() const; int layoutDirection() const; void setLayoutDirection( int l ); qreal flickVelocity() const; public slots: void discardFocusedText(); signals: void fullscreenChanged(); void statusBarHeightChanged(); void navigationBarHeightChanged(); void rootChanged(); void focusedTextChanged(); void layoutDirectionChanged(); void fakeSignal(); private slots: void init_options(); private: AsemanQuickViewPrivate *p; }; #endif // ASEMANQUICKVIEW_H
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_telephony_CallsList_h__ #define mozilla_dom_telephony_CallsList_h__ #include "mozilla/dom/telephony/TelephonyCommon.h" #include "nsWrapperCache.h" namespace mozilla { namespace dom { class CallsList MOZ_FINAL : public nsISupports, public nsWrapperCache { nsRefPtr<Telephony> mTelephony; nsRefPtr<TelephonyCallGroup> mGroup; public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CallsList) CallsList(Telephony* aTelephony, TelephonyCallGroup* aGroup = nullptr); nsPIDOMWindow* GetParentObject() const; // WrapperCache virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE; // CallsList WebIDL already_AddRefed<TelephonyCall> Item(uint32_t aIndex) const; uint32_t Length() const; already_AddRefed<TelephonyCall> IndexedGetter(uint32_t aIndex, bool& aFound) const; private: ~CallsList(); }; } // namespace dom } // namespace mozilla #endif // mozilla_dom_telephony_CallsList_h__
/* * This file is part of the tknet project. * which be used under the terms of the GNU General Public * License version 3.0 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included * in the packaging of this file. Please review the following * information to ensure the GNU General Public License * version 3.0 requirements will be met: * http://www.gnu.org/copyleft/gpl.html * * Copyright (C) 2012 Zhong Wei <clock126@126.com> . */ struct SessionMaintainProcess { struct Process proc; struct Sock *pSock; struct NetAddr addr; struct pipe *pPipe; BOOL ifAlive; }; void SessionStart(struct NetAddr ,struct Sock *,struct ProcessingList *,struct Iterator* ,struct Iterator *); #define SES_DAT_FLAG TK_NET_BDG_MSG_FLAG + 1 #define SES_MAINTAIN_FLAG TK_NET_BDG_MSG_FLAG + 2 #define SES_CMD_FLAG TK_NET_BDG_MSG_FLAG + 3 #define SES_CHAT_FLAG TK_NET_BDG_MSG_FLAG + 4 void MkCmdModePipe(); void MkChatModePipe();
#ifndef ABSTRACTVTKRENDERER_H #define ABSTRACTVTKRENDERER_H #include "AbstractRenderer.h" #include <vtkSmartPointer.h> #include "UIReporterDelegates.h" class vtkRenderer; class vtkRenderWindow; class vtkGenericOpenGLRenderWindow; class vtkRenderWindowInteractor; /** * @brief The child of AbstractRenderer that holds a VTK render window * and can render VTK objects such as polydata. This class also holds an * interactor, which can be connected to a widget's events. However, by * default, interaction is disabled, and must be enabled by calling * SetInteractionStyle */ class AbstractVTKRenderer : public AbstractRenderer { public: irisITKObjectMacro(AbstractVTKRenderer, AbstractRenderer) /** * @brief Enums corresponding to different VTK interaction styles */ enum InteractionStyle { NO_INTERACTION = 0, TRACKBALL_CAMERA, TRACKBALL_ACTOR, PICKER }; virtual void paintGL() ITK_OVERRIDE; virtual void resizeGL(int w, int h, int device_pixel_ratio) ITK_OVERRIDE; virtual void initializeGL() ITK_OVERRIDE; vtkRenderWindow *GetRenderWindow(); vtkRenderWindowInteractor *GetRenderWindowInteractor(); void SetInteractionStyle(InteractionStyle style); /** * Synchronizes camera with another instance of this class. Internally, * this copies the camera pointer from the reference object. */ void SyncronizeCamera(Self *reference); irisGetSetMacro(BackgroundColor, Vector3d) protected: // Render window object used to render VTK stuff vtkSmartPointer<vtkGenericOpenGLRenderWindow> m_RenderWindow; vtkSmartPointer<vtkRenderer> m_Renderer; // The interactor vtkSmartPointer<vtkRenderWindowInteractor> m_Interactor; // The device pixel ratio (1 for regular screens, 2 for retina) // This is updated in resizeGL int m_DevicePixelRatio; // Background color Vector3d m_BackgroundColor; // Virtual method called when the device pixel ratio changes, allowing // the child classes to update some properties (e.g., font size) virtual void OnDevicePixelRatioChange(int old_ratio, int new_ratio) {} AbstractVTKRenderer(); virtual ~AbstractVTKRenderer() {} }; #endif // ABSTRACTVTKRENDERER_H
// // Copyright (c) 2009-2015 Glen Berseth, Mubbasir Kapadia, Shawn Singh, Petros Faloutsos, Glenn Reinman, Rahul Shome // See license.txt for complete license. // #ifndef __STEERLIB_A_STAR_PLANNER_H__ #define __STEERLIB_A_STAR_PLANNER_H__ #include <vector> #include <stack> #include <set> #include <map> #include "SteerLib.h" namespace SteerLib { /* @function The AStarPlannerNode class gives a suggested container to build your search tree nodes. @attributes f : the f value of the node g : the cost from the start, for the node point : the point in (x,0,z) space that corresponds to the current node parent : the pointer to the parent AStarPlannerNode, so that retracing the path is possible. @operators The greater than, less than and equals operator have been overloaded. This means that objects of this class can be used with these operators. Change the functionality of the operators depending upon your implementation */ class STEERLIB_API AStarPlannerNode{ public: double f; double g; Util::Point point; AStarPlannerNode* parent; AStarPlannerNode(Util::Point _point, double _g, double _f, AStarPlannerNode* _parent) { f = _f; point = _point; g = _g; parent = _parent; } bool operator<(AStarPlannerNode other) const { return this->f < other.f; } bool operator>(AStarPlannerNode other) const { return this->f > other.f; } bool operator==(AStarPlannerNode other) const { return ((this->point.x == other.point.x) && (this->point.z == other.point.z)); } }; class STEERLIB_API AStarPlanner{ public: AStarPlanner(); ~AStarPlanner(); // NOTE: There are four indices that need to be disambiguated // -- Util::Points in 3D space(with Y=0) // -- (double X, double Z) Points with the X and Z coordinates of the actual points // -- (int X_GRID, int Z_GRID) Points with the row and column coordinates of the GridDatabase2D. The Grid database can start from any physical point(say -100,-100). So X_GRID and X need not match // -- int GridIndex is the index of the GRID data structure. This is an unique id mapping to every cell. // When navigating the space or the Grid, do not mix the above up /* @function canBeTraversed checkes for a OBSTACLE_CLEARANCE area around the node index id for the presence of obstacles. The function finds the grid coordinates for the cell index as (X_GRID, Z_GRID) and checks cells in bounding box area [[X_GRID-OBSTACLE_CLEARANCE, X_GRID+OBSTACLE_CLEARANCE], [Z_GRID-OBSTACLE_CLEARANCE, Z_GRID+OBSTACLE_CLEARANCE]] This function also contains the griddatabase call that gets traversal costs. */ bool canBeTraversed ( int id ); /* @function getPointFromGridIndex accepts the grid index as input and returns an Util::Point corresponding to the center of that cell. */ Util::Point getPointFromGridIndex(int id); /* @function computePath DO NOT CHANGE THE DEFINITION OF THIS FUNCTION This function executes an A* query @parameters agent_path : The solution path that is populated by the A* search start : The start point goal : The goal point _gSpatialDatabase : The pointer to the GridDatabase2D from the agent append_to_path : An optional argument to append to agent_path instead of overwriting it. */ bool computePath(std::vector<Util::Point>& agent_path, Util::Point start, Util::Point goal, SteerLib::GridDatabase2D * _gSpatialDatabase, bool append_to_path = false); private: SteerLib::GridDatabase2D * gSpatialDatabase; }; } #endif
#ifndef MANTID_CURVEFITTING_COMPLEXVECTOR_H_ #define MANTID_CURVEFITTING_COMPLEXVECTOR_H_ #include "MantidCurveFitting/DllConfig.h" #include <gsl/gsl_vector.h> #include <ostream> #include <vector> #include <complex> namespace Mantid { namespace CurveFitting { typedef std::complex<double> ComplexType; class ComplexVector; /// Struct helping converting complex values /// between ComplexType and internal type of /// ComplexVector struct ComplexVectorValueConverter { ComplexVector &m_vector; size_t m_index; ComplexVectorValueConverter(ComplexVector &vector, size_t i) : m_vector(vector), m_index(i) {} operator ComplexType() const; ComplexVectorValueConverter &operator=(const ComplexType &c); }; /** A complex-valued vector for linear algebra computations. Copyright &copy; 2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid 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. Mantid 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 change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ class MANTID_CURVEFITTING_DLL ComplexVector { public: /// Constructor ComplexVector(); /// Destructor ~ComplexVector(); /// Constructor explicit ComplexVector(const size_t n); /// Copy from a gsl vector explicit ComplexVector(const gsl_vector_complex *v); /// Copy constructor. ComplexVector(const ComplexVector &v); /// Move constructor. ComplexVector(ComplexVector &&v); /// Copy assignment operator ComplexVector &operator=(const ComplexVector &v); /// Move assignment operator ComplexVector &operator=(ComplexVector &&v); /// Get the pointer to the GSL vector gsl_vector_complex *gsl(); /// Get the pointer to the GSL vector const gsl_vector_complex *gsl() const; /// Resize the vector void resize(const size_t n); /// Size of the vector size_t size() const; /// Set an element void set(size_t i, const ComplexType &value); /// Get an element ComplexType get(size_t i) const; // Set all elements to zero void zero(); /// Get a "const reference" to an element. const ComplexVectorValueConverter operator[](size_t i) const { return ComplexVectorValueConverter(const_cast<ComplexVector &>(*this), i); } /// Get a "reference" to an element. ComplexVectorValueConverter operator[](size_t i) { return ComplexVectorValueConverter(*this, i); } /// Add a vector ComplexVector &operator+=(const ComplexVector &v); /// Subtract a vector ComplexVector &operator-=(const ComplexVector &v); /// Multiply by a number ComplexVector &operator*=(const ComplexType d); protected: /// Create a new ComplexVector and move all data to it. Destroys this vector. ComplexVector move(); private: /// Constructor ComplexVector(gsl_vector_complex *&&gslVector); /// The pointer to the GSL vector gsl_vector_complex *m_vector; }; /// The << operator. MANTID_CURVEFITTING_DLL std::ostream &operator<<(std::ostream &ostr, const ComplexVector &v); /// Convert an internal complex value (GSL type) to ComplexType. inline ComplexVectorValueConverter::operator ComplexType() const { return m_vector.get(m_index); } /// Convert a value of ComplexType to the internal complex value (GSL type). inline ComplexVectorValueConverter &ComplexVectorValueConverter:: operator=(const ComplexType &c) { m_vector.set(m_index, c); return *this; } /// Equality operator inline bool operator==(const ComplexType &c, const ComplexVectorValueConverter &conv) { return c == static_cast<ComplexType>(conv); } /// Equality operator inline bool operator==(const ComplexVectorValueConverter &conv, const ComplexType &c) { return c == static_cast<ComplexType>(conv); } /// Multiplication operator inline ComplexType operator*(const ComplexVectorValueConverter &conv, const ComplexType &c) { return static_cast<ComplexType>(conv) * c; } /// Multiplication operator inline ComplexType operator*(const ComplexType &c, const ComplexVectorValueConverter &conv) { return c * static_cast<ComplexType>(conv); } } // namespace CurveFitting } // namespace Mantid #endif /*MANTID_CURVEFITTING_COMPLEXVECTOR_H_*/
#include <stdio.h> #include <stdlib.h> #define MAX 20 int main() { int i, j, studenti; double postotak, tablica[MAX][4] = {{0}}, prolaznost[4] = {}, pomocna[4] = {}; for(i=0; i<MAX; i++){ scanf("%d", &studenti); if(studenti<2 || studenti>10){ printf("Pogresan unos broja. Unesite ponovno broj studenata:\n"); continue; } else { break; } } for(i = 0; i<studenti; i++){ for(j = 0; j<4; j++){ scanf("%lf", &postotak); tablica[i][j] = postotak; } } for(i = 0; i<studenti; i++){ for(j = 0; j<4; j++){ if(tablica[i][j]>=50 && tablica[i][j]<= 100){ prolaznost[j]++; } } } for(i = 0; i<4; i++){ pomocna[i] = (100.00/studenti)*prolaznost[i]; } printf("Prolaznost:\n"); for(i = 0; i<studenti; i++){ for(j = 0; j<4; j++){ if(j<=2){ printf("%.0lf\t", tablica[i][j]);} else{ printf("%.0lf", tablica[i][j]); } } printf("\n"); } for(i = 0; i<4; i++){ if(i<=2){ printf("%.0lf\t", pomocna[i]); } else{ printf("%.0lf", pomocna[i]); } } return 0; }
/****************************************************************************** * _ _ _ _ * * _ __ ___ _ _ __| | __| | | ___ __| | * * | '_ ` _ \| | | |/ _` |/ _` | |/ _ \/ _` | * * | | | | | | |_| | (_| | (_| | | __/ (_| | * * |_| |_| |_|\__,_|\__,_|\__,_|_|\___|\__,_| * * * * (C) 2010 by Ryan Jennings <c0der78@gmail.com> www.arg3.com * * Many thanks to creators of muds before me. * * * * In order to use any part of this Mud, you must comply with the * * license in 'license.txt'. In particular, you may not remove either * * of these copyright notices. * * * * Much time and thought has gone into this software and you are * * benefitting. I hope that you share your changes too. What goes * * around, comes around. * ******************************************************************************/ #include "area.h" #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include "db.h" #include "exit.h" #include "flag.h" #include "log.h" #include "lookup.h" #include "macro.h" #include "nonplayer.h" #include "object.h" #include "private.h" #include "room.h" #include "str.h" Area *first_area = 0; int max_area = 0; const Lookup area_flags[] = {{"noexplore", AREA_NOEXPLORE}, {"changed", AREA_CHANGED}, {0, 0}}; Area *new_area() { Area *area = (Area *)alloc_mem(1, sizeof(Area)); area->name = str_empty; area->npcs = 0; area->flags = new_flag(); return area; } void destroy_area(Area *area) { free_str(area->name); destroy_flags(area->flags); free_mem(area); } void load_area_columns(Area *area, sql_stmt *stmt) { int count = sql_column_count(stmt); for (int i = 0; i < count; i++) { const char *colname = sql_column_name(stmt, i); if (!str_cmp(colname, "areaId")) { area->id = sql_column_int(stmt, i); } else if (!str_cmp(colname, "name")) { area->name = str_dup(sql_column_str(stmt, i)); } else if (!str_cmp(colname, "flags")) { parse_flags(area->flags, sql_column_str(stmt, i), area_flags); } else { log_warn("unknown column %s for area", colname); } } } Area *load_area(identifier_t id) { char buf[500]; sql_stmt *stmt; Area *area = 0; int len = sprintf(buf, "select * from area where areaId = %" PRId64 " limit 1", id); if (sql_query(buf, len, &stmt) != SQL_OK) { log_data("could not prepare statement"); return 0; } if (sql_step(stmt) != SQL_DONE) { area = new_area(); load_area_columns(area, stmt); log_info("loaded %s (%d npcs, %d objs, %d rooms)", area->name, load_npcs(area), load_objects(area), load_rooms(area)); LINK(first_area, area, next); max_area++; } if (sql_finalize(stmt) != SQL_OK) { log_data("could not finalize statement"); } return area; } int load_areas() { char buf[500]; sql_stmt *stmt; int total = 0; int len = sprintf(buf, "select * from area"); if (sql_query(buf, len, &stmt) != SQL_OK) { log_data("could not prepare statement"); return 0; } while (sql_step(stmt) != SQL_DONE) { Area *area = new_area(); load_area_columns(area, stmt); log_info("loaded %s (%d npcs, %d objs, %d rooms)", area->name, load_npcs(area), load_objects(area), load_rooms(area)); LINK(first_area, area, next); total++; max_area++; } if (sql_finalize(stmt) != SQL_OK) { log_data("could not finalize statement"); } finalize_exits(); return total; } Area *get_area_by_id(identifier_t id) { for (Area *area = first_area; area != 0; area = area->next) { if (area->id == id) { return area; } } return 0; } int save_area_only(Area *area) { remove_bit(area->flags, AREA_CHANGED); field_map area_values[] = {{"areaId", &area->id, SQL_INT}, {"name", &area->name, SQL_TEXT}, {"flags", &area->flags, SQL_FLAG, area_flags}, {0}}; if (area->id == 0) { if (sql_insert_query(area_values, "area") != SQL_OK) { log_data("could not insert area"); return 0; } area->id = db_last_insert_rowid(); } else { if (sql_update_query(area_values, "area", area->id) != SQL_OK) { log_data("could not update area"); return 0; } } return 1; } int save_area(Area *area) { db_begin_transaction(); save_area_only(area); for (Object *obj = area->objects; obj; obj = obj->next_in_area) { save_object(obj); } for (Character *npc = area->npcs; npc; npc = npc->next_in_area) { save_npc(npc); } for (Room *room = area->rooms; room; room = room->next_in_area) { save_room(room); } db_end_transaction(); return 1; } Area *area_lookup(const char *arg) { if (!arg || !*arg) { return 0; } if (is_number(arg)) { return get_area_by_id(atoi(arg)); } for (Area *area = first_area; area != 0; area = area->next) { if (!str_prefix(arg, strip_color(area->name))) { return area; } } return 0; } Area *get_default_area() { if (first_area != 0) { return first_area; } Area *area = new_area(); area->name = "The Default Area"; LINK(first_area, area, next); max_area++; return area; }
//---------------------------------------------------------------------------- /** @file GoModBoard.h */ //---------------------------------------------------------------------------- #ifndef GO_MODBOARD_H #define GO_MODBOARD_H #include "GoAssertBoardRestored.h" //---------------------------------------------------------------------------- /** Make a const board temporarily modifiable. Allows functions to use a const board for performing temporary operations on the board (e.g. searches), as long as the board is in the same state after the function is finished. This class facilitates const-correctness and encapsulation, because it allows the owner of a board, which is the only one who is allowed to do persistent changes on the board, to hand out only a const reference to other code. The other code can still use the board for temporary operations without needing a copy of the board. GoModBoard does a const_cast from the const reference to a non-const reference in its constructor and checks with GoAssertBoardRestored in its destructor that the board is returned in the same state. Example: @code // myFunction is not supposed to do persistent changes on the board // and therefore gets a const-reference. However it wants to use // the board temporarily void myFunction(const GoBoard& constBoard) { GoModBoard modBoard(constBoard); GoBoard& bd = modBoard.Board(); // get a nonconst-reference // ... play some moves and undo them // end of lifetime for modBoard, GoAssertBoardRestored is // automatically called in the destructor of modBoard } @endcode There are also functions that allow to lock and unlock the board explicitly, for cases in which the period of temporary modifications cannot be mapped to the lifetime of a GoModBoard instance (e.g. because the period starts end ends in different functions). */ class GoModBoard { public: /** Constructor. Remembers the current board state. @param bd The board @param locked Whether to start in locked mode (for explicit usage of Lock() and Unlock()) */ GoModBoard(const GoBoard& bd, bool locked = false); /** Destructor. Checks with assertions that the board state is restored. */ ~GoModBoard(); /** Explicit conversion to non-const reference. This function triggers an assertion, if the board is currently in locked mode. */ GoBoard& Board() const; /** Automatic conversion to non-const reference. Allows to pass GoModBoard to functions that expect a non-const GoBoard reference without explicitely calling GoModBoard.Board(). @see Board() */ operator GoBoard&() const; /** Explicitely unlock the board. */ void Unlock(); /** Explicitely lock the board. Checks with assertions that the board state is restored. See Lock() */ void Lock(); private: bool m_locked; GoBoard& m_bd; GoAssertBoardRestored m_assertRestored; }; inline GoModBoard::GoModBoard(const GoBoard& bd, bool locked) : m_locked(locked), m_bd(const_cast<GoBoard&>(bd)), m_assertRestored(bd) { } inline GoModBoard::~GoModBoard() { // Destructor of m_assertRestored calls AssertRestored() } inline GoModBoard::operator GoBoard&() const { return Board(); } inline GoBoard& GoModBoard::Board() const { SG_ASSERT(! m_locked); return m_bd; } inline void GoModBoard::Unlock() { m_assertRestored.Init(m_bd); m_locked = false; } inline void GoModBoard::Lock() { m_assertRestored.AssertRestored(); m_assertRestored.Clear(); m_locked = true; } //---------------------------------------------------------------------------- #endif // GO_MODBOARD_H
/* * Copyright 2012-2018 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_GRAPHICS_ANIMATEDPALETTE_H #define FALLTERGEIST_GRAPHICS_ANIMATEDPALETTE_H // C++ standard includes #include <array> #include <vector> // Falltergeist includes #include "../Format/Enums.h" #include "../Graphics/Renderer.h" // Third party includes #include <glm/glm.hpp> namespace Falltergeist { namespace Graphics { class AnimatedPalette { public: AnimatedPalette(); ~AnimatedPalette(); std::vector<GLuint> counters(); void think(); protected: unsigned int _slimeTicks = 0; unsigned int _slimeCounter = 0; unsigned int _fireSlowTicks = 0; unsigned int _fireSlowCounter = 0; unsigned int _fireFastTicks = 0; unsigned int _fireFastCounter = 0; unsigned int _monitorsTicks = 0; unsigned int _monitorsCounter = 0; unsigned int _shoreTicks = 0; unsigned int _shoreCounter = 0; unsigned int _blinkingRedTicks = 0; unsigned char _blinkingRedCounter = 0; short _blinkingRed = -1; }; } } #endif // FALLTERGEIST_GRAPHICS_ANIMATEDPALETTE_H
// // globals.h // // Copyright (c) 2003-2013 Michael F. Henry // #pragma once #include "math.h" namespace Zeptomoby { namespace OrbitTools { const double PI = 3.141592653589793; const double TWOPI = 2.0 * PI; const double RADS_PER_DEG = PI / 180.0; const double GM = 398601.2; // Earth gravitational constant, km^3/sec^2 const double GEOSYNC_ALT = 42241.892; // km const double EARTH_DIA = 12800.0; // km const double DAY_SIDERAL = (23 * 3600) + (56 * 60) + 4.09; // sec const double DAY_24HR = (24 * 3600); // sec const double AE = 1.0; const double AU = 149597870.0; // Astronomical unit (km) (IAU 76) const double SR = 696000.0; // Solar radius (km) (IAU 76) const double XKMPER_WGS72 = 6378.135; // Earth equatorial radius - km (WGS '72) const double F = 1.0 / 298.26; // Earth flattening (WGS '72) const double GE = 398600.8; // Earth gravitational constant (WGS '72) const double J2 = 1.0826158E-3; // J2 harmonic (WGS '72) const double J3 = -2.53881E-6; // J3 harmonic (WGS '72) const double J4 = -1.65597E-6; // J4 harmonic (WGS '72) const double CK2 = J2 / 2.0; const double CK4 = -3.0 * J4 / 8.0; const double XJ3 = J3; const double QO = AE + 120.0 / XKMPER_WGS72; const double S = AE + 78.0 / XKMPER_WGS72; const double HR_PER_DAY = 24.0; // Hours per day (solar) const double MIN_PER_DAY = 1440.0; // Minutes per day (solar) const double SEC_PER_DAY = 86400.0; // Seconds per day (solar) const double OMEGA_E = 1.00273790934; // earth rotation per sideral day const double XKE = sqrt(3600.0 * GE / //sqrt(ge) ER^3/min^2 (XKMPER_WGS72 * XKMPER_WGS72 * XKMPER_WGS72)); const double QOMS2T = pow((QO - S), 4); //(QO - S)^4 ER^4 // Utility functions double sqr (const double x); double Fmod2p(const double arg); double AcTan (const double sinx, const double cosx); double rad2deg(const double); double deg2rad(const double); } }
#ifndef ENTITY_H_INCLUDED #define ENTITY_H_INCLUDED #include "../General/general.h" #include "../Graphics/WindowEntity.h" class NtsaWindow; ///Cette classe ressemble en tout points à VisualEffect mis à part un construxteur légèrement différent class SpaceLaser : public VisualEffect { public: SpaceLaser(){}; SpaceLaser(float x, float y, float height, sf::Time cycleDuration, sf::Time duration=sf::seconds(0)); }; ///Classiquement, une entité représente un élément du niveau qui peut se mouvoir (un ennemi, où même un simple astéroide de passage) \n ///mais également intéragir avec les autres entités via les collisions class Entity : public WindowEntity { public: enum Direction{Up, Down, Front, Back, Nope}; Entity(); Entity(std::string name, unsigned int priority, std::string textureID=""); void stabilize(); void stopMoving(); void stopAcceleration(); void moveSomewere(Direction direction); protected: //The following accelerations change all the time float m_speedUpDown=0; float m_speedFront=0; unsigned int m_lifePoints=100; void setSpeedUpDown(int speed=3); void setSpeedFront(int speed=4); Direction m_directionAcceleration=Direction::Nope;///Direction de l'accélération }; class Player : public Entity { public: Player(); Player(std::string name, unsigned int priority, std::string textureID=""); Player(std::string name, unsigned int priority, unsigned int width, int positionY, std::string textureID=""); void actualiser(NtsaWindow* window); void fire(); private: Timer m_timer; sf::Thread* m_laserThread=nullptr; SpaceLaser m_laser; unsigned int m_energy=10000; float m_acceleration=1.2;///L'accélération de base float m_stepMultiplicator=1.2;///Acceleration de l'accélération }; #endif // ENTITY_H_INCLUDED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> #include <sys/wait.h> #include <time.h> #include <pcap.h> #include "thc-ipv6.h" char *frbuf, *frbuf2, *frint, buf3[1504]; int frbuflen, frbuf2len, do_hop = 0, do_frag = 0, do_dst = 0, type = NXT_ICMP6, seen = 0, ret = -1; unsigned char *frip6, *frmac, *frdst; thc_ipv6_hdr *frhdr = NULL; void help(char *prg) { printf("%s %s (c) 2013 by %s %s\n\n", prg, VERSION, AUTHOR, RESOURCE); printf("Syntax: %s interface target\n\n", prg); printf("Sends an ICMPv6 node query request to the target and dumps the replies.\n\n"); // printf("Use -r to use raw mode.\n\n"); exit(-1); } void dump_node_reply(u_char *foo, const struct pcap_pkthdr *header, const unsigned char *data) { unsigned char *ipv6hdr = (unsigned char *) (data + 14), *ptr; int i, len = header->caplen - 14; if (do_hdr_size) { len = header->caplen - do_hdr_size; ipv6hdr = (unsigned char *) (data + do_hdr_size); if ((ipv6hdr[0] & 240) != 0x60) return; } if (ipv6hdr[6] != NXT_ICMP6 || ipv6hdr[40] != ICMP6_INFOREPLY || len < 40 + 16) return; ret = 0; printf("Reply from %s:\n", thc_ipv62notation(ipv6hdr + 8)); switch (ipv6hdr[45]) { case 2: printf(" DNS result: "); if (len <= 60) { printf("empty\n"); } else { ptr = ipv6hdr + 61; while (*ptr != 0) { if (*ptr > 0 && *ptr < 32) *ptr = '.'; ptr++; } printf("%s\n", ipv6hdr + 61); } seen++; break; case 3: printf(" IPv6 result: "); if (len <= 76) { printf("empty\n"); } else { printf("\n"); i = 60; while (i + 16 <= len) { printf(" %s\n", thc_ipv62notation((char *) (ipv6hdr+ i))); i += 20; } } seen++; break; case 4: printf(" IPv4 result: "); if (len == 56) { printf("empty\n"); } else { printf("\n"); i = 60; while (i + 4 <= len) { printf(" %d.%d.%d.%d\n", ipv6hdr[i], ipv6hdr[i + 1], ipv6hdr[i + 2], ipv6hdr[i + 3]); i += 8; } } seen++; break; default: printf(" Unknown type (%d) we did not send!\n", ipv6hdr[45]); } printf("\n"); } void clean_exit(int sig) { exit(0); } int main(int argc, char *argv[]) { char *interface, mac[6] = "", string[] = "ip6 and icmp6"; unsigned char *mac6 = mac; unsigned char buf[512]; unsigned char *dst; int i, cnt; unsigned char *pkt = NULL; int pkt_len = 0; int rawmode = 0; pcap_t *p; if (argc != 3 || strncmp(argv[1], "-h", 2) == 0) help(argv[0]); while ((i = getopt(argc, argv, "r")) >= 0) { switch (i) { case 'r': thc_ipv6_rawmode(1); rawmode = 1; break; default: fprintf(stderr, "Error: invalid option %c\n", i); exit(-1); } } interface = argv[optind]; mac6 = thc_get_own_mac(interface); if ((dst = thc_resolve6(argv[2])) == NULL) { fprintf(stderr, "Error: could not resolve %s\n", argv[2]); return -1; } memset(buf, 0, sizeof(buf)); memcpy(buf + 8, dst, 16); i = 24; cnt += getpid(); memcpy(buf + 4, (char *) &cnt, 4); cnt++; if ((p = thc_pcap_init(interface, string)) == NULL) { fprintf(stderr, "Error: could not capture on interface %s with string %s\n", interface, string); exit(-1); } if ((pkt = thc_create_ipv6(interface, PREFER_LINK, &pkt_len, NULL, dst, 255, 0, 0, 0xe0, 0)) == NULL) return -1; if (thc_add_icmp6(pkt, &pkt_len, ICMP6_INFOREQUEST, 0, 0x00020000, buf, i, 0) < 0) return -1; if (thc_generate_and_send_pkt(interface, mac6, NULL, pkt, &pkt_len) < 0) return -1; usleep(1000); memcpy(buf + 4, (char *) &cnt, 4); cnt++; if ((pkt = thc_create_ipv6(interface, PREFER_LINK, &pkt_len, NULL, dst, 255, 0, 0, 0xe0, 0)) == NULL) return -1; if (thc_add_icmp6(pkt, &pkt_len, ICMP6_INFOREQUEST, 0, 0x0003003e, buf, i, 0) < 0) return -1; if (thc_generate_and_send_pkt(interface, mac6, NULL, pkt, &pkt_len) < 0) return -1; usleep(1000); memcpy(buf + 4, (char *) &cnt, 4); cnt++; if ((pkt = thc_create_ipv6(interface, PREFER_LINK, &pkt_len, NULL, dst, 255, 0, 0, 0xe0, 0)) == NULL) return -1; if (thc_add_icmp6(pkt, &pkt_len, ICMP6_INFOREQUEST, 0, 0x00040002, buf, i, 0) < 0) return -1; if (thc_generate_and_send_pkt(interface, mac6, NULL, pkt, &pkt_len) < 0) return -1; signal(SIGALRM, clean_exit); alarm(5); while (seen != 3) { while (thc_pcap_check(p, (char *) dump_node_reply, NULL) > 0); usleep(100); } return ret; }
#include "../cgreen.h" #include "../messaging.h" #include <stdlib.h> #include <stdio.h> #include <sys/msg.h> void highly_nested_test_suite_should_still_complete() { assert_true(1); } TestSuite *highly_nested_test_suite() { TestSuite *suite = create_test_suite(); add_test(suite, highly_nested_test_suite_should_still_complete); int i; for (i = 0; i < 1000; i++) { TestSuite *nesting = create_test_suite(); add_suite(nesting, suite); suite = nesting; } return suite; } void can_send_message() { int messaging = start_messaging(33); send_message(messaging, 99); assert_equal(receive_message(messaging), 99); } TestSuite *messaging_tests() { TestSuite *suite = create_test_suite(); add_suite(suite, highly_nested_test_suite()); add_test(suite, can_send_message); return suite; }
/* -*- c++ -*- */ /* * Copyright 2014,2018 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef TSB_VECTOR_SINK_H #define TSB_VECTOR_SINK_H #include <gnuradio/blocks/api.h> #include <gnuradio/tagged_stream_block.h> #include <cstdint> namespace gr { namespace blocks { /*! * \brief A vector sink for tagged streams. * * Unlike a gr::blocks::vector_sink_f, this only works with tagged streams. * * \ingroup blocks */ template <class T> class BLOCKS_API tsb_vector_sink : virtual public gr::tagged_stream_block { public: typedef boost::shared_ptr<tsb_vector_sink<T>> sptr; virtual void reset() = 0; virtual std::vector<std::vector<T>> data() const = 0; /*! Doesn't include the TSB tags. */ virtual std::vector<tag_t> tags() const = 0; /*! * \param vlen Vector length * \param tsb_key Tagged Stream Key */ static sptr make(unsigned int vlen = 1, const std::string& tsb_key = "ts_last"); }; typedef tsb_vector_sink<std::uint8_t> tsb_vector_sink_b; typedef tsb_vector_sink<std::uint32_t> tsb_vector_sink_i; typedef tsb_vector_sink<std::uint16_t> tsb_vector_sink_s; typedef tsb_vector_sink<float> tsb_vector_sink_f; typedef tsb_vector_sink<gr_complex> tsb_vector_sink_c; } // namespace blocks } // namespace gr #endif /* TSB_VECTOR_SINK_H */
/** *Shell Simulator *2010.08.09 by alex. */ #ifndef SHELL_COMMAND_PARSE_H_ #define SHELL_COMMAND_PARSE_H_ #pragma once #include <iostream> #include <string> #include "base/SmartPtr.h" #include "shell/ShellCommand.h" using namespace std; /** * ʹÓÃSmartPointer »úÖÆ£¬ ¶ÔÓÚ¾ßÌåÒýÈësmart_ptr»úÖÆµÄʵÌåÀà * ¼Ì³ÐRefCount¼ÆÊýÀ࣬ʹÓÃʱ¶ÔSmartPointerÄ£°åʵÀý»¯£¬ * SmartPointer<CommandParse> pointer = new CommandParse; * SmartPointer<CommandParse> pointer(new CommandParse); * ³éÏó³ÉÆÕָͨÕë½Ó¿Ú£¬Ò»ÖÖÓÅ»¯µÄÖ¸Õë¿ò¼Ü¡£ * 1.±ÜÃâÄÚ´æÐ¹Â© * 2.×Ô¶¯´¦ÀíÄÚ´æµÄ»ØÊÕ * 3.±ÜÃâÖ¸Õë¼äµÄ¸³ÖµÒýÓã¬ÏÈÊÍ·ÅÆäÖÐÒ»¸öÖ¸Õ룬Ôì³ÉÆäËûµÄÖ¸Õë * Ðü´¹£¬Ö¸Ïò²»¸´´æÔڵĶÔÏó¡£¼´½â¾ödz¿½±´Ö¸Õë¶Ñ¿Õ¼äʱÎö¹¹ÎÊÌâ¡£ * ´¦ÀíÖ¸Ïò¹«¹²Êý¾Ý¶ÑÎÊÌâ¡£ */ class CommandParse : public ShellCommand, public RefCounted { public: CommandParse(); void execute(int nparams, char **params); const string cmd_help(); }; #endif /* SHELL_COMMAND_PARSE_H_ */
// // div.c: this file is part of the SL toolchain. // // Copyright (C) 2009,2010 The SL project. // // 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. // // The complete GNU General Public Licence Notice can be found as the // `COPYING' file in the root directory. // #include <svp/div.h> #include <svp/slr.h> #include <stdio.h> // ignored for now until the legacy "svp" interface // is replaced by C99's div // XIGNORE: *:* sl_def(testu, void, sl_glparm(uint64_t, x), sl_glparm(uint64_t, y)) { uint64_t lx = sl_getp(x), ly = sl_getp(y); printf("unsigned: %llu : %llu = ", (unsigned long long)lx, (unsigned long long)ly); divmodu(lx, ly); printf("%llu : %llu\n", (unsigned long long)lx, (unsigned long long)ly); } sl_enddef sl_def(tests, void, sl_glparm(int64_t, x), sl_glparm(int64_t, y)) { int64_t lx = sl_getp(x), ly = sl_getp(y); printf("signed: %lld : %lld = ", (long long)lx, (long long)ly); divmods(lx, ly); printf("%lld : %lld\n", (long long)lx, (long long)ly); } sl_enddef slr_decl(slr_var(unsigned long long, ua), slr_var(unsigned long long, ub), slr_var(signed long long, sa), slr_var(signed long long, sb)); // SLT_RUN: ua=42 sa=42 ub=5 sb=5 // SLT_RUN: ua=5 sa=5 ub=42 sb=42 // SLT_RUN: ua=0 sa=0 ub=1 sb=1 // SLT_RUN: ua=0 sa=0 ub=-1 sb=-1 // SLT_RUN: ua=301 sa=301 ub=-10 sb=-10 // SLT_RUN: ua=-301 sa=-301 ub=-10 sb=-10 // SLT_RUN: ua=-301 sa=-301 ub=10 sb=10 // SLT_RUN: ua=301 sa=301 ub=10 sb=10 // SLT_RUN: ua=0xffffffffUL sa=0xffffffffUL ub=0x7ffffffeUL sb=0x7ffffffeUL // SLT_RUN: ua=0xffffffffffffffffULL sa=0xffffffffffffffffULL ub=0x7ffffffffffffffeULL sb=0x7ffffffffffffffeULL sl_def(t_main, void) { puts("----"); sl_proccall(testu, sl_glarg(uint64_t, x, slr_get(ua)[0]), sl_glarg(uint64_t, y, slr_get(ub)[0])); sl_proccall(tests, sl_glarg(int64_t, x, slr_get(sa)[0]), sl_glarg(int64_t, y, slr_get(sb)[0])); } sl_enddef
/****************************************************************\ * * * Library for word-neighbourhood generation * * * * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * * Copyright (C) 2000-2008. All Rights Reserved. * * * * This source code is distributed under the terms of the * * GNU General Public License, version 3. See the file COPYING * * or http://www.gnu.org/licenses/gpl.txt for details * * * * If you use this code, please keep this notice intact. * * * \****************************************************************/ #ifndef INCLUDED_WORDHOOD_H #define INCLUDED_WORDHOOD_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <glib.h> #include <stdio.h> #include <limits.h> #include "submat.h" #include "codonsubmat.h" #ifndef ALPHABETSIZE #define ALPHABETSIZE (1<<(CHAR_BIT)) #endif /* ALPHABETSIZE */ typedef struct WordHood_Alphabet { gint ref_count; gint advance; gpointer user_data; gint input_index[ALPHABETSIZE]; gint output_index[ALPHABETSIZE]; GPtrArray *member_list; Submat *submat; CodonSubmat *codon_submat; gint (*score_func)(struct WordHood_Alphabet *wha, gchar *seq_a, gchar *seq_b); gboolean (*is_valid_func)(struct WordHood_Alphabet *wha, gchar *seq); gint (*index_func)(struct WordHood_Alphabet *wha, gchar *seq); } WordHood_Alphabet; /* Invalid input gets -1 from the index_func * Output is possible for all of member_list */ WordHood_Alphabet *WordHood_Alphabet_create_from_Submat( gchar *input_alphabet, gchar *output_alphabet, Submat *submat, gboolean case_sensitive_input); WordHood_Alphabet *WordHood_Alphabet_create_from_CodonSubmat( CodonSubmat *cs, gboolean case_sensitive_input); WordHood_Alphabet *WordHood_Alphabet_share(WordHood_Alphabet *wha); void WordHood_Alphabet_destroy(WordHood_Alphabet *wha); /* Using different input and output alphabets allows * generation of a neighbourhood covering redundant symbols * */ typedef gboolean (*WordHood_Traverse_Func)(gchar *word, gint score, gpointer user_data); /* Return TRUE to stop the traversal */ typedef struct { WordHood_Alphabet *wha; gint threshold; gboolean use_dropoff; gchar *orig_word; gchar *curr_word; gint *depth_threshold; gint word_pos; gint curr_score; gint curr_len; gint alloc_len; } WordHood; WordHood *WordHood_create(WordHood_Alphabet *wha, gint threshold, gboolean use_dropoff); /* When use_dropoff is FALSE: * - each word will have a score of at least the threshold * When use_dropoff is TRUE: * - each word will have a score within the threshold * of the score given by comparison to itself * * Thus threshold=0, use_dropoff=TRUE will yield the minimum wordhood * (ie. just valid words from the query). */ void WordHood_destroy(WordHood *wh); void WordHood_info(WordHood *wh); void WordHood_traverse(WordHood *wh, WordHood_Traverse_Func whtf, gchar *word, gint len, gpointer user_data); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* INCLUDED_WORDHOOD_H */
#include <R.h> #include <Rinternals.h> #include <R_ext/Rdynload.h> #include "tadbit.h" // Declare and register R/C interface. SEXP tadbit_R_call( SEXP list, SEXP n_threads, SEXP verbose, SEXP max_tad_size, SEXP heuristic ); R_CallMethodDef callMethods[] = { {"tadbit_R_call", (DL_FUNC) &tadbit_R_call, 5}, {NULL, NULL, 0} }; void R_init_tadbit(DllInfo *info) { R_registerRoutines(info, NULL, callMethods, NULL, NULL); } SEXP tadbit_R_call( SEXP list, SEXP n_threads, SEXP verbose, SEXP max_tad_size, SEXP do_not_use_heuristic ){ /* * This is a tadbit wrapper for R. The matrices have to be passed * in a list (in R). Checks that the input consists of numeric * square matrices, with identical dimensions. The list is * is converted to pointer of pointers to doubles and passed * to 'tadbit'. * Assume that NAs can be passed from R and are ignored in the * computation. */ R_len_t i, m = length(list); int first = 1, N, *dim_int; SEXP dim; PROTECT(dim = allocVector(INTSXP, 2)); // Convert 'obs_list' to pointer of pointer to double. int **obs = (int **) malloc(m * sizeof(int **)); for (i = 0 ; i < m ; i++) { // This fails if list element is not numeric. obs[i] = INTEGER(coerceVector(VECTOR_ELT(list, i), INTSXP)); // Check that input is a matrix. if (!isMatrix(VECTOR_ELT(list, i))) { error("input must be square matrix"); } // Check the dimension. dim = getAttrib(VECTOR_ELT(list, i), R_DimSymbol); dim_int = INTEGER(dim); if (dim_int[0] != dim_int[1]) { error("input must be square matrix"); } if (first) { N = dim_int[0]; first = 0; } else { if (N != dim_int[0]) { error("all matrices must have same dimensions"); } } } UNPROTECT(1); tadbit_output *seg = (tadbit_output *) malloc(sizeof(tadbit_output)); // Call 'tadbit'. tadbit(obs, N, m, INTEGER(n_threads)[0], INTEGER(verbose)[0], INTEGER(max_tad_size)[0], INTEGER(do_not_use_heuristic)[0], seg); int maxbreaks = seg->maxbreaks; // Check that tadbit exited successfully. if (maxbreaks == -1) { free(obs); free(seg); SEXP fail_SEXP; PROTECT(fail_SEXP = allocVector(INTSXP, 1)); int *fail = INTEGER(fail_SEXP); fail[0] = -1; SEXP list_SEXP; PROTECT(list_SEXP = allocVector(VECSXP, 1)); SET_VECTOR_ELT(list_SEXP, 0, fail_SEXP); UNPROTECT(2); return list_SEXP; } // Copy output to R-readable variables. SEXP nbreaks_SEXP; SEXP passages_SEXP; SEXP llikmat_SEXP; SEXP mllik_SEXP; SEXP bkpts_SEXP; PROTECT(nbreaks_SEXP = allocVector(INTSXP, 1)); PROTECT(passages_SEXP = allocVector(INTSXP, N)); PROTECT(llikmat_SEXP = allocVector(REALSXP, N*N)); PROTECT(mllik_SEXP = allocVector(REALSXP, maxbreaks)); PROTECT(bkpts_SEXP = allocVector(INTSXP, N*(maxbreaks-1))); int *nbreaks_opt = INTEGER(nbreaks_SEXP); int *passages = INTEGER(passages_SEXP); double *llikmat = REAL(llikmat_SEXP); double *mllik = REAL(mllik_SEXP); int *bkpts = INTEGER(bkpts_SEXP); nbreaks_opt[0] = seg->nbreaks_opt; for (i = 0 ; i < N ; i++) passages[i] = seg->passages[i]; for (i = 0 ; i < N*N ; i++) llikmat[i] = seg->llikmat[i]; for (i = 0 ; i < maxbreaks ; i++) mllik[i] = seg->mllik[i]; // Remove first column associated with 0 breaks. Itcontains only // 0s and shifts the index in R (vectors start at position 1). for (i = N ; i < N*(maxbreaks-1) ; i++) bkpts[i-N] = seg->bkpts[i]; // Set 'dim' attributes. SEXP dim_llikmat; PROTECT(dim_llikmat = allocVector(INTSXP, 2)); INTEGER(dim_llikmat)[0] = N; INTEGER(dim_llikmat)[1] = N; setAttrib(llikmat_SEXP, R_DimSymbol, dim_llikmat); SEXP dim_breaks; PROTECT(dim_breaks = allocVector(INTSXP, 2)); INTEGER(dim_breaks)[0] = N; INTEGER(dim_breaks)[1] = maxbreaks-1; setAttrib(bkpts_SEXP, R_DimSymbol, dim_breaks); free(obs); free(seg->passages); free(seg->llikmat); free(seg->mllik); free(seg->bkpts); free(seg); SEXP list_SEXP; PROTECT(list_SEXP = allocVector(VECSXP, 5)); SET_VECTOR_ELT(list_SEXP, 0, nbreaks_SEXP); SET_VECTOR_ELT(list_SEXP, 1, llikmat_SEXP); SET_VECTOR_ELT(list_SEXP, 2, mllik_SEXP); SET_VECTOR_ELT(list_SEXP, 3, bkpts_SEXP); SET_VECTOR_ELT(list_SEXP, 4, passages_SEXP); UNPROTECT(8); return list_SEXP; }
/* -*- c -*- */ #ifndef INCLUDED_LIB3DS_NODE_H #define INCLUDED_LIB3DS_NODE_H /* * The 3D Studio File Format Library * Copyright (C) 1996-2007 by Jan Eric Kyprianidis <www.kyprianidis.com> * All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: node.h,v 1.12 2007/06/20 17:04:09 jeh Exp $ */ #ifndef INCLUDED_LIB3DS_TRACKS_H #include <lib3ds/tracks.h> #endif #ifdef __cplusplus extern "C" { #endif /** * Scene graph ambient color node data * \ingroup node */ typedef struct Lib3dsAmbientData { Lib3dsRgb col; Lib3dsLin3Track col_track; } Lib3dsAmbientData; /** * Scene graph object instance node data * \ingroup node */ typedef struct Lib3dsObjectData { Lib3dsVector pivot; char instance[64]; Lib3dsVector bbox_min; Lib3dsVector bbox_max; Lib3dsVector pos; Lib3dsLin3Track pos_track; Lib3dsQuat rot; Lib3dsQuatTrack rot_track; Lib3dsVector scl; Lib3dsLin3Track scl_track; Lib3dsFloat morph_smooth; char morph[64]; Lib3dsMorphTrack morph_track; Lib3dsBool hide; Lib3dsBoolTrack hide_track; } Lib3dsObjectData; /** * Scene graph camera node data * \ingroup node */ typedef struct Lib3dsCameraData { Lib3dsVector pos; Lib3dsLin3Track pos_track; Lib3dsFloat fov; Lib3dsLin1Track fov_track; Lib3dsFloat roll; Lib3dsLin1Track roll_track; } Lib3dsCameraData; /** * Scene graph camera target node data * \ingroup node */ typedef struct Lib3dsTargetData { Lib3dsVector pos; Lib3dsLin3Track pos_track; } Lib3dsTargetData; /** * Scene graph light node data * \ingroup node */ typedef struct Lib3dsLightData { Lib3dsVector pos; Lib3dsLin3Track pos_track; Lib3dsRgb col; Lib3dsLin3Track col_track; Lib3dsFloat hotspot; Lib3dsLin1Track hotspot_track; Lib3dsFloat falloff; Lib3dsLin1Track falloff_track; Lib3dsFloat roll; Lib3dsLin1Track roll_track; } Lib3dsLightData; /** * Scene graph spotlight target node data * \ingroup node */ typedef struct Lib3dsSpotData { Lib3dsVector pos; Lib3dsLin3Track pos_track; } Lib3dsSpotData; /** * Scene graph node data union * \ingroup node */ typedef union Lib3dsNodeData { Lib3dsAmbientData ambient; Lib3dsObjectData object; Lib3dsCameraData camera; Lib3dsTargetData target; Lib3dsLightData light; Lib3dsSpotData spot; } Lib3dsNodeData; /*! * \ingroup node */ #define LIB3DS_NO_PARENT 65535 /** * Scene graph node * \ingroup node */ struct Lib3dsNode { Lib3dsUserData user; Lib3dsNode *next; Lib3dsNode *childs; Lib3dsNode *parent; Lib3dsNodeTypes type; Lib3dsWord node_id; char name[64]; Lib3dsWord flags1; Lib3dsWord flags2; Lib3dsWord parent_id; Lib3dsMatrix matrix; Lib3dsNodeData data; }; /** * Node flags #1 * \ingroup node */ typedef enum { LIB3DS_HIDDEN = 0x800 } Lib3dsNodeFlags1; /** * Node flags #2 * \ingroup node */ typedef enum { LIB3DS_SHOW_PATH = 0x1, LIB3DS_SMOOTHING = 0x2, LIB3DS_MOTION_BLUR = 0x10, LIB3DS_MORPH_MATERIALS = 0x40 } Lib3dsNodeFlags2; LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_ambient(); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_object(); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_camera(); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_target(); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_light(); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_new_spot(); LIB3DSEXTERN LIB3DSAPI void lib3ds_node_free(Lib3dsNode *node); LIB3DSEXTERN LIB3DSAPI void lib3ds_node_eval(Lib3dsNode *node, Lib3dsFloat t); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_by_name(Lib3dsNode *node, const char* name, Lib3dsNodeTypes type); LIB3DSEXTERN LIB3DSAPI Lib3dsNode* lib3ds_node_by_id(Lib3dsNode *node, Lib3dsWord node_id); LIB3DSEXTERN LIB3DSAPI void lib3ds_node_dump(Lib3dsNode *node, Lib3dsIntd level); LIB3DSEXTERN LIB3DSAPI Lib3dsBool lib3ds_node_read(Lib3dsNode *node, Lib3dsFile *file, Lib3dsIo *io); LIB3DSEXTERN LIB3DSAPI Lib3dsBool lib3ds_node_write(Lib3dsNode *node, Lib3dsFile *file, Lib3dsIo *io); #ifdef __cplusplus } #endif #endif
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-cen-xr-w32-bld/build/docshell/base/nsIContentViewerFile.idl */ #ifndef __gen_nsIContentViewerFile_h__ #define __gen_nsIContentViewerFile_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif #ifndef __gen_nsIPrintSettings_h__ #include "nsIPrintSettings.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif class nsIDOMWindowInternal; /* forward declaration */ class nsIWebProgressListener; /* forward declaration */ #include <stdio.h> /* starting interface: nsIContentViewerFile */ #define NS_ICONTENTVIEWERFILE_IID_STR "6317f32c-9bc7-11d3-bccc-0060b0fc76bd" #define NS_ICONTENTVIEWERFILE_IID \ {0x6317f32c, 0x9bc7, 0x11d3, \ { 0xbc, 0xcc, 0x00, 0x60, 0xb0, 0xfc, 0x76, 0xbd }} /** * The nsIDocShellFile */ class NS_NO_VTABLE NS_SCRIPTABLE nsIContentViewerFile : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTVIEWERFILE_IID) /* readonly attribute boolean printable; */ NS_SCRIPTABLE NS_IMETHOD GetPrintable(PRBool *aPrintable) = 0; /* [noscript] void print (in boolean aSilent, in FILE aDebugFile, in nsIPrintSettings aPrintSettings); */ NS_IMETHOD Print(PRBool aSilent, FILE *aDebugFile, nsIPrintSettings *aPrintSettings) = 0; /* [noscript] void printWithParent (in nsIDOMWindowInternal aParentWin, in nsIPrintSettings aThePrintSettings, in nsIWebProgressListener aWPListener); */ NS_IMETHOD PrintWithParent(nsIDOMWindowInternal *aParentWin, nsIPrintSettings *aThePrintSettings, nsIWebProgressListener *aWPListener) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentViewerFile, NS_ICONTENTVIEWERFILE_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSICONTENTVIEWERFILE \ NS_SCRIPTABLE NS_IMETHOD GetPrintable(PRBool *aPrintable); \ NS_IMETHOD Print(PRBool aSilent, FILE *aDebugFile, nsIPrintSettings *aPrintSettings); \ NS_IMETHOD PrintWithParent(nsIDOMWindowInternal *aParentWin, nsIPrintSettings *aThePrintSettings, nsIWebProgressListener *aWPListener); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSICONTENTVIEWERFILE(_to) \ NS_SCRIPTABLE NS_IMETHOD GetPrintable(PRBool *aPrintable) { return _to GetPrintable(aPrintable); } \ NS_IMETHOD Print(PRBool aSilent, FILE *aDebugFile, nsIPrintSettings *aPrintSettings) { return _to Print(aSilent, aDebugFile, aPrintSettings); } \ NS_IMETHOD PrintWithParent(nsIDOMWindowInternal *aParentWin, nsIPrintSettings *aThePrintSettings, nsIWebProgressListener *aWPListener) { return _to PrintWithParent(aParentWin, aThePrintSettings, aWPListener); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSICONTENTVIEWERFILE(_to) \ NS_SCRIPTABLE NS_IMETHOD GetPrintable(PRBool *aPrintable) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPrintable(aPrintable); } \ NS_IMETHOD Print(PRBool aSilent, FILE *aDebugFile, nsIPrintSettings *aPrintSettings) { return !_to ? NS_ERROR_NULL_POINTER : _to->Print(aSilent, aDebugFile, aPrintSettings); } \ NS_IMETHOD PrintWithParent(nsIDOMWindowInternal *aParentWin, nsIPrintSettings *aThePrintSettings, nsIWebProgressListener *aWPListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->PrintWithParent(aParentWin, aThePrintSettings, aWPListener); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsContentViewerFile : public nsIContentViewerFile { public: NS_DECL_ISUPPORTS NS_DECL_NSICONTENTVIEWERFILE nsContentViewerFile(); private: ~nsContentViewerFile(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsContentViewerFile, nsIContentViewerFile) nsContentViewerFile::nsContentViewerFile() { /* member initializers and constructor code */ } nsContentViewerFile::~nsContentViewerFile() { /* destructor code */ } /* readonly attribute boolean printable; */ NS_IMETHODIMP nsContentViewerFile::GetPrintable(PRBool *aPrintable) { return NS_ERROR_NOT_IMPLEMENTED; } /* [noscript] void print (in boolean aSilent, in FILE aDebugFile, in nsIPrintSettings aPrintSettings); */ NS_IMETHODIMP nsContentViewerFile::Print(PRBool aSilent, FILE *aDebugFile, nsIPrintSettings *aPrintSettings) { return NS_ERROR_NOT_IMPLEMENTED; } /* [noscript] void printWithParent (in nsIDOMWindowInternal aParentWin, in nsIPrintSettings aThePrintSettings, in nsIWebProgressListener aWPListener); */ NS_IMETHODIMP nsContentViewerFile::PrintWithParent(nsIDOMWindowInternal *aParentWin, nsIPrintSettings *aThePrintSettings, nsIWebProgressListener *aWPListener) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIContentViewerFile_h__ */
/*========================================================================= Program: ITK-SNAP Module: $RCSfile: UndoDataManager.h,v $ Language: C++ Date: $Date: 2008/11/15 12:20:38 $ Version: $Revision: 1.4 $ Copyright (c) 2007 Paul A. Yushkevich This file is part of ITK-SNAP ITK-SNAP 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/>. ----- Copyright (c) 2003 Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __UndoDataManager_h_ #define __UndoDataManager_h_ #include <vector> #include <list> #include <RLEImage.h> /** * The Delta class represents a difference between two images used in * the Undo system. It only supports linear traversal of images and * stores differences in an RLE (run length encoding) format. */ template <typename TPixel> class UndoDelta { public: typedef itk::ImageRegion<3> RegionType; UndoDelta(); void SetRegion(const RegionType &region) { this->m_Region = region; } const RegionType &GetRegion() { return m_Region; } void Encode(const TPixel &value); void FinishEncoding(); size_t GetNumberOfRLEs() { return m_Array.size(); } TPixel GetRLEValue(size_t i) { return m_Array[i].second; } size_t GetRLELength(size_t i) { return m_Array[i].first; } unsigned long GetUniqueID() const { return m_UniqueID; } UndoDelta & operator = (const UndoDelta &other); protected: typedef std::pair<size_t, TPixel> RLEPair; typedef std::vector<RLEPair> RLEArray; RLEArray m_Array; size_t m_CurrentLength; TPixel m_LastValue; // The delta is associated with an image region RegionType m_Region; // Each delta is assigned a unique ID at creation unsigned long m_UniqueID; static unsigned long m_UniqueIDCounter; }; /** * \class UndoDataManager * \brief Manages data (delta updates) for undo/redo in itk-snap */ template<typename TPixel> class UndoDataManager { public: typedef itk::ImageRegion<3> RegionType; /** List of deltas and related iterators */ typedef UndoDelta<TPixel> Delta; typedef std::list<Delta *> DList; typedef typename DList::iterator DIterator; typedef typename DList::const_iterator DConstIterator; /** * A "commit" to the undo system consists of one or more deltas. For example * in paintbrush drawing, as you drag the paintbrush, deltas are generated, but * these deltas are associated with a single commit. The commit owns the deltas * and deletes them when it is itself deleted. */ class Commit { public: Commit(const DList &list, const char *name); void DeleteDeltas(); size_t GetNumberOfRLEs() const; const DList &GetDeltas() const { return m_Deltas; } protected: DList m_Deltas; std::string m_Name; }; UndoDataManager(size_t nMinCommits, size_t nMaxTotalSize); /** Add a delta to the staging list. The staging list must be committed */ void AddDeltaToStaging(Delta *delta); /** Commit the deltas in the staging list - returns total number of RLEs updated */ int CommitStaging(const char *text); /** Clear the undo stack (removes all commits) */ void Clear(); bool IsUndoPossible(); const Commit &GetCommitForUndo(); bool IsRedoPossible(); const Commit &GetCommitForRedo(); size_t GetNumberOfCommits() { return m_CommitList.size(); } private: // Current staging list - where deltas are added DList m_StagingList; // List of commits typedefs typedef std::list<Commit> CList; typedef typename CList::iterator CIterator; typedef typename CList::const_iterator CConstIterator; // A list of commits CList m_CommitList; CIterator m_Position; size_t m_TotalSize, m_MinCommits, m_MaxTotalSize; }; #endif // __UndoDataManager_h_
/* ldapserver.h Copyright (C) 2008 g10 Code GmbH This file is part of DirMngr. DirMngr 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. DirMngr 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 <https://www.gnu.org/licenses/>. */ #ifndef LDAPSERVER_H #define LDAPSERVER_H #include "dirmngr.h" /* Release the list of SERVERS. As usual it is okay to call this function with SERVERS passed as NULL. */ void ldapserver_list_free (ldap_server_t servers); /* Parse a single LDAP server configuration line. Returns the server or NULL in case of errors. The configuration line is assumed to be colon separated with these fields: 1. field: Hostname 2. field: Portnumber 3. field: Username 4. field: Password 5. field: Base DN FILENAME and LINENO are used for diagnostic purposes only. */ ldap_server_t ldapserver_parse_one (char *line, const char *filename, unsigned int lineno); /* Iterate over all servers. */ struct ldapserver_iter { ctrl_t ctrl; enum { LDAPSERVER_SESSION, LDAPSERVER_OPT } group; ldap_server_t server; }; static inline void ldapserver_iter_next (struct ldapserver_iter *iter) { if (iter->server) iter->server = iter->server->next; if (! iter->server) { if (iter->group == LDAPSERVER_SESSION) { iter->group = LDAPSERVER_OPT; iter->server = opt.ldapservers; } } } static inline int ldapserver_iter_end_p (struct ldapserver_iter *iter) { return (iter->group == LDAPSERVER_OPT && iter->server == NULL); } static inline void ldapserver_iter_begin (struct ldapserver_iter *iter, ctrl_t ctrl) { iter->ctrl = ctrl; iter->group = LDAPSERVER_SESSION; iter->server = get_ldapservers_from_ctrl (ctrl); while (iter->server == NULL && ! ldapserver_iter_end_p (iter)) ldapserver_iter_next (iter); } #endif /* LDAPSERVER_H */
/** ****************************************************************************** * @file spark_wiring_print.h * @author Mohit Bhoite * @version V1.0.0 * @date 13-March-2013 * @brief Header for spark_wiring_print.c module ****************************************************************************** Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved. Copyright (c) 2010 David A. Mellis. All right reserved. 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. 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, see <http://www.gnu.org/licenses/>. ****************************************************************************** */ #ifndef __SPARK_WIRING_PRINT_ #define __SPARK_WIRING_PRINT_ #include <stddef.h> #include <string.h> #include <stdint.h> // for uint8_t #include "spark_wiring_string.h" #include "spark_wiring_printable.h" const unsigned char DEC = 10; const unsigned char HEX = 16; const unsigned char OCT = 8; const unsigned char BIN = 2; class String; class Print { private: int write_error; size_t printNumber(unsigned long, uint8_t); size_t printFloat(double, uint8_t); protected: void setWriteError(int err = 1) { write_error = err; } size_t printf_impl(bool newline, const char* format, ...); public: Print() : write_error(0) {} virtual ~Print() {} int getWriteError() { return write_error; } void clearWriteError() { setWriteError(0); } virtual size_t write(uint8_t) = 0; size_t write(const char *str) { if (str == NULL) return 0; return write((const uint8_t *)str, strlen(str)); } virtual size_t write(const uint8_t *buffer, size_t size); size_t print(const char[]); size_t print(char); size_t print(unsigned char, int = DEC); size_t print(int, int = DEC); size_t print(unsigned int, int = DEC); size_t print(long, int = DEC); size_t print(unsigned long, int = DEC); size_t print(double, int = 2); size_t print(const Printable&); size_t println(const char[]); size_t println(char); size_t println(unsigned char, int = DEC); size_t println(int, int = DEC); size_t println(unsigned int, int = DEC); size_t println(long, int = DEC); size_t println(unsigned long, int = DEC); size_t println(double, int = 2); size_t println(const Printable&); size_t println(void); size_t printfln(const char* format, ...); template <typename... Args> inline size_t printf(const char* format, Args... args) { return this->printf_impl(false, format, args...); } template <typename... Args> inline size_t printfln(const char* format, Args... args) { return this->printf_impl(true, format, args...); } }; #endif
#include <alsaplayer/control.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main (int argc, char *argv[]) { int i; char artist[AP_ARTIST_MAX]; char title[AP_TITLE_MAX]; float speed = 0.0; int session_id = 0; if (ap_get_title(session_id, title) && ap_get_artist(session_id, artist)) { printf("File playing: %s - %s\n", title, artist); } if (argc == 2) { if (sscanf (argv[1], "%f", &speed) == 1) { if (speed == 0.0) { printf ("Pausing player\n"); ap_pause(session_id); } else { printf ("Setting speed to %.2f\n", speed); ap_set_speed(session_id, speed); } } } if (ap_get_speed(session_id, &speed)) { printf ("Current speed = %.2f\n", speed); } return 0; }
// Copyleft 2013 Chris Korda // 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 any later version. /* chris korda revision history: rev date comments 00 28mar13 initial version data tooltip control */ #if !defined(AFX_DATATIPCTRL_H__8DA580FF_35B7_464A_BC56_4AF82D60B1FE__INCLUDED_) #define AFX_DATATIPCTRL_H__8DA580FF_35B7_464A_BC56_4AF82D60B1FE__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // DataTipCtrl.h : header file // ///////////////////////////////////////////////////////////////////////////// // CDataTipCtrl window class DPoint; class CDataTipCtrl : public CToolTipCtrl { DECLARE_DYNAMIC(CDataTipCtrl) // Construction public: CDataTipCtrl(); // Attributes CPoint m_Pos; // tip position, in client coords CPoint m_DataPos; // data position, in user-defined coords int m_Epsilon; // show tip within this proximity to data point CString m_Text; // tip text // Operations void OnMouseMove(MSG *pMsg); bool PointsNear(const CPoint& P1, const CPoint& P2) const; virtual bool FindPoint(CPoint Target, CPoint& DataPos) const = 0; static bool PointsNear(const CPoint& P1, const CPoint& P2, int Epsilon); static double DistancePointToLine(const DPoint& Pt, const DPoint& P1, const DPoint& P2); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDataTipCtrl) //}}AFX_VIRTUAL // Implementation public: virtual ~CDataTipCtrl(); // Generated message map functions protected: //{{AFX_MSG(CDataTipCtrl) afx_msg void OnTimer(W64UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; inline bool CDataTipCtrl::PointsNear(const CPoint& P1, const CPoint& P2, int Epsilon) { return(abs(P1.x - P2.x) <= Epsilon && abs(P1.y - P2.y) <= Epsilon); } inline bool CDataTipCtrl::PointsNear(const CPoint& P1, const CPoint& P2) const { return(PointsNear(P1, P2, m_Epsilon)); } ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DATATIPCTRL_H__8DA580FF_35B7_464A_BC56_4AF82D60B1FE__INCLUDED_)
#include "bootloader.h" #include "ch.h" #include "hal.h" #ifdef STM32_BOOTLOADER_ADDRESS /* STM32 */ #if defined(STM32F0XX) /* This code should be checked whether it runs correctly on platforms */ #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) extern uint32_t __ram0_end__; void bootloader_jump(void) { *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader NVIC_SystemReset(); } #else /* defined(STM32F0XX) */ #error Check that the bootloader code works on your platform and add it to bootloader.c! #endif /* defined(STM32F0XX) */ #elif defined(KL2x) || defined(K20x) /* STM32_BOOTLOADER_ADDRESS */ /* Kinetis */ #if defined(KIIBOHD_BOOTLOADER) /* Kiibohd Bootloader (MCHCK and Infinity KB) */ #define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; void bootloader_jump(void) { __builtin_memcpy((void *)VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); // request reset SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; } #else /* defined(KIIBOHD_BOOTLOADER) */ /* Default for Kinetis - expecting an ARM Teensy */ void bootloader_jump(void) { chThdSleepMilliseconds(100); __BKPT(0); } #endif /* defined(KIIBOHD_BOOTLOADER) */ #else /* neither STM32 nor KINETIS */ void bootloader_jump(void) {} #endif
/* src/config.h. Generated from config.h.in by configure. */ /* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to compile without DEBUG settings. */ #define DEBUG 1 /* Define to 1 if you have the <float.h> header file. */ #define HAVE_FLOAT_H 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #define HAVE_MALLOC 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define if you have the MPI library. */ /* #undef HAVE_MPI */ /* Define to 1 if you have the `pow' function. */ #define HAVE_POW 1 /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #define HAVE_REALLOC 1 /* Define to 1 if you have the `sqrt' function. */ #define HAVE_SQRT 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Compiling with MPI settings. */ /* #undef MPI */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "pops" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "jens@jkleinj.eu" /* Define to the full name of this package. */ #define PACKAGE_NAME "pops" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "pops 2.3.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "pops" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "2.3.2" /* Define to compile with PROFILING settings. */ /* #undef PROFILING */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "2.3.2" /* Define to rpl_malloc if the replacement function should be used. */ /* #undef malloc */ /* Define to rpl_realloc if the replacement function should be used. */ /* #undef realloc */ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */
/*********************************************************************** * Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Carsten Urbach * * This file is part of tmLQCD. * * tmLQCD 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. * * tmLQCD 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 tmLQCD. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************/ #include "utils.ih" int read_message(READER * reader, char **buffer) { int status; n_uint64_t bytes, bytesRead; if (buffer == (char**)NULL) return(-1); if ((*buffer) != (char*)NULL) free(*buffer); bytes = ReaderBytes(reader); bytesRead = bytes; /* this termination force gives sometimes random results and hanging code ... */ /* with calloc instead of malloc it seems to be fine */ *buffer = (char*)calloc(bytes + 1, sizeof(char)); /* *buffer = (char*)calloc(bytes, sizeof(char)); */ if (*buffer == (char*)NULL) { fprintf(stderr, "Couldn't malloc data buffer in read_message.\n"); return(-1); } status = ReaderReadData(*buffer, &bytesRead, reader); #if TM_USE_MPI MPI_Barrier(g_cart_grid); #endif if (status != LIME_SUCCESS || bytes != bytesRead) kill_with_error(reader->fp, g_cart_id, "Error in reading message.\n"); (*buffer)[bytes] = '\0'; /* Force termination for safety */ return(0); }
#pragma once #if IL2CPP_TARGET_WINRT extern "C" { #if WINDOWS_SDK_BUILD_VERSION < 16299 // These APIs got readded on Windows 10 Fall Creators Update #define CreateEvent CreateEventW #define FreeEnvironmentStrings FreeEnvironmentStringsW #define GetEnvironmentStrings GetEnvironmentStringsW #define GetEnvironmentVariable GetEnvironmentVariableW #define GetVersionEx GetVersionExW #define SetEnvironmentVariable SetEnvironmentVariableW #endif #define GetUserName GetUserNameW #if WINDOWS_SDK_BUILD_VERSION < 16299 inline HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName) { DWORD flags = 0; if (bManualReset) flags |= CREATE_EVENT_MANUAL_RESET; if (bInitialState) flags |= CREATE_EVENT_INITIAL_SET; return CreateEventExW(lpEventAttributes, lpName, flags, EVENT_ALL_ACCESS); } #endif inline HANDLE WINAPI CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { const DWORD kFileAttributeMask = 0x0000FFFF; const DWORD kFileFlagMask = 0xFFFF0000; CREATEFILE2_EXTENDED_PARAMETERS extendedParameters; extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); extendedParameters.dwFileAttributes = dwFlagsAndAttributes & kFileAttributeMask; extendedParameters.dwFileFlags = dwFlagsAndAttributes & kFileFlagMask; extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS; extendedParameters.lpSecurityAttributes = lpSecurityAttributes; extendedParameters.hTemplateFile = hTemplateFile; return CreateFile2(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, &extendedParameters); } #if WINDOWS_SDK_BUILD_VERSION < 16299 BOOL WINAPI FreeEnvironmentStringsW(LPWCH strings); LPWCH WINAPI GetEnvironmentStringsW(); DWORD WINAPI GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize); BOOL WINAPI GetVersionExW(LPOSVERSIONINFOW lpVersionInformation); #endif BOOL WINAPI GetUserNameW(LPWSTR lpBuffer, LPDWORD pcbBuffer); inline HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName) { return LoadPackagedLibrary(lpLibFileName, 0); } #if WINDOWS_SDK_BUILD_VERSION < 16299 BOOL WINAPI SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue); #endif #define CreateFileMappingW(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName) \ CreateFileMappingFromApp(hFile, lpFileMappingAttributes, flProtect, (static_cast<ULONG64>(dwMaximumSizeHigh) << 32) | dwMaximumSizeLow, lpName); #define MapViewOfFile(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap) \ MapViewOfFileFromApp(hFileMappingObject, dwDesiredAccess, (static_cast<ULONG64>(dwFileOffsetHigh) << 32) | dwFileOffsetLow, dwNumberOfBytesToMap); #if WINDOWS_SDK_BUILD_VERSION < 14393 #define TlsAlloc() FlsAlloc(NULL) #define TlsGetValue FlsGetValue #define TlsSetValue FlsSetValue #define TlsFree FlsFree #endif } // extern "C" #endif
/*************************************************************************** $RCSfile$ ------------------- begin : Mon Jan 07 2008 copyright : (C) 2008 by Martin Preuss email : martin@libchipcard.de copyright : (C) 2013 by Paul Conrady email : c.p.conrady@gmail.com *************************************************************************** * Please see toplevel file COPYING for license details * ***************************************************************************/ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include "g_buystock_p.h" #include "ofxxmlctx_l.h" #include "g_generic_l.h" #include "g_ignore_l.h" #include "g_invbuy_l.h" #include <gwenhywfar/misc.h> #include <gwenhywfar/debug.h> #include <gwenhywfar/buffer.h> #include <gwenhywfar/gui.h> GWEN_INHERIT(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK) AIO_OFX_GROUP *AIO_OfxGroup_BUYSTOCK_new(const char *groupName, AIO_OFX_GROUP *parent, GWEN_XML_CONTEXT *ctx) { AIO_OFX_GROUP *g; AIO_OFX_GROUP_BUYSTOCK *xg; /* create base group */ g=AIO_OfxGroup_Generic_new(groupName, parent, ctx); assert(g); GWEN_NEW_OBJECT(AIO_OFX_GROUP_BUYSTOCK, xg); assert(xg); GWEN_INHERIT_SETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK, g, xg, AIO_OfxGroup_BUYSTOCK_FreeData); xg->transaction=AB_Transaction_new(); /* set virtual functions */ AIO_OfxGroup_SetStartTagFn(g, AIO_OfxGroup_BUYSTOCK_StartTag); AIO_OfxGroup_SetAddDataFn(g, AIO_OfxGroup_BUYSTOCK_AddData); AIO_OfxGroup_SetEndSubGroupFn(g, AIO_OfxGroup_BUYSTOCK_EndSubGroup); return g; } GWENHYWFAR_CB void AIO_OfxGroup_BUYSTOCK_FreeData(void *bp, void *p) { AIO_OFX_GROUP_BUYSTOCK *xg; xg=(AIO_OFX_GROUP_BUYSTOCK*)p; assert(xg); AB_Transaction_free(xg->transaction); free(xg->currentElement); GWEN_FREE_OBJECT(xg); } int AIO_OfxGroup_BUYSTOCK_StartTag(AIO_OFX_GROUP *g, const char *tagName) { AIO_OFX_GROUP_BUYSTOCK *xg; GWEN_XML_CONTEXT *ctx; AIO_OFX_GROUP *gNew=NULL; assert(g); xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK, g); assert(xg); ctx=AIO_OfxGroup_GetXmlContext(g); if (strcasecmp(tagName, "BUYTYPE")==0 || strcasecmp(tagName, "SELLTYPE")==0) { /* TODO */ } else if (strcasecmp(tagName, "INVBUY")==0 || strcasecmp(tagName, "INVSELL")==0) { gNew=AIO_OfxGroup_INVBUY_new(tagName, g, ctx); } else { DBG_WARN(AQBANKING_LOGDOMAIN, "Ignoring tag [%s]", tagName); free(xg->currentElement); xg->currentElement=strdup(tagName); } if (gNew) { AIO_OfxXmlCtx_SetCurrentGroup(ctx, gNew); GWEN_XmlCtx_IncDepth(ctx); } return 0; } int AIO_OfxGroup_BUYSTOCK_AddData(AIO_OFX_GROUP *g, const char *data) { AIO_OFX_GROUP_BUYSTOCK *xg; assert(g); xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK, g); assert(xg); if (xg->currentElement) { GWEN_BUFFER *buf; int rv; const char *s; buf=GWEN_Buffer_new(0, strlen(data), 0, 1); rv=AIO_OfxXmlCtx_SanitizeData(AIO_OfxGroup_GetXmlContext(g), data, buf); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(buf); return rv; } s=GWEN_Buffer_GetStart(buf); if (*s) { DBG_INFO(AQBANKING_LOGDOMAIN, "AddData: %s=[%s]", xg->currentElement, s); if (strcasecmp(xg->currentElement, "BUYTYPE")==0 || (strcasecmp(xg->currentElement, "SELLTYPE") ==0)) { /*TODO*/ } else { DBG_INFO(AQBANKING_LOGDOMAIN, "Ignoring data for unknown element [%s]", xg->currentElement); } } GWEN_Buffer_free(buf); } return 0; } int AIO_OfxGroup_BUYSTOCK_EndSubGroup(AIO_OFX_GROUP *g, AIO_OFX_GROUP *sg) { AIO_OFX_GROUP_BUYSTOCK *xg; const char *s; GWEN_XML_CONTEXT *ctx; assert(g); xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK, g); assert(xg); ctx=AIO_OfxGroup_GetXmlContext(g); assert(ctx); s=AIO_OfxGroup_GetGroupName(sg); if (strcasecmp(s, "INVBUY")==0 || strcasecmp(s, "INVSELL")==0) { AB_TRANSACTION *t; t=AIO_OfxGroup_INVBUY_TakeTransaction(sg); if (t) { DBG_INFO(AQBANKING_LOGDOMAIN, "Adding transaction"); xg->transaction=t; /*TODO*/ } } return 0; } AB_TRANSACTION *AIO_OfxGroup_BUYSTOCK_TakeTransaction(const AIO_OFX_GROUP *g){ AIO_OFX_GROUP_BUYSTOCK *xg; AB_TRANSACTION *t; assert(g); xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYSTOCK, g); assert(xg); t=xg->transaction; xg->transaction=NULL; free(xg->transaction); return t; }
#ifndef __GAUSSMODEL__H #define __GAUSSMODEL__H #include <BAT/BCModel.h> // --------------------------------------------------------- class GaussModel : public BCModel { public: // Constructors and destructor GaussModel(); GaussModel(const char * name); ~GaussModel(); // Methods to overload, see file GaussModel.cxx void DefineParameters(); double LogAPrioriProbability(const std::vector<double> &parameters); double LogLikelihood(const std::vector<double> &parameters); // overloaded trial function virtual double MCMCTrialFunctionSingle(unsigned int ichain, unsigned int ipar); }; // --------------------------------------------------------- #endif
/* This file is part of fm-multimix, A multiple channel fm downmixer. Copyright (C) 2013 Hendrik van Wyk 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/>. */ /* * This is the header file for a wrapper for FFTW that attempts to identify * transmitting channels. */ #ifndef FFT_CHANFINDER_H #define FFT_CHANFINDER_H #include <fftw3.h> #include <stdint.h> #define FFT_LEN 2048 #define FFT_AVG 2 #define DETECTION_LEVEL 2 #define SAMP_RATE 1014300 #define BANDWIDTH 12500 #define BANDWIDTH_BINS (int)((double)BANDWIDTH/((double)SAMP_RATE/(double)FFT_LEN)) typedef struct fft_s { double avg; double avg_calc; double fftavg [FFT_LEN]; double band_power [FFT_LEN]; double result [FFT_LEN]; double window [FFT_LEN]; int fftavg_counter; float threshold; fftw_complex *in; fftw_complex *out; fftw_plan p; } fft_obj; fft_obj* fft_init(float threshold); void fft_free(fft_obj* obj); int do_fft(fft_obj* obj, uint8_t* buff, int len); double* get_fft_results(fft_obj* obj); #endif
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZILLA_AUDIOSAMPLEFORMAT_H_ #define MOZILLA_AUDIOSAMPLEFORMAT_H_ #include "nsAlgorithm.h" #include <algorithm> namespace mozilla { /** * Audio formats supported in MediaStreams and media elements. * * Only one of these is supported by AudioStream, and that is determined * at compile time (roughly, FLOAT32 on desktops, S16 on mobile). Media decoders * produce that format only; queued AudioData always uses that format. */ enum AudioSampleFormat { // Native-endian signed 16-bit audio samples AUDIO_FORMAT_S16, // Signed 32-bit float samples AUDIO_FORMAT_FLOAT32, // The format used for output by AudioStream. #ifdef MOZ_SAMPLE_TYPE_S16 AUDIO_OUTPUT_FORMAT = AUDIO_FORMAT_S16 #else AUDIO_OUTPUT_FORMAT = AUDIO_FORMAT_FLOAT32 #endif }; enum { MAX_AUDIO_SAMPLE_SIZE = sizeof(float) }; template <AudioSampleFormat Format> class AudioSampleTraits; template <> class AudioSampleTraits<AUDIO_FORMAT_FLOAT32> { public: typedef float Type; }; template <> class AudioSampleTraits<AUDIO_FORMAT_S16> { public: typedef int16_t Type; }; typedef AudioSampleTraits<AUDIO_OUTPUT_FORMAT>::Type AudioDataValue; // Single-sample conversion /* * Use "2^N" conversion since it's simple, fast, "bit transparent", used by * many other libraries and apparently behaves reasonably. * http://blog.bjornroche.com/2009/12/int-float-int-its-jungle-out-there.html * http://blog.bjornroche.com/2009/12/linearity-and-dynamic-range-in-int.html */ inline float AudioSampleToFloat(float aValue) { return aValue; } inline float AudioSampleToFloat(int16_t aValue) { return aValue/32768.0f; } template <typename T> T FloatToAudioSample(float aValue); template <> inline float FloatToAudioSample<float>(float aValue) { return aValue; } template <> inline int16_t FloatToAudioSample<int16_t>(float aValue) { float v = aValue*32768.0f; float clamped = std::max(-32768.0f, std::min(32767.0f, v)); return int16_t(clamped); } // Sample buffer conversion template <typename From, typename To> inline void ConvertAudioSamples(const From* aFrom, To* aTo, int aCount) { for (int i = 0; i < aCount; ++i) { aTo[i] = FloatToAudioSample<To>(AudioSampleToFloat(aFrom[i])); } } inline void ConvertAudioSamples(const int16_t* aFrom, int16_t* aTo, int aCount) { memcpy(aTo, aFrom, sizeof(*aTo)*aCount); } inline void ConvertAudioSamples(const float* aFrom, float* aTo, int aCount) { memcpy(aTo, aFrom, sizeof(*aTo)*aCount); } // Sample buffer conversion with scale template <typename From, typename To> inline void ConvertAudioSamplesWithScale(const From* aFrom, To* aTo, int aCount, float aScale) { if (aScale == 1.0f) { ConvertAudioSamples(aFrom, aTo, aCount); return; } for (int i = 0; i < aCount; ++i) { aTo[i] = FloatToAudioSample<To>(AudioSampleToFloat(aFrom[i])*aScale); } } inline void ConvertAudioSamplesWithScale(const int16_t* aFrom, int16_t* aTo, int aCount, float aScale) { if (aScale == 1.0f) { ConvertAudioSamples(aFrom, aTo, aCount); return; } if (0.0f <= aScale && aScale < 1.0f) { int32_t scale = int32_t((1 << 16) * aScale); for (int i = 0; i < aCount; ++i) { aTo[i] = int16_t((int32_t(aFrom[i]) * scale) >> 16); } return; } for (int i = 0; i < aCount; ++i) { aTo[i] = FloatToAudioSample<int16_t>(AudioSampleToFloat(aFrom[i])*aScale); } } // In place audio sample scaling. inline void ScaleAudioSamples(float* aBuffer, int aCount, float aScale) { for (int32_t i = 0; i < aCount; ++i) { aBuffer[i] *= aScale; } } inline void ScaleAudioSamples(short* aBuffer, int aCount, float aScale) { int32_t volume = int32_t((1 << 16) * aScale); for (int32_t i = 0; i < aCount; ++i) { aBuffer[i] = short((int32_t(aBuffer[i]) * volume) >> 16); } } inline const void* AddAudioSampleOffset(const void* aBase, AudioSampleFormat aFormat, int32_t aOffset) { MOZ_STATIC_ASSERT(AUDIO_FORMAT_S16 == 0, "Bad constant"); MOZ_STATIC_ASSERT(AUDIO_FORMAT_FLOAT32 == 1, "Bad constant"); NS_ASSERTION(aFormat == AUDIO_FORMAT_S16 || aFormat == AUDIO_FORMAT_FLOAT32, "Unknown format"); return static_cast<const uint8_t*>(aBase) + (aFormat + 1)*2*aOffset; } } // namespace mozilla #endif /* MOZILLA_AUDIOSAMPLEFORMAT_H_ */
/*------------------------------------------------------------------------- * * fsm_internal.h * internal functions for free space map * * * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/fsm_internals.h * *------------------------------------------------------------------------- */ #ifndef FSM_INTERNALS_H #define FSM_INTERNALS_H #include "storage/buf.h" #include "storage/bufpage.h" /* * Structure of a FSM page. See src/backend/storage/freespace/README for * details. */ typedef struct { /* * fsm_search_avail() tries to spread the load of multiple backends by * returning different pages to different backends in a round-robin * fashion. fp_next_slot points to the next slot to be returned (assuming * there's enough space on it for the request). It's defined as an int, * because it's updated without an exclusive lock. uint16 would be more * appropriate, but int is more likely to be atomically * fetchable/storable. */ int fp_next_slot; /* * fp_nodes contains the binary tree, stored in array. The first * NonLeafNodesPerPage elements are upper nodes, and the following * LeafNodesPerPage elements are leaf nodes. Unused nodes are zero. */ uint8 fp_nodes[FLEXIBLE_ARRAY_MEMBER]; } FSMPageData; typedef FSMPageData *FSMPage; /* * Number of non-leaf and leaf nodes, and nodes in total, on an FSM page. * These definitions are internal to fsmpage.c. */ #define NodesPerPage (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ offsetof(FSMPageData, fp_nodes)) #define NonLeafNodesPerPage (BLCKSZ / 2 - 1) #define LeafNodesPerPage (NodesPerPage - NonLeafNodesPerPage) /* * Number of FSM "slots" on a FSM page. This is what should be used * outside fsmpage.c. */ #define SlotsPerFSMPage LeafNodesPerPage /* Prototypes for functions in fsmpage.c */ extern int fsm_search_avail(Buffer buf, uint8 min_cat, bool advancenext, bool exclusive_lock_held); extern uint8 fsm_get_avail(Page page, int slot); extern uint8 fsm_get_max_avail(Page page); extern bool fsm_set_avail(Page page, int slot, uint8 value); extern bool fsm_truncate_avail(Page page, int nslots); extern bool fsm_rebuild_page(Page page); #endif /* FSM_INTERNALS_H */
/* -*- c++ -*- */ /* * Copyright 2006 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ // WARNING: this file is machine generated. Edits will be over written #ifndef INCLUDED_GR_PACKED_TO_UNPACKED_SS_H #define INCLUDED_GR_PACKED_TO_UNPACKED_SS_H #include <gr_core_api.h> #include <gr_block.h> #include <gr_endianness.h> class gr_packed_to_unpacked_ss; typedef boost::shared_ptr<gr_packed_to_unpacked_ss> gr_packed_to_unpacked_ss_sptr; GR_CORE_API gr_packed_to_unpacked_ss_sptr gr_make_packed_to_unpacked_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); /*! * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts. * \ingroup converter_blk * * input: stream of short; output: stream of short * * This is the inverse of gr_unpacked_to_packed_XX. * * The bits in the bytes or shorts input stream are grouped into chunks of * \p bits_per_chunk bits and each resulting chunk is written right- * justified to the output stream of bytes or shorts. * All b or 16 bits of the each input bytes or short are processed. * The right thing is done if bits_per_chunk is not a power of two. * * The combination of gr_packed_to_unpacked_XX_ followed by * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the * general case of mapping from a stream of bytes or shorts into * arbitrary float or complex symbols. * * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss, * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. */ class GR_CORE_API gr_packed_to_unpacked_ss : public gr_block { friend GR_CORE_API gr_packed_to_unpacked_ss_sptr gr_make_packed_to_unpacked_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); gr_packed_to_unpacked_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); unsigned int d_bits_per_chunk; gr_endianness_t d_endianness; unsigned int d_index; public: void forecast(int noutput_items, gr_vector_int &ninput_items_required); int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; } }; #endif
// SteepdnFsolver.h: interface for the CSteepdnFsolver class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_STEEPDNFSOLVER_H__ECC9AF9F_D8F3_4E95_9167_8124F854D641__INCLUDED_) #define AFX_STEEPDNFSOLVER_H__ECC9AF9F_D8F3_4E95_9167_8124F854D641__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CSteepdnFsolver { public: double Q9nt; CSteepdnFsolver(); ~CSteepdnFsolver(); void ff4(double x[3], double f[4], double P1, double P2, double P3); void ff5(double x[4], double f[5], double P1, double P2, double P3,double P4); void ff6(double x[5], double f[6], double P1, double P2, double P3,double P4,double P5); void ff7(double x[6], double f[7], double P1, double P2, double P3,double P4,double P5,double P6); void fd4(double x[3], double df[4][3]); void fd5(double x[4], double df[5][5]); void fd6(double x[5], double df[6][6]); void fd7(double x[6], double df[7][7]); void CalR7Mode(double P1,double P2,double P3,double P4,double P5,double P6); void CalR6Mode(double P1,double P2,double P3,double P4,double P5); void CalR5Mode(double P1,double P2,double P3,double P4); void CalR4Mode(double P1,double P2,double P3); int iter; double R; double p; double Q1; double Q2; double Q3; double Q4; }; #endif // !defined(AFX_STEEPDNFSOLVER_H__ECC9AF9F_D8F3_4E95_9167_8124F854D641__INCLUDED_)
/* * linux/include/linux/nfsd/debug.h * * Debugging-related stuff for nfsd * * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_DEBUG_H #define LINUX_NFSD_DEBUG_H #include <linux/sunrpc/debug.h> /* * Enable debugging for nfsd. * Requires RPC_DEBUG. */ #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) # define NFSD_DEBUG 1 #endif /* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001 #define NFSDDBG_FH 0x0002 #define NFSDDBG_EXPORT 0x0004 #define NFSDDBG_SVC 0x0008 #define NFSDDBG_PROC 0x0010 #define NFSDDBG_FILEOP 0x0020 #define NFSDDBG_AUTH 0x0040 #define NFSDDBG_REPCACHE 0x0080 #define NFSDDBG_XDR 0x0100 #define NFSDDBG_LOCKD 0x0200 #define NFSDDBG_ALL 0x7FFF #define NFSDDBG_NOCHANGE 0xFFFF #endif /* LINUX_NFSD_DEBUG_H */
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === * * Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org> * Copyright 2013, Teo Mrnjavac <teo@kde.org> * * Tomahawk 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. * * Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MEDIASTREAM_H #define MEDIASTREAM_H #include "DllMacro.h" #include "Typedefs.h" #include <QUrl> #include <QIODevice> class DLLEXPORT MediaStream : public QObject { Q_OBJECT public: enum MediaType { Unknown = -1, Empty = 0, Url = 1, Stream = 2, IODevice = 3 }; MediaStream( QObject* parent = nullptr ); explicit MediaStream( const QUrl &url ); explicit MediaStream( QIODevice* device, bool bufferingFinished = false ); virtual ~MediaStream(); MediaType type() const; QUrl url() const; void setStreamSize( qint64 size ); qint64 streamSize() const; virtual void seekStream( qint64 offset ) { (void)offset; } virtual qint64 needData ( void** buffer ) { (void)buffer; return 0; } int readCallback( const char* cookie, int64_t* dts, int64_t* pts, unsigned* flags, size_t* bufferSize, void** buffer ); int readDoneCallback ( const char *cookie, size_t bufferSize, void *buffer ); static int seekCallback ( void *data, const uint64_t pos ); public slots: void bufferingFinished(); protected: void endOfData(); MediaType m_type; QUrl m_url; QIODevice* m_ioDevice; bool m_started = false; bool m_bufferingFinished = false; bool m_eos = false; qint64 m_pos = 0; qint64 m_streamSize = 0; char m_buffer[1048576]; private: Q_DISABLE_COPY( MediaStream ) }; #endif // MEDIASTREAM_H
#include <grass/raster.h> #include "clr.h" /* Font sizes */ #define PS_FONT_MAX_SIZE 50 #define PS_FONT_MIN_SIZE 1 #define PS_FONT_DEFAULT_SIZE 8 #define DELTA_Y 0.05 #define MAX_PSFILES 20 #define PAGE_PORTRAIT 1 #define PAGE_LANDSCAPE 2 /* Following XCONV, YCONV were commented because of using G_plot_where_xy() * and uncommented again because G_adjust_easting * in it is not best for each case, RB Jan 2000 */ #define XCONV(E_COORD) (PS.map_left + PS.ew_to_x * ((E_COORD) - PS.w.west)) #define YCONV(N_COORD) (PS.map_bot + PS.ns_to_y * ((N_COORD) - PS.w.south)) struct PS_data { struct Cell_head w; struct Colors colors; struct Categories cats; CELL min_color, max_color; const char *cell_mapset; char *cell_name; char *plfile; char *commentfile; char *grid_font, *geogrid_font; char *psfiles[MAX_PSFILES]; char scaletext[100]; char celltitle[100]; int level; int grey; int mask_needed; int do_header; int do_raster; int do_colortable; int do_border; int do_scalebar; int num_psfiles; int grid, grid_numbers, grid_fontsize; PSCOLOR grid_color, grid_numbers_color; float grid_cross; char geogridunit[64]; int geogrid, geogrid_numbers, geogrid_fontsize; PSCOLOR geogrid_color, geogrid_numbers_color; double grid_width, geogrid_width; int do_outline; PSCOLOR outline_color; int cell_fd; int row_delta, col_delta; int cells_wide, cells_high; int num_panels, startpanel, endpanel; int res; double page_width, page_height; double left_marg, right_marg, top_marg, bot_marg; double map_x_orig, map_y_orig, map_y_loc, min_y, set_y; /* map_y_loc is set by 'maploc' as distance from top * map_x_orig is from left, map_y_orig is from bottom */ double map_pix_wide, map_pix_high; double map_width, map_height; double map_top, map_bot, map_left, map_right; double ew_res, ns_res; double ew_to_x, ns_to_y; double r0, g0, b0; int mask_color; double mask_r, mask_g, mask_b; double outline_width; FILE *fp; }; #ifdef WHITE #undef WHITE #endif #ifdef BLACK #undef BLACK #endif #ifdef GREY #undef GREY #endif extern struct PS_data PS; extern int WHITE, BLACK, GREY, sec_draw;
/** ****************************************************************************** * @file PWR/PWR_CurrentConsumption/Src/stm32f4xx_hal_msp.c * @author MCD Application Team * @version V1.0.1 * @date 29-January-2016 * @brief HAL MSP module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /** @addtogroup STM32F4xx_HAL_Examples * @{ */ /** @defgroup PWR_CurrentConsumption * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup HAL_MSP_Private_Functions * @{ */ /** * @brief RTC MSP Initialization * This function configures the hardware resources used in this example * @param hrtc: RTC handle pointer * * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select * the RTC clock source; in this case the Backup domain will be reset in * order to modify the RTC Clock source, as consequence RTC registers (including * the backup registers) and RCC_BDCR register are set to their reset values. * * @retval None */ void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; /*##-1- Configue LSI as RTC clock soucre ###################################*/ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; RCC_OscInitStruct.LSIState = RCC_LSI_ON; if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { /* Initialization Error */ Error_Handler(); } PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Enable RTC peripheral Clocks #######################################*/ /* Enable RTC Clock */ __HAL_RCC_RTC_ENABLE(); /*##-3- Configure the NVIC for RTC WakeUp Timer ############################*/ HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0x0F, 0); HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn); } /** * @brief RTC MSP De-Initialization * This function freeze the hardware resources used in this example: * - Disable the Peripheral's clock * @param hrtc: RTC handle pointer * @retval None */ void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc) { /*##-1- Reset peripherals ##################################################*/ __HAL_RCC_RTC_DISABLE(); } /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of COLLADAStreamWriter. Licensed under the MIT Open Source License, for details please see LICENSE file or the website http://www.opensource.org/licenses/mit-license.php */ #ifndef __COLLADASTREAMWRITER_LIBRARY_H__ #define __COLLADASTREAMWRITER_LIBRARY_H__ #include "COLLADASWPrerequisites.h" #include "COLLADASWElementWriter.h" namespace COLLADASW { /** Base class for all libraries*/ class Library : public ElementWriter { public: /** Constructor @param streamWriter the stream writer the library should be written to */ Library ( StreamWriter* streamWriter, const String& name ); /** Destructor*/ virtual ~Library() {} /** Closes the @a \<library_geometry\> tag. This function should be called after the last geometry has been added*/ void closeLibrary(); /** Opens the library. This function must be called before the first geometry is added*/ void openLibrary(); private: TagCloser mLibraryCloser; ///< Used to close the library tag bool mLibraryOpen; ///< true, if a library has been open and not closed. false otherwise. const String& mName; }; } //namespace COLLADASW #endif //__COLLADASTREAMWRITER_LIBRARY_H__
#pragma once #include <string> void LOG_DIRECT(const std::string& f);
/* * virsh-completer-host.c: virsh completer callbacks related to host * * Copyright (C) 2019 Red Hat, Inc. * * 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.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ #include <config.h> #include "virsh-completer-host.h" #include "viralloc.h" #include "virsh.h" #include "virstring.h" #include "virxml.h" #include "virutil.h" static char * virshPagesizeNodeToString(xmlNodePtr node) { g_autofree char *pagesize = NULL; g_autofree char *unit = NULL; unsigned long long byteval = 0; const char *suffix = NULL; double size = 0; char *ret; pagesize = virXMLPropString(node, "size"); unit = virXMLPropString(node, "unit"); if (virStrToLong_ull(pagesize, NULL, 10, &byteval) < 0) return NULL; if (virScaleInteger(&byteval, unit, 1024, UINT_MAX) < 0) return NULL; size = vshPrettyCapacity(byteval, &suffix); ret = g_strdup_printf("%.0f%s", size, suffix); return ret; } char ** virshAllocpagesPagesizeCompleter(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED, unsigned int flags) { g_autoptr(xmlXPathContext) ctxt = NULL; virshControlPtr priv = ctl->privData; unsigned int npages = 0; g_autofree xmlNodePtr *pages = NULL; g_autoptr(xmlDoc) doc = NULL; size_t i = 0; const char *cellnum = NULL; bool cellno = vshCommandOptBool(cmd, "cellno"); g_autofree char *path = NULL; g_autofree char *cap_xml = NULL; VIR_AUTOSTRINGLIST tmp = NULL; virCheckFlags(0, NULL); if (!priv->conn || virConnectIsAlive(priv->conn) <= 0) return NULL; if (!(cap_xml = virConnectGetCapabilities(priv->conn))) return NULL; if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) return NULL; if (cellno && vshCommandOptStringQuiet(ctl, cmd, "cellno", &cellnum) > 0) { path = g_strdup_printf("/capabilities/host/topology/cells/cell[@id=\"%s\"]/pages", cellnum); } else { path = g_strdup("/capabilities/host/cpu/pages"); } npages = virXPathNodeSet(path, ctxt, &pages); if (npages <= 0) return NULL; if (VIR_ALLOC_N(tmp, npages + 1) < 0) return NULL; for (i = 0; i < npages; i++) { if (!(tmp[i] = virshPagesizeNodeToString(pages[i]))) return NULL; } return g_steal_pointer(&tmp); } char ** virshCellnoCompleter(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED, unsigned int flags) { g_autoptr(xmlXPathContext) ctxt = NULL; virshControlPtr priv = ctl->privData; unsigned int ncells = 0; g_autofree xmlNodePtr *cells = NULL; g_autoptr(xmlDoc) doc = NULL; size_t i = 0; g_autofree char *cap_xml = NULL; VIR_AUTOSTRINGLIST tmp = NULL; virCheckFlags(0, NULL); if (!priv->conn || virConnectIsAlive(priv->conn) <= 0) return NULL; if (!(cap_xml = virConnectGetCapabilities(priv->conn))) return NULL; if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) return NULL; ncells = virXPathNodeSet("/capabilities/host/topology/cells/cell", ctxt, &cells); if (ncells <= 0) return NULL; if (VIR_ALLOC_N(tmp, ncells + 1)) return NULL; for (i = 0; i < ncells; i++) { if (!(tmp[i] = virXMLPropString(cells[i], "id"))) return NULL; } return g_steal_pointer(&tmp); }
/* Copyright (C) 2011 Fredrik Johansson Copyright (C) 2013 Mike Hansen This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */ #include "fq_poly.h" #ifdef T #undef T #endif #define T fq #define CAP_T FQ #include "fq_poly_templates/test/t-inflate.c" #undef CAP_T #undef T
/* Copyright (C) 2010 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "fmpz_mat.h" void fmpz_mat_randtest(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) { slong r, c, i, j; r = mat->r; c = mat->c; for (i = 0; i < r; i++) for (j = 0; j < c; j++) fmpz_randtest(mat->rows[i] + j, state, bits); }
/** <title>CGBase</title> <abstract>C Interface to graphics drawing library</abstract> Copyright <copy>(C) 2010 Free Software Foundation, Inc.</copy> Author: Eric Wasylishen Date: Jan 2010 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.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef OPAL_CGBase_h #define OPAL_CGBase_h #include <stdlib.h> #include <stdint.h> #include <stdbool.h> // for off_t #include <sys/types.h> // Note: GNUstep Foundation defines CGFloat #import <Foundation/Foundation.h> #import <CoreFoundation/CoreFoundation.h> #endif #ifndef OPAL_CGBase_h #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) #endif #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif /* Typedefs for CoreFoundation types */ typedef signed long CFIndex; typedef unsigned long CFTypeID; typedef NSRange CFRange; typedef NSComparisonResult CFComparisonResult; #ifdef __OBJC__ @class NSObject; typedef NSObject *CFTypeRef; #else typedef struct NSObject * CFTypeRef; #endif #ifdef __OBJC__ @class NSString; @class NSMutableString; typedef NSString* CFStringRef; typedef NSMutableString* CFMutableStringRef; #else typedef const struct __CFString * CFStringRef; typedef struct __CFString * CFMutableStringRef; #endif #ifdef __OBJC__ @class NSAttributedString; @class NSMutableAttributedString; typedef NSAttributedString* CFAttributedStringRef; typedef NSMutableAttributedString* CFMutableAttributedStringRef; #else typedef struct CFAttributedString * CFAttributedStringRef; typedef struct CFMutableAttributedString * CFMutableAttributedStringRef; #endif #ifdef __OBJC__ @class NSArray; @class NSMutableArray; typedef NSArray* CFArrayRef; typedef NSMutableArray* CFMutableArrayRef; #else typedef struct CFArray *CFArrayRef; typedef struct CFArray *CFMutableArrayRef; #endif #ifdef __OBJC__ @class NSCharacterSet; typedef NSCharacterSet* CFCharacterSetRef; #else typedef struct CFCharacterSet * CFCharacterSetRef; #endif #ifdef __OBJC__ @class NSData; @class NSMutableData; typedef NSData* CFDataRef; typedef NSMutableData* CFMutableDataRef; #else typedef struct CFData *CFDataRef; typedef struct CFMutableData *CFMutableDataRef; #endif #ifdef __OBJC__ @class NSDate; @class NSTimeZone; typedef NSDate* CFDateRef; typedef NSTimeZone* CFTimeZoneRef; #else typedef struct CFDate *CFDateRef; typedef struct CFTimeZone *CFTimeZoneRef; #endif #ifdef __OBJC__ @class NSDictionary; @class NSMutableDictionary; typedef NSDictionary* CFDictionaryRef; typedef NSMutableDictionary* CFMutableDictionaryRef; #else typedef struct CFDictionary * CFDictionaryRef; typedef struct CFMutableDictionary * CFMutableDictionaryRef; #endif #ifdef __OBJC__ @class NSError; typedef NSError* CFErrorRef; #else typedef struct CFError *CFErrorRef; #endif #ifdef __OBJC__ @class NSNumber; typedef NSNumber* CFNumberRef; #else typedef struct NSNumber * CFNumberRef; #endif #ifdef __OBJC__ @class NSSet; @class NSMutableSet; typedef NSSet* CFSetRef; typedef NSMutableSet* CFMutableSetRef; #else typedef struct CFSet * CFSetRef; typedef struct CFMutableSet * CFMutableSetRef; #endif #ifdef __OBJC__ @class NSURL; typedef NSURL *CFURLRef; #else typedef struct CFURL *CFURLRef; #endif #endif /* OPAL_CGBase_h */
int mydbl(int input) { return input * 2; }
/* * Mock version of dbus-launch, for gdbus-unix-addresses test * * Copyright © 2015 Collabora Ltd. * * 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.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <glib.h> #ifndef G_OS_UNIX #error This is a Unix-specific test helper #endif #include <errno.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #define ME "GDBus mock version of dbus-launch" static void write_all (const void *ptr, size_t len) { const char *p = ptr; while (len > 0) { gssize done = write (STDOUT_FILENO, p, len); int errsv = errno; if (done == 0) { g_error ("%s: write: EOF", ME); } else if (done < 0) { if (errsv == EINTR) continue; g_error ("%s: write: %s", ME, g_strerror (errsv)); } else { if (len < (size_t) done) g_error ("%s: wrote too many bytes?", ME); len -= done; p += done; } } } int main (int argc, char *argv[]) { pid_t pid = 0x2323; long window_id = 0x42424242; const char *addr = "hello:this=address-is-from-the,mock=dbus-launch"; write_all (addr, strlen (addr) + 1); write_all (&pid, sizeof (pid)); write_all (&window_id, sizeof (window_id)); return 0; }
//===--- CodeGenTBAA.h - TBAA information for LLVM CodeGen ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This is the code that manages TBAA information and defines the TBAA policy // for the optimizer to use. // //===----------------------------------------------------------------------===// #ifndef CLANG_CODEGEN_CODEGENTBAA_H #define CLANG_CODEGEN_CODEGENTBAA_H #include "clang/Basic/LLVM.h" #include "llvm/MDBuilder.h" #include "llvm/ADT/DenseMap.h" namespace llvm { class LLVMContext; class MDNode; } namespace clang { class ASTContext; class CodeGenOptions; class LangOptions; class MangleContext; class QualType; class Type; namespace CodeGen { class CGRecordLayout; /// CodeGenTBAA - This class organizes the cross-module state that is used /// while lowering AST types to LLVM types. class CodeGenTBAA { ASTContext &Context; const CodeGenOptions &CodeGenOpts; const LangOptions &Features; MangleContext &MContext; // MDHelper - Helper for creating metadata. llvm::MDBuilder MDHelper; /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them. llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache; llvm::MDNode *Root; llvm::MDNode *Char; /// getRoot - This is the mdnode for the root of the metadata type graph /// for this translation unit. llvm::MDNode *getRoot(); /// getChar - This is the mdnode for "char", which is special, and any types /// considered to be equivalent to it. llvm::MDNode *getChar(); public: CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext, const CodeGenOptions &CGO, const LangOptions &Features, MangleContext &MContext); ~CodeGenTBAA(); /// getTBAAInfo - Get the TBAA MDNode to be used for a dereference /// of the given type. llvm::MDNode *getTBAAInfo(QualType QTy); /// getTBAAInfoForVTablePtr - Get the TBAA MDNode to be used for a /// dereference of a vtable pointer. llvm::MDNode *getTBAAInfoForVTablePtr(); }; } // end namespace CodeGen } // end namespace clang #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #ifndef S60DEVICEDEBUGRUNCONTROL_H #define S60DEVICEDEBUGRUNCONTROL_H #include <debugger/debuggerrunner.h> namespace Qt4ProjectManager { class S60DeviceRunConfiguration; class CodaRunControl; namespace Internal { class S60DeviceDebugRunControl : public Debugger::DebuggerRunControl { Q_OBJECT public: explicit S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration, const Debugger::DebuggerStartParameters &sp, const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes); virtual void start(); virtual bool promptToStop(bool *optionalPrompt = 0) const; private slots: void remoteSetupRequested(); void codaConnected(); void qmlEngineStateChanged(Debugger::DebuggerState state); void codaFinished(); void handleDebuggingFinished(); void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format); private: CodaRunControl *m_codaRunControl; enum { ENotUsingCodaRunControl = 0, EWaitingForCodaConnection, ECodaConnected } m_codaState; }; class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory { public: explicit S60DeviceDebugRunControlFactory(QObject *parent = 0); bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const; ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode); QString displayName() const; ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */); }; } // namespace Internal } // namespace Qt4ProjectManager #endif // S60DEVICEDEBUGRUNCONTROL_H
/* Copyright (C) 2017 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "mag.h" slong fmpr_sinh(fmpr_t y, const fmpr_t x, slong prec, fmpr_rnd_t rnd) { if (fmpr_is_special(x)) { fmpr_set(y, x); return FMPR_RESULT_EXACT; } else { slong r; CALL_MPFR_FUNC(r, mpfr_sinh, y, x, prec, rnd); return r; } } int main() { slong iter; flint_rand_t state; flint_printf("sinh_lower...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { fmpr_t x, y, z, z2; mag_t xb, yb; fmpr_init(x); fmpr_init(y); fmpr_init(z); fmpr_init(z2); mag_init(xb); mag_init(yb); mag_randtest_special(xb, state, 0); mag_mul_2exp_si(xb, xb, -100 + n_randint(state,120)); mag_randtest_special(yb, state, 25); mag_sinh_lower(yb, xb); mag_get_fmpr(x, xb); mag_get_fmpr(y, yb); fmpr_sinh(z, x, MAG_BITS, FMPR_RND_DOWN); fmpr_mul_ui(z2, z, 1023, MAG_BITS, FMPR_RND_DOWN); fmpr_mul_2exp_si(z2, z2, -10); MAG_CHECK_BITS(xb) MAG_CHECK_BITS(yb) if (!(fmpr_cmpabs(z2, y) <= 0 && fmpr_cmpabs(y, z) <= 0)) { flint_printf("FAIL\n\n"); flint_printf("x = "); fmpr_print(x); flint_printf("\n\n"); flint_printf("y = "); fmpr_print(y); flint_printf("\n\n"); flint_printf("z = "); fmpr_print(z); flint_printf("\n\n"); flint_printf("z2 = "); fmpr_print(z2); flint_printf("\n\n"); flint_abort(); } mag_sinh_lower(xb, xb); if (!mag_equal(xb, yb)) { flint_printf("FAIL (aliasing)\n\n"); flint_abort(); } fmpr_clear(x); fmpr_clear(y); fmpr_clear(z); fmpr_clear(z2); mag_clear(xb); mag_clear(yb); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
// // Copyright (C) 2006-2012 SIPez LLC. All rights reserved. // // Copyright (C) 2004-2006 SIPfoundry Inc. // Licensed by SIPfoundry under the LGPL license. // // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved. // Licensed to SIPfoundry under a Contributor Agreement. // // $$ /////////////////////////////////////////////////////////////////////////////// #ifndef _OsTime_h_ #define _OsTime_h_ // SYSTEM INCLUDES // APPLICATION INCLUDES #include "os/OsDefs.h" #include "utl/UtlDefs.h" // DEFINES // MACROS // EXTERNAL FUNCTIONS // EXTERNAL VARIABLES // CONSTANTS // STRUCTS // TYPEDEFS // FORWARD DECLARATIONS //:Time or time interval // If necessary, this class will adjust the seconds and microseconds values // that it reports such that 0 <= microseconds < USECS_PER_SEC. class OsTime { /* //////////////////////////// PUBLIC //////////////////////////////////// */ public: /// Time quantity enum for special time values typedef enum { OS_INFINITY = -1, NO_WAIT_TIME = 0 } TimeQuantity; static const long MSECS_PER_SEC; static const long USECS_PER_MSEC; static const long USECS_PER_SEC; /* ============================ CREATORS ================================== */ OsTime(); //:Default constructor (creates a zero duration interval) OsTime(const long msecs); //:Constructor specifying time/duration in terms of milliseconds OsTime(TimeQuantity quantity); //:Constructor specifying time/duration in terms of TimeQuantity enum OsTime(const long seconds, const long usecs); //:Constructor specifying time/duration in terms of seconds and microseconds OsTime(const OsTime& rOsTime); //:Copy constructor virtual ~OsTime(); //:Destructor /* ============================ MANIPULATORS ============================== */ OsTime& operator=(TimeQuantity rhs); //:Assignment operator OsTime& operator=(const OsTime& rhs); //:Assignment operator OsTime operator+(const OsTime& rhs); //:Addition operator OsTime operator-(const OsTime& rhs); //:Subtraction operator OsTime operator+=(const OsTime& rhs); //:Increment operator OsTime operator-=(const OsTime& rhs); //:Decrement operator bool operator==(const OsTime& rhs) const; //:Test for equality operator bool operator!=(const OsTime& rhs) const; //:Test for inequality operator bool operator>(const OsTime& rhs) const; //:Test for greater than bool operator>=(const OsTime& rhs) const; //:Test for greater than or equal bool operator<(const OsTime& rhs) const; //:Test for less than bool operator<=(const OsTime& rhs) const; //:Test for less than or equal /* ============================ ACCESSORS ================================= */ virtual long seconds(void) const { return mSeconds; } //:Return the seconds portion of the time interval virtual long usecs(void) const { return mUsecs; } //:Return the microseconds portion of the time interval virtual long cvtToMsecs(void) const; //:Convert the time interval to milliseconds virtual double getDouble() const; //: Return number of seconds (and microseconds) as a double /* ============================ INQUIRY =================================== */ virtual UtlBoolean isInfinite(void) const; //:Return TRUE if the time interval is infinite virtual UtlBoolean isNoWait(void) const; //:Return TRUE if the time interval is zero (no wait) /* //////////////////////////// PROTECTED ///////////////////////////////// */ protected: /* //////////////////////////// PRIVATE /////////////////////////////////// */ private: long mSeconds; long mUsecs; void init(void); //:Initialize the instance variables for a newly constructed object }; /* ============================ INLINE METHODS ============================ */ #endif // _OsTime_h_