text
stringlengths
4
6.14k
/* linux/include/asm-arm/plat-s3c24xx/clock.h * linux/arch/arm/mach-s3c2410/clock.h * * Copyright (c) 2004-2005 Simtec Electronics * http://www.simtec.co.uk/products/SWLINUX/ * Written by Ben Dooks, <ben@simtec.co.uk> * * 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. */ struct clk { struct list_head list; struct module *owner; struct clk *parent; const char *name; int id; int usage; unsigned long rate; unsigned long ctrlbit; int (*enable)(struct clk *, int enable); int (*set_rate)(struct clk *c, unsigned long rate); unsigned long (*get_rate)(struct clk *c); unsigned long (*round_rate)(struct clk *c, unsigned long rate); int (*set_parent)(struct clk *c, struct clk *parent); }; /* core clock support */ extern struct clk clk_f; extern struct clk clk_h; extern struct clk clk_p; extern struct clk clk_mpll; extern struct clk clk_xtal; extern struct clk clk_epll; /* exports for arch/arm/mach-s3c2410 * * Please DO NOT use these outside of arch/arm/mach-s3c2410 */ extern struct mutex clocks_mutex; void s3c_clk_enable (uint clocks, uint enable, ulong gate_reg); extern int s3c64xx_register_clock(struct clk *clk); extern int s3c64xx_register_clocks(struct clk **clk, int nr_clks); extern int s3c64xx_setup_clocks(unsigned long xtal, unsigned long fclk, unsigned long hclk, unsigned long pclk); extern struct clk clk_48m; extern struct clk clk_s; extern struct clk clk_u; extern struct clk clk_27m; extern struct clk clk_hx2;
/* GdkPixbuf RGBA C-Source image dump */ #ifdef __SUNPRO_C #pragma align 4 (stock_rollup_data) #endif #ifdef __GNUC__ static const guint8 stock_rollup_data[] __attribute__ ((__aligned__ (4))) = #else static const guint8 stock_rollup_data[] = #endif { "" /* Pixbuf magic (0x47646b50) */ "GdkP" /* length: header (24) + pixel_data (1024) */ "\0\0\4\30" /* pixdata_type (0x1010002) */ "\1\1\0\2" /* rowstride (64) */ "\0\0\0@" /* width (16) */ "\0\0\0\20" /* height (16) */ "\0\0\0\20" /* pixel_data: */ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\342\342\336\0\342\342\336\0\342" "\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342" "\342\336\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342" "\336\0\342\342\336\0\342\342\336\0\342\342\336\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\342\342\336\0\342\342\336" "\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336" "\0\342\342\336\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0" "\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\342\342\336\0\342" "\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342" "\342\336\0\342\342\336\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342" "\336\0\342\342\336\0\342\342\336\0\342\342\336\0\342\342\336\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2017 UniPro <ugene@unipro.ru> * http://ugene.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #ifndef _U2_FIND_PRIMER_GROUPS_WORKER_H_ #define _U2_FIND_PRIMER_GROUPS_WORKER_H_ #include <U2Lang/LocalDomain.h> #include <U2Lang/WorkflowUtils.h> #include <U2Core/MultipleSequenceAlignment.h> #include <U2Core/DNASequence.h> #include "PrimerStatistics.h" namespace U2 { namespace LocalWorkflow { class PrimersGrouperPromter : public PrompterBase<PrimersGrouperPromter> { Q_OBJECT public: PrimersGrouperPromter( Actor * p = 0 ) : PrompterBase<PrimersGrouperPromter>(p) {}; protected: QString composeRichDoc(); }; class PrimersGrouperWorker : public BaseWorker { Q_OBJECT public: PrimersGrouperWorker( Actor * p ) : BaseWorker(p), inPort(NULL), outPort(NULL) {}; virtual void init(); virtual Task* tick(); virtual void cleanup(); private: IntegralBus* inPort; IntegralBus* outPort; private slots: void sl_onTaskFinished(Task* t); private: QList<DNASequence> data; }; class PrimersGrouperWorkerFactory : public DomainFactory { public: const static QString ACTOR_ID; const static QString OUT_FILE; PrimersGrouperWorkerFactory() : DomainFactory(ACTOR_ID) {}; static void init(); virtual Worker* createWorker( Actor * a ) { return new PrimersGrouperWorker(a); } }; } //LocalWorkflow namespace class PrimerGrouperTask : public Task { Q_OBJECT public: PrimerGrouperTask(const QString& outputFileUrl, const QList<DNASequence>& sequences); void run(); QString getReport() const { return report; } static QString createCell(const QString& value, bool center = false, const QString &attrs = ""); static QString createColumn(const QString& name, const QString &attrs = ""); private: void createReport(const QList<QList<int> >& groups); void fillReportTable(const QList<QList<int> >& groups); void writeReportToFile(); QString createRow(const QString& groupName, const QString& forwardName, const QString& reverseName, const QString& forwardTm, const QString& reverseTm); bool isCompatiblePairs(int firstPairIndex, int secondPairIndex); void findCompatibleGroups(); private: typedef QPair<DNASequence, DNASequence> PrimersPair; QList<PrimersPair> primerPairs; QString report; QString outputUrl; }; } //U2 namespace #endif
/* * arch/ppc/platforms/pal4.h * * Definitions for SBS Palomar IV board * * Author: Dan Cox * * 2002 (c) MontaVista, Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #ifndef __PPC_PLATFORMS_PAL4_H #define __PPC_PLATFORMS_PAL4_H #include <asm/io.h> #define CPC700_MEM_CFGADDR 0xff500008 #define CPC700_MEM_CFGDATA 0xff50000c #define CPC700_MB0SA 0x38 #define CPC700_MB0EA 0x58 #define CPC700_MB1SA 0x3c #define CPC700_MB1EA 0x5c #define CPC700_MB2SA 0x40 #define CPC700_MB2EA 0x60 #define CPC700_MB3SA 0x44 #define CPC700_MB3EA 0x64 #define CPC700_MB4SA 0x48 #define CPC700_MB4EA 0x68 extern inline long cpc700_read_memreg(int reg) { out_be32((volatile unsigned int *) CPC700_MEM_CFGADDR, reg); return in_be32((volatile unsigned int *) CPC700_MEM_CFGDATA); } #define PAL4_NVRAM 0xfffc0000 #define PAL4_NVRAM_SIZE 0x8000 #define PAL4_DRAM 0xfff80000 #define PAL4_DRAM_BR_MASK 0xc0 #define PAL4_DRAM_BR_SHIFT 6 #define PAL4_DRAM_RESET 0x10 #define PAL4_DRAM_EREADY 0x40 #define PAL4_MISC 0xfff80004 #define PAL4_MISC_FB_MASK 0xc0 #define PAL4_MISC_FLASH 0x40 /* StratFlash mapping: 1->0xff80, 0->0xfff0 */ #define PAL4_MISC_MISC 0x08 #define PAL4_MISC_BITF 0x02 #define PAL4_MISC_NVKS 0x01 #define PAL4_L2 0xfff80008 #define PAL4_L2_MASK 0x07 #define PAL4_PLDR 0xfff8000c /* Only two Ethernet devices on the board... */ #define PAL4_ETH 31 #define PAL4_INTA 20 #endif /* __PPC_PLATFORMS_PAL4_H */
/* scale attributes to [lower,upper] usage: scale [-l lower] [-u upper] [-y y_lower y_upper] filename */ #include <float.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #define MAX_LINE_LEN 100000 char buf[MAX_LINE_LEN]; double lower=-1.0,upper=1.0,y_lower,y_upper; int y_scaling = 0; double *feature_max; double *feature_min; double y_max = -DBL_MAX; double y_min = DBL_MAX; int max_index; #define max(x,y) ((x>y)?x:y) #define min(x,y) ((x<y)?x:y) void output_target(double value); void output(int index, double value); int main(int argc,char **argv) { int i,index; FILE *fp; for(i=1;i<argc;i++) { if(argv[i][0] != '-') break; ++i; switch(argv[i-1][1]) { case 'l': lower = atof(argv[i]); break; case 'u': upper = atof(argv[i]); break; case 'y': y_lower = atof(argv[i]); ++i; y_upper = atof(argv[i]); y_scaling = 1; break; default: fprintf(stderr,"unknown option\n"); exit(1); } } if(!(upper > lower) || (y_scaling && !(y_upper > y_lower))) { fprintf(stderr,"inconsistent lower/upper specification\n"); exit(1); } if(argc != i+1) { fprintf(stderr,"usage: %s [-l lower] [-u upper] [-y y_lower y_upper] filename\n",argv[0]); fprintf(stderr,"(default: lower = -1, upper = 1, no y scaling)\n"); exit(1); } fp=fopen(argv[i],"r"); if(fp==NULL) { fprintf(stderr,"can't open file\n"); exit(1); } #define SKIP_TARGET\ while(isspace(*p)) ++p;\ while(!isspace(*p)) ++p; #define SKIP_ELEMENT\ while(*p!=':') ++p;\ ++p;\ while(isspace(*p)) ++p;\ while(*p && !isspace(*p)) ++p; /* assumption: min index of attributes is 1 */ /* pass 1: find out max index of attributes */ max_index = 0; while(fgets(buf,MAX_LINE_LEN,fp)!=NULL) { char *p=buf; SKIP_TARGET while(sscanf(p,"%d:%*f",&index)==1) { max_index = max(max_index, index); SKIP_ELEMENT } } feature_max = (double *)malloc((max_index+1)* sizeof(double)); feature_min = (double *)malloc((max_index+1)* sizeof(double)); if(feature_max == NULL || feature_min == NULL) { fprintf(stderr,"can't allocate enough memory\n"); exit(1); } for(i=0;i<=max_index;i++) { feature_max[i]=-DBL_MAX; feature_min[i]=DBL_MAX; } rewind(fp); /* pass 2: find out min/max value */ while(fgets(buf,MAX_LINE_LEN,fp)!=NULL) { char *p=buf; int next_index=1; double target; double value; sscanf(p,"%lf",&target); y_max = max(y_max,target); y_min = min(y_min,target); SKIP_TARGET while(sscanf(p,"%d:%lf",&index,&value)==2) { for(i=next_index;i<index;i++) { feature_max[i]=max(feature_max[i],0); feature_min[i]=min(feature_min[i],0); } feature_max[index]=max(feature_max[index],value); feature_min[index]=min(feature_min[index],value); SKIP_ELEMENT next_index=index+1; } for(i=next_index;i<=max_index;i++) { feature_max[i]=max(feature_max[i],0); feature_min[i]=min(feature_min[i],0); } } rewind(fp); /* pass 3: scale */ while(fgets(buf,MAX_LINE_LEN,fp)!=NULL) { char *p=buf; int next_index=1; int index; double target; double value; sscanf(p,"%lf",&target); output_target(target); SKIP_TARGET while(sscanf(p,"%d:%lf",&index,&value)==2) { for(i=next_index;i<index;i++) output(i,0); output(index,value); SKIP_ELEMENT next_index=index+1; } for(i=next_index;i<=max_index;i++) output(i,0); printf("\n"); } fclose(fp); return 0; } void output_target(double value) { if(y_scaling) { if(value == y_min) value = y_lower; else if(value == y_max) value = y_upper; else value = y_lower + (y_upper-y_lower) * (value - y_min)/(y_max-y_min); } printf("%g ",value); } void output(int index, double value) { /* skip single-valued attribute */ if(feature_max[index] == feature_min[index]) return; if(value == feature_min[index]) value = lower; else if(value == feature_max[index]) value = upper; else value = lower + (upper-lower) * (value-feature_min[index])/ (feature_max[index]-feature_min[index]); if(value != 0) printf("%d:%g ",index, value); }
/* Copyright (C) 2011 Red Hat, Inc. * Written by Zane Bitter <zbitter@redhat.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file broker_federation.h * Interface to the broker federation configuration code. */ #ifndef MH_BROKER_FEDERATION_H #define MH_BROKER_FEDERATION_H /** * Read the broker federation settings from the environment and set up broker * federation. */ void broker_federation_configure(void); #endif
/* * leds-msm-pmic.c - MSM PMIC LEDs driver. * * Copyright (c) 2009, Code Aurora Forum. 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. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/leds.h> #include <mach/pmic.h> #include <mach/board_lge.h> #define MAX_KEYPAD_BL_LEVEL 16 static void msm_keypad_bl_led_set(struct led_classdev *led_cdev, enum led_brightness value) { int on_off; int brightness; /* debug mesg */ printk(KERN_INFO " LED DEBUG: Value is %d\n", value); if (value == 0) on_off = (int)PM_MPP__I_SINK__SWITCH_DIS; else on_off = (int)PM_MPP__I_SINK__SWITCH_ENA; switch (value) { case 5: brightness = PM_MPP__I_SINK__LEVEL_5mA; break; case 10: brightness = PM_MPP__I_SINK__LEVEL_10mA; break; case 15: brightness = PM_MPP__I_SINK__LEVEL_15mA; break; case 20: brightness = PM_MPP__I_SINK__LEVEL_20mA; break; case 25: brightness = PM_MPP__I_SINK__LEVEL_25mA; break; case 30: brightness = PM_MPP__I_SINK__LEVEL_30mA; break; case 35: brightness = PM_MPP__I_SINK__LEVEL_35mA; break; case 40: brightness = PM_MPP__I_SINK__LEVEL_40mA; break; default: brightness = PM_MPP__I_SINK__LEVEL_25mA; break; } /* */ brightness = PM_MPP__I_SINK__LEVEL_5mA; pmic_secure_mpp_config_i_sink((enum mpp_which)PM_MPP_3, brightness, (enum mpp_i_sink_switch)on_off); } static struct led_classdev msm_kp_bl_led = { .name = "button-backlight", .brightness_set = msm_keypad_bl_led_set, .brightness = LED_OFF, }; static int msm_pmic_led_probe(struct platform_device *pdev) { int rc; rc = led_classdev_register(&pdev->dev, &msm_kp_bl_led); if (rc) { dev_err(&pdev->dev, "unable to register led class driver\n"); return rc; } // // stay led to 'on' from boot //msm_keypad_bl_led_set(&msm_kp_bl_led, LED_OFF); return rc; } static int __devexit msm_pmic_led_remove(struct platform_device *pdev) { led_classdev_unregister(&msm_kp_bl_led); return 0; } #ifdef CONFIG_PM static int msm_pmic_led_suspend(struct platform_device *dev, pm_message_t state) { led_classdev_suspend(&msm_kp_bl_led); return 0; } static int msm_pmic_led_resume(struct platform_device *dev) { led_classdev_resume(&msm_kp_bl_led); return 0; } #else #define msm_pmic_led_suspend NULL #define msm_pmic_led_resume NULL #endif static struct platform_driver msm_pmic_led_driver = { .probe = msm_pmic_led_probe, .remove = __devexit_p(msm_pmic_led_remove), .suspend = msm_pmic_led_suspend, .resume = msm_pmic_led_resume, .driver = { .name = "pmic-leds", .owner = THIS_MODULE, }, }; static int __init msm_pmic_led_init(void) { return platform_driver_register(&msm_pmic_led_driver); } module_init(msm_pmic_led_init); static void __exit msm_pmic_led_exit(void) { platform_driver_unregister(&msm_pmic_led_driver); } module_exit(msm_pmic_led_exit); MODULE_DESCRIPTION("MSM PMIC LEDs driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:pmic-leds");
/* Company : Nequeo Pty Ltd, http://www.nequeo.com.au/ * Copyright : Copyright © Nequeo Pty Ltd 2014 http://www.nequeo.com.au/ * * File : Exception.h * Purpose : Exception class. * */ /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef _EXCEPTION_H #define _EXCEPTION_H #include "GlobalException.h" namespace Nequeo { /// This is the base class for all exceptions defined /// in the Nequeo class library. class Exception : public std::exception { public: Exception(const std::string& msg, int code = 0); /// Creates an exception. Exception(const std::string& msg, const std::string& arg, int code = 0); /// Creates an exception. Exception(const std::string& msg, const Exception& nested, int code = 0); /// Creates an exception and stores a clone /// of the nested exception. Exception(const Exception& exc); /// Copy constructor. ~Exception() throw(); /// Destroys the exception and deletes the nested exception. Exception& operator = (const Exception& exc); /// Assignment operator. virtual const char* name() const throw(); /// Returns a static string describing the exception. virtual const char* className() const throw(); /// Returns the name of the exception class. virtual const char* what() const throw(); /// Returns a static string describing the exception. /// /// Same as name(), but for compatibility with std::exception. const Exception* nested() const; /// Returns a pointer to the nested exception, or /// null if no nested exception exists. const std::string& message() const; /// Returns the message text. int code() const; /// Returns the exception code if defined. std::string displayText() const; /// Returns a string consisting of the /// message name and the message text. virtual Exception* clone() const; /// Creates an exact copy of the exception. /// /// The copy can later be thrown again by /// invoking rethrow() on it. virtual void rethrow() const; /// (Re)Throws the exception. /// /// This is useful for temporarily storing a /// copy of an exception (see clone()), then /// throwing it again. protected: Exception(int code = 0); /// Standard constructor. void message(const std::string& msg); /// Sets the message for the exception. void extendedMessage(const std::string& arg); /// Sets the extended message for the exception. private: std::string _msg; Exception* _pNested; int _code; }; } #endif
/**************************************************************************/ /* */ /* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ /* software is allowed according to terms specified in the file LICENSE */ /* which comes in the source distribution. */ /* */ /* Check http://www.nomachine.com/licensing.html for applicability. */ /* */ /* NX and NoMachine are trademarks of Medialogic S.p.A. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #ifndef TextCompressor_H #define TextCompressor_H #include "CharCache.h" class EncodeBuffer; class DecodeBuffer; class TextCompressor { public: TextCompressor(CharCache* cache, unsigned int cacheSize): cache_(cache), cacheSize_(cacheSize), key_(0) { } void encodeChar(unsigned char ch, EncodeBuffer &); unsigned char decodeChar(DecodeBuffer &); void reset(unsigned int newKey = 0) { key_ = newKey; } private: CharCache* cache_; unsigned int cacheSize_; unsigned int key_; }; #endif /* TextCompressor_H */
/* * JRCU - An RCU suitable for small SMP systems. * * Author: Joe Korty <joe.korty@ccur.com> * Copyright Concurrent Computer Corporation, 2011 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LINUX_JRCU_H #define __LINUX_JRCU_H #define __rcu_read_lock() preempt_disable() #define __rcu_read_unlock() jrcu_read_unlock() extern void jrcu_read_unlock(void); #define __rcu_read_lock_bh() __rcu_read_lock() #define __rcu_read_unlock_bh() __rcu_read_unlock() extern void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); #define call_rcu_bh call_rcu_sched #define call_rcu call_rcu_sched extern void rcu_barrier(void); #define rcu_barrier_sched rcu_barrier #define rcu_barrier_bh rcu_barrier extern void synchronize_sched(void); #define synchronize_rcu synchronize_sched #define synchronize_rcu_bh synchronize_sched #define synchronize_rcu_expedited synchronize_sched #define synchronize_rcu_bh_expedited synchronize_sched #define synchronize_sched_expedited synchronize_sched #define rcu_init(cpu) do { } while (0) #define rcu_init_sched() do { } while (0) #define exit_rcu() do { } while (0) static inline void __rcu_check_callbacks(int cpu, int user) { } #define rcu_check_callbacks __rcu_check_callbacks #define rcu_needs_cpu(cpu) (0) #define rcu_batches_completed() (0) #define rcu_batches_completed_bh() (0) #define rcu_preempt_depth() (0) extern void rcu_force_quiescent_state(void); #define rcu_sched_force_quiescent_state rcu_force_quiescent_state #define rcu_bh_force_quiescent_state rcu_force_quiescent_state #define rcu_enter_nohz() do { } while (0) #define rcu_exit_nohz() do { } while (0) extern void rcu_note_context_switch(int cpu); #define rcu_sched_qs rcu_note_context_switch #define rcu_bh_qs rcu_note_context_switch #define rcu_virt_note_context_switch rcu_note_context_switch extern void rcu_note_might_resched(void); extern void rcu_scheduler_starting(void); extern int rcu_scheduler_active __read_mostly; #endif /* __LINUX_JRCU_H */
/*--------------------------------------------------------------------*/ /*--- Interface to CPUID. pub_tool_cpuid.h ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2000-2010 Julian Seward jseward@acm.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #ifndef __PUB_TOOL_CPUID_H #define __PUB_TOOL_CPUID_H #if defined(VGA_x86) || defined(VGA_amd64) extern Bool VG_(has_cpuid) ( void ); extern void VG_(cpuid) ( UInt eax, UInt ecx, UInt* eax_ret, UInt* ebx_ret, UInt* ecx_ret, UInt* edx_ret ); #endif #endif // __PUB_TOOL_CPUID_H /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
/* Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Convert Windows API error (GetLastError() to Posix equivalent (errno) The exported function my_osmaperr() is modelled after and borrows heavily from undocumented _dosmaperr()(found of the static Microsoft C runtime). */ #include <my_global.h> #include <my_sys.h> struct errentry { unsigned long oscode; /* OS return value */ int sysv_errno; /* System V error code */ }; static struct errentry errtable[]= { { ERROR_INVALID_FUNCTION, EINVAL }, /* 1 */ { ERROR_FILE_NOT_FOUND, ENOENT }, /* 2 */ { ERROR_PATH_NOT_FOUND, ENOENT }, /* 3 */ { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, /* 4 */ { ERROR_ACCESS_DENIED, EACCES }, /* 5 */ { ERROR_INVALID_HANDLE, EBADF }, /* 6 */ { ERROR_ARENA_TRASHED, ENOMEM }, /* 7 */ { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, /* 8 */ { ERROR_INVALID_BLOCK, ENOMEM }, /* 9 */ { ERROR_BAD_ENVIRONMENT, E2BIG }, /* 10 */ { ERROR_BAD_FORMAT, ENOEXEC }, /* 11 */ { ERROR_INVALID_ACCESS, EINVAL }, /* 12 */ { ERROR_INVALID_DATA, EINVAL }, /* 13 */ { ERROR_INVALID_DRIVE, ENOENT }, /* 15 */ { ERROR_CURRENT_DIRECTORY, EACCES }, /* 16 */ { ERROR_NOT_SAME_DEVICE, EXDEV }, /* 17 */ { ERROR_NO_MORE_FILES, ENOENT }, /* 18 */ { ERROR_LOCK_VIOLATION, EACCES }, /* 33 */ { ERROR_BAD_NETPATH, ENOENT }, /* 53 */ { ERROR_NETWORK_ACCESS_DENIED, EACCES }, /* 65 */ { ERROR_BAD_NET_NAME, ENOENT }, /* 67 */ { ERROR_FILE_EXISTS, EEXIST }, /* 80 */ { ERROR_CANNOT_MAKE, EACCES }, /* 82 */ { ERROR_FAIL_I24, EACCES }, /* 83 */ { ERROR_INVALID_PARAMETER, EINVAL }, /* 87 */ { ERROR_NO_PROC_SLOTS, EAGAIN }, /* 89 */ { ERROR_DRIVE_LOCKED, EACCES }, /* 108 */ { ERROR_BROKEN_PIPE, EPIPE }, /* 109 */ { ERROR_DISK_FULL, ENOSPC }, /* 112 */ { ERROR_INVALID_TARGET_HANDLE, EBADF }, /* 114 */ { ERROR_INVALID_HANDLE, EINVAL }, /* 124 */ { ERROR_WAIT_NO_CHILDREN, ECHILD }, /* 128 */ { ERROR_CHILD_NOT_COMPLETE, ECHILD }, /* 129 */ { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, /* 130 */ { ERROR_NEGATIVE_SEEK, EINVAL }, /* 131 */ { ERROR_SEEK_ON_DEVICE, EACCES }, /* 132 */ { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, /* 145 */ { ERROR_NOT_LOCKED, EACCES }, /* 158 */ { ERROR_BAD_PATHNAME, ENOENT }, /* 161 */ { ERROR_MAX_THRDS_REACHED, EAGAIN }, /* 164 */ { ERROR_LOCK_FAILED, EACCES }, /* 167 */ { ERROR_ALREADY_EXISTS, EEXIST }, /* 183 */ { ERROR_FILENAME_EXCED_RANGE, ENOENT }, /* 206 */ { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, /* 215 */ { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */ }; /* size of the table */ #define ERRTABLESIZE (sizeof(errtable)/sizeof(errtable[0])) /* The following two constants must be the minimum and maximum values in the (contiguous) range of Exec Failure errors. */ #define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG #define MAX_EXEC_ERROR ERROR_INFLOOP_IN_RELOC_CHAIN /* These are the low and high value in the range of errors that are access violations */ #define MIN_EACCES_RANGE ERROR_WRITE_PROTECT #define MAX_EACCES_RANGE ERROR_SHARING_BUFFER_EXCEEDED static int get_errno_from_oserr(unsigned long oserrno) { int i; /* check the table for the OS error code */ for (i= 0; i < ERRTABLESIZE; ++i) { if (oserrno == errtable[i].oscode) { return errtable[i].sysv_errno; } } /* The error code wasn't in the table. We check for a range of */ /* EACCES errors or exec failure errors (ENOEXEC). Otherwise */ /* EINVAL is returned. */ if (oserrno >= MIN_EACCES_RANGE && oserrno <= MAX_EACCES_RANGE) return EACCES; else if (oserrno >= MIN_EXEC_ERROR && oserrno <= MAX_EXEC_ERROR) return ENOEXEC; else return EINVAL; } /* Set errno corresponsing to GetLastError() value */ void my_osmaperr ( unsigned long oserrno) { errno= get_errno_from_oserr(oserrno); }
#ifndef DAEMONTEST_H #define DAEMONTEST_H #include <QObject> #include <cppunit/TestFixture.h> #include <cppunit/TestSuite.h> #include <cppunit/extensions/HelperMacros.h> #include "QPackageKit" class DaemonTest : public QObject, public CppUnit::TestFixture { Q_OBJECT CPPUNIT_TEST_SUITE(DaemonTest); CPPUNIT_TEST(getBackendDetail); CPPUNIT_TEST(getActions); CPPUNIT_TEST(getFilters); CPPUNIT_TEST(getGroups); CPPUNIT_TEST(getTimeSinceAction); CPPUNIT_TEST_SUITE_END(); public: DaemonTest(QObject* parent = 0); ~DaemonTest(); void getActions(); void getBackendDetail(); void getFilters(); void getGroups(); void getTimeSinceAction(); }; #endif
#ifndef RIVERSED_H #define RIVERSED_H #include <node.h> #include <flow.h> #include <vector> #include <map> class Reactor; /* Combine Sewer and Reactor */ class RiverSed : public Node { public: RiverSed(); virtual ~RiverSed(); bool init(ptime start, ptime end, int dt); int f(ptime time, int dt); void deinit(); private: void addMuskParam(int dt); void setMuskParam(double *C_x, double *C_y, int dt); /* Stuff from Sewer */ Flow in; Flow out; Flow LATQ; int K; double X; int N; double latq; int SED; std::vector<Flow*> V; std::map<int, std::pair<double, double> > musk_param; /* Stuff from ReactorNode */ std::vector<Reactor*> reactors; std::vector<std::string> conc_formula, formula_name; std::vector<double> init_v; std::string constants; int nc, nstep; }; #endif // RIVERSED_H
/*************************************************************************** * Copyright (C) 2011 by Broadcom Corporation * * Evan Hunter - ehunter@broadcom.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifndef INCLUDED_RTOS_EMBKERNEL_STACKINGS_H_ #define INCLUDED_RTOS_EMBKERNEL_STACKINGS_H_ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "rtos.h" extern const struct rtos_register_stacking rtos_embkernel_Cortex_M3_stacking; #endif /* ifndef INCLUDED_RTOS_EMBKERNEL_STACKINGS_H_ */
/* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2011-2015 ArkCORE <http://www.arkania.net/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _AUTH_SARC4_H #define _AUTH_SARC4_H #include "Define.h" #include <openssl/evp.h> class ARC4 { public: ARC4(uint8 len); ARC4(uint8 *seed, uint8 len); ~ARC4(); void Init(uint8 *seed); void UpdateData(int len, uint8 *data); private: EVP_CIPHER_CTX m_ctx; }; #endif
/** * @file logger.h * * Functions to do logging. * The macros check whether the logsev is active before evaluating the * parameters. Use them instead of the functions. * * If a log statement ends in a newline, the current log is ended. * When the log severity changes, an implicit newline is inserted. * * @author Ben Gardner * @license GPL v2+ */ #ifndef LOGGER_H_INCLUDED #define LOGGER_H_INCLUDED #include "logmask.h" #include <cstring> // strlen() #include <cstdio> // FILE /** * Initializes the log subsystem - call this first. * This function sets the log stream and enables the top 3 sevs (0-2). * * @param log_file nullptr for stderr or the FILE stream for logs. */ void log_init(FILE *log_file); /** * Show or hide the severity prefix "<1>" * * @param show true=show, false=hide */ void log_show_sev(bool show); /** * Returns whether a log severity is active. * * @param sev severity log level * * @return true/false */ bool log_sev_on(log_sev_t sev); /** * Sets a log sev on or off * * @param sev severity log level to modify * @param val new value for severity log level * * @return true/false */ void log_set_sev(log_sev_t sev, bool value); /** * Sets the log mask * * @param mask The mask to copy */ void log_set_mask(const log_mask_t &mask); /** * Gets the log mask * * @param mask Where to copy the mask */ void log_get_mask(log_mask_t &mask); /** * Logs a string of known length * * @param sev The severity * @param str The pointer to the string * @param len The length of the string from strlen(str) * * TODO call strlen internally instead of providing len */ void log_str(log_sev_t sev, const char *str, size_t len); #define LOG_STR(sev, str, len) \ do { if (log_sev_on(sev)) { log_str(sev, str, len); } \ } while (0) #define LOG_STRING(sev, str) \ do { if (log_sev_on(sev)) { log_str(sev, str, strlen(str)); } \ } while (0) /** * Logs a formatted string -- similar to printf() * * @param sev The severity * @param fmt The format string * @param ... Additional arguments */ void log_fmt(log_sev_t sev, const char *fmt, ...) __attribute__((format(printf, 2, 3))); /** * Flushes the cached log text to the stream * * @param force_nl Append NL if not present */ void log_flush(bool force_nl); // it is necessary to make at least one time pro change a check of all the // uses of the MACRO LOG_FMT under Linux. This to detect all the used pointers, // which might be nullptr. // uncomment the define to do that. // #define NO_MACRO_VARARG #ifdef NO_MACRO_VARARG #define LOG_FMT log_fmt // TODO during debugging add source file and line number #else #define LOG_FMT(sev, ...) \ do { if (log_sev_on(sev)) { log_fmt(sev, __VA_ARGS__); } \ } while (0) #endif #ifdef DEBUG #define D_LOG_FMT LOG_FMT #else #define D_LOG_FMT(sev, ...) ((void)0) //forces semicolon after macro #endif /** * Dumps hex characters inline, no newlines inserted * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex(log_sev_t sev, const void *vdata, size_t len); #define LOG_HEX(sev, ptr, len) \ do { if (log_sev_on(sev)) { log_hex(sev, ptr, len); } \ } while (0) /** * Logs a block of data in a pretty hex format * Numbers on the left, characters on the right, just like I like it. * * "nnn | XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX | ................" * 0 ^6 54^ ^56 72^ * * nnn is the line number or index/16 * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex_blk(log_sev_t sev, const void *data, size_t len); #define LOG_HEX_BLK(sev, ptr, len) \ do { if (log_sev_on(sev)) { log_hex_blk(sev, ptr, len); } \ } while (0) /** * Returns the HEX digit for a low nibble in a number * * @param nibble The nibble * * @return '0', '1', '2', '3', '4', '5', '6', '7','8', '9', * 'a', 'b', 'c', 'd', 'e', or 'f' */ static_inline char to_hex_char(int nibble) { const char *hex_string = "0123456789abcdef"; return(hex_string[nibble & 0x0F]); } #ifdef DEBUG /** * This should be called as the first thing in a function. * It uses the log_func class to add an entry to the function log stack. * It is automatically removed when the function returns. */ #define LOG_FUNC_ENTRY() log_func log_fe = log_func(__func__, __LINE__) /** * This should be called right before a repeated function call to trace where * the function was called. It does not add an entry, but rather updates the * line number of the top entry. */ #define LOG_FUNC_CALL() log_func_call(__LINE__) #else #define LOG_FUNC_ENTRY() #define LOG_FUNC_CALL() #endif /** * This class just adds a entry to the top of the stack on construction and * removes it on destruction. * RAII for the win. */ class log_func { public: log_func(const char *name, int line); ~log_func(); }; void log_func_call(int line); void log_func_stack(log_sev_t sev, const char *prefix = 0, const char *suffix = "\n", size_t skip_cnt = 0); #define log_func_stack_inline(_sev) log_func_stack((_sev), " [CallStack:", "]\n", 1) #endif /* LOGGER_H_INCLUDED */
/* * IRQ vector handles * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/pci.h> #include <asm/i8259.h> #include <asm/irq_cpu.h> #include <asm/irq_gt641xx.h> #include <asm/gt64120.h> #include <irq.h> asmlinkage void plat_irq_dispatch(void) { unsigned pending = read_c0_status() & read_c0_cause() & ST0_IM; int irq; if (pending & CAUSEF_IP2) gt641xx_irq_dispatch(); else if (pending & CAUSEF_IP6) { irq = i8259_irq(); if (irq < 0) spurious_interrupt(); else do_IRQ(irq); } else if (pending & CAUSEF_IP3) do_IRQ(MIPS_CPU_IRQ_BASE + 3); else if (pending & CAUSEF_IP4) do_IRQ(MIPS_CPU_IRQ_BASE + 4); else if (pending & CAUSEF_IP5) do_IRQ(MIPS_CPU_IRQ_BASE + 5); else if (pending & CAUSEF_IP7) do_IRQ(MIPS_CPU_IRQ_BASE + 7); else spurious_interrupt(); } static struct irqaction cascade = { .handler = no_action, .name = "cascade", .flags = IRQF_NO_THREAD, }; void __init arch_init_irq(void) { mips_cpu_irq_init(); gt641xx_irq_init(); init_i8259_irqs(); setup_irq(GT641XX_CASCADE_IRQ, &cascade); setup_irq(I8259_CASCADE_IRQ, &cascade); }
/* * IPMic, The IP Microphone project * Copyright (C) 2016 Ricardo Biehl Pasquali <rbpoficial@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef IPMIC_AUDIO_H #define IPMIC_AUDIO_H #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define IPMIC_DEFAULT_CHANNELS 2 #define IPMIC_DEFAULT_RATE 48000 /** Describes whether an audio device is an input or output. * Used when opening a device. * */ enum ipmic_device_type { /** The device is an input device (e.g. microphone) */ IPMIC_DEVICE_INPUT, /** The device is an output device (e.g. speaker) */ IPMIC_DEVICE_OUTPUT }; /** Describes behaviour of a PCM. * */ struct ipmic_device_params { /** Describes whether or not device is an input */ enum ipmic_device_type type; /** The number of frames in a PCM period */ unsigned int period_size; /** The number of frames in a PCM buffer */ unsigned int buffer_size; /** The number of frames per second */ unsigned int rate; /** The number of channels per frame */ unsigned int channels; }; /** Represents an audio input or output. * */ struct ipmic_device; /** Opens up a audio device. * @param params A structure containing * parameters affecting how the audio * device will run. * @returns On success, a pointer to an audio device. * On failure, NULL. * */ struct ipmic_device * ipmic_device_open(const struct ipmic_device_params *params); /** Closes an audio device opened with @ipmic_device_open. * @param device An initialized audio device. * This parameter may be NULL. * */ void ipmic_device_close(struct ipmic_device *device); /** Reads frames from an audio device. * @param device An audio device opened * with @ref ipmic_device_open. * @param frame_array A series of interleaved audio samples. * @param frame_count The number of frames in @p frame_array. * This value should not be greater than INT_MAX. * @retruns On success, the number of frames read. * On failure, a negative error code. * */ int ipmic_device_read(struct ipmic_device *device, int16_t *frame_array, unsigned int frame_count); /** Writes frames to an audio device. * @param device An audio device opened * with @ref ipmic_device_open. * @param frame_array A series of interleaved audio samples. * @param frame_count The number of frames in @p frame_array. * This value should not be greater than INT_MAX. * @retruns On success, the number of frames written. * On failure, a negative error code. * */ int ipmic_device_write(struct ipmic_device *device, const int16_t *frame_array, unsigned int frame_count); /** Prepares an audio device for input or output operations. * @param device An audio device opened * with @ref ipmic_device_open. * @returns Zero on success, a negative error code on failure. * */ int ipmic_device_prepare(struct ipmic_device *device); #define AL_PLAYBACK IPMIC_DEVICE_OUTPUT #define AL_CAPTURE IPMIC_DEVICE_INPUT #define DEFAULT_RATE IPMIC_DEFAULT_RATE #define DEFAULT_CHANNELS IPMIC_DEFAULT_CHANNELS #define bytes_to_frames(bytes) (bytes / 2 * IPMIC_DEFAULT_CHANNELS) #define frames_to_bytes(frames) (frames * 2 * IPMIC_DEFAULT_CHANNELS) typedef struct ipmic_device_params audioparam_t; extern struct ipmic_device_params alp; extern struct ipmic_device *ipmic_snd_input; extern struct ipmic_device *ipmic_snd_output; int audiolayer_open(void); void audiolayer_close(void); int audiolayer_read(void *, unsigned int); int audiolayer_write(const void *, unsigned int); int audiolayer_prepare(void); #ifdef __cplusplus } /* extern "C" { */ #endif /* __cplusplus */ #endif /* IPMIC_AUDIO_H */
#ifndef _NAMESPACE_H_ #define _NAMESPACE_H_ #ifdef __KERNEL__ struct mnt_namespace; struct fs_struct; struct user_namespace; extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, struct user_namespace *, struct fs_struct *); extern void put_mnt_ns(struct mnt_namespace *ns); extern const struct file_operations proc_mounts_operations; extern const struct file_operations proc_mountinfo_operations; extern const struct file_operations proc_mountstats_operations; #endif #endif
/* extcap_parser.h * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __EXTCAP_PARSER_H__ #define __EXTCAP_PARSER_H__ #include <stdio.h> #include <glib.h> #include <string.h> #include <config.h> #include "ui/iface_toolbar.h" typedef enum { EXTCAP_SENTENCE_UNKNOWN, EXTCAP_SENTENCE_ARG, EXTCAP_SENTENCE_VALUE, EXTCAP_SENTENCE_EXTCAP, EXTCAP_SENTENCE_INTERFACE, EXTCAP_SENTENCE_DLT, EXTCAP_SENTENCE_CONTROL } extcap_sentence_type; typedef enum { /* Simple types */ EXTCAP_ARG_UNKNOWN, EXTCAP_ARG_INTEGER, EXTCAP_ARG_UNSIGNED, EXTCAP_ARG_LONG, EXTCAP_ARG_DOUBLE, EXTCAP_ARG_BOOLEAN, EXTCAP_ARG_BOOLFLAG, EXTCAP_ARG_STRING, EXTCAP_ARG_PASSWORD, /* Complex GUI types which are populated with value sentences */ EXTCAP_ARG_SELECTOR, EXTCAP_ARG_RADIO, EXTCAP_ARG_MULTICHECK, EXTCAP_ARG_FILESELECT, EXTCAP_ARG_TIMESTAMP } extcap_arg_type; typedef enum { /* value types */ EXTCAP_PARAM_UNKNOWN, EXTCAP_PARAM_ARGNUM, EXTCAP_PARAM_CALL, EXTCAP_PARAM_DISPLAY, EXTCAP_PARAM_TYPE, EXTCAP_PARAM_ARG, EXTCAP_PARAM_DEFAULT, EXTCAP_PARAM_VALUE, EXTCAP_PARAM_RANGE, EXTCAP_PARAM_TOOLTIP, EXTCAP_PARAM_PLACEHOLDER, EXTCAP_PARAM_NAME, EXTCAP_PARAM_ENABLED, EXTCAP_PARAM_FILE_MUSTEXIST, EXTCAP_PARAM_FILE_EXTENSION, EXTCAP_PARAM_GROUP, EXTCAP_PARAM_PARENT, EXTCAP_PARAM_REQUIRED, EXTCAP_PARAM_RELOAD, EXTCAP_PARAM_SAVE, EXTCAP_PARAM_VALIDATION, EXTCAP_PARAM_VERSION, EXTCAP_PARAM_HELP, EXTCAP_PARAM_CONTROL, EXTCAP_PARAM_ROLE } extcap_param_type; #define ENUM_KEY(s) GUINT_TO_POINTER((guint)s) /* Values for a given sentence; values are all stored as a call * and a value string, or a valid range, so we only need to store * those and repeat them */ typedef struct _extcap_value { int arg_num; gchar *call; gchar *display; gboolean enabled; gboolean is_default; gchar *parent; } extcap_value; /* Complex-ish struct for storing complex values */ typedef struct _extcap_complex { extcap_arg_type complex_type; gchar * _val; } extcap_complex; /* An argument sentence and accompanying options */ typedef struct _extcap_arg { int arg_num; gchar *call; gchar *display; gchar *tooltip; gchar *placeholder; gchar * fileextension; gboolean fileexists; gboolean is_required; gboolean save; gboolean reload; gchar * regexp; gchar * group; extcap_arg_type arg_type; extcap_complex *range_start; extcap_complex *range_end; extcap_complex *default_complex; gchar ** pref_valptr; /**< A copy of the pointer containing the current preference value. */ gchar * device_name; GList * values; } extcap_arg; typedef struct _extcap_interface { gchar * call; gchar * display; gchar * version; gchar * help; gchar * extcap_path; extcap_sentence_type if_type; } extcap_interface; typedef struct _extcap_dlt { gint number; gchar *name; gchar *display; } extcap_dlt; typedef struct _extcap_token_sentence { gchar *sentence; GHashTable *param_list; } extcap_token_sentence; #ifdef __cplusplus extern "C" { #endif /* Parse a string into a complex type */ extcap_complex *extcap_parse_complex(extcap_arg_type complex_type, const gchar *data); /* Free a complex */ void extcap_free_complex(extcap_complex *comp); /* Print a complex value out for debug */ void extcap_printf_complex(extcap_complex *comp); /* * Return a string representation of a complex type * Caller is responsible for calling g_free on the returned string */ gchar *extcap_get_complex_as_string(extcap_complex *comp); gint extcap_complex_get_int(extcap_complex *comp); guint extcap_complex_get_uint(extcap_complex *comp); gint64 extcap_complex_get_long(extcap_complex *comp); gdouble extcap_complex_get_double(extcap_complex *comp); gboolean extcap_complex_get_bool(extcap_complex *comp); gchar *extcap_complex_get_string(extcap_complex *comp); /* compares the default value of an element with a given parameter */ gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test); /* Free a single argument */ void extcap_free_arg(extcap_arg *a); /* Free entire toolbar control structure */ void extcap_free_toolbar_control(iface_toolbar_control *control); /* Free an entire arg list */ void extcap_free_arg_list(GList *a); /** Parser for extcap data */ /* Parse all sentences for args and values */ GList * extcap_parse_args(gchar *output); /* Parse all sentences for values */ GList * extcap_parse_values(gchar *output); /* Parse all sentences for interfaces */ GList * extcap_parse_interfaces(gchar *output, GList **control_items); /* Parse all sentences for DLTs */ GList * extcap_parse_dlts(gchar *output); #ifdef __cplusplus } #endif #endif /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
/* * Copyright (c) 2017 Fujitsu Ltd. * Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* * This is a regression test about the race in autogroup, this test * can crash the buggy kernel, and the bug has been fixed in: * * commit 18f649ef344127ef6de23a5a4272dbe2fdb73dde * Author: Oleg Nesterov <oleg@redhat.com> * Date: Mon Nov 14 19:46:09 2016 +0100 * * sched/autogroup: Fix autogroup_move_group() to never skip sched_move_task() */ #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include "tst_test.h" #define LOOPS 1000 #define PATH_AUTOGROUP "/proc/sys/kernel/sched_autogroup_enabled" static int orig_autogroup = -1; static void do_test(void) { int i; if (!SAFE_FORK()) { SAFE_FILE_PRINTF(PATH_AUTOGROUP, "%d", 1); SAFE_SETSID(); if (SAFE_FORK()) pause(); SAFE_KILL(getppid(), SIGKILL); usleep(1000); // The child has gone, the grandchild runs with kref == 1 SAFE_FILE_PRINTF(PATH_AUTOGROUP, "%d", 0); SAFE_SETSID(); // runs with the freed ag/tg for (i = 0; i < LOOPS; i++) usleep(10); TST_CHECKPOINT_WAKE(0); exit(0); } SAFE_WAIT(NULL); // destroy the child's ag/tg TST_CHECKPOINT_WAIT(0); tst_res(TPASS, "Bug not reproduced"); } static void setup(void) { if (access(PATH_AUTOGROUP, F_OK)) tst_brk(TCONF, "autogroup not supported"); SAFE_FILE_SCANF(PATH_AUTOGROUP, "%d", &orig_autogroup); } static void cleanup(void) { if (orig_autogroup != -1) SAFE_FILE_PRINTF(PATH_AUTOGROUP, "%d", orig_autogroup); } static struct tst_test test = { .forks_child = 1, .needs_root = 1, .needs_checkpoints = 1, .setup = setup, .cleanup = cleanup, .test_all = do_test, };
#include "editor.h" #include "window.h" #include "view.h" #include "frame.h" #include "term.h" #include "config.h" #include "color.h" #include "syntax.h" #include "alias.h" #include "history.h" #include "file-history.h" #include "search.h" #include "error.h" #include <locale.h> #include <langinfo.h> static const char *builtin_rc = // obvious bindings "bind left left\n" "bind right right\n" "bind up up\n" "bind down down\n" "bind home bol\n" "bind end eol\n" "bind pgup pgup\n" "bind pgdown pgdown\n" "bind delete delete\n" "bind ^\\[ unselect\n" "bind ^Z suspend\n" // backspace is either ^? or ^H "bind ^\\? erase\n" "bind ^H erase\n" // there must be a way to get to the command line "bind ^C command\n" // initialize builtin colors "hi\n" // must initialize string options "set statusline-left \" %f%s%m%r%s%M\"\n" "set statusline-right \" %y,%X %u %E %n %t %p \"\n"; static void handle_sigtstp(int signum) { suspend(); } static void handle_sigcont(int signum) { if (!child_controls_terminal && editor_status != EDITOR_INITIALIZING) { term_raw(); resize(); } } static void handle_sigwinch(int signum) { resized = true; } static const char *opt_arg(const char *opt, const char *arg) { if (arg == NULL) { fprintf(stderr, "missing argument for option %s\n", opt); exit(1); } return arg; } int main(int argc, char *argv[]) { const char *term = getenv("TERM"); const char *home = getenv("HOME"); const char *tag = NULL; const char *rc = NULL; const char *command = NULL; char *command_history_filename; char *search_history_filename; char *editor_dir; bool read_rc = true; int i; if (!home) home = ""; home_dir = xstrdup(home); for (i = 1; i < argc; i++) { const char *opt = argv[i]; if (opt[0] != '-' || !opt[1]) break; if (!opt[2]) { switch (opt[1]) { case 'R': read_rc = false; continue; case 't': tag = opt_arg(opt, argv[++i]); continue; case 'r': rc = opt_arg(opt, argv[++i]); continue; case 'c': command = opt_arg(opt, argv[++i]); continue; case 'V': printf("%s %s\nWritten by Timo Hirvonen\n", program, version); return 0; } if (opt[1] == '-') { i++; break; } } printf("Usage: %s [-R] [-V] [-c command] [-t tag] [-r rcfile] [file]...\n", argv[0]); return 1; } if (!isatty(1)) { fprintf(stderr, "stdout doesn't refer to a terminal\n"); return 1; } if (term == NULL || term[0] == 0) { fprintf(stderr, "TERM not set\n"); return 1; } switch (term_init(term)) { case -1: fprintf(stderr, "terminal is hardcopy\n"); return 1; case -2: fprintf(stderr, "terminal could not be found\n"); return 1; case -3: fprintf(stderr, "terminfo database could not be found\n"); return 1; } // create this early. needed if lock-files is true editor_dir = editor_file(""); mkdir(editor_dir, 0755); free(editor_dir); setlocale(LC_CTYPE, ""); charset = nl_langinfo(CODESET); if (streq(charset, "UTF-8")) term_utf8 = true; exec_builtin_rc(builtin_rc); fill_builtin_colors(); // NOTE: syntax_changed() uses window. should possibly create window after reading rc window = new_window(); root_frame = new_root_frame(window); if (read_rc) { if (rc) { read_config(commands, rc, true); } else { char *filename = editor_file("rc"); if (read_config(commands, filename, false)) { free(filename); filename = xsprintf("%s/rc", pkgdatadir); read_config(commands, filename, true); } free(filename); } } update_all_syntax_colors(); sort_aliases(); /* Terminal does not generate signals for control keys. */ set_signal_handler(SIGINT, SIG_IGN); set_signal_handler(SIGQUIT, SIG_IGN); set_signal_handler(SIGPIPE, SIG_IGN); /* Terminal does not generate signal for ^Z but someone can send * us SIGTSTP nevertheless. SIGSTOP can't be caught. */ set_signal_handler(SIGTSTP, handle_sigtstp); set_signal_handler(SIGCONT, handle_sigcont); set_signal_handler(SIGWINCH, handle_sigwinch); load_file_history(); command_history_filename = editor_file("command-history"); search_history_filename = editor_file("search-history"); history_load(&command_history, command_history_filename, command_history_size); history_load(&search_history, search_history_filename, search_history_size); if (search_history.count) search_set_regexp(search_history.ptrs[search_history.count - 1]); /* Initialize terminal but don't update screen yet. Also display * "Press any key to continue" prompt if there were any errors * during reading configuration files. */ term_raw(); if (nr_errors) { any_key(); clear_error(); } editor_status = EDITOR_RUNNING; for (; i < argc; i++) window_open_buffer(window, argv[i], false, NULL); if (window->views.count == 0) window_open_empty_buffer(window); set_view(window->views.ptrs[0]); if (command || tag) resize(); if (command) handle_command(commands, command); if (tag) { PTR_ARRAY(array); ptr_array_add(&array, xstrdup("tag")); ptr_array_add(&array, xstrdup(tag)); ptr_array_add(&array, NULL); run_commands(commands, &array); ptr_array_free(&array); } resize(); main_loop(); ui_end(); // unlock files and add files to file history remove_frame(root_frame); history_save(&command_history, command_history_filename); history_save(&search_history, search_history_filename); free(command_history_filename); free(search_history_filename); save_file_history(); return 0; }
/* Copyright (c) 2008-2011, 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 __Z180_H #define __Z180_H #include "kgsl_device.h" #define DEVICE_2D_NAME "kgsl-2d" #define DEVICE_2D0_NAME "kgsl-2d0" #define DEVICE_2D1_NAME "kgsl-2d1" #define Z180_PACKET_SIZE 15 #define Z180_PACKET_COUNT 8 #define Z180_RB_SIZE (Z180_PACKET_SIZE*Z180_PACKET_COUNT \ *sizeof(uint32_t)) #define Z180_DEVICE(device) \ KGSL_CONTAINER_OF(device, struct z180_device, dev) #define Z180_DEFAULT_PWRSCALE_POLICY NULL /* Wait a maximum of 20 seconds when trying to idle the core */ #define Z180_IDLE_TIMEOUT (20 * 1000) struct z180_ringbuffer { unsigned int prevctx; struct kgsl_memdesc cmdbufdesc; }; struct z180_device { struct kgsl_device dev; /* Must be first field in this struct */ int current_timestamp; int timestamp; struct z180_ringbuffer ringbuffer; spinlock_t cmdwin_lock; }; int z180_dump(struct kgsl_device *, int); #endif /* __Z180_H */
/** * @file r_model_md2.h * @brief md2 alias model loading */ /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ void R_ModLoadAliasMD2Model(struct model_s *mod, byte *buffer, int bufSize, qboolean loadNormals);
#pragma once #include <SFML/Graphics.hpp> class ResourceManager { private: sf::Font roboto; sf::Texture meepleSprite; sf::Texture glowSprite; sf::Texture boardTexture; sf::Texture fieldTexture; sf::Texture backgroundSprite; sf::Texture exitButtonTexture; sf::Texture reloadButtonTexture; sf::Texture menuButtonTexture; sf::Texture particleSprite; sf::Texture avatarSprite; sf::Texture textSprite; sf::Texture soundSprite; sf::Texture tutorialBtnSprite; sf::Texture menuAtlas; sf::Texture splashscreen; sf::Texture tutorial[9]; void loadResourcesFromFileSys(bool setSmooth); // invoked by the constructor public: enum ResourceFont { ROBOTO }; enum ResourceTexture { MEEPLE_SPRITE, MEEPLE_GLOW_SPRITE, BOARD_TEX, FIELD_TEX, BACKGROUND_TEX, EXIT_BTN_TEX, RELOAD_BTN_TEX, MENU_BTN_TEX, PARTICLE_SPRITE, AVATAR_SPRITE, MENU_ATLAS, TEXT_SPRITE, SOUND_SPRITE, TUTORIAL_BTN_SRITE, SPLASH_SCREEN, TUT1, TUT2, TUT3, TUT4, TUT5, TUT6, TUT7, TUT8, TUT9 }; enum ResourceRect { BACKGROUND, BACKGROUND_WINDOW, PROFESSOR_JENKINS, SMOOTH_STEVE, HIPSTER_HENRY, BOYBAND_BILLY, BOOKWORM_BETTY, FASHION_FABIENNE, HIPPIE_HILDY, SMOKIN_STACY, MENU_HEADLINE, MENU_STARTBTN, MENU_STARTBTN_H, MENU_FRAME_UP, MENU_FRAME_DOWN, TUT_BTN, TUT_BTN_HIGHLIGHT, TEXT_PLAYER_1, TEXT_PLAYER_2, TEXT_CHOOSE, TEXT_SELECT, TEXT_A_MEEPLE, TEXT_A_POSITION, TEXT_WINS, TEXT_TIE, ARROW_UP, TEXT_PAUSE, TEXT_SKIP_TO_MENU, SND_MUSIC_MUTE, SND_MUSIC_PLAY, SND_EFFECTS_MUTE, SND_EFFECTS_PLAY, FULL_SCREEN_RECT, }; ResourceManager(); sf::Texture* getTexture(ResourceTexture textureType); sf::IntRect ResourceManager::getTextureRect(ResourceRect rectType) const; sf::Font* getFont(ResourceFont fontType); };
/***************************************************************************** Copyright(c) 2012 FCI Inc. All Rights Reserved File name : fci_tun.h Description : tuner control driver *******************************************************************************/ #ifndef __FCI_TUN_H__ #define __FCI_TUN_H__ #ifdef __cplusplus extern "C" { #endif #include "fci_types.h" typedef enum { FCI_I2C_TYPE = 0, FCI_BYPASS_TYPE = 1 } i2c_type; typedef enum { ISDBT_1_SEG_TYPE = 2 } band_type; typedef enum { FC8150_TUNER = 8150 } product_type; extern int tuner_ctrl_select(HANDLE hDevice, i2c_type type); extern int tuner_ctrl_deselect(HANDLE hDevice); extern int tuner_select(HANDLE hDevice, u32 product, u32 band); extern int tuner_deselect(HANDLE hDevice); extern int tuner_i2c_read(HANDLE hDevice, u8 addr, u8 alen, u8* data, u8 len); extern int tuner_i2c_write(HANDLE hDevice, u8 addr, u8 alen, u8* data, u8 len); extern int tuner_set_freq(HANDLE hDevice, u32 freq); extern int tuner_get_rssi(HANDLE hDevice, s32 *rssi); #ifdef __cplusplus } #endif #endif // __FCI_TUN_H__
/* Public domain, from daemontools-0.76. */ #include <sys/types.h> #include <fcntl.h> #include "open.h" int open_read(const char *fn) { return open(fn,O_RDONLY | O_NDELAY); }
// Copyright (C) 2009 Nexell Co., All Rights Reserved // Nexell Co. Proprietary & Confidential // // NEXELL INFORMS THAT THIS CODE AND INFORMATION IS PROVIDED "AS IS" BASE // AND WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING // BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS // FOR A PARTICULAR PURPOSE. // // Module : Clock & Power Manager // File : nx_PMU.h // Description : // Author : Firmware // History : //------------------------------------------------------------------------------ #ifndef __NX_PMU_H__ #define __NX_PMU_H__ #include "../base/nx_prototype.h" #ifdef __cplusplus extern "C" { #endif //------------------------------------------------------------------------------ /// @defgroup PMU Clock & Power Manager //------------------------------------------------------------------------------ //@{ /// @brief Clock & Power Manager Module's Register List struct NX_PMU_RegisterSet { volatile U32 nISOLATE; ///< 0x00 : Clock Mode Register 0 volatile U32 SCPRE; ///< 0x04 : Clock Mode Register 1 volatile U32 SCALL; ///< 0x08 ~ 0x1C : PLL Setting Register volatile U32 SCALLACK; ///< 0x20 ~ 0x3C : Divider Setting Register }; /// @brief Reset status typedef enum { NX_PMU_POWER_SWITCH_ISOLATE = 0, ///< Power on reset NX_PMU_POWER_SWITCH_SCPRE = 1, ///< GPIO reset NX_PMU_POWER_SWITCH_SCALL = 2, ///< Watchdog Reset } NX_PMU_POWER_SWITCH; //------------------------------------------------------------------------------ /// @name Module Interface //@{ CBOOL NX_PMU_Initialize( void ); U32 NX_PMU_GetNumberOfModule( void ); //@} //------------------------------------------------------------------------------ /// @name Basic Interface //@{ U32 NX_PMU_GetPhysicalAddress( void ); U32 NX_PMU_GetSizeOfRegisterSet( void ); void NX_PMU_SetBaseAddress( U32 BaseAddress ); U32 NX_PMU_GetBaseAddress( void ); CBOOL NX_PMU_OpenModule( void ); CBOOL NX_PMU_CloseModule( void ); CBOOL NX_PMU_CheckBusy( void ); CBOOL NX_PMU_CanPowerDown( void ); //@} //------------------------------------------------------------------------------ /// @name PMU Interface //@{ void NX_PMU_SetPowerUp ( U32 domain, NX_PMU_POWER_SWITCH powerswitch); void NX_PMU_SetPowerDown ( U32 domain, NX_PMU_POWER_SWITCH powerswitch); CBOOL NX_PMU_GetPowerDownState ( U32 domain ); U32 NX_PMU_GetNumberOfPowerDomain ( void ); //@} #ifdef __cplusplus } #endif #endif // __NX_PMU_H__
/* 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 ELEMENTS_PANEL_WIDGET_H #define ELEMENTS_PANEL_WIDGET_H #include <QtGui> #include "elementspanel.h" /** This class embeds an elements panel under a toolbar providing various actions to manage elements. @see ElementsPanel */ class ElementsPanelWidget : public QWidget { Q_OBJECT // constructors, destructor public: ElementsPanelWidget(QWidget * = 0); virtual ~ElementsPanelWidget(); private: ElementsPanelWidget(const ElementsPanelWidget &); // attributes private: ElementsPanel *elements_panel; QToolBar *toolbar, *filter_toolbar; QAction *open_directory, *copy_path; QAction *reload; QAction *new_category, *edit_category, *delete_category; QAction *delete_collection; QAction *new_element, *edit_element, *delete_element, *open_element; QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down; QAction *tbt_add, *tbt_edit, *tbt_remove; QAction *copy_elements_, *move_elements_, *cancel_elements_; QMenu *context_menu; QAction *erase_textfield; QLineEdit *filter_textfield; ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_; QProgressBar *progress_bar_; // methods public: inline ElementsPanel &elementsPanel() const; signals: void requestForDiagram(Diagram *); void requestForProject(QETProject *); void requestForNewDiagram(QETProject *); void requestForProjectClosing(QETProject *); void requestForProjectPropertiesEdition(QETProject *); void requestForDiagramPropertiesEdition(Diagram *); void requestForDiagramDeletion(Diagram *); void requestForDiagramMoveUp(Diagram *); void requestForDiagramMoveDown(Diagram *); public slots: void clearFilterTextField(); void openDirectoryForSelectedItem(); void copyPathForSelectedItem(); void reloadAndFilter(); void activateProject(); void closeProject(); void editProjectProperties(); void editDiagramProperties(); void newDiagram(); void deleteDiagram(); void moveDiagramUp(); void moveDiagramDown(); void addTitleBlockTemplate(); void editTitleBlockTemplate(); void removeTitleBlockTemplate(); void newCategory(); void newElement(); void openElementFromFile(); void editCategory(); void editElement(); void deleteCategory(); void deleteElement(); void updateButtons(); void setElementsActionEnabled(bool); int launchCategoriesManager(); void handleContextMenu(const QPoint &); void handleCollectionRequest(const ElementsLocation &); void handleMoveElementsRequest(ElementsCollectionItem *, ElementsCollectionItem *, const QPoint & = QPoint()); void moveElements(); void moveElements(ElementsCollectionItem *, ElementsCollectionItem *); void copyElements(); void copyElements(ElementsCollectionItem *, ElementsCollectionItem *); void collectionsRead(); void collectionsReadFinished(); void updateProgressBar(int, int); void loadingFinished(); void filterEdited(const QString &); private: void launchElementEditor(const ElementsLocation &); void launchCategoryEditor(const ElementsLocation &); ElementsCategory *writableSelectedCategory(); QString previous_filter_; }; /** @return The elements panel embedded within this widget. */ inline ElementsPanel &ElementsPanelWidget::elementsPanel() const { return(*elements_panel); } #endif
/* * Author: Paul Reioux aka Faux123 <reioux@gmail.com> * * Copyright 2013 Paul Reioux * Copyright 2012 Paul Reioux * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/module.h> #include <linux/kobject.h> #include <linux/sysfs.h> #include <linux/powersuspend.h> #include <linux/mutex.h> #include <linux/notifier.h> #include <linux/reboot.h> #include <linux/writeback.h> #define DYN_FSYNC_VERSION_MAJOR 2 #define DYN_FSYNC_VERSION_MINOR 0 static DEFINE_MUTEX(fsync_mutex); bool power_suspend_active __read_mostly = true; bool dyn_fsync_active __read_mostly = true; static ssize_t dyn_fsync_active_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%u\n", (dyn_fsync_active ? 1 : 0)); } static ssize_t dyn_fsync_active_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { unsigned int data; if(sscanf(buf, "%u\n", &data) == 1) { if (data == 1) { pr_info("%s: dynamic fsync enabled\n", __FUNCTION__); dyn_fsync_active = true; } else if (data == 0) { pr_info("%s: dyanamic fsync disabled\n", __FUNCTION__); dyn_fsync_active = false; } else pr_info("%s: bad value: %u\n", __FUNCTION__, data); } else pr_info("%s: unknown input!\n", __FUNCTION__); return count; } static ssize_t dyn_fsync_version_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "version: %u.%u\n", DYN_FSYNC_VERSION_MAJOR, DYN_FSYNC_VERSION_MINOR); } static ssize_t dyn_fsync_powersuspend_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "power suspend active: %u\n", power_suspend_active); } static ssize_t dyn_fsync_powersuspend_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { unsigned int data; if(sscanf(buf, "%u\n", &data) == 1) { if (data == 1) { pr_info("%s: powersuspend enabled\n", __FUNCTION__); power_suspend_active = true; } else if (data == 0) { pr_info("%s: powersuspend disabled\n", __FUNCTION__); power_suspend_active = false; } else pr_info("%s: bad value: %u\n", __FUNCTION__, data); } else pr_info("%s: unknown input!\n", __FUNCTION__); return count; } static struct kobj_attribute dyn_fsync_active_attribute = __ATTR(Dyn_fsync_active, 0666, dyn_fsync_active_show, dyn_fsync_active_store); static struct kobj_attribute dyn_fsync_version_attribute = __ATTR(Dyn_fsync_version, 0444, dyn_fsync_version_show, NULL); static struct kobj_attribute dyn_fsync_powersuspend_attribute = __ATTR(Dyn_fsync_powersuspend, 0660, dyn_fsync_powersuspend_show, dyn_fsync_powersuspend_store); static struct attribute *dyn_fsync_active_attrs[] = { &dyn_fsync_active_attribute.attr, &dyn_fsync_version_attribute.attr, &dyn_fsync_powersuspend_attribute.attr, NULL, }; static struct attribute_group dyn_fsync_active_attr_group = { .attrs = dyn_fsync_active_attrs, }; static struct kobject *dyn_fsync_kobj; static void dyn_fsync_force_flush(void) { /* flush all outstanding buffers */ wakeup_flusher_threads(0, WB_REASON_SYNC); sync_filesystems(0); sync_filesystems(1); } static void dyn_fsync_power_suspend(struct power_suspend *h) { mutex_lock(&fsync_mutex); if (dyn_fsync_active) { power_suspend_active = true; dyn_fsync_force_flush(); } mutex_unlock(&fsync_mutex); } static void dyn_fsync_resume(struct power_suspend *h) { mutex_lock(&fsync_mutex); power_suspend_active = false; mutex_unlock(&fsync_mutex); } static struct power_suspend dyn_fsync_power_suspend_handler = { .suspend = dyn_fsync_power_suspend, .resume = dyn_fsync_resume, }; static int dyn_fsync_panic_event(struct notifier_block *this, unsigned long event, void *ptr) { power_suspend_active = true; dyn_fsync_force_flush(); //pr_warn("dyn fsync: panic: force flush!\n"); return NOTIFY_DONE; } static struct notifier_block dyn_fsync_panic_block = { .notifier_call = dyn_fsync_panic_event, .priority = INT_MAX, }; static int dyn_fsync_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { if (code == SYS_DOWN || code == SYS_HALT) { power_suspend_active = true; dyn_fsync_force_flush(); //pr_warn("dyn fsync: reboot: force flush!\n"); } return NOTIFY_DONE; } static struct notifier_block dyn_fsync_notifier = { .notifier_call = dyn_fsync_notify_sys, }; static int dyn_fsync_init(void) { int sysfs_result; register_power_suspend(&dyn_fsync_power_suspend_handler); register_reboot_notifier(&dyn_fsync_notifier); atomic_notifier_chain_register(&panic_notifier_list, &dyn_fsync_panic_block); dyn_fsync_kobj = kobject_create_and_add("dyn_fsync", kernel_kobj); if (!dyn_fsync_kobj) { pr_err("%s dyn_fsync kobject create failed!\n", __FUNCTION__); return -ENOMEM; } sysfs_result = sysfs_create_group(dyn_fsync_kobj, &dyn_fsync_active_attr_group); if (sysfs_result) { pr_info("%s dyn_fsync sysfs create failed!\n", __FUNCTION__); kobject_put(dyn_fsync_kobj); } return sysfs_result; } static void dyn_fsync_exit(void) { unregister_power_suspend(&dyn_fsync_power_suspend_handler); unregister_reboot_notifier(&dyn_fsync_notifier); atomic_notifier_chain_unregister(&panic_notifier_list, &dyn_fsync_panic_block); if (dyn_fsync_kobj != NULL) kobject_put(dyn_fsync_kobj); } MODULE_AUTHOR("Paul Reioux <reioux@gmail.com>"); MODULE_AUTHOR("Varun Chitre <varun.chitre15@gmail.com"); module_init(dyn_fsync_init); module_exit(dyn_fsync_exit);
#pragma once namespace SevenZip { class NonCopyable { protected: NonCopyable(){} ~NonCopyable(){} private: NonCopyable(const NonCopyable&); NonCopyable(NonCopyable&&); NonCopyable& operator=(const NonCopyable&); NonCopyable& operator=(NonCopyable&&); }; }
/*************************************************************************** Copyright (C) 2009 Robby Stephenson <robby@periapsis.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) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * ***************************************************************************/ #ifndef CUECATTEST_H #define CUECATTEST_H #include <QObject> class CueCatTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void testDecode(); void testDecode_data(); }; #endif
#include <types.h> #include <unistd.h> #include <ulib.h> #include <spipe.h> #define SPIPE_SIZE 4096 #define SPIPE_BUFSIZE (SPIPE_SIZE - sizeof(__spipe_state_t)) static bool __spipeisclosed_nolock(spipe_t *p, bool read); int spipe(spipe_t *p) { static_assert(SPIPE_SIZE > SPIPE_BUFSIZE); int ret; sem_t spipe_sem; uintptr_t addr = 0; if ((ret = shmem(&addr, SPIPE_SIZE, MMAP_WRITE)) != 0) { goto failed; } if ((spipe_sem = sem_init(1)) < 0) { goto failed_cleanup_mem; } p->isclosed = 0; p->spipe_sem = spipe_sem; p->addr = addr; p->state = (__spipe_state_t *)addr; p->buf = (uint8_t *)(p->state + 1); p->state->p_rpos = p->state->p_wpos = 0; p->state->isclosed = 0; out: return ret; failed_cleanup_mem: munmap(addr, SPIPE_BUFSIZE); failed: goto out; } size_t spiperead(spipe_t *p, void *buf, size_t n) { size_t ret = 0; __spipe_state_t *state = p->state; try_again: if (p->isclosed || sem_wait(p->spipe_sem) != 0) { goto out; } if (__spipeisclosed_nolock(p, 1)) { goto out_unlock; } if (state->p_rpos == state->p_wpos) { sem_post(p->spipe_sem); yield(); goto try_again; } for (; ret < n; ret ++, state->p_rpos ++) { if (state->p_rpos == state->p_wpos) { break; } *(uint8_t *)(buf + ret) = p->buf[state->p_rpos % SPIPE_BUFSIZE]; } out_unlock: sem_post(p->spipe_sem); out: return ret; } size_t spipewrite(spipe_t *p, void *buf, size_t n) { size_t ret = 0; __spipe_state_t *state = p->state; try_again: if (p->isclosed || sem_wait(p->spipe_sem) != 0) { goto out; } if (__spipeisclosed_nolock(p, 0)) { goto out_unlock; } for (; ret < n; ret ++, state->p_wpos ++) { if (state->p_wpos - state->p_rpos >= SPIPE_BUFSIZE) { sem_post(p->spipe_sem); yield(); goto try_again; } p->buf[state->p_wpos % SPIPE_BUFSIZE] = *(uint8_t *)(buf + ret); } out_unlock: sem_post(p->spipe_sem); out: return ret; } static int __spipeclose_nolock(spipe_t *p) { if (!p->isclosed) { p->isclosed = p->state->isclosed = 1; munmap(p->addr, SPIPE_BUFSIZE); return 0; } return -1; } int spipeclose(spipe_t *p) { if (!p->isclosed) { int ret; sem_wait(p->spipe_sem); ret = __spipeclose_nolock(p); sem_post(p->spipe_sem); return ret; } return -1; } static bool __spipeisclosed_nolock(spipe_t *p, bool read) { if (!p->isclosed) { if (!p->state->isclosed) { return 0; } if (p->state->p_rpos < p->state->p_wpos) { return !read; } __spipeclose_nolock(p); } return 1; } bool spipeisclosed(spipe_t *p) { if (!p->isclosed) { bool isclosed; sem_wait(p->spipe_sem); isclosed = __spipeisclosed_nolock(p, 0); sem_post(p->spipe_sem); return isclosed; } return 1; }
/** * @file tpl_init_term.c * * @section descr File description * * Trampoline machine dependant C implementation stuff for the PowerPC port. * * @section copyright Copyright * * Trampoline OS * * Trampoline is copyright (c) IRCCyN 2005+ * Copyright ESEO for function and data structures documentation * Trampoline is protected by the French intellectual property law. * * This software is distributed under the Lesser GNU Public Licence * * @section infos File informations * * $Date$ * $Rev$ * $Author$ * $URL$ */ #include "tpl_machine.h" #include "tpl_machine_interface.h" #include "tpl_os_internal_types.h" #include "tpl_os_definitions.h" #include "tpl_os_interrupt.h" #include "tpl_os_interrupt_kernel.h" #include "tpl_assembler.h" #include "tpl_os_error.h" #include "tpl_os.h" extern FUNC(void, OS_CODE) CallTerminateTask(); extern FUNC(void, OS_CODE) CallTerminateISR2(); #define OS_START_SEC_CONST_UNSPECIFIED #include "tpl_memmap.h" extern CONSTP2CONST(tpl_proc_static, AUTOMATIC, OS_APPL_DATA) tpl_stat_proc_table[TASK_COUNT+ISR_COUNT+1]; #define OS_STOP_SEC_CONST_UNSPECIFIED #include "tpl_memmap.h" #define OS_START_SEC_VAR_32BIT #include "tpl_memmap.h" VAR(uint32, OS_VAR) tpl_msr_start_value; VAR(uint32, OS_VAR) tpl_register_r2; VAR(uint32, OS_VAR) tpl_register_r13; #define OS_STOP_SEC_VAR_32BIT #include "tpl_memmap.h" #define OS_START_SEC_CODE #include "tpl_memmap.h" extern FUNC(void, OS_CODE) tpl_init_regs(void); extern FUNC(void, OS_CODE) tpl_init_interrupts(void); #if WITH_MEMORY_PROTECTION == YES extern FUNC(void, OS_CODE) tpl_init_mp(void); #endif extern FUNC(void, OS_CODE) tpl_user_mode(void); #define OS_STOP_SEC_CODE #include "tpl_memmap.h" #define USER_MODE 0x4000 #define OS_START_SEC_CODE #include "tpl_memmap.h" /** * tpl_init_context * * This function initialize the machine dependant context of a process * * @param proc_id the id of the process */ FUNC(void, OS_CODE) tpl_init_context( VAR(tpl_proc_id, AUTOMATIC) proc_id) { VAR(int, AUTOMATIC) i; CONSTP2CONST(tpl_proc_static, AUTOMATIC, OS_APPL_DATA) proc = tpl_stat_proc_table[proc_id]; P2VAR(ppc_integer_context, AUTOMATIC, OS_APPL_DATA) ic = proc->context.ic; P2VAR(tpl_stack_word, AUTOMATIC, OS_APPL_DATA) stack = proc->stack.stack_zone; for (i = 0; i < 32; i++ ) { ic->gpr[i] = 0; } /* ic->cr = 0; */ ic->xer = 0; ic->ctr = 0; /* address of the instruction to excute when returning from the system call. So it is set to the entry point of the task */ ic->srr0 = (unsigned long)proc->entry; ic->srr1 = tpl_msr_start_value | EE_BIT_1 | USER_MODE; /* The stack pointer is computed by adding the base address of the stack to its size and by substracting the space needed for the linkage area and 12 bytes that are pushed by the context switch function */ ic->gpr[1] = ((unsigned long)proc->stack.stack_zone) + proc->stack.stack_size - 48; ic->gpr[2] = tpl_register_r2; ic->gpr[13] = tpl_register_r13; /* * r11, r12, lr, cr and r0 have to be initialized on the process stack * these registers are located in this order, starting at stack_size - 48 * divided by 4 (32 bits implementation) */ stack += (proc->stack.stack_size - 48) >> 2; *stack++ = 0; /* r11 */ *stack++ = 0; /* r12 */ /* * set the return address of the task/isr. This is usefull in case the * user forgets to call TerminateTask/TerminateISR * MISRA RULE 1,45,85 VIOLATION: the function pointer is used and stored * in a 32bits variable, but as the Os is dependant on the target, * the behaviour is controled */ *stack++ = (IS_ROUTINE == proc->type) ? (uint32)(CallTerminateISR2) : (uint32)(CallTerminateTask); /* lr */ *stack++ = 0; /* cr */ *stack++ = 0; /* r0 */ } /** * TODO: document this */ FUNC(void, OS_CODE) idle_function(void) { while (1) { /* do nothing */ /* asm(" wrteei 1 "); */ } } /* */ /*void tpl_init_machine(void) - { - #pragma asm - subi r1,r1,4 - stw r3,0(r1) - lis r3,%hi(tpl_register_r2) - stw r2,%lo(tpl_register_r2)(r3) - lis r3,%hi(tpl_register_r13) - stw r13,%lo(tpl_register_r13)(r3) - mfmsr r0 - lis r3,%hi(tpl_msr_start_value) - stw r0,%lo(tpl_msr_start_value)(r3) - lwz r3,0(r1) - addi r1,r1,4 - blr - #pragma endasm - } */ FUNC(void, OS_CODE) tpl_init_machine(void) { /* VAR(uint8, AUTOMATIC) i; */ /* initializes the TaskLock counter */ /* tpl_user_task_lock = FALSE; tpl_cpt_user_task_lock = 0; tpl_cpt_os_task_lock = 0; */ #if WITH_AUTOSAR_TIMING_PROTECTION == YES tpl_remaining_watchdog_time = 0; #endif /* these 3 variables are init right after in assemby but this init avoid a wrong MISRA rule violation */ tpl_register_r2 = 0; tpl_register_r13 = 0; tpl_msr_start_value = 0; /* INTC.MCR.B.HVEN_PRC0 = 0; INTC.MCR.B.VTES_PRC0 = 0; INTC.IACKR_PRC0.R = (uint32_t)(&InterruptVectortable[0]); INTC.CPR_PRC0.R = 0;*/ #if WITH_OS_DEBUG == YES tpl_init_stack_debug(); tpl_init_switch_debug(); #endif tpl_init_regs(); tpl_init_interrupts(); #if WITH_MEMORY_PROTECTION == YES tpl_init_mp(); #endif /* tpl_user_mode(); */ /* tpl_init_tick(); */ } #define OS_STOP_SEC_CODE #include "tpl_memmap.h" /* End of file tpl_init_term.c */
#define _REENTRANT #define _LINUX_SOURCE #include <threads.h> #include <unistd.h> #include <sys/futex.h> #include <sys/tls.h> #include <stdlib.h> #include <errno.h> extern void __munmap_and_exit(void* map,size_t len) __attribute__((noreturn)); thread_local tss_t tss_dtor_list; void thrd_exit(int res) { thrd_t t=thrd_current(); int flags; size_t len; while (tss_dtor_list) { tss_t cur=tss_dtor_list; tss_dtor_list=tss_dtor_list->next; if (cur->dtor) cur->dtor(cur); } if (!t) exit(res); // moron user called us when no threads are running t->res=res; if ((flags=__sync_fetch_and_or(&t->flags,4))&4) return; // shouldn't be possible, but the tear-down-bit was already set if (t->join_futex) { // somebody is waiting; send him a message t->join_wait_futex=0; /* we need to wake the waiting threads up one by one, because we * need to wait for all of them to have received our return value * before we can self destruct. */ while (futex(&t->join_futex,FUTEX_WAKE,1,0,0,0)==1) { // wake one waiting thread // We woke somebody up. // Give them time to read our exit code. int r; do { r=futex(&t->join_wait_futex,FUTEX_WAIT,0,0,0,0); } while (r==EINTR); t->join_wait_futex=0; } flags|=1; // mark as detached } len=t->memsize; if (flags&1) { // We are detached or somebody already thrd_join'ed us. // We can die in piece and free all our resources len += sizeof(tcbhead_t)+sizeof(*t); } else { // Tell thrd_join that we are dead and cleaned up our stack and it // should clean up the rest when it's done. __sync_fetch_and_or(&t->flags,2); len&=~4095; // round down to nearest page t->arg=t->memstart+len; t->memsize=t->memsize+sizeof(tcbhead_t)+sizeof(*t)-len; } /* Problem: we need to unmap the stack and call exit, but we can't * touch the stack in between. Unfortunately, calling exit touches the * stack. Returning from the munmap syscall also touches the stack. So * this needs to be done in assembly language. */ __munmap_and_exit(t->memstart,len); }
#ifndef _LIBMMEIMG_ERROR_H #define _LIBMMEIMG_ERROR_H #define LIBMMEIMG_ERROR unsigned int #define LIBMMEIMG_SUCCESS 0 #define LIBMMEIMG_MISC_ERROR 1 #define LIBMMEIMG_NOMEM 2 #define LIBMMEIMG_INVALIDARG 3 #define LIBMMEIMG_NO_DEVACCESS 4 #define LIBMMEIMG_DECODE_ERROR 5 #endif
/*************************************************************************** * Copyright (C) 2003 by Sébastien Laoût * * slaout@linux62.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef HTMLEXPORTER_H #define HTMLEXPORTER_H #include <QString> #include <QTextStream> class QProgressBar; class BasketView; class Note; /** * @author Sébastien Laoût <slaout@linux62.org> */ class HTMLExporter { public: HTMLExporter(BasketView *basket); ~HTMLExporter(); private: void prepareExport(BasketView *basket, const QString &fullPath); void exportBasket(BasketView *basket, bool isSubBasket); void exportNote(Note *note, int indent); void writeBasketTree(BasketView *currentBasket); void writeBasketTree(BasketView *currentBasket, BasketView *basket, int indent); public: QString copyIcon(const QString &iconName, int size); QString copyFile(const QString &srcPath, bool createIt); public: // Absolute path of the file name the user choosen: QString filePath; // eg.: "/home/seb/foo.html" QString fileName; // eg.: "foo.html" // Absolute & relative paths for the current basket to be exported: QString basketFilePath; // eg.: "/home/seb/foo.html" or "/home/seb/foo.html_files/baskets/basketN.html" QString filesFolderPath; // eg.: "/home/seb/foo.html_files/" QString filesFolderName; // eg.: "foo.html_files/" or "../" QString iconsFolderPath; // eg.: "/home/seb/foo.html_files/icons/" QString iconsFolderName; // eg.: "foo.html_files/icons/" or "../icons/" QString imagesFolderPath; // eg.: "/home/seb/foo.html_files/images/" QString imagesFolderName; // eg.: "foo.html_files/images/" or "../images/" QString dataFolderPath; // eg.: "/home/seb/foo.html_files/data/" or "/home/seb/foo.html_files/baskets/basketN-data/" QString dataFolderName; // eg.: "foo.html_files/data/" or "basketN-data/" QString basketsFolderPath; // eg.: "/home/seb/foo.html_files/baskets/" QString basketsFolderName; // eg.: "foo.html_files/baskets/" or "" // Various properties of the currently exporting basket: QString backgroundColorName; // Variables used by every export methods: QTextStream stream; BasketView *exportedBasket; bool withBasketTree; QProgressBar *progress; }; #endif // HTMLEXPORTER_H
/* * Seven Kingdoms 2: The Fryhtan War * * Copyright 2010 Unavowed <unavowed@vexillium.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef OAUDIO_H #define OAUDIO_H #if defined(USE_OPENAL) #include <openal_audio.h> #else #error "You need to define an audio backend, such as OpenAL or Win32" #endif extern Audio audio; #endif
/* * Copyright (C) 1996-2022 The Squid Software Foundation and contributors * * Squid software is distributed under GPLv2+ license and includes * contributions from numerous individuals and organizations. * Please see the COPYING and CONTRIBUTORS files for details. */ #ifndef SQUID_HTCP_H #define SQUID_HTCP_H #if USE_HTCP #include "http/forward.h" #include "HttpHeader.h" #include "ip/forward.h" #include "store_key_md5.h" /// \ingroup ServerProtocolHTCP class HtcpReplyData { public: HtcpReplyData(); /// parses request header from the buffer bool parseHeader(const char *buffer, const size_t size); int hit; HttpHeader hdr; uint32_t msg_id; double version; struct cto_t { /* cache-to-origin */ double rtt; int samp; int hops; } cto; }; /// \ingroup ServerProtocolHTCP void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &); /// \ingroup ServerProtocolHTCP void htcpOpenPorts(void); /** * \ingroup ServerProtocolHTCP * * Generate and Send an HTCP query to the specified peer. * * \param e * \param req * \param p * \retval 1 Successfully sent request. * \retval 0 Unable to send request at this time. HTCP may be shutting down or starting up. * Don't wait for a reply or count in stats as sent. * \retval -1 Error sending request. */ int htcpQuery(StoreEntry * e, HttpRequest * req, CachePeer * p); /// \ingroup ServerProtocolHTCP void htcpClear(StoreEntry * e, HttpRequest * req, const HttpRequestMethod &method, CachePeer * p, htcp_clr_reason reason); /// \ingroup ServerProtocolHTCP void htcpSocketShutdown(void); /// \ingroup ServerProtocolHTCP void htcpClosePorts(void); #endif /* USE_HTCP */ #endif /* SQUID_HTCP_H */
#ifndef _ASM_PARISC_COMPAT_H #define _ASM_PARISC_COMPAT_H /* * Architecture specific compatibility types */ #include <linux/types.h> #include <linux/sched.h> #define COMPAT_USER_HZ 100 typedef u32 compat_size_t; typedef s32 compat_ssize_t; typedef s32 compat_time_t; typedef s32 compat_clock_t; typedef s32 compat_pid_t; typedef u32 __compat_uid_t; typedef u32 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; typedef u32 compat_ino_t; typedef u32 compat_dev_t; typedef s32 compat_off_t; typedef s64 compat_loff_t; typedef u16 compat_nlink_t; typedef u16 compat_ipc_pid_t; typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef s32 compat_timer_t; typedef s32 compat_int_t; typedef s32 compat_long_t; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; }; struct compat_timeval { compat_time_t tv_sec; s32 tv_usec; }; struct compat_stat { compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ compat_ino_t st_ino; /* 32 bits */ compat_mode_t st_mode; /* 16 bits */ compat_nlink_t st_nlink; /* 16 bits */ u16 st_reserved1; /* old st_uid */ u16 st_reserved2; /* old st_gid */ compat_dev_t st_rdev; compat_off_t st_size; compat_time_t st_atime; u32 st_atime_nsec; compat_time_t st_mtime; u32 st_mtime_nsec; compat_time_t st_ctime; u32 st_ctime_nsec; s32 st_blksize; s32 st_blocks; u32 __unused1; /* ACL stuff */ compat_dev_t __unused2; /* network */ compat_ino_t __unused3; /* network */ u32 __unused4; /* cnodes */ u16 __unused5; /* netsite */ short st_fstype; compat_dev_t st_realdev; u16 st_basemode; u16 st_spareshort; __compat_uid32_t st_uid; __compat_gid32_t st_gid; u32 st_spare4[3]; }; struct compat_flock { short l_type; short l_whence; compat_off_t l_start; compat_off_t l_len; compat_pid_t l_pid; }; struct compat_flock64 { short l_type; short l_whence; compat_loff_t l_start; compat_loff_t l_len; compat_pid_t l_pid; }; struct compat_statfs { s32 f_type; s32 f_bsize; s32 f_blocks; s32 f_bfree; s32 f_bavail; s32 f_files; s32 f_ffree; __kernel_fsid_t f_fsid; s32 f_namelen; s32 f_frsize; s32 f_spare[5]; }; struct compat_sigcontext { compat_int_t sc_flags; compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */ u64 sc_fr[32]; compat_int_t sc_iasq[2]; compat_int_t sc_iaoq[2]; compat_int_t sc_sar; /* cr11 */ }; #define COMPAT_RLIM_INFINITY 0xffffffff typedef u32 compat_old_sigset_t; /* at least 32 bits */ #define _COMPAT_NSIG 64 #define _COMPAT_NSIG_BPW 32 typedef u32 compat_sigset_word; #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL /* * A pointer passed in from user mode. This should not * be used for syscall parameters, just declare them * as pointers because the syscall entry code will have * appropriately comverted them already. */ typedef u32 compat_uptr_t; static inline void *compat_ptr(compat_uptr_t uptr) { return (void *)(unsigned long)uptr; } static __inline__ void *compat_alloc_user_space(long len) { struct pt_regs *regs = &current->thread.regs; return (void *)regs->gr[30]; } #endif /* _ASM_PARISC_COMPAT_H */
/* ** The author disclaims copyright to this source code. ** ************************************************************************* ** Implementation of the "simple" full-text-search tokenizer. */ #include <assert.h> #if !defined(__APPLE__) #include <malloc.h> #else #include <stdlib.h> #endif #include <stdio.h> #include <string.h> #include <ctype.h> #include "tokenizer.h" /* Duplicate a string; the caller must free() the returned string. * (We don't use strdup() since it's not part of the standard C library and * may not be available everywhere.) */ /* TODO(shess) Copied from fulltext.c, consider util.c for such ** things. */ static char *string_dup(const char *s){ char *str = malloc(strlen(s) + 1); strcpy(str, s); return str; } typedef struct simple_tokenizer { sqlite3_tokenizer base; const char *zDelim; /* token delimiters */ } simple_tokenizer; typedef struct simple_tokenizer_cursor { sqlite3_tokenizer_cursor base; const char *pInput; /* input we are tokenizing */ int nBytes; /* size of the input */ const char *pCurrent; /* current position in pInput */ int iToken; /* index of next token to be returned */ char *zToken; /* storage for current token */ int nTokenBytes; /* actual size of current token */ int nTokenAllocated; /* space allocated to zToken buffer */ } simple_tokenizer_cursor; static sqlite3_tokenizer_module simpleTokenizerModule;/* forward declaration */ static int simpleCreate( int argc, const char **argv, sqlite3_tokenizer **ppTokenizer ){ simple_tokenizer *t; t = (simple_tokenizer *) malloc(sizeof(simple_tokenizer)); /* TODO(shess) Delimiters need to remain the same from run to run, ** else we need to reindex. One solution would be a meta-table to ** track such information in the database, then we'd only want this ** information on the initial create. */ if( argc>1 ){ t->zDelim = string_dup(argv[1]); } else { /* Build a string excluding alphanumeric ASCII characters */ char zDelim[0x80]; /* nul-terminated, so nul not a member */ int i, j; for(i=1, j=0; i<0x80; i++){ if( !isalnum(i) ){ zDelim[j++] = i; } } zDelim[j++] = '\0'; assert( j<=sizeof(zDelim) ); t->zDelim = string_dup(zDelim); } *ppTokenizer = &t->base; return SQLITE_OK; } static int simpleDestroy(sqlite3_tokenizer *pTokenizer){ simple_tokenizer *t = (simple_tokenizer *) pTokenizer; free((void *) t->zDelim); free(t); return SQLITE_OK; } static int simpleOpen( sqlite3_tokenizer *pTokenizer, const char *pInput, int nBytes, sqlite3_tokenizer_cursor **ppCursor ){ simple_tokenizer_cursor *c; c = (simple_tokenizer_cursor *) malloc(sizeof(simple_tokenizer_cursor)); c->pInput = pInput; c->nBytes = nBytes<0 ? (int) strlen(pInput) : nBytes; c->pCurrent = c->pInput; /* start tokenizing at the beginning */ c->iToken = 0; c->zToken = NULL; /* no space allocated, yet. */ c->nTokenBytes = 0; c->nTokenAllocated = 0; *ppCursor = &c->base; return SQLITE_OK; } static int simpleClose(sqlite3_tokenizer_cursor *pCursor){ simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor; if( NULL!=c->zToken ){ free(c->zToken); } free(c); return SQLITE_OK; } static int simpleNext( sqlite3_tokenizer_cursor *pCursor, const char **ppToken, int *pnBytes, int *piStartOffset, int *piEndOffset, int *piPosition ){ simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor; simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer; int ii; while( c->pCurrent-c->pInput<c->nBytes ){ int n = (int) strcspn(c->pCurrent, t->zDelim); if( n>0 ){ if( n+1>c->nTokenAllocated ){ c->zToken = realloc(c->zToken, n+1); } for(ii=0; ii<n; ii++){ /* TODO(shess) This needs expansion to handle UTF-8 ** case-insensitivity. */ char ch = c->pCurrent[ii]; c->zToken[ii] = (unsigned char)ch<0x80 ? tolower(ch) : ch; } c->zToken[n] = '\0'; *ppToken = c->zToken; *pnBytes = n; *piStartOffset = (int) (c->pCurrent-c->pInput); *piEndOffset = *piStartOffset+n; *piPosition = c->iToken++; c->pCurrent += n + 1; return SQLITE_OK; } c->pCurrent += n + 1; /* TODO(shess) could strspn() to skip delimiters en masse. Needs ** to happen in two places, though, which is annoying. */ } return SQLITE_DONE; } static sqlite3_tokenizer_module simpleTokenizerModule = { 0, simpleCreate, simpleDestroy, simpleOpen, simpleClose, simpleNext, }; void get_simple_tokenizer_module( sqlite3_tokenizer_module **ppModule ){ *ppModule = &simpleTokenizerModule; }
/* This file is part of GNUnet. (C) 2006, 2009 Christian Grothoff (and other contributing authors) GNUnet 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. GNUnet 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 GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * @file include/gnunet_peer_lib.h * @brief helper library for interning of peer identifiers * @author Christian Grothoff */ #ifndef GNUNET_PEER_LIB_H #define GNUNET_PEER_LIB_H #include "gnunet_util_lib.h" #ifdef __cplusplus extern "C" { #if 0 /* keep Emacsens' auto-indent happy */ } #endif #endif /** * A GNUNET_PEER_Id is simply a shorter * version of a "struct GNUNET_PeerIdentifier" * that can be used inside of a GNUnet peer * to save memory when the same identifier * needs to be used over and over again. */ typedef unsigned int GNUNET_PEER_Id; /** * Search for a peer identity. The reference counter is not changed. * * @param pid identity to find * @return the interned identity or 0. */ GNUNET_PEER_Id GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid); /** * Intern an peer identity. If the identity is already known, its * reference counter will be increased by one. * * @param pid identity to intern * @return the interned identity. */ GNUNET_PEER_Id GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid); /** * Change the reference counter of an interned PID. * * @param id identity to change the RC of * @param delta how much to change the RC */ void GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta); /** * Decrement multiple RCs of peer identities by one. * * @param ids array of PIDs to decrement the RCs of * @param count size of the ids array */ void GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count); /** * Convert an interned PID to a normal peer identity. * * @param id interned PID to convert * @param pid where to write the normal peer identity */ void GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid); /** * Convert an interned PID to a normal peer identity. * * @param id interned PID to convert * @return pointer to peer identity, valid as long 'id' is valid */ const struct GNUNET_PeerIdentity * GNUNET_PEER_resolve2 (GNUNET_PEER_Id id); #if 0 /* keep Emacsens' auto-indent happy */ { #endif #ifdef __cplusplus } #endif /* ifndef GNUNET_PEER_LIB_H */ #endif /* end of gnunet_peer_lib.h */
/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop 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. It 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. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once #include "ui/filedialog.h" extern "C" { #undef signals #include <gtk/gtk.h> #include <gdk/gdk.h> #define signals public } // extern "C" namespace Platform { namespace FileDialog { bool Supported(); bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, ::FileDialog::internal::Type type, QString startFile); inline QString UrlToLocal(const QUrl &url) { return url.toLocalFile(); } namespace internal { // This is a patched copy of qgtk2 theme plugin. // We need to use our own gtk file dialog instead of // styling Qt file dialog, because Qt only works with gtk2. // We need to be able to work with gtk2 and gtk3, because // we use gtk3 to work with appindicator3. class QGtkDialog : public QWindow { Q_OBJECT public: QGtkDialog(GtkWidget *gtkWidget); ~QGtkDialog(); GtkDialog *gtkDialog() const; void exec(); void show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent); void hide(); signals: void accept(); void reject(); protected: static void onResponse(QGtkDialog *dialog, int response); private slots: void onParentWindowDestroyed(); private: GtkWidget *gtkWidget; }; class GtkFileDialog : public QDialog { Q_OBJECT public: GtkFileDialog(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString()); ~GtkFileDialog(); void setVisible(bool visible) override; void setWindowTitle(const QString &windowTitle) { _windowTitle = windowTitle; } void setAcceptMode(QFileDialog::AcceptMode acceptMode) { _acceptMode = acceptMode; } void setFileMode(QFileDialog::FileMode fileMode) { _fileMode = fileMode; } void setOption(QFileDialog::Option option, bool on = true) { if (on) { _options |= option; } else { _options &= ~option; } } int exec() override; bool defaultNameFilterDisables() const; void setDirectory(const QString &directory); QDir directory() const; void selectFile(const QString &filename); QStringList selectedFiles() const; void setFilter(); void selectNameFilter(const QString &filter); QString selectedNameFilter() const; private slots: void onAccepted(); void onRejected(); private: static void onSelectionChanged(GtkDialog *dialog, GtkFileDialog *helper); static void onCurrentFolderChanged(GtkFileDialog *helper); void applyOptions(); void setNameFilters(const QStringList &filters); void showHelper(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent); void hideHelper(); // Options QFileDialog::Options _options = { 0 }; QString _windowTitle = "Choose file"; QString _initialDirectory; QStringList _initialFiles; QStringList _nameFilters; QFileDialog::AcceptMode _acceptMode = QFileDialog::AcceptOpen; QFileDialog::FileMode _fileMode = QFileDialog::ExistingFile; QString _dir; QStringList _selection; QHash<QString, GtkFileFilter*> _filters; QHash<GtkFileFilter*, QString> _filterNames; QScopedPointer<QGtkDialog> d; }; } // namespace internal } // namespace FileDialog } // namespace Platform
/**************************************************************************** * * Copyright (C) 2013 PX4 Development Team. All rights reserved. * Author: Simon Wilks <sjwilks@gmail.com> * * 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 PX4 nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ /** * @file unit_test.h * A unit test library based on MinUnit (http://www.jera.com/techinfo/jtns/jtn002.html). * */ #ifndef UNIT_TEST_H_ #define UNIT_TEST_ #include <systemlib/err.h> class __EXPORT UnitTest { public: #define xstr(s) str(s) #define str(s) #s #define INLINE_GLOBAL(type,func) inline type& func() { static type x; return x; } INLINE_GLOBAL(int, mu_tests_run) INLINE_GLOBAL(int, mu_assertion) INLINE_GLOBAL(int, mu_line) INLINE_GLOBAL(const char*, mu_last_test) #define mu_assert(message, test) \ do \ { \ if (!(test)) \ return __FILE__ ":" xstr(__LINE__) " " message " (" #test ")"; \ else \ mu_assertion()++; \ } while (0) #define mu_run_test(test) \ do \ { \ const char *message; \ mu_last_test() = #test; \ mu_line() = __LINE__; \ message = test(); \ mu_tests_run()++; \ if (message) \ return message; \ } while (0) public: UnitTest(); virtual ~UnitTest(); virtual const char* run_tests() = 0; virtual void print_results(const char* result); }; #endif /* UNIT_TEST_H_ */
/* * This file is part of Moonlight Embedded. * * Copyright (C) 2015 Iwan Timmer * * Moonlight 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. * * Moonlight 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 Moonlight; if not, see <http://www.gnu.org/licenses/>. */ #include "../audio.h" #include <stdio.h> #include <opus.h> #include <alsa/asoundlib.h> #define CHECK_RETURN(f) if ((rc = f) < 0) { printf("Alsa error code %d\n", rc); exit(-1); } #define SAMPLE_RATE 48000 #define CHANNEL_COUNT 2 #define FRAME_SIZE 240 const char* audio_device = "sysdefault"; static snd_pcm_t *handle; static OpusDecoder* decoder; static short pcmBuffer[FRAME_SIZE * CHANNEL_COUNT]; static void alsa_renderer_init() { int rc; decoder = opus_decoder_create(SAMPLE_RATE, CHANNEL_COUNT, &rc); snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; snd_pcm_uframes_t period_size = FRAME_SIZE * CHANNEL_COUNT * 2; snd_pcm_uframes_t buffer_size = 12 * period_size; unsigned int sampleRate = SAMPLE_RATE; /* Open PCM device for playback. */ CHECK_RETURN(snd_pcm_open(&handle, audio_device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) /* Set hardware parameters */ CHECK_RETURN(snd_pcm_hw_params_malloc(&hw_params)); CHECK_RETURN(snd_pcm_hw_params_any(handle, hw_params)); CHECK_RETURN(snd_pcm_hw_params_set_access(handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)); CHECK_RETURN(snd_pcm_hw_params_set_format(handle, hw_params, SND_PCM_FORMAT_S16_LE)); CHECK_RETURN(snd_pcm_hw_params_set_rate_near(handle, hw_params, &sampleRate, NULL)); CHECK_RETURN(snd_pcm_hw_params_set_channels(handle, hw_params, CHANNEL_COUNT)); CHECK_RETURN(snd_pcm_hw_params_set_buffer_size_near(handle, hw_params, &buffer_size)); CHECK_RETURN(snd_pcm_hw_params_set_period_size_near(handle, hw_params, &period_size, NULL)); CHECK_RETURN(snd_pcm_hw_params(handle, hw_params)); snd_pcm_hw_params_free(hw_params); /* Set software parameters */ CHECK_RETURN(snd_pcm_sw_params_malloc(&sw_params)); CHECK_RETURN(snd_pcm_sw_params_current(handle, sw_params)); CHECK_RETURN(snd_pcm_sw_params_set_start_threshold(handle, sw_params, buffer_size - period_size)); CHECK_RETURN(snd_pcm_sw_params_set_avail_min(handle, sw_params, period_size)); CHECK_RETURN(snd_pcm_sw_params(handle, sw_params)); snd_pcm_sw_params_free(sw_params); CHECK_RETURN(snd_pcm_prepare(handle)); } static void alsa_renderer_cleanup() { if (decoder != NULL) opus_decoder_destroy(decoder); if (handle != NULL) { snd_pcm_drain(handle); snd_pcm_close(handle); } } static void alsa_renderer_decode_and_play_sample(char* data, int length) { int decodeLen = opus_decode(decoder, data, length, pcmBuffer, FRAME_SIZE, 0); if (decodeLen > 0) { int rc = snd_pcm_writei(handle, pcmBuffer, decodeLen); if (rc == -EPIPE) snd_pcm_recover(handle, rc, 1); if (rc<0) printf("Alsa error from writei: %d\n", rc); else if (decodeLen != rc) printf("Alsa shortm write, write %d frames\n", rc); } else { printf("Opus error from decode: %d\n", decodeLen); } } AUDIO_RENDERER_CALLBACKS audio_callbacks_alsa = { .init = alsa_renderer_init, .cleanup = alsa_renderer_cleanup, .decodeAndPlaySample = alsa_renderer_decode_and_play_sample, .capabilities = CAPABILITY_DIRECT_SUBMIT, };
/* xTalk Engine Platform Glue xtalk_platform.h CinsImp Copyright (c) 2010-2013 Joshua Hawcroft <www.joshhawcroft.com/CinsImp/> Common header for platform-specific glue */ #ifndef GeneralxTalkEngine_xte_platform_h #define GeneralxTalkEngine_xte_platform_h #define XTE_DATE_SHORT 0 #define XTE_DATE_ABBREVIATED 1 #define XTE_DATE_LONG 2 #define XTE_TIME_SHORT 3 #define XTE_TIME_LONG 4 #define XTE_MONTH_SHORT 5 #define XTE_MONTH_LONG 6 #define XTE_WEEKDAY_SHORT 7 #define XTE_WEEKDAY_LONG 8 #endif
//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef MIPSABIINFO_H #define MIPSABIINFO_H #include "llvm/ADT/ArrayRef.h" #include "llvm/IR/CallingConv.h" #include "llvm/MC/MCRegisterInfo.h" namespace llvm { class MipsABIInfo { public: enum class ABI { Unknown, O32, N32, N64, EABI }; protected: ABI ThisABI; public: MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {} static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); } static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); } static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); } static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); } static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); } bool IsKnown() const { return ThisABI != ABI::Unknown; } bool IsO32() const { return ThisABI == ABI::O32; } bool IsN32() const { return ThisABI == ABI::N32; } bool IsN64() const { return ThisABI == ABI::N64; } bool IsEABI() const { return ThisABI == ABI::EABI; } ABI GetEnumValue() const { return ThisABI; } /// The registers to use for byval arguments. const ArrayRef<MCPhysReg> GetByValArgRegs() const; /// The registers to use for the variable argument list. const ArrayRef<MCPhysReg> GetVarArgRegs() const; /// Obtain the size of the area allocated by the callee for arguments. /// CallingConv::FastCall affects the value for O32. unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const; /// Ordering of ABI's /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given /// multiple ABI options. bool operator<(const MipsABIInfo Other) const { return ThisABI < Other.GetEnumValue(); } }; } #endif
//*************************************************************************** // // Copyright (c) 1999 - 2006 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //*************************************************************************** /** @file IFXSchedulerTypes.h This module defines all scheduler-related things that are not specifically part of some class or another. */ #ifndef __IFXSchedulerTypes_H__ #define __IFXSchedulerTypes_H__ #include "IFXResult.h" //------------------------------------------------------------------- // Data Types //------------------------------------------------------------------- /** A handle that uniquely identifies a task and an object registered with one of the Scheduler's various managers. It may be used to perform an unregistration. It should not be used as a pointer. */ typedef U32 IFXTaskHandle; /** This value denotes an invalid task handle. */ #define IFXTASK_HANDLE_INVALID 0 //------------------------------------------------------------------- // Return Codes //------------------------------------------------------------------- #define IFX_E_VIEW_NEEDED MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7000) #define IFX_E_OBJECT_MOUSE_EVENT MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7001) #define IFX_E_OBJECT_JOYSTICK_EVENT MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7001) #define IFX_E_TIME_PERIOD MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7002) #define IFX_E_TIME_START MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7003) #define IFX_E_TIME_UNITS MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7004) #define IFX_E_ROOT_NODE MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7005) #define IFX_E_NO_ATTRIBUTE MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7006) #define IFX_E_INVALID_FLAGS MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7007) #define IFX_E_NO_SCRIPT_HANDLER_FOUND MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x7009) #define IFX_E_NO_SCRIPT_OBJECT_FOUND MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x700a) #define IFX_E_ATTRIBUTE_COMPONENT MAKE_IFXRESULT_FAIL(IFXRESULT_COMPONENT_SCHEDULER, 0x700b) #endif
// // Copyright 2005 The Android Open Source Project // // C/C++ logging functions. See the logging documentation for API details. // // We'd like these to be available from C code (in case we import some from // somewhere), so this has a C interface. // // The output will be correct when the log file is shared between multiple // threads and/or multiple processes so long as the operating system // supports O_APPEND. These calls have mutex-protected data structures // and so are NOT reentrant. Do not use LOG in a signal handler. // #ifndef _MINZIP_LOG_H #define _MINZIP_LOG_H #include <stdio.h> // --------------------------------------------------------------------- #define NDEBUG #define LOG_NDEBUG 1 /* * Normally we strip LOGV (VERBOSE messages) from release builds. * You can modify this (for example with "#define LOG_NDEBUG 0" * at the top of your source file) to change that behavior. */ #ifndef LOG_NDEBUG #ifdef NDEBUG #define LOG_NDEBUG 1 #else #define LOG_NDEBUG 0 #endif #endif /* * This is the local tag used for the following simplified * logging macros. You can change this preprocessor definition * before using the other macros to change the tag. */ #ifndef LOG_TAG #define LOG_TAG NULL #endif // --------------------------------------------------------------------- /* * Simplified macro to send a verbose log message using the current LOG_TAG. */ #ifndef LOGV #if LOG_NDEBUG #define LOGV(...) ((void)0) #else #define LOGV(...) ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) #endif #endif #define CONDITION(cond) (__builtin_expect((cond)!=0, 0)) #ifndef LOGV_IF #if LOG_NDEBUG #define LOGV_IF(cond, ...) ((void)0) #else #define LOGV_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif #endif #define LOGVV LOGV #define LOGVV_IF LOGV_IF /* * Simplified macro to send a debug log message using the current LOG_TAG. */ #ifndef LOGD #define LOGD(...) ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) #endif #ifndef LOGD_IF #define LOGD_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an info log message using the current LOG_TAG. */ #ifndef LOGI #define LOGI(...) ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) #endif #ifndef LOGI_IF #define LOGI_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send a warning log message using the current LOG_TAG. */ #ifndef LOGW #define LOGW(...) ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) #endif #ifndef LOGW_IF #define LOGW_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an error log message using the current LOG_TAG. */ #ifndef LOGE #define LOGE(...) ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) #endif #ifndef LOGE_IF #define LOGE_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * verbose priority. */ #ifndef IF_LOGV #if LOG_NDEBUG #define IF_LOGV() if (false) #else #define IF_LOGV() IF_LOG(LOG_VERBOSE, LOG_TAG) #endif #endif /* * Conditional based on whether the current LOG_TAG is enabled at * debug priority. */ #ifndef IF_LOGD #define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * info priority. */ #ifndef IF_LOGI #define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * warn priority. */ #ifndef IF_LOGW #define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * error priority. */ #ifndef IF_LOGE #define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG) #endif // --------------------------------------------------------------------- /* * Basic log message macro. * * Example: * LOG(LOG_WARN, NULL, "Failed with error %d", errno); * * The second argument may be NULL or "" to indicate the "global" tag. * * Non-gcc probably won't have __FUNCTION__. It's not vital. gcc also * offers __PRETTY_FUNCTION__, which is rather more than we need. */ #ifndef LOG #define LOG(priority, tag, ...) \ LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__) #endif /* * Log macro that allows you to specify a number for the priority. */ #ifndef LOG_PRI #define LOG_PRI(priority, tag, ...) \ printf(tag ": " __VA_ARGS__) #endif /* * Conditional given a desired logging priority and tag. */ #ifndef IF_LOG #define IF_LOG(priority, tag) \ if (1) #endif #endif // _MINZIP_LOG_H
// This file is part of SWGANH which is released under the MIT license. // See file LICENSE or go to http://swganh.com/LICENSE #pragma once #include <cstdint> #include "anh/byte_buffer.h" #include "base_swg_message.h" namespace swganh { namespace messages { struct CancelLiveAuctionResponseMessage : public BaseSwgMessage { uint16_t Opcount() const { return 4; } uint32_t Opcode() const { return 0x7DA2246C; } uint64_t item_id; uint32_t error; // 0 = success, 1 = not allowed, 2 = item invalid, 3 = blank, 8 = must be owner of item to cancel, 15 = too late/auction already completed uint8_t unknown; void OnSerialize(swganh::ByteBuffer& buffer) const { buffer.write(item_id); buffer.write(error); buffer.write(unknown); } void OnDeserialize(swganh::ByteBuffer& buffer) { item_id = buffer.read<uint64_t>(); error = buffer.read<uint32_t>(); unknown = buffer.read<uint8_t>(); } }; } } // namespace swganh::messages
/* This file is part of Darling. Copyright (C) 2019 Lubos Dolezel Darling is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Darling is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Darling. If not, see <http://www.gnu.org/licenses/>. */ #include <Foundation/Foundation.h> @protocol ABCardViewDataSource @end
/*** *dos.h - definitions for MS-DOS interface routines * * Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved. * *Purpose: * Defines the structs and unions used for the direct DOS interface * routines; includes macros to access the segment and offset * values of far pointers, so that they may be used by the routines; and * provides function prototypes for direct DOS interface functions. * ****/ #ifndef _REGS_DEFINED /* word registers */ struct WORDREGS { unsigned int ax; unsigned int bx; unsigned int cx; unsigned int dx; unsigned int si; unsigned int di; unsigned int cflag; }; /* byte registers */ struct BYTEREGS { unsigned char al, ah; unsigned char bl, bh; unsigned char cl, ch; unsigned char dl, dh; }; /* general purpose registers union - * overlays the corresponding word and byte registers. */ union REGS { struct WORDREGS x; struct BYTEREGS h; }; /* segment registers */ struct SREGS { unsigned int es; unsigned int cs; unsigned int ss; unsigned int ds; }; #define _REGS_DEFINED #endif /* dosexterror structure */ #ifndef _DOSERROR_DEFINED struct DOSERROR { int exterror; char class; char action; char locus; }; #define _DOSERROR_DEFINED #endif /* _dos_findfirst structure */ #ifndef _FIND_T_DEFINED struct find_t { char reserved[21]; char attrib; unsigned wr_time; unsigned wr_date; long size; char name[13]; }; #define _FIND_T_DEFINED #endif /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */ #ifndef _DATETIME_T_DEFINED struct dosdate_t { unsigned char day; /* 1-31 */ unsigned char month; /* 1-12 */ unsigned int year; /* 1980-2099 */ unsigned char dayofweek; /* 0-6, 0=Sunday */ }; struct dostime_t { unsigned char hour; /* 0-23 */ unsigned char minute; /* 0-59 */ unsigned char second; /* 0-59 */ unsigned char hsecond; /* 0-99 */ }; #define _DATETIME_T_DEFINED #endif /* _dos_getdiskfree structure */ #ifndef _DISKFREE_T_DEFINED struct diskfree_t { unsigned total_clusters; unsigned avail_clusters; unsigned sectors_per_cluster; unsigned bytes_per_sector; }; #define _DISKFREE_T_DEFINED #endif /* manifest constants for _hardresume result parameter */ #define _HARDERR_IGNORE 0 /* Ignore the error */ #define _HARDERR_RETRY 1 /* Retry the operation */ #define _HARDERR_ABORT 2 /* Abort program issuing Interrupt 23h */ #define _HARDERR_FAIL 3 /* Fail the system call in progress */ /* _HARDERR_FAIL is not supported on DOS 2.x */ /* File attribute constants */ #define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */ #define _A_RDONLY 0x01 /* Read only file */ #define _A_HIDDEN 0x02 /* Hidden file */ #define _A_SYSTEM 0x04 /* System file */ #define _A_VOLID 0x08 /* Volume ID file */ #define _A_SUBDIR 0x10 /* Subdirectory */ #define _A_ARCH 0x20 /* Archive file */ /* macros to break C "far" pointers into their segment and offset components */ #define FP_SEG(fp) (*((unsigned _far *)&(fp)+1)) #define FP_OFF(fp) (*((unsigned _far *)&(fp))) /* external variable declarations */ extern unsigned int _near _cdecl _osversion; /* function prototypes */ #ifndef _MT int _cdecl bdos(int, unsigned int, unsigned int); void _cdecl _chain_intr(void (_cdecl _interrupt _far *)()); void _cdecl _disable(void); unsigned _cdecl _dos_allocmem(unsigned, unsigned *); unsigned _cdecl _dos_close(int); unsigned _cdecl _dos_creat(const char *, unsigned, int *); unsigned _cdecl _dos_creatnew(const char *, unsigned, int *); unsigned _cdecl _dos_findfirst(const char *, unsigned, struct find_t *); unsigned _cdecl _dos_findnext(struct find_t *); unsigned _cdecl _dos_freemem(unsigned); void _cdecl _dos_getdate(struct dosdate_t *); void _cdecl _dos_getdrive(unsigned *); unsigned _cdecl _dos_getdiskfree(unsigned, struct diskfree_t *); unsigned _cdecl _dos_getfileattr(const char *, unsigned *); unsigned _cdecl _dos_getftime(int, unsigned *, unsigned *); void _cdecl _dos_gettime(struct dostime_t *); void (_cdecl _interrupt _far * _cdecl _dos_getvect(unsigned))(); void _cdecl _dos_keep(unsigned, unsigned); unsigned _cdecl _dos_open(const char *, unsigned, int *); unsigned _cdecl _dos_read(int, void _far *, unsigned, unsigned *); unsigned _cdecl _dos_setblock(unsigned, unsigned, unsigned *); unsigned _cdecl _dos_setdate(struct dosdate_t *); void _cdecl _dos_setdrive(unsigned, unsigned *); unsigned _cdecl _dos_setfileattr(const char *, unsigned); unsigned _cdecl _dos_setftime(int, unsigned, unsigned); unsigned _cdecl _dos_settime(struct dostime_t *); void _cdecl _dos_setvect(unsigned, void (_cdecl _interrupt _far *)()); unsigned _cdecl _dos_write(int, const void _far *, unsigned, unsigned *); int _cdecl dosexterr(struct DOSERROR *); void _cdecl _enable(void); void _cdecl _harderr(void (_far *)()); void _cdecl _hardresume(int); void _cdecl _hardretn(int); int _cdecl intdos(union REGS *, union REGS *); int _cdecl intdosx(union REGS *, union REGS *, struct SREGS *); int _cdecl int86(int, union REGS *, union REGS *); int _cdecl int86x(int, union REGS *, union REGS *, struct SREGS *); #endif /* _MT */ void _cdecl segread(struct SREGS *);
/* Copyright (C) 1999-2007 id Software, Inc. and contributors. For a list of contributors, see the accompanying CONTRIBUTORS file. This file is part of GtkRadiant. GtkRadiant 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. GtkRadiant 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 GtkRadiant; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _QBSP3_H #define _QBSP3_H #include "qfiles.h" extern int nummodels; extern dmodel_t dmodels[MAX_MAP_MODELS]; extern int visdatasize; extern byte dvisdata[MAX_MAP_VISIBILITY]; extern dvis_t *dvis; extern int lightdatasize; extern byte dlightdata[MAX_MAP_LIGHTING]; extern int entdatasize; extern char dentdata[MAX_MAP_ENTSTRING]; extern int numleafs; extern dleaf_t dleafs[MAX_MAP_LEAFS]; extern int numplanes; extern dplane_t dplanes[MAX_MAP_PLANES]; extern int numvertexes; extern dvertex_t dvertexes[MAX_MAP_VERTS]; extern int numnodes; extern dnode_t dnodes[MAX_MAP_NODES]; extern int numtexinfo; extern texinfo_t texinfo[MAX_MAP_TEXINFO]; extern int numfaces; extern dface_t dfaces[MAX_MAP_FACES]; extern int numedges; extern dedge_t dedges[MAX_MAP_EDGES]; extern int numleaffaces; extern unsigned short dleaffaces[MAX_MAP_LEAFFACES]; extern int numleafbrushes; extern unsigned short dleafbrushes[MAX_MAP_LEAFBRUSHES]; extern int numsurfedges; extern int dsurfedges[MAX_MAP_SURFEDGES]; extern int numareas; extern darea_t dareas[MAX_MAP_AREAS]; extern int numareaportals; extern dareaportal_t dareaportals[MAX_MAP_AREAPORTALS]; extern int numbrushes; extern dbrush_t dbrushes[MAX_MAP_BRUSHES]; extern int numbrushsides; extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES]; extern byte dpop[256]; void DecompressVis( byte *in, byte *decompressed ); int CompressVis( byte *vis, byte *dest ); void LoadBSPFile( char *filename ); void LoadBSPFileTexinfo( char *filename ); // just for qdata void WriteBSPFile( char *filename ); void PrintBSPFileSizes( void ); //=============== typedef struct epair_s { struct epair_s *next; char *key; char *value; } epair_t; typedef struct { vec3_t origin; int firstbrush; int numbrushes; epair_t *epairs; // only valid for func_areaportals int areaportalnum; int portalareas[2]; } entity_t; extern int num_entities; extern entity_t entities[MAX_MAP_ENTITIES]; void ParseEntities( void ); void UnparseEntities( void ); void SetKeyValue( entity_t *ent, char *key, char *value ); char *ValueForKey( entity_t *ent, char *key ); // will return "" if not present vec_t FloatForKey( entity_t *ent, char *key ); void GetVectorForKey( entity_t *ent, char *key, vec3_t vec ); epair_t *ParseEpair( void ); void PrintEntity( entity_t *ent ); #endif //_QBSP3_H
#pragma once #include <QMainWindow> #include <QCloseEvent> #include "shortinstruction.h" #include "global.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: void writeSettings(void); void readSettings(void); void closeEvent(QCloseEvent * event); void updateLanguage(void); Ui::MainWindow *ui; QString objPath; QString xmacPath; QString newXmacPath; QString localeStr; ShortInstruction * instr; static rmOut out; private slots: void on_actionConvert_triggered(); void on_actionShortInstruction_triggered(); void on_lineEdit_newXmac_textChanged(QString ); void on_lineEdit_xmac_textChanged(QString ); void on_lineEdit_obj_textChanged(QString ); void on_pushButton_convert_clicked(); void on_pushButton_newXmac_clicked(); void on_pushButton_xmac_clicked(); void on_pushButton_obj_clicked(); void on_checkBox_stateChanged(int newState); void on_actionExit_triggered(); void on_actionAbout_triggered(); void on_actionGerman_triggered(); void on_actionEnglish_triggered(); };
// Copyright (c) 2017 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. // // --------------------------------------------------------------------------- // // This file was generated by the CEF translator tool. If making changes by // hand only do so within the body of existing method and function // implementations. See the translator.README.txt file in the tools directory // for more information. // // $hash=f21436369197b967957c039f1a510b9a3ec9c5a8$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_STREAM_WRITER_CTOCPP_H_ #define CEF_LIBCEF_DLL_CTOCPP_STREAM_WRITER_CTOCPP_H_ #pragma once #if !defined(WRAPPING_CEF_SHARED) #error This file can be included wrapper-side only #endif #include "include/capi/cef_stream_capi.h" #include "include/cef_stream.h" #include "libcef_dll/ctocpp/ctocpp_ref_counted.h" // Wrap a C structure with a C++ class. // This class may be instantiated and accessed wrapper-side only. class CefStreamWriterCToCpp : public CefCToCppRefCounted<CefStreamWriterCToCpp, CefStreamWriter, cef_stream_writer_t> { public: CefStreamWriterCToCpp(); // CefStreamWriter methods. size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE; int Seek(int64 offset, int whence) OVERRIDE; int64 Tell() OVERRIDE; int Flush() OVERRIDE; bool MayBlock() OVERRIDE; }; #endif // CEF_LIBCEF_DLL_CTOCPP_STREAM_WRITER_CTOCPP_H_
/*********************************************************************** * 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/>. ***********************************************************************/ #ifdef HAVE_CONFIG_H #include "tmlqcd_config.h" #endif #include <stdlib.h> #include <stdio.h> #include <string.h> #ifdef MPI #include <mpi.h> #endif #ifdef TM_USE_OMP #include <omp.h> #endif #include "global.h" #include "su3.h" #include "convert_even_to_lexic.h" void convert_even_to_lexic(spinor * const P, spinor * const r) { #ifdef TM_USE_OMP #pragma omp parallel { #endif int x, y, z, t, i, ix; spinor * p = NULL; #ifdef TM_USE_OMP #pragma omp for #endif for(x = 0; x < LX; x++) { for(y = 0; y < LY; y++) { for(z = 0; z < LZ; z++) { for(t = 0; t < T; t++) { ix = g_ipt[t][x][y][z]; i = g_lexic2eosub[ ix ]; if((t+x+y+z+g_proc_coords[3]*LZ+g_proc_coords[2]*LY + g_proc_coords[0]*T+g_proc_coords[1]*LX)%2 == 0) { p = r; memcpy((P+ix), (p+i), sizeof(spinor)); } } } } } #ifdef TM_USE_OMP } /*OpenMP closing brace */ #endif return; } /* * P: spinor with full volume * r: new spinor even */ void convert_lexic_to_even(spinor * const r, spinor * const P) { #ifdef TM_USE_OMP #pragma omp parallel { #endif int x, y, z, t, i, ix; spinor * p = NULL; #ifdef TM_USE_OMP #pragma omp for #endif for(x = 0; x < LX; x++) { for(y = 0; y < LY; y++) { for(z = 0; z < LZ; z++) { for(t = 0; t < T; t++) { ix = g_ipt[t][x][y][z]; i = g_lexic2eosub[ ix ]; if((t+x+y+z+g_proc_coords[3]*LZ+g_proc_coords[2]*LY + g_proc_coords[0]*T+g_proc_coords[1]*LX)%2 == 0) { p = r; memcpy((p+i), (P+ix), sizeof(spinor)); } } } } } #ifdef TM_USE_OMP } /* OpenMP closing brace */ #endif return; }
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * 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. * * ***** END GPL LICENSE BLOCK ***** */ /** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h * \ingroup freestyle */ #ifndef __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ #define __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ #include "../BPy_UnaryFunction0DDouble.h" #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////////////////// extern PyTypeObject LocalAverageDepthF0D_Type; #define BPy_LocalAverageDepthF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&LocalAverageDepthF0D_Type)) /*---------------------------Python BPy_LocalAverageDepthF0D structure definition----------*/ typedef struct { BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_LocalAverageDepthF0D; /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif #endif /* __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ */
#pragma once namespace clr { class appdomain_impl; class appdomain { public: appdomain(const wchar_t* version); ~appdomain(); operator bool() const; appdomain_impl* get() const; private: appdomain_impl* m_impl; }; class object_impl; class object { public: object(appdomain* appdomain, const wchar_t* assembly, const wchar_t* type); ~object(); int call(const wchar_t* name); int error_code() const; private: object_impl* m_impl; }; }
/* * SPDX-FileCopyrightText: (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. * SPDX-License-Identifier: BSD-1-Clause * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) * From ASN.1 module "SUPL-POS-INIT" * found in "../supl-posinit.asn" */ #ifndef _RequestedAssistData_H #define _RequestedAssistData_H #include <asn_application.h> /* Including external dependencies */ #include <BOOLEAN.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct XNavigationModel; /* RequestedAssistData */ typedef struct RequestedAssistData { BOOLEAN_t almanacRequested; BOOLEAN_t utcModelRequested; BOOLEAN_t ionosphericModelRequested; BOOLEAN_t dgpsCorrectionsRequested; BOOLEAN_t referenceLocationRequested; BOOLEAN_t referenceTimeRequested; BOOLEAN_t acquisitionAssistanceRequested; BOOLEAN_t realTimeIntegrityRequested; BOOLEAN_t navigationModelRequested; struct XNavigationModel *navigationModelData /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } RequestedAssistData_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_RequestedAssistData; #ifdef __cplusplus } #endif /* Referred external types */ #include "XNavigationModel.h" #endif /* _RequestedAssistData_H_ */ #include <asn_internal.h>
// This file is part of BOINC. // http://boinc.berkeley.edu // Copyright (C) 2008 University of California // // BOINC 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. // // BOINC 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 BOINC. If not, see <http://www.gnu.org/licenses/>. #ifndef _BOINCSIMPLEFRAME_H_ #define _BOINCSIMPLEFRAME_H_ #include "BOINCBaseFrame.h" #if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "sg_BoincSimpleFrame.cpp" #endif class CTransparentButton; class CSimpleTaskPanel; class CSimpleProjectPanel; class CSimpleTaskPanel; class CDlgMessages; class CSimpleGUIPanel : public wxPanel { DECLARE_DYNAMIC_CLASS(CSimpleGUIPanel) public: CSimpleGUIPanel(); CSimpleGUIPanel(wxWindow* parent); ~CSimpleGUIPanel(); // // My tasks panel (shown when there are active tasks) CSimpleTaskPanel *m_taskPanel; // My projects panel CSimpleProjectPanel *m_projPanel; ////////////////////////////; void SetBackgroundBitmap(); void ReskinInterface(); void UpdateProjectView(); void OnFrameRender(); void OnProjectsAttachToProject(); void OnShowNotices(wxCommandEvent& event); void OnSuspendResume(wxCommandEvent& event); void OnHelp( wxCommandEvent& event ); void SetDlgOpen(bool newDlgState) { dlgOpen = newDlgState; } bool GetDlgOpen() { return dlgOpen; } wxBitmap *GetBackgroundBitMap() { return &m_bmpBg; } void OnCheckForNewNotices(wxTimerEvent& WXUNUSED(event)); void NoticesViewed(); ////////// wxBoxSizer *mainSizer; ////////// bool m_bNewNoticeAlert; bool m_bNoticesButtonIsRed; DECLARE_EVENT_TABLE() protected: void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); #ifdef __WXMAC__ // void SetupMacAccessibilitySupport(); // void RemoveMacAccessibilitySupport(); // EventHandlerRef m_pSGAccessibilityEventHandlerRef; int m_iRedRingRadius; #endif wxBitmap m_bmpBg; CTransparentButton *m_NoticesButton; CTransparentButton *m_SuspendResumeButton; CTransparentButton *m_HelpButton; wxString m_sSuspendString; wxString m_sResumeString; int m_oldWorkCount; bool m_bIsSuspended; private: int m_irefreshCount; bool dlgOpen; wxTimer* checkForNewNoticesTimer; wxString m_sSuspendButtonToolTip; wxString m_sResumeButtonToolTip; }; // Define a new frame class CSimpleFrame : public CBOINCBaseFrame { DECLARE_DYNAMIC_CLASS(CSimpleFrame) public: CSimpleFrame(); CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint position, wxSize size); ~CSimpleFrame(); void OnChangeGUI( wxCommandEvent& event ); void BuildSkinSubmenu( wxMenu *submenu ); void OnSelectDefaultSkin( wxCommandEvent& event ); void OnSelectSkin( wxCommandEvent& event ); void OnPreferences( wxCommandEvent& event ); void OnOptions( wxCommandEvent& event ); void OnOldSG( wxCommandEvent& event ); void OnHelp( wxHelpEvent& event ); void OnHelpBOINC( wxCommandEvent& event ); void OnHelpAbout( wxCommandEvent& event ); void OnProjectsAttachToProject(); void OnConnect(CFrameEvent& event ); void OnReloadSkin( CFrameEvent& event ); void OnRefreshView( CFrameEvent& event ); void OnNotification( CFrameEvent& event ); void OnEventLog(wxCommandEvent& event); void SetMsgsDlgOpen(CDlgMessages* newDlgPtr) { dlgMsgsPtr = newDlgPtr; } bool isMessagesDlgOpen() { return (dlgMsgsPtr != NULL); } bool SaveState(); bool RestoreState(); protected: virtual int _GetCurrentViewPage(); wxMenuBar* m_pMenubar; wxMenu* m_pSubmenuSkins; wxAcceleratorEntry m_Shortcuts[2]; wxAcceleratorTable* m_pAccelTable; CSimpleGUIPanel* m_pBackgroundPanel; private: CDlgMessages* dlgMsgsPtr; DECLARE_EVENT_TABLE() }; #endif // _BOINCSIMPLEFRAME_H_
/****************************************************************************** * * MantaFlow fluid solver framework * Copyright 2014 Tobias Pfaff, Nils Thuerey * * This program is free software, distributed under the terms of the * GNU General Public License (GPL) * http://www.gnu.org/licenses * * Simple image IO * ******************************************************************************/ #ifndef MANTA_SIMPLEIMAGE_H #define MANTA_SIMPLEIMAGE_H #include <stdio.h> #include <string.h> #include <stdlib.h> #include "manta.h" #include "vectorbase.h" namespace Manta { //***************************************************************************** // simple 2d image class //template<class Scalar> class SimpleImage { public: // cons/des SimpleImage() : mSize(-1), mpData(NULL), mAbortOnError(true) { }; virtual ~SimpleImage() { if(mpData) delete [] mpData; }; //! set to constant void reset(Real val = 0.) { const Vec3 v = Vec3(val); for(int i=0; i<mSize[0]*mSize[1]; i++) mpData[i] = v; } //! init memory & reset to zero void init(int x,int y) { mSize = Vec3i(x,y,0); mpData = new Vec3[x*y]; reset(); }; inline bool checkIndex(int x,int y) { if( (x<0) || (y<0) || (x>mSize[0]-1) || (y>mSize[1]-1) ) { errMsg("SimpleImage::operator() Invalid access to "<<x<<","<<y<<", size="<<mSize); return false; } return true; } // access element inline Vec3& operator() (int x,int y) { DEBUG_ONLY( checkIndex(x,y) ); return mpData[y*mSize[0]+x]; }; inline Vec3& get (int x, int y) { return (*this)(x,y); } inline Vec3& getMap (int x, int y, int z, int axis) { int i = x, j = y; if(axis==1) j=z; if(axis==0) { i=y; j=z; } return get(i,j); } // output as string, debug std::string toString() { std::ostringstream out; for (int j=0; j<mSize[1]; j++) { for (int i=0; i<mSize[0]; i++) { // normal zyx order */ out << (*this)(i,j); out <<" "; } //if (format) out << std::endl; } return out.str(); } // multiply all values by f void add(Vec3 f) { for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { get(i,j) += f; } } // multiply all values by f void multiply(Real f) { for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { get(i,j) *= f; } } // map 0-f to 0-1 range, clamp void mapRange(Real f) { for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { get(i,j) /= f; for(int c=0; c<3; ++c) get(i,j)[c] = clamp( get(i,j)[c], (Real)0.,(Real)1.); } } // normalize max values void normalizeMax() { Real max = normSquare(get(0,0)); for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { if(normSquare(get(i,j))>max) max = normSquare(get(i,j)); } max = sqrt(max); Real invMax = 1./max; for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { get(i,j) *= invMax; } }; // normalize min and max values void normalizeMinMax() { Real max = normSquare(get(0,0)); Real min = max; for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { if(normSquare(get(i,j))>max) max = normSquare(get(i,j)); if(normSquare(get(i,j))<min) min = normSquare(get(i,j)); } max = sqrt(max); min = sqrt(min); Real factor = 1./(max-min); for (int j=0; j<mSize[1]; j++) for (int i=0; i<mSize[0]; i++) { get(i,j) -= min; get(i,j) *= factor; } }; void setAbortOnError(bool set) { mAbortOnError = set; } // ppm in/output // write whole image bool writePpm(std::string filename); // write rectangle to ppm bool writePpm(std::string filename, int minx, int miny, int maxx, int maxy, bool invertXY = false); // read in a ppm file, and init the image accordingly bool initFromPpm (std::string filename); // check index is valid bool indexIsValid(int i, int j); //! access inline Vec3i getSize() const { return mSize; } protected: //! size Vec3i mSize; //! data Vec3* mpData; // make errors fatal, or continue? bool mAbortOnError; }; // SimpleImage }; // Manta #endif
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[3]; atomic_int atom_0_r1_1; atomic_int atom_1_r1_1; atomic_int atom_2_r1_1; void *t0(void *arg){ label_1:; int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst); atomic_store_explicit(&vars[1], 1, memory_order_seq_cst); int v12 = (v2_r1 == 1); atomic_store_explicit(&atom_0_r1_1, v12, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; int v4_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); atomic_store_explicit(&vars[2], 1, memory_order_seq_cst); int v13 = (v4_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v13, memory_order_seq_cst); return NULL; } void *t2(void *arg){ label_3:; int v6_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst); atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); int v14 = (v6_r1 == 1); atomic_store_explicit(&atom_2_r1_1, v14, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; pthread_t thr2; atomic_init(&vars[0], 0); atomic_init(&vars[1], 0); atomic_init(&vars[2], 0); atomic_init(&atom_0_r1_1, 0); atomic_init(&atom_1_r1_1, 0); atomic_init(&atom_2_r1_1, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_create(&thr2, NULL, t2, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); pthread_join(thr2, NULL); int v7 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst); int v8 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v9 = atomic_load_explicit(&atom_2_r1_1, memory_order_seq_cst); int v10_conj = v8 & v9; int v11_conj = v7 & v10_conj; if (v11_conj == 1) assert(0); return 0; }
/* Copyright (c) 2018-2019, tevador <tevador@gmail.com> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder 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. */ /* Original code from Argon2 reference source code package used under CC0 Licence * https://github.com/P-H-C/phc-winner-argon2 * Copyright 2015 * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves */ #ifndef PORTABLE_BLAKE2_IMPL_H #define PORTABLE_BLAKE2_IMPL_H #include <stdint.h> #include "crypto/randomx/blake2/endian.h" static FORCE_INLINE uint64_t load48(const void *src) { const uint8_t *p = (const uint8_t *)src; uint64_t w = *p++; w |= (uint64_t)(*p++) << 8; w |= (uint64_t)(*p++) << 16; w |= (uint64_t)(*p++) << 24; w |= (uint64_t)(*p++) << 32; w |= (uint64_t)(*p++) << 40; return w; } static FORCE_INLINE void store48(void *dst, uint64_t w) { uint8_t *p = (uint8_t *)dst; *p++ = (uint8_t)w; w >>= 8; *p++ = (uint8_t)w; w >>= 8; *p++ = (uint8_t)w; w >>= 8; *p++ = (uint8_t)w; w >>= 8; *p++ = (uint8_t)w; w >>= 8; *p++ = (uint8_t)w; } static FORCE_INLINE uint32_t rotr32(const uint32_t w, const unsigned c) { return (w >> c) | (w << (32 - c)); } static FORCE_INLINE uint64_t rotr64(const uint64_t w, const unsigned c) { return (w >> c) | (w << (64 - c)); } #endif
/* * Copyright (c) 2010 Mark Liversedge (liversedge@gmail.com) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 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 _GC_GcWindowRegistry_h #define _GC_GcWindowRegistry_h #include "GoldenCheetah.h" #include <QApplication> class Context; // all the windows we have defined namespace GcWindowTypes { enum gcwinid { None = 0, Aerolab = 1, AllPlot = 2, CriticalPower =3, Diary =4, GoogleMap =5, Histogram =6, LTM =7, Model =8, // deprecated PerformanceManager =9, PfPv =10, Race =11, // deprecated RideEditor =13, // deprecated - include in MetadataWindow (23) RideSummary =14, Scatter =15, Summary =16, Train =17, TreeMap =18, WeeklySummary =19, HrPw =20, VideoPlayer =21, DialWindow =22, MetadataWindow = 23, RealtimePlot = 24, WorkoutPlot = 25, MapWindow = 26, StreetViewWindow = 27, BingMap = 28, // deprecated RealtimeControls = 29, ActivityNavigator = 30, SpinScanPlot = 31, DateRangeSummary = 32, CriticalPowerSummary = 33, Distribution = 34, RouteSegment = 35, WorkoutWindow = 36, RideMapWindow = 37, RConsole = 38, RConsoleSeason = 39, SeasonPlan = 40, WebPageWindow = 41, Overview = 42, Python = 43, PythonSeason = 44, UserTrends=45, UserAnalysis=46, OverviewTrends=47, LiveMapWebPageWindow = 48 }; }; typedef enum GcWindowTypes::gcwinid GcWinID; Q_DECLARE_METATYPE(GcWinID) // when declaring a window, what view is it relevant for? #define VIEW_TRAIN 0x01 #define VIEW_ANALYSIS 0x02 #define VIEW_DIARY 0x04 #define VIEW_TRENDS 0x08 class GcChartWindow; class GcWindowRegistry { Q_DECLARE_TR_FUNCTIONS(GcWindowRegistry) public: unsigned int relevance; QString name; GcWinID id; static void initialize(); // initialize global registry static GcChartWindow *newGcWindow(GcWinID id, Context *context); static QStringList windowsForType(int type); static QList<GcWinID> idsForType(int type); static QString title(GcWinID id); }; extern GcWindowRegistry* GcWindows; #endif
/* Allocate memory region filled with spaces. Copyright (C) 1991 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty 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. Libiberty 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 libiberty; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* @deftypefn Extension char* spaces (int @var{count}) Returns a pointer to a memory region filled with the specified number of spaces and null terminated. The returned pointer is valid until at least the next call. @end deftypefn */ /* !kawai! */ #include "../include/ansidecl.h" #include "../include/libiberty.h" /* end of !kawai! */ #if VMS #include <stdlib.h> #include <unixlib.h> #else /* For systems with larger pointers than ints, these must be declared. */ extern PTR malloc PARAMS ((size_t)); extern void free PARAMS ((PTR)); #endif const char * spaces (count) int count; { register char *t; static char *buf; static int maxsize; if (count > maxsize) { if (buf) { free (buf); } buf = malloc (count + 1); if (buf == (char *) 0) return 0; for (t = buf + count ; t != buf ; ) { *--t = ' '; } maxsize = count; buf[count] = '\0'; } return (const char *) (buf + maxsize - count); }
/* Copyright (C) 2019 Equinor ASA, Norway. The file 'ies_enkf.h' is part of ERT - Ensemble based Reservoir Tool. ERT 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. ERT 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 at <http://www.gnu.org/licenses/gpl.html> for more details. */ #ifndef IES_ENKF_H #define IES_ENKF_H #include <ert/util/bool_vector.hpp> #include <ert/util/rng.hpp> #include <ert/analysis/module_info.hpp> #include <ert/res_util/matrix.hpp> #ifdef __cplusplus extern "C" { #endif void ies_enkf_init_update(void * arg , const bool_vector_type * ens_mask , const bool_vector_type * obs_mask , const matrix_type * S , const matrix_type * R , const matrix_type * dObs , const matrix_type * E , const matrix_type * D, rng_type * rng); void ies_enkf_updateA( void * module_data, matrix_type * A , // Updated ensemble A retured to ERT. matrix_type * Yin , // Ensemble of predicted measurements matrix_type * Rin , // Measurement error covariance matrix (not used) matrix_type * dObs , // Actual observations (not used) matrix_type * Ein , // Ensemble of observation perturbations matrix_type * Din , // (d+E-Y) Ensemble of perturbed observations - Y const module_info_type * module_info, rng_type * rng); #ifdef __cplusplus } #endif #endif
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include "RenderableEffect.h" #define GARLANDS_CYCLES_MIN 0 #define GARLANDS_CYCLES_MAX 20 #define GARLANDS_SPACING_MIN 1 #define GARLANDS_SPACING_MAX 100 class GarlandsEffect : public RenderableEffect { public: GarlandsEffect(int id); virtual ~GarlandsEffect(); virtual void SetDefaultParameters() override; virtual void Render(Effect *effect, SettingsMap &settings, RenderBuffer &buffer) override; virtual bool AppropriateOnNodes() const override { return false; } virtual bool CanRenderPartialTimeInterval() const override { return true; } protected: virtual xlEffectPanel *CreatePanel(wxWindow *parent) override; private: };
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include <import.h> #include <textmodifier.h> #include <QString> namespace QmlDesigner { class QmlRefactoring { QmlRefactoring(const QmlRefactoring &); QmlRefactoring &operator=(const QmlRefactoring &); public: enum PropertyType { ArrayBinding = 1, ObjectBinding = 2, ScriptBinding = 3 }; public: QmlRefactoring(const QmlJS::Document::Ptr &doc, QmlDesigner::TextModifier &modifier, const PropertyNameList &propertyOrder); bool reparseDocument(); bool addImport(const Import &import); bool removeImport(const Import &import); bool addToArrayMemberList(int parentLocation, const PropertyName &propertyName, const QString &content); bool addToObjectMemberList(int parentLocation, const QString &content); bool addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType, const TypeName &dynamicTypeName = TypeName()); bool changeProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType); bool changeObjectType(int nodeLocation, const QString &newType); bool moveObject(int objectLocation, const PropertyName &targetPropertyName, bool targetIsArray, int targetParentObjectLocation); bool moveObjectBeforeObject(int movingObjectLocation, int beforeObjectLocation, bool inDefaultProperty); bool removeObject(int nodeLocation); bool removeProperty(int parentLocation, const PropertyName &name); private: QmlJS::Document::Ptr qmlDocument; TextModifier *textModifier; PropertyNameList m_propertyOrder; }; } // namespace QmlDesigner
/* * Copyright (c) 2018 Håvard Pettersson <mail@haavard.me> * * This file is part of Tox-WeeChat. * * Tox-WeeChat 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. * * Tox-WeeChat 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 Tox-WeeChat. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TOX_WEECHAT_BOOTSTRAP_H #define TOX_WEECHAT_BOOTSTRAP_H #include <tox/tox.h> int twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port, const char *public_key); void twc_bootstrap_random_node(Tox *tox); #endif /* TOX_WEECHAT_BOOTSTRAP_H */
/* * NullHandler.h * * Created on: Aug 27, 2012 * Author: lion */ #pragma once #include "ifs/Handler.h" namespace fibjs { class NullHandler : public Handler_base { FIBER_FREE(); public: // Handler_base virtual result_t invoke(object_base* v, obj_ptr<Handler_base>& retVal, AsyncEvent* ac); }; } /* namespace fibjs */
/* * 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. * * Written (W) 2007-2011 Christian Widmer * Copyright (C) 2007-2011 Max-Planck-Society */ #ifdef USE_SVMLIGHT #ifndef _DomainAdaptation_SVM_H___ #define _DomainAdaptation_SVM_H___ #include <shogun/lib/common.h> #include <shogun/classifier/svm/SVMLight.h> #include <stdio.h> namespace shogun { /** @brief class DomainAdaptationSVM */ class CDomainAdaptationSVM : public CSVMLight { public: /** default constructor */ CDomainAdaptationSVM(); /** constructor * * @param C cost constant C * @param k kernel * @param lab labels * @param presvm trained SVM to regularize against * @param B trade-off constant B */ CDomainAdaptationSVM(float64_t C, CKernel* k, CLabels* lab, CSVM* presvm, float64_t B); /** destructor */ virtual ~CDomainAdaptationSVM(); /** init SVM * * @param presvm trained SVM to regularize against * @param B trade-off constant B * */ void init(CSVM* presvm, float64_t B); /** get classifier type * * @return classifier type */ virtual EMachineType get_classifier_type() { return CT_DASVM; } /** classify objects * * @param data (test)data to be classified * @return classified labels */ virtual CBinaryLabels* apply_binary(CFeatures* data=NULL); /** returns SVM that is used as prior information * * @return presvm */ virtual CSVM* get_presvm(); /** getter for regularization parameter B * * @return regularization parameter B */ virtual float64_t get_B(); /** getter for train_factor * * @return train_factor */ virtual float64_t get_train_factor(); /** setter for train_factor * */ virtual void set_train_factor(float64_t factor); /** @return object name */ virtual const char* get_name() const { return "DomainAdaptationSVM"; } protected: /** check sanity of presvm * * @return true if sane, throws SG_ERROR otherwise */ virtual bool is_presvm_sane(); /** train SVM classifier * * @param data training data (parameter can be avoided if distance or * kernel-based classifiers are used and distance/kernels are * initialized with train data) * * @return whether training was successful */ virtual bool train_machine(CFeatures* data=NULL); private: void init(); protected: /** SVM to regularize against */ CSVM* presvm; /** regularization parameter B */ float64_t B; /** flag to switch off regularization in training */ float64_t train_factor; }; } #endif //_DomainAdaptation_SVM_H___ #endif //USE_SVMLIGHT
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: mods/deathmatch/logic/CResourceChecker.cpp * PURPOSE: Resource file content checker/validator/upgrader * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #ifndef CRESOURCECHECKER_H #define CRESOURCECHECKER_H #include <unzip.h> #ifdef WIN32 #include <iowin32.h> #else #include <ioapi.h> #endif #include <zip.h> namespace ECheckerMode { enum ECheckerModeType { NONE, UPGRADE, WARNINGS, }; }; using ECheckerMode::ECheckerModeType; namespace ECheckerWhat { enum ECheckerWhatType { NONE, REMOVED, REPLACED, MODIFIED, }; }; using ECheckerWhat::ECheckerWhatType; class CResourceChecker { public: void LogUpgradeWarnings(CResource* pResource, const string& strResourceZip, SString& strOutReqClientVersion, SString& strOutReqServerVersion, SString& strOutReqClientReason, SString& strOutReqServerReason); void ApplyUpgradeModifications(CResource* pResource, const string& strResourceZip); protected: void CheckResourceForIssues(CResource* pResource, const string& strResourceZip); void CheckFileForIssues(const string& strPath, const string& strFileName, const string& strResourceName, bool bScript, bool bClient, bool bMeta); void CheckPngFileForIssues(const string& strPath, const string& strFileName, const string& strResourceName); void CheckRwFileForIssues(const string& strPath, const string& strFileName, const string& strResourceName); void CheckMetaFileForIssues(const string& strPath, const string& strFileName, const string& strResourceName); void CheckMetaSourceForIssues(CXMLNode* pRootNode, const string& strFileName, const string& strResourceName, ECheckerModeType checkerMode, bool* pbOutHasChanged = NULL); void CheckLuaFileForIssues(const string& strPath, const string& strFileName, const string& strResourceName, bool bClientScript); bool CheckLuaDeobfuscateRequirements(const string& strFileContents, const string& strFileName, const string& strResourceName, bool bClientScript); void CheckLuaSourceForIssues(string strLuaSource, const string& strFileName, const string& strResourceName, bool bClientScript, bool bCompiledScript, ECheckerModeType checkerMode, string* pstrOutResult = NULL); long FindLuaIdentifier(const char* szLuaSource, long* plOutLength, long* plLineNumber); bool UpgradeLuaFunctionName(const string& strFunctionName, bool bClientScript, string& strOutUpgraded); void IssueLuaFunctionNameWarnings(const string& strFunctionName, const string& strFileName, const string& strResourceName, bool bClientScript, unsigned long ulLineNumber); ECheckerWhatType GetLuaFunctionNameUpgradeInfo(const string& strFunctionName, bool bClientScript, string& strOutHow, string& strOutVersion); int ReplaceFilesInZIP(const string& strOrigZip, const string& strTempZip, const vector<string>& pathInArchiveList, const vector<string>& upgradedFullPathList); bool RenameBackupFile(const string& strOrigFilename, const string& strBakAppend); void CheckVersionRequirements(const string& strIdentifierName, bool bClientScript); bool m_bUpgradeScripts; unsigned long m_ulDeprecatedWarningCount; vector<string> m_upgradedFullPathList; SString m_strMinClientReqFromMetaXml; SString m_strMinServerReqFromMetaXml; SString m_strReqClientVersion; SString m_strReqServerVersion; SString m_strReqClientReason; SString m_strReqServerReason; }; #endif
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-avx2-128.h" #include "../common/t3bv_32.c"
/* This file is part of SUPPL - the supplemental library for DOS Copyright (C) 1996-2000 Steffen Kaiser 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $RCSfile: env_strg.c,v $ $Locker: $ $Name: $ $State: Exp $ ob(ject): env_string su(bsystem): env ty(pe): sy(nopsis): sh(ort description): Return the address of an environment string he(ader files): lo(ng description): Returns the offset of a string into the specified environment.\par If \tok{index == env_strings()}, the first unused byte behind the last string is returned. pr(erequistes): va(lue): 0: on failure; index too large (ENOENT) or no environment (ENXIO) \item else: offset of string re(lated to): env_stringcounter se(condary subsystems): xr(ef): im(port): fi(le): in(itialized by): wa(rning): bu(gs): co(mpilers): */ #include "initsupl.loc" #ifndef _MICROC_ #include <dos.h> #endif #include "environ.loc" #include "eno.loc" #include "suppldbg.h" #ifdef RCS_Version static char const rcsid[] = "$Id: env_strg.c,v 1.1 2006/06/17 03:25:03 blairdude Exp $"; #endif word env_string(word segm, int index) { word ofs; DBG_ENTER("env_string", Suppl_env) DBG_ARGUMENTS( ("env=%u, idx=%d", segm, index) ) chkMem unless_segm(segm) { eno_set(ENXIO); DBG_RETURN_I( 0) } DBG_ARGUMENTS( ("effective env=%u", segm) ) /* the string number "index" maybe equal to the number of strings, in which case the proper position of a new string is to be returned. */ if(peekw(segm, ofs = 1 + env_endOfVars(segm)) < index) { eno_set(ENOENT); DBG_RETURN_I( 0) /* string number too high */ } ofs += 2; /* 1st string */ while(index--) /* skip current string */ ofs += env_varlen(segm, ofs); DBG_RETURN_I( ofs) }
/* $Id: shift.c,v 1.2 2004/02/01 13:52:17 skaus Exp $ * SHIFT.C - shift command. * * Only valid inside batch files. * * FREEDOS extension : optional parameter DOWN to allow shifting * parameters backwards. * * 16 Jul 1998 (Hans B Pufal) * started. * * 16 Jul 1998 (John P Price) * Seperated commands into individual files. * * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>) * - added config.h include * */ #include "../config.h" #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../include/batch.h" #include "../include/command.h" int cmd_shift(char *param) { if(bc == 0) { /*!! not in batch - error */ return 1; } assert(param); if(stricmp(param, "down") == 0) { if(bc->shiftlevel) bc->shiftlevel--; } else /* shift up */ bc->shiftlevel++; return 0; }
#pragma once #include <util/system/compat.h> class TOutputStream; size_t printf_format(2,3) Printf(TOutputStream& out, const char* fmt, ...); size_t printf_format(2,0) Printf(TOutputStream& out, const char* fmt, va_list params);
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * 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 jit_FlowAliasAnalysis_h #define jit_FlowAliasAnalysis_h #include "jit/AliasAnalysisShared.h" #include "jit/MIR.h" #include "jit/MIRGraph.h" namespace js { namespace jit { class LoopInfo; class MIRGraph; class GraphStoreInfo; typedef MDefinitionVector BlockStoreInfo; typedef Vector<BlockStoreInfo*, 50, JitAllocPolicy> GraphStoreVector; class FlowAliasAnalysis : public AliasAnalysisShared { // Info on the graph. LoopInfo* loop_; GraphStoreInfo* stores_; // Helper vectors. In order to not have to recreate them the whole time. MDefinitionVector output_; MDefinitionVector worklist_; public: FlowAliasAnalysis(MIRGenerator* mir, MIRGraph& graph); MOZ_MUST_USE bool analyze() override; protected: /* Process instructions. */ MOZ_MUST_USE bool processStore(BlockStoreInfo& stores, MDefinition* store); MOZ_MUST_USE bool processLoad(BlockStoreInfo& stores, MDefinition* load); MOZ_MUST_USE bool processDeferredLoads(LoopInfo* info); /* Improve dependency and helpers. */ MOZ_MUST_USE bool improveDependency(MDefinition* load, MDefinitionVector& inputStores, MDefinitionVector& outputStores); MOZ_MUST_USE bool improveNonAliasedStores(MDefinition* load, MDefinitionVector& inputStores, MDefinitionVector& outputStores, bool* improved, bool onlyControlInstructions = false); MOZ_MUST_USE bool improveStoresInFinishedLoops(MDefinition* load, MDefinitionVector& stores, bool* improved); MOZ_MUST_USE bool improveLoopDependency(MDefinition* load, MDefinitionVector& inputStores, MDefinitionVector& outputStores); MOZ_MUST_USE bool deferImproveDependency(MDefinitionVector& stores); /* Save dependency info. */ void saveLoadDependency(MDefinition* load, MDefinitionVector& dependencies); MOZ_MUST_USE bool saveStoreDependency(MDefinition* store, BlockStoreInfo& prevStores); /* Helper functions. */ MOZ_MUST_USE bool computeBlockStores(MBasicBlock* block); MOZ_MUST_USE bool isLoopInvariant(MDefinition* load, MDefinition* store, bool* loopinvariant); bool loopIsFinished(MBasicBlock* loopheader); }; } // namespace jit } // namespace js #endif /* jit_FlowAliasAnalysis_h */
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas at Austin Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas at Austin 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. */ void bli_mem_init( void ); void bli_mem_finalize( void ); bool_t bli_mem_is_initialized( void ); void bli_mem_acquire_m( siz_t req_size, packbuf_t buf_type, mem_t* mem ); void bli_mem_acquire_v( siz_t req_size, mem_t* mem ); void bli_mem_release( mem_t* mem ); void bli_mem_init_pool( char* pool_mem, siz_t block_size, dim_t n_blocks, void** block_ptrs, pool_t* pool_struct );
/**************************************************************************** * * MODULE: d.font * AUTHOR(S): James Westervelt (CERL) (original contributor) * Markus Neteler <neteler itc.it>, * Bernhard Reiter <bernhard intevation.de>, * Huidae Cho <grass4u gmail.com>, * Eric G. Miller <egm2 jps.net>, * Glynn Clements <glynn gclements.plus.com>, * Jan-Oliver Wagner <jan intevation.de> * PURPOSE: user selection of font for graphics monitor text * COPYRIGHT: (C) 1999-2007 by the GRASS Development Team * * This program is free software under the GNU General Public * License (>=v2). Read the file COPYING that comes with GRASS * for details. * *****************************************************************************/ #include <grass/config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <errno.h> #include <grass/gis.h> #include <grass/display.h> #include <grass/glocale.h> static char **fonts; static int max_fonts; static int num_fonts; static void read_freetype_fonts(int verbose); static void print_font_list(FILE * fp, int verbose); int main(int argc, char **argv) { struct GModule *module; struct Option *opt1, *opt2, *opt3; struct Flag *flag1, *flag2; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("display")); G_add_keyword(_("setup")); module->description = _("Selects the font in which text will be displayed " "on the user's graphics monitor."); opt1 = G_define_option(); opt1->key = "font"; opt1->type = TYPE_STRING; opt1->required = NO; opt1->answer = "romans"; opt1->description = _("Choose new current font"); opt2 = G_define_option(); opt2->key = "path"; opt2->type = TYPE_STRING; opt2->required = NO; opt2->description = _("Path to Freetype-compatible font including file name"); opt2->gisprompt = "old_file,file,font"; opt3 = G_define_option(); opt3->key = "charset"; opt3->type = TYPE_STRING; opt3->required = NO; opt3->answer = "UTF-8"; opt3->description = _("Character encoding"); flag1 = G_define_flag(); flag1->key = 'l'; flag1->description = _("List fonts"); flag2 = G_define_flag(); flag2->key = 'L'; flag2->description = _("List fonts verbosely"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); /* load the font */ if (D_open_driver() != 0) G_fatal_error(_("No graphics device selected. " "Use d.mon to select graphics device.")); if (flag1->answer) { /* List font names */ print_font_list(stdout, 0); D_close_driver(); exit(EXIT_SUCCESS); } if (flag2->answer) { /* List fonts verbosely */ print_font_list(stdout, 1); D_close_driver(); exit(EXIT_SUCCESS); } if (opt2->answer) { /* Full path to freetype font */ STRUCT_STAT info; /* Check a valid filename has been supplied */ if (stat(opt2->answer, &info) != 0) G_fatal_error(_("Unable to access font path %s: %s"), opt2->answer, strerror(errno)); if (!S_ISREG(info.st_mode)) G_fatal_error(_("Font path %s is not a file"), opt2->answer); else D_font(opt2->answer); } else if (opt1->answer) { /* Font name from fontcap */ int i = 0; /* Check the fontname given is valid */ read_freetype_fonts(0); while (i < num_fonts) { if (strcmp(opt1->answer, fonts[i]) == 0) { D_font(opt1->answer); break; } i++; } if (i >= num_fonts) G_fatal_error(_("Font name <%s> is invalid. Check font name or consider running 'g.mkfontcap'"), opt1->answer); } if (opt3->answer) /* Set character encoding */ D_encoding(opt3->answer); /* add this command to the list */ D_close_driver(); exit(EXIT_SUCCESS); } static void read_freetype_fonts(int verbose) { char **list; int count; int i; if (verbose) D_font_info(&list, &count); else D_font_list(&list, &count); if (max_fonts < num_fonts + count) { max_fonts = num_fonts + count; fonts = G_realloc(fonts, max_fonts * sizeof(char *)); } for (i = 0; i < count; i++) fonts[num_fonts++] = list[i]; } static void print_font_list(FILE * fp, int verbose) { int i; /* find out what fonts we have */ read_freetype_fonts(verbose); for (i = 0; i < num_fonts; i++) fprintf(fp, "%s\n", fonts[i]); }
#pragma once #define DEBUG_TRACK_ENTITY_NAME (!IS_PRODUCTION_BUILD)
/** * \file listtab.c * * \brief Low level SQLite table functions. * * This program is free software under the GNU General Public License * (>=v2). Read the file COPYING that comes with GRASS for details. * * \author Radim Blazek * \author Support for multiple connections by Markus Metz * * \date 2005-2011 */ #include <stdlib.h> #include <string.h> #include <grass/dbmi.h> #include "globals.h" #include "proto.h" /** * \fn int db__driver_list_tables (dbString **tlist, int *tcount, int system) * * \brief List SQLite database tables. * * \param[in] tlist list of tables * \param[in] tcount number of tables * \param[in] system * \return int DB_FAILED on error; DB_OK on success */ int db__driver_list_tables(dbString ** tlist, int *tcount, int system) { int i, nrows; dbString *list; sqlite3_stmt *statement; const char *rest; int ret; init_error(); ret = sqlite3_prepare(sqlite, "select name from sqlite_master where type = 'table' or type = 'view'", -1, &statement, &rest); if (ret != SQLITE_OK) { append_error("Cannot list tables\n"); append_error((char *)sqlite3_errmsg(sqlite)); report_error(); sqlite3_finalize(statement); return DB_FAILED; } nrows = 0; while (sqlite3_step(statement) == SQLITE_ROW) { nrows++; } /* get real result code */ ret = sqlite3_reset(statement); if (ret != SQLITE_OK) { append_error("Cannot list tables\n"); append_error((char *)sqlite3_errmsg(sqlite)); report_error(); sqlite3_finalize(statement); return DB_FAILED; } G_debug(3, "nrows = %d", nrows); list = db_alloc_string_array(nrows); if (list == NULL) { append_error("Cannot db_alloc_string_array()"); report_error(); sqlite3_finalize(statement); return DB_FAILED; } i = 0; while (sqlite3_step(statement) == SQLITE_ROW) { G_debug(3, "table: %s", sqlite3_column_text(statement, 0)); db_set_string(&list[i], (char *)sqlite3_column_text(statement, 0)); i++; } sqlite3_finalize(statement); *tlist = list; *tcount = nrows; return DB_OK; }
/***************************************************************************** @(#) File: src/drivers/sdtmux.c ----------------------------------------------------------------------------- Copyright (c) 2008-2015 Monavacon Limited <http://www.monavacon.com/> Copyright (c) 2001-2008 OpenSS7 Corporation <http://www.openss7.com/> Copyright (c) 1997-2001 Brian F. G. Bidulock <bidulock@openss7.org> All Rights Reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>, or write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------------- U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software on behalf of the U.S. Government ("Government"), the following provisions apply to you. If the Software is supplied by the Department of Defense ("DoD"), it is classified as "Commercial Computer Software" under paragraph 252.227-7014 of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any successor regulations) and the Government is acquiring only the license rights granted herein (the license rights customarily provided to non-Government users). If the Software is supplied to any unit or agency of the Government other than DoD, it is classified as "Restricted Computer Software" and the Government's rights in the Software are defined in paragraph 52.227-19 of the Federal Acquisition Regulations ("FAR") (or any successor regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR (or any successor regulations). ----------------------------------------------------------------------------- Commercial licensing and support of this software is available from OpenSS7 Corporation at a fee. See http://www.openss7.com/ *****************************************************************************/ static char const ident[] = "src/drivers/sdtmux.c (" PACKAGE_ENVR ") " PACKAGE_DATE; /* * This is an SDT multiplexing driver for multiplexing SDT upper streams into * SDT lower streams for provisioning and automatic allocation of Signalling * Data Terminals. It translates between Type I SDT streams or attached Type * II SDT streams on the lower boundary to Type II SDT streams on the upper * boundary. Another purpose for the SDT mux is the ability to perform SDT * monitoring, testing, management, statistics collection and event * collection. */ #include <sys/os7/compat.h> #include <ss7/lmi.h> #include <ss7/lmi_ioctl.h> #include <ss7/sdli.h> #include <ss7/sdli_ioctl.h> #include <ss7/sdti.h> #include <ss7/sdti_ioctl.h> #define SDTM_DESCRIP "Signalling Data Terminal (SDT) STREAMS Multiplexing Driver" #define SDTM_EXTRA "Part of the OpenSS7 SS7 Stack for Linux Fast-STREAMS" #define SDTM_REVISION "OpenSS7 src/drivers/sdtmux.c (" PACKAGE_ENVR ") " PACKAGE_DATE #define SDTM_COPYRIGHT "Copyright (c) 2008-2015 Monavacon Limited. All Rights Reserved." #define SDTM_DEVICE "Part of the OpenSS7 Stack for STREAMS." #define SDTM_CONTACT "Brian Bidulock <bidulock@openss7.org>" #define SDTM_LICENSE "GPL" #define SDTM_BANNER SDTM_DESCRIP "\n" \ SDTM_EXTRA "\n" \ SDTM_REVISION "\n" \ SDTM_COPYRIGHT "\n" \ SDTM_DEVICE "\n" \ SDTM_CONTACT #define SDTM_SPLASH SDTM_DEVICE " - " \ SDTM_REVISION "\n" \ #ifdef LINUX MODULE_AUTHOR(SDTM_CONTACT); MODULE_DESCRIPTION(SDTM_DESCRIP); MODULE_SUPPORTED_DEVICE(SDTM_DEVICE); #ifdef MODULE_LICENSE MODULE_LICENSE(SDTM_LICENSE); #endif #if defined MODULE_ALIAS MODULE_ALIAS("streams-sdtmux"); #endif #ifdef MODULE_VERSION MODULE_VERSION(PACKAGE_ENVR); #endif #endif /* LINUX */
/**************************************************************** * * * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ /* * omi_dump_pkt.c --- * * * */ #include "mdef.h" #include <errno.h> #include "gtm_stdio.h" #include "gtm_unistd.h" #include "gtm_string.h" #include "gtmio.h" #include "have_crit.h" #include "omi.h" GBLREF char *omi_pklog; GBLREF int omi_pkdbg; GBLREF char *omi_oprlist[]; #ifndef lint static char rcsid[] = "$Header: /cvsroot/fis-gtm/gtm/sr_unix_cm/omi_dmp_pkt.c,v 1.8 2013/10/23 03:49:32 tuskentower Exp $"; #endif void omi_dump_pkt(omi_conn *cptr) { char *ptr, *end, *chr; omi_vi vi, mlen, xlen; omi_li li, nx; omi_si si; int i, j, len, buf[5]; if (!omi_pklog || INV_FD_P(cptr->pklog)) return; if (write(cptr->pklog, cptr->bptr, cptr->blen) < 0) OMI_DBG((omi_debug, "gtcm_server: write(): %s\n", STRERROR(errno))); if (!omi_pkdbg) return; OMI_DBG((omi_debug, "gtcm_server: connection %d:", cptr->stats.id)); ptr = cptr->bptr; OMI_VI_READ(&mlen, ptr); OMI_DBG((omi_debug, " %d bytes", mlen.value)); if (cptr->exts & OMI_XTF_BUNCH) { OMI_LI_READ(&nx, ptr); OMI_DBG((omi_debug, " %d transactions in bunch", nx.value)); } else { nx.value = 1; xlen = mlen; } OMI_DBG((omi_debug, "\n")); for (i = 0; i < nx.value; i++) { if (cptr->exts & OMI_XTF_BUNCH) OMI_VI_READ(&xlen, ptr); end = ptr + xlen.value; ptr += 3; OMI_SI_READ(&si, ptr); ptr += 8; OMI_DBG((omi_debug, " ")); if (cptr->exts & OMI_XTF_BUNCH) OMI_DBG((omi_debug, "bunch %d, ", i)); OMI_DBG((omi_debug, "%s (%d bytes)\n", (omi_oprlist[si.value]) ? omi_oprlist[si.value] : "unknown", xlen.value)); chr = (char *)buf; while (ptr < end) { OMI_DBG((omi_debug, "\t")); if ((len = (int)(end - ptr)) > 20) len = 20; memcpy(chr, ptr, len); ptr += len; for (j = len; j < 20; j++) chr[j] = '\0'; for (j = 0; j < 5; j++) OMI_DBG((omi_debug, "%08x ", buf[j])); for (j = 0; j < 20; j++) if (j >= len) chr[j] = ' '; else if (chr[j] < 32 || chr[j] > 126) chr[j] = '.'; OMI_DBG((omi_debug, "%20s\n", chr)); } } return; }
/* Copyright (C) 2020 Daniel Schultz 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 "fmpz_mpoly_factor.h" void fmpz_mpoly_factor_print_pretty(const fmpz_mpoly_factor_t f, const char ** vars, const fmpz_mpoly_ctx_t ctx) { slong i; fmpz_print(f->constant); for (i = 0; i < f->num; i++) { flint_printf("*(", i); fmpz_mpoly_print_pretty(f->poly + i, vars, ctx); flint_printf(")^"); fmpz_print(f->exp + i); } }
/* base class for correlation * * 7/11/13 * - from convolution.c */ /* This file is part of VIPS. VIPS is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk */ #ifdef HAVE_CONFIG_H #include <config.h> #endif /*HAVE_CONFIG_H*/ #include <vips/intl.h> #include <stdio.h> #include <math.h> #include <vips/vips.h> #include <vips/internal.h> #include "pconvolution.h" #include "correlation.h" G_DEFINE_ABSTRACT_TYPE( VipsCorrelation, vips_correlation, VIPS_TYPE_OPERATION ); static int vips_correlation_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsRegion *ir = (VipsRegion *) seq; VipsCorrelation *correlation = (VipsCorrelation *) b; VipsCorrelationClass *cclass = VIPS_CORRELATION_GET_CLASS( correlation ); VipsRect *r = &or->valid; VipsRect irect; /* What part of ir do we need? */ irect.left = r->left; irect.top = r->top; irect.width = r->width + correlation->ref_ready->Xsize - 1; irect.height = r->height + correlation->ref_ready->Ysize - 1; if( vips_region_prepare( ir, &irect ) ) return( -1 ); cclass->correlation( correlation, ir, or ); return( 0 ); } static int vips_correlation_build( VipsObject *object ) { VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsCorrelationClass *cclass = VIPS_CORRELATION_CLASS( class ); VipsCorrelation *correlation = (VipsCorrelation *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 6 ); if( VIPS_OBJECT_CLASS( vips_correlation_parent_class )-> build( object ) ) return( -1 ); /* Stretch input out. */ if( vips_embed( correlation->in, &t[0], correlation->ref->Xsize / 2, correlation->ref->Ysize / 2, correlation->in->Xsize + correlation->ref->Xsize - 1, correlation->in->Ysize + correlation->ref->Ysize - 1, "extend", VIPS_EXTEND_COPY, NULL ) ) return( -1 ); if( vips__formatalike( t[0], correlation->ref, &t[1], &t[2] ) || vips__bandalike( class->nickname, t[1], t[2], &t[3], &t[4] ) || !(t[5] = vips_image_copy_memory( t[4] )) ) return( -1 ); correlation->in_ready = t[3]; correlation->ref_ready = t[5]; g_object_set( object, "out", vips_image_new(), NULL ); /* FATSTRIP is good for us as THINSTRIP will cause * too many recalculations on overlaps. */ if( vips_image_pipelinev( correlation->out, VIPS_DEMAND_STYLE_FATSTRIP, correlation->in_ready, correlation->ref_ready, NULL ) ) return( -1 ); correlation->out->Xsize = correlation->in->Xsize; correlation->out->Ysize = correlation->in->Ysize; correlation->out->BandFmt = cclass->format_table[correlation->in_ready->BandFmt]; if( cclass->pre_generate && cclass->pre_generate( correlation ) ) return( -1 ); if( vips_image_generate( correlation->out, vips_start_one, vips_correlation_gen, vips_stop_one, correlation->in_ready, correlation ) ) return( -1 ); return( 0 ); } static void vips_correlation_class_init( VipsCorrelationClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; VipsOperationClass *operation_class = VIPS_OPERATION_CLASS( class ); gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "correlation"; object_class->description = _( "correlation operation" ); object_class->build = vips_correlation_build; operation_class->flags = VIPS_OPERATION_SEQUENTIAL; VIPS_ARG_IMAGE( class, "in", 0, _( "Input" ), _( "Input image argument" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsCorrelation, in ) ); VIPS_ARG_IMAGE( class, "ref", 10, _( "Mask" ), _( "Input reference image" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsCorrelation, ref ) ); VIPS_ARG_IMAGE( class, "out", 20, _( "Output" ), _( "Output image" ), VIPS_ARGUMENT_REQUIRED_OUTPUT, G_STRUCT_OFFSET( VipsCorrelation, out ) ); } static void vips_correlation_init( VipsCorrelation *correlation ) { }
/** * SFCGAL * * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com> * Copyright (C) 2012-2013 IGN (http://www.ign.fr) * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef _IGN_EXCEPTION_H_ #define _IGN_EXCEPTION_H_ #include <SFCGAL/config.h> #include <string> #include <boost/exception/all.hpp> #include <boost/format.hpp> namespace SFCGAL { /** * Base SFCGAL Exception * * \code * BOOST_THROW_EXCEPTION( Exception("invalid geometry") ); * \endcode */ class SFCGAL_API Exception : public virtual boost::exception, public virtual std::exception { public: Exception() throw(); Exception( std::string const& message ) throw(); virtual ~Exception() throw(); /** * returns the exception message */ virtual const char* what() const throw(); /** * returns diagnostic information (file, line, etc.) */ std::string diagnostic() const throw(); protected: std::string _message; }; /** * SFCGAL Exception thrown when invalid geometries are found before entering an algo */ class SFCGAL_API GeometryInvalidityException : public Exception { public: GeometryInvalidityException( std::string const& message ): Exception( message ) { } }; /** * SFCGAL Exception thrown when a function is not implemented */ class SFCGAL_API NotImplementedException : public Exception { public: NotImplementedException( std::string const& message ): Exception( message ) { } }; /** * SFCGAL Exception thrown when geometry is inapropriate for a function */ class SFCGAL_API InappropriateGeometryException : public Exception { public: InappropriateGeometryException( std::string const& message ): Exception( message ) { } }; /** * SFCGAL Exception thrown when non finite value is found */ class SFCGAL_API NonFiniteValueException : public Exception { public: NonFiniteValueException( std::string const& message ): Exception( message ) { } }; /** * SFCGAL Exception thrown when parsing WKT */ class SFCGAL_API WktParseException : public Exception { public: WktParseException( std::string const& message ): Exception( message ) { } }; } // namespace SFCGAL #endif
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef WINDOW_H #define WINDOW_H #include <QWidget> QT_BEGIN_NAMESPACE class QGroupBox; QT_END_NAMESPACE //! [0] class Window : public QWidget { Q_OBJECT public: Window(QWidget *parent = 0); private: QGroupBox *createFirstExclusiveGroup(); QGroupBox *createSecondExclusiveGroup(); QGroupBox *createNonExclusiveGroup(); QGroupBox *createPushButtonGroup(); }; //! [0] #endif
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QLAYOUTWIDGET_PROPERTYSHEET_H #define QLAYOUTWIDGET_PROPERTYSHEET_H #include <qdesigner_propertysheet_p.h> #include <extensionfactory_p.h> #include <qlayout_widget_p.h> QT_BEGIN_NAMESPACE namespace qdesigner_internal { class QLayoutWidgetPropertySheet: public QDesignerPropertySheet { Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: explicit QLayoutWidgetPropertySheet(QLayoutWidget *object, QObject *parent = 0); virtual ~QLayoutWidgetPropertySheet(); virtual void setProperty(int index, const QVariant &value); virtual bool isVisible(int index) const; virtual bool dynamicPropertiesAllowed() const; }; typedef QDesignerPropertySheetFactory<QLayoutWidget, QLayoutWidgetPropertySheet> QLayoutWidgetPropertySheetFactory; } // namespace qdesigner_internal QT_END_NAMESPACE #endif // QLAYOUTWIDGET_PROPERTYSHEET_H
/* * Copyright 2014, 2015 AASHTO/ITE/NEMA. * American Association of State Highway and Transportation Officials, * Institute of Transportation Engineers and * National Electrical Manufacturers Association. * * This file is part of the Advanced Transportation Controller (ATC) * Application Programming Interface Reference Implementation (APIRI). * * The APIRI is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. * * The APIRI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the APIRI. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _FPUI_H_ #define _FPUI_H_ #include <unistd.h> #include <stdbool.h> #define CHAR_DC1 0x11 #define CHAR_DC2 0x12 #define CHAR_DC3 0x13 #define CHAR_DC4 0x14 #if !(__bool_true_false_are_defined) typedef enum { false=(0!=0), true=(0==0) } bool; #endif typedef union { int errcode; struct { unsigned int auto_wrap:1, auto_scroll:1, auto_repeat:1, backlight:1, cursor_on:1, cursor_blink:1, char_blink:1, aux_switch:1, backlight_timeout:8, char_reverse:1, char_underline:1, :14; }; } fpui_attr_t; /* General Operators */ typedef int fpui_handle; typedef int fpui_aux_handle; char *fpui_apiver( fpui_handle fd, int type ); fpui_handle fpui_open( int flags, const char * regname ); int fpui_open_config_window( int flags ); int fpui_close( fpui_handle fd ); int fpui_close_config_window( fpui_handle fd ); int fpui_panel_present( fpui_handle fd ); int fpui_get_window_size( fpui_handle fd, int * rows, int * columns ); int fpui_get_focus( fpui_handle fd ); int fpui_clear( fpui_handle fd ); int fpui_refresh( fpui_handle fd ); int fpui_set_emergency( fpui_handle fd, bool state ) ; /* Attribute Operators */ int fpui_set_window_attr( fpui_handle fd, int attr ); int fpui_get_window_attr( fpui_handle fd ); /*int fpui_get_attributes( fpui_handle fd, int index );*/ int fpui_set_character_blink( fpui_handle fd, bool state ); int fpui_get_character_blink( fpui_handle fd ); int fpui_set_backlight( fpui_handle fd, bool state ); int fpui_get_backlight( fpui_handle fd ); int fpui_set_backlight_timeout( fpui_handle fd, int timeout ); int fpui_set_cursor_blink( fpui_handle fd, bool state ); int fpui_get_cursor_blink( fpui_handle fd ); int fpui_set_reverse_video( fpui_handle fd, bool state ); int fpui_get_reverse_video( fpui_handle fd ); int fpui_set_underline( fpui_handle fd, bool state ); int fpui_get_underline( fpui_handle fd ); int fpui_set_auto_wrap( fpui_handle fd, bool state ); int fpui_get_auto_wrap( fpui_handle fd ); int fpui_set_auto_repeat( fpui_handle fd, bool state ); int fpui_get_auto_repeat( fpui_handle fd ); int fpui_set_cursor( fpui_handle fd, bool state ); int fpui_get_cursor( fpui_handle fd ); int fpui_set_auto_scroll( fpui_handle fd, bool state ); int fpui_get_auto_scroll( fpui_handle fd ); int fpui_reset_all_attributes( fpui_handle fd ); /* Read Operators */ int fpui_poll( fpui_handle fd, int flags ); ssize_t fpui_read( fpui_handle fd, char *buffer, int bufsize ); char fpui_read_char( fpui_handle fd ); ssize_t fpui_read_string( fpui_handle fd, char *string, int stringsize ); /* Write Operators */ ssize_t fpui_write( fpui_handle fd, char *buffer, int buflen ); ssize_t fpui_write_char( fpui_handle fd, char ch ); ssize_t fpui_write_string( fpui_handle fd, char *string ); ssize_t fpui_write_at( fpui_handle fd, char *buffer, int buflen, int row, int column ); ssize_t fpui_write_char_at( fpui_handle fd, char ch, int row, int column ); ssize_t fpui_write_string_at( fpui_handle fd, char *string, int row, int column ); /* Cursor Operators */ int fpui_get_cursor_pos( fpui_handle fd, int *row, int *column ); int fpui_set_cursor_pos( fpui_handle fd, int row, int column ); int fpui_home( fpui_handle fd ); int fpui_set_tab( fpui_handle fd ); int fpui_clear_tab( fpui_handle fd, int type ); /* Special Character Operators */ int fpui_compose_special_char( fpui_handle fd, int index, unsigned char *buffer ); int fpui_display_special_char( fpui_handle fd, int index ); /* LED Operators */ int fpui_set_led( fpui_handle fd, int state ); int fpui_get_led( fpui_handle fd ); /* AUX Switch Operators */ fpui_aux_handle fpui_open_aux_switch( void ); int fpui_close_aux_switch( fpui_aux_handle fd ); int fpui_read_aux_switch( fpui_aux_handle fd ); /* Key Mapping Operators */ typedef struct keymap_s { char cmd; char key; char seq[7]; } keymap_t; int fpui_set_keymap( fpui_handle fd, char key, char *seq ); int fpui_get_keymap( fpui_handle fd, char key, char *seq, int size ); int fpui_del_keymap( fpui_handle fd, char key ); int fpui_reset_keymap( fpui_handle fd, int type ); #endif
/*************************************************************************** ** ** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (directui@nokia.com) ** ** This file is part of libmeegotouch. ** ** If you have questions regarding the use of this file, please contact ** Nokia at directui@nokia.com. ** ** This library is free software; you can redistribute it and/or ** modify it 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. ** ****************************************************************************/ #include "../corelib/widgets/mlistfilter.h"
#ifndef MYGLWIDGET_H #define MYGLWIDGET_H #include <QGLWidget> #include <QKeyEvent> #include <GL/glu.h> #include <GL/glaux.h> #include <QMessageBox> #include <QApplication> #define MAX_PARTICLES 1000 // 定义最大的粒子数 class MyGLWidget : public QGLWidget { Q_OBJECT public: //好!现在是有趣的东西.下段程序描述单一粒子结构,这是我们给予粒子的属性. //我们用布尔型变量active开始,如果为true,我们的粒子为活跃的.如果为false则粒子为死的,此时我们就删除它. //在程序中我没有使用活跃的,因为它很好的实现.变量life和fade来控制粒子显示多久以及显示时候的亮度. //随着life数值的降低fade的数值也相应降低.这将导致一些粒子比其他粒子燃烧的时间长. typedef struct // 创建粒子数据结构 { bool active; // 是否激活 float life; // 粒子生命 float fade; // 衰减速度 //变量r,g和b用来表示粒子的红色强度,绿色强度和蓝色强度.当r的值变成1.0f时粒子将会很红,当三个变量全为1.0f时则粒子将变成白色. float r; // 红色值 float g; // 绿色值 float b; // 蓝色值 //变量x.y和z控制粒子在屏幕上显示的位置.x表示粒子在x轴上的位置.y表示y轴上的位置.z表示粒子z轴上的位置 float x; // X 位置 float y; // Y 位置 float z; // Z 位置 //下面三个变量很重要.这三个变量控制粒子在每个轴上移动的快慢和方向.如果xi是负价粒子将会向左移动,正值将会向右移动. //如果yi是负值粒子将会向下移动,正值将向上.最后,如果zi负值粒子将会向荧屏内部移动,正植将移向观察者. float xi; // X 方向 float yi; // Y 方向 float zi; // Z 方向 //最后,另外3个变量!每一个变量可被看成加速度.如果xg正值时,粒子将会被拉倒右边,负值将拉向左边. //所以如果粒子向左移动(负的)而我们给它一个正的加速度,粒子速度将变慢.最后将向反方向移动(高中物理). //yg拉下或拉上.zg拉进或拉出屏幕. float xg; // X 方向重力加速度 float yg; // Y 方向重力加速度 float zg; // Z 方向重力加速度 //结构的名字为particles. }particles; explicit MyGLWidget(QWidget *parent = 0); ~MyGLWidget(); protected: void resizeGL(int w, int h); void initializeGL(); void paintGL(); void keyPressEvent(QKeyEvent *event); void timerEvent(QTimerEvent *event); private: void loadGLTexture(); private: bool m_show_full_screen; GLuint m_texture[1]; bool m_rainbow; // 是否为彩虹模式 //下面四行是复杂的变量.变量slowdown控制粒子移动的快慢.数值愈高,移动越慢.数值越底,移动越快. //如果数值降低,粒子将快速的移动!粒子的速度影响它们在荧屏中移动的距离.记住速度慢的粒子不会射很远的. //变量xspeed和yspeed控制尾部的方向.xspeed将会增加粒子在x轴上速度.如果xspeed是正值粒子将会向右边移动多. //如果xspeed负价值,粒子将会向左边移动多.那个值越高,就向那个方向移动比较多.yspeed工作相同的方法,但是在y轴上. //因为有其它的因素影响粒子的运动,所以我要说"多".xspeed和yspeed有助于在我们想要的方向上移动粒子.最后是变量zoom, //我们用该变量移入或移出我们的屏幕.在粒子引擎里,有时可看见更多的图象,而且当接近你时很酷 float m_slowdown; // 减速粒子 float m_xspeed; // X方向的速度 float m_yspeed; // Y方向的速度 float m_zoom; // 沿Z轴缩放 //下面我们创建一个数组叫particle.数组存储MAX_PARTICLES个元素.也就是说我们创建1000(MAX_PARTICLES)个粒子, //存储空间为每个粒子提供相应的信息 particles particle[MAX_PARTICLES]; // 保存1000个粒子的数组 GLuint m_col; // 当前的颜色 GLuint m_delay; // 彩虹效果延迟 }; #endif // MYGLWIDGET_H
/* librepo - A library providing (libcURL like) API to downloading repository * Copyright (C) 2012 Tomas Mlcoch * * Licensed under the GNU Lesser General Public License Version 2.1 * * 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 */ #include <Python.h> #undef NDEBUG #include <assert.h> #include "librepo/librepo.h" #include "packagedownloader-py.h" #include "handle-py.h" #include "packagetarget-py.h" #include "exception-py.h" #include "globalstate-py.h" // GIL Hack void BeginAllowThreads(PyThreadState **state) { assert(state); assert(*state == NULL); (*state) = PyEval_SaveThread(); } void EndAllowThreads(PyThreadState **state) { assert(state); assert(*state); PyEval_RestoreThread(*state); (*state) = NULL; } PyObject * py_download_url(G_GNUC_UNUSED PyObject *self, PyObject *args) { gboolean ret; PyObject *py_handle; LrHandle *handle = NULL; char *url; int fd; GError *tmp_err = NULL; PyThreadState *state = NULL; if (!PyArg_ParseTuple(args, "Osi:download_url", &py_handle, &url, &fd)) return NULL; if (HandleObject_Check(py_handle)) { handle = Handle_FromPyObject(py_handle); Handle_SetThreadState(py_handle, &state); } else if (py_handle != Py_None) { PyErr_SetString(PyExc_TypeError, "Only Handle or None is supported"); return NULL; } // XXX: GIL Hack int hack_rc = gil_logger_hack_begin(&state); if (hack_rc == GIL_HACK_ERROR) return NULL; BeginAllowThreads(&state); ret = lr_download_url(handle, url, fd, &tmp_err); EndAllowThreads(&state); // XXX: GIL Hack if (!gil_logger_hack_end(hack_rc)) return NULL; assert((ret && !tmp_err) || (!ret && tmp_err)); if (ret) Py_RETURN_NONE; // All fine - Return None // Error occurred if (PyErr_Occurred()) { // Python exception occurred (in a python callback probably) return NULL; } else if(tmp_err->code == LRE_INTERRUPTED) { // Interrupted by Ctr+C g_error_free(tmp_err); PyErr_SetInterrupt(); PyErr_CheckSignals(); return NULL; } else { // Return exception created from GError RETURN_ERROR(&tmp_err, -1, NULL); } }
/****************************************************** Copyright (c) 2013 Percona LLC and/or its affiliates. Local datasink implementation for XtraBackup. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *******************************************************/ #include <my_global.h> #include <my_base.h> #include <mysys_err.h> #include "common.h" #include "datasink.h" typedef struct { File fd; } ds_stdout_file_t; static ds_ctxt_t *stdout_init(const char *root); static ds_file_t *stdout_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat); static int stdout_write(ds_file_t *file, const void *buf, size_t len); static int stdout_close(ds_file_t *file); static void stdout_deinit(ds_ctxt_t *ctxt); datasink_t datasink_stdout = { &stdout_init, &stdout_open, &stdout_write, &stdout_close, &stdout_deinit }; static ds_ctxt_t * stdout_init(const char *root) { ds_ctxt_t *ctxt; ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE)); ctxt->root = my_strdup(root, MYF(MY_FAE)); return ctxt; } static ds_file_t * stdout_open(ds_ctxt_t *ctxt __attribute__((unused)), const char *path __attribute__((unused)), MY_STAT *mystat __attribute__((unused))) { ds_stdout_file_t *stdout_file; ds_file_t *file; size_t pathlen; const char *fullpath = "<STDOUT>"; pathlen = strlen(fullpath) + 1; file = (ds_file_t *) my_malloc(sizeof(ds_file_t) + sizeof(ds_stdout_file_t) + pathlen, MYF(MY_FAE)); stdout_file = (ds_stdout_file_t *) (file + 1); #ifdef __WIN__ setmode(fileno(stdout), _O_BINARY); #endif stdout_file->fd = my_fileno(stdout); file->path = (char *) stdout_file + sizeof(ds_stdout_file_t); memcpy(file->path, fullpath, pathlen); file->ptr = stdout_file; return file; } static int stdout_write(ds_file_t *file, const void *buf, size_t len) { File fd = ((ds_stdout_file_t *) file->ptr)->fd; if (!my_write(fd, buf, len, MYF(MY_WME | MY_NABP))) { posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); return 0; } return 1; } static int stdout_close(ds_file_t *file) { my_free(file); return 1; } static void stdout_deinit(ds_ctxt_t *ctxt) { my_free(ctxt->root); my_free(ctxt); }
/************************************************************************** ** ** 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 RESOURCEEDITORPLUGIN_H #define RESOURCEEDITORPLUGIN_H #include <extensionsystem/iplugin.h> QT_BEGIN_NAMESPACE class QAction; QT_END_NAMESPACE namespace ResourceEditor { namespace Internal { class ResourceEditorW; class ResourceWizard; class ResourceEditorFactory; class ResourceEditorPlugin : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ResourceEditor.json") public: ResourceEditorPlugin(); virtual ~ResourceEditorPlugin(); // IPlugin bool initialize(const QStringList &arguments, QString *errorMessage = 0); void extensionsInitialized(); private slots: void onUndo(); void onRedo(); public: void onUndoStackChanged(ResourceEditorW const *editor, bool canUndo, bool canRedo); private: ResourceEditorW * currentEditor() const; private: ResourceWizard *m_wizard; ResourceEditorFactory *m_editor; QAction *m_redoAction; QAction *m_undoAction; }; } // namespace Internal } // namespace ResourceEditor #endif // RESOURCEEDITORPLUGIN_H
/** * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de> * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * * @ingroup sys_fmt * @{ * @file * @brief String formatting library implementation * @author Kaspar Schleiser <kaspar@schleiser.de> * @} */ #include <assert.h> #include <stdarg.h> #include <stdint.h> #include <unistd.h> #ifdef __WITH_AVRLIBC__ #include <stdio.h> /* for fwrite() */ #else /* work around broken sys/posix/unistd.h */ ssize_t write(int fildes, const void *buf, size_t nbyte); #endif #include "fmt.h" static const char _hex_chars[16] = "0123456789ABCDEF"; static inline int _is_digit(char c) { return (c >= '0' && c <= '9'); } size_t fmt_byte_hex(char *out, uint8_t byte) { if (out) { *out++ = _hex_chars[byte >> 4]; *out = _hex_chars[byte & 0x0F]; } return 2; } size_t fmt_strlen(const char *str) { const char *tmp = str; while(*tmp) { tmp++; } return (tmp - str); } size_t fmt_str(char *out, const char *str) { int len = 0; if (!out) { len = fmt_strlen(str); } else { char c; while ((c = *str++)) { *out++ = c; len++; } } return len; } size_t fmt_bytes_hex_reverse(char *out, const uint8_t *ptr, size_t n) { size_t i = n; while (i--) { out += fmt_byte_hex(out, ptr[i]); } return (n<<1); } size_t fmt_u32_hex(char *out, uint32_t val) { return fmt_bytes_hex_reverse(out, (uint8_t*) &val, 4); } size_t fmt_u64_hex(char *out, uint64_t val) { return fmt_bytes_hex_reverse(out, (uint8_t*) &val, 8); } size_t fmt_u32_dec(char *out, uint32_t val) { size_t len = 1; /* count needed characters */ for (uint32_t tmp = val; (tmp > 9); len++) { tmp /= 10; } if (out) { char *ptr = out + len; do { *--ptr = (val % 10) + '0'; } while ((val /= 10)); } return len; } size_t fmt_u16_dec(char *out, uint16_t val) { return fmt_u32_dec(out, val); } size_t fmt_s32_dec(char *out, int32_t val) { int negative = (val < 0); if (negative) { if (out) { *out++ = '-'; } val *= -1; } return fmt_u32_dec(out, val) + negative; } uint32_t scn_u32_dec(const char *str, size_t n) { uint32_t res = 0; while(n--) { char c = *str++; if (!_is_digit(c)) { break; } else { res *= 10; res += (c - '0'); } } return res; } void print(const char *s, size_t n) { #ifdef __WITH_AVRLIBC__ /* AVR's libc doesn't offer write(), so use fwrite() instead */ fwrite(s, n, 1, stdout); #else while (n > 0) { ssize_t written = write(STDOUT_FILENO, s, n); if (written < 0) { break; } n -= written; s += written; } #endif /* __WITH_AVRLIBC__ */ } void print_u32_dec(uint32_t val) { char buf[10]; size_t len = fmt_u32_dec(buf, val); print(buf, len); } void print_s32_dec(int32_t val) { char buf[11]; size_t len = fmt_s32_dec(buf, val); print(buf, len); } void print_u32_hex(uint32_t val) { char buf[8]; fmt_u32_hex(buf, val); print(buf, sizeof(buf)); } void print_u64_hex(uint64_t val) { print_u32_hex(val>>32); print_u32_hex(val); } void print_str(const char* str) { print(str, fmt_strlen(str)); }
/* * RELIC is an Efficient LIbrary for Cryptography * Copyright (C) 2007-2014 RELIC Authors * * This file is part of RELIC. RELIC is legal property of its developers, * whose names are not listed here. Please refer to the COPYRIGHT file * for contact information. * * RELIC 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. * * RELIC 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 RELIC. If not, see <http://www.gnu.org/licenses/>. */ /** * @file * * Implementation of the binary field squaring. * * @version $Id$ * @ingroup fb */ #include <string.h> #include "relic_core.h" #include "relic_conf.h" #include "relic_fb.h" #include "relic_fb_low.h" #include "relic_bn_low.h" #include "relic_util.h" /*============================================================================*/ /* Public definitions */ /*============================================================================*/ #if FB_SQR == BASIC || !defined(STRIP) void fb_sqr_basic(fb_t c, const fb_t a) { dv_t t; dv_null(t); TRY { /* We need a temporary variable so that c can be a or b. */ dv_new(t); fb_sqrn_low(t, a); fb_rdc(c, t); } CATCH_ANY { THROW(ERR_CAUGHT); } FINALLY { dv_free(t); } } #endif #if FB_SQR == TABLE || !defined(STRIP) void fb_sqr_table(fb_t c, const fb_t a) { dv_t t; dv_null(t); TRY { /* We need a temporary variable so that c can be a or b. */ dv_new(t); fb_sqrl_low(t, a); fb_rdc(c, t); } CATCH_ANY { THROW(ERR_CAUGHT); } FINALLY { dv_free(t); } } #endif #if FB_SQR == INTEG || !defined(STRIP) void fb_sqr_integ(fb_t c, const fb_t a) { fb_sqrm_low(c, a); } #endif
/* * This file is part of libFirm. * Copyright (C) 2015 Matthias Braun */ /** * @file * @brief position independent code adjustments * @author Matthias Braun */ #include "amd64_bearch_t.h" #include "amd64_new_nodes.h" #include "beutil.h" #include "entity_t.h" #include "ircons_t.h" #include "irgwalk.h" #include "irnode_t.h" #include "panic.h" #include "platform_t.h" #include "x86_node.h" static bool is_externally_visible(ir_entity const *const entity) { ir_visibility const vis = get_entity_visibility(entity); switch (vis) { case ir_visibility_private: case ir_visibility_local: return false; case ir_visibility_external: case ir_visibility_external_private: case ir_visibility_external_protected: return true; } panic("invalid visibility in %+F", entity); } static ir_node *create_gotpcrel_load(dbg_info *const dbgi, ir_graph *const irg, ir_entity *const entity) { ir_node *const addr = be_new_Relocation(dbgi, irg, X86_IMM_GOTPCREL, entity, mode_P); ir_type *const type = get_entity_type(entity); ir_node *const nomem = get_irg_no_mem(irg); ir_node *const block = get_irg_start_block(irg); ir_node *const load = new_rd_Load(dbgi, block, nomem, addr, mode_P, type, cons_floats); return new_r_Proj(load, mode_P, pn_Load_res); } static void fix_address_pic_mach_o(ir_node *const node, void *const data) { (void)data; foreach_irn_in(node, i, pred) { if (!is_Address(pred)) continue; ir_entity *const entity = get_Address_entity(pred); if (is_tls_entity(entity)) continue; ir_node *res; dbg_info *const dbgi = get_irn_dbg_info(pred); ir_graph *const irg = get_irn_irg(node); if (i == n_Call_ptr && is_Call(node)) { // Somehow we can always call PC relative. Are there trampolines // involved? res = be_new_Relocation(dbgi, irg, X86_IMM_PCREL, entity, mode_P); } else if (entity_has_definition(entity) && !(get_entity_linkage(entity) & IR_LINKAGE_MERGE)) { res = be_new_Relocation(dbgi, irg, X86_IMM_PCREL, entity, mode_P); } else { res = create_gotpcrel_load(dbgi, irg, entity); } set_irn_n(node, i, res); } } static void fix_address_pic_elf(ir_node *const node, void *const data) { (void)data; foreach_irn_in(node, i, pred) { if (!is_Address(pred)) continue; ir_entity *const entity = get_Address_entity(pred); if (is_tls_entity(entity)) continue; dbg_info *const dbgi = get_irn_dbg_info(pred); ir_graph *const irg = get_irn_irg(node); bool const ext_visible = is_externally_visible(entity); ir_node * res; if (i == n_Call_ptr && is_Call(node)) { /* We can compilation-unit local functions directly, everything else * goes through the PLT */ x86_immediate_kind_t const reloc = ext_visible ? X86_IMM_PLT : X86_IMM_PCREL; res = be_new_Relocation(dbgi, irg, reloc, entity, mode_P); } else if (!ext_visible) { res = be_new_Relocation(dbgi, irg, X86_IMM_PCREL, entity, mode_P); } else { res = create_gotpcrel_load(dbgi, irg, entity); } set_irn_n(node, i, res); } } void amd64_adjust_pic(ir_graph *irg) { switch (ir_platform.pic_style) { case BE_PIC_NONE: return; case BE_PIC_ELF_PLT: irg_walk_graph(irg, fix_address_pic_elf, NULL, NULL); break; case BE_PIC_ELF_NO_PLT: panic("amd64 elf/no-plt not implemented yet"); case BE_PIC_MACH_O: irg_walk_graph(irg, fix_address_pic_mach_o, NULL, NULL); break; } be_dump(DUMP_BE, irg, "pic"); }
/* * This file is part of libFirm. * Copyright (C) 2017 University of Karlsruhe. */ /** * @file * @brief Internal declarations used by gen_new_nodes.c */ #ifndef FIRM_BE_MIPS_MIPS_NEW_NODES_T_H #define FIRM_BE_MIPS_MIPS_NEW_NODES_T_H #include <stdio.h> #include "firm_types.h" #include "irop.h" void mips_dump_node(FILE *F, const ir_node *n, dump_reason_t reason); int mips_attrs_equal(ir_node const *a, ir_node const *b); int mips_cond_attrs_equal(ir_node const *a, ir_node const *b); int mips_immediate_attrs_equal(ir_node const *a, ir_node const *b); int mips_switch_attrs_equal(ir_node const *a, ir_node const *b); #endif
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3Support module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef Q3VALUESTACK_H #define Q3VALUESTACK_H #include <Qt3Support/q3valuelist.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Qt3SupportLight) template<class T> class Q3ValueStack : public Q3ValueList<T> { public: Q3ValueStack() {} ~Q3ValueStack() {} void push(const T& val) { this->append(val); } T pop() { T elem(this->last()); if (!this->isEmpty()) this->remove(this->fromLast()); return elem; } T& top() { return this->last(); } const T& top() const { return this->last(); } }; QT_END_NAMESPACE QT_END_HEADER #endif // Q3VALUESTACK_H