text
stringlengths
4
6.14k
/* * Author: MontaVista Software, Inc. <source@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #include <linux/init.h> #include <linux/mvl_patch.h> static __init int regpatch(void) { return mvl_register_patch(18); } module_init(regpatch);
/* * ioe_e4defrag: ioengine for git://git.kernel.dk/fio.git * * IO engine that does regular EXT4_IOC_MOVE_EXT ioctls to simulate * defragment activity * */ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/uio.h> #include <errno.h> #include <assert.h> #include <fcntl.h> #include "../fio.h" #include "../optgroup.h" #ifndef EXT4_IOC_MOVE_EXT #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) struct move_extent { __u32 reserved; /* should be zero */ __u32 donor_fd; /* donor file descriptor */ __u64 orig_start; /* logical start offset in block for orig */ __u64 donor_start; /* logical start offset in block for donor */ __u64 len; /* block length to be moved */ __u64 moved_len; /* moved block length */ }; #endif struct e4defrag_data { int donor_fd; int bsz; }; struct e4defrag_options { void *pad; unsigned int inplace; char * donor_name; }; static struct fio_option options[] = { { .name = "donorname", .lname = "Donor Name", .type = FIO_OPT_STR_STORE, .off1 = offsetof(struct e4defrag_options, donor_name), .help = "File used as a block donor", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_E4DEFRAG, }, { .name = "inplace", .lname = "In Place", .type = FIO_OPT_INT, .off1 = offsetof(struct e4defrag_options, inplace), .minval = 0, .maxval = 1, .help = "Alloc and free space inside defrag event", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_E4DEFRAG, }, { .name = NULL, }, }; static int fio_e4defrag_init(struct thread_data *td) { int r, len = 0; struct e4defrag_options *o = td->eo; struct e4defrag_data *ed; struct stat stub; char donor_name[PATH_MAX]; if (!strlen(o->donor_name)) { log_err("'donorname' options required\n"); return 1; } ed = malloc(sizeof(*ed)); if (!ed) { td_verror(td, ENOMEM, "io_queue_init"); return 1; } memset(ed, 0 ,sizeof(*ed)); if (td->o.directory) len = sprintf(donor_name, "%s/", td->o.directory); sprintf(donor_name + len, "%s", o->donor_name); ed->donor_fd = open(donor_name, O_CREAT|O_WRONLY, 0644); if (ed->donor_fd < 0) { td_verror(td, errno, "io_queue_init"); log_err("Can't open donor file %s err:%d\n", donor_name, ed->donor_fd); free(ed); return 1; } if (!o->inplace) { long long __len = td->o.file_size_high - td->o.start_offset; r = fallocate(ed->donor_fd, 0, td->o.start_offset, __len); if (r) goto err; } r = fstat(ed->donor_fd, &stub); if (r) goto err; ed->bsz = stub.st_blksize; td->io_ops_data = ed; return 0; err: td_verror(td, errno, "io_queue_init"); close(ed->donor_fd); free(ed); return 1; } static void fio_e4defrag_cleanup(struct thread_data *td) { struct e4defrag_data *ed = td->io_ops_data; if (ed) { if (ed->donor_fd >= 0) close(ed->donor_fd); free(ed); } } static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) { int ret; unsigned long long len; struct move_extent me; struct fio_file *f = io_u->file; struct e4defrag_data *ed = td->io_ops_data; struct e4defrag_options *o = td->eo; fio_ro_check(td, io_u); /* Theoretically defragmentation should not change data, but it * changes data layout. So this function handle only DDIR_WRITE * in order to satisfy strict read only access pattern */ if (io_u->ddir != DDIR_WRITE) { io_u->error = EINVAL; return FIO_Q_COMPLETED; } if (o->inplace) { ret = fallocate(ed->donor_fd, 0, io_u->offset, io_u->xfer_buflen); if (ret) goto out; } memset(&me, 0, sizeof(me)); me.donor_fd = ed->donor_fd; me.orig_start = io_u->offset / ed->bsz; me.donor_start = me.orig_start; len = (io_u->offset + io_u->xfer_buflen + ed->bsz -1); me.len = len / ed->bsz - me.orig_start; ret = ioctl(f->fd, EXT4_IOC_MOVE_EXT, &me); len = me.moved_len * ed->bsz; if (len > io_u->xfer_buflen) len = io_u->xfer_buflen; if (len != io_u->xfer_buflen) { io_u->resid = io_u->xfer_buflen - len; io_u->error = 0; } if (ret) io_u->error = errno; if (o->inplace) ret = ftruncate(ed->donor_fd, 0); out: if (ret && !io_u->error) io_u->error = errno; return FIO_Q_COMPLETED; } static struct ioengine_ops ioengine = { .name = "e4defrag", .version = FIO_IOOPS_VERSION, .init = fio_e4defrag_init, .queue = fio_e4defrag_queue, .open_file = generic_open_file, .close_file = generic_close_file, .get_file_size = generic_get_file_size, .flags = FIO_SYNCIO, .cleanup = fio_e4defrag_cleanup, .options = options, .option_struct_size = sizeof(struct e4defrag_options), }; static void fio_init fio_syncio_register(void) { register_ioengine(&ioengine); } static void fio_exit fio_syncio_unregister(void) { unregister_ioengine(&ioengine); }
/* * AscNHalf MMORPG Server * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> * Copyright (C) 2010 AscNHalf Team <http://ascnhalf.scymex.info/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef AUCTIONHOUSE_H #define AUCTIONHOUSE_H enum AuctionRemoveType { AUCTION_REMOVE_EXPIRED, AUCTION_REMOVE_WON, AUCTION_REMOVE_CANCELLED, }; enum AUCTIONRESULT { AUCTION_CREATE, AUCTION_CANCEL, AUCTION_BID, AUCTION_BUYOUT, }; enum AUCTIONRESULTERROR { AUCTION_ERROR_NONE, AUCTION_ERROR_UNK1, AUCTION_ERROR_INTERNAL, AUCTION_ERROR_MONEY, AUCTION_ERROR_ITEM, }; enum AuctionMailResult { AUCTION_OUTBID, AUCTION_WON, AUCTION_SOLD, AUCTION_EXPIRED, AUCTION_EXPIRED2, AUCTION_CANCELLED, }; struct Auction { uint32 Id; uint32 Owner; uint32 HighestBidder; uint32 HighestBid; uint32 BuyoutPrice; uint32 DepositAmount; uint32 ExpiryTime; Item* pItem; void DeleteFromDB(); void SaveToDB(uint32 AuctionHouseId); void UpdateInDB(); void AddToPacket(WorldPacket & data); bool Deleted; uint32 DeletedReason; }; class AuctionHouse { public: AuctionHouse(uint32 ID); ~AuctionHouse(); INLINE uint32 GetID() { return dbc->id; } void LoadAuctions(); void UpdateAuctions(); void UpdateDeletionQueue(); void RemoveAuction(Auction * auct); void AddAuction(Auction * auct); Auction * GetAuction(uint32 Id); void QueueDeletion(Auction * auct, uint32 Reason); void SendOwnerListPacket(Player* plr, WorldPacket * packet); void SendBidListPacket(Player* plr, WorldPacket * packet); void SendAuctionNotificationPacket(Player* plr, Auction * auct); void SendAuctionList(Player* plr, WorldPacket * packet); void UpdateItemOwnerships(uint32 oldGuid, uint32 newGuid); private: RWLock itemLock; HM_NAMESPACE::hash_map<uint64, Item* > auctionedItems; RWLock auctionLock; HM_NAMESPACE::hash_map<uint32, Auction*> auctions; Mutex removalLock; list<Auction*> removalList; AuctionHouseDBC * dbc; public: float cut_percent; float deposit_percent; }; #endif
DECL|macro|TAG_H DECL|member|date DECL|member|object DECL|member|tag DECL|member|tagged DECL|struct|tag
/* * sundries.h * Support function prototypes. Functions are in sundries.c. */ #include <sys/types.h> #include <fcntl.h> #include <limits.h> #include <signal.h> #include <stdarg.h> #include <stdlib.h> #if !defined(bool_t) && !defined(__GLIBC__) #include <rpc/types.h> #endif extern int nocluster_opt; extern int mount_quiet; extern int verbose; extern int sloppy; #define streq(s, t) (strcmp ((s), (t)) == 0) /* Functions in sundries.c that are used in mount.c and umount.c */ void block_signals (int how); char *canonicalize (const char *path); void error (const char *fmt, ...); int matching_type (const char *type, const char *types); int matching_opts (const char *options, const char *test_opts); void *xmalloc (size_t size); char *xstrdup (const char *s); char *xstrndup (const char *s, int n); char *xstrconcat2 (const char *, const char *); char *xstrconcat3 (const char *, const char *, const char *); char *xstrconcat4 (const char *, const char *, const char *, const char *); void die (int errcode, const char *fmt, ...); #ifdef HAVE_NFS int nfsmount (const char *spec, const char *node, int *flags, char **orig_opts, char **opt_args, int *version, int running_bg); #endif /* exit status - bits below are ORed */ #define EX_USAGE 1 /* incorrect invocation or permission */ #define EX_SYSERR 2 /* out of memory, cannot fork, ... */ #define EX_SOFTWARE 4 /* internal mount bug or wrong version */ #define EX_USER 8 /* user interrupt */ #define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */ #define EX_FAIL 32 /* mount failure */ #define EX_SOMEOK 64 /* some mount succeeded */ #define EX_BG 256 /* retry in background (internal only) */
#undef TRACE_SYSTEM #define TRACE_SYSTEM timer #if !defined(_TRACE_EVENTS_TIMER_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_EVENTS_TIMER_H #include <linux/tracepoint.h> #include <linux/hrtimer.h> #include <linux/timer.h> TRACE_EVENT(timer_init, TP_PROTO(struct timer_list *timer), TP_ARGS(timer), TP_STRUCT__entry( __field( void *, timer ) ), TP_fast_assign( __entry->timer = timer; ), TP_printk("timer=%p", __entry->timer) ); TRACE_EVENT(timer_start, TP_PROTO(struct timer_list *timer, unsigned long expires), TP_ARGS(timer, expires), TP_STRUCT__entry( __field( void *, timer ) __field( void *, function ) __field( unsigned long, expires ) __field( unsigned long, now ) ), TP_fast_assign( __entry->timer = timer; __entry->function = timer->function; __entry->expires = expires; __entry->now = jiffies; ), TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]", __entry->timer, __entry->function, __entry->expires, (long)__entry->expires - __entry->now) ); TRACE_EVENT(timer_expire_entry, TP_PROTO(struct timer_list *timer), TP_ARGS(timer), TP_STRUCT__entry( __field( void *, timer ) __field( unsigned long, now ) __field( void *, function) ), TP_fast_assign( __entry->timer = timer; __entry->now = jiffies; __entry->function = timer->function; ), TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now) ); TRACE_EVENT(timer_expire_exit, TP_PROTO(struct timer_list *timer), TP_ARGS(timer), TP_STRUCT__entry( __field(void *, timer ) ), TP_fast_assign( __entry->timer = timer; ), TP_printk("timer=%p", __entry->timer) ); TRACE_EVENT(timer_cancel, TP_PROTO(struct timer_list *timer), TP_ARGS(timer), TP_STRUCT__entry( __field( void *, timer ) ), TP_fast_assign( __entry->timer = timer; ), TP_printk("timer=%p", __entry->timer) ); TRACE_EVENT(hrtimer_init, TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, enum hrtimer_mode mode), TP_ARGS(hrtimer, clockid, mode), TP_STRUCT__entry( __field( void *, hrtimer ) __field( clockid_t, clockid ) __field( enum hrtimer_mode, mode ) ), TP_fast_assign( __entry->hrtimer = hrtimer; __entry->clockid = clockid; __entry->mode = mode; ), TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, __entry->clockid == CLOCK_REALTIME ? "CLOCK_REALTIME" : "CLOCK_MONOTONIC", __entry->mode == HRTIMER_MODE_ABS ? "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL") ); TRACE_EVENT(hrtimer_start, TP_PROTO(struct hrtimer *hrtimer), TP_ARGS(hrtimer), TP_STRUCT__entry( __field( void *, hrtimer ) __field( void *, function ) __field( s64, expires ) __field( s64, softexpires ) ), TP_fast_assign( __entry->hrtimer = hrtimer; __entry->function = hrtimer->function; __entry->expires = hrtimer_get_expires(hrtimer).tv64; __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64; ), TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu", __entry->hrtimer, __entry->function, (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->expires }), (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->softexpires })) ); TRACE_EVENT(hrtimer_expire_entry, TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), TP_ARGS(hrtimer, now), TP_STRUCT__entry( __field( void *, hrtimer ) __field( s64, now ) __field( void *, function) ), TP_fast_assign( __entry->hrtimer = hrtimer; __entry->now = now->tv64; __entry->function = hrtimer->function; ), TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function, (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) ); TRACE_EVENT(hrtimer_expire_exit, TP_PROTO(struct hrtimer *hrtimer), TP_ARGS(hrtimer), TP_STRUCT__entry( __field( void *, hrtimer ) ), TP_fast_assign( __entry->hrtimer = hrtimer; ), TP_printk("hrtimer=%p", __entry->hrtimer) ); TRACE_EVENT(hrtimer_cancel, TP_PROTO(struct hrtimer *hrtimer), TP_ARGS(hrtimer), TP_STRUCT__entry( __field( void *, hrtimer ) ), TP_fast_assign( __entry->hrtimer = hrtimer; ), TP_printk("hrtimer=%p", __entry->hrtimer) ); TRACE_EVENT(itimer_state, TP_PROTO(int which, const struct itimerval *const value, cputime_t expires), TP_ARGS(which, value, expires), TP_STRUCT__entry( __field( int, which ) __field( cputime_t, expires ) __field( long, value_sec ) __field( long, value_usec ) __field( long, interval_sec ) __field( long, interval_usec ) ), TP_fast_assign( __entry->which = which; __entry->expires = expires; __entry->value_sec = value->it_value.tv_sec; __entry->value_usec = value->it_value.tv_usec; __entry->interval_sec = value->it_interval.tv_sec; __entry->interval_usec = value->it_interval.tv_usec; ), TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", __entry->which, (unsigned long long)__entry->expires, __entry->value_sec, __entry->value_usec, __entry->interval_sec, __entry->interval_usec) ); TRACE_EVENT(itimer_expire, TP_PROTO(int which, struct pid *pid, cputime_t now), TP_ARGS(which, pid, now), TP_STRUCT__entry( __field( int , which ) __field( pid_t, pid ) __field( cputime_t, now ) ), TP_fast_assign( __entry->which = which; __entry->now = now; __entry->pid = pid_nr(pid); ), TP_printk("which=%d pid=%d now=%llu", __entry->which, (int) __entry->pid, (unsigned long long)__entry->now) ); #endif /* _TRACE_EVENTS_TIMER_H */ /* This part must be outside protection */ #include <trace/define_trace.h>
/* * Copyright (C) 2004,2004 bmonthy@users.sourceforge.net * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US * * * $Id: env_lex.h,v 1.4 2005/04/26 12:56:57 bmonthy Exp $ */ #ifndef _ENV_LEX_H #define _ENV_LEX_H #include "toolwrap.h" #include <stdio.h> #include <sys/types.h> #include <regex.h> #define YYSTYPE char* #include "env.h" #include "list.h" #include "log.h" #define MAX_WORD_LEN 512 struct _env_lex_t { FILE* in; /* input file handle */ int cond; /* current start condition */ char* buffer; /* temporary buffer */ size_t buffer_len; /* temporary buffer length */ int eof; /* end of file */ char tmp[MAX_WORD_LEN]; /* current read word */ }; typedef struct _env_lex_t env_lex_t; env_lex_t *env_lex_new(const char*); void env_lex_free(env_lex_t*); int yylex(YYSTYPE *yylval, env_lex_t*); #endif /* ! _ENV_LEX_H */
/* Copyright (C) 2001 Tensilica, Inc. All Rights Reserved. Revised to support Tensilica processors and to improve overall performance */ /* Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ #pragma ident "@(#) libu/util/ishell.c 92.2 10/29/99 21:40:31" #include <errno.h> #include <fortran.h> #if !defined(_ABSOFT) #include <malloc.h> #endif #include <stddef.h> #include <stdlib.h> /* * ISHELL - Fortran callable routine to send a command * to the shell. * * INPUT: cmdargs--type character argument or type * other containing character data that * ends with a NULL character. * OUTPUT: integer variable containing status returned by * the system() call. If system() returns -1, * the value of -errno is returned. */ #ifdef _UNICOS _f_int ISHELL(_fcd cmdarg) { char *cptr; int ret; int fcdflag; /* Check number of arguments */ if (_numargs() < 1) return( (_f_int) -1); /* IS cmdarg an _fcd ? */ fcdflag = 0; #ifdef _ADDR64 if (_numargs() * sizeof(long) == sizeof(_fcd)) #else if (_isfcd(cmdarg)) #endif fcdflag = 1; /* Convert argument to C character string */ if (fcdflag) { /* If Fortran character */ cptr = _fc_acopy(cmdarg); if (cptr == NULL) return( (_f_int) -1); } else cptr = _fcdtocp(cmdarg); /* Run command using system() */ ret = system(cptr); if (ret == -1) ret = -errno; if (fcdflag) free(cptr); return( (_f_int) ret); } #endif /* _UNICOS */ #ifndef _UNICOS #include <string.h> _f_int ishell_(char* cmdcptr, int cmdlen) { char *cptr; int ret; cptr = malloc(cmdlen + 1); if (cptr == NULL) return( (_f_int) -1); (void) memcpy(cptr, cmdcptr, cmdlen); cptr[cmdlen] = '\0'; ret = system(cptr); if (ret == -1) ret = -errno; free(cptr); return( (_f_int) ret); } #endif /* ! _UNICOS */
#ifndef QEMU_OSDEP_H #define QEMU_OSDEP_H #include <stdarg.h> #ifdef __OpenBSD__ #include <sys/types.h> #include <sys/signal.h> #endif #ifndef _WIN32 #include <sys/time.h> #endif #ifndef glue #define xglue(x, y) x ## y #define glue(x, y) xglue(x, y) #define stringify(s) tostring(s) #define tostring(s) #s #endif #ifndef likely #if __GNUC__ < 3 #define __builtin_expect(x, n) (x) #endif #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #endif #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) #endif #ifndef container_of #define container_of(ptr, type, member) ({ \ const typeof(((type *) 0)->member) *__mptr = (ptr); \ (type *) ((char *) __mptr - offsetof(type, member));}) #endif #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif #ifndef always_inline #if !((__GNUC__ < 3) || defined(__APPLE__)) #ifdef __OPTIMIZE__ #define inline __attribute__ (( always_inline )) __inline__ #endif #endif #else #define inline always_inline #endif #ifdef __i386__ #define REGPARM __attribute((regparm(3))) #else #define REGPARM #endif #define qemu_printf printf #if defined (__GNUC__) && defined (__GNUC_MINOR__) # define QEMU_GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define QEMU_GNUC_PREREQ(maj, min) 0 #endif void *qemu_memalign(size_t alignment, size_t size); void *qemu_vmalloc(size_t size); void qemu_vfree(void *ptr); int qemu_create_pidfile(const char *filename); #ifdef _WIN32 int ffs(int i); typedef struct { long tv_sec; long tv_usec; } qemu_timeval; int qemu_gettimeofday(qemu_timeval *tp); #else typedef struct timeval qemu_timeval; #define qemu_gettimeofday(tp) gettimeofday(tp, NULL); #endif /* !_WIN32 */ #endif
/***************************************************************************** * quant.h: arm quantization and level-run ***************************************************************************** * Copyright (C) 2005-2014 x264 project * * Authors: David Conrad <lessen42@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 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #ifndef X264_ARM_QUANT_H #define X264_ARM_QUANT_H int x264_quant_2x2_dc_armv6( int16_t dct[4], int mf, int bias ); int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias ); int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias ); int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] ); int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] ); int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] ); void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp ); void x264_dequant_mpeg2_inter_neon( dctcoef dct[64], int dequant_mf[64] ); void x264_dequant_mpeg2_intra_neon( dctcoef dct[64], int dequant_mf[64], int precision ); int x264_coeff_last4_arm( int16_t * ); int x264_coeff_last15_neon( int16_t * ); int x264_coeff_last16_neon( int16_t * ); int x264_coeff_last64_neon( int16_t * ); #endif
/** @file implements menubar interface functions. Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "EditMenuBar.h" #include "UefiShellDebug1CommandsLib.h" #include "EditStatusBar.h" EDITOR_MENU_ITEM *MenuItems; MENU_ITEM_FUNCTION *ControlBasedMenuFunctions; UINTN NumItems; /** Cleanup function for a menu bar. frees all allocated memory. **/ VOID EFIAPI MenuBarCleanup ( VOID ) { SHELL_FREE_NON_NULL(MenuItems); } /** Initialize the menu bar with the specified items. @param[in] Items The items to display and their functions. @retval EFI_SUCCESS The initialization was correct. @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS EFIAPI MenuBarInit ( IN CONST EDITOR_MENU_ITEM *Items ) { CONST EDITOR_MENU_ITEM *ItemsWalker; for (NumItems = 0, ItemsWalker = Items ; ItemsWalker != NULL && ItemsWalker->Function != NULL ; ItemsWalker++,NumItems++); MenuItems = AllocateZeroPool((NumItems+1) * sizeof(EDITOR_MENU_ITEM)); if (MenuItems == NULL) { return EFI_OUT_OF_RESOURCES; } CopyMem(MenuItems, Items, (NumItems+1) * sizeof(EDITOR_MENU_ITEM)); return EFI_SUCCESS; } /** Initialize the control hot-key with the specified items. @param[in] Items The hot-key functions. @retval EFI_SUCCESS The initialization was correct. **/ EFI_STATUS EFIAPI ControlHotKeyInit ( IN MENU_ITEM_FUNCTION *Items ) { ControlBasedMenuFunctions = Items; return EFI_SUCCESS; } /** Refresh function for the menu bar. @param[in] LastRow The last printable row. @param[in] LastCol The last printable column. @retval EFI_SUCCESS The refresh was successful. **/ EFI_STATUS EFIAPI MenuBarRefresh ( IN CONST UINTN LastRow, IN CONST UINTN LastCol ) { EDITOR_MENU_ITEM *Item; UINTN Col; UINTN Row; UINTN Width; CHAR16 *NameString; CHAR16 *FunctionKeyString; // // variable initialization // Col = 1; Row = (LastRow - 2); // // clear menu bar rows // EditorClearLine (LastRow - 2, LastCol, LastRow); EditorClearLine (LastRow - 1, LastCol, LastRow); EditorClearLine (LastRow , LastCol, LastRow); // // print out the menu items // for (Item = MenuItems; Item != NULL && Item->Function != NULL; Item++) { NameString = HiiGetString(gShellDebug1HiiHandle, Item->NameToken, NULL); Width = MAX ((StrLen (NameString) + 6), 20); if (((Col + Width) > LastCol)) { Row++; Col = 1; } FunctionKeyString = HiiGetString(gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL); ShellPrintEx ((INT32)(Col) - 1, (INT32)(Row) - 1, L"%E%s%N %H%s%N ", FunctionKeyString, NameString); FreePool (NameString); FreePool (FunctionKeyString); Col += Width; } return EFI_SUCCESS; } /** Function to dispatch the correct function based on a function key (F1...) @param[in] Key The pressed key. @retval EFI_NOT_FOUND The key was not a valid function key (an error was sent to the status bar). @return The return value from the called dispatch function. **/ EFI_STATUS EFIAPI MenuBarDispatchFunctionKey ( IN CONST EFI_INPUT_KEY *Key ) { UINTN Index; Index = Key->ScanCode - SCAN_F1; // // check whether in range // if (Index > (NumItems - 1)) { StatusBarSetStatusString (L"Unknown Command"); return EFI_SUCCESS; } return (MenuItems[Index].Function ()); } /** Function to dispatch the correct function based on a control-based key (ctrl+o...) @param[in] Key The pressed key. @retval EFI_NOT_FOUND The key was not a valid control-based key (an error was sent to the status bar). @return EFI_SUCCESS. **/ EFI_STATUS EFIAPI MenuBarDispatchControlHotKey ( IN CONST EFI_INPUT_KEY *Key ) { if ((SCAN_CONTROL_Z < Key->UnicodeChar) ||(NULL == ControlBasedMenuFunctions[Key->UnicodeChar])) { return EFI_NOT_FOUND; } ControlBasedMenuFunctions[Key->UnicodeChar](); return EFI_SUCCESS; }
#include <stdio.h> int congHaiSo(int soThu1, int soThu2); int nhanHaiSo(int soThu1, int soThu2); int main() { int number1 = 10; int number2 = 30; int resultOfCongHaiSo = congHaiSo(number1, number2); printf("Ket qua cua CongHaiSo: %d\n", resultOfCongHaiSo); printf("Ket qua cua CongHaiSo: %d\n", nhanHaiSo(number1, number2)); } int congHaiSo(int soThu1, int soThu2) { int ketQua = soThu1 + soThu2; return ketQua; } int nhanHaiSo(int soThu1, int soThu2) { int ketQua = soThu1 * soThu2; return ketQua; }
/* * IRC - Internet Relay Chat, include/supported.h * Copyright (C) 1999 Perry Lorier. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: supported.h 1860 2007-12-28 15:52:43Z klmitch $ * * Description: This file has the featureset that ircu announces on connecting * a client. It's in this .h because it's likely to be appended * to frequently and s_user.h is included by basically everyone. */ #ifndef INCLUDED_supported_h #define INCLUDED_supported_h #include "channel.h" #include "ircd_defs.h" #endif /* INCLUDED_supported_h */
/* * Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com> * * Based on clk-simple-gates.c, which is: * Copyright 2015 Maxime Ripard * * Maxime Ripard <maxime.ripard@free-electrons.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. */ #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/slab.h> #include <linux/spinlock.h> static DEFINE_SPINLOCK(gates_lock); static void __init sun8i_h3_bus_gates_init(struct device_node *node) { const char *clocks[] = { "ahb1", "ahb2", "apb1", "apb2" }; enum { AHB1, AHB2, APB1, APB2 } clk_parent; struct clk_onecell_data *clk_data; const char *clk_name; struct property *prop; struct resource res; void __iomem *clk_reg; void __iomem *reg; const __be32 *p; int number, i; u8 clk_bit; u32 index; reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) return; for (i = 0; i < ARRAY_SIZE(clocks); i++) { index = of_property_match_string(node, "clock-names", clocks[i]); if (index < 0) return; clocks[i] = of_clk_get_parent_name(node, index); } clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); if (!clk_data) goto err_unmap; number = of_property_count_u32_elems(node, "clock-indices"); of_property_read_u32_index(node, "clock-indices", number - 1, &number); clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL); if (!clk_data->clks) goto err_free_data; i = 0; of_property_for_each_u32(node, "clock-indices", prop, p, index) { of_property_read_string_index(node, "clock-output-names", i, &clk_name); if (index == 17 || (index >= 29 && index <= 31)) clk_parent = AHB2; else if (index <= 63 || index >= 128) clk_parent = AHB1; else if (index >= 64 && index <= 95) clk_parent = APB1; else if (index >= 96 && index <= 127) clk_parent = APB2; clk_reg = reg + 4 * (index / 32); clk_bit = index % 32; clk_data->clks[index] = clk_register_gate(NULL, clk_name, clocks[clk_parent], 0, clk_reg, clk_bit, 0, &gates_lock); i++; if (IS_ERR(clk_data->clks[index])) { WARN_ON(true); continue; } } clk_data->clk_num = number + 1; of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); return; err_free_data: kfree(clk_data); err_unmap: iounmap(reg); of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); } CLK_OF_DECLARE(sun8i_h3_bus_gates, "allwinner,sun8i-h3-bus-gates-clk", sun8i_h3_bus_gates_init);
/* Copyright (c) 2008 Stefan Kurtz <kurtz@zbh.uni-hamburg.de> Copyright (c) 2008 Center for Bioinformatics, University of Hamburg Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef GT_TAGERATOR_H #define GT_TAGERATOR_H #include "core/tool.h" /* the tagerator tool */ GtTool* gt_tagerator(void); #endif
/** \file ARMlet.c * Source file containing the program entrypoint, initialisation and quit * handler. */ #include "fxlib.h" #include "common/filesys.h" #include "common/menu.h" /** * Program entrypoint. * * \param[in] isAppli 1 if launched from the menu, 0 by an eACT application. * \param[in] OptionNum Strip number (0-3). Only used if isAppli == 0. * * \return 0 if there has been an error, otherwise 1. */ int AddIn_main(int isAppli, unsigned short OptionNum) { unsigned int key; Bdisp_AllClr_DDVRAM(); GetKey( &key ); display_menu( explorer_entries, 0 ); GetKey( &key ); display_menu( explorer_entries, 1 ); GetKey( &key ); display_menu( explorer_entries, 2 ); while( 1 ) { GetKey( &key ); } return 1; } #pragma section _BR_Size unsigned long BR_Size; /**< Global variable BR_Size. */ #pragma section #pragma section _TOP /** * Initialise system. * * \param[in] isAppli 1 for an application, 0 for an eActivity. * \param[in] OptionNum Strip number (0-3). Only used for eActivities. * * \return 0 if there has been an error, otherwise 1. */ int InitializeSystem(int isAppli, unsigned short OptionNum) { return INIT_ADDIN_APPLICATION(isAppli, OptionNum); } #pragma section
/* * upperbounds.h * * Created on: Aug 13, 2014 * Author: olga */ #ifndef UPPERBOUNDS_H_ #define UPPERBOUNDS_H_ /** main function to carry out Upper Bounds analysis */ #include "tree/iqtree.h" #include "tree/mexttree.h" #include "alignment/alignment.h" #include "tree/phylotree.h" class PhyloTree; class IQTree; void UpperBounds(Params* params, Alignment* alignment, IQTree* tree); void printUB(); void printTreeUB(MTree *tree); /** * extracting subtree spanned by corresponding taxa together with subalignment * * ids - vector of taxa ids, the subtree is spanned by these taxa * type - specifies the copying procedure: * = 0, normal (PhyloTree) tree->copyTree; * two branches, incident to one of the end nodes of the branch spliting two subtrees, are collapsed * = 1, remember the end of the branch, do not collapse two branches * this is used for the subtree with "artificial root", * this will be a leaf without any nucleotide fixed at any site */ PhyloTree* extractSubtreeUB(IntVector &ids, MTree* tree, Params *params, int sw = 0); // Slightly changed functions from usual MTree.copy, to allow for non collapsed branches: type=1 void copyTreeUB(MTree *tree, MTree *treeCopy, string &taxa_set); Node* copyTreeUBnode(MTree *tree, MTree *treeCopy, string &taxa_set, double &len, Node *node = NULL, Node *dad = NULL); // With artificial root internal node might get ID < taxaNUM. Just to make consistent with any other part of program, // reindex all taxa from 0 to taxaNUM-1, and then internal nodes will get ids from taxaNUM to nodesNUM. void reindexTaxonIDs(MTree *tree); /* * Generate random YH tree, which is considered as a subtree of parent tree * input tree - is a subtree, * output - log-likelihood of generated subtree */ MTree* generateRandomYH_UB(Params &params, PhyloTree *tree); /* * This function generates a random tree that has A|B split. * One can also specify the length of corresponding branch. * t(A|B) = brLen */ double RandomTreeAB(PhyloTree* treeORGN, PhyloTree* treeAorgn, PhyloTree* treeBorgn, IntVector &taxaA, IntVector &taxaB, Params *params, double brLen = 0.0); /* * This function computes the product of logLhs of two subtrees corresponding to a given split A|B on tree. */ double UpperBoundAB(IntVector &taxaA, IntVector &taxaB, PhyloTree* tree, Params *params); /* * Auxiliary function for RandomTreeAB, chooses randomly node and inserts new branch with randomLen */ void extendingTree(MTree* tree, Params* params); NodeVector getBranchABid(double brLen, PhyloTree* tree); /* * Applying UBs to NNI search */ NNIMove getBestNNIForBranUB(PhyloNode *node1, PhyloNode *node2, PhyloTree *tree); double logC(double t, PhyloTree* tree); /** * Tests on fractions ai/(ai+bi) and bi/(ai+bi) * (fractions of sums for matching and non-matching pairs of nucleotides on the ends of branch) */ void sumFraction(PhyloNode *node1, PhyloNode *node2, PhyloTree *tree); #endif /* UPPERBOUNDS_H_ */
//----------------------------------------------------------------------------- // File: SingleIndirectInterfaceItem.h //----------------------------------------------------------------------------- // Project: Kactus 2 // Author: // Date: // // Description: // The item for single bus interface in the component editor's navigation tree. //----------------------------------------------------------------------------- #ifndef SingleIndirectInterfaceItem_H #define SingleIndirectInterfaceItem_H #include <editors/ComponentEditor/treeStructure/ParameterizableItem.h> #include <QSharedPointer> class IndirectInterface; class IndirectInterfaceValidator; class ExpressionParser; class BusInterfaceInterface; //----------------------------------------------------------------------------- //! The item for single bus interface in the component editor's navigation tree. //----------------------------------------------------------------------------- class SingleIndirectInterfaceItem : public ParameterizableItem { Q_OBJECT public: /*! * The constructor. * * @param [in] busif The bus interface being edited. * @param [in] model The model that owns the items. * @param [in] libHandler The instance that manages the library. * @param [in] component The component being edited. * @param [in] referenceCounter The reference counter. * @param [in] parameterFinder The parameter finder. * @param [in] expressionFormatter The expression formatter. * @param [in] expressionParser The expression parser. * @param [in] validator The validator for bus interfaces. * @param [in] busInterface Interface for accessing bus interfaces. * @param [in] parent The owner of this item. * @param [in] parentWnd The parent window. */ SingleIndirectInterfaceItem(QSharedPointer<IndirectInterface> busif, ComponentEditorTreeModel* model, LibraryInterface* libHandler, QSharedPointer<Component> component, QSharedPointer<ReferenceCounter> referenceCounter, QSharedPointer<ParameterFinder> parameterFinder, QSharedPointer<ExpressionFormatter> expressionFormatter, QSharedPointer<ExpressionParser> expressionParser, QSharedPointer<IndirectInterfaceValidator> validator, BusInterfaceInterface* busInterface, ComponentEditorItem* parent, QWidget* parentWnd); //! The destructor virtual ~SingleIndirectInterfaceItem(); /*! Get the tool tip for the item. * * @return The text for the tool tip to print to user. */ virtual QString getTooltip() const; /*! Get the text to be displayed to user in the tree for this item. * * @return QString Contains the text to display. */ virtual QString text() const; /*! Check the validity of this item and sub items. * * @return bool True if item is in valid state. */ virtual bool isValid() const; /*! Get The editor of this item. * * @return The editor to use for this item. */ virtual ItemEditor* editor(); private: //! No copying SingleIndirectInterfaceItem(const SingleIndirectInterfaceItem& other); //! No assignment SingleIndirectInterfaceItem& operator=(const SingleIndirectInterfaceItem& other); //! The bus interface being edited. QSharedPointer<IndirectInterface> indirectInterface_; //! The parent window. QWidget* parentWnd_; //! The expression parse used to form the results of the expressions. QSharedPointer<ExpressionParser> expressionParser_; //! The validator for indirect interfaces. QSharedPointer<IndirectInterfaceValidator> validator_; //! Interface for accessing bus interfaces. BusInterfaceInterface* busInterface_; }; #endif // SingleIndirectInterfaceItem_H
/* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> * 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 TRINITY_UNORDERED_SET_H #define TRINITY_UNORDERED_SET_H #include "HashNamespace.h" #if COMPILER_HAS_CPP11_SUPPORT # include <unordered_set> #elif COMPILER == COMPILER_INTEL # include <ext/hash_set> #elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) # include <unordered_set> #elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 # include <tr1/unordered_set> #elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 # include <ext/hash_set> #elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later # include <unordered_set> #else # include <hash_set> #endif #ifdef _STLPORT_VERSION # define UNORDERED_SET std::hash_set using std::hash_set; #elif COMPILER_HAS_CPP11_SUPPORT # define UNORDERED_SET std::unordered_set #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100 # define UNORDERED_SET std::tr1::unordered_set #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 # define UNORDERED_SET std::tr1::unordered_set #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300 # define UNORDERED_SET stdext::hash_set using stdext::hash_set; #elif COMPILER == COMPILER_INTEL # define UNORDERED_SET std::hash_set using std::hash_set; #elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) # define UNORDERED_SET std::unordered_set #elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 # define UNORDERED_SET std::tr1::unordered_set #elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 # define UNORDERED_SET __gnu_cxx::hash_set #else # define UNORDERED_SET std::hash_set using std::hash_set; #endif #endif
/* $Id$ */ /* * This file is part of mptestsuite. Copyright 2001,2002, Stefan Podkowinski. * * mptestsuite 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. * * mptestsuite 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 mptestsuite; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #if STDC_HEADERS # include <stdlib.h> # include <string.h> # include <stdarg.h> #elif HAVE_STRINGS_H # include <strings.h> #endif /*STDC_HEADERS*/ #if HAVE_UNISTD_H # include <unistd.h> # include <sys/types.h> #endif #include <dirent.h> #include <errno.h> #include <stdio.h> #include <fcntl.h> #include <assert.h> #include "mplib.h" #include "mptestsuite.h" int results_ok = 0; int results_failed = 0; int curfd; int main(int argc, char** args) { if(getopt(argc, args, "s:") != -1 && optarg) { printf("Scanning directory %s...\n", optarg); mpt_scan(optarg); puts("Done."); exit(0); } puts("\n\nmplib testsuite starting...\n\n"); puts("This will run a number of tests that will check\nif mplib was correctly build"\ " and works as excpected.\n\n"); puts(" => Testing tag reading capabilities\n\n"); curfd = open("r_mplib_v1.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 1)) { mpt_check_header_v1(curfd); mpt_check_v1_mplib(curfd); } close(curfd); curfd = open("r_mplib_v11.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 1)) { mpt_check_v11_mplib(curfd); } close(curfd); curfd = open("r_mplib_v2.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_v2_mplib(curfd); } close(curfd); curfd = open("r_winamp_v2.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_v2_winamp(curfd); } close(curfd); curfd = open("r_winamp_508_v2.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_v2_winamp(curfd); } close(curfd); curfd = open("r_music_match_jukebox_v2.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_v2_mmjukebox(curfd); } close(curfd); curfd = open("r_music_match_jukebox_10_v2.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_v2_mmjukebox(curfd); } close(curfd); curfd = open("r_mediamonkey.mp3", O_RDONLY); if(!mpt_check_readable(curfd, 2)) { mpt_check_mediamonkey(curfd); } close(curfd); puts("\n => Testing tag writing capabilities\n\n"); system("cp clip.mp3 w_mplib_v1.mp3; cp clip.mp3 w_mplib_v2.mp3"); curfd = open("w_mplib_v1.mp3", O_RDWR); if(!mpt_write_tag(curfd, 1)) { mpt_check_v11_mplib(curfd); } close(curfd); curfd = open("w_mplib_v2.mp3", O_RDWR); if(!mpt_write_tag(curfd, 2)) { mpt_check_v2_mplib(curfd); } close(curfd); //unlink("w_mplib_v1.mp3"); //unlink("w_mplib_v2.mp3"); //xprint_malloc_stat(); exit(0); }
/* Kvalobs - Free Quality Control Software for Meteorological Observations $Id: miTimeParse.h,v 1.1.2.2 2007/09/27 09:02:32 paule Exp $ Copyright (C) 2007 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY email: kvalobs-dev@met.no This file is part of KVALOBS KVALOBS 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. KVALOBS 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 KVALOBS; if not, write to the Free Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __GETTIMEOFDAY_H__ #define __GETTIMEOFDAY_H__ namespace miutil { /** * gettimeofday returns the number of second since 1970.1.1 00:00:00 as a double * with microseconds resolution. * * @return a number > 0 on success and a number <0 on failure. */ double gettimeofday(); } #endif
/* * Copyright (C) 2006 Sven Peter <svpe@gmx.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 NVIDIA_PLUGIN_H #define NVIDIA_PLUGIN_H #include <sensors-applet/sensors-applet-plugin.h> #endif /* NVIDIA_PLUGIN_H*/
#include <linux/module.h> #include <linux/sched.h> #include <linux/kthread.h> #include <linux/workqueue.h> #include <linux/memblock.h> #include <asm/proto.h> /* * Some BIOSes seem to corrupt the low 64k of memory during events * like suspend/resume and unplugging an HDMI cable. Reserve all * remaining free memory in that area and fill it with a distinct * pattern. */ #define MAX_SCAN_AREAS 8 static int __read_mostly memory_corruption_check = -1; static unsigned __read_mostly corruption_check_size = 64*1024; static unsigned __read_mostly corruption_check_period = 60; /* seconds */ static struct scan_area { u64 addr; u64 size; } scan_areas[MAX_SCAN_AREAS]; static int num_scan_areas; static __init int set_corruption_check(char *arg) { ssize_t ret; unsigned long val; ret = kstrtoul(arg, 10, &val); if (ret) return ret; memory_corruption_check = val; return 0; } early_param("memory_corruption_check", set_corruption_check); static __init int set_corruption_check_period(char *arg) { ssize_t ret; unsigned long val; ret = kstrtoul(arg, 10, &val); if (ret) return ret; corruption_check_period = val; return 0; } early_param("memory_corruption_check_period", set_corruption_check_period); static __init int set_corruption_check_size(char *arg) { char *end; unsigned size; size = memparse(arg, &end); if (*end == '\0') corruption_check_size = size; return (size == corruption_check_size) ? 0 : -EINVAL; } early_param("memory_corruption_check_size", set_corruption_check_size); void __init setup_bios_corruption_check(void) { phys_addr_t start, end; u64 i; if (memory_corruption_check == -1) { memory_corruption_check = #ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK 1 #else 0 #endif ; } if (corruption_check_size == 0) memory_corruption_check = 0; if (!memory_corruption_check) return; corruption_check_size = round_up(corruption_check_size, PAGE_SIZE); for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) { start = clamp_t(phys_addr_t, round_up(start, PAGE_SIZE), PAGE_SIZE, corruption_check_size); end = clamp_t(phys_addr_t, round_down(end, PAGE_SIZE), PAGE_SIZE, corruption_check_size); if (start >= end) continue; memblock_reserve(start, end - start); scan_areas[num_scan_areas].addr = start; scan_areas[num_scan_areas].size = end - start; /* Assume we've already mapped this early memory */ memset(__va(start), 0, end - start); if (++num_scan_areas >= MAX_SCAN_AREAS) break; } if (num_scan_areas) printk(KERN_INFO "Scanning %d areas for low memory corruption\n", num_scan_areas); } void check_for_bios_corruption(void) { int i; int corruption = 0; if (!memory_corruption_check) return; for (i = 0; i < num_scan_areas; i++) { unsigned long *addr = __va(scan_areas[i].addr); unsigned long size = scan_areas[i].size; for (; size; addr++, size -= sizeof(unsigned long)) { if (!*addr) continue; printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n", addr, __pa(addr), *addr); corruption = 1; *addr = 0; } } WARN_ONCE(corruption, KERN_ERR "Memory corruption detected in low memory\n"); } static void check_corruption(struct work_struct *dummy); static DECLARE_DELAYED_WORK(bios_check_work, check_corruption); static void check_corruption(struct work_struct *dummy) { check_for_bios_corruption(); schedule_delayed_work(&bios_check_work, round_jiffies_relative(corruption_check_period*HZ)); } static int start_periodic_check_for_corruption(void) { if (!num_scan_areas || !memory_corruption_check || corruption_check_period == 0) return 0; printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", corruption_check_period); /* First time we run the checks right away */ schedule_delayed_work(&bios_check_work, 0); return 0; } module_init(start_periodic_check_for_corruption);
// RUN: %clang_cc1 -triple i386-apple-darwin9 -target-cpu pentium4 -g -emit-llvm %s -o - typedef short __v4hi __attribute__ ((__vector_size__ (8))); void test1() { __v4hi A = (__v4hi)0LL; } __v4hi x = {1,2,3}; __v4hi y = {1,2,3,4}; typedef int vty __attribute((vector_size(16))); int test2() { vty b; return b[2LL]; } // PR4339 typedef float vec4 __attribute__((vector_size(16))); void test3 ( vec4* a, char b, float c ) { (*a)[b] = c; } #include <mmintrin.h> int test4(int argc, char *argv[]) { int array[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; __m64 *p = (__m64 *)array; __m64 accum = _mm_setzero_si64(); for (int i=0; i<8; ++i) accum = _mm_add_pi32(p[i], accum); __m64 accum2 = _mm_unpackhi_pi32(accum, accum); accum = _mm_add_pi32(accum, accum2); int result = _mm_cvtsi64_si32(accum); _mm_empty(); return result; }
/* exynos_drm_crtc.h * * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Authors: * Inki Dae <inki.dae@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com> * * 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 (including the next * paragraph) 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 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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. */ #ifndef _EXYNOS_DRM_CRTC_H_ #define _EXYNOS_DRM_CRTC_H_ #include "drmP.h" #include "drm.h" #include "drm_crtc.h" struct exynos_drm_display; struct exynos_drm_overlay; int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr, struct exynos_drm_display *display); int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); void exynos_drm_overlay_disable(struct drm_crtc *crtc, int zpos); void exynos_drm_crtc_apply(struct drm_crtc *crtc, struct exynos_drm_overlay *overlay); void exynos_drm_crtc_finish_pageflip(struct drm_device *drm_dev, int crtc_idx); /* * Exynos specific crtc postion structure. * * @fb_x: offset x on a framebuffer to be displyed * - the unit is screen coordinates. * @fb_y: offset y on a framebuffer to be displayed * - the unit is screen coordinates. * @fb_w: width of a framebuffer to be displayed * - the unit is screen coordinates. * @fb_h: height of a framebuffer to be displayed * - the unit is screen coordinates. * @crtc_x: offset x on hardware screen. * @crtc_y: offset y on hardware screen. * @crtc_w: width of hardware screen. * @crtc_h: height of hardware screen. */ struct exynos_drm_crtc_pos { unsigned int fb_x; unsigned int fb_y; unsigned int fb_w; unsigned int fb_h; unsigned int crtc_x; unsigned int crtc_y; unsigned int crtc_w; unsigned int crtc_h; }; void exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, struct drm_framebuffer *fb, struct drm_display_mode *mode, struct exynos_drm_crtc_pos *pos); void exynos_drm_kds_callback(void *callback_parameter, void *callback_extra_parameter); #endif
/* * linux/drivers/mmc/mmc_pxa.h * * Author: Vladimir Shebordaev, Igor Oblakov * Copyright: MontaVista Software Inc. * * $Id: mmc.h,v 1.1 2009/04/26 18:23:44 rhabarber1848 Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __MMC_PPC4XX_H__ #define __MMC_PPC4XX_H__ #endif /* __MMC_PPC4XX_H__ */
/* This file is part of the KDE libraries * Copyright (C) 1999 Waldo Bastian <bastian@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation; * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #ifndef __ksycocadict_h__ #define __ksycocadict_h__ #include <qstring.h> #include <qvaluelist.h> #include <qdatastream.h> #include "kdelibs_export.h" class KSycocaEntry; class KSycocaDictStringList; /** * @internal * Hash table implementation for the sycoca database file */ class KDECORE_EXPORT KSycocaDict { public: /** * Create an empty dict, for building the database */ KSycocaDict(); /** * Create a dict from an existing database */ KSycocaDict(QDataStream *str, int offset); ~KSycocaDict(); /** * Adds a 'payload' to the dictionary with key 'key'. * * 'payload' should have a valid offset by the time * the dictionary gets saved. **/ void add(const QString &key, KSycocaEntry *payload); /** * Removes the 'payload' from the dictionary with key 'key'. * * Not very fast, use with care O(N) **/ void remove(const QString &key); /** * Looks up an entry identified by 'key'. * * If 0 is returned, no matching entry exists. * Otherwise, the offset of the entry is returned. * * NOTE: It is not guaranteed that this entry is * indeed the one you were looking for. * After loading the entry you should check that it * indeed matches the search key. If it doesn't * then no matching entry exists. */ int find_string(const QString &key ); /** * The number of entries in the dictionary. * * Only valid when building the database. */ uint count(); /** * Reset the dictionary. * * Only valid when building the database. */ void clear(); /** * Save the dictionary to the stream * A reasonable fast hash algorithm will be created. * * Typically this will find 90% of the entries directly. * Average hash table size: nrOfItems * 20 bytes. * Average duplicate list size: nrOfItms * avgKeyLength / 5. * * Unknown keys have an average 20% chance to give a false hit. * (That's why your program should check the result) * * Example: * Assume 1000 items with an average key length of 60 bytes. * * Approx. 900 items will hash directly to the right entry. * Approx. 100 items require a lookup in the duplicate list. * * The hash table size will be approx. 20Kb. * The duplicate list size will be approx. 12Kb. **/ void save(QDataStream &str); protected: Q_UINT32 hashKey( const QString &); private: KSycocaDictStringList *d; QDataStream *mStr; Q_INT32 mOffset; Q_UINT32 mHashTableSize; QValueList<Q_INT32> mHashList; }; #endif
/***************************************************************************/ /* * linux/arch/m68knommu/platform/5272/config.c * * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com) */ /***************************************************************************/ #include <linux/kernel.h> #include <linux/param.h> #include <linux/init.h> #include <linux/io.h> #include <linux/phy.h> #include <linux/phy_fixed.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> #include <asm/mcfuart.h> /***************************************************************************/ /* * Some platforms need software versions of the GPIO data registers. */ unsigned short ppdata; unsigned char ledbank = 0xff; /***************************************************************************/ static struct mcf_platform_uart m5272_uart_platform[] = { { .mapbase = MCF_MBAR + MCFUART_BASE1, .irq = MCF_IRQ_UART1, }, { .mapbase = MCF_MBAR + MCFUART_BASE2, .irq = MCF_IRQ_UART2, }, { }, }; static struct platform_device m5272_uart = { .name = "mcfuart", .id = 0, .dev.platform_data = m5272_uart_platform, }; static struct resource m5272_fec_resources[] = { { .start = MCF_MBAR + 0x840, .end = MCF_MBAR + 0x840 + 0x1cf, .flags = IORESOURCE_MEM, }, { .start = MCF_IRQ_ERX, .end = MCF_IRQ_ERX, .flags = IORESOURCE_IRQ, }, { .start = MCF_IRQ_ETX, .end = MCF_IRQ_ETX, .flags = IORESOURCE_IRQ, }, { .start = MCF_IRQ_ENTC, .end = MCF_IRQ_ENTC, .flags = IORESOURCE_IRQ, }, }; static struct platform_device m5272_fec = { .name = "fec", .id = 0, .num_resources = ARRAY_SIZE(m5272_fec_resources), .resource = m5272_fec_resources, }; static struct platform_device *m5272_devices[] __initdata = { &m5272_uart, &m5272_fec, }; /***************************************************************************/ static void __init m5272_uart_init_line(int line, int irq) { u32 v; if ((line >= 0) && (line < 2)) { /* Enable the output lines for the serial ports */ v = readl(MCF_MBAR + MCFSIM_PBCNT); v = (v & ~0x000000ff) | 0x00000055; writel(v, MCF_MBAR + MCFSIM_PBCNT); v = readl(MCF_MBAR + MCFSIM_PDCNT); v = (v & ~0x000003fc) | 0x000002a8; writel(v, MCF_MBAR + MCFSIM_PDCNT); } } static void __init m5272_uarts_init(void) { const int nrlines = ARRAY_SIZE(m5272_uart_platform); int line; for (line = 0; (line < nrlines); line++) m5272_uart_init_line(line, m5272_uart_platform[line].irq); } /***************************************************************************/ static void m5272_cpu_reset(void) { local_irq_disable(); /* Set watchdog to reset, and enabled */ __raw_writew(0, MCF_MBAR + MCFSIM_WIRR); __raw_writew(1, MCF_MBAR + MCFSIM_WRRR); __raw_writew(0, MCF_MBAR + MCFSIM_WCR); for (;;) /* wait for watchdog to timeout */; } /***************************************************************************/ void __init config_BSP(char *commandp, int size) { #if defined (CONFIG_MOD5272) volatile unsigned char *pivrp; /* Set base of device vectors to be 64 */ pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR); *pivrp = 0x40; #endif #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0004000, size); commandp[size-1] = 0; #elif defined(CONFIG_CANCam) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0010000, size); commandp[size-1] = 0; #endif mach_reset = m5272_cpu_reset; } /***************************************************************************/ /* * Some 5272 based boards have the FEC ethernet diectly connected to * an ethernet switch. In this case we need to use the fixed phy type, * and we need to declare it early in boot. */ static struct fixed_phy_status nettel_fixed_phy_status __initdata = { .link = 1, .speed = 100, .duplex = 0, }; /***************************************************************************/ static int __init init_BSP(void) { m5272_uarts_init(); fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status); platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices)); return 0; } arch_initcall(init_BSP); /***************************************************************************/
#if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 SMI"; #endif /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Copyright (c) 1988 by Sun Microsystems, Inc. */ /* * rtime - get time from remote machine * * gets time, obtaining value from host * on the udp/time socket. Since timeserver returns * with time of day in seconds since Jan 1, 1900, must * subtract seconds before Jan 1, 1970 to get * what unix uses. */ #include <stdio.h> #include <unistd.h> #include <rpc/rpc.h> #include <rpc/clnt.h> #include <sys/types.h> #include <sys/poll.h> #include <sys/socket.h> #include <sys/time.h> #include <rpc/auth_des.h> #include <errno.h> #include <netinet/in.h> #define NYEARS (u_long)(1970 - 1900) #define TOFFSET (u_long)(60*60*24*(365*NYEARS + (NYEARS/4))) int __socket (int domain, int type, int proto); int __close (int fd); int __read (int fd, void *buf, size_t size); int __connect (int fd, struct sockaddr *addr, size_t addrlen); static void do_close (int); static void do_close (int s) { int save; save = errno; __close (s); __set_errno (save); } int rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep, struct rpc_timeval *timeout) { int s; struct pollfd fd; int milliseconds; int res; unsigned long thetime; struct sockaddr_in from; int fromlen; int type; if (timeout == NULL) type = SOCK_STREAM; else type = SOCK_DGRAM; s = __socket (AF_INET, type, 0); if (s < 0) return (-1); addrp->sin_family = AF_INET; addrp->sin_port = htons (IPPORT_TIMESERVER); if (type == SOCK_DGRAM) { res = sendto (s, (char *) &thetime, sizeof (thetime), 0, (struct sockaddr *) addrp, sizeof (*addrp)); if (res < 0) { do_close (s); return -1; } milliseconds = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); fd.fd = s; fd.events = POLLIN; do res = __poll (&fd, 1, milliseconds); while (res < 0 && errno == EINTR); if (res <= 0) { if (res == 0) __set_errno (ETIMEDOUT); do_close (s); return (-1); } fromlen = sizeof (from); res = recvfrom (s, (char *) &thetime, sizeof (thetime), 0, (struct sockaddr *) &from, &fromlen); do_close (s); if (res < 0) return -1; } else { if (__connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0) { do_close (s); return -1; } res = __read (s, (char *) &thetime, sizeof (thetime)); do_close (s); if (res < 0) return (-1); } if (res != sizeof (thetime)) { __set_errno (EIO); return -1; } thetime = ntohl (thetime); timep->tv_sec = thetime - TOFFSET; timep->tv_usec = 0; return 0; }
/* * $Id: store_swapmeta.c,v 1.21 2006/07/29 14:44:49 hno Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ #include "squid.h" static tlv ** storeSwapTLVAdd(int type, const void *ptr, size_t len, tlv ** tail) { tlv *t = memAllocate(MEM_TLV); t->type = (char) type; t->length = (int) len; t->value = xmalloc(len); xmemcpy(t->value, ptr, len); *tail = t; return &t->next; /* return new tail pointer */ } void storeSwapTLVFree(tlv * n) { tlv *t; while ((t = n) != NULL) { n = t->next; xfree(t->value); memFree(t, MEM_TLV); } } /* * Build a TLV list for a StoreEntry */ tlv * storeSwapMetaBuild(StoreEntry * e) { tlv *TLV = NULL; /* we'll return this */ tlv **T = &TLV; const char *url; const char *vary; const squid_off_t objsize = objectLen(e); assert(e->mem_obj != NULL); assert(e->swap_status == SWAPOUT_WRITING); url = storeUrl(e); debug(20, 3) ("storeSwapMetaBuild: %s\n", url); T = storeSwapTLVAdd(STORE_META_KEY, e->hash.key, MD5_DIGEST_CHARS, T); #if SIZEOF_SQUID_FILE_SZ == SIZEOF_SIZE_T T = storeSwapTLVAdd(STORE_META_STD, &e->timestamp, STORE_HDR_METASIZE, T); #else T = storeSwapTLVAdd(STORE_META_STD_LFS, &e->timestamp, STORE_HDR_METASIZE, T); #endif T = storeSwapTLVAdd(STORE_META_URL, url, strlen(url) + 1, T); if (objsize > -1) { T = storeSwapTLVAdd(STORE_META_OBJSIZE, &objsize, sizeof(objsize), T); } vary = e->mem_obj->vary_headers; if (vary) T = storeSwapTLVAdd(STORE_META_VARY_HEADERS, vary, strlen(vary) + 1, T); return TLV; } char * storeSwapMetaPack(tlv * tlv_list, int *length) { int buflen = 0; tlv *t; int j = 0; char *buf; assert(length != NULL); buflen++; /* STORE_META_OK */ buflen += sizeof(int); /* size of header to follow */ for (t = tlv_list; t; t = t->next) buflen += sizeof(char) + sizeof(int) + t->length; buf = xmalloc(buflen); buf[j++] = (char) STORE_META_OK; xmemcpy(&buf[j], &buflen, sizeof(int)); j += sizeof(int); for (t = tlv_list; t; t = t->next) { buf[j++] = (char) t->type; xmemcpy(&buf[j], &t->length, sizeof(int)); j += sizeof(int); xmemcpy(&buf[j], t->value, t->length); j += t->length; } assert((int) j == buflen); *length = buflen; return buf; } tlv * storeSwapMetaUnpack(const char *buf, int *hdr_len) { tlv *TLV = NULL; /* we'll return this */ tlv **T = &TLV; char type; int length; int buflen; int j = 0; assert(buf != NULL); assert(hdr_len != NULL); if (buf[j++] != (char) STORE_META_OK) return NULL; xmemcpy(&buflen, &buf[j], sizeof(int)); j += sizeof(int); /* * sanity check on 'buflen' value. It should be at least big * enough to hold one type and one length. */ if (buflen <= (sizeof(char) + sizeof(int))) return NULL; while (buflen - j >= (sizeof(char) + sizeof(int))) { type = buf[j++]; /* VOID is reserved, but allow some slack for new types.. */ if (type <= STORE_META_VOID || type > STORE_META_END + 10) { debug(20, 0) ("storeSwapMetaUnpack: bad type (%d)!\n", type); break; } xmemcpy(&length, &buf[j], sizeof(int)); if (length < 0 || length > (1 << 16)) { debug(20, 0) ("storeSwapMetaUnpack: insane length (%d)!\n", length); break; } j += sizeof(int); if (j + length > buflen) { debug(20, 0) ("storeSwapMetaUnpack: overflow!\n"); debug(20, 0) ("\ttype=%d, length=%d, buflen=%d, offset=%d\n", type, length, buflen, (int) j); break; } T = storeSwapTLVAdd(type, &buf[j], (size_t) length, T); j += length; } *hdr_len = buflen; return TLV; }
/********************************************************************** This file is part of the Quantum Computation Language QCL. (c) Copyright by Bernhard Oemer <oemer@tph.tuwien.ac.at>, 1998 This program comes without any warranty; without even the implied warranty of merchantability or fitness for any particular purpose. This program is free software under the terms of the GNU General Public Licence (GPL) version 2 or higher ************************************************************************/ #ifndef EXTERN_H #define EXTERN_H 1 #pragma interface #include <string> #include "types.h" /* class QuBaseState : public quBaseState { public: QuBaseState(int n) : quBaseState(n) { } }; */ struct RoutTableEntry { tExtRout *rout; std::string id; }; extern RoutTableEntry ExtRoutTable[]; #endif
/* * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. * All rights reserved * www.brocade.com * * Linux driver for Brocade Fibre Channel Host Bus Adapter. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License (GPL) 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 __BFA_DEFS_VF_H__ #define __BFA_DEFS_VF_H__ #include <bfa_os_inc.h> #include <defs/bfa_defs_port.h> #include <protocol/types.h> /** * VF states */ enum bfa_vf_state { BFA_VF_UNINIT = 0, /* fabric is not yet initialized */ BFA_VF_LINK_DOWN = 1, /* link is down */ BFA_VF_FLOGI = 2, /* flogi is in progress */ BFA_VF_AUTH = 3, /* authentication in progress */ BFA_VF_NOFABRIC = 4, /* fabric is not present */ BFA_VF_ONLINE = 5, /* login to fabric is complete */ BFA_VF_EVFP = 6, /* EVFP is in progress */ BFA_VF_ISOLATED = 7, /* port isolated due to vf_id mismatch */ }; /** * VF statistics */ struct bfa_vf_stats_s { u32 flogi_sent; /* Num FLOGIs sent */ u32 flogi_rsp_err; /* FLOGI response errors */ u32 flogi_acc_err; /* FLOGI accept errors */ u32 flogi_accepts; /* FLOGI accepts received */ u32 flogi_rejects; /* FLOGI rejects received */ u32 flogi_unknown_rsp; /* Unknown responses for FLOGI */ u32 flogi_alloc_wait; /* Allocation wait * prior to sending FLOGI */ u32 flogi_rcvd; /* FLOGIs received */ u32 flogi_rejected; /* Incoming FLOGIs rejected */ u32 fabric_onlines; /* Internal fabric online notification * sent to other modules */ u32 fabric_offlines; /* Internal fabric offline notification * sent to other modules */ u32 resvd; /* padding for 64 bit alignment */ }; /** * VF attributes returned in queries */ struct bfa_vf_attr_s { enum bfa_vf_state state; /* VF state */ u32 rsvd; wwn_t fabric_name; /* fabric name */ }; #endif /* __BFA_DEFS_VF_H__ */
/* * arch/arm/mach-tegra/board-smba1002-wlan.c * * Copyright (C) 2011 Eduardo José Tagle <ejtagle@tutopia.com> * * 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/console.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/platform_data/tegra_usb.h> #include <linux/gpio.h> #include <linux/delay.h> #include <linux/reboot.h> #include <linux/memblock.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> #include <asm/setup.h> #include <mach/io.h> #include <mach/iomap.h> #include <mach/irqs.h> #include <mach/nand.h> #include <mach/iomap.h> #include "board.h" #include "board-smba1002.h" #include "clock.h" #include "gpio-names.h" #include "devices.h" static struct platform_device smba_wlan_pm_device = { .name = "smba-pm-wlan", .id = -1, }; static struct platform_device *smba_wlan_pm_devices[] __initdata = { &smba_wlan_pm_device, }; int __init smba_wlan_pm_register_devices(void) { return platform_add_devices(smba_wlan_pm_devices, ARRAY_SIZE(smba_wlan_pm_devices)); }
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * Mate Nibbles: Mate Worm Game * Written by Sean MacIsaac <sjm@acm.org>, Ian Peters <itp@gnu.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PROPERTIES_H_ #define _PROPERTIES_H_ #include <config.h> #include <gtk/gtk.h> #include "gnibbles.h" #define KEY_PREFERENCES_GROUP "preferences" #define KEY_NUM_WORMS "players" #define KEY_NUM_AI "ai" #define KEY_SPEED "speed" #define KEY_FAKES "fakes" #define KEY_RANDOM "random" #define KEY_START_LEVEL "start_level" #define KEY_SOUND "sound" #define KEY_TILE_SIZE "tile_size" #define KEY_WORM_DIR "worm/%d" #define KEY_WORM_COLOR "worm/%d/color" #define KEY_WORM_REL_MOVE "worm/%d/move_relative" #define KEY_WORM_UP "worm/%d/key_up" #define KEY_WORM_DOWN "worm/%d/key_down" #define KEY_WORM_LEFT "worm/%d/key_left" #define KEY_WORM_RIGHT "worm/%d/key_right" typedef struct { gint color; gboolean relmove; guint up, down, left, right; } GnibblesWormProps; typedef struct { gint numworms; gint human; gint ai; gint gamespeed; gint fakes; gint random; gint startlevel; gint sound; gint tilesize; GnibblesWormProps *wormprops[NUMWORMS]; gulong conf_notify_id; } GnibblesProperties; GnibblesProperties *gnibbles_properties_new (void); void gnibbles_properties_update (GnibblesProperties * tmp); void gnibbles_properties_destroy (GnibblesProperties * props); void gnibbles_properties_set_worms_number (gint value); void gnibbles_properties_set_ai_number (gint value); void gnibbles_properties_set_speed (gint value); void gnibbles_properties_set_fakes (gboolean value); void gnibbles_properties_set_random (gboolean value); void gnibbles_properties_set_start_level (gint value); void gnibbles_properties_set_sound (gboolean value); void gnibbles_properties_set_tile_size (gint value); void gnibbles_properties_set_worm_relative_movement (gint i, gboolean value); void gnibbles_properties_set_worm_color (gint i, gint value); void gnibbles_properties_set_worm_up (gint i, gchar * value); void gnibbles_properties_set_worm_down (gint i, gchar * value); void gnibbles_properties_set_worm_left (gint i, gchar * value); void gnibbles_properties_set_worm_right (gint i, gchar * value); void gnibbles_properties_save (GnibblesProperties * props); gchar *colorval_name (gint colorval); #endif
/* * This file is part of ePipe * Copyright (C) 2019, Logical Clocks AB. All rights reserved * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DATASETPROJECTCACHE_H #define DATASETPROJECTCACHE_H #include "Cache.h" #include "Utils.h" #include "tables/DBTableBase.h" /* * Key1(DatasetIId) -> Key2(ProjectId)- OneToOne relation - parent relation * Key2(ProjectId) -> Key1(DatasetIID) - OneToMany relation - child relation */ class DatasetProjectCache { public: typedef boost::unordered_set<int> PCKSet; DatasetProjectCache(int lru_cap, const char* prefix) : mDatasets(lru_cap, prefix), mProjects(lru_cap, prefix), mDatasetValues(lru_cap, prefix){ } void add(Int64 datasetIId, int projectId, std::string datasetName) { mDatasets.put(datasetIId, projectId); if (!mProjects.contains(projectId)) { mProjects.put(projectId, new PCKSet()); } mProjects.get(projectId).get()->insert(datasetIId); mDatasetValues.put(datasetIId, datasetName); LOG_TRACE("Added Key[" << datasetIId << "," << projectId << "] and Value[" << datasetName << "]"); } boost::optional<int> getParentProject(Int64 datasetIId) { return mDatasets.get(datasetIId); } PCKSet getChildrenDatasets(int projectId) { PCKSet keys; PCKSet* keysInCache = getKeysInternal(projectId); if (keysInCache != NULL) { keys.insert(keysInCache->begin(), keysInCache->end()); } return keys; } boost::optional<std::string> getDatasetValue(Int64 datasetIId) { boost::optional<std::string> val = mDatasetValues.get(datasetIId); if(val) { LOG_INFO("dataset:" << datasetIId << " val:" << val.get()); } else { LOG_INFO("dataset:" << datasetIId << " no val"); } return val; } void removeDataset(Int64 datasetIId) { boost::optional<int> projectId = getParentProject(datasetIId); mDatasets.remove(datasetIId); if (projectId) { PCKSet* keysInCache = getKeysInternal(projectId.get()); if (keysInCache != NULL) { keysInCache->erase(datasetIId); } } mDatasetValues.remove(datasetIId); LOG_TRACE("REMOVE Dataset[" << datasetIId << "]"); } PCKSet removeProject(int projectId) { PCKSet keys = getChildrenDatasets(projectId); for (typename PCKSet::iterator it = keys.begin(); it != keys.end(); ++it) { Int64 datasetIId = *it; removeDataset(datasetIId); } return keys; } bool containsDataset(Int64 datasetIId) { return mDatasets.contains(datasetIId); } private: Cache<Int64, int> mDatasets; Cache<int, PCKSet*> mProjects; Cache<Int64, std::string> mDatasetValues; PCKSet* getKeysInternal(int projectId) { boost::optional<PCKSet*> res = mProjects.get(projectId); if (!res) { LOG_TRACE("Datasets not in the cache for Project[" << projectId << "]"); return NULL; } return *res; } }; #endif /* DATASETPROJECTCACHE_H */
/* * Copyright (c) 2007 NVIDIA Corporation. All rights reserved. * * NVIDIA Corporation and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation * and any modifications thereto. Any use, reproduction, disclosure or * distribution of this software and related documentation without an express * license agreement from NVIDIA Corporation is strictly prohibited. */ #ifndef INCLUDED_NVMM_M2V_PARSER_CORE_H #define INCLUDED_NVMM_M2V_PARSER_CORE_H #include "nvmm_parser_core.h" NvError NvMMCreateM2vCoreParser( NvMMParserCoreHandle *hParserCore, NvMMParserCoreCreationParameters *pParams); void NvMMDestroyM2vCoreParser(NvMMParserCoreHandle hParserCore); #endif // INCLUDED_NVMM_AMR_PARSER_CORE_H
/* * Vectors.c * * Generic vectors and security for Coldfire Vx * * Created on: 07/12/2012 * Author: podonoghue */ #include <stdint.h> #define $(targetDeviceSubFamily) /* * Security information */ typedef struct { uint8_t backdoorKey[8]; uint32_t cfmprot; uint32_t cfmsacc; uint32_t cfmdacc; uint32_t cfmsec; } SecurityInfo; __attribute__ ((section(".security_information"))) const SecurityInfo securityInfo = { /* backdoor */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* cfmprot */ 0x00000000, /* cfmsacc */ 0x00000000, /* cfmdacc */ 0x00000000, /* cfmsec */ 0x00000000, /* KEYEN=0,SEC=0x0000 (SEC=0x4AC8 protects device) */ }; /* * Vector table related */ typedef void( *const intfunc )( void ); #define WEAK_DEFAULT_HANDLER __attribute__ ((weak, alias("Default_Handler"))) __attribute__((__interrupt__)) void Default_Handler(void) { while (1) { __asm__("halt"); } } void __HardReset(void) __attribute__((__interrupt__)); extern uint32_t __StackTop; /* * Each vector is assigned an unique name. This is then 'weakly' assigned to the * default handler. * To install a handler, create a function with the name shown and it will override * the weak default. */ $(cVectorTable)
/* bytes_view.h * * $Id: bytes_view.h 50095 2013-06-20 23:28:35Z darkjames $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. */ #ifndef __BYTES_VIEW_H__ #define __BYTES_VIEW_H__ #define BYTES_VIEW_TYPE (bytes_view_get_type()) #define BYTES_VIEW(object) (G_TYPE_CHECK_INSTANCE_CAST((object), BYTES_VIEW_TYPE, BytesView)) #define BYTE_VIEW_HIGHLIGHT_APPENDIX 1 #define BYTE_VIEW_HIGHLIGHT_PROTOCOL 2 typedef struct _BytesView BytesView; GType bytes_view_get_type(void); GtkWidget *bytes_view_new(void); void bytes_view_set_font(BytesView *bv, PangoFontDescription *font); void bytes_view_set_data(BytesView *bv, const guint8 *data, int len); void bytes_view_set_encoding(BytesView *bv, int enc); void bytes_view_set_format(BytesView *bv, int format); void bytes_view_set_highlight_style(BytesView *bv, gboolean bold); void bytes_view_set_highlight(BytesView *bv, int start, int end, guint32 mask, int maskle); void bytes_view_set_highlight_extra(BytesView *bv, int id, int start, int end); void bytes_view_refresh(BytesView *bv); int bytes_view_byte_from_xy(BytesView *bv, int x, int y); void bytes_view_scroll_to_byte(BytesView *bv, int byte); #endif /* __BYTES_VIEW_H__ */
/* Rconfig.h. Generated automatically */ #ifndef R_RCONFIG_H #define R_RCONFIG_H #ifndef R_CONFIG_H #define HAVE_F77_UNDERSCORE 1 /* all R platforms have this */ #define IEEE_754 1 /* #undef WORDS_BIGENDIAN */ #define R_INLINE inline #define HAVE_VISIBILITY_ATTRIBUTE 1 /* all R platforms have the next two */ #define SUPPORT_UTF8 1 #define SUPPORT_MBCS 1 #define ENABLE_NLS 0 /* #undef HAVE_AQUA */ #define SUPPORT_OPENMP 1 #define SIZEOF_SIZE_T 8 #define HAVE_ALLOCA_H 1 #endif /* not R_CONFIG_H */ #endif /* not R_RCONFIG_H */
/* * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> * * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 TRINITY_TYPECONTAINER_H #define TRINITY_TYPECONTAINER_H /* * Here, you'll find a series of containers that allow you to hold multiple * types of object at the same time. */ #include <map> #include <vector> #include "Platform/Define.h" #include "Utilities/TypeList.h" #include "GameSystem/GridRefManager.h" /* * @class ContainerMapList is a mulit-type container for map elements * By itself its meaningless but collaborate along with TypeContainers, * it become the most powerfully container in the whole system. */ template<class OBJECT> struct ContainerMapList { //std::map<OBJECT_HANDLE, OBJECT *> _element; GridRefManager<OBJECT> _element; }; template<> struct ContainerMapList<TypeNull> /* nothing is in type null */ { }; template<class H, class T> struct ContainerMapList<TypeList<H, T> > { ContainerMapList<H> _elements; ContainerMapList<T> _TailElements; }; /* * @class ContaierArrayList is a multi-type container for * array of elements. */ template<class OBJECT> struct ContainerArrayList { std::vector<OBJECT> _element; }; // termination condition template<> struct ContainerArrayList<TypeNull> {}; // recursion template<class H, class T> struct ContainerArrayList<TypeList<H, T> > { ContainerArrayList<H> _elements; ContainerArrayList<T> _TailElements; }; /* * @class ContainerList is a simple list of different types of elements * */ template<class OBJECT> struct ContainerList { OBJECT _element; }; /* TypeNull is underfined */ template<> struct ContainerList<TypeNull> {}; template<class H, class T> struct ContainerList<TypeList<H, T> > { ContainerList<H> _elements; ContainerMapList<T> _TailElements; }; #include "TypeContainerFunctions.h" /* * @class TypeMapContainer contains a fixed number of types and is * determined at compile time. This is probably the most complicated * class and do its simplest thing, that is, holds objects * of different types. */ template<class OBJECT_TYPES> class TRINITY_DLL_DECL TypeMapContainer { public: template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); } template<class SPECIFIC_TYPE> SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) { return Trinity::Find(i_elements, hdl,fake); } /// find a specific type of object in the container template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) const { return Trinity::Find(i_elements, hdl,fake); } /// inserts a specific object into the container template<class SPECIFIC_TYPE> bool insert(OBJECT_HANDLE hdl, SPECIFIC_TYPE *obj) { SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj, hdl); return (t != NULL); } /// Removes the object from the container, and returns the removed object template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj, OBJECT_HANDLE hdl) { SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj, hdl); return (t != NULL); } ContainerMapList<OBJECT_TYPES> & GetElements(void) { return i_elements; } const ContainerMapList<OBJECT_TYPES> & GetElements(void) const { return i_elements;} private: ContainerMapList<OBJECT_TYPES> i_elements; }; #endif
/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. * * 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. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __PORTAB__ #define __PORTAB__ /** * @file * Portability functions and declarations (header) */ #include "config.h" #ifndef DEBUG # define NDEBUG #endif /* compiler features */ #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)) # define PUNUSED(x) __attribute__ ((unused)) x # define UNUSED __attribute__ ((unused)) #else # define PUNUSED(x) x # define UNUSED #endif #ifndef PARAMS # if PROTOTYPES # define PARAMS(args) args # else # define PARAMS(args) () # endif #endif /* datatypes */ #include <sys/types.h> #ifdef HAVE_STDDEF_H # include <stddef.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> # define NGIRC_GOT_INTTYPES #else # ifdef HAVE_STDINT_H # include <stdint.h> # define NGIRC_GOT_INTTYPES # endif #endif #ifndef PROTOTYPES # ifndef signed # define signed # endif #endif typedef void POINTER; #ifdef NGIRC_GOT_INTTYPES typedef uint8_t UINT8; typedef uint16_t UINT16; typedef uint32_t UINT32; #else typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; #endif #ifdef HAVE_STDBOOL_H # include <stdbool.h> #else typedef unsigned char bool; # define true (bool)1 # define false (bool)0 #endif #ifndef NULL # ifdef PROTOTYPES # define NULL (void *)0 # else # define NULL 0L # endif #endif #ifdef NeXT # define S_IRUSR 0000400 /* read permission, owner */ # define S_IWUSR 0000200 /* write permission, owner */ # define S_IRGRP 0000040 /* read permission, group */ # define S_IROTH 0000004 /* read permission, other */ # define ssize_t int #endif #undef GLOBAL #ifdef GLOBAL_INIT #define GLOBAL #else #define GLOBAL extern #endif /* SPLint */ #ifdef S_SPLINT_S # include "splint.h" #endif /* target constants */ #ifndef HOST_OS # define HOST_OS "unknown" #endif #ifndef HOST_CPU # define HOST_CPU "unknown" #endif #ifndef HOST_VENDOR # define HOST_VENDOR "unknown" #endif #ifdef __HAIKU__ # define SINGLE_USER_OS #endif /* configure options */ #ifndef HAVE_socklen_t typedef int socklen_t; /* for Mac OS X, amongst others */ #endif #ifndef HAVE_SNPRINTF extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... )); #endif #ifndef HAVE_STRLCAT extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_STRLCPY extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_STRDUP extern char * strdup PARAMS(( const char *s )); #endif #ifndef HAVE_STRNDUP extern char * strndup PARAMS((const char *s, size_t maxlen)); #endif #ifndef HAVE_STRTOK_R extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr)); #endif #ifndef HAVE_VSNPRINTF #include <stdarg.h> extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args )); #endif #ifndef HAVE_GAI_STRERROR # define gai_strerror(r) "unknown error" #endif #ifndef PACKAGE_NAME # define PACKAGE_NAME PACKAGE #endif #ifndef PACKAGE_VERSION # define PACKAGE_VERSION VERSION #endif #ifndef SYSCONFDIR # define SYSCONFDIR "/etc" #endif #endif /* -eof- */
/****************************************************************************** * <<<<<<< HEAD * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. ======= * Copyright(c) 2007 - 2010 Intel Corporation. All rights reserved. >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a * * Portions of this file are derived from the ipw3945 project, as well * as portions of the ieee80211 subsystem header files. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * Intel Linux Wireless <ilw@linux.intel.com> * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *****************************************************************************/ #ifndef __iwl_power_setting_h__ #define __iwl_power_setting_h__ #include "iwl-commands.h" <<<<<<< HEAD ======= #define IWL_ABSOLUTE_ZERO 0 #define IWL_ABSOLUTE_MAX 0xFFFFFFFF #define IWL_TT_INCREASE_MARGIN 5 #define IWL_TT_CT_KILL_MARGIN 3 enum iwl_antenna_ok { IWL_ANT_OK_NONE, IWL_ANT_OK_SINGLE, IWL_ANT_OK_MULTI, }; /* Thermal Throttling State Machine states */ enum iwl_tt_state { IWL_TI_0, /* normal temperature, system power state */ IWL_TI_1, /* high temperature detect, low power state */ IWL_TI_2, /* higher temperature detected, lower power state */ IWL_TI_CT_KILL, /* critical temperature detected, lowest power state */ IWL_TI_STATE_MAX }; /** * struct iwl_tt_restriction - Thermal Throttling restriction table * @tx_stream: number of tx stream allowed * @is_ht: ht enable/disable * @rx_stream: number of rx stream allowed * * This table is used by advance thermal throttling management * based on the current thermal throttling state, and determines * the number of tx/rx streams and the status of HT operation. */ struct iwl_tt_restriction { enum iwl_antenna_ok tx_stream; enum iwl_antenna_ok rx_stream; bool is_ht; }; /** * struct iwl_tt_trans - Thermal Throttling transaction table * @next_state: next thermal throttling mode * @tt_low: low temperature threshold to change state * @tt_high: high temperature threshold to change state * * This is used by the advanced thermal throttling algorithm * to determine the next thermal state to go based on the * current temperature. */ struct iwl_tt_trans { enum iwl_tt_state next_state; u32 tt_low; u32 tt_high; }; /** * struct iwl_tt_mgnt - Thermal Throttling Management structure * @advanced_tt: advanced thermal throttle required * @state: current Thermal Throttling state * @tt_power_mode: Thermal Throttling power mode index * being used to set power level when * when thermal throttling state != IWL_TI_0 * the tt_power_mode should set to different * power mode based on the current tt state * @tt_previous_temperature: last measured temperature * @iwl_tt_restriction: ptr to restriction tbl, used by advance * thermal throttling to determine how many tx/rx streams * should be used in tt state; and can HT be enabled or not * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling * state transaction * @ct_kill_toggle: used to toggle the CSR bit when checking uCode temperature * @ct_kill_exit_tm: timer to exit thermal kill */ struct iwl_tt_mgmt { enum iwl_tt_state state; bool advanced_tt; u8 tt_power_mode; bool ct_kill_toggle; #ifdef CONFIG_IWLWIFI_DEBUG s32 tt_previous_temp; #endif struct iwl_tt_restriction *restriction; struct iwl_tt_trans *transaction; struct timer_list ct_kill_exit_tm; struct timer_list ct_kill_waiting_tm; }; >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a enum iwl_power_level { IWL_POWER_INDEX_1, IWL_POWER_INDEX_2, IWL_POWER_INDEX_3, IWL_POWER_INDEX_4, IWL_POWER_INDEX_5, IWL_POWER_NUM }; struct iwl_power_mgr { struct iwl_powertable_cmd sleep_cmd; <<<<<<< HEAD struct iwl_powertable_cmd sleep_cmd_next; ======= >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a int debug_sleep_level_override; bool pci_pm; }; <<<<<<< HEAD int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, bool force); int iwl_power_update_mode(struct iwl_priv *priv, bool force); ======= int iwl_power_update_mode(struct iwl_priv *priv, bool force); bool iwl_ht_enabled(struct iwl_priv *priv); bool iwl_within_ct_kill_margin(struct iwl_priv *priv); enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv); enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv); void iwl_tt_enter_ct_kill(struct iwl_priv *priv); void iwl_tt_exit_ct_kill(struct iwl_priv *priv); void iwl_tt_handler(struct iwl_priv *priv); void iwl_tt_initialize(struct iwl_priv *priv); void iwl_tt_exit(struct iwl_priv *priv); >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a void iwl_power_initialize(struct iwl_priv *priv); extern bool no_sleep_autoadjust; #endif /* __iwl_power_setting_h__ */
/* * xen/arch/arm/platform_vexpress.c * * Versatile Express specific settings * * Stefano Stabellini <stefano.stabellini@eu.citrix.com> * Copyright (c) 2013 Citrix Systems. * * 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. */ #include <asm/platforms/vexpress.h> #include <asm/platform.h> #include <xen/mm.h> #include <xen/vmap.h> #define DCC_SHIFT 26 #define FUNCTION_SHIFT 20 #define SITE_SHIFT 16 #define POSITION_SHIFT 12 #define DEVICE_SHIFT 0 static inline int vexpress_ctrl_start(uint32_t *syscfg, int write, int function, int device) { int dcc = 0; /* DCC to access */ int site = 0; /* motherboard */ int position = 0; /* daughterboard */ uint32_t stat; /* set control register */ syscfg[V2M_SYS_CFGCTRL/4] = V2M_SYS_CFG_START | (write ? V2M_SYS_CFG_WRITE : 0) | (dcc << DCC_SHIFT) | (function << FUNCTION_SHIFT) | (site << SITE_SHIFT) | (position << POSITION_SHIFT) | (device << DEVICE_SHIFT); /* wait for complete flag to be set */ do { stat = syscfg[V2M_SYS_CFGSTAT/4]; dsb(); } while ( !(stat & V2M_SYS_CFG_COMPLETE) ); /* check error status and return error flag if set */ if ( stat & V2M_SYS_CFG_ERROR ) { printk(KERN_ERR "V2M SYS_CFGSTAT reported a configuration error\n"); return -1; } return 0; } int vexpress_syscfg(int write, int function, int device, uint32_t *data) { uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; set_fixmap(FIXMAP_MISC, V2M_SYS_MMIO_BASE >> PAGE_SHIFT, DEV_SHARED); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; /* clear the complete bit in the V2M_SYS_CFGSTAT status register */ syscfg[V2M_SYS_CFGSTAT/4] = 0; if ( write ) { /* write data */ syscfg[V2M_SYS_CFGDATA/4] = *data; if ( vexpress_ctrl_start(syscfg, write, function, device) < 0 ) goto out; } else { if ( vexpress_ctrl_start(syscfg, write, function, device) < 0 ) goto out; else /* read data */ *data = syscfg[V2M_SYS_CFGDATA/4]; } ret = 0; out: clear_fixmap(FIXMAP_MISC); return ret; } /* * TODO: Get base address from the device tree * See arm,vexpress-reset node */ static void vexpress_reset(void) { void __iomem *sp810; /* Use the SP810 system controller to force a reset */ sp810 = ioremap_nocache(SP810_ADDRESS, PAGE_SIZE); if ( !sp810 ) { dprintk(XENLOG_ERR, "Unable to map SP810\n"); return; } /* switch to slow mode */ iowritel(sp810, 0x3); dsb(); isb(); /* writing any value to SCSYSSTAT reg will reset the system */ iowritel(sp810 + 4, 0x1); dsb(); isb(); iounmap(sp810); } static const char * const vexpress_dt_compat[] __initdata = { "arm,vexpress", NULL }; static const struct dt_device_match vexpress_blacklist_dev[] __initconst = { /* Cache Coherent Interconnect */ DT_MATCH_COMPATIBLE("arm,cci-400"), DT_MATCH_COMPATIBLE("arm,cci-400-pmu"), /* Video device * TODO: remove it once memreserve is handled properly by Xen */ DT_MATCH_COMPATIBLE("arm,hdlcd"), /* Hardware power management */ DT_MATCH_COMPATIBLE("arm,vexpress-reset"), DT_MATCH_COMPATIBLE("arm,vexpress-reboot"), DT_MATCH_COMPATIBLE("arm,vexpress-shutdown"), { /* sentinel */ }, }; PLATFORM_START(vexpress, "VERSATILE EXPRESS") .compatible = vexpress_dt_compat, .reset = vexpress_reset, .blacklist_dev = vexpress_blacklist_dev, PLATFORM_END /* * Local variables: * mode: C * c-file-style: "BSD" * c-basic-offset: 4 * indent-tabs-mode: nil * End: */
/* * The ManaPlus Client * Copyright (C) 2013-2014 The ManaPlus Developers * * This file is part of The ManaPlus Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * 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 RESOURCES_SOUNDINFO_H #define RESOURCES_SOUNDINFO_H #include "resources/itemsoundevent.h" #include <map> #include <string> #include <vector> #include "localconsts.h" struct SoundInfo final { SoundInfo(const std::string &sound0, const int delay0) : sound(sound0), delay(delay0) { } std::string sound; int delay; }; typedef std::vector<SoundInfo> SoundInfoVect; typedef std::map<ItemSoundEvent::Type, SoundInfoVect*> ItemSoundEvents; #endif // RESOURCES_SOUNDINFO_H
#include <config.h> /*****************************************************************/ /*** ***/ /*** Play out a file on Linux ***/ /*** ***/ /*** H.F. Silverman 1/4/91 ***/ /*** Modified: H.F. Silverman 1/16/91 for amax parameter ***/ /*** Modified: A. Smith 2/14/91 for 8kHz for klatt synth ***/ /*** Modified: Rob W. W. Hooft (hooft@EMBL-Heidelberg.DE) ***/ /*** adapted for linux soundpackage Version 2.0 ***/ /*** ***/ /*****************************************************************/ #include <useconfig.h> #include <stdio.h> #include <math.h> #include <errno.h> #include <ctype.h> #include <fcntl.h> #include <sys/file.h> #include <sys/stat.h> #include <sys/param.h> #include <sys/signal.h> #include <sys/ioctl.h> #include <machine/soundcard.h> #include "getargs.h" #include "hplay.h" #define SAMP_RATE 8000 long samp_rate = SAMP_RATE; /* Audio Parameters */ static int dev_fd = -1; /* file descriptor for audio device */ char *dev_file = "/dev/dsp"; static int linear_fd = -1; static char *linear_file = NULL; char *prog = "hplay"; static int audio_open(void) { dev_fd = open(dev_file, O_WRONLY | O_NDELAY); if (dev_fd < 0) { perror(dev_file); return 0; } return 1; } int audio_init(int argc, char *argv[]) { int rate_set = 0; int use_audio = 1; prog = argv[0]; argc = getargs("FreeBSD Audio",argc, argv, "r", "%d", &rate_set, "Sample rate", "a", NULL, &use_audio, "Audio enable", NULL); if (help_only) return argc; if (use_audio) audio_open(); if (rate_set) samp_rate = rate_set; if (dev_fd > 0) { ioctl(dev_fd, SNDCTL_DSP_SPEED, &samp_rate); printf("Actual sound rate: %ld\n", samp_rate); } return argc; } void audio_term() { int dummy; /* Close audio system */ if (dev_fd >= 0) { ioctl(dev_fd, SNDCTL_DSP_SYNC, &dummy); close(dev_fd); dev_fd = -1; } /* Finish linear file */ if (linear_fd >= 0) { ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR)); close(linear_fd); linear_fd = -1; } } void audio_play(int n, short *data) { if (n > 0) { unsigned char *converted = (unsigned char *) malloc(n); int i; if (converted == NULL) { fprintf(stderr, "Could not allocate memory for conversion\n"); exit(3); } for (i = 0; i < n; i++) converted[i] = (data[i] - 32768) / 256; if (linear_fd >= 0) { if (write(linear_fd, converted, n) != n) perror("write"); } if (dev_fd >= 0) { if (write(dev_fd, converted, n) != n) perror("write"); } free(converted); } }
// // ESCWebView.h // ESCDevelopKit // // Created by 程巍巍 on 11/17/14. // Copyright (c) 2014 Littocats. All rights reserved. // #import <UIKit/UIKit.h> #define ESCWebView_JQuerySourceURL @"http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" @class ESCWebView; /** * You should never retain callback object , otherwist ,it may cause retain cycle */ typedef void (^ESCWebViewJSAction)(ESCWebView *webView,NSString *action, NSArray *arguments, id *returnValue); #define ESCWebViewEvalJSCallback(callback,...) [callback eval:@"" # __VA_ARGS__, __VA_ARGS__, nil] #define ESCWebViewCallJSFunction(webview,function,...) [webview callJSFunction:function withArguments:@"" # __VA_ARGS__, __VA_ARGS__, nil] @interface ESCWebViewJSCallback : NSObject /** * buffer为引导参数,不做为有效参数传入 callback * 应避免直接调用该方法,请使用 ESCWebViewEvalJSCallback(callback,...) 代替 * 通过参数列表传入的 block 对像,会被 retain ,在函数执行完成后,即被 release */ - (void)eval:(id)buffer,... NS_REQUIRES_NIL_TERMINATION; @end @protocol ESCWebViewDOMProtocol; @protocol ESCWebViewCSSProtocol; @interface ESCWebView : UIWebView /** * 当 jQueryEnable = YES 时,可使用 XMLDOM 对网业元素进行操作 * XMLDOM 操作方式类似于 jQuery, 相当于 $ 操作符 * 默认值为 NO */ @property (nonatomic,getter=isJQueryEnable,readonly) BOOL jQueryEnable; /** * */ - (void)setJQueryEnable:(BOOL)jQueryEnable enabledHandler:(void (^)(ESCWebView *webview))handler; /** * */ @property (nonatomic, readonly) id<ESCWebViewDOMProtocol> (^XMLDOM)(NSString *jQuery); /** * 如果,name 对应的 jsAction 已存在,则返回 NO * 需要保证 name 与 webview 中的业务 javascript 变量不重名,否则可能被覆盖 * callback 会被 retain , 当 ESCWebView 释放时,自动释放,使用过程中,需注意循环引用问题 * @discussion 当webview 重新加载时,需重新加载 callback */ - (BOOL)addJSAction:(NSString *)name withCallback:(ESCWebViewJSAction)callback; /** * buffer 为引导参数,不做为有效参传入 JSFunction * 应避免直接调用该方法,请使用 ESCWebViewCallJSFunction(webview,function,...) 代替 * 通过参数列表传入的 block 对像,会被 retain ,在函数执行完成后,即被 release, 因此,js 代码中不要将参数中的block回调存储 */ - (void)callJSFunction:(NSString *)func withArguments:(id)buffer,... NS_REQUIRES_NIL_TERMINATION; @end @protocol ESCWebViewDOMProtocol <NSObject> @optional @property (nonatomic, readonly) NSString *(^attr)(NSString *name, NSString *value); @property (nonatomic, readonly) NSString *(^html)(NSString *html); @property (nonatomic, readonly) void (^remove)(); @property (nonatomic, readonly) void (^removeAttr)(NSString *attr); @property (nonatomic, readonly) void (^removeClass)(NSString *class); @property (nonatomic, readonly) NSString *(^text)(NSString *text); @property (nonatomic, readonly) NSString *(^val)(NSString *value); @property (nonatomic, readonly) id<ESCWebViewCSSProtocol> (^css)(NSString *css); @end @protocol ESCWebViewCSSProtocol <NSObject> @optional @property (nonatomic, readonly) NSNumber * (^height)(NSNumber * height); @property (nonatomic, readonly) NSNumber * (^width)(NSNumber * width); @property (nonatomic, readonly) NSValue * (^position)(NSValue * position); @property (nonatomic, readonly) NSValue * (^offset)(NSValue * position); @property (nonatomic, readonly) NSValue * (^offsetParent)(NSValue * position); @property (nonatomic, readonly) NSValue * (^scrollLeft)(NSValue * position); @property (nonatomic, readonly) NSValue * (^scrollTop)(NSValue * position); @end
/**************************************************************************** ** $Id: qwhatsthis.h 2 2005-11-16 15:49:26Z dmik $ ** ** Definition of QWhatsThis class ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of the widgets module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition ** licenses may use this file in accordance with the Qt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef QWHATSTHIS_H #define QWHATSTHIS_H #ifndef QT_H #include "qobject.h" #endif // QT_H #ifndef QT_NO_WHATSTHIS #include "qcursor.h" class QToolButton; class QPopupMenu; class QStyleSheet; class Q_EXPORT QWhatsThis: public Qt { public: QWhatsThis( QWidget *); virtual ~QWhatsThis(); virtual QString text( const QPoint & ); virtual bool clicked( const QString& href ); // the common static functions static void setFont( const QFont &font ); static void add( QWidget *, const QString &); static void remove( QWidget * ); static QString textFor( QWidget *, const QPoint & pos = QPoint(), bool includeParents = FALSE ); static QToolButton * whatsThisButton( QWidget * parent ); static void enterWhatsThisMode(); static bool inWhatsThisMode(); static void leaveWhatsThisMode( const QString& = QString::null, const QPoint& pos = QCursor::pos(), QWidget* w = 0 ); static void display( const QString& text, const QPoint& pos = QCursor::pos(), QWidget* w = 0 ); }; #endif // QT_NO_WHATSTHIS #endif // QWHATSTHIS_H
/* Launchy: Application Launcher Copyright (C) 2005 Josh Karlin 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. */ #pragma once #include "stdafx.h" #include "ReadOnlyEdit.h" //#include "TypeEdit.h" //#include "OpaqueListBox.h" //#include "LListBox.h" //#include "ColorCombo.h" // SmartComboBox #define WM_LAUNCHY_MOUSE_SELECT (LAUNCHY_DB_DONE + 1) #define WM_CHANGE_COMBO_SEL (WM_LAUNCHY_MOUSE_SELECT + 1) struct DropItem { HICON icon; CString longpath; CString lesspath; int owner; ~DropItem() { if (icon != NULL) { DestroyIcon(icon); } } }; class SmartComboBox : public CComboBox { DECLARE_DYNAMIC(SmartComboBox) public: SmartComboBox(); virtual ~SmartComboBox(); private: protected: DECLARE_MESSAGE_MAP() public: void SetTextColor(COLORREF rgb); void SetBackColor(COLORREF rgb); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnDestroy(); afx_msg void OnCbnEditupdate(); afx_msg void OnCbnCloseup(); afx_msg void OnCbnEditchange(); CString typed; CString searchPath; afx_msg void OnSelEndOK(); afx_msg void OnDrawSelchange(int id); void SetSmallFont(CFont* font, COLORREF rgb); COLORREF m_FontSmallRGB; CFont* m_FontSmall; int cloneSelect; bool m_RemoveFrame; bool m_RemoveButton; bool m_Transparent; afx_msg void OnCbnDropdown(); void TabSearchTxt(); void ReformatDisplay(); void DeleteWord(); void DeleteLine(); private: //text and text background colors COLORREF m_crText; COLORREF m_crBackGnd; //background brush CBrush m_brBackGnd; afx_msg void OnPaint(); LRESULT AfterSelChange(UINT wParam, LONG lParam); public: void ParseSearchTxt(); void CleanText(void); afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct); afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct); // virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void PreSubclassWindow(); };
#pragma once #include "Emu/RSX/RSXThread.h" #include <memory> struct RSXDebuggerProgram { u32 id; u32 vp_id; u32 fp_id; std::string vp_shader; std::string fp_shader; bool modified; RSXDebuggerProgram() : modified(false) { } }; enum wm_event { none, //nothing geometry_change_notice, //about to start resizing and/or moving the window geometry_change_in_progress, //window being resized and/or moved window_resized, //window was resized window_minimized, //window was minimized window_restored, //window was restored from a minimized state window_moved, //window moved without resize window_visibility_changed }; using RSXDebuggerPrograms = std::vector<RSXDebuggerProgram>; using draw_context_t = std::shared_ptr<void>; class GSFrameBase { public: GSFrameBase() = default; GSFrameBase(const GSFrameBase&) = delete; virtual void close() = 0; virtual bool shown() = 0; virtual void hide() = 0; virtual void show() = 0; draw_context_t new_context(); virtual void set_current(draw_context_t ctx) = 0; virtual void flip(draw_context_t ctx, bool skip_frame=false) = 0; virtual int client_width() = 0; virtual int client_height() = 0; virtual void* handle() const = 0; protected: virtual void delete_context(void* ctx) = 0; virtual void* make_context() = 0; //window manager event management wm_event m_raised_event; std::atomic_bool wm_event_raised = {}; std::atomic_bool wm_event_queue_enabled = {}; public: //synchronize native window access std::mutex wm_event_lock; virtual wm_event get_default_wm_event() const = 0; void clear_wm_events() { m_raised_event = wm_event::none; wm_event_raised.store(false); } wm_event get_wm_event() { if (wm_event_raised.load(std::memory_order_consume)) { auto result = m_raised_event; m_raised_event = wm_event::none; wm_event_raised.store(false); return result; } return get_default_wm_event(); } void disable_wm_event_queue() { wm_event_queue_enabled.store(false); } void enable_wm_event_queue() { wm_event_queue_enabled.store(true); } }; class GSRender : public rsx::thread { protected: GSFrameBase* m_frame; draw_context_t m_context; public: GSRender(); virtual ~GSRender(); void on_init_rsx() override; void on_init_thread() override; void flip(int buffer) override; };
/* * File : media_proc.c * This file is part of FH8620 BSP for RT-Thread distribution. * * Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd. * All rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Visit http://www.fullhan.com to get contact with Fullhan. * * Change Logs: * Date Author Notes */ #define FH_DGB_ISP_PROC #define FH_DGB_DSP_PROC #include "rtthread.h" #ifdef FH_DGB_DSP_PROC extern int media_read_proc(); extern int media_mem_proc(); extern int vpu_read_proc(); extern int vpu_write_proc(char *s); extern int enc_read_proc(); extern int enc_write_proc(char *s); extern int jpeg_read_proc(); extern int jpeg_write_proc(char *s); extern int vou_read_proc(); extern int vou_write_proc(char *s); extern void cmm_mem_proc(int index); #ifdef RT_USING_FINSH #include <finsh.h> #ifdef FH_DGB_ISP_PROC extern int isp_read_proc(); FINSH_FUNCTION_EXPORT(isp_read_proc, read proc info); #endif FINSH_FUNCTION_EXPORT(media_mem_proc, media mem use info.e.g : media_mem_proc()); FINSH_FUNCTION_EXPORT(jpeg_write_proc, write jpeg proc info); FINSH_FUNCTION_EXPORT(jpeg_read_proc, read jpeg proc info); FINSH_FUNCTION_EXPORT(media_read_proc, get media process proc info); FINSH_FUNCTION_EXPORT(enc_write_proc, write enc proc info); FINSH_FUNCTION_EXPORT(enc_read_proc, read enc proc info); FINSH_FUNCTION_EXPORT(vou_write_proc, write vou proc info); FINSH_FUNCTION_EXPORT(vou_read_proc, read vou proc info); FINSH_FUNCTION_EXPORT(vpu_write_proc, write vpu proc info); FINSH_FUNCTION_EXPORT(vpu_read_proc, read vpu proc info); FINSH_FUNCTION_EXPORT(cmm_mem_proc, reserved mem use info.e.g : cmm_mem_proc(index)); #endif #endif
#include "bbs.h" //////////////////////////////////////////////////////////////////////////// // Figlet Captcha System //////////////////////////////////////////////////////////////////////////// #ifdef USE_FIGLET_CAPTCHA #define FN_JOBSPOOL_DIR "jobspool/" static int gen_captcha(char *buf, int szbuf, char *fpath) { // do not use: GQV const char *alphabet = "ABCDEFHIJKLMNOPRSTUWXYZ"; int calphas = strlen(alphabet); char cmd[PATHLEN], opts[PATHLEN]; int i, coptSpace, coptFont; static const char *optSpace[] = { "-S", "-s", "-k", "-W", // "-o", NULL }; static const char *optFont[] = { "banner", "big", "slant", "small", "smslant", "standard", // block family "block", "lean", // shadow family // "shadow", "smshadow", // mini (better with large spacing) // "mini", NULL }; // fill captcha code for (i = 0; i < szbuf-1; i++) buf[i] = alphabet[random() % calphas]; buf[i] = 0; // szbuf-1 // decide options coptSpace = coptFont = 0; while (optSpace[coptSpace]) coptSpace++; while (optFont[coptFont]) coptFont++; snprintf(opts, sizeof(opts), "%s -f %s", optSpace[random() % coptSpace], optFont [random() % coptFont ]); // create file snprintf(fpath, PATHLEN, FN_JOBSPOOL_DIR ".captcha.%s", buf); snprintf(cmd, sizeof(cmd), FIGLET_PATH " %s %s >%s 2>/dev/null || rm %s", opts, buf, fpath, fpath); // for mbbsd daemons, system() may return -1 with errno=ECHILD, // so we can only trust the command itself. // vmsg(cmd); system(cmd); return dashf(fpath) && dashs(fpath) > 1; } static int _vgetcb_data_upper(int key, VGET_RUNTIME *prt GCC_UNUSED, void *instance GCC_UNUSED) { if (key >= 'a' && key <= 'z') key = toupper(key); if (key < 'A' || key > 'Z') { bell(); return VGETCB_NEXT; } return VGETCB_NONE; } static int _vgetcb_data_change(int key GCC_UNUSED, VGET_RUNTIME *prt GCC_UNUSED, void *instance GCC_UNUSED) { char *s = prt->buf; while (*s) { if (isascii(*s) && islower(*s)) *s = toupper(*s); s++; } return VGETCB_NONE; } int verify_captcha(const char *reason) { char captcha[7] = "", code[STRLEN]; char fpath[PATHLEN]; VGET_CALLBACKS vge = { NULL, _vgetcb_data_upper, _vgetcb_data_change }; int tries = 0, i; do { // create new captcha if (tries % 2 == 0 || !captcha[0]) { // if generation failed, skip captcha. if (!gen_captcha(captcha, sizeof(captcha), fpath)) return 1; // prompt user about captcha vs_hdr("CAPTCHA ÅçÃÒµ{§Ç"); outs(reason); outs("½Ð¿é¤J¤U­±¹Ï¼ËÅã¥Üªº¤å¦r¡C\n" "¹Ï¼Ë¥u·|¥Ñ¤j¼gªº A-Z ­^¤å¦r¥À²Õ¦¨¡C\n\n"); show_file(fpath, 4, b_lines-5, SHOWFILE_ALLOW_ALL); unlink(fpath); } // each run waits 10 seconds. for (i = 10; i > 0; i--) { move(b_lines-1, 0); clrtobot(); prints("½Ð¥J²ÓÀˬd¤W­±ªº¹Ï§Î¡A %d ¬í«á§Y¥i¿é¤J...", i); // flush out current input doupdate(); sleep(1); vkey_purge(); } // input captcha move(b_lines-1, 0); clrtobot(); prints("½Ð¿é¤J¹Ï¼ËÅã¥Üªº %d ­Ó­^¤å¦r¥À: ", (int)strlen(captcha)); vgetstring(code, strlen(captcha)+1, 0, "", &vge, NULL); if (code[0] && strcasecmp(code, captcha) == 0) break; // error case. if (++tries >= 10) return 0; // error vmsg("¿é¤J¿ù»~¡A½Ð­«¸Õ¡Cª`·N²Õ¦¨¤å¦r¥þ¬O¤j¼g­^¤å¦r¥À¡C"); } while (1); clear(); return 1; } #else // !USE_FIGLET_CAPTCHA int verify_captcha(const char *reason) { return 1; } #endif // !USE_FIGLET_CAPTCHA //////////////////////////////////////////////////////////////////////////// // Remote Captcha System //////////////////////////////////////////////////////////////////////////// #ifdef USE_REMOTE_CAPTCHA static const char * captcha_insert_remote(const char *handle, const char *verify) { int ret, code = 0; char uri[320]; snprintf(uri, sizeof(uri), "%s?secret=%s&handle=%s&verify=%s", CAPTCHA_INSERT_URI, CAPTCHA_INSERT_SECRET, handle, verify); THTTP t; thttp_init(&t); ret = thttp_get(&t, CAPTCHA_INSERT_SERVER_ADDR, uri, CAPTCHA_INSERT_HOST); if (!ret) code = thttp_code(&t); thttp_cleanup(&t); if (ret) return "¦øªA¾¹³s½u¥¢±Ñ, ½Ðµy«á¦A¸Õ."; if (code != 200) return "¤º³¡¦øªA¾¹¿ù»~, ½Ðµy«á¦A¸Õ."; return NULL; } const char * remote_captcha() { const char *msg = NULL; char handle[CAPTCHA_CODE_LENGTH + 1]; char verify[CAPTCHA_CODE_LENGTH + 1]; char verify_input[CAPTCHA_CODE_LENGTH + 1]; vs_hdr("¨ú±oÅçÃÒ½X"); random_text_code(handle, CAPTCHA_CODE_LENGTH); random_text_code(verify, CAPTCHA_CODE_LENGTH); msg = captcha_insert_remote(handle, verify); if (msg) return msg; move(2, 0); outs("½Ð¥ý¦Ü¥H¤U³sµ²¨ú±o»{ÃÒ½X:\n"); outs(CAPTCHA_URL_PREFIX "?handle="); outs(handle); outs("\n"); for (int i = 3; i > 0; i--) { if (i < 3) { char buf[80]; snprintf(buf, sizeof(buf), ANSI_COLOR(1;31) "ÅçÃÒ½X¿ù»~, ±zÁÙ¦³ %d ¦¸¾÷·|." ANSI_RESET, i); move(6, 0); outs(buf); } verify_input[0] = '\0'; getdata(5, 0, "½Ð¿é¤JÅçÃÒ½X: ", verify_input, sizeof(verify_input), DOECHO); if (!strcmp(verify, verify_input)) return NULL; } return "ÅçÃÒ½X¿é¤J¿ù»~¦¸¼Æ¤Ó¦h, ½Ð­«·s¾Þ§@!"; } #else const char * remote_captcha() { return NULL; } #endif // !USE_REMOTE_CAPTCHA
/* * Copyright (c) 2012 Boudewijn Rempt <boud@valdyas.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef OCIO_DISPLAY_FILTER_H #define OCIO_DISPLAY_FILTER_H #include "lut_export.h" #include <kis_display_filter.h> #include <OpenColorIO/OpenColorIO.h> #include <OpenColorIO/OpenColorTransforms.h> #include <QVector> #include <opengl/kis_opengl.h> #include "kis_exposure_gamma_correction_interface.h" namespace OCIO = OCIO_NAMESPACE; enum OCIO_CHANNEL_SWIZZLE { LUMINANCE, RGBA, R, G, B, A }; class LUT_EXPORT OcioDisplayFilter : public KisDisplayFilter { Q_OBJECT public: explicit OcioDisplayFilter(KisExposureGammaCorrectionInterface *interface, QObject *parent = 0); ~OcioDisplayFilter(); void filter(quint8 *pixels, quint32 numPixels); void approximateInverseTransformation(quint8 *pixels, quint32 numPixels); void approximateForwardTransformation(quint8 *pixels, quint32 numPixels); bool useInternalColorManagement() const; bool lockCurrentColorVisualRepresentation() const; void setLockCurrentColorVisualRepresentation(bool value); KisExposureGammaCorrectionInterface *correctionInterface() const; #ifdef HAVE_OPENGL virtual QString program() const; GLuint lutTexture() const; #endif void updateProcessor(); OCIO::ConstConfigRcPtr config; const char *inputColorSpaceName; const char *displayDevice; const char *view; OCIO_CHANNEL_SWIZZLE swizzle; float exposure; float gamma; float blackPoint; float whitePoint; bool forceInternalColorManagement; private: OCIO::ConstProcessorRcPtr m_processor; OCIO::ConstProcessorRcPtr m_revereseApproximationProcessor; OCIO::ConstProcessorRcPtr m_forwardApproximationProcessor; KisExposureGammaCorrectionInterface *m_interface; bool m_lockCurrentColorVisualRepresentation; #ifdef HAVE_OPENGL QString m_program; GLuint m_lut3dTexID; QVector<float> m_lut3d; QString m_lut3dcacheid; QString m_shadercacheid; #endif }; #endif // OCIO_DISPLAY_FILTER_H
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * 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. * * $URL$ * $Id$ * */ namespace DS { void scanKeys(void); uint32 keysHeld(void); uint32 keysDown(void); uint32 keysDownRepeat(void); void keysSetRepeat(u8 setDelay, u8 setRepeat); uint32 keysUp(void); } // End of namespace DS
/* * drivers/cpufreq/cpufreq_re_fit_data.h * * Created by Liangzhen Lai @ 10/09/2014 * cpufreq_re_fit_data.h : interface for initializing * fit rate for different power states and configurations * */ #ifndef _CPUFREQ_RE_FIR_DATA_H #define _CPUFREQ_RE_FIR_DATA_H struct cpufreq_re_fit_data; struct cpufreq_re_fit_data { unsigned int core_fit[5]; unsigned int core_fit_c1[5]; unsigned int core_fit_c2; unsigned int core_fit_c3; unsigned int L1_mem_fit[5]; unsigned int L1_mem_fit_ret[5]; unsigned int L2_mem_fit; unsigned int L2_mem_fit_ret; unsigned int core_pow[5]; unsigned int core_pow_c1[5]; unsigned int core_pow_c2; unsigned int core_pow_c3; unsigned int L1_mem_pow[5]; unsigned int L1_mem_pow_ret[5]; unsigned int L2_mem_pow; unsigned int L2_mem_pow_ret; }; void import_fit_data(struct cpufreq_re_fit_data *fit_data, unsigned int cpu); #endif
#ifndef IOCTL_COMMANDS_H #define IOCTL_COMMANDS_H #include <linux/ioctl.h> #define BRPA3_SET_MODE _IOW('c',1,int *) #define BRPA3_SET_KEY _IOW('c',2,int *) #define BRPA3_GET_MODE _IOR('c',3,int *) #endif
//Samuel Balula & Pedro Ribeiro 2014 #include <p30F4011.h> //defines dspic registers #include <stdio.h> //standart IO library C #include <libpic30.h> //C30 compiler definitions #include <uart.h> //UART (serial port) function and utilities library #include <timer.h> //timer library #include <string.h> #include <math.h> #include "uart2.h" #include "io.h" //#include "timer2.h" #include "timer3.h" #include "timer4.h" //#include "oc.h" //#include "ic.h" #include "delays.h" #include "todo.h" #include "adc.h" #include "spi.h" int main() { int a; init_UART2(); init_io(); //calculaseno(); init_TMR2(); //init_ADC(); //init_TMR3(); //init_TMR4(); init_OC2(); //init_SPI1(); duty = 180; while (1) { pull_UART2(); OC2RS = 332+358*duty/90; //Duty Time } }
// // CMLocal.h // NAStify // // Created by Sylver Bruneau. // Copyright (c) 2012 CodeIsALie. All rights reserved. // #import <Foundation/Foundation.h> #import "ConnectionManager.h" #import "UserAccount.h" #import "HTTPServer.h" @interface CMLocal : NSObject <CM,UIAlertViewDelegate> @property(nonatomic, strong) HTTPServer *httpServer; @property(nonatomic, strong) UserAccount *userAccount; @property(nonatomic, weak) id <CMDelegate> delegate; @property(nonatomic, strong) NSFileManager *fileManager; - (NSArray *)serverInfo; - (void)listForPath:(FileItem *)folder; - (void)createFolder:(NSString *)folderName inFolder:(FileItem *)folder; #ifndef APP_EXTENSION - (void)spaceInfoAtPath:(FileItem *)folder; - (void)renameFile:(FileItem *)oldFile toName:(NSString *)newName atPath:(FileItem *)folder; - (void)deleteFiles:(NSArray *)files; - (void)moveFiles:(NSArray *)files toPath:(FileItem *)destFolder andOverwrite:(BOOL)overwrite; - (void)copyFiles:(NSArray *)files toPath:(FileItem *)destFolder andOverwrite:(BOOL)overwrite; - (void)compressFiles:(NSArray *)files toArchive:(NSString *)archive archiveType:(ARCHIVE_TYPE)archiveType compressionLevel:(ARCHIVE_COMPRESSION_LEVEL)compressionLevel password:(NSString *)password overwrite:(BOOL)overwrite; - (void)extractFiles:(NSArray *)files toFolder:(FileItem *)folder withPassword:(NSString *)password overwrite:(BOOL)overwrite extractWithFolder:(BOOL)extractFolders; #endif - (void)searchFiles:(NSString *)searchString atPath:(FileItem *)folder; - (void)downloadFile:(FileItem *)file toLocalName:(NSString *)localName; - (void)uploadLocalFile:(FileItem *)file toPath:(FileItem *)destFolder overwrite:(BOOL)overwrite serverFiles:(NSArray *)filesArray; #ifndef APP_EXTENSION - (NetworkConnection *)urlForFile:(FileItem *)file; #endif /* Server features */ - (long long)supportedFeaturesAtPath:(NSString *)path; #ifndef APP_EXTENSION - (NSInteger)supportedArchiveType; #endif @end
#ifndef SIGNING_H #define SIGNING_H void gpgme_sign(int rootfd, const char *file, const char *key); int gpgme_verify(int rootfd, const char *file); #endif
#include <stdio.h> #include <fcntl.h> #include <unistd.h> int main( void ) { int fd = fileno(stdout); printf("before!\n"); close(fd); printf("after!\n"); }
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/IMCore.framework/Frameworks/IMFoundation.framework/IMFoundation */ @protocol IMReachabilityDelegate - (void)reachabilityDidChange:(id)reachability; @end
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2022 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_MIN_LEN_STEP_H_ #define _U2_MIN_LEN_STEP_H_ #include "trimmomatic/TrimmomaticStep.h" namespace U2 { namespace LocalWorkflow { class MinLenStep : public TrimmomaticStep { Q_OBJECT public: MinLenStep(); TrimmomaticStepSettingsWidget* createWidget() const; private: QString serializeState(const QVariantMap& widgetState) const; QVariantMap parseState(const QString& command) const; }; class MinLenStepFactory : public TrimmomaticStepFactory { public: static const QString ID; MinLenStepFactory(); MinLenStep* createStep() const; }; } // namespace LocalWorkflow } // namespace U2 #endif // _U2_MIN_LEN_STEP_H_
// // FGDataManager.h // OhMyGist // // Created by wangzz on 15-1-22. // Copyright (c) 2015年 wangzz. All rights reserved. // #import <Foundation/Foundation.h> @class FGError; @class OCTClient; typedef void (^completionBlock)(id object, FGError *error); @interface FGDataManager : NSObject /** * 登录接口 * * @param userName 用户名 * @param password 密码 * @param completionBlock 登录结果回调 */ + (void)loginWithUserName:(NSString *)userName password:(NSString *)password completionBlock:(completionBlock)completionBlock; /** * 异步获取用户信息 * * @param client 当前登陆用户 * @param completionBlock 获取结果回调 */ + (void)fetchUserInfo:(OCTClient *)client completionBlock:(completionBlock)completionBlock; /** * 异步获取当前登录用户所有gists列表 * * @param client 当前登陆用户 * @param completionBlock 获取结果回调 */ + (void)fetchGists:(OCTClient *)client completionBlock:(completionBlock)completionBlock; /** * 异步获取当前登录用户Repositories * * @param client 当前登陆用户 * @param completionBlock 获取结果回调 */ + (void)fetchUserRepositories:(OCTClient *)client completionBlock:(completionBlock)completionBlock; /** * 异步获取Public Gists * * @param client 当前登陆用户 * @param completionBlock 获取结果回调 */ + (void)fetchPublicGists:(OCTClient *)client completionBlock:(completionBlock)completionBlock; @end
/** * @file * * @brief RTEMS File System Location Support * @ingroup LibIOInternal */ /* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * Modifications to support reference counting in the file system are * Copyright (c) 2012 embedded brains GmbH. * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <sys/stat.h> #include <rtems/libio_.h> static int null_handler_open( rtems_libio_t *iop, const char *path, int oflag, mode_t mode ) { return -1; } static int null_handler_fstat( const rtems_filesystem_location_info_t *pathloc, struct stat *buf ) { return -1; } const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers = { .open_h = null_handler_open, .close_h = rtems_filesystem_default_close, .read_h = rtems_filesystem_default_read, .write_h = rtems_filesystem_default_write, .ioctl_h = rtems_filesystem_default_ioctl, .lseek_h = rtems_filesystem_default_lseek, .fstat_h = null_handler_fstat, .ftruncate_h = rtems_filesystem_default_ftruncate, .fsync_h = rtems_filesystem_default_fsync_or_fdatasync, .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync, .fcntl_h = rtems_filesystem_default_fcntl, .kqfilter_h = rtems_filesystem_default_kqfilter, .poll_h = rtems_filesystem_default_poll, .readv_h = rtems_filesystem_default_readv, .writev_h = rtems_filesystem_default_writev }; static void null_op_lock_or_unlock( const rtems_filesystem_mount_table_entry_t *mt_entry ) { /* Do nothing */ } static int null_op_mknod( const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev ) { return -1; } static int null_op_rmnod( const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc ) { return -1; } static int null_op_link( const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen ) { return -1; } static int null_op_fchmod( const rtems_filesystem_location_info_t *pathloc, mode_t mode ) { return -1; } static int null_op_chown( const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group ) { return -1; } static int null_op_clonenode( rtems_filesystem_location_info_t *loc ) { return -1; } static int null_op_mount( rtems_filesystem_mount_table_entry_t *mt_entry ) { return -1; } static int null_op_fsmount_me( rtems_filesystem_mount_table_entry_t *mt_entry, const void *data ) { return -1; } static int null_op_unmount( rtems_filesystem_mount_table_entry_t *mt_entry ) { return -1; } static void null_op_fsunmount_me( rtems_filesystem_mount_table_entry_t *mt_entry ) { /* Do nothing */ } static int null_op_utime( const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime ) { return -1; } static int null_op_symlink( const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target ) { return -1; } static ssize_t null_op_readlink( const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize ) { return -1; } static int null_op_rename( const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen ) { return -1; } static int null_op_statvfs( const rtems_filesystem_location_info_t *__restrict loc, struct statvfs *__restrict buf ) { return -1; } static const rtems_filesystem_operations_table null_ops = { .lock_h = null_op_lock_or_unlock, .unlock_h = null_op_lock_or_unlock, .eval_path_h = rtems_filesystem_default_eval_path, .link_h = null_op_link, .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal, .mknod_h = null_op_mknod, .rmnod_h = null_op_rmnod, .fchmod_h = null_op_fchmod, .chown_h = null_op_chown, .clonenod_h = null_op_clonenode, .freenod_h = rtems_filesystem_default_freenode, .mount_h = null_op_mount, .fsmount_me_h = null_op_fsmount_me, .unmount_h = null_op_unmount, .fsunmount_me_h = null_op_fsunmount_me, .utime_h = null_op_utime, .symlink_h = null_op_symlink, .readlink_h = null_op_readlink, .rename_h = null_op_rename, .statvfs_h = null_op_statvfs }; rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry = { .location_chain = RTEMS_CHAIN_INITIALIZER_ONE_NODE( &rtems_filesystem_global_location_null.location.mt_entry_node ), .ops = &null_ops, .mt_point_node = &rtems_filesystem_global_location_null, .mt_fs_root = &rtems_filesystem_global_location_null, .mounted = false, .writeable = false, .type = "" }; rtems_filesystem_global_location_t rtems_filesystem_global_location_null = { .location = { .mt_entry_node = RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( &rtems_filesystem_null_mt_entry.location_chain ), .handlers = &rtems_filesystem_null_handlers, .mt_entry = &rtems_filesystem_null_mt_entry }, /* * The initial reference count accounts for the following references * o the root directory of the user environment, * o the current directory of the user environment, * o the root node of the null file system instance, and * o the mount point node of the null file system instance. */ .reference_count = 4 }; rtems_user_env_t rtems_global_user_env = { .current_directory = &rtems_filesystem_global_location_null, .root_directory = &rtems_filesystem_global_location_null, .umask = S_IWGRP | S_IWOTH }; pthread_key_t rtems_current_user_env_key;
// // VKCJSONSerializationUtil.h // VkClient // // Created by Artsiom Kaliaha on 28/08/15. // Copyright (c) 2015 Artsiom Kaliaha. All rights reserved. // #import <Foundation/Foundation.h> #import "VKCSingleton.h" @interface VKCJSONSerializationUtil : NSObject <VKCSingleton> - (NSDictionary *)serialize:(NSData *) jsonData error:(NSError *)error; @end
/** <pre> * The Multi-Purpose Viewer * Copyright (c) 2004 The Boeing Company * * 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. * * 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 * * * FILENAME: EnvRegionMgr.h * LANGUAGE: C++ * CLASS: UNCLASSIFIED * PROJECT: Multi-Purpose Viewer * * PROGRAM DESCRIPTION: * This class manages environmental regions. * * MODIFICATION NOTES: * DATE NAME SCR NUMBER * DESCRIPTION OF CHANGE........................ * * 11/02/2005 Greg Basler MPV_CR_DR_1 * Initial Release. * * 2007-07-14 Andrew Sampson * Changed interface to use new state machine API * * </pre> * The Boeing Company * 1.0 */ #ifndef _PLUGIN_ENVREGION_MANAGER_INCLUDED_ #define _PLUGIN_ENVREGION_MANAGER_INCLUDED_ #include "Plugin.h" #include "AllCigi.h" #include "ProcEnvRegionCtrl.h" #include "ProcCompCtrl.h" #include "ProcShortCompCtrl.h" #include "EnvRegion.h" #include "ProcWeatherCtrl.h" #include "DefFileGroup.h" #include <list> #include <string> #include <map> //========================================================= //! This class manages environmental regions. //! class EnvRegionMgr : public Plugin { public: //==> Management //========================================================= //! General Constructor //! EnvRegionMgr(); //========================================================= //! General Destructor //! virtual ~EnvRegionMgr(); //==> Basic plugin functionality //========================================================= //! The per-frame processing that this plugin performs //! \param state - The current system state //! \param stateContext - an object containing all the variables which //! influence state transitions //! virtual void act( SystemState::ID state, StateContext &stateContext ); //==> Environmental Region Extended Data public functions //========================================================= //! Generates a new entry in each Environmental Regions's //! extended data vector and increments the size of the //! environmental region's extended data so that future //! environmental regions will have the correct //! extended data vector. //! //! \return - The index of the new element in each //! environmental region's extended data vector //! static int PostedAddEnvRegionExtendedData( void ); protected: void operate(); void cleanUp(); //========================================================= //! Generates a new entry in each Environmental Regions's //! extended data vector and increments the size of the //! environmental region's extended data so that future //! environmental regions will have the correct //! extended data vector. //! //! \return - The index of the new element in each //! environmental region's extended data vector //! int AddEnvRegionExtendedData( void ); //========================================================= //! A pointer to the instanced plugin object; used by the Posted* functions //! static EnvRegionMgr *Singleton; //========================================================= //! A pointer to the Cigi outgoing message object //! CigiOutgoingMsg *OmsgPtr; //========================================================= //! A pointer to the Cigi incoming message object //! CigiIncomingMsg *ImsgPtr; //========================================================= //! A pointer to the Environmental Region Control //! packet processor object //! ProcEnvRegionCtrl EnvRegionCtrlP; //========================================================= //! The Component control packet processing object //! ProcEnvRegionCompCtrl CompCtrlP; //========================================================= //! The Short Component control packet processing object //! ProcEnvRegionShortCompCtrl ShortCompCtrlP; //========================================================= //! The Weather control packet processing object //! ProcEnvRegionWeatherCtrl WeatherCtrlP; //========================================================= //! A List of the current environmental regions //! std::list<EnvRegion> EnvRegions; //========================================================= //! A List of the environmental regions that are marked as //! "destroy" and have not been deleted. //! std::list<EnvRegion> DestroyEnvRegions; //========================================================= //! A table of pointers into the environmental regions list //! to specific regions<br> //! (environmental region IDs are used as the index) //! std::list<EnvRegion>::iterator (EnvRegionTable[65536]); //========================================================= //! CoordCigi2DBase<br> //! A pointer to the CIGI coordinate to Database coordinate //! member function of the position conversion plugin //! CoordCigi2DBaseFunctionPtr CoordCigi2DBase; //========================================================= //! CoordDBase2Cigi<br> //! A pointer to the Database coordinate to CIGI coordinate //! member function of the position conversion plugin //! CoordDBase2CigiFunctionPtr CoordDBase2Cigi; }; #endif // _PLUGIN_ENVREGION_MANAGER_INCLUDED_
#pragma once #include <Eigen/Core> #include <angles/angles.h> #include <geometry_msgs/Twist.h> #include <tf2/utils.h> #include <arips_navigation/utils/transforms.h> using Vector2d = Eigen::Vector2d; struct Pose2D; using Twist2D = Pose2D; struct Pose2D { Vector2d point = {0, 0}; double theta = 0; Pose2D() = default; Pose2D(const Pose2D& other) = default; Pose2D(const Vector2d& point, double theta) : point{point}, theta{theta} {} static Pose2D fromMsg(const geometry_msgs::Twist& msg) { return {{msg.linear.x, msg.linear.y}, msg.angular.z}; } static Pose2D fromMsg(geometry_msgs::Pose const& msg) { return {{msg.position.x, msg.position.y}, getYawFromQuaternion(msg.orientation)}; } static Pose2D fromTf(const tf2::Transform& trans) { return {{trans.getOrigin().x(), trans.getOrigin().y()}, tf2::getYaw(trans.getRotation())}; } [[nodiscard]] double x() const { return point.x(); } [[nodiscard]] double y() const { return point.y(); } [[nodiscard]] Pose2D moved(const Twist2D& vel, double dt) const { const Vector2d dir = {vel.point.x() * cos(theta) + vel.point.y() * cos(M_PI_2 + theta), vel.point.x() * sin(theta) + vel.point.y() * cos(M_PI_2 + theta)}; return {point + dir * dt, angles::normalize_angle(theta + vel.theta * dt)}; } /* [[nodiscard]] Pose2D operator+(const Pose2D& rhs) const { return {point + rhs.point, angles::normalize_angle(theta + rhs.theta)}; } [[nodiscard]] Pose2D& operator+=(const Pose2D& rhs) { point += rhs.point; theta = angles::normalize_angle(theta + rhs.theta); } */ Pose2D operator*(double scale) const { return {point * scale, theta * scale}; } [[nodiscard]] double distance(const Pose2D& other) const { return (point - other.point).norm(); } geometry_msgs::Twist toTwistMsg() const { geometry_msgs::Twist msg; msg.linear.x = point.x(); msg.linear.y = point.y(); msg.angular.z = theta; return msg; } geometry_msgs::Pose toPoseMsg() const { geometry_msgs::Pose pose; pose.position.x = point.x(); pose.position.y = point.y(); pose.orientation = createQuaternionMsgFromYaw(theta); return pose; } }; struct TrajectoryPoint { Pose2D pose; Twist2D velocity; double timeFromStart = 0; }; using Trajectory = std::vector<TrajectoryPoint>; using Trajectories = std::vector<Trajectory>; struct Odom2D { Pose2D pose; Twist2D vel; };
// -*- C++ -*- // $Id: helpers.h,v 1.1 2001/01/12 00:41:08 robert Exp $ // id3lib: a C++ library for creating and manipulating id3v1/v2 tags // Copyright 1999, 2000 Scott Thomas Haug // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Library General Public License as published by // the Free Software Foundation; either version 2 of the License, or (at your // option) any later version. // // This library is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public // License for more details. // // You should have received a copy of the GNU Library General Public License // along with this library; if not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // The id3lib authors encourage improvements and optimisations to be sent to // the id3lib coordinator. Please see the README file for details on where to // send such submissions. See the AUTHORS file for a list of people who have // contributed to id3lib. See the ChangeLog file for a list of changes to // id3lib. These files are distributed with id3lib at // http://download.sourceforge.net/id3lib/ #ifndef _ID3LIB_HELPERS_H_ #define _ID3LIB_HELPERS_H_ #include "strings.h" #include "globals.h" class ID3_TagImpl; class ID3_Frame; namespace dami { namespace id3 { namespace v2 { String getString(const ID3_Frame*, ID3_FieldID); String getStringAtIndex(const ID3_Frame*, ID3_FieldID, index_t); String getFrameText(const ID3_TagImpl&, ID3_FrameID); ID3_Frame* setFrameText(ID3_TagImpl&, ID3_FrameID, String); size_t removeFrames(ID3_TagImpl&, ID3_FrameID); ID3_Frame* hasArtist(const ID3_TagImpl&); String getArtist(const ID3_TagImpl&); ID3_Frame* setArtist(ID3_TagImpl&, String); size_t removeArtists(ID3_TagImpl&); String getAlbum(const ID3_TagImpl&); ID3_Frame* setAlbum(ID3_TagImpl&, String); size_t removeAlbums(ID3_TagImpl&); String getTitle(const ID3_TagImpl&); ID3_Frame* setTitle(ID3_TagImpl&, String); size_t removeTitles(ID3_TagImpl&); String getYear(const ID3_TagImpl&); ID3_Frame* setYear(ID3_TagImpl&, String); size_t removeYears(ID3_TagImpl&); String getComment(const ID3_TagImpl&, String desc); String getV1Comment(const ID3_TagImpl&); ID3_Frame* setComment(ID3_TagImpl&, String, String, String); size_t removeComments(ID3_TagImpl&, String); size_t removeAllComments(ID3_TagImpl&); String getTrack(const ID3_TagImpl&); size_t getTrackNum(const ID3_TagImpl&); ID3_Frame* setTrack(ID3_TagImpl&, uchar ucTrack, uchar ucTotal); size_t removeTracks(ID3_TagImpl&); String getGenre(const ID3_TagImpl&); size_t getGenreNum(const ID3_TagImpl&); ID3_Frame* setGenre(ID3_TagImpl&, size_t ucGenre); size_t removeGenres(ID3_TagImpl&); String getLyrics(const ID3_TagImpl&); ID3_Frame* setLyrics(ID3_TagImpl&, String, String, String); size_t removeLyrics(ID3_TagImpl&); String getLyricist(const ID3_TagImpl&); ID3_Frame* setLyricist(ID3_TagImpl&, String); size_t removeLyricists(ID3_TagImpl&); ID3_Frame* setSyncLyrics(ID3_TagImpl&, BString, ID3_TimeStampFormat, String, String, ID3_ContentType); BString getSyncLyrics(const ID3_TagImpl& tag, String lang, String desc); }; }; }; #endif /* _ID3LIB_HELPERS_H_ */
#ifndef GLOBALS_H #define GLOBALS_H #include <iostream> #include <SFML\Graphics.hpp> //Ruudun leveys ja korkeus const int SCREEN_WIDTH = 1280; const int SCREEN_HEIGHT = 768; const char OPTIONS_FILENAME[] = "options.dat"; extern sf::RenderWindow window; //Piirtoikkuna #endif;
/* SHSQL suite - SQL utility for LINUX/UNIX shell scriptiing Copyright (C) 2004 Edward Macnaghten 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 Edward Macnaghten EDL Systems 16 Brierley Walk Cambridge CB4 3NH UK eddy@edlsystems.com */ /* * A dinky string object * * string *new_string() - Creates the object with zero length string * string *new_string(char *) - Creates the object with contents of *s * string_set(string *str, char *s) - Sets the string to contents of *s * string_cat(string *str, char *s) - Appends string with *s * string_cat_c(string *str, char c) - Appends string with character c * string_clear(string *str) - Clears the string (to empty string) * string_empty(string *str) - Empties the string (to empty string) * char *string_s(string *str) - Returns the string as char * * int string_len(string *str) - Returns the length * string_delete(string *str) - Deletes it (frees resources) * * string_init(string *str) - Initializes an existing string structure * string_term(string *str) - Terminates it * * NB At no time is the string NULL, it always creates and clears with * an empty string */ #include "string.h" string *new_string() { string *str; if((str = (string *)malloc(sizeof(string))) == NULL) return NULL; if((str->s = malloc(STRING_BLOCK)) == NULL) { free(str); return NULL; } str->len = 0; str->plen = STRING_BLOCK; *(str->s) = 0; return str; } string *new_string_s(char *s) { string *str; int plen; if((str = (string *)malloc(sizeof(string))) == NULL) return NULL; str->len = strlen(s); plen = (((str->len + 1)/ STRING_BLOCK) + 1) * STRING_BLOCK; if((str->s = malloc(plen)) == NULL) { free(str); return NULL; } str->plen = plen; strcpy(str->s, s); return str; } /* * Initialize an existing string */ string *string_init(string *str) { if((str->s = malloc(STRING_BLOCK)) == NULL) { return NULL; } str->len = 0; str->plen = STRING_BLOCK; return str; } /* * Terminate it */ void string_term(string *str) { free(str->s); } string *string_cat(string *str, char *s) { int plen; str->len += strlen(s); plen = (((1 + str->len)/ STRING_BLOCK) + 1) * STRING_BLOCK; if(plen > str->plen) { if((str->s = realloc(str->s, plen)) == NULL) { free(str); return NULL; } str->plen = plen; } strcat(str->s, s); return str; } string *string_cat_c(string *str, char c) { int plen; plen = (((2 + str->len)/ STRING_BLOCK) + 1) * STRING_BLOCK; if(plen > str->plen) { if((str->s = realloc(str->s, plen)) == NULL) { free(str); return NULL; } str->plen = plen; } str->s[str->len] = c; str->len++; str->s[str->len] = 0; return str; } string *string_set(string *str, char *s) { int plen; str->len = strlen(s); plen = (((1 + str->len)/ STRING_BLOCK) + 1) * STRING_BLOCK; if(plen != str->plen) { if((str->s = realloc(str->s, plen)) == NULL) { free(str); return NULL; } str->plen = plen; } strcpy(str->s, s); return str; } string *string_clear(string *str) { str->len = 0; if(STRING_BLOCK != str->plen) { if((str->s = realloc(str->s, STRING_BLOCK)) == NULL) { free(str); return NULL; } str->plen = STRING_BLOCK; } *(str->s) = 0; return str; } string *string_empty(string *str) { str->len = 0; *(str->s) = 0; return str; } char *string_s(string *str) { return str->s; } long string_len(string *str) { return str->len; } void string_delete(string *str) { free(str->s); free(str); } char string_last(string *str) { if(str->len) return str->s[str->len - 1]; return 0; } void string_minus(string *str) { if(str->len) { (str->len)--; str->s[str->len] = 0; } }
// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2011 Linaro Limited * Aneesh V <aneesh@ti.com> */ #include <common.h> #include <environment.h> #include <asm/setup.h> #include <asm/arch/sys_proto.h> #include <asm/omap_common.h> static void do_cancel_out(u32 *num, u32 *den, u32 factor) { while (1) { if (((*num)/factor*factor == (*num)) && ((*den)/factor*factor == (*den))) { (*num) /= factor; (*den) /= factor; } else break; } } #ifdef CONFIG_FASTBOOT_FLASH static void omap_set_fastboot_cpu(void) { char *cpu; u32 cpu_rev = omap_revision(); switch (cpu_rev) { case DRA762_ES1_0: case DRA762_ABZ_ES1_0: case DRA762_ACD_ES1_0: cpu = "DRA762"; break; case DRA752_ES1_0: case DRA752_ES1_1: case DRA752_ES2_0: cpu = "DRA752"; break; case DRA722_ES1_0: case DRA722_ES2_0: case DRA722_ES2_1: cpu = "DRA722"; break; default: cpu = NULL; printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev); } env_set("fastboot.cpu", cpu); } static void omap_set_fastboot_secure(void) { const char *secure; u32 dev = get_device_type(); switch (dev) { case EMU_DEVICE: secure = "EMU"; break; case HS_DEVICE: secure = "HS"; break; case GP_DEVICE: secure = "GP"; break; default: secure = NULL; printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev); } env_set("fastboot.secure", secure); } static void omap_set_fastboot_board_rev(void) { const char *board_rev; board_rev = env_get("board_rev"); if (board_rev == NULL) printf("Warning: fastboot.board_rev: unknown board revision\n"); env_set("fastboot.board_rev", board_rev); } #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV static u32 omap_mmc_get_part_size(const char *part) { int res; struct blk_desc *dev_desc; disk_partition_t info; u64 sz = 0; dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { pr_err("invalid mmc device\n"); return 0; } /* Check only for EFI (GPT) partition table */ res = part_get_info_by_name_type(dev_desc, part, &info, PART_TYPE_EFI); if (res < 0) return 0; /* Calculate size in bytes */ sz = (info.size * (u64)info.blksz); /* to KiB */ sz >>= 10; return (u32)sz; } static void omap_set_fastboot_userdata_size(void) { char buf[16]; u32 sz_kb; sz_kb = omap_mmc_get_part_size("userdata"); if (sz_kb == 0) return; /* probably it's not Android partition table */ sprintf(buf, "%u", sz_kb); env_set("fastboot.userdata_size", buf); } #else static inline void omap_set_fastboot_userdata_size(void) { } #endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */ void omap_set_fastboot_vars(void) { omap_set_fastboot_cpu(); omap_set_fastboot_secure(); omap_set_fastboot_board_rev(); omap_set_fastboot_userdata_size(); } #endif /* CONFIG_FASTBOOT_FLASH */ /* * Cancel out the denominator and numerator of a fraction * to get smaller numerator and denominator. */ void cancel_out(u32 *num, u32 *den, u32 den_limit) { do_cancel_out(num, den, 2); do_cancel_out(num, den, 3); do_cancel_out(num, den, 5); do_cancel_out(num, den, 7); do_cancel_out(num, den, 11); do_cancel_out(num, den, 13); do_cancel_out(num, den, 17); while ((*den) > den_limit) { *num /= 2; /* * Round up the denominator so that the final fraction * (num/den) is always <= the desired value */ *den = (*den + 1) / 2; } } __weak void omap_die_id(unsigned int *die_id) { die_id[0] = die_id[1] = die_id[2] = die_id[3] = 0; } void omap_die_id_serial(void) { unsigned int die_id[4] = { 0 }; char serial_string[17] = { 0 }; omap_die_id((unsigned int *)&die_id); if (!env_get("serial#")) { snprintf(serial_string, sizeof(serial_string), "%08x%08x", die_id[0], die_id[3]); env_set("serial#", serial_string); } } void omap_die_id_get_board_serial(struct tag_serialnr *serialnr) { char *serial_string; unsigned long long serial; serial_string = env_get("serial#"); if (serial_string) { serial = simple_strtoull(serial_string, NULL, 16); serialnr->high = (unsigned int) (serial >> 32); serialnr->low = (unsigned int) (serial & 0xffffffff); } else { serialnr->high = 0; serialnr->low = 0; } } void omap_die_id_usbethaddr(void) { unsigned int die_id[4] = { 0 }; unsigned char mac[6] = { 0 }; omap_die_id((unsigned int *)&die_id); if (!env_get("usbethaddr")) { /* * Create a fake MAC address from the processor ID code. * First byte is 0x02 to signify locally administered. */ mac[0] = 0x02; mac[1] = die_id[3] & 0xff; mac[2] = die_id[2] & 0xff; mac[3] = die_id[1] & 0xff; mac[4] = die_id[0] & 0xff; mac[5] = (die_id[0] >> 8) & 0xff; eth_env_set_enetaddr("usbethaddr", mac); if (!env_get("ethaddr")) eth_env_set_enetaddr("ethaddr", mac); } } void omap_die_id_display(void) { unsigned int die_id[4] = { 0 }; omap_die_id(die_id); printf("OMAP die ID: %08x%08x%08x%08x\n", die_id[3], die_id[2], die_id[1], die_id[0]); }
/** * @file find_closest_point.c * @brief find the two points in a given array that make their distance be * the minimum value so the the points are the closest pairs. * @author chenxilinsidney * @version 1.0 * @date 2015-02-15 */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> // #define NDEBUG #include <assert.h> // #define NDBG_PRINT #include "debug_print.h" typedef int ElementType; ///< element data type typedef int CommonType; ///< common data type /// Point struct typedef struct { ElementType x; ElementType y; }Point; #define MAX_COUNT 1000000 Point point_x[MAX_COUNT]; Point point_y[MAX_COUNT]; /// sort point array by x from small to big int compare_x(const void* a, const void* b) { return (*(Point*)a).x - (*(Point*)b).x; } /// sort point array by y from small to big int compare_y(const void* a, const void* b) { return (*(Point*)a).y - (*(Point*)b).y; } /// get distance for two point double distance_2D(Point x, Point y) { return sqrt((x.x - y.x)*(x.x - y.x) + (x.y - y.y)*(x.y - y.y)); } /// get distance for value that x is not larger than y double distance(ElementType x, ElementType y) { return (double)(y - x); } /** * @brief find point_a and point_b that they have the minimum distance in * the array. * * @param[in,out] array_x element array * @param[in,out] array_y element array * @param[in] array_size element array size * @param[out] point_a element a * @param[out] point_b element b * * @return return the minimum distance between value_a and value_b */ ElementType find_closest_point(Point* array_x, Point* array_y, CommonType array_size, Point* point_a, Point* point_b) { /// divide and conquer if (array_size > 2) { /// get middle point CommonType middle = (unsigned)array_size >> 1; /// get left and right distance Point left_point_a, left_point_b, right_point_a, right_point_b; double distance_left = find_closest_point(array_x, array_y, middle, &left_point_a, &left_point_b); double distance_right = find_closest_point(array_x + middle, array_y + middle, array_size - middle, &right_point_a, &right_point_b); /// get min distance of the two distance double distance_min_lr = distance_left < distance_right ? distance_left : distance_right; /// get search range CommonType ii = middle - 1; while (array_x[middle].x - array_x[ii].x < distance_min_lr) ii--; CommonType jj = middle; while (array_x[jj].x - array_x[middle].x < distance_min_lr) jj++; /// get middle distance in range CommonType i, j; double temp; for (i = ii; i < middle; i++) for (j = jj; j < array_size; j++) if ((temp = distance_2D(array_x[i], array_x[j])) < distance_min_lr) distance_min_lr = temp; return distance_min_lr; } else if (array_size == 2) { *point_a = array_x[0]; *point_b = array_x[1]; return distance_2D(*point_a, *point_b); } else { return 1000000; } } int main(void) { /// read data to array CommonType count = 0; while(count < MAX_COUNT && scanf("(%u,%u)\n", &(point_x[count].x), &(point_x[count].y)) == 2) { ++count; } memcpy(point_y, point_x, count * sizeof(point_x[0])); /// sort array by x and y qsort(point_x, count, sizeof(point_x[0]), compare_x); qsort(point_y, count, sizeof(point_y[0]), compare_y); /// display printf("Point count = %d\n", count); CommonType i; for (i = 0; i < count; i++) { printf("sorted point by x is (%d,%d).\n", point_x[i].x, point_x[i].y); } for (i = 0; i < count; i++) { printf("sorted point by y is (%d,%d).\n", point_y[i].x, point_y[i].y); } /// find closest values Point value_a; Point value_b; double distance = find_closest_point(point_x, point_y, count, &value_a, &value_b); /// output result // printf("closest value_a and value_b is %d, %d.\n", value_a, value_b); printf("closest distance is %f.\n", distance); return EXIT_SUCCESS; }
/* Copyright (C) 2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. DCP-o-matic 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. DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. */ #include <boost/shared_ptr.hpp> class Log; /** The current log; set up by the front-ends when they have a Film to log into */ extern boost::shared_ptr<Log> dcpomatic_log; #define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); #define LOG_GENERAL_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_GENERAL); #define LOG_ERROR(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_ERROR); #define LOG_ERROR_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_ERROR); #define LOG_WARNING(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_WARNING); #define LOG_WARNING_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_WARNING); #define LOG_TIMING(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_TIMING); #define LOG_DEBUG_ENCODE(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE);
/******************************************************************** * * * THIS FILE IS PART OF THE Theorarm SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 * * by the Xiph.Org Foundation and contributors http://www.xiph.org/ * * Modifications/Additions Copyright (C) 2009 Robin Watts for * * Pinknoise Productions Ltd. * * * ******************************************************************** function: last mod: $Id: decint.h 16503 2009-08-22 18:14:02Z giles $ ********************************************************************/ #include <limits.h> #if !defined(_decint_H) # define _decint_H (1) # include "theora/theoradec.h" # include "internal.h" # include "bitpack.h" typedef struct th_setup_info oc_setup_info; typedef struct th_dec_ctx oc_dec_ctx; # include "huffdec.h" # include "dequant.h" /*Constants for the packet-in state machine specific to the decoder.*/ /*Next packet to read: Data packet.*/ #define OC_PACKET_DATA (0) struct th_setup_info{ /*The Huffman codes.*/ oc_huff_node *huff_tables[TH_NHUFFMAN_TABLES]; /*The quantization parameters.*/ th_quant_info qinfo; }; struct th_dec_ctx{ /*Shared encoder/decoder state.*/ oc_theora_state state; /*Whether or not packets are ready to be emitted. This takes on negative values while there are remaining header packets to be emitted, reaches 0 when the codec is ready for input, and goes to 1 when a frame has been processed and a data packet is ready.*/ int packet_state; /*Buffer in which to assemble packets.*/ oc_pack_buf opb; /*Huffman decode trees.*/ oc_huff_node *huff_tables[TH_NHUFFMAN_TABLES]; /*The index of the first token in each plane for each coefficient.*/ ptrdiff_t ti0[3][64]; /*The number of outstanding EOB runs at the start of each coefficient in each plane.*/ ptrdiff_t eob_runs[3][64]; /*The DCT token lists.*/ unsigned char *dct_tokens; /*The extra bits associated with DCT tokens.*/ unsigned char *extra_bits; /*The number of dct tokens unpacked so far.*/ int dct_tokens_count; /*The out-of-loop post-processing level.*/ int pp_level; /*The DC scale used for out-of-loop deblocking.*/ int pp_dc_scale[64]; /*The sharpen modifier used for out-of-loop deringing.*/ int pp_sharp_mod[64]; /*The DC quantization index of each block.*/ unsigned char *dc_qis; /*The variance of each block.*/ int *variances; /*The storage for the post-processed frame buffer.*/ unsigned char *pp_frame_data; /*Whether or not the post-processsed frame buffer has space for chroma.*/ int pp_frame_state; /*The buffer used for the post-processed frame. Note that this is _not_ guaranteed to have the same strides and offsets as the reference frame buffers.*/ th_ycbcr_buffer pp_frame_buf; /*The striped decode callback function.*/ th_stripe_callback stripe_cb; # if defined(HAVE_CAIRO) /*Output metrics for debugging.*/ int telemetry; int telemetry_mbmode; int telemetry_mv; int telemetry_qi; int telemetry_bits; int telemetry_frame_bytes; int telemetry_coding_bytes; int telemetry_mode_bytes; int telemetry_mv_bytes; int telemetry_qi_bytes; int telemetry_dc_bytes; unsigned char *telemetry_frame_data; # endif }; #endif
/* * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file libavutil/sh4/bswap.h * byte swapping routines */ #ifndef AVUTIL_SH4_BSWAP_H #define AVUTIL_SH4_BSWAP_H #include <stdint.h> #include "config.h" #include "libavutil/attributes.h" #define bswap_16 bswap_16 static av_always_inline av_const uint16_t bswap_16(uint16_t x) { __asm__("swap.b %0,%0" : "+r"(x)); return x; } #define bswap_32 bswap_32 static av_always_inline av_const uint32_t bswap_32(uint32_t x) { __asm__("swap.b %0,%0\n" "swap.w %0,%0\n" "swap.b %0,%0\n" : "+r"(x)); return x; } #endif /* AVUTIL_SH4_BSWAP_H */
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * 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 Library 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 NACTV_DEFINITIONS_H #define NACTV_DEFINITIONS_H #include "config.h" #include "nactv-debug.h" #ifdef NACTV_LOCAL_BUILD #define GLADEDIR "src/" #define EXECUTABLE_PATH "src/netactview" #else /*ndef NACTV_LOCAL_BUILD*/ #define GLADEDIR DATADIR"/netactview/glade/" #define EXECUTABLE_PATH BINDIR"/netactview" #endif #define GLADEFILE GLADEDIR"netactview.glade" #endif /*NACTV_DEFINITIONS_H*/
#include "archive.h" #include "emu.h" #include "db.h" #include "crc32.h" #include "sha1.h" #define MAX_PRG_ROMS 4 #define MAX_CHR_ROMS 2 #define MAX_ROMS (MAX_PRG_ROMS + MAX_CHR_ROMS) static int load_split_rom_parts(struct archive *archive, int *chip_list, struct rom_info *rom_info, uint8_t **bufferp, size_t *sizep) { uint8_t *buffer; uint8_t *ptr; size_t size; off_t offsets[MAX_ROMS]; int file_list[MAX_ROMS]; int num_chips; int status; int i; size = 0; num_chips = rom_info->prg_size_count + rom_info->chr_size_count; for (i = 0; i < MAX_ROMS; i++) file_list[i] = -1; status = 0; for (i = 0; i < num_chips; i++) { int j; for (j = 0; j < archive->file_list->count; j++) { if (chip_list[j] == i) { offsets[i] = size; size += archive->file_list->entries[j].size; break; } } } buffer = malloc(INES_HEADER_SIZE + size); if (!buffer) { return -1; } ptr = buffer + INES_HEADER_SIZE; for (i = 0; i < num_chips; i++) { int j; for (j = 0; j < archive->file_list->count; j++) { if (chip_list[j] == i) { sha1nfo sha1; uint8_t *result; file_list[i] = j; status = archive_read_file_by_index(archive, file_list[i], ptr); if (status) { free(buffer); return -1; } /* Validate each chip's SHA1, if present. If it doesn't match, then move on to the next match for that chip in the archive. */ if ((i < rom_info->prg_size_count) && rom_info->prg_sha1_count) { sha1_init(&sha1); sha1_write(&sha1, (char *)ptr, archive->file_list->entries[file_list[i]].size); result = sha1_result(&sha1); if (memcmp(result, rom_info->prg_sha1[i], 20) != 0) { continue; } } else if (rom_info->chr_sha1_count) { sha1_init(&sha1); sha1_write(&sha1, (char *)ptr, archive->file_list->entries[file_list[i]].size); result = sha1_result(&sha1); if (memcmp(result, rom_info->chr_sha1[i - rom_info->prg_size_count], 20) != 0) { continue; } } ptr += archive->file_list->entries[file_list[i]].size; break; } } if (j == archive->file_list->count) { status = -1; break; } } if (status < 0) { if (bufferp) *bufferp = NULL; return 0; } status = -1; for (i = 0; (i < MAX_ROMS) && (file_list[i] >= 0); i++) { uint8_t *ptr; ptr = buffer + INES_HEADER_SIZE + offsets[i]; status = archive_read_file_by_index(archive, file_list[i], ptr); if (status) break; } if (status) { free(buffer); if (bufferp) *bufferp = NULL; return 0; } if (sizep) { *sizep = size + INES_HEADER_SIZE; } *bufferp = buffer; return 0; } /* This is a generic split-ROM format loader. It requires the database entry for the game in question to have the sizes and CRC32 and/or SHA1 checksums for each PRG chunk and CHR chunk listed in the correct order. Once a database entry is found for which all rom files are included in the archive, each split file is loaded into memory in order (based on the checksum lists in the database entry), then the final buffer is checksummed again and the size, CRC32 and SHA1 of the combined entry is checked against the same database entry (assuming the db entry provides a full-rom crc32 or sha1) . If the checksums of the rom match what's in the database entry, the load is considered successful. */ int split_rom_load(struct emu *emu, const char *filename, struct rom **romptr) { struct archive *archive; uint8_t *buffer; size_t size; struct rom_info *rom_info; struct rom *rom; int *chip_list; int i; if (!romptr) return -1; chip_list = NULL; *romptr = NULL; if (archive_open(&archive, filename)) return -1; chip_list = malloc(archive->file_list->count * sizeof(*chip_list)); if (!chip_list) return -1; rom_info = NULL; rom = NULL; buffer = NULL; do { rom_info = db_lookup_split_rom(archive, chip_list, rom_info); if (!rom_info) break; if (load_split_rom_parts(archive, chip_list, rom_info, &buffer, &size)) { break; } if (!buffer) continue; rom = rom_alloc(filename, buffer, size); if (!rom) break; /* Store the filename of the first PRG chip as the empty string; this allows patches to be included with split roms as well, but they need to be located in the top-level directory of the archive. */ rom->compressed_filename = strdup(""); buffer = NULL; memcpy(&rom->info, rom_info, sizeof(*rom_info)); if (rom_info->name) rom->info.name = strdup(rom_info->name); else rom->info.name = NULL; rom->offset = INES_HEADER_SIZE; rom_calculate_checksum(rom); for (i = 0; i < archive->file_list->count; i++) { char *basename; if (!archive->file_list->entries[i].name) continue; basename = strrchr(archive->file_list->entries[i].name, '/'); if (!basename) basename = archive->file_list->entries[i].name; /* Hack for PlayChoice ROMs; most of these are the same as NES carts, so check for a file called 'security.prm' to distinguish them. */ if (!strcasecmp(basename, "security.prm")) { if (rom->info.flags & ROM_FLAG_PLAYCHOICE) rom->info.system_type = EMU_SYSTEM_TYPE_PLAYCHOICE; } } /* Validate individual chip CRCs or SHA1s if present, then the combined CRC and/or SHA1, if present. */ if (!validate_checksums(rom, rom_info)) goto invalid; if ((rom->info.flags & ROM_FLAG_HAS_CRC) && (rom->info.combined_crc != rom_info->combined_crc)) { goto invalid; } if ((rom->info.flags & ROM_FLAG_HAS_SHA1) && memcmp(rom->info.combined_sha1, rom_info->combined_sha1, 20)) { goto invalid; } break; invalid: rom_free(rom); rom = NULL; } while (rom_info); archive_close(&archive); if (chip_list) free(chip_list); if (buffer) free(buffer); if (!rom) return -1; *romptr = rom; return 0; }
/* Generic support for remote debugging interfaces. Copyright 1993, 1994, 2000, 2001 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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 REMOTE_UTILS_H #define REMOTE_UTILS_H struct target_ops; #include "target.h" struct serial; /* Stuff that should be shared (and handled consistently) among the various remote targets. */ struct _sr_settings { unsigned int timeout; int retries; char *device; struct serial *desc; }; extern struct _sr_settings sr_settings; /* get and set debug value. */ #define sr_get_debug() (remote_debug) #define sr_set_debug(newval) (remote_debug = (newval)) /* get and set timeout. */ #define sr_get_timeout() (sr_settings.timeout) #define sr_set_timeout(newval) (sr_settings.timeout = (newval)) /* get and set device. */ #define sr_get_device() (sr_settings.device) #define sr_set_device(newval) \ { \ if (sr_settings.device) xfree (sr_settings.device); \ sr_settings.device = (newval); \ } /* get and set descriptor value. */ #define sr_get_desc() (sr_settings.desc) #define sr_set_desc(newval) (sr_settings.desc = (newval)) /* get and set retries. */ #define sr_get_retries() (sr_settings.retries) #define sr_set_retries(newval) (sr_settings.retries = (newval)) #define sr_is_open() (sr_settings.desc != NULL) #define sr_check_open() { if (!sr_is_open()) \ error (_("Remote device not open")); } struct gr_settings { char *prompt; struct target_ops *ops; int (*clear_all_breakpoints) (void); void (*checkin) (void); }; extern struct gr_settings *gr_settings; /* get and set prompt. */ #define gr_get_prompt() (gr_settings->prompt) #define gr_set_prompt(newval) (gr_settings->prompt = (newval)) /* get and set ops. */ #define gr_get_ops() (gr_settings->ops) #define gr_set_ops(newval) (gr_settings->ops = (newval)) #define gr_clear_all_breakpoints() ((gr_settings->clear_all_breakpoints)()) #define gr_checkin() ((gr_settings->checkin)()) /* Keep discarding input until we see the prompt. The convention for dealing with the prompt is that you o give your command o *then* wait for the prompt. Thus the last thing that a procedure does with the serial line will be an gr_expect_prompt(). Exception: resume does not wait for the prompt, because the terminal is being handed over to the inferior. However, the next thing which happens after that is a bug_wait which does wait for the prompt. Note that this includes abnormal exit, e.g. error(). This is necessary to prevent getting into states from which we can't recover. */ #define gr_expect_prompt() sr_expect(gr_get_prompt()) int gr_multi_scan (char *list[], int passthrough); int sr_get_hex_digit (int ignore_space); int sr_pollchar (void); int sr_readchar (void); int sr_timed_read (char *buf, int n); long sr_get_hex_word (void); void gr_close (int quitting); void gr_create_inferior (char *execfile, char *args, char **env); void gr_detach (char *args, int from_tty); void gr_files_info (struct target_ops *ops); void gr_generic_checkin (void); void gr_kill (void); void gr_mourn (void); void gr_prepare_to_store (void); void sr_expect (char *string); void sr_get_hex_byte (char *byt); void sr_scan_args (char *proto, char *args); void sr_write (char *a, int l); void sr_write_cr (char *s); void gr_open (char *args, int from_tty, struct gr_settings *gr_settings); void gr_load_image (char *, int from_tty); #endif /* REMOTE_UTILS_H */
/* conversations_usb.c 2007 Jon Smirl * modified from conversations_eth.c 2003 Ronnie Sahlberg * * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <string.h> #include <gtk/gtk.h> #include <epan/packet.h> #include <epan/stat_cmd_args.h> #include <epan/tap.h> #include "../stat_menu.h" #include "ui/gtk/gui_stat_menu.h" #include "ui/gtk/conversations_table.h" void register_tap_listener_usb_conversation(void); static int usb_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_) { add_conversation_table_data((conversations_table *)pct, &pinfo->src, &pinfo->dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, SAT_NONE, PT_NONE); return 1; } static void usb_conversation_init(const char *opt_arg, void* userdata _U_) { const char *filter=NULL; if (!strncmp(opt_arg, "conv,usb,", 9)) { filter = opt_arg + 9; } else { filter = NULL; } init_conversation_table(TRUE, "USB", "usb", filter, usb_conversation_packet); } void usb_endpoints_cb(GtkAction *action _U_, gpointer user_data _U_) { usb_conversation_init("conv,usb", NULL); } void register_tap_listener_usb_conversation(void) { register_stat_cmd_arg("conv,usb", usb_conversation_init, NULL); register_conversation_table(TRUE, "USB", "usb", NULL /*filter*/, usb_conversation_packet); }
/* Mantis PCI bridge driver Copyright (C) Manu Abraham (abraham.manu@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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/kernel.h> #include <linux/i2c.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/interrupt.h> #include "dmxdev.h" #include "dvbdev.h" #include "dvb_demux.h" #include "dvb_frontend.h" #include "dvb_net.h" #include "mantis_common.h" #include "mantis_reg.h" #include "mantis_ioc.h" static int read_eeprom_bytes(struct mantis_pci *mantis, u8 reg, u8 *data, u8 length) { struct i2c_adapter *adapter = &mantis->adapter; int err; u8 buf = reg; struct i2c_msg msg[] = { { .addr = 0x50, .flags = 0, .buf = &buf, .len = 1 }, { .addr = 0x50, .flags = I2C_M_RD, .buf = data, .len = length }, }; err = i2c_transfer(adapter, msg, 2); if (err < 0) { dprintk(MANTIS_ERROR, 1, "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >", err, data[0], data[1]); return err; } return 0; } int mantis_get_mac(struct mantis_pci *mantis) { int err; u8 mac_addr[6] = {0}; err = read_eeprom_bytes(mantis, 0x08, mac_addr, 6); if (err < 0) { dprintk(MANTIS_ERROR, 1, "ERROR: Mantis EEPROM read error <%d>", err); return err; } <<<<<<< HEAD dprintk(MANTIS_ERROR, 0, " MAC Address=[%pM]\n", mac_addr); ======= dprintk(MANTIS_ERROR, 0, " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a return 0; } EXPORT_SYMBOL_GPL(mantis_get_mac); /* Turn the given bit on or off. */ <<<<<<< HEAD void mantis_gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) ======= void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a { u32 cur; dprintk(MANTIS_DEBUG, 1, "Set Bit <%d> to <%d>", bitpos, value); cur = mmread(MANTIS_GPIF_ADDR); if (value) mantis->gpio_status = cur | (1 << bitpos); else mantis->gpio_status = cur & (~(1 << bitpos)); dprintk(MANTIS_DEBUG, 1, "GPIO Value <%02x>", mantis->gpio_status); mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR); mmwrite(0x00, MANTIS_GPIF_DOUT); } <<<<<<< HEAD EXPORT_SYMBOL_GPL(mantis_gpio_set_bits); ======= EXPORT_SYMBOL_GPL(gpio_set_bits); >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl) { u32 reg; reg = mmread(MANTIS_CONTROL); switch (stream_ctl) { case STREAM_TO_HIF: dprintk(MANTIS_DEBUG, 1, "Set stream to HIF"); reg &= 0xff - MANTIS_BYPASS; mmwrite(reg, MANTIS_CONTROL); reg |= MANTIS_BYPASS; mmwrite(reg, MANTIS_CONTROL); break; case STREAM_TO_CAM: dprintk(MANTIS_DEBUG, 1, "Set stream to CAM"); reg |= MANTIS_BYPASS; mmwrite(reg, MANTIS_CONTROL); reg &= 0xff - MANTIS_BYPASS; mmwrite(reg, MANTIS_CONTROL); break; default: dprintk(MANTIS_ERROR, 1, "Unknown MODE <%02x>", stream_ctl); return -1; } return 0; } EXPORT_SYMBOL_GPL(mantis_stream_control);
/* readtokens.c -- Functions for reading tokens from an input stream. Copyright (C) 1990-1991, 1999 Jim Meyering. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Written by Jim Meyering. */ /* This almost supercedes xreadline stuff -- using delim="\n" gives the same functionality, except that these functions would never return empty lines. To Do: - To allow '\0' as a delimiter, I will have to change interfaces to permit specification of delimiter-string length. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #ifdef STDC_HEADERS # include <stdlib.h> #endif #if defined (STDC_HEADERS) || defined(HAVE_STRING_H) # include <string.h> /* An ANSI string.h and pre-ANSI memory.h might conflict. */ # if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H) # include <memory.h> # endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #else /* not STDC_HEADERS and not HAVE_STRING_H */ # include <strings.h> /* memory.h and strings.h conflict on some systems. */ #endif /* not STDC_HEADERS and not HAVE_STRING_H */ #include "readtokens.h" void *xmalloc (); void *xrealloc (); #define STREQ(a,b) ((a) == (b) || ((a) && (b) && *(a) == *(b) \ && strcmp(a, b) == 0)) /* Initialize a tokenbuffer. */ void init_tokenbuffer (tokenbuffer) token_buffer *tokenbuffer; { tokenbuffer->size = INITIAL_TOKEN_LENGTH; tokenbuffer->buffer = ((char *) xmalloc (INITIAL_TOKEN_LENGTH)); } /* Read a token from `stream' into `tokenbuffer'. Upon return, the token is in tokenbuffer->buffer and has a trailing '\0' instead of the original delimiter. The function value is the length of the token not including the final '\0'. When EOF is reached (i.e. on the call after the last token is read), -1 is returned and tokenbuffer isn't modified. This function will work properly on lines containing NUL bytes and on files that aren't newline-terminated. */ long readtoken (FILE *stream, const char *delim, int n_delim, token_buffer *tokenbuffer) { char *p; int c, i, n; static const char *saved_delim = NULL; static char isdelim[256]; int same_delimiters; if (delim == NULL && saved_delim == NULL) abort (); same_delimiters = 0; if (delim != saved_delim && saved_delim != NULL) { same_delimiters = 1; for (i = 0; i < n_delim; i++) { if (delim[i] != saved_delim[i]) { same_delimiters = 0; break; } } } if (!same_delimiters) { const char *t; saved_delim = delim; for (i = 0; i < sizeof (isdelim); i++) isdelim[i] = 0; for (t = delim; *t; t++) isdelim[(unsigned int) *t] = 1; } p = tokenbuffer->buffer; n = tokenbuffer->size; i = 0; /* FIXME: don't fool with this caching BS. Use strchr instead. */ /* skip over any leading delimiters */ for (c = getc (stream); c >= 0 && isdelim[c]; c = getc (stream)) { /* empty */ } for (;;) { if (i >= n) { n = 3 * (n / 2 + 1); p = xrealloc (p, (unsigned int) n); } if (c < 0) { if (i == 0) return (-1); p[i] = 0; break; } if (isdelim[c]) { p[i] = 0; break; } p[i++] = c; c = getc (stream); } tokenbuffer->buffer = p; tokenbuffer->size = n; return (i); } /* Return a NULL-terminated array of pointers to tokens read from `stream.' The number of tokens is returned as the value of the function. All storage is obtained through calls to malloc(); %%% Question: is it worth it to do a single %%% realloc() of `tokens' just before returning? */ int readtokens (FILE *stream, int projected_n_tokens, const char *delim, int n_delim, char ***tokens_out, long **token_lengths) { token_buffer tb, *token = &tb; int token_length; char **tokens; long *lengths; int sz; int n_tokens; n_tokens = 0; if (projected_n_tokens > 0) projected_n_tokens++; /* add one for trailing NULL pointer */ else projected_n_tokens = 64; sz = projected_n_tokens; tokens = (char **) xmalloc (sz * sizeof (char *)); lengths = (long *) xmalloc (sz * sizeof (long)); init_tokenbuffer (token); for (;;) { char *tmp; token_length = readtoken (stream, delim, n_delim, token); if (n_tokens >= sz) { sz *= 2; tokens = (char **) xrealloc (tokens, sz * sizeof (char *)); lengths = (long *) xrealloc (lengths, sz * sizeof (long)); } if (token_length < 0) { /* don't increment n_tokens for NULL entry */ tokens[n_tokens] = NULL; lengths[n_tokens] = -1; break; } tmp = (char *) xmalloc ((token_length + 1) * sizeof (char)); lengths[n_tokens] = token_length; tokens[n_tokens] = strncpy (tmp, token->buffer, (unsigned) (token_length + 1)); n_tokens++; } free (token->buffer); *tokens_out = tokens; if (token_lengths != NULL) *token_lengths = lengths; return n_tokens; }
/* * Copyright (c) 2000-2006 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would 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 the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" #include "xfs_fs.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_alloc.h" #include "xfs_quota.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_itable.h" #include "xfs_bmap.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_qm.h" STATIC void xfs_fill_statvfs_from_dquot( struct kstatfs *statp, struct xfs_dquot *dqp) { __uint64_t limit; limit = dqp->q_core.d_blk_softlimit ? be64_to_cpu(dqp->q_core.d_blk_softlimit) : be64_to_cpu(dqp->q_core.d_blk_hardlimit); if (limit && statp->f_blocks > limit) { statp->f_blocks = limit; statp->f_bfree = statp->f_bavail = (statp->f_blocks > dqp->q_res_bcount) ? (statp->f_blocks - dqp->q_res_bcount) : 0; } limit = dqp->q_core.d_ino_softlimit ? be64_to_cpu(dqp->q_core.d_ino_softlimit) : be64_to_cpu(dqp->q_core.d_ino_hardlimit); if (limit && statp->f_files > limit) { statp->f_files = limit; statp->f_ffree = (statp->f_files > dqp->q_res_icount) ? (statp->f_ffree - dqp->q_res_icount) : 0; } } /* * Directory tree accounting is implemented using project quotas, where * the project identifier is inherited from parent directories. * A statvfs (df, etc.) of a directory that is using project quota should * return a statvfs of the project, not the entire filesystem. * This makes such trees appear as if they are filesystems in themselves. */ void xfs_qm_statvfs( xfs_inode_t *ip, struct kstatfs *statp) { xfs_mount_t *mp = ip->i_mount; xfs_dquot_t *dqp; if (!xfs_qm_dqget(mp, NULL, xfs_get_projid(ip), XFS_DQ_PROJ, 0, &dqp)) { xfs_fill_statvfs_from_dquot(statp, dqp); xfs_qm_dqput(dqp); } } int xfs_qm_newmount( xfs_mount_t *mp, uint *needquotamount, uint *quotaflags) { uint quotaondisk; uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0; quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) && (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); if (quotaondisk) { uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT; pquotaondisk = mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT; gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT; } /* * If the device itself is read-only, we can't allow * the user to change the state of quota on the mount - * this would generate a transaction on the ro device, * which would lead to an I/O error and shutdown */ if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) || (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) || (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) || (!pquotaondisk && XFS_IS_PQUOTA_ON(mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && xfs_dev_is_read_only(mp, "changing quota state")) { xfs_warn(mp, "please mount with%s%s%s%s.", (!quotaondisk ? "out quota" : ""), (uquotaondisk ? " usrquota" : ""), (pquotaondisk ? " prjquota" : ""), (gquotaondisk ? " grpquota" : "")); return XFS_ERROR(EPERM); } if (XFS_IS_QUOTA_ON(mp) || quotaondisk) { /* * Call mount_quotas at this point only if we won't have to do * a quotacheck. */ if (quotaondisk && !XFS_QM_NEED_QUOTACHECK(mp)) { /* * If an error occurred, qm_mount_quotas code * has already disabled quotas. So, just finish * mounting, and get on with the boring life * without disk quotas. */ xfs_qm_mount_quotas(mp); } else { /* * Clear the quota flags, but remember them. This * is so that the quota code doesn't get invoked * before we're ready. This can happen when an * inode goes inactive and wants to free blocks, * or via xfs_log_mount_finish. */ *needquotamount = true; *quotaflags = mp->m_qflags; mp->m_qflags = 0; } } return 0; }
/* perfx-protocol.c * * Copyright (C) 2011 Christian Hergert <chris@dronelabs.com> * * 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. */ #include <unistd.h> #include "perfx-debug.h" #include "perfx-main.h" #include "perfx-protocol.h" void PerfxProtocol_RecvData(PerfxProtocol *protocol, /* IN */ PerfxBuffer *buffer) /* IN */ { PerfxProtocolClass *class; ENTRY; ASSERT(protocol); ASSERT(PERFX_PROTOCOL(protocol)); ASSERT(buffer); class = PERFX_PROTOCOL_GET_CLASS(protocol); ASSERT(class); if (class->DataReceived) { class->DataReceived(protocol, buffer); } EXIT; } /* *-------------------------------------------------------------------------- * * PerfxProtocol_SendData -- * * Sends a buffer to the protocols destination. * * Returns: * None. * * Side effects: * None. * *-------------------------------------------------------------------------- */ void PerfxProtocol_SendData(PerfxProtocol *protocol, /* IN */ PerfxBuffer *buffer) /* IN */ { ASSERT(protocol); ASSERT(protocol->connection); ASSERT(buffer); PerfxConnection_Send(protocol->connection, buffer); } /* *-------------------------------------------------------------------------- * * PerfxProtocol_ConnectionLost -- * * Calls the ConnectionLost handler if it is specified. * * Returns: * None. * * Side effects: * None. * *-------------------------------------------------------------------------- */ void PerfxProtocol_ConnectionLost(PerfxProtocol *protocol) /* IN */ { PerfxProtocolClass *class; uint32_t reason = 0; ENTRY; ASSERT(protocol); /* * TODO: determine reason. */ class = PERFX_PROTOCOL_GET_CLASS(protocol); if (class->ConnectionLost) { class->ConnectionLost(protocol, reason); } protocol->connection = NULL; EXIT; } void PerfxProtocol_ConnectionMade(PerfxProtocol *protocol, /* IN */ PerfxConnection *connection) /* IN */ { PerfxProtocolClass *class; ENTRY; ASSERT(protocol); ASSERT(connection); ASSERT(protocol->connection == NULL); protocol->connection = connection; class = PERFX_PROTOCOL_GET_CLASS(protocol); if (class->ConnectionMade) { class->ConnectionMade(protocol, connection); } EXIT; } /* *-------------------------------------------------------------------------- * * PerfxProtocol_Destroy -- * * Handle destruction of the PerfxProtocol instance. * * Returns: * None. * * Side effects: * Frees any lingering resources. * *-------------------------------------------------------------------------- */ static void PerfxProtocol_Destroy(PerfxObject *object) /* IN */ { } /* *-------------------------------------------------------------------------- * * PerfxProtocol_Init -- * * Initialize the PerfxProtocol structure. * * Returns: * None. * * Side effects: * None. * *-------------------------------------------------------------------------- */ static void PerfxProtocol_Init(PerfxObject *object) /* IN */ { ENTRY; EXIT; } /* *-------------------------------------------------------------------------- * * PerfxProtocol_GetType -- * * Retrieve the type id for the PerfxProtocol class. * * Returns: * A PerfxType id. * * Side effects: * Type may be registered. * *-------------------------------------------------------------------------- */ PerfxType PerfxProtocol_GetType(void) { PerfxClass *class; static PerfxType type = 0; if (!type) { type = PerfxClass_Register("PerfxProtocol", 0, sizeof(PerfxProtocolClass), sizeof(PerfxProtocol), TRUE); class = PerfxType_GetClass(type); class->Init = PerfxProtocol_Init; class->Destroy = PerfxProtocol_Destroy; } return type; }
#ifndef SQL_TYPE_INET_H #define SQL_TYPE_INET_H /* Copyright (c) 2011,2013, Oracle and/or its affiliates. Copyright (c) 2014 MariaDB Foundation Copyright (c) 2019,2021 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ static const size_t IN_ADDR_SIZE= 4; static const size_t IN_ADDR_MAX_CHAR_LENGTH= 15; static const size_t IN6_ADDR_SIZE= 16; static const size_t IN6_ADDR_NUM_WORDS= IN6_ADDR_SIZE / 2; /** Non-abbreviated syntax is 8 groups, up to 4 digits each, plus 7 delimiters between the groups. Abbreviated syntax is even shorter. */ static const uint IN6_ADDR_MAX_CHAR_LENGTH= 8 * 4 + 7; #include "sql_type_fixedbin_storage.h" class Inet6: public FixedBinTypeStorage<IN6_ADDR_SIZE, IN6_ADDR_MAX_CHAR_LENGTH> { public: using FixedBinTypeStorage::FixedBinTypeStorage; bool ascii_to_fbt(const char *str, size_t str_length); size_t to_string(char *dst, size_t dstsize) const; static const Name &default_value(); }; #include "sql_type_fixedbin.h" typedef FixedBinTypeBundle<Inet6> Inet6Bundle; /***********************************************************************/ class Inet4 { char m_buffer[IN_ADDR_SIZE]; protected: bool ascii_to_ipv4(const char *str, size_t length); bool character_string_to_ipv4(const char *str, size_t str_length, CHARSET_INFO *cs) { if (cs->state & MY_CS_NONASCII) { char tmp[IN_ADDR_MAX_CHAR_LENGTH]; String_copier copier; uint length= copier.well_formed_copy(&my_charset_latin1, tmp, sizeof(tmp), cs, str, str_length); return ascii_to_ipv4(tmp, length); } return ascii_to_ipv4(str, str_length); } bool binary_to_ipv4(const char *str, size_t length) { if (length != sizeof(m_buffer)) return true; memcpy(m_buffer, str, length); return false; } // Non-initializing constructor Inet4() { } public: void to_binary(char *dst, size_t dstsize) const { DBUG_ASSERT(dstsize >= sizeof(m_buffer)); memcpy(dst, m_buffer, sizeof(m_buffer)); } bool to_binary(String *to) const { return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin); } size_t to_string(char *dst, size_t dstsize) const; bool to_string(String *to) const { to->set_charset(&my_charset_latin1); if (to->alloc(INET_ADDRSTRLEN)) return true; to->length((uint32) to_string((char*) to->ptr(), INET_ADDRSTRLEN)); return false; } }; class Inet4_null: public Inet4, public Null_flag { public: // Initialize from a text representation Inet4_null(const char *str, size_t length, CHARSET_INFO *cs) :Null_flag(character_string_to_ipv4(str, length, cs)) { } Inet4_null(const String &str) :Inet4_null(str.ptr(), str.length(), str.charset()) { } // Initialize from a binary representation Inet4_null(const char *str, size_t length) :Null_flag(binary_to_ipv4(str, length)) { } Inet4_null(const Binary_string &str) :Inet4_null(str.ptr(), str.length()) { } public: const Inet4& to_inet4() const { DBUG_ASSERT(!is_null()); return *this; } void to_binary(char *dst, size_t dstsize) const { to_inet4().to_binary(dst, dstsize); } bool to_binary(String *to) const { return to_inet4().to_binary(to); } size_t to_string(char *dst, size_t dstsize) const { return to_inet4().to_string(dst, dstsize); } bool to_string(String *to) const { return to_inet4().to_string(to); } }; #endif /* SQL_TYPE_INET_H */
/*------------------------------------------------------------------------- fssub.c Copyright (C) 1991, Pipeline Associates, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1, 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this library; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, if you link this library with other files, some of which are compiled with SDCC, to produce an executable, this library does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. -------------------------------------------------------------------------*/ /* ** libgcc support for software floating point. ** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved. ** Permission is granted to do *anything* you want with this file, ** commercial or otherwise, provided this message remains intact. So there! ** I would appreciate receiving any updates/patches/changes that anyone ** makes, and am willing to be the repository for said changes (am I ** making a big mistake?). ** ** Pat Wood ** Pipeline Associates, Inc. ** pipeline!phw@motown.com or ** sun!pipeline!phw or ** uunet!motown!pipeline!phw */ /* (c)2000/2001: hacked a little by johan.knol@iduna.nl for sdcc */ #include <float.h> union float_long { float f; long l; }; /* subtract two floats */ float __fssub (float a1, float a2) _FS_REENTRANT { volatile union float_long fl1, fl2; fl1.f = a1; fl2.f = a2; /* check for zero args */ if (!fl2.l) return (fl1.f); if (!fl1.l) return (-fl2.f); /* twiddle sign bit and add */ fl2.l ^= SIGNBIT; return fl1.f + fl2.f; }
/* * Authors: T. Heim <timon.heim@cern.ch>, * Date: 2016-Mar-30 */ #ifndef FE65P2QCLOOP_H #define FE65P2QCLOOP_H #include "LoopActionBase.h" #include "Fe65p2.h" class Fe65p2QcLoop : public LoopActionBase { public: Fe65p2QcLoop(); private: unsigned m_mask; unsigned m_cur; void init(); void end(); void execPart1(); void execPart2(); }; #endif
/* ** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) ** ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of version 2 of the GNU Library General ** Public License as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Library General Public License for more details. To obtain a ** copy of the GNU Library General Public License, write to the Free ** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** Any permitted reproduction of these routines, in whole or in part, ** must bear this legend. ** ** ** dis6502.h ** ** 6502 disassembler header ** $Id: dis6502.h,v 1.1 2003/04/08 20:53:00 ben Exp $ */ #ifndef _DIS6502_H_ #define _DIS6502_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern void nes6502_disasm(uint32 PC, uint8 P, uint8 A, uint8 X, uint8 Y, uint8 S); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* !_DIS6502_H_ */ /* ** $Log: dis6502.h,v $ ** Revision 1.1 2003/04/08 20:53:00 ben ** Adding more files... ** ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** */
/* Copyright (c) 2004-2010 Jay Sorg 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. */ #if !defined(ARCH_H) #define ARCH_H #if !(defined(L_ENDIAN) || defined(B_ENDIAN)) /* check endianess */ #if defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || \ defined(__hppa__) #define B_ENDIAN #else #define L_ENDIAN #endif /* check if we need to align data */ #if defined(__sparc__) || defined(__alpha__) || defined(__hppa__) || \ defined(__AIX__) || defined(__PPC__) || defined(__mips__) || \ defined(__ia64__) || defined(__ppc__) || defined(__arm__) #define NEED_ALIGN #endif #endif /* defines for thread creation factory functions */ #if defined(_WIN32) #define THREAD_RV unsigned long #define THREAD_CC __stdcall #else #define THREAD_RV void* #define THREAD_CC #endif #if defined(__BORLANDC__) || defined(_WIN32) #define APP_CC __fastcall #define DEFAULT_CC __cdecl #else #define APP_CC #define DEFAULT_CC #endif #if defined(_WIN32) #if defined(__BORLANDC__) #define EXPORT_CC _export __cdecl #else #define EXPORT_CC #endif #else #define EXPORT_CC #endif typedef char ti8; typedef unsigned char tui8; typedef signed char tsi8; typedef short ti16; typedef unsigned short tui16; typedef signed short tsi16; typedef int ti32; typedef unsigned int tui32; typedef signed int tsi32; #if defined(_WIN64) /* Microsoft's VC++ compiler uses the more backwards-compatible LLP64 model. Most other 64 bit compilers(Solaris, AIX, HP, Linux, Mac OS X) use the LP64 model. long is 32 bits in LLP64 model, 64 bits in LP64 model. */ typedef __int64 tbus; #else typedef long tbus; #endif typedef tbus thandle; typedef tbus tintptr; /* wide char, socket */ #if defined(_WIN32) typedef unsigned short twchar; typedef unsigned int tsock; typedef unsigned __int64 tui64; typedef signed __int64 tsi64; #else typedef int twchar; typedef int tsock; typedef unsigned long long tui64; typedef signed long long tsi64; #endif #endif
#include <linux/kernel.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/highmem.h> #include <linux/page-debug-flags.h> #include <linux/poison.h> #include <linux/ratelimit.h> #ifndef mark_addr_rdonly #define mark_addr_rdonly(a) #endif #ifndef mark_addr_rdwrite #define mark_addr_rdwrite(a) #endif static inline void set_page_poison(struct page *page) { __set_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); } static inline void clear_page_poison(struct page *page) { __clear_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); } static inline bool page_poison(struct page *page) { return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); } static void poison_page(struct page *page) { void *addr = kmap_atomic(page); set_page_poison(page); memset(addr, PAGE_POISON, PAGE_SIZE); mark_addr_rdonly(addr); kunmap_atomic(addr); } static void poison_pages(struct page *page, int n) { int i; for (i = 0; i < n; i++) poison_page(page + i); } static bool single_bit_flip(unsigned char a, unsigned char b) { unsigned char error = a ^ b; return error && !(error & (error - 1)); } struct page_poison_information { u64 virtualaddress; u64 physicaladdress; char buf; }; #define MAX_PAGE_POISON_COUNT 8 static struct page_poison_information page_poison_array[MAX_PAGE_POISON_COUNT]={{0,0}}; static int page_poison_count = 0; static void check_poison_mem(struct page *page, unsigned char *mem, size_t bytes) { static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10); unsigned char *start; unsigned char *end; start = memchr_inv(mem, PAGE_POISON, bytes); if (!start) return; for (end = mem + bytes - 1; end > start; end--) { if (*end != PAGE_POISON) break; } if (!__ratelimit(&ratelimit)) return; else if (start == end && single_bit_flip(*start, PAGE_POISON)) { pr_err("pagealloc: single bit error on page with phys start 0x%lx\n", (unsigned long)page_to_phys(page)); printk(KERN_ERR "virt: %p, phys: 0x%llx\n", start, virt_to_phys(start)); if(page_poison_count == MAX_PAGE_POISON_COUNT-1){ BUG_ON(PANIC_CORRUPTION); dump_stack(); }else { page_poison_array[page_poison_count].virtualaddress = (u64)start; page_poison_array[page_poison_count].physicaladdress = (u64)(virt_to_phys(start)); page_poison_array[page_poison_count].buf = *start; page_poison_count++; } } else{ pr_err("pagealloc: memory corruption on page with phys start 0x%lx\n", (unsigned long)page_to_phys(page)); print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, start, end - start + 1, 1); BUG_ON(PANIC_CORRUPTION); dump_stack(); } } static void unpoison_page(struct page *page) { void *addr; if (!page_poison(page)) return; addr = kmap_atomic(page); check_poison_mem(page, addr, PAGE_SIZE); mark_addr_rdwrite(addr); clear_page_poison(page); kunmap_atomic(addr); } static void unpoison_pages(struct page *page, int n) { int i; for (i = 0; i < n; i++) unpoison_page(page + i); } void kernel_map_pages(struct page *page, int numpages, int enable) { if (enable) unpoison_pages(page, numpages); else poison_pages(page, numpages); }
/* Copyright (C) 2002-2011 Victor Luchits 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. */ /* ======================================================================= CINEMATICS PLAYBACK ABSTRACTION LAYER ======================================================================= */ #include "cin_local.h" #include "cin_ogg.h" #include "cin_roq.h" enum { CIN_TYPE_NONE = -1, CIN_TYPE_OGG, CIN_TYPE_ROQ, CIN_NUM_TYPES }; typedef struct { const char * const extensions; qboolean ( *init )( cinematics_t *cin ); void ( *shutdown )( cinematics_t *cin ); void ( *reset )( cinematics_t *cin ); qboolean ( *need_next_frame )( cinematics_t *cin ); qbyte *( *read_next_frame )( cinematics_t *cin, qboolean *redraw ); } cin_type_t; static const cin_type_t cin_types[] = { // Ogg Theora { OGG_FILE_EXTENSIONS, Ogg_Init_CIN, Ogg_Shutdown_CIN, Ogg_Reset_CIN, Ogg_NeedNextFrame_CIN, Ogg_ReadNextFrame_CIN }, // RoQ - http://wiki.multimedia.cx/index.php?title=ROQ { ROQ_FILE_EXTENSIONS, RoQ_Init_CIN, RoQ_Shutdown_CIN, RoQ_Reset_CIN, RoQ_NeedNextFrame_CIN, RoQ_ReadNextFrame_CIN }, // NULL safe guard { NULL, NULL, NULL, NULL } }; // ===================================================================== /* * CIN_Open */ cinematics_t *CIN_Open( const char *name, unsigned int start_time, int flags ) { int i; size_t name_size; const cin_type_t *type; qboolean res; struct mempool_s *mempool; cinematics_t *cin = NULL; name_size = strlen( "video/" ) + strlen( name ) + /*strlen( ".roq" )*/10 + 1; mempool = CIN_AllocPool( name ); cin = CIN_Alloc( mempool, sizeof( *cin ) ); memset( cin, 0, sizeof( *cin ) ); cin->mempool = mempool; cin->file = 0; cin->flags = flags; cin->name = CIN_Alloc( cin->mempool, name_size ); cin->frame = 0; cin->width = cin->height = 0; cin->aspect_numerator = cin->aspect_denominator = 0; // do not keep aspect ratio cin->start_time = cin->cur_time = start_time; if( trap_FS_IsUrl( name ) ) { cin->type = CIN_TYPE_OGG; Q_strncpyz( cin->name, name, name_size ); trap_FS_FOpenFile( cin->name, &cin->file, FS_READ ); } else { cin->type = CIN_TYPE_NONE; Q_snprintfz( cin->name, name_size, "video/%s", name ); } // loop through the list of supported formats for( i = 0, type = cin_types; i < CIN_NUM_TYPES && cin->type == CIN_TYPE_NONE; i++, type++ ) { char *s, *t; const char *ext; // no extensions, break, probably a safe guard if( !type->extensions ) break; // scan filesystem, trying all known extensions for this format s = CIN_CopyString( type->extensions ); t = strtok( s, " " ); while( t != NULL ) { ext = t; COM_ReplaceExtension( cin->name, ext, name_size ); trap_FS_FOpenFile( cin->name, &cin->file, FS_READ ); if( cin->file ) { // found the file cin->type = i; break; } t = strtok( NULL, " " ); } CIN_Free( s ); } // call format-dependent initializer, return NULL if it fails type = cin_types + cin->type; if( cin->type != CIN_TYPE_NONE ) { res = type->init( cin ); if( !res ) { type->shutdown( cin ); } } else { res = qfalse; } if( !res && cin ) { CIN_Free( cin ); return NULL; } return cin; } /* * CIN_NeedNextFrame */ qboolean CIN_NeedNextFrame( cinematics_t *cin, unsigned int curtime ) { const cin_type_t *type; assert( cin ); assert( cin->type > CIN_TYPE_NONE && cin->type < CIN_NUM_TYPES ); type = &cin_types[cin->type]; cin->cur_time = curtime; if( cin->cur_time <= cin->start_time ) return qfalse; return type->need_next_frame( cin ); } /* * CIN_ReadNextFrame */ qbyte *CIN_ReadNextFrame( cinematics_t *cin, int *width, int *height, int *aspect_numerator, int *aspect_denominator, qboolean *redraw ) { int i; qbyte *frame = NULL; const cin_type_t *type; qboolean redraw_ = qfalse; assert( cin ); assert( cin->type > CIN_TYPE_NONE && cin->type < CIN_NUM_TYPES ); type = &cin_types[cin->type]; for( i = 0; i < 2; i++ ) { redraw_ = qfalse; frame = type->read_next_frame( cin, &redraw_ ); if( frame || !( cin->flags & CIN_LOOP ) ) break; // try again from the beginning if looping type->reset( cin ); cin->frame = 0; cin->start_time = cin->cur_time; } if( width ) *width = cin->width; if( height ) *height = cin->height; if( aspect_numerator ) *aspect_numerator = cin->aspect_numerator; if( aspect_denominator ) *aspect_denominator = cin->aspect_denominator; if( redraw ) *redraw = redraw_; return frame; } /* * CIN_Close */ void CIN_Close( cinematics_t *cin ) { struct mempool_s *mempool; const cin_type_t *type; if( !cin ) return; assert( cin->type > CIN_TYPE_NONE && cin->type < CIN_NUM_TYPES ); mempool = cin->mempool; assert( mempool != NULL ); type = &cin_types[cin->type]; type->shutdown( cin ); cin->cur_time = 0; cin->start_time = 0; // done if( cin->file ) { trap_FS_FCloseFile( cin->file ); cin->file = 0; } if( cin->fdata ) { CIN_Free( cin->fdata ); cin->fdata = NULL; } if( cin->name ) { CIN_Free( cin->name ); cin->name = NULL; } if( cin->vid_buffer ) { CIN_Free( cin->vid_buffer ); cin->vid_buffer = NULL; } CIN_Free( cin ); CIN_FreePool( &mempool ); }
#ifndef QUADTREE_H #define QUADTREE_H #include "object.h" #include <vector> #define MAX_NODE_CAPACITY 5 #define MIN_NODE_CAPACITY 6 #define MAX_DEPTH 5 #include "manager_space.h" struct quadtree { aabb2 boundary; std::vector<object*> obj; quadtree* children[4]; bool has; int depth, count; void cleanUp(); quadtree(); quadtree(aabb2 b, int d); std::vector<short> whereTo(aabb2 p); void insert(object *a ,aabb2 p); void subdivide(); void queryRange(aabb2 range); void collect(std::vector<object*> &here); void kill(); void remove(object* a, aabb2 rem); void checkObj(); void checkWall(int w); void check(); void draw(); }; void checkPair(object &o1, object &o2); void checkWorld(object &o, glm::vec2 a, glm::vec2 b, float e); #endif // QUADTREE_H
/* * WriteStructures.h * Write structures out to file. * * Created on: Aug 17, 2011 * Author: Martin Uhrin */ #ifndef WRITE_STRUCTURES_H #define WRITE_STRUCTURES_H // INCLUDES ///////////////////////////////////////////// #include "spipe/StructurePipe.h" #include <string> #include <boost/noncopyable.hpp> #include <pipelib/pipelib.h> #include <spl/io/ResourceLocator.h> #include "spipe/SpTypes.h" // FORWARD DECLARATIONS //////////////////////////////////// namespace spl { namespace io { struct AdditionalData; class StructureReadWriteManager; } } namespace spipe { namespace blocks { class WriteStructures : public PipeBlock, ::boost::noncopyable { public: static const bool WRITE_MULTI_DEFAULT; static const ::std::string FORMAT_DEFAULT; WriteStructures(); bool getWriteMulti() const; void setWriteMulti(const bool writeMulti); const ::std::string & getFileType() const; void setFileType(const ::std::string & extension); // From PipeBlock //// virtual void pipelineStarting(); virtual void in(StructureDataType * const data); // End from PipeBlock //// private: struct State { enum Value { DISABLED, USE_CUSTOM_WRITER, USE_DEFAULT_WRITER }; }; ::spl::io::ResourceLocator generateLocator(::spl::common::Structure & structure, const ::spl::io::IStructureWriter & writer) const; bool useMultiStructure(const ::spl::io::IStructureWriter & writer) const; State::Value myState; bool myWriteMultiStructure; const bool myMultiStructureFromPath; ::std::string myFileType; }; } } #endif /* WRITE_STRUCTURE_H */
/* * Copyright (C) 2010-2011 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MALI_KERNEL_MEM_H__ #define __MALI_KERNEL_MEM_H__ #include "mali_kernel_subsystem.h" extern struct mali_kernel_subsystem mali_subsystem_memory; #endif /* __MALI_KERNEL_MEM_H__ */
/* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file newgrf_roadtype.h NewGRF handling of road types. */ #ifndef NEWGRF_ROADTYPE_H #define NEWGRF_ROADTYPE_H #include "road.h" #include "newgrf_commons.h" #include "newgrf_spritegroup.h" /** Resolver for the railtype scope. */ struct RoadTypeScopeResolver : public ScopeResolver { TileIndex tile; ///< Tracktile. For track on a bridge this is the southern bridgehead. TileContext context; ///< Are we resolving sprites for the upper halftile, or on a bridge? RoadTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context); /* virtual */ uint32 GetRandomBits() const; /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const; }; /** Resolver object for road types. */ struct RoadTypeResolverObject : public ResolverObject { RoadTypeScopeResolver roadtype_scope; ///< Resolver for the roadtype scope. RoadTypeResolverObject(const RoadTypeInfo *rti, TileIndex tile, TileContext context, RoadTypeSpriteGroup rtsg, uint32 param1 = 0, uint32 param2 = 0); /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) { switch (scope) { case VSG_SCOPE_SELF: return &this->roadtype_scope; default: return ResolverObject::GetScope(scope, relative); } } /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const; }; SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = nullptr); uint8 GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile); #endif /* NEWGRF_ROADTYPE_H */
/***************************************************************************** * rtcp.h: RTP/RTCP headerfile ***************************************************************************** * Copyright (C) 2005 M2X * * $Id: rtcp.h 14601 2006-03-03 21:43:48Z jpsaman $ * * Authors: Jean-Paul Saman <jpsaman #_at_# videolan dot 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, USA. *****************************************************************************/ #ifndef _RTCP_H #define _RTCP_H 1 /* RTCP packet types */ #define RTCP_SR 200 #define RTCP_RR 201 #define RTCP_SDES 202 #define RTCP_BYE 203 #define RTCP_APP 204 /* End of RTCP packet types */ /* RTCP Info */ #define RTCP_INFO_CNAME 1 #define RTCP_INFO_NAME 2 #define RTCP_INFO_EMAIL 3 #define RTCP_INFO_PHONE 4 #define RTCP_INFO_LOC 5 #define RTCP_INFO_TOOL 6 #define RTCP_INFO_NOTE 7 #define RTCP_INFO_PRIV 8 /* End of RTCP Info */ #define RTCP_HEADER_LEN 3 typedef struct { unsigned int u_ssrc; unsigned int ntp_timestampH; unsigned int ntp_timestampL; unsigned int rtp_timestamp; unsigned int u_pkt_count; unsigned int u_octet_count; } rtcp_SR; typedef struct _RTCP_header_RR { unsigned int u_ssrc; } rtcp_RR; typedef struct { unsigned long u_ssrc; unsigned char u_fract_lost; unsigned char u_pck_lost[3]; unsigned int u_highest_seq_no; unsigned int u_jitter; unsigned int u_last_SR; unsigned int u_delay_last_SR; } rtcp_report_block_SR; typedef struct { unsigned int u_ssrc; unsigned char u_attr_name; unsigned char u_length; char *p_data; } rtcp_SDES; typedef struct { unsigned int u_ssrc; unsigned char u_length; } rtcp_BYE; typedef struct { unsigned char u_length; char *p_data; } rtcp_APP; /** * structure rtcp_stats_t */ typedef struct { unsigned int u_RR_received; /*< RR records received */ unsigned int u_SR_received; /*< SR records received */ unsigned long l_dest_SSRC; /*< SSRC */ unsigned int u_pkt_count; /*< count of packets received */ unsigned int u_octet_count; /*< ? */ unsigned int u_pkt_lost; /*< count of packets lost */ unsigned int u_fract_lost; /*< count of fractional packets lost */ unsigned int u_highest_seq_no;/*< highest sequence number found */ unsigned int u_jitter; /*< jitter calculated */ unsigned int u_last_SR; /*< last SR record received */ unsigned int u_last_RR; /*< last RR record received */ mtime_t u_delay_since_last_SR; /*< delay since last SR record received */ mtime_t u_delay_since_last_RR; /*< delay since last RR record received */ } rtcp_stats_t; typedef struct { int fd; /*< socket descriptor of rtcp stream */ unsigned int u_count; /*< packet count */ unsigned int u_version; /*< RTCP version number */ unsigned int u_length; /*< lenght of packet */ unsigned int u_payload_type; /*< type of RTCP payload */ rtcp_stats_t stats; /*< RTCP statistics */ union { rtcp_SR sr; /*< SR record */ rtcp_RR rr; /*< RR record */ rtcp_SDES sdes; /*< SDES record */ rtcp_BYE bye; /*< BYE record */ rtcp_APP app; /*< APP record */ } report; /*int (*pf_connect)( void *p_userdata, char *p_server, int i_port ); int (*pf_disconnect)( void *p_userdata ); int (*pf_read)( void *p_userdata, uint8_t *p_buffer, int i_buffer ); int (*pf_write)( void *p_userdata, uint8_t *p_buffer, int i_buffer );*/ } rtcp_t; /** * Decode RTCP packet * Decode incoming RTCP packet and inspect the records types. */ int rtcp_decode( vlc_object_t *p_this, rtcp_t *p_rtcp, block_t *p_block ); //VLC_EXPORT( int, rtcp_decode, ( rtcp_t *p_rtcp, block_t *p_block ) ); block_t *rtcp_encode( vlc_object_t *p_this, int type ); #endif /* RTCP_H */
/** * @file heap_test.h * @brief * @author malin malinbupt@gmail.com * @date 2015年05月10日 星期日 11时14分27秒 * @version * @note */ #ifndef __HEAP_TEST_H #define __HEAP_TEST_H void heap_test(); #endif // __HEAP_TEST_H
// Copyright (c) 2014 GeometryFactory Sarl (France) // All rights reserved. // // This file is part of CGAL (www.cgal.org); 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. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL: https://github.com/CGAL/cgal/blob/releases/CGAL-4.14.1/STL_Extension/include/CGAL/Time_stamper.h $ // $Id: Time_stamper.h 8993817 %aI Laurent Rineau // SPDX-License-Identifier: LGPL-3.0+ // // Author(s) : Jane Tournois #ifndef CGAL_TIME_STAMPER_H #define CGAL_TIME_STAMPER_H #include <CGAL/Has_timestamp.h> #include <CGAL/atomic.h> namespace CGAL { template <typename T> struct Time_stamper { Time_stamper() : time_stamp_() {} Time_stamper(const Time_stamper& ts) : time_stamp_() { time_stamp_ = std::size_t(ts.time_stamp_); } Time_stamper& operator=(const Time_stamper& ts) { time_stamp_ = std::size_t(ts.time_stamp_); return *this; } static void initialize_time_stamp(T* pt) { pt->set_time_stamp(std::size_t(-1)); } void set_time_stamp(T* pt) { if(pt->time_stamp() == std::size_t(-1)) { const std::size_t new_ts = time_stamp_++; pt->set_time_stamp(new_ts); } else { // else: the time stamp is re-used // Enforces that the time stamp is greater than the current value. // That is used when a TDS_3 is copied: in that case, the // time stamps are copied from the old element to the new one, // but the time stamper does not know. #ifdef CGAL_NO_ATOMIC time_stamp_ = (std::max)(time_stamp_, pt->time_stamp() + 1); #else // How to atomically update a maximum value? // https://stackoverflow.com/a/16190791/1728537 const std::size_t new_value = pt->time_stamp() + 1; std::size_t prev_value = time_stamp_; while(prev_value < new_value && !time_stamp_.compare_exchange_weak(prev_value, new_value)) ; #endif // atomic } } static std::size_t time_stamp(const T* pt) { if(pt == NULL){ return std::size_t(-1); } return pt->time_stamp(); } static std::size_t hash_value(const T* p) { if(NULL == p) return std::size_t(-1); else return p->time_stamp(); } static bool less(const T* p_t1, const T* p_t2) { if(p_t1 == NULL) return (p_t2 != NULL); else if(p_t2 == NULL) return false; else { CGAL_assertion((p_t1 == p_t2) == (time_stamp(p_t1) == time_stamp(p_t2))); return time_stamp(p_t1) < time_stamp(p_t2); } } void reset() { time_stamp_ = 0; } private: #ifdef CGAL_NO_ATOMIC std::size_t time_stamp_; #else CGAL::cpp11::atomic<std::size_t> time_stamp_; #endif }; // end class template Time_stamper<T> template <typename T> struct No_time_stamp { public: void set_time_stamp(T*) {} static bool less(const T* p_t1,const T* p_t2) { return p_t1 < p_t2; } static void initialize_time_stamp(T*) { } static std::size_t time_stamp(const T*) { return 0; } static std::size_t hash_value(const T* p) { return reinterpret_cast<std::size_t>(p)/sizeof(T); } void reset() {} }; // end class template No_time_stamp<T> // That class template is an auxiliary class. It has a // specialization for the case where `T::Has_timestamp` does not exists. // The non-specialized template, when `T::Has_timestamp` exists, derives // from `Time_stamper<T>` or `No_time_stamp<T>` depending on the // value of the Boolean constant `T::Has_timestamp`. // The declaration of that class template requires `T` to be a complete type. template <class T, bool has_timestamp = internal::Has_timestamp<T>::value> struct Get_time_stamper{ typedef Time_stamper<T> type; }; // Specialization when `T::Has_timestamp` does not exist, derives from // `TimeStamper_`, or from `No_time_stamp<T>`. template <class T> struct Get_time_stamper<T,false>{ typedef No_time_stamp<T> type; }; // Implementation of the timestamp policy. It is very important that the // declaration of that class template does not require `T` to be a complete // type. That way, the declaration of a pointer of type `Time_stamper_impl<T, Ts> // in `Compact_container` for example is possible with an incomplete type. template <class T> struct Time_stamper_impl : public Get_time_stamper<T>::type {}; } //end of namespace CGAL #endif // CGAL_TIME_STAMPER_H
#include <zdb.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> #include <time.h> #include "sql_db.h" #include "log.h" #include "common.h" #define URL_LEN 256 #define DB_TYPE 128 const char *project_db = "projectdb"; const char *task_db = "taskdb"; ConnectionPool_T g_myjobdb_pool = NULL; ConnectionPool_T g_projectdb_pool = NULL; ConnectionPool_T g_taskdb_pool = NULL; URL_T g_projectdb_url = NULL; URL_T g_myjobdb_url = NULL; URL_T g_taskdb_url = NULL; char g_db_type[DB_TYPE]; int sql_db_init() { char db_url[URL_LEN] = { 0 }; /* init myjobdb database pool */ snprintf(db_url, URL_LEN, "%s://%s:%d/%s?user=%s&password=%s", g_conf.db_type, g_conf.ip, g_conf.sql_port, g_conf.db_name, g_conf.db_user, g_conf.db_pwd); g_myjobdb_url = URL_new(db_url); if (g_myjobdb_url == NULL) { LOG_ERROR("Create DB URL fail\n"); return 0; } g_myjobdb_pool = ConnectionPool_new(g_myjobdb_url); if (g_myjobdb_url == NULL) { LOG_ERROR("Create database connection pool fail\n"); return 0; } ConnectionPool_start(g_myjobdb_pool); /* init projectdb database pool */ memset(db_url, '\0', URL_LEN); snprintf(db_url, URL_LEN, "%s://%s:%d/%s?user=%s&password=%s", g_conf.db_type, g_conf.ip, g_conf.sql_port, project_db, g_conf.db_user, g_conf.db_pwd); g_projectdb_url = URL_new(db_url); if (g_projectdb_url == NULL) { LOG_ERROR("Create DB URL fail\n"); return 0; } g_projectdb_pool = ConnectionPool_new(g_projectdb_url); if (g_projectdb_pool == NULL) { LOG_ERROR("Create database connection pool fail\n"); return 0; } ConnectionPool_start(g_projectdb_pool); /* init taskdb database pool */ memset(db_url, '\0', URL_LEN); snprintf(db_url, URL_LEN, "%s://%s:%d/%s?user=%s&password=%s", g_conf.db_type, g_conf.ip, g_conf.sql_port, task_db, g_conf.db_user, g_conf.db_pwd); g_taskdb_url = URL_new(db_url); if (g_taskdb_url == NULL) { LOG_ERROR("Create DB URL fail\n"); return 0; } g_taskdb_pool = ConnectionPool_new(g_taskdb_url); if (g_taskdb_pool == NULL) { LOG_ERROR("Create database connection pool fail\n"); return 0; } ConnectionPool_start(g_taskdb_pool); return 1; } Connection_T sql_db_connect(int db) { const char mysql[] = "mysql"; const char oracle[] = "oracle"; Connection_T conn = NULL; switch(db) { case MYJOB_DB: conn = ConnectionPool_getConnection(g_myjobdb_pool); break; case PROJECT_DB: conn = ConnectionPool_getConnection(g_projectdb_pool); break; case TASK_DB: conn = ConnectionPool_getConnection(g_taskdb_pool); break; default : LOG_ERROR("Database Type Error\n"); break; } if (conn != NULL) { if (!strncmp(g_conf.db_type, mysql, strlen(mysql))) { Connection_execute(conn, "SET NAMES utf8"); } else if (!strncmp(g_conf.db_type, oracle, strlen(oracle))) { //later add } } return conn; } void sql_db_free() { ConnectionPool_free(&g_myjobdb_pool); g_myjobdb_pool = NULL; URL_free(&g_myjobdb_url); g_myjobdb_url = NULL; ConnectionPool_free(&g_projectdb_pool); g_projectdb_pool = NULL; URL_free(&g_taskdb_url); g_taskdb_url = NULL; ConnectionPool_free(&g_taskdb_pool); g_taskdb_pool = NULL; URL_free(&g_taskdb_url); g_taskdb_url = NULL; } void sql_db_format_time(char *cur_time) { char tmp_time[100]; struct tm *p = NULL; time_t time_val; time(&time_val); p = localtime(&time_val); strftime(tmp_time, sizeof(tmp_time), "%Y-%m-%d %H:%M:%S", p); snprintf(cur_time, 100, "%s", tmp_time); }
/**************************************************************************** ** ** Copyright (C) 2009 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$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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. ** ** 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. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Designer. This header // file may change from version to version without notice, or even be removed. // // We mean it. // #ifndef METADATABASE_H #define METADATABASE_H #include "shared_global_p.h" #include <QtDesigner/QDesignerMetaDataBaseInterface> #include <QtCore/QHash> #include <QtCore/QStringList> #include <QtGui/QCursor> QT_BEGIN_NAMESPACE namespace qdesigner_internal { class QDESIGNER_SHARED_EXPORT MetaDataBaseItem: public QDesignerMetaDataBaseItemInterface { public: explicit MetaDataBaseItem(QObject *object); virtual ~MetaDataBaseItem(); virtual QString name() const; virtual void setName(const QString &name); typedef QList<QWidget*> TabOrder; virtual TabOrder tabOrder() const; virtual void setTabOrder(const TabOrder &tabOrder); virtual bool enabled() const; virtual void setEnabled(bool b); QString customClassName() const; void setCustomClassName(const QString &customClassName); QString script() const; void setScript(const QString &script); QStringList fakeSlots() const; void setFakeSlots(const QStringList &); QStringList fakeSignals() const; void setFakeSignals(const QStringList &); private: QObject *m_object; TabOrder m_tabOrder; bool m_enabled; QString m_customClassName; QString m_script; QStringList m_fakeSlots; QStringList m_fakeSignals; }; class QDESIGNER_SHARED_EXPORT MetaDataBase: public QDesignerMetaDataBaseInterface { Q_OBJECT public: explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); virtual ~MetaDataBase(); virtual QDesignerFormEditorInterface *core() const; virtual QDesignerMetaDataBaseItemInterface *item(QObject *object) const { return metaDataBaseItem(object); } virtual MetaDataBaseItem *metaDataBaseItem(QObject *object) const; virtual void add(QObject *object); virtual void remove(QObject *object); virtual QList<QObject*> objects() const; private slots: void slotDestroyed(QObject *object); private: QDesignerFormEditorInterface *m_core; typedef QHash<QObject *, MetaDataBaseItem*> ItemMap; ItemMap m_items; }; // promotion convenience QDESIGNER_SHARED_EXPORT bool promoteWidget(QDesignerFormEditorInterface *core,QWidget *widget,const QString &customClassName); QDESIGNER_SHARED_EXPORT void demoteWidget(QDesignerFormEditorInterface *core,QWidget *widget); QDESIGNER_SHARED_EXPORT bool isPromoted(QDesignerFormEditorInterface *core, QWidget* w); QDESIGNER_SHARED_EXPORT QString promotedCustomClassName(QDesignerFormEditorInterface *core, QWidget* w); QDESIGNER_SHARED_EXPORT QString promotedExtends(QDesignerFormEditorInterface *core, QWidget* w); } // namespace qdesigner_internal QT_END_NAMESPACE #endif // METADATABASE_H
/********************************************************************** Freeciv - Copyright (C) 2003 - The Freeciv Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ #ifndef WC_CLIENT_GUI_RATESDLG_H #define WC_CLIENT_GUI_RATESDLG_H #include "../include/ratesdlg_g.h" /* nothing to add */ #endif /* WC_CLIENT_GUI_RATESDLG_H */
#include "cornet/cnnum.h" int cn_cnnumDefaultItemDestructor(void *item) { if(item != NULL){free(item);} return 0; }