text
stringlengths
4
6.14k
/* * fbcon.c * * Copyright (C) 2012 Andrei Warkentin <andreiw@msalumni.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 <xen/kernel.h> #include <xen/fb.h> #include <xen/fbcon.h> #include <xen/console.h> static struct fbcon_private { struct fb_info *fb; struct fbcon_font *font; /* * Offsets calculated so the white space around the border * looks equivalent. */ u8 x_offset; u8 y_offset; /* Dimensions. */ unsigned lines; unsigned cols; /* Next position to place char. */ unsigned next_line; unsigned next_col; /* * Colors used. */ hw_color_t bg_color; hw_color_t fg_color; } fbcon_private; static void fbcon_newline(struct fbcon_private *private) { struct fb_copyarea area; struct fb_fillrect rect; private->next_line++; private->next_col = 0; if (private->next_line >= private->lines) { /* * Scroll upwards by a line. * * Yes, not from x-offset, but it makes the width * calculation simpler, no? */ area.dx = 0; area.dy = private->y_offset; area.sx = 0; area.sy = private->y_offset + private->font->height; area.width = private->fb->xres; area.height = private->font->height * (private->next_line - 1); fb_copyarea(private->fb, &area); private->next_line--; /* * Clear line. */ rect.dx = 0; rect.dy = private->y_offset + private->font->height * private->next_line; rect.width = private->fb->xres; rect.height = private->font->height; rect.color = private->bg_color; fb_fillrect(private->fb, &rect); } } static inline unsigned fbcon_font_index(struct fbcon_font *font, char c) { /* * The font is stored in bytes, so a 12-bit width occupies two bytes. */ return (ROUND_UP(font->width, 8) / 8) * c * font->height; } static void fbcon_putc(struct fbcon_private *private, char c) { struct fb_image image; if (c == '\n' || private->next_col >= private->cols) { fbcon_newline(private); if (c == '\n') { return; } } image.width = private->font->width; image.height = private->font->height; image.dx = private->x_offset + image.width * private->next_col; image.dy = private->y_offset + image.height * private->next_line; image.fg_color = private->fg_color; image.bg_color = private->bg_color; image.depth = 1; image.data = private->font->data + fbcon_font_index(private->font, c); fb_imageblit(private->fb, &image); if (++private->next_col > private->cols) { fbcon_newline(private); } } void fbcon_puts(struct console_info *con, const char *s) { int c; struct fbcon_private *private = (struct fbcon_private *) con->private; while ((c = *s++) != '\0') { fbcon_putc(private, c); } } static struct console_info fbcon_info = { .name = "framebuffer console", .puts = fbcon_puts, .private = &fbcon_private, }; void fbcon_init(struct fb_info *fb) { struct fb_fillrect rect; BUG_ON(fbcon_private.fb != NULL); fbcon_private.fb = fb; fbcon_private.fg_color = fb_get_color(fb, FB_COLOR_LIGHT_GRAY); fbcon_private.bg_color = fb_get_color(fb, FB_COLOR_BLACK); fbcon_private.font = &fbcon_font; fbcon_private.lines = fb->yres / fbcon_private.font->height; fbcon_private.cols = fb->xres / fbcon_private.font->width; fbcon_private.y_offset = (fb->yres - (fbcon_private.lines * fbcon_private.font->height)) / 2; fbcon_private.x_offset = (fb->xres - (fbcon_private.cols * fbcon_private.font->width)) / 2; printk("framebuffer console: %s, %ux%u (xoff: %u yoff: %u)\n", fb->name, fbcon_private.cols, fbcon_private.lines, fbcon_private.x_offset, fbcon_private.y_offset); rect.dx = 0; rect.dy = 0; rect.width = fb->xres; rect.height = fb->yres; rect.color = fbcon_private.bg_color; rect.rop = FB_ROP_COPY; fb_fillrect(fb, &rect); fbcon_info.private = &fbcon_private; console_register(&fbcon_info); } /* * Local variables: * eval: (xen-c-mode) * End: */
#pragma once typedef unsigned char byte; typedef unsigned int uint; struct BGRAPixel; struct RGBPixel; void BGRAtoRGBPlane(BGRAPixel* data, const uint width, const uint height, byte* destRGBBuffer); void BGRAtoYUV444Planes(BGRAPixel* data, const uint width, const uint height, byte* destYBuffer, byte* destUBuffer, byte* destVBuffer);
/********************************************************************* * Filename: sha256.h * Author: Brad Conte (brad AT bradconte.com) * Copyright: * Disclaimer: This code is presented "as is" without any guarantees. * Details: Defines the API for the corresponding SHA1 implementation. *********************************************************************/ #ifndef SHA256_H #define SHA256_H /*************************** HEADER FILES ***************************/ #include <stddef.h> /****************************** MACROS ******************************/ #define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest /**************************** DATA TYPES ****************************/ typedef unsigned char BYTE; // 8-bit byte typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines typedef struct { BYTE data[64]; WORD datalen; unsigned long long bitlen; WORD state[8]; } SHA256_CTX; /*********************** FUNCTION DECLARATIONS **********************/ void sha256_init(SHA256_CTX *ctx); void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len); void sha256_final(SHA256_CTX *ctx, BYTE hash[]); #endif // SHA256_H
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Rosegarden A MIDI and audio sequencer and musical notation editor. Copyright 2000-2018 the Rosegarden development team. Other copyrights also apply to some parts of this work. Please see the AUTHORS file and individual file headers for details. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #ifndef RG_TIMET_H #define RG_TIMET_H namespace Rosegarden { // Time in internal units (pulses). Timebase is 960ppq. typedef long timeT; constexpr timeT timebase = 960; // Time used in the rewriter to represent tupled notes exactly. // It doesn't have a fixed conversion to timeT, instead each bar // figures out a scaling that allows all tupleting in it to be // represented exactly. typedef timeT stretchedTimeT; // Time in 256th notes; equivalently, 4 times the time in smallest // notes. We need the unit to be 1/4 of the smallest note so we // can represent dotted and double-dotted notes exactly. typedef int Num256ths; } #endif /* ifndef RG_TIMET_H */
#include "stdarg.h" #include "include/console.h" static int x = 0; static int y = 0; static char* video = (char*) 0xb8000; static int kprintf_res = 0; static void kputc(char c) { if ((c == '\n') || (x > 79)) { x = 0; y++; } if (c == '\n') { return; } if (y > 24) { int i; for (i = 0; i < 2 * 24 * 80; i++) { video[i] = video[i + 160]; } for (; i < 2 * 25 * 80; i++) { video[i] = 0; } y--; } video[2 * (y * 80 + x)] = c; video[2 * (y * 80 + x) + 1] = 0x07; x++; kprintf_res++; } static void kputs(const char* s) { while (*s) { kputc(*s++); } } static void kputn(unsigned long x, int base) { char buf[65]; const char* digits = "0123456789abcdefghijklmnopqrstuvwxyz"; char* p; if (base > 36) { return; } p = buf + 64; *p = '\0'; do { *--p = digits[x % base]; x /= base; } while (x); kputs(p); } void clrscr(void) { int i; for (i = 0; i < 2 * 25 * 80; i++) { video[i] = 0; } x = y = 0; } int kprintf(const char* fmt, ...) { va_list ap; const char* s; unsigned long n; va_start(ap, fmt); kprintf_res = 0; while (*fmt) { if (*fmt == '%') { fmt++; switch (*fmt) { case 's': s = va_arg(ap, char*); kputs(s); break; case 'd': case 'u': n = va_arg(ap, unsigned long int); kputn(n, 10); break; case 'x': case 'p': n = va_arg(ap, unsigned long int); kputn(n, 16); break; case '%': kputc('%'); break; case '\0': goto out; default: kputc('%'); kputc(*fmt); break; } } else { kputc(*fmt); } fmt++; } out: va_end(ap); return kprintf_res; }
/* tre-config.h. This file defines all compile time definitions that are needed in `regex.h' for Win32. */ /* Define to 1 if the system has the type `reg_errcode_t'. */ /* #undef HAVE_REG_ERRCODE_T */ /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <wchar.h> header file. */ #define HAVE_WCHAR_H 1 /* Define if you want to enable approximate matching functionality. */ #define TRE_APPROX 1 /* Define to enable multibyte character set support. */ #undef TRE_MULTIBYTE /* Define to include the system regex.h from TRE regex.h */ /* #undef TRE_USE_SYSTEM_REGEX_H */ /* Define to the absolute path to the system regex.h */ /* #undef TRE_SYSTEM_REGEX_H_PATH */ /* Define to enable wide character (wchar_t) support. */ #undef TRE_WCHAR
/* Copyright (c) 2012, Code Aurora Forum. All rights reserved. * Copyright (c) 2012, LGE Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/init.h> #include <linux/platform_device.h> #include <mach/kgsl.h> #include <mach/msm_bus_board.h> #include <mach/board.h> #include <mach/msm_dcvs.h> #include <mach/socinfo.h> #include "devices.h" #include "board-j1.h" #ifdef CONFIG_MSM_DCVS static struct msm_dcvs_freq_entry grp3d_freq[] = { {0, 0, 333932}, {0, 0, 497532}, {0, 0, 707610}, {0, 0, 844545}, }; static struct msm_dcvs_core_info grp3d_core_info = { .freq_tbl = &grp3d_freq[0], .core_param = { .max_time_us = 100000, .num_freq = ARRAY_SIZE(grp3d_freq), }, .algo_param = { .slack_time_us = 39000, .disable_pc_threshold = 86000, .ss_window_size = 1000000, .ss_util_pct = 95, .em_max_util_pct = 97, .ss_iobusy_conv = 100, }, }; #endif /* CONFIG_MSM_DCVS */ #ifdef CONFIG_MSM_BUS_SCALING static struct msm_bus_vectors grp3d_init_vectors[] = { { .src = MSM_BUS_MASTER_GRAPHICS_3D, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = 0, }, { .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = 0, }, }; static struct msm_bus_vectors grp3d_low_vectors[] = { { .src = MSM_BUS_MASTER_GRAPHICS_3D, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(1000), }, { .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(1000), }, }; static struct msm_bus_vectors grp3d_nominal_low_vectors[] = { { .src = MSM_BUS_MASTER_GRAPHICS_3D, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(2000), }, { .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(2000), }, }; static struct msm_bus_vectors grp3d_nominal_high_vectors[] = { { .src = MSM_BUS_MASTER_GRAPHICS_3D, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(2656), }, { .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(2656), }, }; static struct msm_bus_vectors grp3d_max_vectors[] = { { .src = MSM_BUS_MASTER_GRAPHICS_3D, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(4264), }, { .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, .dst = MSM_BUS_SLAVE_EBI_CH0, .ab = 0, .ib = KGSL_CONVERT_TO_MBPS(4264), }, }; static struct msm_bus_paths grp3d_bus_scale_usecases[] = { { ARRAY_SIZE(grp3d_init_vectors), grp3d_init_vectors, }, { ARRAY_SIZE(grp3d_low_vectors), grp3d_low_vectors, }, { ARRAY_SIZE(grp3d_nominal_low_vectors), grp3d_nominal_low_vectors, }, { ARRAY_SIZE(grp3d_nominal_high_vectors), grp3d_nominal_high_vectors, }, { ARRAY_SIZE(grp3d_max_vectors), grp3d_max_vectors, }, }; static struct msm_bus_scale_pdata grp3d_bus_scale_pdata = { grp3d_bus_scale_usecases, ARRAY_SIZE(grp3d_bus_scale_usecases), .name = "grp3d", }; #endif static struct resource kgsl_3d0_resources[] = { { .name = KGSL_3D0_REG_MEMORY, .start = 0x04300000, /* GFX3D address */ .end = 0x0431ffff, .flags = IORESOURCE_MEM, }, { .name = KGSL_3D0_IRQ, .start = GFX3D_IRQ, .end = GFX3D_IRQ, .flags = IORESOURCE_IRQ, }, }; static const struct kgsl_iommu_ctx kgsl_3d0_iommu0_ctxs[] = { { "gfx3d_user", 0 }, { "gfx3d_priv", 1 }, }; static const struct kgsl_iommu_ctx kgsl_3d0_iommu1_ctxs[] = { { "gfx3d1_user", 0 }, { "gfx3d1_priv", 1 }, }; static struct kgsl_device_iommu_data kgsl_3d0_iommu_data[] = { { .iommu_ctxs = kgsl_3d0_iommu0_ctxs, .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu0_ctxs), .physstart = 0x07C00000, .physend = 0x07C00000 + SZ_1M - 1, }, { .iommu_ctxs = kgsl_3d0_iommu1_ctxs, .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu1_ctxs), .physstart = 0x07D00000, .physend = 0x07D00000 + SZ_1M - 1, }, }; static struct kgsl_device_platform_data kgsl_3d0_pdata = { .pwrlevel = { { .gpu_freq = 400000000, .bus_freq = 4, .io_fraction = 0, }, { .gpu_freq = 325000000, .bus_freq = 3, .io_fraction = 33, }, { .gpu_freq = 200000000, .bus_freq = 2, .io_fraction = 100, }, { .gpu_freq = 128000000, .bus_freq = 1, .io_fraction = 100, }, { .gpu_freq = 27000000, .bus_freq = 0, }, }, .init_level = 1, .num_levels = 5, .set_grp_async = NULL, .idle_timeout = HZ/10, .nap_allowed = true, .strtstp_sleepwake = true, .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM_IFACE, #ifdef CONFIG_MSM_BUS_SCALING .bus_scale_table = &grp3d_bus_scale_pdata, #endif .iommu_data = kgsl_3d0_iommu_data, .iommu_count = ARRAY_SIZE(kgsl_3d0_iommu_data), #ifdef CONFIG_MSM_DCVS .core_info = &grp3d_core_info, #endif }; struct platform_device device_kgsl_3d0 = { .name = "kgsl-3d0", .id = 0, .num_resources = ARRAY_SIZE(kgsl_3d0_resources), .resource = kgsl_3d0_resources, .dev = { .platform_data = &kgsl_3d0_pdata, }, }; void __init apq8064_init_gpu(void) { unsigned int version = socinfo_get_version(); if ((SOCINFO_VERSION_MAJOR(version) == 1) && (SOCINFO_VERSION_MINOR(version) == 1)) kgsl_3d0_pdata.chipid = ADRENO_CHIPID(3, 2, 0, 1); else kgsl_3d0_pdata.chipid = ADRENO_CHIPID(3, 2, 0, 0); platform_device_register(&device_kgsl_3d0); }
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:40 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/forcedeth/napi.h */
/* * 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 */ #ifdef IDE_COMPILE #include "ffmpeg-config.h" #include "ide-config.h" #else #include "config.h" #endif #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" #include "fft.h" av_cold void ff_fft_init_x86(FFTContext *s) { int cpu_flags = av_get_cpu_flags(); #if ARCH_X86_32 #if (HAVE_AMD3DNOW_EXTERNAL == 1) if (EXTERNAL_AMD3DNOW(cpu_flags)) { /* 3DNow! for K6-2/3 */ s->imdct_calc = ff_imdct_calc_3dnow; s->imdct_half = ff_imdct_half_3dnow; s->fft_calc = ff_fft_calc_3dnow; } #endif #if (HAVE_AMD3DNOWEXT_EXTERNAL == 1) if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dnowext; s->imdct_half = ff_imdct_half_3dnowext; s->fft_calc = ff_fft_calc_3dnowext; } #endif #endif #if (HAVE_SSE_EXTERNAL == 1) if (EXTERNAL_SSE(cpu_flags)) { /* SSE for P3/P4/K8 */ s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } #endif #if (HAVE_AVX_EXTERNAL == 1) if (EXTERNAL_AVX(cpu_flags) && s->nbits >= 5) { /* AVX for SB */ s->imdct_half = ff_imdct_half_avx; s->fft_calc = ff_fft_calc_avx; s->fft_permutation = FF_FFT_PERM_AVX; } #endif }
/* ASE - Allegro Sprite Editor * Copyright (C) 2001-2011 David Capello * * 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 CONTEXT_FLAGS_H_INCLUDED #define CONTEXT_FLAGS_H_INCLUDED class Context; class ContextFlags { public: enum { HasActiveDocument = 1 << 0, HasActiveSprite = 1 << 1, HasVisibleMask = 1 << 2, HasActiveLayer = 1 << 3, HasActiveCel = 1 << 4, HasActiveImage = 1 << 5, HasBackgroundLayer = 1 << 6, ActiveDocumentIsReadable = 1 << 7, ActiveDocumentIsWritable = 1 << 8, ActiveLayerIsImage = 1 << 9, ActiveLayerIsBackground = 1 << 10, ActiveLayerIsReadable = 1 << 11, ActiveLayerIsWritable = 1 << 12, }; ContextFlags(); bool check(uint32_t flags) const { return (m_flags & flags) == flags; } void update(Context* context); private: uint32_t m_flags; }; #endif
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 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. * * M3 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 version 2 for more details. */ #pragma once #include <base/Common.h> #include <base/col/SList.h> #include <string.h> #include "Parser.h" class Vars { struct Var : public m3::SListItem { char *name; char *value; }; explicit Vars() : _vars() { } public: static Vars &get() { return _inst; } const char *get(const char *name) { Var *v = get_var(name); return v ? v->value : ""; } void set(const char *name, const char *value) { Var *v = get_var(name); if(!v) { v = new Var; v->name = new char[strlen(name) + 1]; strcpy(v->name, name); _vars.append(v); } else delete[] v->value; v->value = new char[strlen(value) + 1]; strcpy(v->value, value); } private: Var *get_var(const char *name) { for(auto it = _vars.begin(); it != _vars.end(); ++it) { if(strcmp(it->name, name) == 0) return &*it; } return nullptr; } m3::SList<Var> _vars; static Vars _inst; }; static inline const char *expr_value(Expr *e) { if(e->is_var) return Vars::get().get(e->name_val); return e->name_val; }
/* Copyright (C) 2007, Charles Stewart */ /* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /******************************************************************************* * * $URL$ * $Id$ * ******************************************************************************/ #ifndef TEST_GCSTL_RBTREE_H #define TEST_GCSTL_RBTREE_H extern void test_gcstl_rbtree_insert(); extern void test_gcstl_rbtree_remove(); #endif
/* * * ================================================================================ * common,h - part of the WebTester Server frontend * ================================================================================ * * Written (by Nazgul) under General Public License. * */ #ifndef _common_h_ #define _common_h_ #include <gtk/gtk.h> #include <config.h> #include "macrodef.h" #include "support.h" #include <libwebtester/core.h> extern GtkWidget *main_window; #define BUTTONS_COUNT 7 #define CONSOLE_VIEW "console_view" #define CONSOLE_SCROLL "console_scroll" #define PIPE_VIEW "pipe_view" #define PIPE_SCROLL "pipe_scroll" #define CONFIG_FILE HOME_DIRECTORY "/conf/gwebtester.conf" #endif
/** * (C) 2010-2011 Alibaba Group Holding Limited. * * 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. * * Version: $Id$ * * ob_packet_queue_thread.h for ... * * Authors: * yanran <yanran.hfs@taobao.com> * */ #ifndef OCEANBASE_COMMON_OB_PACKET_QUEUE_THREAD_H_ #define OCEANBASE_COMMON_OB_PACKET_QUEUE_THREAD_H_ #include "tbnet.h" #include "ob_define.h" #include "ob_packet.h" #include "ob_packet_queue.h" namespace sb { namespace common { class ObPacketQueueThread : public tbsys::CDefaultRunnable { public: ObPacketQueueThread(); virtual ~ObPacketQueueThread(); void setThreadParameter(int threadCount, tbnet::IPacketQueueHandler* handler, void* args); void stop(bool waitFinish = false); bool push(ObPacket* packet, int maxQueueLen = 0, bool block = true); void pushQueue(ObPacketQueue& packetQueue, int maxQueueLen = 0); void run(tbsys::CThread* thread, void* arg); ObPacket* head() { return queue_.head(); } ObPacket* tail() { return queue_.tail(); } size_t size() { return queue_.size(); } void clear(); protected: bool wait_finish_; bool waiting_; ObPacketQueue queue_; tbnet::IPacketQueueHandler* handler_; tbsys::CThreadCond cond_; tbsys::CThreadCond pushcond_; void* args_; }; } // end namespace common } // end namespace sb #endif // OCEANBASE_COMMON_OB_PACKET_QUEUE_THREAD_H_
/* AArch64-specific backend routines. Copyright 2009-2013 Free Software Foundation, Inc. Contributed by ARM Ltd. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING3. If not, see <http://www.gnu.org/licenses/>. */ #include "bfd.h" #include "cgc-bfd.h" #include "stdint.h" /* Take the PAGE component of an address or offset. */ #define PG(x) ((x) & ~ (bfd_vma) 0xfff) #define PG_OFFSET(x) ((x) & (bfd_vma) 0xfff) extern bfd_reloc_status_type _bfd_aarch64_cgc_put_addend (bfd *, bfd_byte *, bfd_reloc_code_real_type, reloc_howto_type *, bfd_signed_vma); extern bfd_vma _bfd_aarch64_cgc_resolve_relocation (bfd_reloc_code_real_type, bfd_vma, bfd_vma, bfd_vma, bfd_boolean); extern bfd_boolean _bfd_aarch64_cgc_add_symbol_hook (bfd *, struct bfd_link_info *, Cgc_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); extern bfd_boolean _bfd_aarch64_cgc_grok_prstatus (bfd *, Cgc_Internal_Note *); #define cgc_backend_add_symbol_hook _bfd_aarch64_cgc_add_symbol_hook #define cgc_backend_grok_prstatus _bfd_aarch64_cgc_grok_prstatus
/* * $Id: ftshadow.c 9689 2012-09-16 08:28:37Z andijahja $ */ /* * Harbour Project source code: * NF functions: FT_SHADOW(), FT_SETATTR() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. * * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * * This exception applies only to the code released by the Harbour * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * */ #include "hbapi.h" #include "hbapigt.h" HB_FUNC_EXTERN( HB_SHADOW ); HB_FUNC( FT_SHADOW ) { HB_FUNC_EXEC( HB_SHADOW ); } HB_FUNC( FT_SETATTR ) { hb_gtSetAttribute( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ); }
/* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02110-1301, USA. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_LIST_H__ #define __G_LIST_H__ #include <glib/gmem.h> G_BEGIN_DECLS typedef struct _GList GList; struct _GList { gpointer data; GList *next; GList *prev; }; /* Doubly linked lists */ GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; void g_list_free (GList *list); void g_list_free_1 (GList *list); #define g_list_free1 g_list_free_1 GList* g_list_append (GList *list, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_prepend (GList *list, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_insert (GList *list, gpointer data, gint position) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_insert_sorted_with_data (GList *list, gpointer data, GCompareDataFunc func, gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_insert_before (GList *list, GList *sibling, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_concat (GList *list1, GList *list2) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_remove (GList *list, gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_remove_all (GList *list, gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_remove_link (GList *list, GList *llink) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_delete_link (GList *list, GList *link_) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_nth (GList *list, guint n); GList* g_list_nth_prev (GList *list, guint n); GList* g_list_find (GList *list, gconstpointer data); GList* g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func); gint g_list_position (GList *list, GList *llink); gint g_list_index (GList *list, gconstpointer data); GList* g_list_last (GList *list); GList* g_list_first (GList *list); guint g_list_length (GList *list); void g_list_foreach (GList *list, GFunc func, gpointer user_data); GList* g_list_sort (GList *list, GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; GList* g_list_sort_with_data (GList *list, GCompareDataFunc compare_func, gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; gpointer g_list_nth_data (GList *list, guint n); #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) #ifndef G_DISABLE_DEPRECATED void g_list_push_allocator (gpointer allocator); void g_list_pop_allocator (void); #endif G_END_DECLS #endif /* __G_LIST_H__ */
/* * File: el_string.c * Copyright: (c)2015 Gerrard de Jonge <development.gdj@netvisit.nl> * License: GPLv2 (see file COPYING) * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include "el_defs.h" #include "el_string.h" /// /// /// /// void clearMarker(char * s, char marker) { char * pos; if ((pos = strchr(s, marker)) != NULL) { *pos = '\0'; } } /// /// Remove all leading spaces of string /// Returns pointer to string, which should be /// the same as the original /// char * leftTrim(char * str) { char * t; int i = 0; while (isspace(str[i])) i++; t = xStrDup(&str[i]); strcpy(str, t); if (t) { free(t); } return str; } /// /// Remove all trailing spaces of string str /// Returns pointer to string, which should be /// the same as the original /// char * rightTrim(char * str) { int pos; pos = strlen(str) - 1; while (isspace(str[pos]) && pos >= 0) { str[pos] = '\0'; pos--; } return str; } /// /// Remove all leading and trailing spaces of string str /// Returns pointer to string, which should be /// the same as the original /// char * trim(char * str) { return leftTrim(rightTrim(str)); } /// /// Alloc memory for size chars /// Return pointer to allocated memory or /// exits on failure /// void * xMalloc(const size_t size) { void * temp; if ((temp = malloc(size)) == NULL) { printf("Out of memory\n"); exit(EXIT_FAILURE); } return temp; } /// /// Allocate memory for count elements of size chars and set them to 0 /// Return pointer to allocated memory or /// exits on failure /// void * xCalloc(const size_t count, const size_t eltsize) { void * temp = xMalloc(count * eltsize); memset (temp, 0, count * eltsize); return temp; } /// /// Allocates new string and copies string str to it /// Return pointer to allocated memory or exit /// if allocation went wrong /// void * xStrDup(const char * str) { char * temp; if ((temp = calloc(strlen(str)+1, 1)) == NULL) { printf("Out of memory\n"); exit(EXIT_FAILURE); } else { strcpy(temp, str); } return temp; } /// /// /// /// char loCase(const char c) { return ('A' <= c && c <= 'Z') ? c -'A' + 'a' : c; } /// /// /// /// char upCase(const char c) { return ('a' <= c && c <= 'z') ? c - 'a' + 'A' : c; } /// /// /// /// void upperCase(char * str) { if (str) { for ( ; *str != '\0'; str++) { *str = upCase(*str); } } } /// /// /// /// void lowerCase(char * str) { if (str) { for ( ; *str != '\0'; str++) { *str = loCase(*str); } } } /// /// Remove all spaces from a given string /// /// void strTransform(char * line) { char * str; char newstr[LINESIZE] = {""}; while ((str = strtok(line, " ")) != NULL) { strcat(newstr, str); } strcpy(line, newstr); lowerCase(line); } /// Check if a line is isEmpty /// Return true if empty otherwise return false bool isEmpty(const char const * line) { return *line == '\0' ? true : false; } // end of el_string.c
/** @file Color3uint8.h @maintainer Morgan McGuire, graphics3d.com @created 2003-04-07 @edited 2006-06-24 Copyright 2000-2006, Morgan McGuire. All rights reserved. */ #ifndef G3D_COLOR3UINT8_H #define G3D_COLOR3UINT8_H #include "G3D/platform.h" #include "G3D/g3dmath.h" namespace G3D { /* Represents a Color3 as a packed integer. Convenient for creating unsigned int vertex arrays. Used by G3D::GImage as the underlying format. <B>WARNING</B>: Integer color formats are different than integer vertex formats. The color channels are automatically scaled by 255 (because OpenGL automatically scales integer colors back by this factor). So Color3(1,1,1) == Color3uint8(255,255,255) but Vector3(1,1,1) == Vector3int16(1,1,1). */ G3D_BEGIN_PACKED_CLASS(1) class Color3uint8 { private: // Hidden operators bool operator<(const Color3uint8&) const; bool operator>(const Color3uint8&) const; bool operator<=(const Color3uint8&) const; bool operator>=(const Color3uint8&) const; public: uint8 r; uint8 g; uint8 b; Color3uint8() : r(0), g(0), b(0) {} Color3uint8(const uint8 _r, const uint8 _g, const uint8 _b) : r(_r), g(_g), b(_b) {} Color3uint8(const class Color3& c); Color3uint8(class BinaryInput& bi); inline static Color3uint8 fromARGB(uint32 i) { Color3uint8 c; c.r = (i >> 16) & 0xFF; c.g = (i >> 8) & 0xFF; c.b = i & 0xFF; return c; } inline Color3uint8 bgr() const { return Color3uint8(b, g, r); } /* Returns the color packed into a uint32 (the upper byte is 0xFF) */ inline uint32 asUInt32() const { return (0xFF << 24) + ((uint32)r << 16) + ((uint32)g << 8) + b; } void serialize(class BinaryOutput& bo) const; void deserialize(class BinaryInput& bi); // access vector V as V[0] = V.r, V[1] = V.g, V[2] = V.b // // WARNING. These member functions rely on // (1) Color3 not having virtual functions // (2) the data packed in a 3*sizeof(uint8) memory block uint8& operator[] (int i) const { debugAssert((unsigned int)i < 3); return ((uint8*)this)[i]; } operator uint8* () { return (G3D::uint8*)this; } operator const uint8* () const { return (uint8*)this; } bool operator==(const Color3uint8& other) const { return (other.r == r) && (other.g == g) && (other.b == b); } bool operator!=(const Color3uint8& other) const { return (other.r != r) && (other.g != g) && (other.b != b); } } G3D_END_PACKED_CLASS(1) } // namespace G3D #endif
#include <linux/module.h> #include <linux/video_output.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/ctype.h> MODULE_DESCRIPTION("Display Output Switcher Lowlevel Control Abstraction"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Luming Yu <luming.yu@intel.com>"); static ssize_t video_output_show_state(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret_size = 0; struct output_device *od = to_output_device(dev); if (od->props) ret_size = sprintf(buf,"%.8x\n",od->props->get_status(od)); return ret_size; } static ssize_t video_output_store_state(struct device *dev, struct device_attribute *attr, const char *buf,size_t count) { char *endp; struct output_device *od = to_output_device(dev); int request_state = simple_strtoul(buf,&endp,0); size_t size = endp - buf; if (isspace(*endp)) size++; if (size != count) return -EINVAL; if (od->props) { od->request_state = request_state; od->props->set_state(od); } return count; } static void video_output_release(struct device *dev) { struct output_device *od = to_output_device(dev); kfree(od); } static struct device_attribute video_output_attributes[] = { __ATTR(state, 0644, video_output_show_state, video_output_store_state), __ATTR_NULL, }; static struct class video_output_class = { .name = "video_output", .dev_release = video_output_release, .dev_attrs = video_output_attributes, }; struct output_device *video_output_register(const char *name, struct device *dev, void *devdata, struct output_properties *op) { struct output_device *new_dev; int ret_code = 0; new_dev = kzalloc(sizeof(struct output_device),GFP_KERNEL); if (!new_dev) { ret_code = -ENOMEM; goto error_return; } new_dev->props = op; new_dev->dev.class = &video_output_class; new_dev->dev.parent = dev; dev_set_name(&new_dev->dev, name); dev_set_drvdata(&new_dev->dev, devdata); ret_code = device_register(&new_dev->dev); if (ret_code) { kfree(new_dev); goto error_return; } return new_dev; error_return: return ERR_PTR(ret_code); } EXPORT_SYMBOL(video_output_register); void video_output_unregister(struct output_device *dev) { if (!dev) return; device_unregister(&dev->dev); } EXPORT_SYMBOL(video_output_unregister); static void __exit video_output_class_exit(void) { class_unregister(&video_output_class); } static int __init video_output_class_init(void) { return class_register(&video_output_class); } postcore_initcall(video_output_class_init); module_exit(video_output_class_exit);
#ifndef DYN_ARRAY_DYN_ARRAY_H #define DYN_ARRAY_DYN_ARRAY_H extern void **dynarr_new(); extern void **dynarr_destroy(void **arr); extern void **dynarr_set(void **arr, size_t index, void* data); extern void *dynarr_get(void **arr, size_t index); #endif //DYN_ARRAY_DYN_ARRAY_H
#include "openbios/config.h" #include "openbios/bindings.h" #include "asm/types.h" /* program counter */ extern ucell PC; extern unsigned char *dict; extern cell dicthead; extern ucell *last; struct eregs { uint32_t eax, ecx, edx, ebx, esp, ebp, esi, edi; uint32_t vector; uint32_t error_code; uint32_t eip; uint32_t cs; uint32_t eflags; }; static const char * const exception_names[]= { "division by zero", "single step", "NMI", "breakpoint", "interrupt overflow", "bound range exceeded", "invalid opcode", "device unavailable", "double fault", "FPU segment overrun", "invalid TSS", "segment not present", "stack exception", "general protection fault", "page fault", "reserved", "floating point exception", "alignment check", "machine check exception", }; void do_nothing(void); void do_nothing(void) { printk("Doing nothing\n"); } void x86_exception(struct eregs *info); void x86_exception(struct eregs *info) { if(info->vector <= 18) { printk("\nUnexpected Exception: %s", exception_names[info->vector]); } else { printk("\nUnexpected Exception: %d", info->vector); } printk( " @ %02x:%08lx - Halting\n" "Code: %d eflags: %08lx\n" "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n" "edi: %08lx esi: %08lx ebp: %08lx esp: %08lx\n", info->cs, (unsigned long)info->eip, info->error_code, (unsigned long)info->eflags, (unsigned long)info->eax, (unsigned long)info->ebx, (unsigned long)info->ecx, (unsigned long)info->edx, (unsigned long)info->edi, (unsigned long)info->esi, (unsigned long)info->ebp, (unsigned long)info->esp); printk("\ndict=0x%x here=0x%x(dict+0x%x) pc=0x%x(dict+0x%x)\n", (ucell)dict, (ucell)dict + dicthead, dicthead, PC, PC - (ucell) dict); printk("dstackcnt=%d rstackcnt=%d\n", dstackcnt, rstackcnt); rstackcnt=0; dstackcnt=0; PC=findword("outer-interpreter"); info->eip=(uint32_t)&do_nothing; /* for (;;) asm("hlt;"); ; */ }
/* * Dummy LL interface for the Gigaset driver * * Copyright (c) 2009 by Tilman Schmidt <tilman@imap.cc>. * * ===================================================================== * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * ===================================================================== */ #include <linux/export.h> #include "gigaset.h" void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) { } EXPORT_SYMBOL_GPL(gigaset_skb_sent); void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb) { } EXPORT_SYMBOL_GPL(gigaset_skb_rcvd); void gigaset_isdn_rcv_err(struct bc_state *bcs) { } EXPORT_SYMBOL_GPL(gigaset_isdn_rcv_err); int gigaset_isdn_icall(struct at_state_t *at_state) { return ICALL_IGNORE; } void gigaset_isdn_connD(struct bc_state *bcs) { } void gigaset_isdn_hupD(struct bc_state *bcs) { } void gigaset_isdn_connB(struct bc_state *bcs) { } void gigaset_isdn_hupB(struct bc_state *bcs) { } void gigaset_isdn_start(struct cardstate *cs) { } void gigaset_isdn_stop(struct cardstate *cs) { } int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) { return 1; } void gigaset_isdn_unregdev(struct cardstate *cs) { } void gigaset_isdn_regdrv(void) { pr_info("no ISDN subsystem interface\n"); } void gigaset_isdn_unregdrv(void) { }
/*------------------------------------------------------------------------ * Step length estimation by parabolic line search for the AC case * * D. Koehn * Kiel, 12.06.2017 * ----------------------------------------------------------------------*/ #include "fd.h" float step_length_est_ac(struct waveAC *waveAC, struct waveAC_PML *waveAC_PML, struct matAC *matAC, struct fwiPSV *fwiPSV, struct mpiPSV *mpiPSV, struct seisPSV *seisPSV, struct seisPSVfwi *seisPSVfwi, struct acq *acq, float *hc, int iter, int nsrc, int ns, int ntr, int ntr_glob, float * epst1, double * L2t, int nsrc_glob, int nsrc_loc, int *step1, int *step3, int nxgrav, int nygrav, int ngrav, float **gravpos, float *gz_mod, int NZGRAV, int ntr_loc, float **Ws, float **Wr, int hin, int *DTINV_help, MPI_Request * req_send, MPI_Request * req_rec){ /* global variables */ extern int MYID,MIN_ITER,TIME_FILT,STEPMAX, GRAVITY, IDX, IDY, NX, NY, NXG, NYG, POS[3], MYID; extern char JACOBIAN[STRING_SIZE]; extern float EPS_SCALE, SCALEFAC, LAM_GRAV, GAMMA_GRAV, L2_GRAV_IT1; extern float FC; /* local variables */ float opteps_vp, ** rho_grav, ** rho_grav_ext; int h, i, j, n, nshots, ishot, nt, lsnap, lsamp, nsnap, infoout; int step2, itest, itests, iteste, stepmax, countstep; float scalefac, eps_scale, L2_grav, tmp, tmp1; double L2sum1; float * gz_res; char jac_grav[STRING_SIZE]; FILE *FP_GRAV, *FP; scalefac = SCALEFAC; /* scale factor for the step length */ stepmax = STEPMAX; /* number of maximum misfit calculations/steplength 2/3*/ *step1=0; step2=0; /* start with first guess for step length alpha */ eps_scale=EPS_SCALE; /* maximum model change = 1% of the maximum model value */ countstep=0; /* count number of forward calculations */ itests=2; iteste=2; /* store current AC models */ copy_mat((*matAC).prho,(*fwiPSV).prho_old); copy_mat((*matAC).ppi,(*fwiPSV).ppi_old); while((step2!=1)||(*step1!=1)){ for (itest=itests;itest<=iteste;itest++){ /* calculate 3 L2 values */ /* update material parameters for test step eps_scale */ tmp=calc_mat_change_test_AC((*fwiPSV).waveconv,(*fwiPSV).waveconv_rho,(*fwiPSV).prho_old,(*matAC).prho,(*fwiPSV).ppi_old,(*matAC).ppi,iter,1,eps_scale,1); (*seisPSVfwi).L2 = obj_ac(waveAC,waveAC_PML,matAC,fwiPSV,mpiPSV,seisPSV,seisPSVfwi,acq,hc,nsrc,nsrc_loc,nsrc_glob,ntr,ntr_glob,ns,itest,iter,Ws,Wr,hin,DTINV_help,eps_scale,req_send,req_rec); L2t[itest] = (*seisPSVfwi).L2; epst1[itest]=eps_scale; epst1[1] = 0.0; if(GRAVITY==2){ /* save seismic L2-norm of seismic data residuals */ L2sum1 = L2t[itest]; gz_res = vector(1,ngrav); /* global density model */ rho_grav = matrix(1,NYG,1,NXG); rho_grav_ext = matrix(1,nygrav,1,nxgrav); /* model gravity data */ /* save current density model */ sprintf(jac_grav,"%s_tmp.rho.%i.%i",JACOBIAN,POS[1],POS[2]); FP_GRAV=fopen(jac_grav,"wb"); for (i=1;i<=NX;i=i+IDX){ for (j=1;j<=NY;j=j+IDY){ tmp1 = (*matAC).prho[j][i]; fwrite(&tmp1,sizeof(float),1,FP_GRAV); } } fclose(FP_GRAV); MPI_Barrier(MPI_COMM_WORLD); /* merge model file */ sprintf(jac_grav,"%s_tmp.rho",JACOBIAN); if (MYID==0) mergemod(jac_grav,3); MPI_Barrier(MPI_COMM_WORLD); read_density_glob(rho_grav,2); extend_mod(rho_grav,rho_grav_ext,nxgrav,nygrav); grav_mod(rho_grav_ext,ngrav,gravpos,gz_mod,nxgrav,nygrav,NZGRAV); /* calculate gravity data residuals */ L2_grav=calc_res_grav(ngrav,gz_mod,gz_res); /* calculate lambda_grav */ /* LAM_GRAV = GAMMA_GRAV * (L2sum1/L2_GRAV_IT1); */ /* add gravity penalty term to the seismic objective function */ L2t[itest]+=LAM_GRAV * L2_grav; /* free memory */ free_matrix(rho_grav,1,NYG,1,NXG); free_matrix(rho_grav_ext,1,nygrav,1,nxgrav); free_vector(gz_res,1,ngrav); } } /* end of L2 test */ /* Did not found a step size which reduces the misfit function */ if((*step1==0)&&(L2t[1]<=L2t[2])){ eps_scale = eps_scale/scalefac; countstep++; } /* Found a step size with L2t[2] < L2t[3]*/ if((*step1==1)&&(L2t[2]<L2t[3])){ epst1[3]=eps_scale; step2=1; } /* Could not found a step size with L2t[2] < L2t[3]*/ if((*step1==1)&&(L2t[2]>=L2t[3])){ epst1[3]=eps_scale; /* increase step length to find a larger misfit function than L2t[2]*/ eps_scale = eps_scale + (eps_scale/scalefac); countstep++; } /* found a step size which reduces the misfit function */ if((*step1==0)&&(L2t[1]>L2t[2])){ epst1[2]=eps_scale; *step1=1; iteste=3; itests=3; countstep=0; /* find a second step length with a larger misfit function than L2t[2]*/ eps_scale = eps_scale + (eps_scale/scalefac); } *step3=0; if((*step1==0)&&(countstep>stepmax)){ if(MYID==0){ printf(" Steplength estimation failed!");} *step3=1; break; } if((*step1==1)&&(countstep>stepmax)){ if(MYID==0){ printf("Could not found a proper 3rd step length which brackets the minimum\n");} *step1=1; step2=1; } if(MYID==0){ printf("iteste = %d \t itests = %d \t step1 = %d \t step2 = %d \t eps_scale = %e \t countstep = %d \t stepmax= %d \t scalefac = %e \t MYID = %d \t L2t[1] = %e \t L2t[2] = %e \t L2t[3] = %e \n",iteste,itests,*step1,step2,eps_scale,countstep,stepmax,scalefac,MYID,L2t[1],L2t[2],L2t[3]);} } /* end of while loop */ if(*step1==1){ /* only find an optimal step length if step1==1 */ if(MYID==0){ printf("================================================= \n"); printf("calculate optimal step length epsilon for Vp and Vs \n"); printf("================================================= \n"); } opteps_vp=calc_opt_step(L2t,epst1,1); eps_scale = opteps_vp; } return eps_scale; }
/*************************************************************************** * This file is part of KDevelop * * Copyright 2007 Andreas Pakulat <apaku@gmx.de> * * * * This program 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 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 Library 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 KDEVPLATFORM_PLUGIN_SVNLOGJOB_H #define KDEVPLATFORM_PLUGIN_SVNLOGJOB_H #include "svnjobbase.h" #include <QVariant> #include <kurl.h> #include <vcs/vcsrevision.h> #include <vcs/vcsevent.h> class SvnInternalLogJob; class SvnLogJob : public SvnJobBase { Q_OBJECT public: SvnLogJob( KDevSvnPlugin* parent ); QVariant fetchResults(); void start(); SvnInternalJobBase* internalJob() const; void setLocation( const KUrl& location ); void setLimit( int limit ); void setEndRevision( const KDevelop::VcsRevision& rev ); void setStartRevision( const KDevelop::VcsRevision& rev ); private slots: void logEventReceived( const KDevelop::VcsEvent& ); private: SvnInternalLogJob* m_job; QList<QVariant> m_eventList; }; #endif
#ifndef VOLUME_RENDERER_H #define VOLUME_RENDERER_H #include "GL/glew.h" #include "volume_renderer_global.h" #include <QWidget> class TransferFunction1DWidget; class VolumeRenderWidget; class QSlider; class VOLUMERENDERER_EXPORT VolumeRenderer : public QWidget { Q_OBJECT public: VolumeRenderer(); ~VolumeRenderer(); void SetData(int* sizes_t, float* spacings_t, GLenum data_format_t, void* data_t); private: TransferFunction1DWidget* transfer_function_1d_widget_; VolumeRenderWidget* volume_render_widget_; QSlider* win_center_slider; QSlider* win_width_slider; void InitializeWidget(); private slots: void OnTransferFunctionChanged(); void OnWinCenterChanged(int); void OnWinWidthChanged(int); void OnOptimizationTriggered(); }; #endif // VOLUME_RENDERER_H
// // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005-2014 Simon Howard // // 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. // // DESCRIPTION: // Mission begin melt/wipe screen special effect. // #include <string.h> #include "z_zone.h" #include "i_video.h" #include "v_video.h" #include "m_random.h" #include "doomtype.h" #include "f_wipe.h" // // SCREEN WIPE PACKAGE // // when zero, stop the wipe static boolean go = 0; static byte* wipe_scr_start; static byte* wipe_scr_end; static byte* wipe_scr; void wipe_shittyColMajorXform ( short* array, int width, int height ) { int x; int y; short* dest; dest = (short*) Z_Malloc(width*height*sizeof(*dest), PU_STATIC, 0); for(y=0;y<height;y++) for(x=0;x<width;x++) dest[x*height+y] = array[y*width+x]; memcpy(array, dest, width*height*sizeof(*dest)); Z_Free(dest); } int wipe_initColorXForm ( int width, int height, int ticks ) { memcpy(wipe_scr, wipe_scr_start, width*height*sizeof(*wipe_scr)); return 0; } int wipe_doColorXForm ( int width, int height, int ticks ) { boolean changed; byte* w; byte* e; int newval; changed = false; w = wipe_scr; e = wipe_scr_end; while (w!=wipe_scr+width*height) { if (*w != *e) { if (*w > *e) { newval = *w - ticks; if (newval < *e) *w = *e; else *w = newval; changed = true; } else if (*w < *e) { newval = *w + ticks; if (newval > *e) *w = *e; else *w = newval; changed = true; } } w++; e++; } return !changed; } int wipe_exitColorXForm ( int width, int height, int ticks ) { return 0; } static int* y; int wipe_initMelt ( int width, int height, int ticks ) { int i, r; // copy start screen to main screen memcpy(wipe_scr, wipe_scr_start, width*height*sizeof(*wipe_scr)); // makes this wipe faster (in theory) // to have stuff in column-major format wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height); wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height); // setup initial column positions // (y<0 => not ready to scroll yet) y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0); y[0] = -(M_Random()%16); for (i=1;i<width;i++) { r = (M_Random()%3) - 1; y[i] = y[i-1] + r; if (y[i] > 0) y[i] = 0; else if (y[i] == -16) y[i] = -15; } return 0; } int wipe_doMelt ( int width, int height, int ticks ) { int i; int j; int dy; int idx; short* s; short* d; boolean done = true; width/=2; while (ticks--) { for (i=0;i<width;i++) { if (y[i]<0) { y[i]++; done = false; } else if (y[i] < height) { dy = (y[i] < 16) ? y[i]+1 : (8 << hires); if (y[i]+dy >= height) dy = height - y[i]; s = &((short *)wipe_scr_end)[i*height+y[i]]; d = &((short *)wipe_scr)[y[i]*width+i]; idx = 0; for (j=dy;j;j--) { d[idx] = *(s++); idx += width; } y[i] += dy; s = &((short *)wipe_scr_start)[i*height]; d = &((short *)wipe_scr)[y[i]*width+i]; idx = 0; for (j=height-y[i];j;j--) { d[idx] = *(s++); idx += width; } done = false; } } } return done; } int wipe_exitMelt ( int width, int height, int ticks ) { Z_Free(y); Z_Free(wipe_scr_start); Z_Free(wipe_scr_end); return 0; } int wipe_StartScreen ( int x, int y, int width, int height ) { wipe_scr_start = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*wipe_scr_start), PU_STATIC, NULL); I_ReadScreen(wipe_scr_start); return 0; } int wipe_EndScreen ( int x, int y, int width, int height ) { wipe_scr_end = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*wipe_scr_end), PU_STATIC, NULL); I_ReadScreen(wipe_scr_end); V_DrawBlock(x, y, width, height, wipe_scr_start); // restore start scr. return 0; } int wipe_ScreenWipe ( int wipeno, int x, int y, int width, int height, int ticks ) { int rc; static int (*wipes[])(int, int, int) = { wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm, wipe_initMelt, wipe_doMelt, wipe_exitMelt }; // initial stuff if (!go) { go = 1; // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG wipe_scr = I_VideoBuffer; (*wipes[wipeno*3])(width, height, ticks); } // do a piece of wipe-in V_MarkRect(0, 0, width, height); rc = (*wipes[wipeno*3+1])(width, height, ticks); // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG // final stuff if (rc) { go = 0; (*wipes[wipeno*3+2])(width, height, ticks); } return !go; }
/* * * Copyright (C) 2010 Gautier Hattenberger * * This file is part of paparazzi. * * paparazzi 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. * * paparazzi 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 paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ /** \file sonar_maxbotix.h * * simple driver to deal with one maxbotix sensor */ #ifndef SONAR_MAXBOTIX_LISA_H #define SONAR_MAXBOTIX_LISA_H #include "std.h" #include "mcu_periph/adc.h" extern uint16_t sonar_meas; extern uint16_t sonar_thresh; extern uint16_t v1; extern uint16_t v2; extern uint16_t v3; extern bool_t sonar_data_available; extern void maxbotix_init(void); extern void maxbotix_read(void); //#include "subsystems/ins.h" // needed because ins is not a module #define SonarEvent(_handler) { \ if (sonar_data_available) { \ _handler(); \ sonar_data_available = FALSE; \ } \ } #endif
/* * blenderWindow.h * * Created on: Oct 31, 2013 * Author: arnaud */ #ifndef BLENDERWINDOW_H_ #define BLENDERWINDOW_H_ #include "ofxMSAInteractiveObject.h" class blenderWindow: public ofxMSAInteractiveObject { public: blenderWindow(); virtual ~blenderWindow(); void setup(); void update(); void draw(); virtual void reset(); int offView; //offset for 3D Viewport // see windowState diagrams bool cmdActive; // is blender task active in this window? bool active; // is window active static bool operatorActive; // is an operator (like rotate) active? bool coloredActive; //for color only // time to fade back to original color float coloredTime; float coloredStart; bool taskCompleted; bool mouseFocus; ofTrueTypeFont font; void onRollOver(int x, int y) { if (!operatorActive && mouseFocus) active = true; } void onRollOut() { if (!operatorActive && mouseFocus) active = false; } // Gaze move event void onGazeMoved(ofVec2f &coords); private: void processColored(ofColor &c); ofColor windowColor; ofColor activeWindowColor; ofColor windowColored; float coloredCount; }; #endif /* BLENDERWINDOW_H_ */
#ifndef __ASMARM_HWCAP_H #define __ASMARM_HWCAP_H /* * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP */ #define HWCAP_SWP (1 << 0) #define HWCAP_HALF (1 << 1) #define HWCAP_THUMB (1 << 2) #define HWCAP_26BIT (1 << 3) /* Play it safe */ #define HWCAP_FAST_MULT (1 << 4) #define HWCAP_FPA (1 << 5) #define HWCAP_VFP (1 << 6) #define HWCAP_EDSP (1 << 7) #define HWCAP_JAVA (1 << 8) #define HWCAP_IWMMXT (1 << 9) #define HWCAP_CRUNCH (1 << 10) #define HWCAP_THUMBEE (1 << 11) #define HWCAP_NEON (1 << 12) #define HWCAP_VFPv3 (1 << 13) #define HWCAP_VFPv3D16 (1 << 14) /* also set for VFPv4-D16 */ #define HWCAP_TLS (1 << 15) #define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */ #define HWCAP_VFPv4 (1 << 16) #define HWCAP_IDIVA (1 << 17) #define HWCAP_IDIVT (1 << 18) #define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */ #define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) #if defined(__KERNEL__) && !defined(__ASSEMBLY__) /* * This yields a mask that user programs can use to figure out what * instruction set this cpu supports. */ #define ELF_HWCAP (elf_hwcap) extern unsigned int elf_hwcap; #endif #endif
#if !defined(AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_) #define AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // AddModule.h : header file // ///////////////////////////////////////////////////////////////////////////// // CAddModule dialog class CAddModule : public CDialog { // Construction public: CAddModule(CWnd* pParent = NULL); // standard constructor void AddMachineName(const char *name, void *modinfo); // Dialog Data //{{AFX_DATA(CAddModule) enum { IDD = IDD_DIALOG1 }; CComboBox m_combo1; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAddModule) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CAddModule) virtual void OnOK(); virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_)
/** * Project: VSXu: Realtime modular visual programming language, music/audio visualizer. * * This file is part of Vovoid VSXu. * * @author Jonatan Wallmander, Robert Wenzel, Vovoid Media Technologies AB Copyright (C) 2003-2013 * @see The GNU Public License (GPL) * * 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 VSX_APPLICATION_H #define VSX_APPLICATION_H #include <sys/time.h> //extern vsx_engine* vme; //#define vsxu_version "VSXu 0.1.14 beta" //extern vsx_string vsxu_name; //extern vsx_string vsxu_version; //extern char* vsxu_ver; extern bool app_ctrl; extern bool app_alt; extern bool app_shift; extern bool dual_monitor; extern bool disable_randomizer; extern bool option_preload_all; extern bool no_overlay; extern int app_argc; extern char** app_argv; //extern int app_num_displays; // 0 means the primary one used, 1 the extra extern void (*app_set_fullscreen)(int,bool); extern bool (*app_get_fullscreen)(int); void app_init(int id); // which context is used? void app_pre_draw(); bool app_draw(int id); void app_char(long key); void app_key_down(long key); void app_key_up(long key); void app_mouse_move_passive(int x, int y); void app_mouse_move(int x, int y); // buttons: 0 = left, 1 = middle, 2 = right void app_mouse_down(unsigned long button,int x,int y); void app_mouse_up(unsigned long button,int x,int y); // -1 to -5 or whatever up to +1 void app_mousewheel(float diff,int x,int y); #endif
/* * Misc system wide parameters. * * Copyright (C) 2015, Broadcom Corporation. All Rights Reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * $Id: bcmparams.h 241182 2011-02-17 21:50:03Z $ */ #ifndef _bcmparams_h_ #define _bcmparams_h_ /*Foxconn add,edward,zhang,2013/07/03*/ #ifndef VLAN_SUPPORT #define VLAN_MAXVID 15 /* Max. VLAN ID supported/allowed */ #else #define VLAN_MAXVID 4094 /* Max. VLAN ID supported/allowed */ #endif #define VLAN_NUMPRIS 8 /* # of prio, start from 0 */ /*Foxconn add,edward,zhang,2013/07/03*/ #ifndef VLAN_SUPPORT #define DEV_NUMIFS 16 /* Max. # of devices/interfaces supported */ #else #define DEV_NUMIFS 4095 /* Max. # of devices/interfaces supported */ #endif #define WL_MAXBSSCFG 16 /* maximum number of BSS Configs we can configure */ #endif
/* * lingot, a musical instrument tuner. * * Copyright (C) 2004-2020 Iban Cereijo. * Copyright (C) 2004-2008 Jairo Chapela. * * This file is part of lingot. * * lingot 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. * * lingot 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 lingot; if not, write to the Free Software Foundation, * Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef LINGOT_AUDIO_PULSEAUDIO_H #define LINGOT_AUDIO_PULSEAUDIO_H #ifdef __cplusplus extern "C" { #endif int lingot_audio_pulseaudio_register(void); #ifdef __cplusplus } #endif #endif
#include <stdlib.h> #include <stdio.h> #include <stdbool.h> int squaresumdigits (int number) { int sum = 0; int input = number; while (input) { int digit = input % 10; sum += digit * digit; input /= 10; } //printf("%d\n",sum); return sum; } bool isHappy (int n) { int fast = n; int slow = n; do { fast = squaresumdigits (squaresumdigits (fast)); slow = squaresumdigits (slow); if (slow == 1 || fast == 1) return true; }while(fast != slow); return false; } int main() { int i = 0; printf("The number 19 is a happy number, %d\n", isHappy(19)); for(i; i < 10; i++) { int n = rand() % 10000; printf("The number %d is a happy number, %d\n", n, isHappy(n)); } }
/* linux/arch/arm/plat-s3c64xx/dev-spi.c * * Copyright (C) 2009 Samsung Electronics Ltd. * Jaswinder Singh <jassi.brar@samsung.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/string.h> #include <linux/platform_device.h> #include <linux/dma-mapping.h> #include <linux/gpio.h> #include <mach/dma.h> #include <mach/map.h> #include <mach/spi-clocks.h> #include <mach/irqs.h> #include <plat/s3c64xx-spi.h> #include <plat/gpio-cfg.h> #include <plat/devs.h> static char *spi_src_clks[] = { [S3C64XX_SPI_SRCCLK_PCLK] = "pclk", [S3C64XX_SPI_SRCCLK_SPIBUS] = "spi-bus", [S3C64XX_SPI_SRCCLK_48M] = "spi_48m", }; /* SPI Controller platform_devices */ /* Since we emulate multi-cs capability, we do not touch the GPC-3,7. * The emulated CS is toggled by board specific mechanism, as it can * be either some immediate GPIO or some signal out of some other * chip in between ... or some yet another way. * We simply do not assume anything about CS. */ static int s3c64xx_spi_cfg_gpio(struct platform_device *pdev) { unsigned int base; switch (pdev->id) { case 0: base = S3C64XX_GPC(0); break; case 1: base = S3C64XX_GPC(4); break; default: dev_err(&pdev->dev, "Invalid SPI Controller number!"); return -EINVAL; } //configure gpc 0~3 gpc 4~6 as function 2, spi function mode s3c_gpio_cfgall_range(base, 3, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); return 0; } static struct resource s3c64xx_spi0_resource[] = { [0] = { .start = S3C64XX_PA_SPI0, .end = S3C64XX_PA_SPI0 + 0x100 - 1, .flags = IORESOURCE_MEM, }, [1] = { .start = DMACH_SPI0_TX, .end = DMACH_SPI0_TX, .flags = IORESOURCE_DMA, }, [2] = { .start = DMACH_SPI0_RX, .end = DMACH_SPI0_RX, .flags = IORESOURCE_DMA, }, [3] = { .start = IRQ_SPI0, .end = IRQ_SPI0, .flags = IORESOURCE_IRQ, }, }; static struct s3c64xx_spi_info s3c64xx_spi0_pdata = { .cfg_gpio = s3c64xx_spi_cfg_gpio, .fifo_lvl_mask = 0x7f, .rx_lvl_offset = 13, .tx_st_done = 21, }; static u64 spi_dmamask = DMA_BIT_MASK(32); struct platform_device s3c64xx_device_spi0 = { .name = "s3c64xx-spi", .id = 0, .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), .resource = s3c64xx_spi0_resource, .dev = { .dma_mask = &spi_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c64xx_spi0_pdata, }, }; EXPORT_SYMBOL(s3c64xx_device_spi0); static struct resource s3c64xx_spi1_resource[] = { [0] = { .start = S3C64XX_PA_SPI1, .end = S3C64XX_PA_SPI1 + 0x100 - 1, .flags = IORESOURCE_MEM, }, [1] = { .start = DMACH_SPI1_TX, .end = DMACH_SPI1_TX, .flags = IORESOURCE_DMA, }, [2] = { .start = DMACH_SPI1_RX, .end = DMACH_SPI1_RX, .flags = IORESOURCE_DMA, }, [3] = { .start = IRQ_SPI1, .end = IRQ_SPI1, .flags = IORESOURCE_IRQ, }, }; static struct s3c64xx_spi_info s3c64xx_spi1_pdata = { .cfg_gpio = s3c64xx_spi_cfg_gpio, .fifo_lvl_mask = 0x7f, .rx_lvl_offset = 13, .tx_st_done = 21, }; struct platform_device s3c64xx_device_spi1 = { .name = "s3c64xx-spi", .id = 1, .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), .resource = s3c64xx_spi1_resource, .dev = { .dma_mask = &spi_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c64xx_spi1_pdata, }, }; EXPORT_SYMBOL(s3c64xx_device_spi1); void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) { struct s3c64xx_spi_info *pd; /* Reject invalid configuration */ if (!num_cs || src_clk_nr < 0 || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) { printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__); return; } switch (cntrlr) { case 0: pd = &s3c64xx_spi0_pdata; break; case 1: pd = &s3c64xx_spi1_pdata; break; default: printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", __func__, cntrlr); return; } pd->num_cs = num_cs; pd->src_clk_nr = src_clk_nr; pd->src_clk_name = spi_src_clks[src_clk_nr]; }
/* singlecolumnobjectproxymodel.h This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause <volker.krause@kdab.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/>. */ /** @file This file is part of the GammaRay Plugin API and declares the SingleColumnObjectProxyModel class. @brief Declares the SingleColumnObjectProxyModel class. @author Volker Krause \<volker.krause@kdab.com\> */ #ifndef GAMMARAY_SINGLECOLUMNOBJECTPROXYMODEL_H #define GAMMARAY_SINGLECOLUMNOBJECTPROXYMODEL_H #include <common/objectmodel.h> #include "util.h" #if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) #include <QSortFilterProxyModel> typedef QSortFilterProxyModel QIdentityProxyModel; #else #include <QIdentityProxyModel> #endif namespace GammaRay { /** * @brief A QIdentityProxyModel for generic Objects. */ class SingleColumnObjectProxyModel : public QIdentityProxyModel { public: /** * Constructor. * @param parent is the parent object for this instance. */ explicit SingleColumnObjectProxyModel(QObject *parent = 0) : QIdentityProxyModel(parent) { } /** * Returns the data for the specified model. * @param proxyIndex is a QModelIndex. * @param role is a Qt role. * * @return on success, a QVariant containing the data; * QVariant() if some anamoly occurs. */ QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const { if (proxyIndex.isValid() && role == Qt::DisplayRole && proxyIndex.column() == 0) { const QObject *obj = proxyIndex.data(ObjectModel::ObjectRole).value<QObject*>(); if (obj) { return Util::displayString(obj); } } return QIdentityProxyModel::data(proxyIndex, role); } }; } #endif // GAMMARAY_SINGLECOLUMNOBJECTPROXYMODEL_H
/* * Copyright (C) 2016 Felix "KoffeinFlummi" Wiegand * * 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. */ #pragma once #include "vector.h" typedef struct { float m00, m01, m02; float m10, m11, m12; float m20, m21, m22; } matrix; static const matrix empty_matrix = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const matrix identity_matrix = { 1, 0, 0, 0, 1, 0, 0, 0, 1 }; matrix vector_tilda(const vector v); matrix matrix_sub(const matrix m1, const matrix m2); matrix matrix_mult(const matrix m1, const matrix m2); matrix matrix_mult_scalar(const float s, const matrix m); matrix matrix_inverse(const matrix m);
// // RestaurantGuard.h // demoProtocol // // Created by techmaster on 9/11/13. // Copyright (c) 2013 Techmaster. All rights reserved. // #import <Foundation/Foundation.h> @protocol RestaurantGuard <NSObject> @required - (BOOL) isHeightOver18; - (void) speakEnglish; @optional - (void) speakJapanese; @end
/*********************************************************************** RemoteDevice - Class to daisy-chain device servers on remote machines. Copyright (c) 2002-2005 Oliver Kreylos This file is part of the Vrui VR Device Driver Daemon (VRDeviceDaemon). The Vrui VR Device Driver Daemon 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. The Vrui VR Device Driver Daemon 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 the Vrui VR Device Driver Daemon; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***********************************************************************/ #ifndef REMOTEDEVICE_INCLUDED #define REMOTEDEVICE_INCLUDED #include <Vrui/VRDeviceState.h> #include <Vrui/VRDevicePipe.h> #include "VRDevice.h" class RemoteDevice:public VRDevice { /* Elements: */ private: Vrui::VRDevicePipe pipe; // Pipe connected to device server Vrui::VRDeviceState state; // Shadow of server's current state /* Protected methods: */ virtual void deviceThreadMethod(void); /* Constructors and destructors: */ public: RemoteDevice(VRDevice::Factory* sFactory,VRDeviceManager* sDeviceManager,Misc::ConfigurationFile& configFile); ~RemoteDevice(void); /* Methods: */ virtual void start(void); virtual void stop(void); }; #endif
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; MODULE_INFO(intree, "Y"); static const struct modversion_info ____versions[] __used __attribute__((section("__versions"))) = { { 0x708a9a2b, "module_layout" }, { 0x3ec8886f, "param_ops_int" }, { 0x8a82c414, "ctp_free_platform_resource" }, { 0x7885b289, "i2c_del_driver" }, { 0xc96b8770, "i2c_register_driver" }, { 0xcaa92d89, "ctp_print_info" }, { 0x72edf3a, "standby_level" }, { 0x73e20c1c, "strlcpy" }, { 0xcbb41871, "input_event" }, { 0x5f754e5a, "memset" }, { 0x31b5d6b6, "malloc_sizes" }, { 0xb5eeb329, "register_early_suspend" }, { 0xe85d4cb5, "ctp_set_int_port_deb" }, { 0xf9e65190, "ctp_set_int_port_rate" }, { 0xd6b80f4f, "sw_gpio_irq_request" }, { 0x1a03a7f4, "dev_err" }, { 0xc170990, "input_register_device" }, { 0xe914e41e, "strcpy" }, { 0x676bbc0f, "_set_bit" }, { 0x9a72feeb, "input_set_abs_params" }, { 0xcb1a71bb, "input_allocate_device" }, { 0x43a53735, "__alloc_workqueue_key" }, { 0x279fb16d, "kmem_cache_alloc" }, { 0x37a0cba, "kfree" }, { 0xda660e67, "input_free_device" }, { 0x70411a66, "input_unregister_device" }, { 0x597e7b79, "dev_set_drvdata" }, { 0x8c03d20c, "destroy_workqueue" }, { 0x69ef5e17, "sw_gpio_irq_free" }, { 0xb227ae83, "unregister_early_suspend" }, { 0x9006564a, "ctp_wakeup" }, { 0x9d669763, "memcpy" }, { 0xf9a482f9, "msleep" }, { 0x2e5810c6, "__aeabi_unwind_cpp_pr1" }, { 0xdd4fb86f, "i2c_transfer" }, { 0x42160169, "flush_workqueue" }, { 0x4205ad24, "cancel_work_sync" }, { 0x28fd02bd, "config_info" }, { 0xc84de6db, "sw_gpio_eint_set_enable" }, { 0xaa5ff8b1, "dev_get_drvdata" }, { 0xefd6cf06, "__aeabi_unwind_cpp_pr0" }, { 0x33543801, "queue_work" }, { 0x27e1a049, "printk" }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends="; MODULE_INFO(srcversion, "519D3E0B4D8F42684573DD1");
/* * Copyright (C) 2005-2011 Junjiro R. Okajima * * This program, aufs is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * module initialization and module-global */ #ifndef __AUFS_MODULE_H__ #define __AUFS_MODULE_H__ #ifdef __KERNEL__ #include <linux/slab.h> struct path; struct seq_file; /* module parameters */ extern int sysaufs_brs; /* ---------------------------------------------------------------------- */ extern int au_dir_roflags; enum { AuLcNonDir_FIINFO, AuLcNonDir_DIINFO, AuLcNonDir_IIINFO, AuLcDir_FIINFO, AuLcDir_DIINFO, AuLcDir_IIINFO, AuLcSymlink_DIINFO, AuLcSymlink_IIINFO, AuLcKey_Last }; extern struct lock_class_key au_lc_key[AuLcKey_Last]; void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp); int au_seq_path(struct seq_file *seq, struct path *path); #ifdef CONFIG_PROC_FS /* procfs.c */ int __init au_procfs_init(void); void au_procfs_fin(void); #else AuStubInt0(au_procfs_init, void); AuStubVoid(au_procfs_fin, void); #endif /* ---------------------------------------------------------------------- */ /* kmem cache */ enum { AuCache_DINFO, AuCache_ICNTNR, AuCache_FINFO, AuCache_VDIR, AuCache_DEHSTR, #ifdef CONFIG_AUFS_HNOTIFY AuCache_HNOTIFY, #endif AuCache_Last }; #define AuCacheFlags (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD) #define AuCache(type) KMEM_CACHE(type, AuCacheFlags) #define AuCacheCtor(type, ctor) \ kmem_cache_create(#type, sizeof(struct type), \ __alignof__(struct type), AuCacheFlags, ctor) extern struct kmem_cache *au_cachep[]; #define AuCacheFuncs(name, index) \ static inline struct au_##name *au_cache_alloc_##name(void) \ { return kmem_cache_alloc(au_cachep[AuCache_##index], GFP_NOFS); } \ static inline void au_cache_free_##name(struct au_##name *p) \ { kmem_cache_free(au_cachep[AuCache_##index], p); } AuCacheFuncs(dinfo, DINFO); AuCacheFuncs(icntnr, ICNTNR); AuCacheFuncs(finfo, FINFO); AuCacheFuncs(vdir, VDIR); AuCacheFuncs(vdir_dehstr, DEHSTR); #ifdef CONFIG_AUFS_HNOTIFY AuCacheFuncs(hnotify, HNOTIFY); #endif #endif /* __KERNEL__ */ #endif /* __AUFS_MODULE_H__ */
#ifndef DATAOBJECT_H #define DATAOBJECT_H #include <QObject> #include <QString> #include <QUrl> class DataObject : public QObject { Q_OBJECT Q_PROPERTY( QString name READ name CONSTANT) Q_PROPERTY( QString url READ url CONSTANT) // delet in further public: explicit DataObject(const QString &name, const QString &url, QObject *parent = 0); QString name()const; QString url()const; private: QString m_name; QString m_url; }; typedef QList<DataObject*> DataList; #endif // DATAOBJECT_H
#include "slalib.h" #include "slamac.h" #include <string.h> void slaDeuler ( char *order, double phi, double theta, double psi, double rmat[3][3] ) /* ** - - - - - - - - - - ** s l a D e u l e r ** - - - - - - - - - - ** ** Form a rotation matrix from the Euler angles - three successive ** rotations about specified Cartesian axes. ** ** (double precision) ** ** Given: ** *order char specifies about which axes the rotations occur ** phi double 1st rotation (radians) ** theta double 2nd rotation ( " ) ** psi double 3rd rotation ( " ) ** ** Returned: ** rmat double[3][3] rotation matrix ** ** A rotation is positive when the reference frame rotates ** anticlockwise as seen looking towards the origin from the ** positive region of the specified axis. ** ** The characters of order define which axes the three successive ** rotations are about. A typical value is 'zxz', indicating that ** rmat is to become the direction cosine matrix corresponding to ** rotations of the reference frame through phi radians about the ** old z-axis, followed by theta radians about the resulting x-axis, ** then psi radians about the resulting z-axis. ** ** The axis names can be any of the following, in any order or ** combination: x, y, z, uppercase or lowercase, 1, 2, 3. Normal ** axis labelling/numbering conventions apply; the xyz (=123) ** triad is right-handed. Thus, the 'zxz' example given above ** could be written 'zxz' or '313' (or even 'zxz' or '3xz'). Order ** is terminated by length or by the first unrecognized character. ** ** Fewer than three rotations are acceptable, in which case the later ** angle arguments are ignored. Zero rotations leaves rmat set to the ** identity matrix. ** ** Last revision: 2 January 2004 ** ** Copyright P.T.Wallace. All rights reserved. */ { int j, i, l, n, k; double result[3][3], rotn[3][3], angle, s, c , w, wm[3][3]; char axis; /* Initialize result matrix */ for ( j = 0; j < 3; j++ ) { for ( i = 0; i < 3; i++ ) { result[i][j] = ( i == j ) ? 1.0 : 0.0; } } /* Establish length of axis string */ l = (int) strlen ( order ); /* Look at each character of axis string until finished */ for ( n = 0; n < 3; n++ ) { if ( n <= l ) { /* Initialize rotation matrix for the current rotation */ for ( j = 0; j < 3; j++ ) { for ( i = 0; i < 3; i++ ) { rotn[i][j] = ( i == j ) ? 1.0 : 0.0; } } /* Pick up the appropriate Euler angle and take sine & cosine */ switch ( n ) { case 0 : angle = phi; break; case 1 : angle = theta; break; default: angle = psi; break; } s = sin ( angle ); c = cos ( angle ); /* Identify the axis */ axis = order[n]; if ( ( axis == 'X' ) || ( axis == 'x' ) || ( axis == '1' ) ) { /* Matrix for x-rotation */ rotn[1][1] = c; rotn[1][2] = s; rotn[2][1] = -s; rotn[2][2] = c; } else if ( ( axis == 'Y' ) || ( axis == 'y' ) || ( axis == '2' ) ) { /* Matrix for y-rotation */ rotn[0][0] = c; rotn[0][2] = -s; rotn[2][0] = s; rotn[2][2] = c; } else if ( ( axis == 'Z' ) || ( axis == 'z' ) || ( axis == '3' ) ) { /* Matrix for z-rotation */ rotn[0][0] = c; rotn[0][1] = s; rotn[1][0] = -s; rotn[1][1] = c; } else { /* Unrecognized character - fake end of string */ l = 0; } /* Apply the current rotation (matrix rotn x matrix result) */ for ( i = 0; i < 3; i++ ) { for ( j = 0; j < 3; j++ ) { w = 0.0; for ( k = 0; k < 3; k++ ) { w += rotn[i][k] * result[k][j]; } wm[i][j] = w; } } for ( j = 0; j < 3; j++ ) { for ( i= 0; i < 3; i++ ) { result[i][j] = wm[i][j]; } } } } /* Copy the result */ for ( j = 0; j < 3; j++ ) { for ( i = 0; i < 3; i++ ) { rmat[i][j] = result[i][j]; } } }
#ifndef EDGE_H #define EDGE_H #endif // EDGE_H
/* pdfdocument.h: Implementation of EvDocument for impresss * Copyright (C) 2005, Jonathan Blandford <jrb@gnome.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __IMPRESS_DOCUMENT_H__ #define __IMPRESS_DOCUMENT_H__ #include "ev-document.h" G_BEGIN_DECLS #define IMPRESS_TYPE_DOCUMENT (impress_document_get_type ()) #define IMPRESS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IMPRESS_TYPE_DOCUMENT, ImpressDocument)) #define IMPRESS_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IMPRESS_TYPE_DOCUMENT)) typedef struct _ImpressDocument ImpressDocument; GType impress_document_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS #endif /* __IMPRESS_DOCUMENT_H__ */
#ifdef COMPRESS_SUBALIGNMENTS void Make_All_Edges_Red(arbre *tree); void Init_All_Edges_Red(arbre *tree); void Fill_Red_Arrays_First(edge *b, node* from, arbre *tree); #endif
#ifndef _AGB_HOOKS_H #define _AGB_HOOKS_H #include <sys/stat.h> typedef int (*write_hook_t) (int file, char *ptr, int len); typedef int (*read_hook_t) (int file, char *ptr, int len); typedef int (*lseek_hook_t) (int file, int ptr, int dir); typedef int (*fstat_hook_t) (int file, struct stat *st); typedef int (*close_hook_t) (int file); typedef struct file_hook_t { read_hook_t read; write_hook_t write; lseek_hook_t lseek; fstat_hook_t fstat; close_hook_t close; } file_hook_t; typedef int (*valid_path_t) (const char *path); typedef int (*open_hook_t) (const char *path, int flags, ... ); typedef int (*link_hook_t) (const char *old, const char *new); typedef int (*unlink_hook_t) (const char *path); typedef int (*rename_hook_t) (const char *old, const char *new); typedef int (*stat_hook_t) (const char *path, struct stat *st); typedef struct filesystem_hook_t { valid_path_t valid_path; open_hook_t open; link_hook_t link; unlink_hook_t unlink; rename_hook_t rename; stat_hook_t stat; } filesystem_hook_t; void set_file_hook_buffer(file_hook_t **buffer, int size); void set_filesystem_hook_buffer(filesystem_hook_t **buffer, int size); file_hook_t *get_file_hook(int file); filesystem_hook_t *get_filesystem_hook(const char* path); #endif // _AGB_HOOKS
/* * $Id$ * * Copyright (C) 2008 Stanislav Sinyagin * * 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. * * Written by Stanislav Sinyagin <ssinyagin@k-open.com>, 2008. * */ #include <sysdep.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <sys/time.h> #include <urjtag/error.h> #include <urjtag/cmd.h> #include "cmd.h" static int cmd_usleep_run (urj_chain_t *chain, char *params[]) { long unsigned usecs; if (urj_cmd_params (params) != 2) { urj_error_set (URJ_ERROR_SYNTAX, "%s: #parameters should be %d, not %d", params[0], 2, urj_cmd_params (params)); return URJ_STATUS_FAIL; } if (urj_cmd_get_number (params[1], &usecs) != URJ_STATUS_OK) return URJ_STATUS_FAIL; usleep (usecs); return URJ_STATUS_OK; } static void cmd_usleep_help (void) { urj_log (URJ_LOG_LEVEL_NORMAL, _("Usage: %s USECS\n" "Sleep some number of microseconds.\n"), "usleep"); } const urj_cmd_t urj_cmd_usleep = { "usleep", N_("Sleep some number of microseconds"), cmd_usleep_help, cmd_usleep_run };
/** @file AsyncAudioSplitter.h @brief A class that splits an audio stream into multiple streams @author Tobias Blomberg / SM0SVX @date 2005-05-05 \verbatim Async - A library for programming event driven applications Copyright (C) 2004-2015 Tobias Blomberg / SM0SVX 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 \endverbatim */ #ifndef ASYNC_AUDIO_SPLITTER_INCLUDED #define ASYNC_AUDIO_SPLITTER_INCLUDED /**************************************************************************** * * System Includes * ****************************************************************************/ #include <list> #include <sigc++/sigc++.h> /**************************************************************************** * * Project Includes * ****************************************************************************/ #include <AsyncTimer.h> /**************************************************************************** * * Local Includes * ****************************************************************************/ #include <AsyncAudioSink.h> #include <AsyncAudioSource.h> /**************************************************************************** * * Forward declarations * ****************************************************************************/ /**************************************************************************** * * Namespace * ****************************************************************************/ namespace Async { /**************************************************************************** * * Forward declarations of classes inside of the declared namespace * ****************************************************************************/ /**************************************************************************** * * Defines & typedefs * ****************************************************************************/ /**************************************************************************** * * Exported Global Variables * ****************************************************************************/ /**************************************************************************** * * Class definitions * ****************************************************************************/ /** @brief A class that splits an audio stream into multiple streams @author Tobias Blomberg @date 2005-05-05 This class is part of the audio pipe framework. It is used to split one incoming audio source into multiple outgoing sources. */ class AudioSplitter : public Async::AudioSink, public Async::AudioSource, public sigc::trackable { public: /** * @brief Default constuctor */ AudioSplitter(void); /** * @brief Destructor */ ~AudioSplitter(void); /** * @brief Add an audio sink to the splitter * @param sink The sink object to add * @param managed If managed is \em true the attached sink will be * deleted when the splitter is deleted */ void addSink(AudioSink *sink, bool managed=false); /** * @brief Remove an audio sink from the splitter * @param sink The sink object to remove */ void removeSink(AudioSink *sink); /** * @brief Remove all audio sinks from this splitter */ void removeAllSinks(void); /** * @brief Enable or disable audio output to the given audio sink * @param sink The audio sink to enable/disable * @param enable Set to \em true to enable the sink or \em false to * disable it */ void enableSink(AudioSink *sink, bool enable); /** * @brief Write samples into this audio sink * @param samples The buffer containing the samples * @param len The number of samples in the buffer * @return Returns the number of samples that has been taken care of * * This function is used to write audio into this audio sink. If it * returns 0, no more samples should be written until the resumeOutput * function in the source have been called. * This function is normally only called from a connected source object. */ int writeSamples(const float *samples, int len); /** * @brief Tell the sink to flush the previously written samples * * This function is used to tell the sink to flush previously written * samples. When done flushing, the sink should call the * sourceAllSamplesFlushed function. * This function is normally only called from a connected source object. */ void flushSamples(void); protected: private: class Branch; std::list<Branch *> branches; float *buf; int buf_size; int buf_len; bool do_flush; bool input_stopped; int flushed_branches; Async::Timer *cleanup_branches_timer; Branch *main_branch; void writeFromBuffer(void); void flushAllBranches(void); friend class Branch; void branchResumeOutput(void); void branchAllSamplesFlushed(void); void cleanupBranches(Async::Timer *t); }; /* class AudioSplitter */ } /* namespace */ #endif /* ASYNC_AUDIO_SPLITTER_INCLUDED */ /* * This file has not been truncated */
#include <common.h> #include "platform.h" #include "usb_pcd.h" #include "usb_pcd.c" #include "platform.c" #include "dwc_pcd.c" #include "dwc_pcd_irq.c" DECLARE_GLOBAL_DATA_PTR; int usb_boot(int clk_cfg, int time_out) { int cfg = INT_CLOCK; #if defined(CONFIG_SILENT_CONSOLE) gd->flags &= ~GD_FLG_SILENT; #endif if(clk_cfg) cfg = EXT_CLOCK; set_usb_phy_config(cfg); usb_parameter_init(time_out); if(usb_pcd_init()) return 0; while(1) { //watchdog_clear(); //Elvis Fool if(usb_pcd_irq()) break; } return 0; } int do_tiny_usbtool (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int time_out = 0; if(argc > 1) { time_out = simple_strtol(argv[1], NULL, 10); } printf("Enter USB burning.\n"); return usb_boot(1, time_out); } U_BOOT_CMD( tiny_usbtool, 2, 1, do_tiny_usbtool, "start tiny USB tool for PC burner", "tiny_usbtool timeout" );
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * * Note: This test is not based on the POSIX spec, but is a speculation * about behavior for an assertion where the POSIX spec does not make a * statement about the behavior in either case. * * Test that if clock_settime() changes the value for CLOCK_REALTIME, * a repeating absolute timer uses this new value for expires. * * Document whether expirations which have already happened happen again or * not. * * Steps: * - get time T0 * - create/enable a timer to expire at T1 = T0 + TIMERINTERVAL and repeat * at interval TIMERINTERVAL * - sleep for time TIMERINTERVAL+ADDITIONALEXPIRES*TIMERINTERAL (must do * in a loop to catch all expires) * - set time backward to T0 * - sleep for time TIMERINTERVAL and ensure timer expires (2X) * * signal SIGTOTEST is used. */ #include <stdio.h> #include <time.h> #include <signal.h> #include <unistd.h> #include <stdlib.h> #include "posixtest.h" #include "../helpers.h" #define TIMERINTERVAL 5 #define ADDITIONALEXPIRES 2 #define ADDITIONALDELTA 1 #define SIGTOTEST SIGALRM int caught = 0; void handler(int signo) { printf("Caught signal\n"); caught++; } int main(int argc, char *argv[]) { struct sigevent ev; struct sigaction act; struct timespec tpT0, tpclock, tsreset; struct itimerspec its; timer_t tid; int i, flags = 0, nocaught = 0; /* * set up sigevent for timer * set up sigaction to catch signal */ ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGTOTEST; act.sa_handler = handler; act.sa_flags = 0; if (sigemptyset(&act.sa_mask) != 0) { perror("sigemptyset() was not successful\n"); return PTS_UNRESOLVED; } if (sigaction(SIGTOTEST, &act, 0) != 0) { perror("sigaction() was not successful\n"); return PTS_UNRESOLVED; } if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) { perror("clock_gettime() was not successful\n"); return PTS_UNRESOLVED; } if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } flags |= TIMER_ABSTIME; its.it_interval.tv_sec = TIMERINTERVAL; its.it_interval.tv_nsec = 0; its.it_value.tv_sec = tpT0.tv_sec + TIMERINTERVAL; its.it_value.tv_nsec = tpT0.tv_nsec; if (timer_settime(tid, flags, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } sleep(TIMERINTERVAL); for (i = 0; i < ADDITIONALEXPIRES; i++) { sleep(TIMERINTERVAL); } tpclock.tv_sec = tpT0.tv_sec; tpclock.tv_nsec = tpT0.tv_nsec; getBeforeTime(&tsreset); if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) { printf("clock_settime() was not successful\n"); return PTS_UNRESOLVED; } caught = 0; sleep(TIMERINTERVAL + ADDITIONALDELTA); if (caught == 1) { printf("Caught the first signal\n"); } else { printf("FAIL: Didn't catch timer after TIMERINTERVAL.\n"); nocaught = 1; } sleep(TIMERINTERVAL + ADDITIONALDELTA); if (caught >= 2) { printf("Caught another signal\n"); } else { printf("Caught %d < 2 signals\n", caught); nocaught = 1; } if (nocaught) { printf ("Implementation does not repeat signals on clock reset\n"); } else { printf("Implementation does repeat signals on clock reset\n"); } // If we finish, pass tsreset.tv_sec += 2 * (TIMERINTERVAL + ADDITIONALDELTA); setBackTime(tsreset); return PTS_PASS; }
/* * irq.h: in kernel interrupt controller related definitions * Copyright (c) 2007, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * Authors: * Yaozu (Eddie) Dong <Eddie.dong@intel.com> * */ #ifndef __IRQ_H #define __IRQ_H #include <linux/mm_types.h> #include <linux/hrtimer.h> #include <linux/kvm_host.h> #include <linux/spinlock.h> #include "iodev.h" #include "ioapic.h" #include "lapic.h" #define PIC_NUM_PINS 16 #define SELECT_PIC(irq) \ ((irq) < 8 ? KVM_IRQCHIP_PIC_MASTER : KVM_IRQCHIP_PIC_SLAVE) struct kvm; struct kvm_vcpu; struct kvm_kpic_state { u8 last_irr; /* edge detection */ u8 irr; /* interrupt request register */ u8 imr; /* interrupt mask register */ u8 isr; /* interrupt service register */ u8 priority_add; /* highest irq priority */ u8 irq_base; u8 read_reg_select; u8 poll; u8 special_mask; u8 init_state; u8 auto_eoi; u8 rotate_on_auto_eoi; u8 special_fully_nested_mode; u8 init4; /* true if 4 byte init */ u8 elcr; /* PIIX edge/trigger selection */ u8 elcr_mask; u8 isr_ack; /* interrupt ack detection */ struct kvm_pic *pics_state; }; struct kvm_pic { spinlock_t lock; bool wakeup_needed; unsigned pending_acks; struct kvm *kvm; struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */ int output; /* intr from master PIC */ struct kvm_io_device dev_master; struct kvm_io_device dev_slave; struct kvm_io_device dev_eclr; void (*ack_notifier)(void *opaque, int irq); unsigned long irq_states[PIC_NUM_PINS]; }; struct kvm_pic *kvm_create_pic(struct kvm *kvm); void kvm_destroy_pic(struct kvm_pic *vpic); int kvm_pic_read_irq(struct kvm *kvm); void kvm_pic_update_irq(struct kvm_pic *s); static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) { return kvm->arch.vpic; } static inline int pic_in_kernel(struct kvm *kvm) { int ret; ret = (pic_irqchip(kvm) != NULL); return ret; } static inline int irqchip_split(struct kvm *kvm) { return kvm->arch.irqchip_split; } static inline int irqchip_in_kernel(struct kvm *kvm) { struct kvm_pic *vpic = pic_irqchip(kvm); bool ret; ret = (vpic != NULL); ret |= irqchip_split(kvm); /* Read vpic before kvm->irq_routing. */ smp_rmb(); return ret; } void kvm_pic_reset(struct kvm_kpic_state *s); void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu); void __kvm_migrate_timers(struct kvm_vcpu *vcpu); int apic_has_pending_timer(struct kvm_vcpu *vcpu); #endif
#ifndef MAIN_H #define MAIN_H #include "cantera/zerodim.h" #include "cantera/thermo/IdealGasPhase.h" //#include "cantera/numerics.h" #include "global_settings.h" #include "initialcondition.h" #include <time.h> #include <sys/time.h> #include "example_utils.h" #include "ReimannSolver.h" #include "initialconditionfix.h" #include "exchanging.h" #include "reaction.h" #include "struct.h" #include "dataread.h" int kinetics2(int np, void* p); #endif
/* * ===================================================================================== * * Filename: netfunc.c * * Description: net exchange functions. * * Version: 1.0 * Created: 07/13/13 12:19:55 * Revision: none * Compiler: gcc * * Author: Li Xiang (gk), lixiang-best@163.com * Company: Li Xiang in Xiamen China. * * ===================================================================================== */ #include "unp.h" int main(void){ int b1,b2; long int m1,m2; uint16_t port;/*ip port*/ uint32_t host;/*ip host*/ port = htons(8080);/*host to network short*/ printf("ip port: 0x%x, ip net port: 0x%x\n", 8080, port); printf("ip port: 0x%x\n\n", ntohs(port)); host = htonl(0xffffff10);/*host to network short*/ printf("ip host: 0x%x, ip net host: 0x%x\n", 0xffffff10, host); printf("ip host: 0x%x\n\n", ntohl(host)); bzero(&b1,sizeof(b1)); printf("bzero(int):0x%x\n", b1); b1 = 10; bcopy(&b1, &b2, sizeof(b2)); printf("bcopy 0x%x, 0x%x, bcmp: 0x%x\n\n", b1, b2, bcmp(&b1, &b2, sizeof(b2))); memset(&m1, 0, sizeof(m1)); printf("bzero(long int):0x%lx\n", m1); m1 = 20; memcpy(&m2, &m1, sizeof(m2)); printf("bcopy 0x%lx, 0x%lx, bcmp: 0x%x\n\n", m1, m2, memcmp(&m1, &m2, sizeof(m2))); char straddr[] = "255.255.255.16"; struct in_addr addr; printf("inet_aton:%d\n", inet_aton(straddr, &addr)); printf("straddr:%s, in_addr:0x%x\n", straddr, addr); printf("inet_addr:0x%x\n", inet_addr(straddr));/*INADDR_NONE=0xffffffff*/ printf("inet_ntoa:%s\n\n", inet_ntoa(addr)); /*if(myinet_pton(AF_UNIX, NULL, NULL) < 0)*/ if(inet_pton(AF_UNIX, NULL, NULL) < 0) perror("inet_pton"); char pstr[] = "255.255.255.17"; char nstr[16]; struct in_addr paddr; printf("inet_pton:%d\n", inet_pton(AF_INET, pstr, &paddr)); printf("presentation str:%s, addr pointer:0x%x\n", pstr, paddr); if(inet_ntop(AF_INET, &paddr, nstr, 5) == NULL) perror("inet_ntop"); printf("inet_ntop:%s\n", inet_ntop(AF_INET, &paddr, nstr, sizeof(nstr))); printf("presentation:%s\n\n", nstr); char mystr[] = "255.255.255.20"; char mstr[INET_ADDRSTRLEN]; struct in_addr myaddr; myinet_pton(AF_INET, mystr, &myaddr); printf("presentation str:%s, addr pointer:0x%x\n", mystr, myaddr); myinet_ntop(AF_INET, &myaddr, mstr, INET_ADDRSTRLEN); printf("presentation:%s\n\n", mstr); u_char *pu = (u_char *)&myaddr; printf("sizeof u_char %d, %d.%d.%d.%d\n", sizeof(u_char), pu[0], pu[1], pu[2], pu[3]); int int_addr = 0xffffff11; unsigned char *pm = (unsigned char *)&int_addr; printf("sizeof char %d, %d.%d.%d.%d\n", sizeof(char), pm[3], pm[2], pm[1], pm[0]); return 0; }
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein is * confidential and proprietary to MediaTek Inc. and/or its licensors. Without * the prior written permission of MediaTek inc. and/or its licensors, any * reproduction, modification, use or disclosure of MediaTek Software, and * information contained herein, in whole or in part, shall be strictly * prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek * Software") have been modified by MediaTek Inc. All revisions are subject to * any receiver's applicable license agreements with MediaTek Inc. */ #ifndef _AUDIO_CUST_PARAM_TYPE_H_ #define _AUDIO_CUST_PARAM_TYPE_H_ namespace android { /* speech structure definition*/ typedef enum { VOL_NORMAL = 0 , VOL_HEADSET , VOL_HANDFREE , MAX_VOL_CATE } volume_category_enum; typedef enum { VOL_TYPE_TON = 0 , VOL_TYPE_KEY , VOL_TYPE_MIC , VOL_TYPE_FMR , VOL_TYPE_SPH , VOL_TYPE_SID , VOL_TYPE_MEDIA , MAX_VOL_TYPE } volume_type_enum; typedef struct { /* volume setting */ char volume[MAX_VOL_CATE][MAX_VOL_TYPE]; /* speech enhancement */ unsigned short speech_common_para[12]; unsigned short speech_mode_para[8][16]; unsigned short speech_volume_para[4];//in the feature, should extend to [MAX_VOL_CATE][MAX_VOL_TYPE][4] /* debug info */ unsigned short debug_info[16]; /* speech input FIR */ short sph_in_fir[6][45]; /* speech output FIR */ short sph_out_fir[6][45]; /* digital gain of DL speech */ unsigned short Digi_DL_Speech; /* digital gain of uplink speech */ unsigned short Digi_Microphone; /* FM record volume*/ unsigned short FM_Record_Volume; /* user mode : normal mode, earphone mode, loud speaker mode */ unsigned short Bluetooth_Sync_Type; unsigned short Bluetooth_Sync_Length; unsigned short bt_pcm_in_vol; unsigned short bt_pcm_out_vol; unsigned short user_mode; /* auto VM record setting */ unsigned short bSupportVM; unsigned short bAutoVM; // set to 1900, 2000, 2100, 2200¡Adefault 1900 // control AFE_VAC_CON0 VMIC_VREF unsigned short uMicbiasVolt; } SPH_CUSTOM_PARAM_STRUCT; }; // namespace android #endif //_AUDIO_CUST_PARAM_TYPE_H_
#ifndef _BMP_LOADER_H_ #define _BMP_LOADER_H_ #include "UIHelper.h" #include "Texture.h" class BMPLoader { public: static Texture load(char * name, bool smoothTexture); private: static bool readBMP(unsigned char * rawData, int rawDataSize, unsigned char ** buffer, Size * size); static bool getRawData(unsigned char ** rawData, int * size, char * name); static int getRawSize(FILE * imgFile); static void error(char * name, char * where); static void copyColorBytesBGR(unsigned char * rgbaBuffer, unsigned char * rgbBuffer, int count); static void copyColorBytesABGR(unsigned char * rgbaBuffer, unsigned char * rgbBuffer, int count); static int addPaddingFor4Bytes(int size); static int ucharToInt(unsigned char * buffer, int offset); static unsigned short ucharToUShort(unsigned char * buffer, int offset); }; #endif // _BMP_LOADER_H_
#include "ofgwrite.h" #include <stdio.h> #include <stdarg.h> #include <string.h> #include <stdlib.h> #include <fcntl.h> #include <getopt.h> #include <libubi.h> #include <syslog.h> #include <unistd.h> #include <libmtd.h> #include <errno.h> #include <mtd/mtd-abi.h> int getFlashType(char* device) { libmtd_t libmtd = libmtd_open(); if (libmtd == NULL) { if (errno == 0) my_printf("MTD is not present in the system"); my_printf("cannot open libmtd %s", strerror(errno)); return -1; } struct mtd_dev_info mtd; int err = mtd_get_dev_info(libmtd, device, &mtd); if (err) { my_fprintf(stderr, "cannot get information about \"%s\"\n", device); return -1; } libmtd_close(libmtd); return mtd.type; } int flash_erase(char* device, char* context, int quiet, int no_write) { optind = 0; // reset getopt_long char* argv[] = { "flash_erase", // program name device, // device "0", // start offset "0", // block count NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; if (!quiet) my_printf("Erasing %s: flash_erase %s 0 0\n", context, device); if (!no_write) if (flash_erase_main(argc, argv) != 0) return 0; return 1; } int flash_erase_jffs2(char* device, char* context, int quiet, int no_write) { optind = 0; // reset getopt_long char* argv[] = { "flash_erase", // program name "-j", // format the device for jffs2 device, // device "0", // start offset "0", // block count NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; if (!quiet) my_printf("Erasing %s: flash_erase -j %s 0 0\n", context, device); if (!no_write) if (flash_erase_main(argc, argv) != 0) return 0; return 1; } int flash_write(char* device, char* filename, int quiet, int no_write) { optind = 0; // reset getopt_long char opts[4]; strcpy(opts, "-pm"); char* argv[] = { "nandwrite", // program name opts, // options -p for pad and -m for mark bad blocks device, // device filename, // file to flash NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; if (!quiet) my_printf("Flashing kernel: nandwrite %s %s %s\n", opts, device, filename); if (!no_write) if (nandwrite_main(argc, argv) != 0) return 0; return 1; } int ubi_write(char* device, char* filename, int quiet, int no_write) { optind = 0; // reset getopt_long char* argv[] = { "ubiformat", // program name device, // device "-f", // flash file filename, // file to flash "-D", // no detach check NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; my_printf("Flashing rootfs: ubiformat %s -f %s\n", device, filename); if (!no_write) if (ubiformat_main(argc, argv) != 0) return 0; return 1; } int ubi_detach_dev(char* device, int quiet, int no_write) { optind = 0; // reset getopt_long char* argv[] = { "ubidetach", // program name "-p", // path to device device, // device NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; my_printf("Detach rootfs: ubidetach -p %s\n", device); if (!no_write) if (ubidetach_main(argc, argv) != 0) return 0; return 1; } int flashcp(char* device, char* filename, int reboot, int quiet, int no_write) { optind = 0; // reset getopt_long char opts[4]; if (reboot) strcpy(opts, "-vr\0"); else strcpy(opts, "-v\0"); char* argv[] = { "flashcp", // program name opts, // options -v verbose -r reboot immediately after flashing filename, // file to flash device, // device NULL }; int argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1; my_printf("Flashing rootfs: flashcp %s %s %s\n", opts, filename, device); if (!no_write) if (flashcp_main(argc, argv) != 0) return 0; return 1; } int flash_ubi_jffs2_kernel(char* device, char* filename, int quiet, int no_write) { int type = getFlashType(device); if (type == -1) return 0; if (type == MTD_NANDFLASH || type == MTD_MLCNANDFLASH) { my_printf("Found NAND flash\n"); // Erase set_step("Erasing kernel"); if (!flash_erase(device, "kernel", quiet, no_write)) { my_printf("Error erasing kernel! System might not boot. If you have problems please flash backup!\n"); return 0; } // Flash set_step("Writing kernel"); if (!flash_write(device, filename, quiet, no_write)) { my_printf("Error flashing kernel! System won't boot. Please flash backup!\n"); return 0; } } else if (type == MTD_NORFLASH) { my_printf("Found NOR flash\n"); if (!flashcp(device, filename, 0, quiet, no_write)) { my_printf("Error flashing kernel! System won't boot. Please flash backup!\n"); return 0; } } else { my_fprintf(stderr, "Flash type \"%d\" not supported\n", type); return 0; } return 1; } int flash_ubi_jffs2_rootfs(char* device, char* filename, enum RootfsTypeEnum rootfs_type, int quiet, int no_write) { int type = getFlashType(device); if (type == -1) return 0; if ((type == MTD_NANDFLASH || type == MTD_MLCNANDFLASH) && rootfs_type == UBIFS) { my_printf("Found NAND flash\n"); if (!ubi_write(device, filename, quiet, no_write)) return 0; } else if ((type == MTD_NANDFLASH || type == MTD_MLCNANDFLASH) && rootfs_type == JFFS2) { my_printf("Found NAND flash\n"); if (!flash_erase_jffs2(device, "rootfs", quiet, no_write)) return 0; if (!flash_write(device, filename, quiet, no_write)) return 0; } else if (type == MTD_NORFLASH && rootfs_type == JFFS2) { my_printf("Found NOR flash\n"); if (!flashcp(device, filename, 1, quiet, no_write)) return 0; } else { my_fprintf(stderr, "Flash type \"%d\" in combination with rootfs type %d is not supported\n", type, rootfs_type); return 0; } return 1; }
/* * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ #include "GraphicsPrimitiveMgr.h" #include "LoopMacros.h" /* * This file contains macro and type definitions used by the macros in * LoopMacros.h to manipulate a surface of type "AnyInt". */ typedef jint AnyIntDataType; #define AnyIntPixelStride 4 #define DeclareAnyIntLoadVars(PREFIX) #define DeclareAnyIntStoreVars(PREFIX) #define InitAnyIntLoadVars(PREFIX, pRasInfo) #define InitAnyIntStoreVarsY(PREFIX, pRasInfo) #define InitAnyIntStoreVarsX(PREFIX, pRasInfo) #define NextAnyIntStoreVarsX(PREFIX) #define NextAnyIntStoreVarsY(PREFIX) #define DeclareAnyIntPixelData(PREFIX) #define ExtractAnyIntPixelData(PIXEL, PREFIX) #define StoreAnyIntPixelData(pPix, x, pixel, PREFIX) \ (pPix)[x] = (pixel) #define CopyAnyIntPixelData(pSrc, sx, pDst, dx) \ (pDst)[dx] = (pSrc)[sx] #define XorCopyAnyIntPixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \ (pDst)[x] ^= (pSrc)[x] ^ (xorpixel) #define XorAnyIntPixelData(srcpixel, SRCPREFIX, pDst, x, \ xorpixel, XORPREFIX, mask, MASKPREFIX) \ (pDst)[x] ^= (((srcpixel) ^ (xorpixel)) & ~(mask)) DECLARE_ISOCOPY_BLIT(AnyInt); DECLARE_ISOSCALE_BLIT(AnyInt); DECLARE_ISOXOR_BLIT(AnyInt); DECLARE_CONVERT_BLIT(ByteIndexed, IntArgb); DECLARE_SCALE_BLIT(ByteIndexed, IntArgb); DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, IntArgb); DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, IntArgb); DECLARE_XPAR_BLITBG(ByteIndexedBm, IntArgb); #define REGISTER_ANYINT_ISOCOPY_BLIT(INTTYPE) \ REGISTER_ISOCOPY_BLIT(INTTYPE, AnyInt) #define REGISTER_ANYINT_ISOSCALE_BLIT(INTTYPE) \ REGISTER_ISOSCALE_BLIT(INTTYPE, AnyInt) #define REGISTER_ANYINT_ISOXOR_BLIT(INTTYPE) \ REGISTER_ISOXOR_BLIT(INTTYPE, AnyInt)
// // MessageTableItemSocial.h // Telegram // // Created by keepcoder on 03.11.14. // Copyright (c) 2014 keepcoder. All rights reserved. // #import "MessageTableItem.h" #import "YoutubeServiceDescription.h" #import "InstagramServiceDescription.h" @interface MessageTableItemSocial : MessageTableItem @property (nonatomic,strong,readonly) SocialServiceDescription *social; -(id)initWithObject:(id)object socialClass:(Class)socialClass; @end
#ifndef TH_OSSAUDIO_H #define TH_OSSAUDIO_H #include <sys/soundcard.h> #define DEFAULT_FREQ 44100 #define DEFAULT_FORMAT AFMT_U8 #define DEFAULT_CHANNELS 2 #define DEFAULT_SAMPLES 4096 #define BUF_SIZE 65536 #define BUF_REFILL_PERCENT 0.5 class thOSSAudio: public thAudio { public: thOSSAudio(char *null, const thAudioFmt *afmt) throw(thIOException); virtual ~thOSSAudio(); void Play (thAudio *audioPtr); // changed on 9/15/03 by brandon lewis // all thAudio classes will work with floating point buffers // converting to integer internally based on format data int Write (float *, int len); int Read (void *, int len); const thAudioFmt *GetFormat (void) { return &ofmt; }; void SetFormat (const thAudioFmt *fmt); bool ProcessEvents (void); private: int fd; thAudioFmt ofmt; // added second format structure on 9/15/03 // intended to store the actual format of the synth data thAudioFmt ifmt; void *outbuf; }; inline thOSSAudio *new_thOSSAudio(char *null, const thAudioFmt *afmt) { try { thOSSAudio *audio = new thOSSAudio(null, afmt); return audio; } catch (thIOException e) { fprintf(stderr, "thOSSAudio::thOSSAudio: %s\n", strerror(e)); } return NULL; } #endif /* TH_OSSAUDIO_H */
/* GStreamer * Copyright (C) 2005 Wim Taymans <wim@fluendo.com> * * gstalsasink.h: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __GST_ALSASINK_H__ #define __GST_ALSASINK_H__ #include <gst/gst.h> #include <gst/audio/audio.h> #include <alsa/asoundlib.h> G_BEGIN_DECLS #define GST_TYPE_ALSA_SINK (gst_alsasink_get_type()) #define GST_ALSA_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SINK,GstAlsaSink)) #define GST_ALSA_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SINK,GstAlsaSinkClass)) #define GST_IS_ALSA_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SINK)) #define GST_IS_ALSA_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SINK)) #define GST_ALSA_SINK_CAST(obj) ((GstAlsaSink *) (obj)) typedef struct _GstAlsaSink GstAlsaSink; typedef struct _GstAlsaSinkClass GstAlsaSinkClass; #define GST_ALSA_SINK_GET_LOCK(obj) (&GST_ALSA_SINK_CAST (obj)->alsa_lock) #define GST_ALSA_SINK_LOCK(obj) (g_mutex_lock (GST_ALSA_SINK_GET_LOCK (obj))) #define GST_ALSA_SINK_UNLOCK(obj) (g_mutex_unlock (GST_ALSA_SINK_GET_LOCK (obj))) #define GST_DELAY_SINK_GET_LOCK(obj) (&GST_ALSA_SINK_CAST (obj)->delay_lock) #define GST_DELAY_SINK_LOCK(obj) (g_mutex_lock (GST_DELAY_SINK_GET_LOCK (obj))) #define GST_DELAY_SINK_UNLOCK(obj) (g_mutex_unlock (GST_DELAY_SINK_GET_LOCK (obj))) /** * GstAlsaSink: * * Opaque data structure */ struct _GstAlsaSink { GstAudioSink sink; gchar *device; snd_pcm_t *handle; snd_pcm_access_t access; snd_pcm_format_t format; guint rate; guint channels; gint bpf; gboolean iec958; gboolean need_swap; guint buffer_time; guint period_time; snd_pcm_uframes_t buffer_size; snd_pcm_uframes_t period_size; GstCaps *cached_caps; GMutex alsa_lock; GMutex delay_lock; }; struct _GstAlsaSinkClass { GstAudioSinkClass parent_class; }; GType gst_alsasink_get_type(void); G_END_DECLS #endif /* __GST_ALSASINK_H__ */
// Simple class for communicating with a serial port. // Copyright (C) 2016 Kevin Somervill // // 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. // Filename: communication_manager.h // Author: Kevin Somervill <kevin@somervill.org> // Date: Thu Apr 9 15:07:52 EDT 2015 #ifndef COMM_MANAGER_H #define COMM_MANAGER_H #include<stdint.h> #include "serial_port.h" #ifndef INVALID_PORT #define INVALID_PORT -1 #endif //#define CM_APP_DEBUG 1 class communication_manager { private: serial_port * _sp; int _max_retries; public: communication_manager(); ~communication_manager(); int baudrate(); char * port_name(); bool open_session(const char* serialport, int baud); bool session_is_open(); void close_session(); int send(const uint8_t* buf, int len); int receive(uint8_t* buf, int len, bool dbg=false); int poll(uint8_t* buf, bool dbg=false); port_list get_available_ports(); }; #endif // !defined (COMM_MANAGER_H)
/* * This is part of openAHRS * * Copyright (c) by Carlos Becker http://github.com/cbecker * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <QFrame> #include "ui_glframe.h" class GLFrame : public QFrame { public: GLFrame( QWidget *parent = 0 ); //update, angles in radians void setPRY( double pitch, double roll, double yaw ); private: Ui_GLFrame ui; };
/* LAPD over datagram user-mode example. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <unistd.h> #include <arpa/inet.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/talloc.h> #include <osmocom/core/msgb.h> #include <osmocom/core/logging.h> #include <osmocom/core/application.h> #include <osmocom/core/select.h> #include <osmocom/abis/lapd.h> #include <osmocom/netif/datagram.h> static LLIST_HEAD(msg_sent_list); struct msg_sent { struct llist_head head; struct msgb *msg; int num; struct timeval tv; }; #define DLAPDTEST 0 struct log_info_cat lapd_test_cat[] = { [DLAPDTEST] = { .name = "DLAPDTEST", .description = "LAPD-mode test", .color = "\033[1;35m", .enabled = 1, .loglevel = LOGL_DEBUG, }, }; const struct log_info lapd_test_log_info = { .filter_fn = NULL, .cat = lapd_test_cat, .num_cat = ARRAY_SIZE(lapd_test_cat), }; static struct osmo_dgram *conn; static struct lapd_instance *lapd; static int sapi = 63, tei = 0; void sighandler(int foo) { lapd_sap_stop(lapd, tei, sapi); lapd_instance_free(lapd); LOGP(DLINP, LOGL_NOTICE, "closing LAPD.\n"); exit(EXIT_SUCCESS); } static int read_cb(struct osmo_dgram *conn) { int error; struct msgb *msg; msg = msgb_alloc(1200, "LAPD/test"); if (msg == NULL) { LOGP(DLAPDTEST, LOGL_ERROR, "cannot allocate message\n"); return -1; } if (osmo_dgram_recv(conn, msg) < 0) { msgb_free(msg); LOGP(DLAPDTEST, LOGL_ERROR, "cannot receive message\n"); return -1; } if (lapd_receive(lapd, msg, &error) < 0) { msgb_free(msg); LOGP(DLINP, LOGL_ERROR, "lapd_receive returned error!\n"); return -1; } return 0; } static void *tall_test; void lapd_tx_cb(struct msgb *msg, void *cbdata) { LOGP(DLINP, LOGL_DEBUG, "sending message over datagram\n"); osmo_dgram_send(conn, msg); } void lapd_rx_cb(struct osmo_dlsap_prim *dp, uint8_t tei, uint8_t sapi, void *rx_cbdata) { struct msgb *msg = dp->oph.msg; int *__msgs = rx_cbdata; int num_msgs = *__msgs; switch (dp->oph.primitive) { case PRIM_DL_EST: DEBUGP(DLAPDTEST, "DL_EST: sapi(%d) tei(%d)\n", sapi, tei); int i; for (i=0; i<num_msgs; i++) { struct msgb *msg; struct msg_sent *msg_sent; char *ptr; int x; msg = msgb_alloc(1024, "LAPD/test"); if (msg == NULL) { LOGP(DLINP, LOGL_ERROR, "cannot alloc msg\n"); return; } ptr = (char *)msgb_put(msg, sizeof(int)); x = htonl(i); memcpy(ptr, &x, sizeof(int)); msg_sent = talloc_zero(NULL, struct msg_sent); if (msg_sent == NULL) { LOGP(DLINP, LOGL_ERROR, "can't alloc struct\n"); return; } msg_sent->msg = msg; gettimeofday(&msg_sent->tv, NULL); msg_sent->num = i; llist_add(&msg_sent->head, &msg_sent_list); lapd_transmit(lapd, tei, sapi, msg); LOGP(DLAPDTEST, LOGL_DEBUG, "enqueueing msg %d of " "%d bytes to be sent over LAPD\n", i, msg->len); } break; case PRIM_DL_REL: DEBUGP(DLAPDTEST, "DL_REL: sapi(%d) tei(%d)\n", sapi, tei); break; case PRIM_DL_DATA: case PRIM_DL_UNIT_DATA: if (dp->oph.operation == PRIM_OP_INDICATION) { msg->l2h = msg->l3h; DEBUGP(DLAPDTEST, "RX: %s sapi=%d tei=%d\n", osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)), sapi, tei); int num; struct msg_sent *cur, *tmp, *found = NULL; num = ntohl(*((int *)msg->data)); LOGP(DLINP, LOGL_DEBUG, "received msg number %d\n", num); llist_for_each_entry_safe(cur, tmp, &msg_sent_list, head) { if (cur->num == num) { llist_del(&cur->head); found = cur; break; } } if (found) { struct timeval tv, diff; gettimeofday(&tv, NULL); timersub(&tv, &found->tv, &diff); LOGP(DLINP, LOGL_NOTICE, "message %d replied " "in %lu.%.6lu\n", num, diff.tv_sec, diff.tv_usec); talloc_free(found); } else { LOGP(DLINP, LOGL_ERROR, "message %d not found!\n", num); } } break; case PRIM_MDL_ERROR: DEBUGP(DLMI, "MDL_EERROR: cause(%d)\n", dp->u.error_ind.cause); break; default: printf("ERROR: unknown prim\n"); break; } } int main(int argc, char *argv[]) { int num_msgs; signal(SIGINT, sighandler); if (argc != 2) { printf("Usage: %s [num_msgs]\n", argv[0]); exit(EXIT_FAILURE); } num_msgs = atoi(argv[1]); tall_test = talloc_named_const(NULL, 1, "lapd_test"); msgb_talloc_ctx_init(tall_test, 0); osmo_init_logging2(tall_test, &lapd_test_log_info); log_set_log_level(osmo_stderr_target, LOGL_NOTICE); /* * initialize LAPD stuff. */ lapd = lapd_instance_alloc(0, lapd_tx_cb, NULL, lapd_rx_cb, &num_msgs, &lapd_profile_sat); if (lapd == NULL) { LOGP(DLINP, LOGL_ERROR, "cannot allocate instance\n"); exit(EXIT_FAILURE); } /* * initialize datagram socket. */ conn = osmo_dgram_create(tall_test); if (conn == NULL) { fprintf(stderr, "cannot create client\n"); exit(EXIT_FAILURE); } osmo_dgram_set_local_addr(conn, "127.0.0.1"); osmo_dgram_set_local_port(conn, 10000); osmo_dgram_set_remote_addr(conn, "127.0.0.1"); osmo_dgram_set_remote_port(conn, 10001); osmo_dgram_set_read_cb(conn, read_cb); if (osmo_dgram_open(conn) < 0) { fprintf(stderr, "cannot open client\n"); exit(EXIT_FAILURE); } if (lapd_sap_start(lapd, tei, sapi) < 0) { LOGP(DLINP, LOGL_ERROR, "cannot start user-side LAPD\n"); exit(EXIT_FAILURE); } LOGP(DLINP, LOGL_NOTICE, "Entering main loop\n"); while(1) { osmo_select_main(0); } }
/*************************************************************************** * Copyright (C) 2010 by Xavier Lefage * * xavier.kwooty@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef SYSTRAYLEGACY_H #define SYSTRAYLEGACY_H #include <QObject> #include <KSystemTrayIcon> #include "utilities/utility.h" using namespace UtilityNamespace; class QueueFileObserver; class ClientsObserver; class StatsInfoBuilder; class MainWindow; class SysTray : public KSystemTrayIcon { Q_OBJECT public: SysTray(MainWindow*); ~SysTray(); private: MainWindow* parent; QueueFileObserver* queueFileObserver; ClientsObserver* clientsObserver; StatsInfoBuilder* statsInfoBuilder; QPixmap normalBaseIcon; QPixmap grayedBaseIcon; QPixmap renderedIcon; int oldMergePos; bool displayToolTip; bool blendOverlay(const QPixmap&); bool updateIconStatus(const UtilityNamespace::ItemStatus&); void setupConnections(); void setupActions(); void initPixmaps(); void initShow(); void updateIconProgress(const int&); void createToolTip(); signals: public slots: void progressUpdateSlot(const int); void statusUpdateSlot(const UtilityNamespace::ItemStatus); void updateDownloadSpeedInfoSlot(); void updateConnectionStatusSlot(); private slots: void menuAboutToHideSlot(); void menuAboutToShowSlot(); }; #endif // SYSTRAYLEGACY_H
#pragma once #include "Cute/Foundation.h" #include "Cute/Timestamp.h" CUTE_NS_BEGIN enum LogLevel { LOG_LEVEL_FATAL = 1, LOG_LEVEL_CRITICAL, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_NOTICE, LOG_LEVEL_INFORMATION, LOG_LEVEL_DEBUG, LOG_LEVEL_TRACE, LOG_LEVEL_MAX, }; struct CUTE_CORE_API LogMessage { public: LogMessage(); LogMessage(const String& source, const String& text, LogLevel level); LogMessage(const String& source, const String& text, LogLevel level, const char* file, int line); LogMessage(const LogMessage& other); ~LogMessage(); LogMessage& operator = (const LogMessage& msg); void swap(LogMessage& msg); void setSource(const String& src); void setText(const String& text); void setThread(const String& name); void setTime(const Timestamp& time); void setLevel(LogLevel level); void setTid(int tid); void setPid(long pid); void setFile(const char* file); void setLine(int line); void setMessage(const String& msg) const; const String& getMessage() const; const String& getSource() const; const String& getText() const; const String& getThread() const; const Timestamp& getTime() const; LogLevel getLevel() const; int getTid() const; long getPid() const; const char* getFile() const; int getLine() const; protected: void init(); private: String m_source; String m_text; String m_thread; LogLevel m_level; Timestamp m_time; int m_tid; long m_pid; const char* m_file; int m_line; mutable String m_message; // 最终序列化后的数据 }; // inlines inline void LogMessage::setSource(const String& src) { m_source = src; } inline void LogMessage::setText(const String& text) { m_text = text; } inline void LogMessage::setThread(const String& name) { m_thread = name; } inline void LogMessage::setLevel(LogLevel level) { m_level = level; } inline void LogMessage::setTime(const Timestamp& time) { m_time = time; } inline void LogMessage::setTid(int tid) { m_tid = tid; } inline void LogMessage::setPid(long pid) { m_pid = pid; } inline void LogMessage::setFile(const char* file) { m_file = file; } inline void LogMessage::setLine(int line) { m_line = line; } inline const String& LogMessage::getSource() const { return m_source; } inline const String& LogMessage::getText() const { return m_text; } inline const String& LogMessage::getThread() const { return m_thread; } inline LogLevel LogMessage::getLevel() const { return m_level; } inline const Timestamp& LogMessage::getTime() const { return m_time; } inline int LogMessage::getTid() const { return m_tid; } inline long LogMessage::getPid() const { return m_pid; } inline const char* LogMessage::getFile() const { return m_file; } inline int LogMessage::getLine() const { return m_line; } inline void LogMessage::setMessage(const String& msg) const { m_message = msg; } inline const String& LogMessage::getMessage() const { return m_message.empty() ? m_text : m_message; } CUTE_NS_END
#ifndef MERRORS_H #define MERRORS_H #define ERR -1 #define MEMERR -2 #define CONERR -3 #endif
/* * * $Id: pvrusb2-tuner.c,v 1.1.1.1 2010/03/11 21:07:26 kris Exp $ * * Copyright (C) 2005 Mike Isely <isely@pobox.com> * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "pvrusb2.h" #include "pvrusb2-util.h" #include "pvrusb2-tuner.h" #include "pvrusb2-hdw-internal.h" #include "pvrusb2-debug.h" #include <linux/videodev2.h> #include <media/tuner.h> #include <media/v4l2-common.h> struct pvr2_tuner_handler { struct pvr2_hdw *hdw; struct pvr2_i2c_client *client; struct pvr2_i2c_handler i2c_handler; int type_update_fl; }; static void set_type(struct pvr2_tuner_handler *ctxt) { struct pvr2_hdw *hdw = ctxt->hdw; struct tuner_setup setup; pvr2_trace(PVR2_TRACE_CHIPS,"i2c tuner set_type(%d)",hdw->tuner_type); if (((int)(hdw->tuner_type)) < 0) return; setup.addr = ADDR_UNSET; setup.type = hdw->tuner_type; setup.mode_mask = T_RADIO | T_ANALOG_TV; /* We may really want mode_mask to be T_ANALOG_TV for now */ pvr2_i2c_client_cmd(ctxt->client,TUNER_SET_TYPE_ADDR,&setup); ctxt->type_update_fl = 0; } static int tuner_check(struct pvr2_tuner_handler *ctxt) { struct pvr2_hdw *hdw = ctxt->hdw; if (hdw->tuner_updated) ctxt->type_update_fl = !0; return ctxt->type_update_fl != 0; } static void tuner_update(struct pvr2_tuner_handler *ctxt) { if (ctxt->type_update_fl) set_type(ctxt); } static void pvr2_tuner_detach(struct pvr2_tuner_handler *ctxt) { ctxt->client->handler = NULL; kfree(ctxt); } static unsigned int pvr2_tuner_describe(struct pvr2_tuner_handler *ctxt,char *buf,unsigned int cnt) { return scnprintf(buf,cnt,"handler: pvrusb2-tuner"); } static const struct pvr2_i2c_handler_functions tuner_funcs = { .detach = (void (*)(void *))pvr2_tuner_detach, .check = (int (*)(void *))tuner_check, .update = (void (*)(void *))tuner_update, .describe = (unsigned int (*)(void *,char *,unsigned int))pvr2_tuner_describe, }; int pvr2_i2c_tuner_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) { struct pvr2_tuner_handler *ctxt; if (cp->handler) return 0; ctxt = kzalloc(sizeof(*ctxt),GFP_KERNEL); if (!ctxt) return 0; ctxt->i2c_handler.func_data = ctxt; ctxt->i2c_handler.func_table = &tuner_funcs; ctxt->type_update_fl = !0; ctxt->client = cp; ctxt->hdw = hdw; cp->handler = &ctxt->i2c_handler; pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x tuner handler set up", cp->client->addr); return !0; } /* Stuff for Emacs to see, in order to encourage consistent editing style: *** Local Variables: *** *** mode: c *** *** fill-column: 70 *** *** tab-width: 8 *** *** c-basic-offset: 8 *** *** End: *** */
/* * Copyright © 2009 Jonny Lamb <jonny@debian.org> * * based on the Python extension by Stefan Stuhr: * Copyright (C) 2006 Stefan Stuhr * * 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. */ #ifndef EPHY_CONFIRMWINDOWCLOSE_EXTENSION_H #define EPHY_CONFIRMWINDOWCLOSE_EXTENSION_H #include <glib.h> #include <glib-object.h> G_BEGIN_DECLS #define EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION \ (ephy_confirmwindowclose_extension_get_type ()) #define EPHY_CONFIRMWINDOWCLOSE_EXTENSION(o) \ (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION, \ EphyConfirmwindowcloseExtension)) #define EPHY_CONFIRMWINDOWCLOSE_EXTENSION_CLASS(k) \ (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION, \ EphyConfirmwindowcloseExtensionClass)) #define EPHY_IS_CONFIRMWINDOWCLOSE_EXTENSION(o) \ (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION)) #define EPHY_IS_CONFIRMWINDOWCLOSE_EXTENSION_CLASS(k) \ (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION)) #define EPHY_CONFIRMWINDOWCLOSE_EXTENSION_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_CONFIRMWINDOWCLOSE_EXTENSION, \ EphyConfirmwindowcloseExtensionClass)) typedef struct _EphyConfirmwindowcloseExtension EphyConfirmwindowcloseExtension; typedef struct _EphyConfirmwindowcloseExtensionClass EphyConfirmwindowcloseExtensionClass; typedef struct _EphyConfirmwindowcloseExtensionPrivate EphyConfirmwindowcloseExtensionPrivate; struct _EphyConfirmwindowcloseExtensionClass { GObjectClass parent_class; }; struct _EphyConfirmwindowcloseExtension { GObject parent_instance; /*< private >*/ EphyConfirmwindowcloseExtensionPrivate *priv; }; GType ephy_confirmwindowclose_extension_get_type (void); GType ephy_confirmwindowclose_extension_register_type (GTypeModule *module); G_END_DECLS #endif
#ifndef _BZOS_TYPE_H_ #define _BZOS_TYPE_H_ typedef unsigned long long u64; typedef unsigned int u32; typedef unsigned short u16; typedef unsigned char u8; typedef void (*irq_handler)(int irq); typedef void (*int_handler)(); typedef void (*task_f)(); typedef void* system_call; typedef char* va_list; /* mesaage mechanism borrowed from MINIX */ struct mess1{ int m1i1; int m1i2; int m1i3; int m1i4; }; struct mess2{ void* m2p1; void* m2p2; void* m2p3; void* m2p4; }; struct mess3{ int m3i1; int m3i2; int m3i3; int m3i4; u64 m3l1; u64 m3l2; void* m3p1; void* m3p2; }; typedef struct{ int source; /* who sends this message */ int type; union{ struct mess1 m1; struct mess2 m2; struct mess3 m3; /* @see include/const.h RETVAL == u.m3.m3i1 */ } u; } MESSAGE; /* */ struct boot_params{ int mem_size; /* memory size */ u8* kernel_file; /* addr of kernel file */ }; #endif
/* * Copyright (c) 2003, Brent Fulgham <bfulgham@debian.org> * * This source code is released for free distribution under the terms of the * GNU General Public License version 2 or (at your option) any later version. * * This module contains functions for generating tags for Erlang language * files. Some of the parsing constructs are based on the Emacs 'etags' * program by Francesco Potori <pot@gnu.org> */ /* * INCLUDE FILES */ #include "general.h" /* must always come first */ #include <string.h> #include "entry.h" #include "options.h" #include "read.h" #include "routines.h" #include "vstring.h" /* * DATA DEFINITIONS */ typedef enum { K_MACRO, K_FUNCTION, K_MODULE, K_RECORD, K_TYPE } erlangKind; static kindOption ErlangKinds[] = { {TRUE, 'd', "macro", "macro definitions"}, {TRUE, 'f', "function", "functions"}, {TRUE, 'm', "module", "modules"}, {TRUE, 'r', "record", "record definitions"}, {TRUE, 't', "type", "type definitions"}, }; /* * FUNCTION DEFINITIONS */ /* tagEntryInfo and vString should be preinitialized/preallocated but not * necessary. If successful you will find class name in vString */ static boolean isIdentifierFirstCharacter (int c) { return (boolean) (isalpha (c)); } static boolean isIdentifierCharacter (int c) { return (boolean) (isalnum (c) || c == '_' || c == ':'); } static const unsigned char *skipSpace (const unsigned char *cp) { while (isspace ((int) *cp)) ++cp; return cp; } static const unsigned char *parseIdentifier ( const unsigned char *cp, vString *const identifier) { vStringClear (identifier); while (isIdentifierCharacter ((int) *cp)) { vStringPut (identifier, (int) *cp); ++cp; } vStringTerminate (identifier); return cp; } static void makeMemberTag ( vString *const identifier, erlangKind kind, vString *const module) { if (ErlangKinds [kind].enabled && vStringLength (identifier) > 0) { tagEntryInfo tag; initTagEntry (&tag, vStringValue (identifier), & (ErlangKinds[kind])); if (module != NULL && vStringLength (module) > 0) { tag.extensionFields.scopeKind = &(ErlangKinds [K_MODULE]); tag.extensionFields.scopeName = vStringValue (module); } makeTagEntry (&tag); } } static void parseModuleTag (const unsigned char *cp, vString *const module) { vString *const identifier = vStringNew (); parseIdentifier (cp, identifier); makeSimpleTag (identifier, ErlangKinds, K_MODULE); /* All further entries go in the new module */ vStringCopy (module, identifier); vStringDelete (identifier); } static void parseSimpleTag (const unsigned char *cp, erlangKind kind) { vString *const identifier = vStringNew (); parseIdentifier (cp, identifier); makeSimpleTag (identifier, ErlangKinds, kind); vStringDelete (identifier); } static void parseFunctionTag (const unsigned char *cp, vString *const module) { vString *const identifier = vStringNew (); parseIdentifier (cp, identifier); makeMemberTag (identifier, K_FUNCTION, module); vStringDelete (identifier); } /* * Directives are of the form: * -module(foo) * -define(foo, bar) * -record(graph, {vtab = notable, cyclic = true}). * -type some_type() :: any(). * -opaque some_opaque_type() :: any(). */ static void parseDirective (const unsigned char *cp, vString *const module) { /* * A directive will be either a record definition or a directive. * Record definitions are handled separately */ vString *const directive = vStringNew (); const char *const drtv = vStringValue (directive); cp = parseIdentifier (cp, directive); cp = skipSpace (cp); if (*cp == '(') ++cp; if (strcmp (drtv, "record") == 0) parseSimpleTag (cp, K_RECORD); else if (strcmp (drtv, "define") == 0) parseSimpleTag (cp, K_MACRO); else if (strcmp (drtv, "type") == 0) parseSimpleTag (cp, K_TYPE); else if (strcmp (drtv, "opaque") == 0) parseSimpleTag (cp, K_TYPE); else if (strcmp (drtv, "module") == 0) parseModuleTag (cp, module); /* Otherwise, it was an import, export, etc. */ vStringDelete (directive); } static void findErlangTags (void) { vString *const module = vStringNew (); const unsigned char *line; while ((line = fileReadLine ()) != NULL) { const unsigned char *cp = line; if (*cp == '%') /* skip initial comment */ continue; if (*cp == '"') /* strings sometimes start in column one */ continue; if ( *cp == '-') { ++cp; /* Move off of the '-' */ parseDirective(cp, module); } else if (isIdentifierFirstCharacter ((int) *cp)) parseFunctionTag (cp, module); } vStringDelete (module); } extern parserDefinition *ErlangParser (void) { static const char *const extensions[] = { "erl", "ERL", "hrl", "HRL", NULL }; parserDefinition *def = parserNew ("Erlang"); def->kinds = ErlangKinds; def->kindCount = COUNT_ARRAY (ErlangKinds); def->extensions = extensions; def->parser = findErlangTags; return def; } /* vi:set tabstop=4 shiftwidth=4: */
/* =========================================================================== blockattack - Block Attack - Rise of the Blocks Copyright (C) 2005-2012 Poul Sander 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/ Source information and contacts persons can be found at https://blockattack.net =========================================================================== */ /* *This is the common.h *It contains some basic functions that nearly all multi platform games are going *to need. */ #ifndef _COMMON_H #define _COMMON_H #include <string> #include <iostream> #include <map> #include <stdlib.h> #include <libintl.h> #include <ctime> #define _(String) gettext (String) struct commonTime { unsigned int days = 0; unsigned int hours = 0; unsigned int minutes = 0; unsigned int seconds = 0; }; bool strequals(const char* a, const char* b); /** * str2int parses a string and returns an int with the value of the string. * if the string is not an int then 0 is returned instead of throwing an error * in that way this function will always return a usable value. */ int str2int(const std::string &str2parse) __attribute__((const)); void dieOnNullptr(bool, const char* msg); /** * str2double parses a string and returns a double with the value of the string. * if the string is not a double then 0.0 is returned instead of throwing an error * in that way this function will always return a usable value. */ double str2double(const std::string &str2parse) __attribute__((const)); class TimeHandler { public: static commonTime ms2ct(unsigned int milliseconds); static commonTime getTime(const std::string &name); static commonTime peekTime(const std::string &name, const commonTime &toAdd); static commonTime addTime(const std::string &name, const commonTime &toAdd); }; #define MAX_VAR_LENGTH 1024 /*This is the Config class it is a map to hold config variables. *It is inspired by Quake 3's CVAR system although a lot simpler. *All variables have keys "varName" that is used to access a variable. * *This class is a singleton */ class Config { private: std::map<std::string, std::string> configMap; static Config *instance; void load(); /* tells if the user has requested a shutdown */ long shuttingDown = 0; Config(); public: /*Config is a singleton. *It is accessed like this: *Config::getInstance()->method2call(parameters); */ static Config* getInstance(); /*save() *forces the config to be written to disk. This will also happened if the *program terminates normally. */ void save(); /*getString(varName) *Looks in the config file and returns the string that matches the key "varName" *Returns an empty string if varName does not exist. */ std::string getString(const std::string &varName); /*getInt(varName) *Looks in the config file and returns the int that matches the key "varName" *Returns "0" if varName does not exist or cannot be parsed. */ int getInt(const std::string &varName); /*getValue(varName) *Looks in the config file and returns the double that matches the key "varName" *Returns "0.0" if varName does not exist or cannot be parsed. */ double getValue(const std::string &varName); /*setString(varName,content) *Sets the config variable with key "varName" to the value of "content" */ void setString(const std::string &varName, const std::string &content); /*setInt(varName,content) *Sets the config variable with key "varName" to the value of "content" */ void setInt(const std::string &varName, int content); /** * Sets a config variable to a given (double) value * @param varName Name of the variable to set * @param content Value to give the variable */ void setValue(const std::string &varName,double content); /** * returns true if the key varName exists. This is used the first time 1.4.0 * starts so that it can see that it has to import configs from an earlier * version. * @param varName Name of the variable * @return true if the variable exists */ bool exists(const std::string &varName) const; /*setDefault(varName,value) *if the variable "varName" does not exist it will be created with value "value" *if varName exists then this will have no effect */ /** * Set default value for a variable. If the variable "varName" does not exist it will be created with value "value" * if varName exists then this will have no effect * @param varName Name of the variable * @param content The default value */ void setDefault(const std::string &varName, const std::string &content); /** * Should be set if the user has requested the program to shutdown. * @param shuttingDown value of shutdown command. 5 = default = shutdown but allow saving */ void setShuttingDown(long shuttingDown = 5); /** * tells if the user wants to shutdown. This can be used if the exit button is pressed deeply in the program. * @return */ long isShuttingDown() const; }; #endif /* _COMMON_H */
#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #include <netpacket/packet.h> int main (void) { return 0; }
#ifndef FILEDIALOG_H #define FILEDIALOG_H #include <QDialog> namespace Ui { class FileDialog; } class FileDialog : public QDialog { Q_OBJECT public: explicit FileDialog(QWidget *parent = 0); explicit FileDialog(QString str, QWidget *parent = 0); ~FileDialog(); bool hasAccepted; QString address(); private slots: void on_buttonBox_rejected(); void on_buttonBox_accepted(); private: Ui::FileDialog *ui; }; #endif // FILEDIALOG_H
/* * * Author: Sylvain Afchain <safchain@gmail.com>, (C) 2008 - 2013 * * Copyright: See COPYING file that comes with this distribution * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <stropts.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <linux/netdevice.h> #include <arpa/inet.h> #include <netinet/in.h> #include <unistd.h> #include <types.h> #include <mm.h> #include <hl.h> #include <misc.h> #include <xml.h> #include <log.h> #include "rdb.h" #include "options.h" static char *curr_addr = NULL; static uint16_t curr_port = 53; static int _add_addr (LIST *addrs) { struct rdb_addr_s *addr; if ((addr = (struct rdb_addr_s *) malloc (sizeof(struct rdb_addr_s))) == NULL) return -1; addr->addr = curr_addr; addr->port = curr_port; if (hl_list_push(addrs, &addr, sizeof (struct rdb_addr_s *)) == -1) return -1; return 0; } static int _add_all_addr (LIST *addrs) { char ip[INET_ADDRSTRLEN]; struct ifconf ifconf; struct ifreq ifr[50]; struct sockaddr_in *s_in; int ifs, sock, i; ifconf.ifc_buf = (char *) ifr; ifconf.ifc_len = sizeof ifr; if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) return -1; if (ioctl(sock, SIOCGIFCONF, &ifconf) == -1) return -1; ifs = ifconf.ifc_len / sizeof(ifr[0]); for (i = 0; i < ifs; i++) { s_in = (struct sockaddr_in *) &ifr[i].ifr_addr; if (!inet_ntop(AF_INET, &s_in->sin_addr, ip, sizeof(ip))) { LOG_ERR("unable to get address of %s", ifr[i].ifr_name); return -1; } curr_addr = strdup(ip); if (_add_addr (addrs) == -1) { LOG_ERR("unable to add address of %s to listener interfaces", ifr[i].ifr_name); return -1; } } return 0; } static int _tag_attr(char *tagname, char *attrname, char *attrvalue, XML_CONFIG *config) { struct rdb_options_s *options = ((RDB *) config->backptr)->options; if (strcasecmp(config->xpath, "/nnodes/options/listen") == 0) { if (strcasecmp(attrname, "port") == 0 && attrvalue) { curr_port = atoi(attrvalue); } else if (strcasecmp(attrname, "addr") == 0 && attrvalue) { curr_addr = strdup(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/user") == 0) { if (strcasecmp(attrname, "uid") == 0 && attrvalue) { options->uid = atoi(attrvalue); } else if (strcasecmp(attrname, "gid") == 0 && attrvalue) { options->gid = atoi(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/pid") == 0) { if (strcasecmp(attrname, "file") == 0 && attrvalue) { options->pid = strdup(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/threads") == 0) { if (strcasecmp(attrname, "value") == 0 && attrvalue) { options->nthreads = atoi(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/log") == 0) { if (strcasecmp(attrname, "file") == 0 && attrvalue) { options->log_file = strdup(attrvalue); } else if (strcasecmp(attrname, "level") == 0 && attrvalue) { options->log_level = atoi(attrvalue); } else if (strcasecmp(attrname, "maxfile") == 0 && attrvalue) { options->log_maxfile = atoi(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/websrv") == 0) { if (strcasecmp(attrname, "xslt") == 0 && attrvalue) { options->websrv_xslt = strdup(attrvalue); } else if (strcasecmp(attrname, "port") == 0 && attrvalue) { options->websrv_port = atoi(attrvalue); } } else if (strcasecmp(config->xpath, "/nnodes/options/geoip") == 0) { #ifdef HAVE_GEOIP if (strcasecmp(attrname, "database") == 0 && attrvalue) { if ((options->gi = GeoIP_open(attrvalue, GEOIP_MEMORY_CACHE)) == NULL) { LOG_ERR("error opening database %s", attrvalue); return -1; } } #else LOG_WARN ("%s\n", "not compiled with geoip"); #endif } return 0; } static int _tag_open(char *tagname, XML_CONFIG *config) { RDB *rdb = (RDB *) config->backptr; if (strcasecmp(config->xpath, "/nnodes/options") == 0) { if ((rdb->options = calloc(1, sizeof (struct rdb_options_s))) == NULL) return -1; } return 0; } static int _tag_close(char *tagname, XML_CONFIG *config) { RDB *rdb = (RDB *) config->backptr; if (strcasecmp(config->xpath, "/nnodes/options/listen") == 0) { if (curr_addr) { if (! rdb->options->addrs) if((rdb->options->addrs = hl_list_alloc ()) == NULL) return -1; if (strcmp(curr_addr, "0.0.0.0") == 0) _add_all_addr(rdb->options->addrs); else _add_addr (rdb->options->addrs); } curr_addr = NULL; curr_port = 53; } return 0; } void rdb_options_add_xc(HCODE *xch) { XML_CALLBACKS xc; memset(&xc, 0, sizeof(xc)); xc.on_tag_attr = _tag_attr; xc.on_tag_open = _tag_open; xc.on_tag_close = _tag_close; hl_hash_put(xch, "/nnodes/options", &xc, sizeof(XML_CALLBACKS)); }
/* * * Copyright (c) International Business Machines Corp., 2001 * * 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 */ /* * NAME * creat04.c * * DESCRIPTION * testcase to check creat(2) fails with EACCES * * ALGORITHM * 1. A parent spawns a child, which creates a test-directory, and * makes it 700. Then the parent spawns another child, does a * setreuid to ltpuser1, and attempts to creat() a file (which * does not exist) in the directory created by the first child. * 2. Repeat 1, for a file (to be created by ltpuser1) which exists. * That is the first child should creat() a file before exiting. * * USAGE: <for command-line> * creat04 [-c n] [-e] [-i n] [-I x] [-P x] [-t] * where, -c n : Run n copies concurrently. * -e : Turn on errno logging. * -i n : Execute test n times. * -I x : Execute test for x seconds. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * HISTORY * 07/2001 Ported by Wayne Boyer * * RESTRICTIONS * Test must be run as root. */ #include <stdio.h> #include <errno.h> #include <fcntl.h> #include <pwd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include "test.h" #include "usctest.h" char *TCID = "creat04"; int TST_TOTAL = 2; void setup(void); void cleanup(void); #define FMODE 0444 #define DMODE 00700 int exp_enos[] = { EACCES, 0 }; char user1name[] = "nobody"; char good_dir[40] = "testdir"; char fname[40], fname1[40]; extern struct passwd *my_getpwnam(char *); struct passwd *ltpuser1; struct test_case_t { char *fname; } TC[] = { { fname}, { fname1} }; int main(int ac, char **av) { int lc; /* loop counter */ int retval = 0; char *msg; /* message returned from parse_opts */ pid_t pid, pid1; int i, status, fd; /* parse standard options */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); TEST_EXP_ENOS(exp_enos); for (lc = 0; TEST_LOOPING(lc); lc++) { /* reset Tst_count in case we are looping */ Tst_count = 0; if ((pid = FORK_OR_VFORK()) == -1) { tst_brkm(TBROK|TERRNO, cleanup, "fork() #1 failed"); } if (pid == 0) { /* first child */ if (mkdir(good_dir, DMODE) != 0) { perror("mkdir() failed"); exit(1); } if ((fd = open(fname1, O_RDWR | O_CREAT, 0444)) == -1) { perror("open failed"); exit(1); } exit(0); } wait(&status); /* make sure the child returned a good exit status */ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { tst_brkm(TBROK, cleanup, "child #1 failed"); } if ((pid1 = FORK_OR_VFORK()) == -1) { tst_brkm(TBROK|TERRNO, cleanup, "fork() #2 failed"); } if (pid1 == 0) { /* second child */ ltpuser1 = my_getpwnam(user1name); if (ltpuser1 == NULL) { perror("getpwnam"); exit(1); } if (seteuid(ltpuser1->pw_uid) == -1) { perror("seteuid"); exit(1); } /* loop through the test cases */ for (i = 0; i < TST_TOTAL; i++) { TEST(creat(TC[i].fname, FMODE)); if (TEST_RETURN != -1) { retval = 1; tst_resm(TFAIL, "call succeeded " "unexpectedly"); continue; } TEST_ERROR_LOG(TEST_ERRNO); if (TEST_ERRNO != EACCES) { retval = 1; tst_resm(TFAIL|TTERRNO, "Expected EACCES"); } else { tst_resm(TPASS, "call failed with " "EACCES as expected"); } } seteuid(0); /* clean up things in case we are looping */ unlink(fname); unlink(fname1); rmdir(good_dir); exit(retval); } else { /* parent */ /* wait for the child to finish */ wait(&status); /* make sure the child returned a good exit status */ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { tst_resm(TFAIL, "see failures reported above"); } } } cleanup(); tst_exit(); } /* * setup() - performs all ONE TIME setup for this test. */ void setup() { tst_require_root(NULL); tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* make a temporary directory and cd to it */ tst_tmpdir(); sprintf(good_dir, "%s.%d", good_dir, getpid()); sprintf(fname1, "%s/file1.%d", good_dir, getpid()); sprintf(fname, "%s/file.%d", good_dir, getpid()); } /* * cleanup() - performs all ONE TIME cleanup for this test at * completion or premature exit. */ void cleanup() { /* * print timing stats if that option was specified. * print errno log if that option was specified. */ TEST_CLEANUP; /* delete the test directory created in setup() */ tst_rmdir(); }
/* * Copyright (C) 2011-2015 severalnines.com */ #pragma once #include <map> #include <vector> #include <string> #include "S9sGlobal" #include "S9sString" #include "S9sVector" template <typename Key, typename T> class S9sMap : public std::map<Key, T> { public: bool contains(const Key &key) const; S9sVector<Key> keys() const; #if 0 static S9sMap<Key, T> fromVector(const std::vector<Key> &theVector); static S9sMap<Key, T> fromVector(const CmonStringList &theVector); #endif }; /** * \returns true if the map contains an element with the given key * * One can't be careful enough with checking the maps for keys. The [] * operator would add a new element created by the default constructor, so it is * not very good for testing if the key can be found. A simple way to check this * is to use this contains() method. So instead of <code> if (!v[key].isNull()) v[key].something(); </code> * use this <code> if (v.contains(key)) v[key].something(); </code> */ template <typename Key, typename T> inline bool S9sMap<Key, T>::contains( const Key &key) const { return this->find(key) != this->end(); } /** * \returns a list that holds all the keys from the map */ template <typename Key, typename T> S9sVector<Key> S9sMap<Key, T>::keys() const { S9sVector<Key> retval; for (typename std::map<Key, T>::const_iterator it = this->begin(); it != this->end(); ++it) { retval.push_back(it->first); } return retval; } #if 0 /** * Handy little method to convert a vector to a map. use like this: <code> std::vector<string> theList; S9sMap<std::string, bool> theMap; ... theMap = S9sMap<std::string, bool>::fromVector(theList); </code> */ template <typename Key, typename T> S9sMap<Key, T> S9sMap<Key, T>::fromVector( const std::vector<Key> &theVector) { S9sMap<Key, T> retval; for (uint idx = 0; idx < theVector.size(); ++idx) retval[theVector[idx]] = T(); return retval; } #endif #if 0 template <typename Key, typename T> S9sMap<Key, T> S9sMap<Key, T>::fromVector( const S9sStringList &theVector) { S9sMap<Key, T> retval; for (uint idx = 0; idx < theVector.size(); ++idx) retval[theVector[idx]] = T(); return retval; } #endif
/* ResidualVM - A 3D game interpreter * * ResidualVM 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 library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * */ #ifndef GRIM_MODEL_COMPONENT_H #define GRIM_MODEL_COMPONENT_H #include "engines/grim/costume/component.h" namespace Grim { class Model; class AnimManager; class ModelComponent : public Component { public: ModelComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag); ~ModelComponent(); void init(); void setKey(int val); void animate(); void reset(); void resetColormap(); void setMatrix(const Math::Matrix4 &matrix) { _matrix = matrix; }; void restoreState(SaveGame *state); void translateObject(bool reset); static void translateObject(ModelNode *node, bool reset); AnimManager *getAnimManager() const; ModelNode *getHierarchy() { return _hier; } int getNumNodes(); Model *getModel() { return _obj; } void draw(); void getBoundingBox(int *x1, int *y1, int *x2, int *y2); protected: Model *_obj; ModelNode *_hier; Math::Matrix4 _matrix; AnimManager *_animation; Component *_prevComp; }; } // end of namespace Grim #endif
/* * Copyright (c) 2009-2021, Christian Ferrari <tiian@users.sourceforge.net> * All rights reserved. * * This file is part of LIXA. * * LIXA 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. * * LIXA 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 LIXA. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #ifdef HAVE_STDIO_H # include <stdio.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #ifdef HAVE_ASSERT_H # include <assert.h> #endif #include <tx.h> #include <liblixamonkey.h> /* this case test is used to test TX_CHAINED transactions */ int main(int argc, char *argv[]) { char *pgm = argv[0]; int rc; long begin_pos; int rmid; if (argc < 2) { fprintf(stderr, "%s: at least one option must be specified\n", argv[0]); exit (1); } begin_pos = strtol(argv[1], NULL, 0); printf("%s| starting...\n", pgm); printf("%s| tx_open(): %d\n", pgm, rc = tx_open()); assert(TX_OK == rc); if (0 == begin_pos) { printf("%s| tx_begin(): %d\n", pgm, rc = tx_begin()); assert(TX_OK == rc); } /* emulate callback registration from resource manager when accessing * resource manager owned resources; you may imagine these are the * equivalent of a SQLExecDirect function call */ for (rmid=0; rmid<3; ++rmid) { printf("%s| lixa_monkeyrm_call_ax_reg(%d): %d\n", pgm, rmid, rc = lixa_monkeyrm_call_ax_reg(rmid)); } if (1 == begin_pos) { printf("%s| tx_begin(): %d\n", pgm, rc = tx_begin()); assert(TX_OUTSIDE == rc); } /* emulate callback de-registration from resource manager when accessing * resource manager owned resources; you may imagine these are the * equivalent of a SQLEndTran function call */ for (rmid=0; rmid<3; ++rmid) { printf("%s| lixa_monkeyrm_call_ax_unreg(%d): %d\n", pgm, rmid, rc = lixa_monkeyrm_call_ax_unreg(rmid)); if (0 == begin_pos) assert(TMER_PROTO == rc); } if (2 == begin_pos) { printf("%s| tx_begin(): %d\n", pgm, rc = tx_begin()); assert(TX_OK == rc); } printf("%s| tx_commit(): %d\n", pgm, rc = tx_commit()); if (1 == begin_pos) assert(TX_PROTOCOL_ERROR == rc); else assert(TX_OK == rc); /* emulate callback registration from resource manager when accessing * resource manager owned resources; you may imagine these are the * equivalent of a SQLExecDirect function call */ for (rmid=0; rmid<3; ++rmid) { printf("%s| lixa_monkeyrm_call_ax_reg(%d): %d\n", pgm, rmid, rc = lixa_monkeyrm_call_ax_reg(rmid)); assert(TM_OK == rc); } /* emulate callback de-registration from resource manager when accessing * resource manager owned resources; you may imagine these are the * equivalent of a SQLEndTran function call */ for (rmid=0; rmid<3; ++rmid) { printf("%s| lixa_monkeyrm_call_ax_unreg(%d): %d\n", pgm, rmid, rc = lixa_monkeyrm_call_ax_unreg(rmid)); assert(TM_OK == rc); } printf("%s| tx_close(): %d\n", pgm, rc = tx_close()); assert(TX_OK == rc); /* memory leak prevention */ lixa_monkeyrm_call_cleanup(); printf("%s| ...finished\n", pgm); return 0; }
#include <ctype.h> #include <stdio.h> #include <string.h> #include "geekcode.h" #include "lines.h" #include "parse.h" const char *parse_errors[] = { "Success", "Trailing text in data", "Missing alias", "Missing dependant", "Syntax error", "Unexpected EOF", "File error", }; /* * Parses the contents of data into line. * Returns 0 on success, error code on failure. */ static enum parse_errors_t process_line(struct answer *line, char *data) { char *last, *p; for ((p = strtok_r(data, " ", &last)); p && line->answer; (p = strtok_r(NULL, " ", &last)), line++) { int i; const struct elem *temp; char c=0; /* Skip lines we shouldn't display */ while (!line->display) line++; /* Parse each 'element' in the text, put the value in the * answer struct */ for (temp = line->contents, i=0; temp[i].alias; i++) { char *n, buf[256]; const char *s; /* * If the line is dependant, iterate over the possible * aliases it could be. If it's not, this loop will * only be entered once. */ if (line->dependant) { if (sscanf(p, temp[i].alias, &c)) snprintf(buf, sizeof(buf), temp[i].alias, c); else continue; s = (const char *)&buf; } else { s = temp[i].alias; } /* Kill those pesky newlines */ n = strchr(p, '\n'); if (n) *n = '\0'; if (!strcmp(s, p)) goto out; } return EALIAS; out: line->answer = i+1; /* Set the answer of the dependant */ if (c) { const struct elem *temp; int i; for (temp = (line-1)->contents, i = 0; temp->alias; temp++, i++) if (*(temp->alias) == c) goto found; return EDEPENDANT; found: (line-1)->answer = i+1; } } /* There's something left! */ if ((p && isalnum((unsigned char )*p)) || line->answer) return ETRAILING; return SUCCESS; } /* * Reads geekcode from in and initialises the structures in lines * appropriately. * Returns 0 on success, error code on failure. */ static int parse_header(FILE *in, unsigned *line_count) { char data[1024]; *line_count = 0; while (fgets(data, sizeof(data), in)) { (*line_count)++; if (strcmp(data, "-----BEGIN GEEK CODE BLOCK-----\n")) continue; /* Skip version line */ /* XXX: Check version some way? */ if (!fgets(data, sizeof(data), in)) return -1; (*line_count)++; return 0; } return -1; } static int parse_code(FILE *in, unsigned *line_count) { char data[1024]; struct answer **cur_line = lines; while (fgets(data, sizeof(data), in)) { int ret; (*line_count)++; if (!strcmp(data, "------END GEEK CODE BLOCK------\n")) return 0; if (!*cur_line) return ESYNTAX; if ((ret = process_line(*cur_line, data))) return ret; cur_line++; } return -1; } unsigned read_code(FILE *in, unsigned *line_count) { int ret; ret = parse_header(in, line_count); if (!ret) ret = parse_code(in, line_count); if (!ret) return 0; if (ret < 0) { if (ferror(in)) return EFERROR; else return EEOF; } return ret; }
// Copyright (c) 2012- PPSSPP 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, version 2.0 or later versions. // 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 2.0 for more details. // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #pragma once // TODO: Remove the Windows-specific code, FILE is fine there too. #include <map> #include <string> #include "../Core/FileSystems/FileSystem.h" #ifdef _WIN32 typedef void * HANDLE; #endif #if defined(__APPLE__) #if TARGET_OS_IPHONE #define HOST_IS_CASE_SENSITIVE 1 #elif TARGET_IPHONE_SIMULATOR #define HOST_IS_CASE_SENSITIVE 0 #else // Mac OSX case sensitivity defaults off, but is user configurable (when // creating a filesytem), so assume the worst: #define HOST_IS_CASE_SENSITIVE 1 #endif #elif defined(_WIN32) || defined(__SYMBIAN32__) #define HOST_IS_CASE_SENSITIVE 0 #else // Android, Linux, BSD (and the rest?) #define HOST_IS_CASE_SENSITIVE 1 #endif class DirectoryFileSystem : public IFileSystem { public: DirectoryFileSystem(IHandleAllocator *_hAlloc, std::string _basePath); ~DirectoryFileSystem(); void DoState(PointerWrap &p); std::vector<PSPFileInfo> GetDirListing(std::string path); u32 OpenFile(std::string filename, FileAccess access); void CloseFile(u32 handle); size_t ReadFile(u32 handle, u8 *pointer, s64 size); size_t WriteFile(u32 handle, const u8 *pointer, s64 size); size_t SeekFile(u32 handle, s32 position, FileMove type); PSPFileInfo GetFileInfo(std::string filename); bool OwnsHandle(u32 handle); bool MkDir(const std::string &dirname); bool RmDir(const std::string &dirname); bool RenameFile(const std::string &from, const std::string &to); bool DeleteFile(const std::string &filename); bool GetHostPath(const std::string &inpath, std::string &outpath); private: struct OpenFileEntry { #ifdef _WIN32 HANDLE hFile; #else FILE *hFile; #endif }; typedef std::map<u32, OpenFileEntry> EntryMap; EntryMap entries; std::string basePath; IHandleAllocator *hAlloc; // In case of Windows: Translate slashes, etc. std::string GetLocalPath(std::string localpath); #if HOST_IS_CASE_SENSITIVE typedef enum { FPC_FILE_MUST_EXIST, // all path components must exist (rmdir, move from) FPC_PATH_MUST_EXIST, // all except the last one must exist - still tries to fix last one (fopen, move to) FPC_PARTIAL_ALLOWED, // don't care how many exist (mkdir recursive) } FixPathCaseBehavior; bool FixPathCase(std::string &path, FixPathCaseBehavior behavior); #endif };
/** * MaNGOS is a full featured server for World of Warcraft, supporting * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 * * Copyright (C) 2005-2022 MaNGOS <https://getmangos.eu> * * 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 * * World of Warcraft, and all World of Warcraft or Warcraft art, images, * and lore are copyrighted by Blizzard Entertainment, Inc. */ #ifndef MANGOS_H_ACCMGR #define MANGOS_H_ACCMGR #include "Common.h" enum AccountOpResult { AOR_OK, AOR_NAME_TOO_LONG, AOR_PASS_TOO_LONG, AOR_NAME_ALREADY_EXIST, AOR_NAME_NOT_EXIST, AOR_DB_INTERNAL_ERROR }; #define MAX_ACCOUNT_STR 16 #define MAX_PASSWORD_STR 16 class AccountMgr { public: AccountMgr(); ~AccountMgr(); AccountOpResult CreateAccount(std::string username, std::string password); AccountOpResult DeleteAccount(uint32 accid); AccountOpResult ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd); AccountOpResult ChangePassword(uint32 accid, std::string new_passwd); bool CheckPassword(uint32 accid, std::string passwd); uint32 GetId(std::string username); AccountTypes GetSecurity(uint32 acc_id); bool GetName(uint32 acc_id, std::string& name); uint32 GetCharactersCount(uint32 acc_id); std::string CalculateShaPassHash(std::string& name, std::string& password); static bool normalizeString(std::string& utf8str); }; #define sAccountMgr MaNGOS::Singleton<AccountMgr>::Instance() #endif
/* * sVimPy - small Virtual interpreting machine for Python * (c) 2012 by Tim Theede aka Pez2001 <pez2001@voyagerproject.de> / vp * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * THIS SOFTWARE IS SUPPLIED AS IT IS WITHOUT ANY WARRANTY! * */ #ifndef OPCODES_H #define OPCODES_H #include "features.h" #include "types.h" #include "debug.h" #define OPCODE_STOP_CODE 0x00 #define OPCODE_POP_TOP 0x01 #define OPCODE_ROT_TWO 0x02 #define OPCODE_ROT_THREE 0x03 #define OPCODE_DUP_TOP 0x04 #define OPCODE_DUP_TOP_TWO 0x05 #define OPCODE_NOP 0x09 #define OPCODE_UNARY_POSITIVE 0x0a #define OPCODE_UNARY_NEGATIVE 0x0b #define OPCODE_UNARY_NOT 0x0c #define OPCODE_UNARY_INVERT 0x0f #define OPCODE_BINARY_POWER 0x13 #define OPCODE_BINARY_MULTIPLY 0x14 #define OPCODE_BINARY_DIVIDE 0x15 #define OPCODE_BINARY_MODULO 0x16 #define OPCODE_BINARY_ADD 0x17 #define OPCODE_BINARY_SUBTRACT 0x18 #define OPCODE_BINARY_SUBSCR 0x19 #define OPCODE_BINARY_FLOOR_DIVIDE 0x1a #define OPCODE_BINARY_TRUE_DIVIDE 0x1b #define OPCODE_INPLACE_FLOOR_DIVIDE 0x1c #define OPCODE_INPLACE_TRUE_DIVIDE 0x1d #define OPCODE_STORE_MAP 0x36 #define OPCODE_INPLACE_ADD 0x37 #define OPCODE_INPLACE_SUBTRACT 0x38 #define OPCODE_INPLACE_MULTIPLY 0x39 #define OPCODE_INPLACE_DIVIDE 0x3a #define OPCODE_INPLACE_MODULO 0x3b #define OPCODE_STORE_SUBSCR 0x3c #define OPCODE_DELETE_SUBSCR 0x3d #define OPCODE_BINARY_LSHIFT 0x3e #define OPCODE_BINARY_RSHIFT 0x3f #define OPCODE_BINARY_AND 0x40 #define OPCODE_BINARY_XOR 0x41 #define OPCODE_BINARY_OR 0x42 #define OPCODE_INPLACE_POWER 0x43 #define OPCODE_GET_ITER 0x44 #define OPCODE_STORE_LOCALS 0x45 #define OPCODE_PRINT_EXPR 0x46 #define OPCODE_LOAD_BUILD_CLASS 0x47 #define OPCODE_INPLACE_LSHIFT 0x4b #define OPCODE_INPLACE_RSHIFT 0x4c #define OPCODE_INPLACE_AND 0x4d #define OPCODE_INPLACE_XOR 0x4e #define OPCODE_INPLACE_OR 0x4f #define OPCODE_BREAK_LOOP 0x50 #define OPCODE_WITH_CLEANUP 0x51 #define OPCODE_RETURN_VALUE 0x53 #define OPCODE_IMPORT_STAR 0x54 #define OPCODE_YIELD_VALUE 0x56 #define OPCODE_POP_BLOCK 0x57 #define OPCODE_END_FINALLY 0x58 #define OPCODE_POP_EXCEPT 0x59 #define OPCODE_STORE_NAME 0x5a #define OPCODE_DELETE_NAME 0x5b #define OPCODE_UNPACK_SEQUENCE 0x5c #define OPCODE_FOR_ITER 0x5d #define OPCODE_UNPACK_EX 0x5e #define OPCODE_STORE_ATTR 0x5f #define OPCODE_DELETE_ATTR 0x60 #define OPCODE_STORE_GLOBAL 0x61 #define OPCODE_DELETE_GLOBAL 0x62 #define OPCODE_LOAD_CONST 0x64 #define OPCODE_LOAD_NAME 0x65 #define OPCODE_BUILD_TUPLE 0x66 #define OPCODE_BUILD_LIST 0x67 #define OPCODE_BUILD_SET 0x68 #define OPCODE_BUILD_MAP 0x69 #define OPCODE_LOAD_ATTR 0x6a #define OPCODE_COMPARE_OP 0x6b #define OPCODE_IMPORT_NAME 0x6c #define OPCODE_IMPORT_FROM 0x6d #define OPCODE_JUMP_FORWARD 0x6e #define OPCODE_JUMP_IF_FALSE 0x6f #define OPCODE_JUMP_IF_TRUE 0x70 #define OPCODE_JUMP_ABSOLUTE 0x71 #define OPCODE_POP_JUMP_IF_FALSE 0x72 #define OPCODE_POP_JUMP_IF_TRUE 0x73 #define OPCODE_LOAD_GLOBAL 0x74 #define OPCODE_SETUP_LOOP 0x78 #define OPCODE_SETUP_EXCEPT 0x79 #define OPCODE_SETUP_FINALLY 0x7a #define OPCODE_LOAD_FAST 0x7c #define OPCODE_STORE_FAST 0x7d #define OPCODE_DELETE_FAST 0x7e #define OPCODE_RAISE_VARARGS 0x82 #define OPCODE_CALL_FUNCTION 0x83 #define OPCODE_MAKE_FUNCTION 0x84 #define OPCODE_BUILD_SLICE 0x85 #define OPCODE_MAKE_CLOSURE 0x86 #define OPCODE_LOAD_CLOSURE 0x87 #define OPCODE_LOAD_DEREF 0x88 #define OPCODE_STORE_DEREF 0x89 #define OPCODE_DELETE_DEREF 0x8a #define OPCODE_CALL_FUNCTION_VAR 0x8c #define OPCODE_CALL_FUNCTION_KW 0x8d #define OPCODE_CALL_FUNCTION_VAR_KW 0x8e #define OPCODE_SETUP_WITH 0x8f #define OPCODE_EXTENDED_ARG 0x90 #define OPCODE_LIST_APPEND 0x91 #define OPCODE_SET_ADD 0x92 #define OPCODE_MAP_ADD 0x93 #if defined(USE_DEBUGGING) || defined(USE_ARDUINO_OPCODE_DEBUGGING) #ifdef __cplusplus extern "C" { #endif typedef struct { unsigned char cm_op; // cmp op in bytecode representation //#ifdef DEBUG char *name; // string version //#endif } cmp_op; typedef struct { unsigned char opcode; // opcode in bytecode representation //#ifdef DEBUG char *name; // string version #ifndef USE_ARDUINO_OPCODE_DEBUGGING char *description; // a short description #endif // unsigned int num_parameters; //number of parameters NUM argcount; #ifndef USE_ARDUINO_OPCODE_DEBUGGING BOOL supported; #endif } opcode; #ifndef USE_ARDUINO_OPCODE_DEBUGGING void DumpUnsupportedOpCodes(void); NUM GetSupportedOpcodesNum(void); #endif INDEX GetOpcodeIndex(unsigned char opcode); #ifdef __cplusplus } #endif #endif #endif
/* wmgeneral miscellaneous functions * * from dock.c - built-in Dock module for WindowMaker window manager * * Copyright (c) 1997 Alfredo K. Kojima * * 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 <stdlib.h> #include <string.h> #include <stdio.h> #include "list.h" #include "misc.h" /* *---------------------------------------------------------------------- * parse_command-- * Divides a command line into a argv/argc pair. *---------------------------------------------------------------------- */ #define PRC_ALPHA 0 #define PRC_BLANK 1 #define PRC_ESCAPE 2 #define PRC_DQUOTE 3 #define PRC_EOS 4 #define PRC_SQUOTE 5 typedef struct { short nstate; short output; } DFA; static DFA mtable[9][6] = { {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}}, {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}}, {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}}, {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}}, {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}}, {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}}, {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}}, {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ }; char* next_token(char *word, char **next) { char *ptr; char *ret, *t; int state, ctype; t = ret = malloc(strlen(word)+1); if (ret == NULL) { fprintf(stderr, "Insufficient memory.\n"); exit(EXIT_FAILURE); } ptr = word; state = 0; *t = 0; while (1) { if (*ptr==0) ctype = PRC_EOS; else if (*ptr=='\\') ctype = PRC_ESCAPE; else if (*ptr=='"') ctype = PRC_DQUOTE; else if (*ptr=='\'') ctype = PRC_SQUOTE; else if (*ptr==' ' || *ptr=='\t') ctype = PRC_BLANK; else ctype = PRC_ALPHA; if (mtable[state][ctype].output) { *t = *ptr; t++; *t = 0; } state = mtable[state][ctype].nstate; ptr++; if (mtable[state][0].output<0) { break; } } if (*ret==0) t = NULL; else t = strdup(ret); free(ret); if (ctype==PRC_EOS) *next = NULL; else *next = ptr; return t; } extern void parse_command(char *command, char ***argv, int *argc) { LinkedList *list = NULL; char *token, *line; int count, i; line = command; do { token = next_token(line, &line); if (token) { list = list_cons(token, list); } } while (token!=NULL && line!=NULL); count = list_length(list); *argv = malloc(sizeof(char*)*count); i = count; while (list!=NULL) { (*argv)[--i] = list->head; list_remove_head(&list); } *argc = count; } extern pid_t execCommand(char *command) { pid_t pid; char **argv; int argc; parse_command(command, &argv, &argc); if (argv==NULL) { return 0; } if ((pid=fork())==0) { char **args; int i; args = malloc(sizeof(char*)*(argc+1)); if (!args) exit(10); for (i=0; i<argc; i++) { args[i] = argv[i]; } args[argc] = NULL; execvp(argv[0], args); exit(10); } free(argv); return pid; }
// // LiveUploadingHelper.h // Telegram // // Created by Mikhail Filimonov on 08/03/2018. // Copyright © 2018 Telegram. All rights reserved. // #import <Foundation/Foundation.h> @interface LiveUploadingHelper : NSObject @end
#ifndef _LINUX_NTFS_COLLATE_H #define _LINUX_NTFS_COLLATE_H #include "types.h" #include "volume.h" static inline bool ntfs_is_collation_rule_supported(COLLATION_RULE cr) { int i; /* * FIXME: At the moment we only support COLLATION_BINARY and * COLLATION_NTOFS_ULONG, so we return false for everything else for * now. */ if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG)) return false; i = le32_to_cpu(cr); if (likely(((i >= 0) && (i <= 0x02)) || ((i >= 0x10) && (i <= 0x13)))) return true; return false; } extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, const void *data1, const int data1_len, const void *data2, const int data2_len); #endif /* _LINUX_NTFS_COLLATE_H */
#include "TCS3200.h" #include "HMC.h" #define tl0 0x00 #define th0 0xB8 //Timer0 void ColorInt() { AUXR&= 0x00; TMOD = 0xE0; AUXR = 0x14; //T2Ϊ1Tģʽ, ²¢Æô¶¯¶¨Ê±Æ÷2 page 470 AUXR |= 0x01; } unsigned int CheckRed() { unsigned int Red; TL0= tl0; TH0= th0; TH1= 0; TL1= 0; TCS_S2= 0; TCS_S3= 0;//Select Red Filter Delay5ms(); TR0= 1;//Timer 0 Start 10ms TR1= 1;//Counter 1 Start while(TF0==0) ;//Waitng for Timer0 overflow TF0= 0;//Clean Timer0 overflow flag TR0= 0;//Timer0 stop TR1= 0;//Counter0 stop Red= (unsigned long)(TH1*256+TL1);//*255/k_Red; return Red; } unsigned int CheckGreen() { unsigned int Green; TL0= tl0; TH0= th0; TH1= 0; TL1= 0; TCS_S2= 1; TCS_S3= 1;//Select Green Filter Delay5ms(); TR0= 1;//Timer 0 Start 10ms TR1= 1;//Counter 1 Start while(TF0==0) ;//Waitng for Timer0 overflow TF0= 0;//Clean Timer0 overflow flag TR0= 0;//Timer0 stop TR1= 0;//Counter0 stop Green= (unsigned long)(TH1*256+TL1);//*255/k_Green; return Green; } unsigned int CheckBlue() { unsigned int Blue; TL0= tl0; TH0= th0; TH1= 0; TL1= 0; TCS_S2= 0; TCS_S3= 1;//Select Blue Filter Delay5ms(); TR0= 1;//Timer 0 Start 10ms TR1= 1;//Counter 1 Start while(TF0==0) ;//Waitng for Timer0 overflow TF0= 0;//Clean Timer0 overflow flag TR0= 0;//Timer0 stop TR1= 0;//Counter0 stop Blue= (unsigned long)(TH1*256+TL1);//*255/k_Blue; return Blue; }
/* $Id: GuestDnDTargetImpl.h $ */ /** @file * VBox Console COM Class implementation - Guest drag'n drop target. */ /* * Copyright (C) 2014-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ #ifndef ____H_GUESTDNDTARGETIMPL #define ____H_GUESTDNDTARGETIMPL #include "GuestDnDTargetWrap.h" #include "GuestDnDPrivate.h" #include <VBox/GuestHost/DragAndDrop.h> #include <VBox/HostServices/DragAndDropSvc.h> struct SENDDATACTX; typedef struct SENDDATACTX *PSENDDATACTX; class ATL_NO_VTABLE GuestDnDTarget : public GuestDnDTargetWrap, public GuestDnDBase { public: /** @name COM and internal init/term/mapping cruft. * @{ */ DECLARE_EMPTY_CTOR_DTOR(GuestDnDTarget) int init(const ComObjPtr<Guest>& pGuest); void uninit(void); HRESULT FinalConstruct(void); void FinalRelease(void); /** @} */ private: /** Private wrapped @name IDnDBase methods. * @{ */ HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported); HRESULT getFormats(GuestDnDMIMEList &aFormats); HRESULT addFormats(const GuestDnDMIMEList &aFormats); HRESULT removeFormats(const GuestDnDMIMEList &aFormats); HRESULT getProtocolVersion(ULONG *aProtocolVersion); /** @} */ /** Private wrapped @name IDnDTarget methods. * @{ */ HRESULT enter(ULONG aScreenId, ULONG ax, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction); HRESULT move(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction); HRESULT leave(ULONG aScreenId); HRESULT drop(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, com::Utf8Str &aFormat, DnDAction_T *aResultAction); HRESULT sendData(ULONG aScreenId, const com::Utf8Str &aFormat, const std::vector<BYTE> &aData, ComPtr<IProgress> &aProgress); HRESULT cancel(BOOL *aVeto); /** @} */ protected: static Utf8Str i_guestErrorToString(int guestRc); static Utf8Str i_hostErrorToString(int hostRc); /** @name Thread callbacks. * @{ */ static DECLCALLBACK(int) i_sendDataThread(RTTHREAD Thread, void *pvUser); /** @} */ /** @name Callbacks for dispatch handler. * @{ */ static DECLCALLBACK(int) i_sendURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser); /** @} */ protected: int i_cancelOperation(void); int i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout); int i_sendDataBody(PSENDDATACTX pCtx, GuestDnDData *pData); int i_sendDataHeader(PSENDDATACTX pCtx, GuestDnDData *pData, GuestDnDURIData *pURIData /* = NULL */); int i_sendDirectory(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg); int i_sendFile(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg); int i_sendFileData(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg); int i_sendRawData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout); int i_sendURIData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout); int i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg); protected: struct { bool mfTransferIsPending; /** Maximum data block size (in bytes) the target can handle. */ uint32_t mcbBlockSize; } mData; friend class SendDataTask; }; #endif /* !____H_GUESTDNDTARGETIMPL */
/* * 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. */ #include <bfa_priv.h> #include <bfi/bfi_cbreg.h> void bfa_hwcb_reginit(struct bfa_s *bfa) { struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs; bfa_os_addr_t kva = bfa_ioc_bar0(&bfa->ioc); int i, q, fn = bfa_ioc_pcifn(&bfa->ioc); if (fn == 0) { bfa_regs->intr_status = (kva + HOSTFN0_INT_STATUS); bfa_regs->intr_mask = (kva + HOSTFN0_INT_MSK); } else { bfa_regs->intr_status = (kva + HOSTFN1_INT_STATUS); bfa_regs->intr_mask = (kva + HOSTFN1_INT_MSK); } for (i = 0; i < BFI_IOC_MAX_CQS; i++) { /* * CPE registers */ q = CPE_Q_NUM(fn, i); bfa_regs->cpe_q_pi[i] = (kva + CPE_Q_PI(q)); bfa_regs->cpe_q_ci[i] = (kva + CPE_Q_CI(q)); bfa_regs->cpe_q_depth[i] = (kva + CPE_Q_DEPTH(q)); /* * RME registers */ q = CPE_Q_NUM(fn, i); bfa_regs->rme_q_pi[i] = (kva + RME_Q_PI(q)); bfa_regs->rme_q_ci[i] = (kva + RME_Q_CI(q)); bfa_regs->rme_q_depth[i] = (kva + RME_Q_DEPTH(q)); } } void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int reqq) { } static void bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq) { bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, __HFN_INT_CPE_Q0 << CPE_Q_NUM(bfa_ioc_pcifn(&bfa->ioc), reqq)); } void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq) { } static void bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq) { bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, __HFN_INT_RME_Q0 << RME_Q_NUM(bfa_ioc_pcifn(&bfa->ioc), rspq)); } void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, u32 *num_vecs, u32 *max_vec_bit) { #define __HFN_NUMINTS 13 if (bfa_ioc_pcifn(&bfa->ioc) == 0) { *msix_vecs_bmap = (__HFN_INT_CPE_Q0 | __HFN_INT_CPE_Q1 | __HFN_INT_CPE_Q2 | __HFN_INT_CPE_Q3 | __HFN_INT_RME_Q0 | __HFN_INT_RME_Q1 | __HFN_INT_RME_Q2 | __HFN_INT_RME_Q3 | __HFN_INT_MBOX_LPU0); *max_vec_bit = __HFN_INT_MBOX_LPU0; } else { *msix_vecs_bmap = (__HFN_INT_CPE_Q4 | __HFN_INT_CPE_Q5 | __HFN_INT_CPE_Q6 | __HFN_INT_CPE_Q7 | __HFN_INT_RME_Q4 | __HFN_INT_RME_Q5 | __HFN_INT_RME_Q6 | __HFN_INT_RME_Q7 | __HFN_INT_MBOX_LPU1); *max_vec_bit = __HFN_INT_MBOX_LPU1; } *msix_vecs_bmap |= (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS); *num_vecs = __HFN_NUMINTS; } /** * No special setup required for crossbow -- vector assignments are implicit. */ void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs) { int i; bfa_assert((nvecs == 1) || (nvecs == __HFN_NUMINTS)); bfa->msix.nvecs = nvecs; if (nvecs == 1) { for (i = 0; i < BFA_MSIX_CB_MAX; i++) bfa->msix.handler[i] = bfa_msix_all; return; } for (i = BFA_MSIX_CPE_Q0; i <= BFA_MSIX_CPE_Q7; i++) bfa->msix.handler[i] = bfa_msix_reqq; for (i = BFA_MSIX_RME_Q0; i <= BFA_MSIX_RME_Q7; i++) bfa->msix.handler[i] = bfa_msix_rspq; for (; i < BFA_MSIX_CB_MAX; i++) bfa->msix.handler[i] = bfa_msix_lpu_err; } /** * Crossbow -- dummy, interrupts are masked */ void bfa_hwcb_msix_install(struct bfa_s *bfa) { } void bfa_hwcb_msix_uninstall(struct bfa_s *bfa) { } /** * No special enable/disable -- vector assignments are implicit. */ void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix) { bfa->iocfc.hwif.hw_reqq_ack = bfa_hwcb_reqq_ack_msix; bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack_msix; }
/** * @file md5.h * A simple class for MD5 calculation * * @author Ben Gardner * @license GPL v2+ */ #ifndef MD5_H_INCLUDED #define MD5_H_INCLUDED #include "base_types.h" class MD5 { public: MD5(); ~MD5() { } void Init(); void Update(const void *data, UINT32 len); void Final(char digest[33]); /* internal function */ static void Transform(UINT32 buf[4], UINT32 in_data[16]); static void Calc(const void *data, UINT32 length, char digest[33]); private: UINT32 m_buf[4]; UINT32 m_bits[2]; UINT8 m_in[64]; bool m_need_byteswap; bool m_big_endian; void reverse_u32(UINT8 *buf, int n_u32); }; #endif /* MD5_H_INCLUDED */
/* * mcp2515_cmds.h * * Created on: 21 Feb 2015 * Author: RobThePyro */ #ifndef MCP2515_CMDS_H_ #define MCP2515_CMDS_H_ /* Includes: */ #include <avr/io.h> #include <util/delay.h> #include "mcp2515_defs.h" #include "AVR_SPI.h" /* Defines: */ #define DDR_CS DDRB #define PORT_CS PORTB #define P_CS 2 #define DDR_SPI DDRB #define PORT_SPI PORTB #define P_MISO 4 #define P_MOSI 3 #define P_SCK 5 typedef struct { uint16_t id; uint8_t rtr; uint8_t length; uint8_t data [ 8 ] ; } CANMessage; // CAN Bitrate 125 kbps #define R_CNF1 (1<<BRP2)|(1<<BRP1)|(1<<BRP0) #define R_CNF2 (1<<BTLMODE)|(1<<PHSEG11) #define R_CNF3 (1<<PHSEG21) /* Functions: */ void mcp2515_init ( void ); void mcp2515_write_register ( uint8_t , uint8_t ); uint8_t mcp2515_read_register ( uint8_t ); void mcp2515_bit_modify ( uint8_t , uint8_t , uint8_t ); void can_send_message ( CANMessage *); #endif /* MCP2515_CMDS_H_ */
/* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * 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 __PALETTE_EDITOR_COMMANDS_H__ #define __PALETTE_EDITOR_COMMANDS_H__ void palette_editor_edit_color_cmd_callback (GtkAction *action, gpointer data); void palette_editor_new_color_cmd_callback (GtkAction *action, gint value, gpointer data); void palette_editor_delete_color_cmd_callback (GtkAction *action, gpointer data); void palette_editor_zoom_cmd_callback (GtkAction *action, gint value, gpointer data); #endif /* __PALETTE_EDITOR_COMMANDS_H__ */
// // FlashcardViewController.h // hci-flashcard-iPhone // // Created by Jordan Sommers on 3/11/14. // Copyright (c) 2014 CMPE131. All rights reserved. // #import <UIKit/UIKit.h> @class Deck; @class Flashcard; @interface FlashcardViewController : UIViewController @property (strong, nonatomic) Deck *deckref; @property (strong, nonatomic) NSString *group; @property (strong, nonatomic) Flashcard *currentCard; @end
#include <linux/init.h> #include <linux/pci.h> #include <linux/module.h> #include <linux/interrupt.h> #include "pci.h" struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, struct pci_dev *from) { struct pci_dev *pdev; pci_dev_get(from); pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); pci_dev_put(pdev); return pdev; } EXPORT_SYMBOL(pci_find_device);
/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2006 by Barry Wardell * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #ifndef _ADC_TARGET_H_ #define _ADC_TARGET_H_ /* only two channels used by the Gigabeat */ #define NUM_ADC_CHANNELS 2 #define ADC_BATTERY 0 #define ADC_HPREMOTE 1 #define ADC_UNKNOWN_3 2 #define ADC_UNKNOWN_4 3 #define ADC_UNKNOWN_5 4 #define ADC_UNKNOWN_6 5 #define ADC_UNKNOWN_7 6 #define ADC_UNKNOWN_8 7 #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ #define ADC_READ_ERROR 0xFFFF #endif
/* readable.c: check if a filename is a readable non-directory file. Copyright 1993, 1995, 1996, 2008, 2011, 2012 Karl Berry. Copyright 1998, 1999, 2000, 2001, 2005 Olaf Weber. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <kpathsea/config.h> #include <kpathsea/c-namemx.h> #include <kpathsea/c-pathch.h> #include <kpathsea/c-pathmx.h> #include <kpathsea/c-stat.h> #include <kpathsea/pathsearch.h> #include <kpathsea/readable.h> #include <kpathsea/tex-hush.h> /* If access can read FN, run stat (assigning to stat buffer ST) and check that fn is not a directory. Don't check for just being a regular file, as it is potentially useful to read fifo's or some kinds of devices. */ #ifdef __DJGPP__ /* `stat' is way too expensive for such a simple job. */ #define READABLE(fn, st) \ (access (fn, R_OK) == 0 && access (fn, D_OK) == -1) #elif defined (WIN32) /* st must be an unsigned int under Windows */ static boolean READABLE(const_string fn, unsigned int st) { wchar_t *fnw; fnw = get_wstring_from_fsyscp(fn, fnw=NULL); if ((st = GetFileAttributesW(fnw)) != 0xFFFFFFFF) { /* succeeded */ errno = 0; } else { switch(GetLastError()) { case ERROR_BUFFER_OVERFLOW: errno = ENAMETOOLONG; break; case ERROR_ACCESS_DENIED: errno = EACCES; break; default : errno = EIO; /* meaningless, will make ret=NULL later */ break; } } if(fnw) free(fnw); return ((st != 0xFFFFFFFF) && !(st & FILE_ATTRIBUTE_DIRECTORY)); } #else #define READABLE(fn, st) \ (access (fn, R_OK) == 0 && stat (fn, &(st)) == 0 && !S_ISDIR (st.st_mode)) #endif /* POSIX invented the brain-damage of not necessarily truncating filename components; the system's behavior is defined by the value of the symbol _POSIX_NO_TRUNC, but you can't change it dynamically! */ string kpathsea_readable_file (kpathsea kpse, string name) { #ifdef WIN32 unsigned int st = 0; #else /* ! WIN32 */ struct stat st; #endif kpathsea_normalize_path (kpse, name); if (READABLE (name, st)) { return name; #ifdef ENAMETOOLONG } else if (errno == ENAMETOOLONG) { /* Truncate any too-long components in NAME. */ unsigned c_len = 0; /* Length of current component. */ char *s = name; /* Position in current component. */ char *t = name; /* End of allowed length. */ for (; *s; s++) { if (c_len <= NAME_MAX) t = s; #if defined(WIN32) if (IS_KANJI (s)) { s++; c_len += 2; continue; } #endif if (IS_DIR_SEP (*s) || IS_DEVICE_SEP (*s)) { if (c_len > NAME_MAX) { /* Truncate if past the max for a component. */ memmove (t, s, strlen (s) + 1); s = t; } /* At a directory delimiter, reset component length. */ c_len = 0; } else c_len++; } if (c_len > NAME_MAX) /* Truncate if past the max for last component. */ *t = 0; /* Perhaps some other error will occur with the truncated name, so let's call access again. */ if (READABLE (name, st)) /* Success. */ return name; #endif /* ENAMETOOLONG */ } else { /* Some other error. */ if (errno == EACCES) { /* Maybe warn them if permissions are bad. */ if (!kpathsea_tex_hush (kpse, "readable")) { perror (name); } } } return NULL; } #if defined (KPSE_COMPAT_API) string kpse_readable_file (string name) { return kpathsea_readable_file (kpse_def, name); } #endif
/************************************************************************ $Id: rtbinit.h,v 1.2 2005/02/24 10:27:55 jonico Exp $ RTB - Team Framework: Framework for RealTime Battle robots to communicate efficiently in a team Copyright (C) 2004 The RTB- Team Framework Group: http://rtb-team.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 USA $Log: rtbinit.h,v $ Revision 1.2 2005/02/24 10:27:55 jonico Updated newest version of the framework Revision 1.2 2005/01/06 17:59:34 jonico Now all files in the repository have their new header format. **************************************************************************/ #ifndef RTBINIT_H #define RTBINIT_H #include "../stdnamespace.h" #include "../exceptions/parserexception.h" #include "../exceptions/ioexception.h" /** * Namespace RTBGlobal */namespace RTBGlobal { using std::string; using Exceptions::ParserException; using std::bad_exception; using Exceptions::RTBException; using Exceptions::IOException; /** * Class RTBInit */ class RTBInit { /* * Public stuff */ public: /* * Operations */ /** * Calls the RTBConfig Parser to parse the config file, register the pasring result in the MRC * @param configFileName Path to the file containing the absolute necessary configuration data */ static void ParseConfigFile (const string& configFileName) throw (ParserException, bad_exception); /** * This method first has to switch to blocking mode * This method has to send: * 1. The Robot Option USE_NON_BLOCKING 1 (this is tricky, we do not want to be killed by the RTB Server, so we chose non blocking for it, but set our descriptors to block * 2. The Robot Option SEND_ROTATION_REACHED with a specified value in the configuration file * 3. the name and the color of the robot if requested (first sequence) * This method has to read: * 1. The Initialize Command * 2. If it is not the first sequence in the tournament, the YourColour and YourNameCommand * This methods registers the following runtime properties: * 1. Section Main, Key FirstSequence : "true" / "false" * 2. Section Main, Key ActualColor : actual color as hex string, if first sequence, this value will be set to RobotHomeColor in section Main of the configuration file * 3. Section Main, Key ActualName: actual name of the roboter given by the server, if first sequence, this value will be set to RobotName in section Main of the configuration file */ static void SendInitialMessages() throw (IOException, bad_exception); /** * Starts the game as a client or as the RTB MasterServer (automatically found out by the MRC) * @return true, if no error occured in the whole sequence, false if something went wrong and we could not continue playing */ static bool StartGame () throw (RTBException, bad_exception); }; } #endif //RTBINIT_H
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ #import <Cocoa/Cocoa.h> #include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #import "chrome/browser/ui/cocoa/chrome_browser_window.h" #include "chrome/browser/ui/panels/panel.h" #import "ui/base/cocoa/tracking_area.h" class PanelCocoa; @class PanelTitlebarViewCocoa; @interface PanelWindowCocoaImpl : ChromeBrowserWindow { } @end @interface PanelWindowControllerCocoa : NSWindowController <NSWindowDelegate, NSAnimationDelegate> { @private IBOutlet PanelTitlebarViewCocoa* titlebar_view_; scoped_ptr<PanelCocoa> windowShim_; base::scoped_nsobject<NSString> pendingWindowTitle_; NSViewAnimation* boundsAnimation_; BOOL animateOnBoundsChange_; BOOL throbberShouldSpin_; BOOL playingMinimizeAnimation_; float animationStopToShowTitlebarOnly_; BOOL canBecomeKeyWindow_; BOOL activationRequestedByPanel_; BOOL userResizing_; ui::ScopedCrTrackingArea trackingArea_; } - (id)initWithPanel:(PanelCocoa*)window; - (Panel*)panel; - (void)webContentsInserted:(content::WebContents*)contents; - (void)webContentsDetached:(content::WebContents*)contents; - (void)updateWebContentsViewFrame; - (void)disableWebContentsViewAutosizing; - (void)enableWebContentsViewAutosizing; - (void)revealAnimatedWithFrame:(const NSRect&)frame; - (void)updateTitleBar; - (void)updateIcon; - (void)updateThrobber:(BOOL)shouldSpin; - (void)updateTitleBarMinimizeRestoreButtonVisibility; - (void)closePanel; - (void)minimizeButtonClicked:(int)modifierFlags; - (void)restoreButtonClicked:(int)modifierFlags; - (void)setPanelFrame:(NSRect)frame animate:(BOOL)animate; - (void)startDrag:(NSPoint)mouseLocation; - (void)endDrag:(BOOL)cancelled; - (void)drag:(NSPoint)mouseLocation; - (PanelTitlebarViewCocoa*)titlebarView; - (int)titlebarHeightInScreenCoordinates; - (void)onTitlebarMouseClicked:(int)modifierFlags; - (void)onTitlebarDoubleClicked:(int)modifierFlags; - (void)animationDidEnd:(NSAnimation*)animation; - (void)terminateBoundsAnimation; - (BOOL)isAnimatingBounds; - (void)activate; - (void)deactivate; - (void)preventBecomingKeyWindow:(BOOL)prevent; - (void)fullScreenModeChanged:(bool)isFullScreen; - (BOOL)canBecomeKeyWindow; - (BOOL)activationRequestedByPanel; - (void)updateWindowLevel; - (void)updateWindowLevel:(BOOL)panelIsMinimized; - (void)updateWindowCollectionBehavior; - (void)updateTrackingArea; - (void)showShadow:(BOOL)show; - (void)miniaturize; - (BOOL)isMiniaturized; - (BOOL)canResizeByMouseAtCurrentLocation; - (NSRect)frameRectForContentRect:(NSRect)contentRect; - (NSRect)contentRectForFrameRect:(NSRect)frameRect; @end #endif
#ifndef Podd_THaTRACKOUT_h_ #define Podd_THaTRACKOUT_h_ /////////////////////////////////////////////////////////////////////////// // // Class to put the four-vector for tracks from a THaTrackingModule // /////////////////////////////////////////////////////////////////////////// #include "THaPhysicsModule.h" #include <TLorentzVector.h> #include <TString.h> class THaTrackingModule; class THaTrackOut : public THaPhysicsModule { public: THaTrackOut(const char* name, const char* description, const char* src="", Double_t pmass=0.0 /* GeV */ ); virtual ~THaTrackOut(); virtual void Clear( Option_t* opt="" ); virtual EStatus Init( const TDatime& run_time ); virtual Int_t InitOutput( THaOutput* output ); void SetMass ( Double_t m ); void SetSpectrometer( const char* name ); virtual Int_t Process( const THaEvData& evdata ); protected: Double_t fM; // Mass of detected particle TString fSrcName; // Name of module providing the track TLorentzVector* fP4; // momentum four-vector THaTrackingModule* fSrc; // Pointer to trackingmodule public: ClassDef(THaTrackOut,0) // lorentz-vector output module }; #endif