text
stringlengths
4
6.14k
// Copyright 2016 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <memory> #include <vector> #include "Common/CommonTypes.h" #include "VideoBackends/Vulkan/Constants.h" #include "VideoBackends/Vulkan/Texture2D.h" namespace Vulkan { class CommandBufferManager; class ObjectCache; class SwapChain { public: SwapChain(void* native_handle, VkSurfaceKHR surface, bool vsync); ~SwapChain(); // Creates a vulkan-renderable surface for the specified window handle. static VkSurfaceKHR CreateVulkanSurface(VkInstance instance, void* hwnd); // Create a new swap chain from a pre-existing surface. static std::unique_ptr<SwapChain> Create(void* native_handle, VkSurfaceKHR surface, bool vsync); void* GetNativeHandle() const { return m_native_handle; } VkSurfaceKHR GetSurface() const { return m_surface; } VkSurfaceFormatKHR GetSurfaceFormat() const { return m_surface_format; } bool IsVSyncEnabled() const { return m_vsync_enabled; } VkSwapchainKHR GetSwapChain() const { return m_swap_chain; } VkRenderPass GetRenderClearPass() const { return m_render_clear_pass; } VkRenderPass GetRenderAppendPass() const { return m_render_append_pass; } u32 GetWidth() const { return m_width; } u32 GetHeight() const { return m_height; } u32 GetCurrentImageIndex() const { return m_current_swap_chain_image_index; } VkImage GetCurrentImage() const { return m_swap_chain_images[m_current_swap_chain_image_index].image; } Texture2D* GetCurrentTexture() const { return m_swap_chain_images[m_current_swap_chain_image_index].texture.get(); } VkFramebuffer GetCurrentFramebuffer() const { return m_swap_chain_images[m_current_swap_chain_image_index].texture->GetFrameBuffer(); } VkResult AcquireNextImage(VkSemaphore available_semaphore); bool RecreateSurface(void* native_handle); bool ResizeSwapChain(); bool RecreateSwapChain(); // Change vsync enabled state. This may fail as it causes a swapchain recreation. bool SetVSync(bool enabled); private: bool SelectSurfaceFormat(); bool SelectPresentMode(); bool CreateSwapChain(); void DestroySwapChain(); bool CreateRenderPass(); void DestroyRenderPass(); bool SetupSwapChainImages(); void DestroySwapChainImages(); void DestroySurface(); struct SwapChainImage { VkImage image; std::unique_ptr<Texture2D> texture; }; void* m_native_handle; VkSurfaceKHR m_surface = VK_NULL_HANDLE; VkSurfaceFormatKHR m_surface_format = {}; VkPresentModeKHR m_present_mode = VK_PRESENT_MODE_RANGE_SIZE_KHR; bool m_vsync_enabled; VkSwapchainKHR m_swap_chain = VK_NULL_HANDLE; std::vector<SwapChainImage> m_swap_chain_images; u32 m_current_swap_chain_image_index = 0; VkRenderPass m_render_clear_pass = VK_NULL_HANDLE; VkRenderPass m_render_append_pass = VK_NULL_HANDLE; u32 m_width = 0; u32 m_height = 0; }; } // namespace Vulkan
/* WSQL ==== An asynchronous python interface to MySQL --------------------------------------------------------- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __WSQL_COMPAT_H__ #define __WSQL_COMPAT_H__ #define PY_SSIZE_T_CLEAN 1 #include <Python.h> #define Py_ALLOC(s,t) (s *) t.tp_alloc(&t, 0) #define Py_FREE(o) ((PyObject*)o)->ob_type->tp_free((PyObject*)o) #if PY_MAJOR_VERSION >= 3 #define PY3K 1 #define PyString_Check PyUnicode_Check #define PyString_FromStringAndSize PyUnicode_FromStringAndSize #define PyString_FromString PyUnicode_FromString #define PyString_FromFormat PyUnicode_FromFormat #define PyString_AsString PyUnicode_AsUTF8 #define PyString_AsStringAndSize2 PyUnicode_AsUTF8AndSize #define PyString_Type PyUnicode_Type #else #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define _PyBytes_Resize _PyString_Resize #define PyBytes_AS_STRING PyString_AS_STRING inline char *PyString_AsStringAndSize2(PyObject *obj, Py_ssize_t *length) { char* buffer = NULL; PyString_AsStringAndSize(obj, &buffer, length); return buffer; } inline PyObject *PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict) { PyObject *exception = PyErr_NewException(name, base, dict); if (exception) { PyObject* pydoc = PyString_FromString(doc); PyObject_SetAttrString(exception, "__doc__", pydoc); Py_DECREF(pydoc); } return exception; } #endif // PYTHON3 #endif //__WSQL_COMPAT_H__
/* Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) Copyright (C) 2006-2017 Apple Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include "TextEncoding.h" #include <wtf/RefCounted.h> namespace WebCore { class HTMLMetaCharsetParser; class TextCodec; class TextResourceDecoder : public RefCounted<TextResourceDecoder> { public: enum EncodingSource { DefaultEncoding, AutoDetectedEncoding, EncodingFromXMLHeader, EncodingFromMetaTag, EncodingFromCSSCharset, EncodingFromHTTPHeader, UserChosenEncoding, EncodingFromParentFrame }; WEBCORE_EXPORT static Ref<TextResourceDecoder> create(const String& mimeType, const TextEncoding& defaultEncoding = { }, bool usesEncodingDetector = false); WEBCORE_EXPORT ~TextResourceDecoder(); void setEncoding(const TextEncoding&, EncodingSource); const TextEncoding& encoding() const { return m_encoding; } bool hasEqualEncodingForCharset(const String& charset) const; WEBCORE_EXPORT String decode(const char* data, size_t length); WEBCORE_EXPORT String flush(); WEBCORE_EXPORT String decodeAndFlush(const char* data, size_t length); void setHintEncoding(const TextResourceDecoder* parentFrameDecoder); void useLenientXMLDecoding() { m_useLenientXMLDecoding = true; } bool sawError() const { return m_sawError; } private: TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding, bool usesEncodingDetector); enum ContentType { PlainText, HTML, XML, CSS }; // PlainText only checks for BOM. static ContentType determineContentType(const String& mimeType); static const TextEncoding& defaultEncoding(ContentType, const TextEncoding& defaultEncoding); size_t checkForBOM(const char*, size_t); bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer); bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer); bool checkForMetaCharset(const char*, size_t); void detectJapaneseEncoding(const char*, size_t); bool shouldAutoDetect() const; ContentType m_contentType; TextEncoding m_encoding; std::unique_ptr<TextCodec> m_codec; std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; EncodingSource m_source { DefaultEncoding }; const char* m_parentFrameAutoDetectedEncoding { nullptr }; Vector<char> m_buffer; bool m_checkedForBOM { false }; bool m_checkedForCSSCharset { false }; bool m_checkedForHeadCharset { false }; bool m_useLenientXMLDecoding { false }; // Don't stop on XML decoding errors. bool m_sawError { false }; bool m_usesEncodingDetector { false }; }; inline void TextResourceDecoder::setHintEncoding(const TextResourceDecoder* parentFrameDecoder) { if (parentFrameDecoder && parentFrameDecoder->m_source == AutoDetectedEncoding) m_parentFrameAutoDetectedEncoding = parentFrameDecoder->encoding().name(); } } // namespace WebCore
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: fmemio.h,v 1.3 2004/07/09 18:20:29 hubbe Exp $ * * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. * * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL. Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. * * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. * * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. * * Technology Compatibility Kit Test Suite(s) Location: * http://www.helixcommunity.org/content/tck * * Contributor(s): * * ***** END LICENSE BLOCK ***** */ #ifndef _FMEMIO_ #define _FMEMIO_ #include "chxdfmem.h" #include "hxmap.h" #include "bio.h" class FMEMIO : public IO { public: FMEMIO(CHXDataFileMem* mem_file); virtual ~FMEMIO(); virtual LONG32 read(void* buf, LONG32 size); virtual LONG32 write(const void* buf, LONG32 size); virtual off_t seek(off_t off, LONG32 whence); virtual LONG32 close(); virtual off_t file_size(); LONG32 error(); LONG32 flags(); protected: CHXDataFileMem *mMemFile; ULONG32 mFileSize; LONG32 err; LONG32 _flags; }; #endif // _FMEMIO_
/* * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #include <u.h> #include <ureg.h> #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" /* * We have one page table per processor. * * Different processes are distinguished via the VSID field in * the segment registers. As flushing the entire page table is an * expensive operation, we implement an aging algorithm for * mmu pids, with a background kproc to purge stale pids en mass. * * This needs modifications to run on a multiprocessor. */ static ulong ptabsize; /* number of bytes in page table */ static ulong ptabmask; /* hash mask */ /* * VSID is 24 bits. 3 are required to distinguish segments in user * space (kernel space only uses the BATs). pid 0 is reserved. * The top 2 bits of the pid are used as a `color' for the background * pid reclamation algorithm. */ enum { PIDBASE = 1, PIDBITS = 21, COLBITS = 2, PIDMAX = ((1<<PIDBITS)-1), COLMASK = ((1<<COLBITS)-1), }; #define VSID(pid, i) (((pid)<<3)|i) #define PIDCOLOR(pid) ((pid)>>(PIDBITS-COLBITS)) #define PTECOL(color) PTE0(1, VSID(((color)<<(PIDBITS-COLBITS)), 0), 0, 0) void mmuinit(void) { int lhash, mem, i; ulong memsize; memsize = conf.npage * BY2PG; if(ptabsize == 0) { /* heuristically size the hash table */ lhash = 10; mem = (1<<23); while(mem < memsize) { lhash++; mem <<= 1; } ptabsize = (1<<(lhash+6)); ptabmask = (1<<lhash)-1; } m->ptabbase = (ulong)xspanalloc(ptabsize, 0, ptabsize); /* set page table base address */ putsdr1(PADDR(m->ptabbase) | (ptabmask>>10)); m->mmupid = PIDBASE; m->sweepcolor = 0; m->trigcolor = COLMASK; for(i = 0; i < 16; i++) putsr(i<<28, 0); } static int work(void*) { return PIDCOLOR(m->mmupid) == m->trigcolor; } void mmusweep(void*) { Proc *p; int i, x, sweepcolor; ulong *ptab, *ptabend, ptecol; for(;;) { if(PIDCOLOR(m->mmupid) != m->trigcolor) sleep(&m->sweepr, work, nil); sweepcolor = m->sweepcolor; x = splhi(); p = proctab(0); for(i = 0; i < conf.nproc; i++, p++) if(PIDCOLOR(p->mmupid) == sweepcolor) p->mmupid = 0; splx(x); ptab = (ulong*)m->ptabbase; ptabend = (ulong*)(m->ptabbase+ptabsize); ptecol = PTECOL(sweepcolor); while(ptab < ptabend) { if((*ptab & PTECOL(3)) == ptecol){ *ptab = 0; } ptab += 2; } m->sweepcolor = (sweepcolor+1) & COLMASK; m->trigcolor = (m->trigcolor+1) & COLMASK; } } int newmmupid(void) { int pid, newcolor, i, x; Proc *p; pid = m->mmupid++; if(m->mmupid > PIDMAX){ /* Used up all mmupids, start again from first. Flush the tlb * to delete any entries with old pids remaining, then reassign * all pids. */ m->mmupid = PIDBASE; x = splhi(); tlbflushall(); p = proctab(0); for(i = 0; i < conf.nproc; i++, p++) p->mmupid = 0; splx(x); wakeup(&m->sweepr); } newcolor = PIDCOLOR(m->mmupid); if(newcolor != PIDCOLOR(pid)) { if(newcolor == m->sweepcolor) { /* desperation time. can't block here. punt to fault/putmmu */ print("newmmupid: %uld: no free mmu pids\n", up->pid); if(m->mmupid == PIDBASE) m->mmupid = PIDMAX; else m->mmupid--; pid = 0; } else if(newcolor == m->trigcolor) wakeup(&m->sweepr); } up->mmupid = pid; return pid; } void flushmmu(void) { int x; x = splhi(); up->newtlb = 1; mmuswitch(up); splx(x); } /* * called with splhi */ void mmuswitch(Proc *p) { int i, mp; ulong r; if(p->kp) { for(i = 0; i < 8; i++) putsr(i<<28, 0); return; } if(p->newtlb) { p->mmupid = 0; p->newtlb = 0; } mp = p->mmupid; if(mp == 0) mp = newmmupid(); for(i = 0; i < 8; i++){ r = VSID(mp, i)|BIT(1)|BIT(2); putsr(i<<28, r); } } void mmurelease(Proc* p) { p->mmupid = 0; } void putmmu(ulong va, ulong pa, Page *pg) { int mp; char *ctl; ulong *p, *ep, *q, pteg; ulong vsid, hash; ulong ptehi, x; static ulong pva; /* * If mmupid is 0, mmuswitch/newmmupid was unable to assign us * a pid, hence we faulted. Keep calling sched() until the mmusweep * proc catches up, and we are able to get a pid. */ while((mp = up->mmupid) == 0) sched(); vsid = VSID(mp, va>>28); hash = (vsid ^ ((va>>12)&0xffff)) & ptabmask; ptehi = PTE0(1, vsid, 0, va); pteg = m->ptabbase + BY2PTEG*hash; p = (ulong*)pteg; ep = (ulong*)(pteg+BY2PTEG); q = nil; while(p < ep) { x = p[0]; if(x == ptehi) { q = p; break; } if(q == nil && (x & BIT(0)) == 0) q = p; p += 2; } if(q == nil) { q = (ulong*)(pteg+m->slotgen); m->slotgen = (m->slotgen + BY2PTE) & (BY2PTEG-1); } if (q[0] != ptehi || q[1] != pa){ tlbflush(va); m->tlbpurge++; } q[0] = ptehi; q[1] = pa; ctl = &pg->cachectl[m->machno]; switch(*ctl) { case PG_NEWCOL: default: panic("putmmu: %d\n", *ctl); break; case PG_TXTFLUSH: dcflush((void*)pg->va, BY2PG); icflush((void*)pg->va, BY2PG); *ctl = PG_NOFLUSH; break; case PG_NOFLUSH: break; } } void checkmmu(ulong, ulong) { } void countpagerefs(ulong*, int) { } /* * Return the number of bytes that can be accessed via KADDR(pa). * If pa is not a valid argument to KADDR, return 0. */ ulong cankaddr(ulong pa) { if(pa >= -KZERO) return 0; return -KZERO - pa; }
/* Copyright (C) 1994 - 2003 artofcode LLC. All rights reserved. This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861. */ /* $Id: gp_mac.h,v 1.5 2003/08/15 20:19:21 giles Exp $ */ #ifndef gp_mac_INCLUDED # define gp_mac_INCLUDED /* no special definitions for macos */ #endif /* gp_mac_INCLUDED */
/** * @file chargen.h * @brief Character generator protocol * * @section License * * Copyright (C) 2010-2013 Oryx Embedded. All rights reserved. * * This file is part of CycloneTCP Open. * * 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. * * @author Oryx Embedded (www.oryx-embedded.com) * @version 1.3.8 **/ #ifndef _CHARGEN_H #define _CHARGEN_H //Dependencies #include "tcp_ip_stack.h" #include "socket.h" //Stack size required to run the chargen service #ifndef CHARGEN_SERVICE_STACK_SIZE #define CHARGEN_SERVICE_STACK_SIZE 600 #elif (CHARGEN_SERVICE_STACK_SIZE < 1) #error CHARGEN_SERVICE_STACK_SIZE parameter is invalid #endif //Priority at which the chargen service should run #ifndef CHARGEN_SERVICE_PRIORITY #define CHARGEN_SERVICE_PRIORITY 1 #elif (CHARGEN_SERVICE_PRIORITY < 0) #error CHARGEN_SERVICE_PRIORITY parameter is invalid #endif //Size of the buffer for input/output operations #ifndef CHARGEN_BUFFER_SIZE #define CHARGEN_BUFFER_SIZE 1500 #elif (CHARGEN_BUFFER_SIZE < 1) #error CHARGEN_BUFFER_SIZE parameter is invalid #endif //Maximum time the TCP chargen server will wait before closing the connection #ifndef CHARGEN_TIMEOUT #define CHARGEN_TIMEOUT 20000 #elif (CHARGEN_TIMEOUT < 1) #error CHARGEN_TIMEOUT parameter is invalid #endif //Chargen service port #define CHARGEN_PORT 19 /** * @brief Chargen service context **/ typedef struct { Socket *socket; char_t buffer[CHARGEN_BUFFER_SIZE]; } ChargenServiceContext; //TCP chargen service related functions error_t tcpChargenStart(void); void tcpChargenListenerTask(void *param); void tcpChargenConnectionTask(void *param); //UDP chargen service related functions error_t udpChargenStart(void); void udpChargenTask(void *param); #endif
#ifndef _GAP_OPTIONS_H #define _GAP_OPTIONS_H #include <windows.h> void SaveOptions(void); void LoadOptions(void); int CreateOptionsDlg(HWND hwnd); void SetCheckBox(HWND hwnd, int cbId, BOOL cbVal); BOOL GetCheckBox(HWND hwnd, int cbId); void EnableApply(HWND hwnd); void DisableApply(HWND hwnd); void TrackPropPage(HWND hwnd, int index); #endif
/* * F-List Pidgin - a libpurple protocol plugin for F-Chat * * Copyright 2011 F-List Pidgin developers. * * This file is part of F-List Pidgin. * * F-List Pidgin 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. * * F-List Pidgin 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 F-List Pidgin. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FLIST_PROFILE_H #define FLIST_PROFILE_H #include "f-list.h" gboolean flist_process_PRD(PurpleConnection *, JsonObject *); void flist_profile_process_flood(FListAccount *, const gchar*); void flist_profile_load(PurpleConnection *); void flist_profile_unload(PurpleConnection *); #endif /* F_LIST_PROFILE_H */
/* * Copyright (C) 2006 Ingenic Semiconductor Inc. * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope 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 <linux/init.h> #include <linux/io.h> #include <linux/ioport.h> void __init plat_mem_setup(void) { /* use IO_BASE, so that we can use phy addr on hard manual * directly with in(bwlq)/out(bwlq) in io.h. */ set_io_port_base(IO_BASE); ioport_resource.start = 0x00000000; ioport_resource.end = 0xffffffff; iomem_resource.start = 0x00000000; iomem_resource.end = 0xffffffff; return; }
#pragma once BOOL SetWindowsHooksEx_Injection();
#pragma once #include "Renderer2D_Common.h" #include "ImageResource.h" struct SDL_Surface; struct SDL_Texture; struct SDL_Renderer; namespace Vanguard { class SDLImageResource : public ImageResource { friend class Renderer2D; TYPE_DECLARATION(SDLImageResource, ImageResource); private: SDL_Surface* sdlSurface; std::unordered_map<SDL_Renderer*, SDL_Texture*> sdlTextures; public: SDLImageResource() : ImageResource() , sdlSurface(nullptr) { } ~SDLImageResource() {} SDL_Texture* getSDLTexture(SDL_Renderer* sdlRenderer); // Implement Resource virtual bool LoadResource() override; virtual bool UnloadResource() override; virtual bool IsLoaded() override; virtual size_t GetSize() override; // Implement ImageResource virtual int GetStride() override; virtual int GetPixelDepth() override; }; }
/* * $Id: io.c,v 1.1.1.1 2006/01/06 00:51:08 jsantiago Exp $ * Copyright (C) 2000 YAEGASHI Takeshi * Typical I/O routines for HD64461 system. */ #include <linux/config.h> #include <asm/io.h> #include <asm/hd64461/hd64461.h> #define MEM_BASE (CONFIG_HD64461_IOBASE - HD64461_STBCR) static __inline__ unsigned long PORT2ADDR(unsigned long port) { /* 16550A: HD64461 internal */ if (0x3f8<=port && port<=0x3ff) return CONFIG_HD64461_IOBASE + 0x8000 + ((port-0x3f8)<<1); if (0x2f8<=port && port<=0x2ff) return CONFIG_HD64461_IOBASE + 0x7000 + ((port-0x2f8)<<1); #ifdef CONFIG_HD64461_ENABLER /* NE2000: HD64461 PCMCIA channel 0 (I/O) */ if (0x300<=port && port<=0x31f) return 0xba000000 + port; /* ide0: HD64461 PCMCIA channel 1 (memory) */ /* On HP690, CF in slot 1 is configured as a memory card device. See CF+ and CompactFlash Specification for the detail of CF's memory mapped addressing. */ if (0x1f0<=port && port<=0x1f7) return 0xb5000000 + port; if (port == 0x3f6) return 0xb50001fe; if (port == 0x3f7) return 0xb50001ff; /* ide1 */ if (0x170<=port && port<=0x177) return 0xba000000 + port; if (port == 0x376) return 0xba000376; if (port == 0x377) return 0xba000377; #endif /* ??? */ if (port < 0xf000) return 0xa0000000 + port; /* PCMCIA channel 0, I/O (0xba000000) */ if (port < 0x10000) return 0xba000000 + port - 0xf000; /* HD64461 internal devices (0xb0000000) */ if (port < 0x20000) return CONFIG_HD64461_IOBASE + port - 0x10000; /* PCMCIA channel 0, I/O (0xba000000) */ if (port < 0x30000) return 0xba000000 + port - 0x20000; /* PCMCIA channel 1, memory (0xb5000000) */ if (port < 0x40000) return 0xb5000000 + port - 0x30000; /* Whole physical address space (0xa0000000) */ return 0xa0000000 + (port & 0x1fffffff); } static inline void delay(void) { ctrl_inw(0xa0000000); } unsigned char hd64461_inb(unsigned long port) { return *(volatile unsigned char*)PORT2ADDR(port); } unsigned char hd64461_inb_p(unsigned long port) { unsigned long v = *(volatile unsigned char*)PORT2ADDR(port); delay(); return v; } unsigned short hd64461_inw(unsigned long port) { return *(volatile unsigned short*)PORT2ADDR(port); } unsigned int hd64461_inl(unsigned long port) { return *(volatile unsigned long*)PORT2ADDR(port); } void hd64461_outb(unsigned char b, unsigned long port) { *(volatile unsigned char*)PORT2ADDR(port) = b; } void hd64461_outb_p(unsigned char b, unsigned long port) { *(volatile unsigned char*)PORT2ADDR(port) = b; delay(); } void hd64461_outw(unsigned short b, unsigned long port) { *(volatile unsigned short*)PORT2ADDR(port) = b; } void hd64461_outl(unsigned int b, unsigned long port) { *(volatile unsigned long*)PORT2ADDR(port) = b; } void hd64461_insb(unsigned long port, void *buffer, unsigned long count) { volatile unsigned char* addr=(volatile unsigned char*)PORT2ADDR(port); unsigned char *buf=buffer; while(count--) *buf++=*addr; } void hd64461_insw(unsigned long port, void *buffer, unsigned long count) { volatile unsigned short* addr=(volatile unsigned short*)PORT2ADDR(port); unsigned short *buf=buffer; while(count--) *buf++=*addr; } void hd64461_insl(unsigned long port, void *buffer, unsigned long count) { volatile unsigned long* addr=(volatile unsigned long*)PORT2ADDR(port); unsigned long *buf=buffer; while(count--) *buf++=*addr; } void hd64461_outsb(unsigned long port, const void *buffer, unsigned long count) { volatile unsigned char* addr=(volatile unsigned char*)PORT2ADDR(port); const unsigned char *buf=buffer; while(count--) *addr=*buf++; } void hd64461_outsw(unsigned long port, const void *buffer, unsigned long count) { volatile unsigned short* addr=(volatile unsigned short*)PORT2ADDR(port); const unsigned short *buf=buffer; while(count--) *addr=*buf++; } void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count) { volatile unsigned long* addr=(volatile unsigned long*)PORT2ADDR(port); const unsigned long *buf=buffer; while(count--) *addr=*buf++; } unsigned short hd64461_readw(unsigned long addr) { return *(volatile unsigned short*)(MEM_BASE+addr); } void hd64461_writew(unsigned short b, unsigned long addr) { *(volatile unsigned short*)(MEM_BASE+addr) = b; }
//**************************************************************************** // Copyright (C) 2006-2007 PEAK System-Technik GmbH // // linux@peak-system.com // www.peak-system.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. // // Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de) // Contributions: Oliver Hartkopp (oliver.hartkopp@volkswagen.de) //**************************************************************************** //**************************************************************************** // // pcan_netdev.h - CAN network device support defines / prototypes // // $Id: pcan_netdev.h 753 2014-01-21 10:45:03Z stephane $ // // For CAN netdevice / socketcan specific questions please check the // Mailing List <socketcan-users@lists.berlios.de> // Project homepage http://developer.berlios.de/projects/socketcan // //**************************************************************************** #ifndef PCAN_NETDEV_H #define PCAN_NETDEV_H #include <linux/netdevice.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) #include <linux/can/dev.h> #endif #define CAN_NETDEV_NAME "can%d" #ifndef LINUX_26 #define netdev_priv(dev) ((dev)->priv) #endif /* private data structure for netdevice */ /* "struct can_priv" is defined since 2.6.31 in include/linux/net/can/dev.h */ /* => rename our struct can_priv into struct pcan_priv and set kernel */ /* can_priv as first member */ struct pcan_priv { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) struct net_device_stats stats; /* standard netdev statistics */ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) struct can_priv can; #endif struct pcandev *pdev; /* back reference to PCAN device */ }; struct net_device_stats *pcan_netdev_get_stats(struct net_device *dev); int pcan_netdev_register(struct pcandev *dev); int pcan_netdev_unregister(struct pcandev *dev); int pcan_netdev_rx(struct pcandev *dev, struct can_frame *cf, struct timeval *tv); #endif /* PCAN_NETDEV_H */
#ifndef SVO_RELOCALIZER_FERN_H_PRVK2HPG #define SVO_RELOCALIZER_FERN_H_PRVK2HPG #include <vector> #include <opencv2/opencv.hpp> namespace reloc { class Fern { public: Fern (int num_tests, int max_x, int max_y); virtual ~Fern (); uint32_t evaluetePatch (const cv::Mat &patch); int getMaxX () { return max_x_; }; int getMaxY () { return max_y_; }; int getNumTests() { return operants1.size(); }; private: // First operant positions std::vector <cv::Point2i> operants1; // Second operant positions std::vector <cv::Point2i> operants2; int max_x_; int max_y_; }; } /* reloc */ #endif /* end of include guard: SVO_RELOCALIZER_FERN_H_PRVK2HPG */
/* ZynAddSubFX - a software synthesizer NotePool.h - Pool of Synthesizer Engines And Note Instances Copyright (C) 2016 Mark McCurry 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. */ #pragma once #include <stdint.h> #include <functional> #include "../globals.h" //Expected upper bound of synths given that max polyphony is hit #define EXPECTED_USAGE 3 namespace zyn { typedef uint8_t note_t; //Global MIDI note definition struct LegatoParams; class NotePool { public: //Currently this wastes a ton of bits due to the legatoMirror flag struct NoteDescriptor { //acceptable overlap after 2 minutes //run time at 48kHz 8 samples per buffer //19 bit minimum uint32_t age; note_t note; uint8_t sendto; //max of 16 kit elms and 3 kit items per uint8_t size; uint8_t status; bool legatoMirror; bool operator==(NoteDescriptor); //status checks bool playing(void) const; bool off(void) const; bool sustained(void) const; bool released(void) const; //status transitions void setStatus(uint8_t s); void doSustain(void); bool canSustain(void) const; void makeUnsustainable(void); }; //To be pedantic this wastes 2 or 6 bytes per descriptor //depending on 32bit/64bit alignment rules struct SynthDescriptor { SynthNote *note; uint8_t type; uint8_t kit; }; //Pool of notes NoteDescriptor ndesc[POLYPHONY]; SynthDescriptor sdesc[POLYPHONY*EXPECTED_USAGE]; bool needs_cleaning; //Iterators struct activeNotesIter { SynthDescriptor *begin() {return _b;}; SynthDescriptor *end() {return _e;}; SynthDescriptor *_b; SynthDescriptor *_e; }; struct activeDescIter { activeDescIter(NotePool &_np):np(_np) { int off=0; for(int i=0; i<POLYPHONY; ++i, ++off) if(np.ndesc[i].status == 0) break; _end = np.ndesc+off; } NoteDescriptor *begin() {return np.ndesc;}; NoteDescriptor *end() { return _end; }; NoteDescriptor *_end; NotePool &np; }; struct constActiveDescIter { constActiveDescIter(const NotePool &_np):np(_np) { int off=0; for(int i=0; i<POLYPHONY; ++i, ++off) if(np.ndesc[i].status == 0) break; _end = np.ndesc+off; } const NoteDescriptor *begin() const {return np.ndesc;}; const NoteDescriptor *end() const { return _end; }; const NoteDescriptor *_end; const NotePool &np; }; activeNotesIter activeNotes(NoteDescriptor &n); activeDescIter activeDesc(void); constActiveDescIter activeDesc(void) const; //Counts of descriptors used for tests int usedNoteDesc(void) const; int usedSynthDesc(void) const; NotePool(void); //Operations void insertNote(note_t note, uint8_t sendto, SynthDescriptor desc, bool legato=false); void insertLegatoNote(note_t note, uint8_t sendto, SynthDescriptor desc); void upgradeToLegato(void); void applyLegato(note_t note, const LegatoParams &par); void makeUnsustainable(note_t note); bool full(void) const; bool synthFull(int sdesc_count) const; //Note that isn't KEY_PLAYING or KEY_RELEASED_AND_SUSTAINING bool existsRunningNote(void) const; int getRunningNotes(void) const; void enforceKeyLimit(int limit); void releasePlayingNotes(void); void releaseNote(note_t note); void release(NoteDescriptor &d); void killAllNotes(void); void killNote(note_t note); void kill(NoteDescriptor &d); void kill(SynthDescriptor &s); void entomb(NoteDescriptor &d); void cleanup(void); void dump(void); }; }
#pragma once #include "common.h" #include "exefs.h" #define ESSENTIAL_NAME "essential.exefs" // magic number for essential backup #define ESSENTIAL_MAGIC 'n', 'a', 'n', 'd', '_', 'h', 'd', 'r', 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00 // size of /ro/sys/HWCAL0.dat and /ro/sys/HWCAL1.dat #define SIZE_HWCAL 0x9D0 // /rw/sys/LocalFriendCodeSeed_B (/_A) file // see: http://3dbrew.org/wiki/Nandrw/sys/LocalFriendCodeSeed_B typedef struct { u8 signature[0x100]; u8 unknown[0x8]; // normally zero u8 codeseed[0x8]; // the actual data } __attribute__((packed)) LocalFriendCodeSeed; // /private/movable.sed file // see: http://3dbrew.org/wiki/Nand/private/movable.sed typedef struct { u8 magic[0x4]; // "SEED" u8 indicator[0x4]; // uninitialized all zero, otherwise u8[1] nonzero LocalFriendCodeSeed codeseed_data; u8 keyy_high[8]; u8 unknown[0x10]; u8 cmac[0x10]; } __attribute__((packed)) MovableSed; // /rw/sys/SecureInfo_A (/_B) file // see: http://3dbrew.org/wiki/Nandrw/sys/SecureInfo_A typedef struct { u8 signature[0x100]; u8 region; u8 unknown; char serial[0xF]; } __attribute__((packed)) SecureInfo; // includes all essential system files // (this is of our own making) typedef struct { ExeFsHeader header; u8 nand_hdr[0x200]; SecureInfo secinfo; u8 padding_secinfo[0x200 - (sizeof(SecureInfo)%0x200)]; MovableSed movable; u8 padding_movable[0x200 - (sizeof(MovableSed)%0x200)]; LocalFriendCodeSeed frndseed; u8 padding_frndseed[0x200 - (sizeof(LocalFriendCodeSeed)%0x200)]; u8 nand_cid[0x10]; u8 padding_nand_cid[0x200 - 0x10]; u8 otp[0x100]; u8 padding_otp[0x200 - 0x100]; u8 hwcal0[SIZE_HWCAL]; u8 padding_hwcal0[0x200 - (SIZE_HWCAL%0x200)]; u8 hwcal1[SIZE_HWCAL]; u8 padding_hwcal1[0x200 - (SIZE_HWCAL%0x200)]; } __attribute__((packed)) EssentialBackup;
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); __visible 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"))) = { { 0xb95b937f, __VMLINUX_SYMBOL_STR(module_layout) }, { 0x19cbafdb, __VMLINUX_SYMBOL_STR(unregister_nls) }, { 0x474f6707, __VMLINUX_SYMBOL_STR(__register_nls) }, { 0x2e5810c6, __VMLINUX_SYMBOL_STR(__aeabi_unwind_cpp_pr1) }, { 0xb1ad28e0, __VMLINUX_SYMBOL_STR(__gnu_mcount_nc) }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends="; MODULE_INFO(srcversion, "1CCE0E6A0952466AB37E5D0");
/*************************************************************************** qgswcsdataitems.h --------------------- begin : 2 July, 2012 copyright : (C) 2012 by Radim Blazek email : radim dot blazek at 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. * * * ***************************************************************************/ #ifndef QGSWCSDATAITEMS_H #define QGSWCSDATAITEMS_H #include "qgsdataitem.h" #include "qgsdatasourceuri.h" #include "qgswcscapabilities.h" class QgsWCSConnectionItem : public QgsDataCollectionItem { Q_OBJECT public: QgsWCSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri ); ~QgsWCSConnectionItem(); QVector<QgsDataItem*> createChildren() override; virtual bool equal( const QgsDataItem *other ) override; virtual QList<QAction*> actions() override; QgsWcsCapabilities mCapabilities; QVector<QgsWcsCoverageSummary> mLayerProperties; public slots: void editConnection(); void deleteConnection(); private: QString mUri; }; // WCS Layers may be nested, so that they may be both QgsDataCollectionItem and QgsLayerItem // We have to use QgsDataCollectionItem and support layer methods if necessary class QgsWCSLayerItem : public QgsLayerItem { Q_OBJECT public: QgsWCSLayerItem( QgsDataItem* parent, const QString& name, const QString& path, const QgsWcsCapabilitiesProperty& capabilitiesProperty, const QgsDataSourceURI& dataSourceUri, const QgsWcsCoverageSummary& coverageSummary ); ~QgsWCSLayerItem(); QString createUri(); QgsWcsCapabilitiesProperty mCapabilities; QgsDataSourceURI mDataSourceUri; QgsWcsCoverageSummary mCoverageSummary; }; class QgsWCSRootItem : public QgsDataCollectionItem { Q_OBJECT public: QgsWCSRootItem( QgsDataItem* parent, const QString& name, const QString& path ); ~QgsWCSRootItem(); QVector<QgsDataItem*> createChildren() override; virtual QList<QAction*> actions() override; virtual QWidget * paramWidget() override; public slots: void connectionsChanged(); void newConnection(); }; #endif // QGSWCSDATAITEMS_H
/* * $Id: c_thstmv.c,v 1.2 2003-03-03 16:16:24 haley Exp $ */ #include <math.h> #include <stdio.h> #include <string.h> #include <ncarg/ncargC.h> #include <ncarg/gks.h> #define NDIM 320 #define NCLS 17 #define NWRK 374 #define IWTYPE 1 #define WKID 1 main() { /* * PURPOSE To provide a demonstration of the Histogram * utility when special flagged values occur in * the input data. * * USAGE CALL THSTMV (IERROR) * * ARGUMENTS * * * I/O If the test is successful, the message * * HISTGR TEST SUCCESSFUL . . . SEE PLOT * TO VERIFY PERFORMANCE * * is written on unit 6. * * Verify success by examing the plot produced. * * PRECISION Single * * REQUIRED LIBRARY HISTGR * FILES * * REQUIRED GKS LEVEL 0A * * LANGUAGE FORTRAN 77 * * HISTORY Written by Bob Lackman, October 1993. * * ALGORITHM THSTMV computes data and calls HISTGR * with special values * * * Array DAT1 is filled with values to be used as input for HISTGR */ /* * NWRK = NDIM + 3*(NCLS+1) */ float dat1[2][NDIM], x, work[NWRK]; float class[NCLS+1]; float array[2]; int i, j, l, iflag, nclass, npts; char ifc[2]; /* * Open GKS. */ gopen_gks ("stdout",0); gopen_ws (WKID, NULL, IWTYPE); gactivate_ws(WKID); /* * Change the Plotchar special character code from a : to a @ */ strcpy( ifc, "@" ); c_pcsetc("FC",ifc); /* * Change the print font to the high quality filled times roman. */ c_pcsetc("FN","times-roman"); /* * Plot 1: IFLAG = 0, input values are sorted into 11 equal classes */ iflag = 0; nclass = 11; npts = 320; for( i = 0; i < npts; i++ ) { for( j = 0; j < 2; j++ ) { dat1[j][i] = 0.; } } for( i = 0; i < npts; i++ ) { x = (float)i; dat1[0][i] = 10. * log10(0.1*x+1.); } /* * Put in some special values */ dat1[0][6] = -999.; dat1[0][43] = -999.; dat1[0][78] = -999.; for( l = 199; l < 320; l++ ) { dat1[0][l] = -999.; } /* * (First call HSTOPL("DEF=ON") to activate all default options.) */ c_hstopl("DE=ON"); /* * Then call HSTOPR to activate special value checking */ array[0] = -999.; array[1] = 1.e-6; c_hstopr("MV=ON",array,2); /* * Call HSTOPL with NMV = ON, so normalization is by NPTS-MISS. */ c_hstopl("NM=ON"); /* * Call HSTOPL with PMV = ON, so NPTS and MISS are written on the plot. */ c_hstopl("PM=ON"); /* * Turn on the printing of the option list. */ c_hstopl("LI=ON"); /* * Print a main title. */ c_hstopc("TIT=ON","Demonstration plot for Histogram. Special value = -999.",0,0); c_histgr((float *)dat1, NDIM, npts, iflag, class, nclass, work, NWRK); /* * Plot 2: IFLAG = 1, input values are sorted into a defined set of * 8 classes. */ iflag = 1; nclass = 8; class[0] = -0.6; for( i = 0; i < nclass; i++ ) { class[i+1] = class[i] + 0.20; } /* * Create some input data. */ x = 0.; for( i = 0; i < npts; i++ ) { dat1[0][i] = sin(x); x = x + .02; } /* * Put in some special values */ dat1[0][6] = -999.; dat1[0][43]= -999.; dat1[0][78]= -999.; for( l = 99; l < 220; l++ ) { dat1[0][l] = -999.; } /* * (First call HSTOPL("DEF=ON") to activate all default options.) */ c_hstopl("DE=ON"); /* * Then call HSTOPR to activate special value checking */ array[0] = -999.; array[1] = 1.e-6; c_hstopr("MV=ON",array,2); /* * Call HSTOPL with NMV = OFF so normalization is relative to NPTS. */ c_hstopl("NM=OF"); /* * Call HSTOPL with PMV = ON, so NPTS and MISS are written on the plot. */ c_hstopl("PM=ON"); c_hstopc("TIT=ON","Demonstration plot for Histogram. Normalize to the original number of points.",0,0); c_histgr((float *)dat1, NDIM, npts, iflag, class, nclass, work, NWRK); /* * Plot 3: IFLAG = 1, define the CLASS values so as to capture * the missing value counts. */ iflag = 1; nclass = 7; /* * Set the first class bin between -1000. and -0.6. Missing values * of -999. will fall into this bin. */ class[0] = -1000.; class[1] = -0.6; for( i = 1; i < nclass; i++ ) { class[i+1] = class[i] + 0.30; } npts = 320; for( i = 0; i < npts; i++ ) { for( j = 0; j < 2; j++ ) { dat1[j][i]=0.; } } /* * Define some data */ x = 0.; for( i = 0; i < npts; i++ ) { dat1[0][i] = sin(x); x = x + .02; } /* * Put in some special values */ dat1[0][6] = -999.; dat1[0][43] = -999.; dat1[0][78] = -999.; for( l = 199; l < 320; l++ ) { dat1[0][l] = -999.; } /* * (First call HSTOPL("DEF=ON") to activate all default options.) */ c_hstopl("DE=ON"); /* * Label the histogram bar endpoints */ c_hstopl("MI=OF"); /* * Convert the class label format to F7.1 */ c_hstopc("FOR=ON","(F7.1)",9,7); /* * To see the missing values in a histogram bar. Choose CLASS * values so that the missing value indicator becomes a bar * and use MVA = OFF (default.) */ c_hstopc("TIT=ON","Demo plot for special value in Histogram. Title length has been increased to 96 characters.",0,0); c_histgr((float *)dat1, NDIM, npts, iflag, class, nclass, work, NWRK); printf( "HISTGR TEST SUCCESSFUL\nSEE PLOT TO VERIFY PERFORMANCE\n"); /* * Close GKS. */ gdeactivate_ws(WKID); gclose_ws(WKID); gclose_gks(); }
#include <au_channel.h> #include <stdio.h> #include <stdlib.h> AuChanError AuChannelOpen ( hAudioChannel* audioChannel, const char* filename, AuChanMode mode, AuChanType* type, AuChanInfo* info) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelSeek ( hAudioChannel audioChannel, int nSamples ) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } void AuChannelClose (hAudioChannel audioChannel) { } AuChanError AuChannelWriteLong( hAudioChannel audioChannel, const long* samples, int nBytes, int* written) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelWriteShort( hAudioChannel audioChannel, const short* samples, int nSamples, int* written) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelWriteFloat( hAudioChannel audioChannel, const float* samples, int nSamples, int* written) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelWriteBytes( hAudioChannel audioChannel, const char* bytes, int nBytes, int* written) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelReadShort( hAudioChannel audioChannel, short* samples, int nSamples, int* written) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelReadFloat( hAudioChannel audioChannel, float* samples, int nSamples, int* read) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelReadBytes( hAudioChannel audioChannel, char* bytes, int nBytes, int* read) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelSetLevel( hAudioChannel audioChannel, int volume) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } AuChanError AuChannelParseFormatString(const char* format, AuChanInfo* info, AuChanType* type) { return AU_CHAN_UNIMPLEMENTED_FEATURE; } void AuChannelGetLibInfo (AuChanLibInfo* libInfo) { }
// // ProfilePreferencesViewController.h // iTerm // // Created by George Nachman on 4/8/14. // // #import "iTermPreferencesBaseViewController.h" #import "ProfileModel.h" @class ProfileModel; // Posted when the name field ends editing in the "get info" dialog. The object is the guid of the // profile that may have changed. extern NSString *const kProfileSessionNameDidEndEditing; @protocol ProfilePreferencesViewControllerDelegate <NSObject> - (ProfileModel *)profilePreferencesModel; @end @interface ProfilePreferencesViewController : iTermPreferencesBaseViewController @property(nonatomic, assign) IBOutlet id<ProfilePreferencesViewControllerDelegate> delegate; // Size of tab view. @property(nonatomic, readonly) NSSize size; - (void)layoutSubviewsForEditCurrentSessionMode; - (Profile *)selectedProfile; - (void)selectGuid:(NSString *)guid; - (void)selectFirstProfileIfNecessary; - (void)changeFont:(id)fontManager; - (void)selectGeneralTab; - (void)openToProfileWithGuid:(NSString *)guid selectGeneralTab:(BOOL)selectGeneralTab; - (void)openToProfileWithGuidAndEditHotKey:(NSString *)guid; // Update views for changed backing state. - (void)refresh; - (void)resizeWindowForCurrentTab; - (void)windowWillClose:(NSNotification *)notification; @end
/* * Philips outdoor temperature sensor -- used with various Philips clock * radios (tested on AJ3650) * * Not tested, but these should also work: AJ7010, AJ260 ... maybe others? * * A complete message is 112 bits: * 4-bit initial preamble, always 0 * 4-bit packet separator, always 0, followed by 32-bit data packet. * Packets are repeated 3 times for 108 bits total. * * 32-bit data packet format: * * 0001cccc tttttttt tt000000 0b0?ssss * * c - channel: 0=channel 2, 2=channel 1, 4=channel 3 (4 bits) * t - temperature in Celsius: subtract 500 and divide by 10 (10 bits) * b - battery status: 0 = OK, 1 = LOW (1 bit) * ? - unknown: always 1 in every packet I've seen (1 bit) * s - CRC: non-standard CRC-4, poly 0x9, init 0x1 * * Pulse width: * Short: 2000 us = 0 * Long: 6000 us = 1 * Gap width: * Short: 6000 us * Long: 2000 us * Gap width between packets: 29000 us * * Presumably the 4-bit preamble is meant to be a sync of some sort, * but it has the exact same pulse/gap width as a short pulse, and * gets processed as data. * * Copyright (C) 2017 Chris Coffey <kpuc@sdf.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include "decoder.h" #define PHILIPS_BITLEN 112 #define PHILIPS_PACKETLEN 4 #define PHILIPS_STARTNIBBLE 0x0 /* Map channel values to their real-world counterparts */ static const uint8_t channel_map[] = { 2, 0, 1, 0, 3 }; static int philips_callback(r_device *decoder, bitbuffer_t *bitbuffer) { uint8_t *bb; unsigned int i; uint8_t a, b, c; uint8_t packet[PHILIPS_PACKETLEN]; uint8_t c_crc; uint8_t channel, battery_status; int tmp; float temperature; data_t *data; /* Get the time */ bitbuffer_invert(bitbuffer); /* Correct number of rows? */ if (bitbuffer->num_rows != 1) { if (decoder->verbose > 1) { fprintf(stderr, "%s: wrong number of rows (%d)\n", __func__, bitbuffer->num_rows); } return 0; } /* Correct bit length? */ if (bitbuffer->bits_per_row[0] != PHILIPS_BITLEN) { if (decoder->verbose > 1) { fprintf(stderr, "%s: wrong number of bits (%d)\n", __func__, bitbuffer->bits_per_row[0]); } return 0; } bb = bitbuffer->bb[0]; /* Correct start sequence? */ if ((bb[0] >> 4) != PHILIPS_STARTNIBBLE) { if (decoder->verbose > 1) { fprintf(stderr, "%s: wrong start nibble\n", __func__); } return 0; } /* Compare and combine the 3 repeated packets, with majority wins */ for (i = 0; i < PHILIPS_PACKETLEN; i++) { a = bb[i+1]; /* First packet - on byte boundary */ b = (bb[i+5] << 4) | (bb[i+6] >> 4 & 0xf); /* Second packet - not on byte boundary */ c = bb[i+10]; /* Third packet - on byte boundary */ packet[i] = (a & b) | (b & c) | (a & c); } /* If debug enabled, print the combined majority-wins packet */ if (decoder->verbose > 1) { fprintf(stderr, "%s: combined packet = ", __func__); bitrow_print(packet, PHILIPS_PACKETLEN * 8); } /* Correct CRC? */ c_crc = crc4(packet, PHILIPS_PACKETLEN, 0x9, 1); /* Including the CRC nibble */ if (0 != c_crc) { if (decoder->verbose) { fprintf(stderr, "%s: CRC failed, calculated %x\n", __func__, c_crc); } return 0; } /* Message validated, now parse the data */ /* Channel */ channel = packet[0] & 0x0f; if (channel > (sizeof(channel_map) / sizeof(channel_map[0]))) channel = 0; else channel = channel_map[channel]; /* Temperature */ tmp = packet[1]; tmp <<= 2; tmp |= ((packet[2] & 0xc0) >> 6); tmp -= 500; temperature = tmp / 10.0f; /* Battery status */ battery_status = packet[PHILIPS_PACKETLEN - 1] & 0x40; data = data_make( "model", "", DATA_STRING, _X("Philips-Temperature","Philips outdoor temperature sensor"), "channel", "Channel", DATA_INT, channel, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature, "battery", "Battery", DATA_STRING, battery_status ? "LOW" : "OK", NULL); decoder_output_data(decoder, data); return 1; } static char *philips_output_fields[] = { "model", "channel", "temperature_C", "battery", NULL }; r_device philips = { .name = "Philips outdoor temperature sensor", .modulation = OOK_PULSE_PWM, .short_width = 2000, .long_width = 6000, .reset_limit = 30000, .decode_fn = &philips_callback, .disabled = 0, .fields = philips_output_fields, };
// 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_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ #include <queue> #include <string> #include <vector> #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" #include "base/strings/string16.h" #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" class SpellingEngine; class SpellcheckLanguage { public: SpellcheckLanguage(); ~SpellcheckLanguage(); void Init(base::PlatformFile file, const std::string& language); bool SpellCheckWord(const char16* in_word, int in_word_len, int tag, int* misspelling_start, int* misspelling_len, std::vector<base::string16>* optional_suggestions); bool InitializeIfNeeded(); bool IsEnabled(); private: friend class SpellCheckTest; bool IsValidContraction(const base::string16& word, int tag); SpellcheckCharAttribute character_attributes_; SpellcheckWordIterator text_iterator_; SpellcheckWordIterator contraction_iterator_; scoped_ptr<SpellingEngine> platform_spelling_engine_; DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguage); }; #endif
#include "tests.h" #include "machine.h" #include "thread.h" #include "map.h" #include "debug.h" int test__thread_mg_share(void) { struct machines machines; struct machine *machine; /* thread group */ struct thread *leader; struct thread *t1, *t2, *t3; struct map_groups *mg; /* other process */ struct thread *other, *other_leader; struct map_groups *other_mg; /* * This test create 2 processes abstractions (struct thread) * with several threads and checks they properly share and * maintain map groups info (struct map_groups). * * thread group (pid: 0, tids: 0, 1, 2, 3) * other group (pid: 4, tids: 4, 5) */ machines__init(&machines); machine = &machines.host; /* create process with 4 threads */ leader = machine__findnew_thread(machine, 0, 0); t1 = machine__findnew_thread(machine, 0, 1); t2 = machine__findnew_thread(machine, 0, 2); t3 = machine__findnew_thread(machine, 0, 3); /* and create 1 separated process, without thread leader */ other = machine__findnew_thread(machine, 4, 5); TEST_ASSERT_VAL("failed to create threads", leader && t1 && t2 && t3 && other); mg = leader->mg; TEST_ASSERT_EQUAL("wrong refcnt", mg->refcnt, 4); /* test the map groups pointer is shared */ TEST_ASSERT_VAL("map groups don't match", mg == t1->mg); TEST_ASSERT_VAL("map groups don't match", mg == t2->mg); TEST_ASSERT_VAL("map groups don't match", mg == t3->mg); /* * Verify the other leader was created by previous call. * It should have shared map groups with no change in * refcnt. */ other_leader = machine__find_thread(machine, 4, 4); TEST_ASSERT_VAL("failed to find other leader", other_leader); /* * Ok, now that all the rbtree related operations were done, * lets remove all of them from there so that we can do the * refcounting tests. */ machine__remove_thread(machine, leader); machine__remove_thread(machine, t1); machine__remove_thread(machine, t2); machine__remove_thread(machine, t3); machine__remove_thread(machine, other); machine__remove_thread(machine, other_leader); other_mg = other->mg; TEST_ASSERT_EQUAL("wrong refcnt", other_mg->refcnt, 2); TEST_ASSERT_VAL("map groups don't match", other_mg == other_leader->mg); /* release thread group */ thread__put(leader); TEST_ASSERT_EQUAL("wrong refcnt", mg->refcnt, 3); thread__put(t1); TEST_ASSERT_EQUAL("wrong refcnt", mg->refcnt, 2); thread__put(t2); TEST_ASSERT_EQUAL("wrong refcnt", mg->refcnt, 1); thread__put(t3); /* release other group */ thread__put(other_leader); TEST_ASSERT_EQUAL("wrong refcnt", other_mg->refcnt, 1); thread__put(other); machines__exit(&machines); return 0; }
#import <sqlite3.h> @interface SQL_Controller : NSObject { @public sqlite3 *connection; } - (void)openDatabase; - (void)closeDatabase; @end
//----------------------------------------------------------------------------- // File: ComponentDiffWidget.h //----------------------------------------------------------------------------- // Project: Kactus 2 // Author: Esko Pekkarinen // Date: 17.10.2014 // // Description: // Tree widget for displaying differences of two components. //----------------------------------------------------------------------------- #ifndef COMPONENTDIFFWIDGET_H #define COMPONENTDIFFWIDGET_H #include <QTreeWidget> #include <wizards/common/IPXactDiff.h> #include <editors/ComponentEditor/common/ExpressionFormatter.h> class Component; //----------------------------------------------------------------------------- //! Tree widget for displaying differences of two components. //----------------------------------------------------------------------------- class ComponentDiffWidget : public QTreeWidget { Q_OBJECT public: //! Enumeration of the tree columns. enum COLUMNS { ITEM_NAME = 0, CHANGE_ELEMENT, PREVIOUS_VALUE, UPDATED_VALUE, COLUMN_COUNT }; /*! * The constructor. * * @param [in] expressionFormatter Pointer to the expression formatter. * @param [in] parent Pointer to the parent item. */ ComponentDiffWidget(QSharedPointer <ExpressionFormatter> expressionFormatter, QWidget *parent); //! The destructor. ~ComponentDiffWidget(); /*! * Sets the components to diff in the view. * * @param [in] reference The reference component to compare to. * @param [in] subject The component to compare against the reference. */ void setComponents(QSharedPointer<const Component> reference, QSharedPointer<const Component> subject); private: // Disable copying. ComponentDiffWidget(ComponentDiffWidget const& rhs); ComponentDiffWidget& operator=(ComponentDiffWidget const& rhs); /*! * Checks if a list of diffs shows no change. * * @param [in] diffs The list to check. * * @return True, if nothing has changed, otherwise false. */ bool nothingChanged(QList<QSharedPointer<IPXactDiff> > const& diffs); /*! * Creates the top level items in the tree. * * @param [in] diffs The diffs to display in the tree. * * @return Top level items indexed by their element type. */ QMap<QString, QTreeWidgetItem*> createTopLevelItems(QList<QSharedPointer<IPXactDiff> > const& diffs); /*! * Creates a top level item for a given element. * * @param [in] elementName The name of the element. * * @return The created item. */ QTreeWidgetItem* createTopLevelItemForElement(QString const& elementName); /*! * Adds an item to the tree indicating an added element. * * @param [in] name The name of the added element. * @param [in] parent The parent item. */ void addAddItem(QString const& name, QTreeWidgetItem* parent); /*! * Adds an item to the tree indicating a removed element. * * @param [in] name The name of the removed element. * @param [in] parent The parent item. */ void addRemoveItem(QString const& name, QTreeWidgetItem* parent); /*! * Adds an item to the tree indicating a modified element. * * @param [in] name The name of the modified element. * @param [in] parent The parent item. */ void addModificationItem(QSharedPointer<IPXactDiff> diff, QTreeWidgetItem* parent); /*! * Adds an item to the tree indicating an modified element with a single modified sub-element. * * @param [in] name The name of the modified element. * @param [in] modification The modification to the element. * @param [in] parent The parent item. */ void addSingleLevelModificationItem(QString const& name, IPXactDiff::Modification const& modification, QTreeWidgetItem* parent); /*! * Creates an item to indicate a modified sub-element. * * @param [in] modification The modification to the element. * @param [in] parent The parent item. * * @return Item for a modified sub-element. */ QTreeWidgetItem* createModificationItem(IPXactDiff::Modification const& modification, QTreeWidgetItem* parent = 0) const; /*! * Adds an item to the tree indicating an modified element with multiple modified sub-elements. * * @param [in] name The name of the modified element. * @param [in] changelist The modifications to the element. * @param [in] parent The parent item. */ void addMultiLevelModificationItem(QString const& name, QList<IPXactDiff::Modification> changelist, QTreeWidgetItem* parent); //! Expression formatter, formats the referencing expressions. QSharedPointer<ExpressionFormatter> expressionFormatter_; }; #endif // COMPONENTDIFFWIDGET_H
/* * global.h * XTBook * * Created by Nexhawks on 12/22/10. * Copyright 2011 Nexhawks. All rights reserved. * */ #pragma once #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdarg.h> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> #include <list> #include <stdint.h> #include <exception> using namespace std; #include "SDL.h" #if defined(__MACOSX__) #define EV_PLATFORM_MACOSX 1 #elif defined(WIN32) #define EV_PLATFORM_WIN32 1 #else #define EV_PLATFORM_GENERICPOSIX 1 #endif /** Formats "...{0}..." style text. NULL must be added to the end of the arguments. */ std::wstring XTBFormat(const std::wstring& str, ...); /** Formats "...{0}..." style text using va_list. * @see XTBFormat */ std::wstring XTBVarArgFormat(const std::wstring& format, va_list list); /** Formats printf style text. It may cause the unexpected result to use non-ASCII characters. */ std::wstring XTBFormatStd(const std::wstring& str, ...); /** Converts the string to the integer. */ int XTBIntWithString(const std::wstring&); /** Converts the integer to the string. */ std::wstring XTBStringWithInt(int); /** Short version. */ std::wstring XTBShortVersionInformation(); /** Full version information. */ std::wstring XTBLongVersionInformation(); #if EV_PLATFORM_WIN32 #include <excpt.h> struct _EXCEPTION_RECORD; struct _CONTEXT; struct _DISPATCHER_CONTEXT; /** Handles the Win32 exception by throwing XTBWin32Exception. */ int XTBHandleWin32Exception(struct _EXCEPTION_RECORD*, void *, struct _CONTEXT*, struct _DISPATCHER_CONTEXT*); #endif /** This is the virtual entry point. */ int Main(int argc, char *argv[]) #if EV_PLATFORM_WIN32 __attribute__((__exception_handler__(XTBHandleWin32Exception))); #endif ; #include "platform.h" #include "XTBException.h" #include "i18n.h" #include <tcw/twWnd.h> #include <tcw/twApp.h> #include <tcw/twEvent.h> #include <tcw/twInvocation.h>
/* * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ /** \addtogroup u2w User to World Communication * @{ * \file PoolSocketMgr.h * \author Derex <derex101@gmail.com> */ #ifndef __POOLSOCKETMGR_H #define __POOLSOCKETMGR_H #include <ace/Basic_Types.h> #include <ace/Singleton.h> #include <ace/Thread_Mutex.h> class PoolSocket; class ReactorRunnable; class ACE_Event_Handler; /// Manages all sockets connected to peers and network threads class PoolSocketMgr { public: friend class PoolSocket; friend class ACE_Singleton<PoolSocketMgr, ACE_Thread_Mutex>; /// Start network, listen at address:port . int StartNetwork(ACE_UINT16 port, const char* address); /// Stops all network threads, It will wait for all running threads . void StopNetwork(); /// Wait untill all network threads have "joined" . void Wait(); private: int OnSocketOpen(PoolSocket* sock); int StartReactiveIO(ACE_UINT16 port, const char* address); private: PoolSocketMgr(); virtual ~PoolSocketMgr(); ReactorRunnable* m_NetThreads; size_t m_NetThreadsCount; int m_SockOutKBuff; int m_SockOutUBuff; bool m_UseNoDelay; class PoolSocketAcceptor* m_Acceptor; }; #define sPoolSocketMgr ACE_Singleton<PoolSocketMgr, ACE_Thread_Mutex>::instance() #endif /// @}
/* linphone, gtk-glade interface. Copyright (C) 2008 Simon MORLAT (simon.morlat@linphone.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){ GtkWidget *w; GtkTextBuffer *b; gchar *tmp; w=linphone_gtk_create_window("chatroom"); tmp=g_strdup_printf(_("Chat with %s"),with); gtk_window_set_title(GTK_WINDOW(w),tmp); g_free(tmp); g_object_set_data(G_OBJECT(w),"cr",cr); gtk_widget_show(w); linphone_chat_room_set_user_data(cr,w); b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog"))); gtk_text_buffer_create_tag(b,"blue","foreground","blue",NULL); gtk_text_buffer_create_tag(b,"green","foreground","green",NULL); return w; } void linphone_gtk_create_chatroom(const char *with){ LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),with); if (!cr) return; linphone_gtk_init_chatroom(cr,with); } void linphone_gtk_chat_destroyed(GtkWidget *w){ LinphoneChatRoom *cr=(LinphoneChatRoom*)g_object_get_data(G_OBJECT(w),"cr"); linphone_chat_room_destroy(cr); } /* dc:comment void linphone_gtk_chat_close(GtkWidget *button){ GtkWidget *w=gtk_widget_get_toplevel(button); gtk_widget_destroy(w); } */ void linphone_gtk_push_text(GtkTextView *v, const char *from, const char *message, gboolean me){ GtkTextBuffer *b=gtk_text_view_get_buffer(v); GtkTextIter iter,begin; int off; gtk_text_buffer_get_end_iter(b,&iter); off=gtk_text_iter_get_offset(&iter); gtk_text_buffer_insert(b,&iter,from,-1); gtk_text_buffer_get_end_iter(b,&iter); gtk_text_buffer_insert(b,&iter,":\t",-1); gtk_text_buffer_get_end_iter(b,&iter); gtk_text_buffer_get_iter_at_offset(b,&begin,off); gtk_text_buffer_apply_tag_by_name(b,me ? "green" : "blue" ,&begin,&iter); gtk_text_buffer_insert(b,&iter,message,-1); gtk_text_buffer_get_end_iter(b,&iter); gtk_text_buffer_insert(b,&iter,"\n",-1); gtk_text_buffer_get_end_iter(b,&iter); gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0); } const char* linphone_gtk_get_used_identity(){ LinphoneCore *lc=linphone_gtk_get_core(); LinphoneProxyConfig *cfg; linphone_core_get_default_proxy(lc,&cfg); if (cfg) return linphone_proxy_config_get_identity(cfg); else return linphone_core_get_primary_contact(lc); } void linphone_gtk_send_text(GtkWidget *button){ GtkWidget *w=gtk_widget_get_toplevel(button); GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry"); LinphoneChatRoom *cr=(LinphoneChatRoom*)g_object_get_data(G_OBJECT(w),"cr"); const gchar *entered; entered=gtk_entry_get_text(GTK_ENTRY(entry)); if (strlen(entered)>0) { linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")), linphone_gtk_get_used_identity(), entered,TRUE); linphone_chat_room_send_message(cr,entered); gtk_entry_set_text(GTK_ENTRY(entry),""); } } void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message){ GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room); if (w==NULL){ w=linphone_gtk_init_chatroom(room,from); } linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")), from, message,FALSE); gtk_window_present(GTK_WINDOW(w)); /*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/ }
/* * Copyright (C) 2002 ARM Ltd. * All Rights Reserved * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> #include <linux/cpu.h> #include <linux/notifier.h> #include <linux/msm_rtb.h> #include <asm/smp_plat.h> #include <asm/vfp.h> #include <mach/jtag.h> #include "pm.h" #include "spm.h" static cpumask_t cpu_dying_mask; static DEFINE_PER_CPU(unsigned int, warm_boot_flag); static inline void cpu_enter_lowpower(void) { } static inline void cpu_leave_lowpower(void) { } static inline void platform_do_lowpower(unsigned int cpu, int *spurious) { /* Just enter wfi for now. TODO: Properly shut off the cpu. */ for (;;) { lpm_cpu_hotplug_enter(cpu); if (pen_release == cpu_logical_map(cpu)) { /* * OK, proper wakeup, we're done */ break; } /* * getting here, means that we have come out of WFI without * having been woken up - this shouldn't happen * * The trouble is, letting people know about this is not really * possible, since we are currently running incoherently, and * therefore cannot safely call printk() or anything else */ (*spurious)++; } } int msm_cpu_kill(unsigned int cpu) { int ret = 0; if (cpumask_test_and_clear_cpu(cpu, &cpu_dying_mask)) ret = msm_pm_wait_cpu_shutdown(cpu); return ret ? 0 : 1; } /* * platform-specific code to shutdown a CPU * * Called with IRQs disabled */ void __ref msm_cpu_die(unsigned int cpu) { int spurious = 0; if (unlikely(cpu != smp_processor_id())) { pr_crit("%s: running on %u, should be %u\n", __func__, smp_processor_id(), cpu); BUG(); } /* * we're ready for shutdown now, so do it */ cpu_enter_lowpower(); platform_do_lowpower(cpu, &spurious); pr_debug("CPU%u: %s: normal wakeup\n", cpu, __func__); cpu_leave_lowpower(); if (spurious) pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); } #define CPU_SHIFT 0 #define CPU_MASK 0xF #define CPU_OF(n) (((n) & CPU_MASK) << CPU_SHIFT) #define CPUSET_SHIFT 4 #define CPUSET_MASK 0xFFFF #define CPUSET_OF(n) (((n) & CPUSET_MASK) << CPUSET_SHIFT) static int hotplug_rtb_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { /* * Bits [19:4] of the data are the online mask, lower 4 bits are the * cpu number that is being changed. Additionally, changes to the * online_mask that will be done by the current hotplug will be made * even though they aren't necessarily in the online mask yet. * * XXX: This design is limited to supporting at most 16 cpus */ int this_cpumask = CPUSET_OF(1 << (int)hcpu); int cpumask = CPUSET_OF(cpumask_bits(cpu_online_mask)[0]); int cpudata = CPU_OF((int)hcpu) | cpumask; switch (action & (~CPU_TASKS_FROZEN)) { case CPU_STARTING: uncached_logk(LOGK_HOTPLUG, (void *)(cpudata | this_cpumask)); break; case CPU_DYING: cpumask_set_cpu((unsigned long)hcpu, &cpu_dying_mask); uncached_logk(LOGK_HOTPLUG, (void *)(cpudata & ~this_cpumask)); break; default: break; } return NOTIFY_OK; } static struct notifier_block hotplug_rtb_notifier = { .notifier_call = hotplug_rtb_callback, }; int msm_platform_secondary_init(unsigned int cpu) { int ret; unsigned int *warm_boot = &__get_cpu_var(warm_boot_flag); if (!(*warm_boot)) { *warm_boot = 1; return 0; } msm_jtag_restore_state(); #if defined(CONFIG_VFP) && defined (CONFIG_CPU_PM) vfp_pm_resume(); #endif ret = msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING, false); return ret; } static int __init init_hotplug(void) { return register_hotcpu_notifier(&hotplug_rtb_notifier); } early_initcall(init_hotplug);
#ifndef WEPL_H #define WEPL_H #include <array> #include <vector> #include "cbctrecon_config.h" #include "cbctrecon_types.h" // for FloatImageType, UShortImageType #include <itkPoint.h> #include "PlmWrapper.h" namespace crl { namespace wepl { double WEPL_from_point(const std::array<size_t, 3> &cur_point_id, const std::array<double, 3> &vec_basis, const std::array<double, 3> &vec_voxelsize, const FloatImageType::Pointer &wepl_cube); CBCTRECON_API std::array<double, 3> get_basis_from_angles(double gantry, double couch); std::vector<double> WEPL_trace_from_point(const std::array<size_t, 3> &cur_point_id, const std::array<double, 3> &vec_basis, const std::array<double, 3> &vec_cubesize, const FloatImageType::Pointer &wepl_cube); CBCTRECON_API std::vector<FloatVector> distal_points_only(const Rtss_contour_modern &points, const std::array<double, 3> &direction); std::vector<WEPLVector> WEPLContourFromRtssContour(const Rtss_contour_modern &rt_contour, const std::array<double, 3> &vec_basis, const FloatImageType::Pointer &wepl_cube); std::vector<WEPLVector> DistalWEPLContourFromRtssContour(const Rtss_contour_modern &rt_contour, const std::array<double, 3> &vec_basis, const FloatImageType::Pointer &wepl_cube); FloatImageType::PointType point_from_WEPL(const vnl_vector_fixed<double, 3> &start_point, double fWEPL, const vnl_vector_fixed<double, 3> &vec_basis, const FloatImageType::Pointer &wepl_cube); FloatVector NewPoint_from_WEPLVector(const WEPLVector &vwepl, const std::array<double, 3> &arr_basis, const FloatImageType::Pointer &wepl_cube); FloatImageType::Pointer ConvertUshort2WeplFloat(const UShortImageType::Pointer &spImgUshort); template <bool DISTAL_ONLY = false> Rtss_roi_modern *CalculateWEPLtoVOI(const Rtss_roi_modern *voi, const double gantry_angle, const double couch_angle, const UShortImageType::Pointer &spMoving, const UShortImageType::Pointer &spFixed) { // Get basis from angles const auto vec_basis = get_basis_from_angles(gantry_angle, couch_angle); // Get Fixed and Moving // Tranlate fixed and moving to dEdx const auto wepl_cube = ConvertUshort2WeplFloat(spMoving); const auto wepl_cube_fixed = ConvertUshort2WeplFloat(spFixed); // Initialize WEPL contour auto WEPL_voi = std::make_unique<Rtss_roi_modern>(); WEPL_voi->name = "WEPL" + voi->name; WEPL_voi->color = "255 0 0"; WEPL_voi->id = voi->id; /* Used for import/export (must be >= 1) */ WEPL_voi->bit = voi->bit; /* Used for ss-img (-1 for no bit) */ WEPL_voi->pslist.resize(voi->pslist.size()); auto i = 0U; // Calculate WEPL for (const auto &contour : voi->pslist) { auto WEPL_contour = std::make_unique<Rtss_contour_modern>(contour); WEPL_contour->ct_slice_uid = contour.ct_slice_uid; WEPL_contour->slice_no = contour.slice_no; WEPL_contour->coordinates.clear(); // Actually calculate WEPL on spMoving auto WEPL_points = DISTAL_ONLY ? DistalWEPLContourFromRtssContour(contour, vec_basis, wepl_cube) : WEPLContourFromRtssContour(contour, vec_basis, wepl_cube); // Inversely calc WEPL on spFixed // And put WEPL point in contour std::transform(std::begin(WEPL_points), std::end(WEPL_points), std::back_inserter(WEPL_contour->coordinates), [&vec_basis, &wepl_cube_fixed](const WEPLVector &val) { return NewPoint_from_WEPLVector(val, vec_basis, wepl_cube_fixed); }); WEPL_voi->pslist.at(i++) = *WEPL_contour.release(); } return WEPL_voi.release(); } } // namespace wepl } // namespace crl #endif
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #pragma once #include <string> #include "Core/HW/EXI_Device.h" class PointerWrap; class CEXIIPL : public IEXIDevice { public: CEXIIPL(); virtual ~CEXIIPL(); virtual void SetCS(int _iCS) override; bool IsPresent() const override; void DoState(PointerWrap &p) override; static u32 GetGCTime(); static u64 NetPlay_GetGCTime(); static void Descrambler(u8* data, u32 size); private: enum { ROM_SIZE = 1024*1024*2, ROM_MASK = (ROM_SIZE - 1) }; enum { REGION_RTC = 0x200000, REGION_SRAM = 0x200001, REGION_UART = 0x200100, REGION_UART_UNK = 0x200103, REGION_BARNACLE = 0x200113, REGION_WRTC0 = 0x210000, REGION_WRTC1 = 0x210001, REGION_WRTC2 = 0x210008, REGION_EUART_UNK = 0x300000, REGION_EUART = 0x300001 }; // Region bool m_bNTSC; //! IPL u8* m_pIPL; // STATE_TO_SAVE //! RealTimeClock u8 m_RTC[4]; //! Helper u32 m_uPosition; u32 m_uAddress; u32 m_uRWOffset; std::string m_buffer; bool m_FontsLoaded; virtual void TransferByte(u8 &_uByte) override; bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); } u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; } void LoadFileToIPL(std::string filename, u32 offset); };
/* asm/bitops.h for Linux/CRIS * * TODO: asm versions if speed is needed * * All bit operations return 0 if the bit was cleared before the * operation and != 0 if it was not. * * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */ #ifndef _CRIS_BITOPS_H #define _CRIS_BITOPS_H /* Currently this is unsuitable for consumption outside the kernel. */ #ifdef __KERNEL__ #ifndef _LINUX_BITOPS_H #error only <linux/bitops.h> can be included directly #endif #include <arch/bitops.h> #include <asm/system.h> #include <asm/atomic.h> #include <linux/compiler.h> /* * set_bit - Atomically set a bit in memory * @nr: the bit to set * @addr: the address to start counting from * * This function is atomic and may not be reordered. See __set_bit() * if you do not require the atomic guarantees. * Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ #define set_bit(nr, addr) (void)test_and_set_bit(nr, addr) /* * clear_bit - Clears a bit in memory * @nr: Bit to clear * @addr: Address to start counting from * * clear_bit() is atomic and may not be reordered. However, it does * not contain a memory barrier, so if it is used for locking purposes, * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() * in order to ensure changes are visible on other processors. */ #define clear_bit(nr, addr) (void)test_and_clear_bit(nr, addr) /* * change_bit - Toggle a bit in memory * @nr: Bit to change * @addr: Address to start counting from * * change_bit() is atomic and may not be reordered. * Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ #define change_bit(nr, addr) (void)test_and_change_bit(nr, addr) /** * test_and_set_bit - Set a bit and return its old value * @nr: Bit to set * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) { unsigned int mask, retval; unsigned long flags; unsigned int *adr = (unsigned int *)addr; adr += nr >> 5; mask = 1 << (nr & 0x1f); cris_atomic_save(addr, flags); retval = (mask & *adr) != 0; *adr |= mask; cris_atomic_restore(addr, flags); return retval; } /* * clear_bit() doesn't provide any barrier for the compiler. */ #define smp_mb__before_clear_bit() barrier() #define smp_mb__after_clear_bit() barrier() /** * test_and_clear_bit - Clear a bit and return its old value * @nr: Bit to clear * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) { unsigned int mask, retval; unsigned long flags; unsigned int *adr = (unsigned int *)addr; adr += nr >> 5; mask = 1 << (nr & 0x1f); cris_atomic_save(addr, flags); retval = (mask & *adr) != 0; *adr &= ~mask; cris_atomic_restore(addr, flags); return retval; } /** * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) { unsigned int mask, retval; unsigned long flags; unsigned int *adr = (unsigned int *)addr; adr += nr >> 5; mask = 1 << (nr & 0x1f); cris_atomic_save(addr, flags); retval = (mask & *adr) != 0; *adr ^= mask; cris_atomic_restore(addr, flags); return retval; } #include <asm-generic/bitops/non-atomic.h> /* * Since we define it "external", it collides with the built-in * definition, which doesn't have the same semantics. We don't want to * use -fno-builtin, so just hide the name ffs. */ #define ffs kernel_ffs #include <asm-generic/bitops/fls.h> #include <asm-generic/bitops/__fls.h> #include <asm-generic/bitops/fls64.h> #include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/find.h> #include <asm-generic/bitops/lock.h> <<<<<<< HEAD #include <asm-generic/bitops/le.h> ======= #include <asm-generic/bitops/ext2-non-atomic.h> >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) <<<<<<< HEAD ======= #include <asm-generic/bitops/minix.h> >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a #include <asm-generic/bitops/sched.h> #endif /* __KERNEL__ */ #endif /* _CRIS_BITOPS_H */
// -*- c++ -*- // Generated by gtkmmproc -- DO NOT MODIFY! #ifndef _GTKMM_PAGESETUP_P_H #define _GTKMM_PAGESETUP_P_H #include <glibmm/private/object_p.h> #include <glibmm/class.h> namespace Gtk { class PageSetup_Class : public Glib::Class { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef PageSetup CppObjectType; typedef GtkPageSetup BaseObjectType; typedef GtkPageSetupClass BaseClassType; typedef Glib::Object_Class CppClassParent; typedef GObjectClass BaseClassParent; friend class PageSetup; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ const Glib::Class& init(); static void class_init_function(void* g_class, void* class_data); static Glib::ObjectBase* wrap_new(GObject*); protected: #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (default signal handlers): //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. //You could prevent the original default signal handlers being called by overriding the *_impl method. #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (virtual functions): #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED }; } // namespace Gtk #endif /* _GTKMM_PAGESETUP_P_H */
/*********************************************************** * author BIKRAM KAUSHIK BORA * * * * LinkedIn: https://au.linkedin.com/in/bikrambora * * * * GitHub: https://github.com/bikrambora * ***********************************************************/ /* ** This file contains the function prototypes and struct definitions used by the file setcover.c ** */ void setCover(Set **SetMap,Set* HeapSet,Heap* h,unsigned int numH);
/* * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. */ /* * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ extern struct cpu_op *mx35_get_cpu_op(int *op);
/* Purdue University CNIT 315 Team Hot Wheels Members:: Tim Cahoe Matt Depue Matt Morehouse Nathan Morin @nathanamorin */ #include "hotWheelsLib.h" #include <pthread.h> #include <stdio.h> #include <string.h> int initialized = FALSE; double frequency = 1.0/400.0; int throttleVal = TRUE; struct varSpeedInput throttleData; int initHotWheels() { wiringPiSetup(); //Set up pins pinMode(GPIO_RIGHT, OUTPUT); pinMode(GPIO_LEFT, OUTPUT); pinMode(GPIO_FORWARD, OUTPUT); pinMode(GPIO_BACK, OUTPUT); //Set initial low values; clearThrottle(); clearSteering(); initialized = TRUE; return SUCCESS; } void *variableSpeed(void *input) { if (!initialized) return; struct varSpeedInput *data = input; int wait_time_on = 1000 * frequency * (((double)data->value)/100.0); int wait_time_off = 1000 * frequency * ((100.0-(double)data->value)/100.0); for(;;) { if (*(data->enabled) == FALSE) { *(data->enabled) = TRUE; return; } digitalWrite(data->GPIO, HIGH); delay(wait_time_on); digitalWrite(data->GPIO, LOW); delay(wait_time_off); } pthread_exit(0); return; } int throttle(int value) { if (!initialized) return FAILURE; clearThrottle(); throttleVal = TRUE; pthread_t thread; if (value < 0) { value = -value; throttleData.value = value; throttleData.GPIO = GPIO_BACK; throttleData.enabled = &throttleVal; pthread_create(&thread,NULL, variableSpeed, &throttleData); } else if (value > 0) { throttleData.value = value; throttleData.GPIO = GPIO_FORWARD; throttleData.enabled = &throttleVal; pthread_create(&thread,NULL, variableSpeed, &throttleData); } return SUCCESS; } int steering(int value) { if (!initialized) return FAILURE; clearSteering(); if (value < 0) { digitalWrite(GPIO_LEFT, HIGH); } else if (value > 0) { digitalWrite(GPIO_RIGHT, HIGH); } return SUCCESS; } int clearThrottle() { if (!initialized) return FAILURE; throttleVal = FALSE; delay(21); // while(throttleVal == FALSE) // { // delay(1); // } digitalWrite(GPIO_FORWARD, LOW); digitalWrite(GPIO_BACK, LOW); return SUCCESS; } int clearSteering() { if (!initialized) return FAILURE; digitalWrite(GPIO_RIGHT, LOW); digitalWrite(GPIO_LEFT, LOW); return SUCCESS; }
// BubbleBabble implementation, written and // placed in the public domain by denis bider #ifndef BABBLE_H_INCLUDED #define BABBLE_H_INCLUDED #include "filters.h" NAMESPACE_BEGIN(CryptoPP) class BubbleBabbleEncoder : public Filter { public: BubbleBabbleEncoder(BufferedTransformation* pQ = 0); void Put(byte b) { Put(&b, 1); } void Put(byte const* p, unsigned int n); void MessageEnd(int nPropagation = -1); protected: bool m_started; bool m_haveOddByte; byte m_oddByte; unsigned int m_checksum; }; NAMESPACE_END #endif
/****************************************************************************** * Generated by PSoC Designer 5.4.2946 ******************************************************************************/ // ============================================================================= // FILENAME: PSoCAPI.h // // Copyright (c) Cypress Semiconductor 2013. All Rights Reserved. // // NOTES: // Do not modify this file. It is generated by PSoC Designer each time the // generate application function is run. The values of the parameters in this // file can be modified by changing the values of the global parameters in the // device editor. // // ============================================================================= #ifndef __PSOCAPI_H #define __PSOCAPI_H #include "PSoCGPIOINT.h" #include "I2CHWRSRCInits.h" #include "I2CHWMMS.h" #include "I2CHWMstr.h" #include "LCD.h" #include "OME.h" #include "OMT.h" #include "SleepTimer.h" #include "TRIGG.h" #include "VME.h" #include "VMT.h" #endif
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <efi.h> #include <efilib.h> #include "disk.h" #include "graphics.h" #include "linux.h" #include "measure.h" #include "pe.h" #include "splash.h" #include "util.h" /* magic string to find in the binary image */ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-stub " GIT_VERSION " ####"; static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE; EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { EFI_LOADED_IMAGE *loaded_image; _cleanup_freepool_ CHAR8 *b = NULL; UINTN size; BOOLEAN secure = FALSE; CHAR8 *sections[] = { (CHAR8 *)".cmdline", (CHAR8 *)".linux", (CHAR8 *)".initrd", (CHAR8 *)".splash", NULL }; UINTN addrs[ELEMENTSOF(sections)-1] = {}; UINTN offs[ELEMENTSOF(sections)-1] = {}; UINTN szs[ELEMENTSOF(sections)-1] = {}; CHAR8 *cmdline = NULL; UINTN cmdline_len; CHAR16 uuid[37]; EFI_STATUS err; InitializeLib(image, sys_table); err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image, image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (EFI_ERROR(err)) { Print(L"Error getting a LoadedImageProtocol handle: %r ", err); uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); return err; } if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) if (*b > 0) secure = TRUE; err = pe_memory_locate_sections(loaded_image->ImageBase, sections, addrs, offs, szs); if (EFI_ERROR(err)) { Print(L"Unable to locate embedded .linux section: %r ", err); uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); return err; } if (szs[0] > 0) cmdline = (CHAR8 *)(loaded_image->ImageBase + addrs[0]); cmdline_len = szs[0]; /* if we are not in secure boot mode, or none was provided, accept a custom command line and replace the built-in one */ if ((!secure || cmdline_len == 0) && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions > 0x1F) { CHAR16 *options; CHAR8 *line; UINTN i; options = (CHAR16 *)loaded_image->LoadOptions; cmdline_len = (loaded_image->LoadOptionsSize / sizeof(CHAR16)) * sizeof(CHAR8); line = AllocatePool(cmdline_len); for (i = 0; i < cmdline_len; i++) line[i] = options[i]; cmdline = line; #if ENABLE_TPM /* Try to log any options to the TPM, especially manually edited options */ err = tpm_log_event(SD_TPM_PCR, (EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions, loaded_image->LoadOptionsSize, loaded_image->LoadOptions); if (EFI_ERROR(err)) { Print(L"Unable to add image options measurement: %r", err); uefi_call_wrapper(BS->Stall, 1, 200 * 1000); } #endif } /* Export the device path this image is started from, if it's not set yet */ if (efivar_get_raw(&loader_guid, L"LoaderDevicePartUUID", NULL, NULL) != EFI_SUCCESS) if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS) efivar_set(L"LoaderDevicePartUUID", uuid, FALSE); /* if LoaderImageIdentifier is not set, assume the image with this stub was loaded directly from UEFI */ if (efivar_get_raw(&loader_guid, L"LoaderImageIdentifier", NULL, NULL) != EFI_SUCCESS) { _cleanup_freepool_ CHAR16 *s; s = DevicePathToStr(loaded_image->FilePath); efivar_set(L"LoaderImageIdentifier", s, FALSE); } /* if LoaderFirmwareInfo is not set, let's set it */ if (efivar_get_raw(&loader_guid, L"LoaderFirmwareInfo", NULL, NULL) != EFI_SUCCESS) { _cleanup_freepool_ CHAR16 *s; s = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); efivar_set(L"LoaderFirmwareInfo", s, FALSE); } /* ditto for LoaderFirmwareType */ if (efivar_get_raw(&loader_guid, L"LoaderFirmwareType", NULL, NULL) != EFI_SUCCESS) { _cleanup_freepool_ CHAR16 *s; s = PoolPrint(L"UEFI %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); efivar_set(L"LoaderFirmwareType", s, FALSE); } /* add StubInfo */ if (efivar_get_raw(&loader_guid, L"StubInfo", NULL, NULL) != EFI_SUCCESS) efivar_set(L"StubInfo", L"systemd-stub " GIT_VERSION, FALSE); if (szs[3] > 0) graphics_splash((UINT8 *)((UINTN)loaded_image->ImageBase + addrs[3]), szs[3], NULL); err = linux_exec(image, cmdline, cmdline_len, (UINTN)loaded_image->ImageBase + addrs[1], (UINTN)loaded_image->ImageBase + addrs[2], szs[2]); graphics_mode(FALSE); Print(L"Execution of embedded linux image failed: %r\n", err); uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); return err; }
/* ---------------------------------------------------------------------------- SOURCE FILE Name: select.c Program: C10K Developer: Andrew Burian Created On: 2015-02-11 Functions: int select_server(int port) Description: A multiplexing server centered around epoll Revisions: (none) ---------------------------------------------------------------------------- */ #include "server.h" /* ---------------------------------------------------------------------------- FUNCTION Name: Select Server Prototype: int select_server(int port) Developer: Andrew Burian Created On: 2015-02-13 Parameters: int port the port to listen on Return Values: 0 success -1 error conditions Description: A simple select-centered echo server but cheating and using level-triggered epoll instead of select. same thing. Revisions: (none) ---------------------------------------------------------------------------- */ int select_server(int port){ // the epoll instance descriptor int epollfd = 0; // the listening socket int listenSocket = 0; // new connections int newSocket = 0; struct sockaddr_in remote = {0}; socklen_t remoteLen = 0; // for epoll wait events struct epoll_event events[LISTEN_LIMIT]; // for adding new connections struct epoll_event addEvent = {0}; // number of active epoll descriptors int fdCount = 0; // the amount of data read int thisRead = 0; // data buffer, unique to each thread char buffer[BUFFER_SIZE] = {0}; // the size remaining in the buffer int buflen = 0; // counter int i = 0; // single epoll event struct epoll_event event = {0}; // create the epoll descriptor if((epollfd = epoll_create1(0)) == -1){ perror("Epoll create failed"); return -1; } // create the socket (common) if((listenSocket = create_server_socket(port)) == -1){ return -1; } // listen on the socket listen(listenSocket, LISTEN_LIMIT); // Set listen socket to non-blocking while keeping previous flags fcntl(listenSocket, F_SETFL, O_NONBLOCK | fcntl(listenSocket, F_GETFL, 0)); // register listenSocket with epoll event.events = EPOLLIN | EPOLLERR; event.data.fd = listenSocket; if(epoll_ctl(epollfd, EPOLL_CTL_ADD, listenSocket, &event) == -1){ perror("epoll_ctl: conn_sock"); return -1; } // initialize the new socket event so it only needs to be done once addEvent.events = EPOLLIN | EPOLLERR | EPOLLHUP; // epoll loop while(1){ // epoll on descriptors up to listen limit with no timeout fdCount = epoll_wait (epollfd, events, LISTEN_LIMIT, -1); // error check if(fdCount == -1){ perror("Epoll failed"); return -1; } // loop through active events for(i = 0; i < fdCount; ++i){ // Check this event for error if(events[i].events & EPOLLERR){ fprintf(stderr, "Error on socket %d\n", events[i].data.fd); close(events[i].data.fd); // epoll will remove interest automatically on close continue; } // check for hangup if(events[i].events & EPOLLHUP){ close(events[i].data.fd); // epoll will remove interest automatically on close continue; } // check for data if(events[i].events & EPOLLIN){ // see if this is an accept if(events[i].data.fd == listenSocket){ // loop accepting new connections and setting them non-blocking while((newSocket = accept4(listenSocket, (struct sockaddr*)&remote, &remoteLen, SOCK_NONBLOCK)) != -1){ // add the new socket to the epoll set // events flags are already set to IN | ERR | HUP | ET addEvent.data.fd = newSocket; if(epoll_ctl(epollfd, EPOLL_CTL_ADD, newSocket, &addEvent) == -1){ perror("Epoll ctl failed with new socket"); return -1; } } // check to make sure the error was as expected if(errno != EAGAIN || errno != EWOULDBLOCK){ perror("Error on accept4"); return -1; } // done accepting, next socket continue; } // end of accept handler //read data from the socket buflen = 0; while((thisRead = recv(events[i].data.fd, &buffer[buflen], BUFFER_SIZE - buflen, 0)) > 0){ // space taken from the buflen += thisRead; // check to see if the buffer is full if(buflen == BUFFER_SIZE){ // send and flush send(events[i].data.fd, buffer, buflen, 0); buflen = 0; } } // end of reading if(thisRead == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)){ // socket data exhaused with no read error send(events[i].data.fd, buffer, buflen, 0); } else if (thisRead == 0){ // socket performed a shutdown close(events[i].data.fd); // epoll will remove interest automatically on close } else { // some error has occured perror("Receive error"); return -1; } } // end of data handler } // end of events loop } return 0; }
/* * Configuation settings for the ESPT-GIGA board * * Copyright (C) 2008 Renesas Solutions Corp. * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __ESPT_H #define __ESPT_H #define CONFIG_CPU_SH7763 1 #define CONFIG_ESPT 1 #define __LITTLE_ENDIAN 1 /* * Command line configuration. */ #define CONFIG_CMD_SDRAM #define CONFIG_CMD_MII #define CONFIG_CMD_PING #define CONFIG_CMD_ENV #define CONFIG_BOOTDELAY -1 #define CONFIG_BOOTARGS "console=ttySC0,115200 root=1f01" #define CONFIG_ENV_OVERWRITE 1 #define CONFIG_VERSION_VARIABLE #undef CONFIG_SHOW_BOOT_PROGRESS /* SCIF */ #define CONFIG_SCIF_CONSOLE 1 #define CONFIG_BAUDRATE 115200 #define CONFIG_CONS_SCIF0 1 #define CONFIG_SYS_TEXT_BASE 0x8FFC0000 #define CONFIG_SYS_LONGHELP /* undef to save memory */ #define CONFIG_SYS_CBSIZE 256 /* Buffer size for input from the Console */ #define CONFIG_SYS_PBSIZE 256 /* Buffer size for Console output */ #define CONFIG_SYS_MAXARGS 16 /* max args accepted for monitor commands */ #define CONFIG_SYS_BARGSIZE 512 /* Buffer size for Boot Arguments passed to kernel */ #define CONFIG_SYS_BAUDRATE_TABLE { 115200 } /* List of legal baudrate settings for this board */ /* SDRAM */ #define CONFIG_SYS_SDRAM_BASE (0x8C000000) #define CONFIG_SYS_SDRAM_SIZE (64 * 1024 * 1024) #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE) #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (60 * 1024 * 1024)) /* Flash(NOR) S29JL064H */ #define CONFIG_SYS_FLASH_BASE (0xA0000000) #define CONFIG_SYS_FLASH_CFI_WIDTH (FLASH_CFI_16BIT) #define CONFIG_SYS_MAX_FLASH_BANKS (1) #define CONFIG_SYS_MAX_FLASH_SECT (150) /* U-Boot setting */ #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 4 * 1024 * 1024) #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_FLASH_BASE) #define CONFIG_SYS_MONITOR_LEN (128 * 1024) /* Size of DRAM reserved for malloc() use */ #define CONFIG_SYS_MALLOC_LEN (1024 * 1024) #define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024) #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER #undef CONFIG_SYS_FLASH_QUIET_TEST #define CONFIG_SYS_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */ /* Timeout for Flash erase operations (in ms) */ #define CONFIG_SYS_FLASH_ERASE_TOUT (3 * 1000) /* Timeout for Flash write operations (in ms) */ #define CONFIG_SYS_FLASH_WRITE_TOUT (3 * 1000) /* Timeout for Flash set sector lock bit operations (in ms) */ #define CONFIG_SYS_FLASH_LOCK_TOUT (3 * 1000) /* Timeout for Flash clear lock bit operations (in ms) */ #define CONFIG_SYS_FLASH_UNLOCK_TOUT (3 * 1000) /* Use hardware flash sectors protection instead of U-Boot software protection */ #undef CONFIG_SYS_FLASH_PROTECTION #undef CONFIG_SYS_DIRECT_FLASH_TFTP #define CONFIG_ENV_IS_IN_FLASH #define CONFIG_ENV_SECT_SIZE (128 * 1024) #define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE) #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + (1 * CONFIG_ENV_SECT_SIZE)) /* Offset of env Flash sector relative to CONFIG_SYS_FLASH_BASE */ #define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE) #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SECT_SIZE) #define CONFIG_ENV_ADDR_REDUND (CONFIG_SYS_FLASH_BASE + (2 * CONFIG_ENV_SECT_SIZE)) /* Clock */ #define CONFIG_SYS_CLK_FREQ 66666666 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SYS_TMU_CLK_DIV 4 /* Ether */ #define CONFIG_SH_ETHER 1 #define CONFIG_SH_ETHER_USE_PORT (1) #define CONFIG_SH_ETHER_PHY_ADDR (0x00) #define CONFIG_PHYLIB #define CONFIG_BITBANGMII #define CONFIG_BITBANGMII_MULTI #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII #endif /* __SH7763RDP_H */
#ifdef NS3_MODULE_COMPILATION # error "Do not include ns3 module aggregator headers from other modules; these are meant only for end user scripts." #endif #ifndef NS3_MODULE_CORE // Module headers: #include "abort.h" #include "assert.h" #include "attribute-accessor-helper.h" #include "attribute-construction-list.h" #include "attribute-helper.h" #include "attribute.h" #include "boolean.h" #include "breakpoint.h" #include "calendar-scheduler.h" #include "callback.h" #include "command-line.h" #include "config.h" #include "default-deleter.h" #include "default-simulator-impl.h" #include "deprecated.h" #include "double.h" #include "empty.h" #include "enum.h" #include "event-id.h" #include "event-impl.h" #include "fatal-error.h" #include "fatal-impl.h" #include "global-value.h" #include "heap-scheduler.h" #include "int-to-type.h" #include "int64x64-128.h" #include "int64x64-double.h" #include "int64x64.h" #include "integer.h" #include "list-scheduler.h" #include "log.h" #include "make-event.h" #include "map-scheduler.h" #include "math.h" #include "names.h" #include "nstime.h" #include "object-base.h" #include "object-factory.h" #include "object-map.h" #include "object-ptr-container.h" #include "object-vector.h" #include "object.h" #include "pointer.h" #include "ptr.h" #include "random-variable-stream.h" #include "random-variable.h" #include "ref-count-base.h" #include "rng-seed-manager.h" #include "rng-stream.h" #include "scheduler.h" #include "simple-ref-count.h" #include "simulation-singleton.h" #include "simulator-impl.h" #include "simulator.h" #include "singleton.h" #include "string.h" #include "synchronizer.h" #include "system-condition.h" #include "system-path.h" #include "system-wall-clock-ms.h" #include "test.h" #include "timer-impl.h" #include "timer.h" #include "trace-source-accessor.h" #include "traced-callback.h" #include "traced-value.h" #include "type-id.h" #include "type-name.h" #include "type-traits.h" #include "uinteger.h" #include "unused.h" #include "vector.h" #include "watchdog.h" #endif
/*************************************************************************** * Copyright (C) 2007-2009 by Glen Masgai * * mimosius@users.sourceforge.net * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CSLLISTCTRLPLAYER_H #define CSLLISTCTRLPLAYER_H /** @author Glen Masgai <mimosius@users.sourceforge.net> */ #include "CslListCtrl.h" WX_DEFINE_ARRAY_PTR(CslPlayerStatsData*,t_aCslPlayerStatsData); class CslListCtrlPlayer : public CslListCtrl { public: enum { SIZE_MICRO, SIZE_MINI, SIZE_DEFAULT, SIZE_FULL }; CslListCtrlPlayer(wxWindow* parent,wxWindowID id,const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize,long style=wxLC_ICON, const wxValidator& validator=wxDefaultValidator, const wxString& name=wxListCtrlNameStr); ~CslListCtrlPlayer(); void ListInit(const wxInt32 view); void ListAdjustSize(const wxSize& size=wxDefaultSize); void UpdateData(); void EnableEntries(bool enable); void ListClear(); void ServerInfo(CslServerInfo *info); CslServerInfo* ServerInfo() { return m_info; } wxInt32 View() { return m_view; } static wxSize BestSizeMicro; static wxSize BestSizeMini; private: wxInt32 m_view; CslServerInfo *m_info; CslListSortHelper m_sortHelper; bool m_processSelectEvent; t_aCslPlayerStatsData m_selected; void OnColumnLeftClick(wxListEvent& event); void OnItemSelected(wxListEvent& event); void OnItemDeselected(wxListEvent& event); void OnItemActivated(wxListEvent& event); void OnContextMenu(wxContextMenuEvent& event); void OnMenu(wxCommandEvent& event); DECLARE_EVENT_TABLE() protected: wxInt32 ListFindItem(CslPlayerStatsData *data,wxListItem& item); void ListSort(const wxInt32 column); void GetToolTipText(wxInt32 row,CslToolTipEvent& event); wxString GetScreenShotFileName(); wxWindow *GetScreenShotWindow() { return GetParent(); } wxSize GetImageListSize(); static int wxCALLBACK ListSortCompareFunc(long item1,long item2,IntPtr data); }; class CslPanelPlayer : public wxPanel { public: CslPanelPlayer(wxWindow* parent,long listStyle=wxLC_ICON); CslListCtrlPlayer* ListCtrl() { return m_listCtrl; } CslServerInfo* ServerInfo() { return m_listCtrl->ServerInfo(); } void ServerInfo(CslServerInfo *info) { m_listCtrl->ServerInfo(info); } void UpdateData(); void CheckServerStatus(); private: void OnSize(wxSizeEvent& event); DECLARE_EVENT_TABLE() protected: wxFlexGridSizer *m_sizer; CslListCtrlPlayer *m_listCtrl; wxStaticText *m_label; wxString GetLabelText(); }; #endif
#ifndef AY8910_H #define AY8910_H #define MAX_8910 5 #define ALL_8910_CHANNELS -1 struct AY8910interface { int num; /* total number of 8910 in the machine */ int baseclock; int mixing_level[MAX_8910]; mem_read_handler portAread[MAX_8910]; mem_read_handler portBread[MAX_8910]; mem_write_handler portAwrite[MAX_8910]; mem_write_handler portBwrite[MAX_8910]; void (*handler[MAX_8910])(int irq); /* IRQ handler for the YM2203 */ }; void AY8910_reset(int chip); void AY8910_set_clock(int chip,int _clock); void AY8910_set_volume(int chip,int channel,int volume); void AY8910Write(int chip,int a,int data); int AY8910Read(int chip); READ_HANDLER( AY8910_read_port_0_r ); READ_HANDLER( AY8910_read_port_1_r ); READ_HANDLER( AY8910_read_port_2_r ); READ_HANDLER( AY8910_read_port_3_r ); READ_HANDLER( AY8910_read_port_4_r ); WRITE_HANDLER( AY8910_control_port_0_w ); WRITE_HANDLER( AY8910_control_port_1_w ); WRITE_HANDLER( AY8910_control_port_2_w ); WRITE_HANDLER( AY8910_control_port_3_w ); WRITE_HANDLER( AY8910_control_port_4_w ); WRITE_HANDLER( AY8910_write_port_0_w ); WRITE_HANDLER( AY8910_write_port_1_w ); WRITE_HANDLER( AY8910_write_port_2_w ); WRITE_HANDLER( AY8910_write_port_3_w ); WRITE_HANDLER( AY8910_write_port_4_w ); int AY8910_sh_start(const struct MachineSound *msound); #endif
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <check.h> #include "check-helpers.h" #include "check-libempathy.h" #include "check-empathy-helpers.h" #include <libempathy/empathy-chatroom.h> #if 0 static EmpathyChatroom * create_chatroom (void) { EmpathyAccount *account; EmpathyChatroom *chatroom; account = get_test_account (); chatroom = empathy_chatroom_new (account); fail_if (chatroom == NULL); return chatroom; } START_TEST (test_empathy_chatroom_new) { EmpathyChatroom *chatroom; gboolean auto_connect, favorite; chatroom = create_chatroom (); fail_if (empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (auto_connect); fail_if (favorite); g_object_unref (empathy_chatroom_get_account (chatroom)); g_object_unref (chatroom); } END_TEST START_TEST (test_favorite_and_auto_connect) { /* auto connect implies favorite */ EmpathyChatroom *chatroom; gboolean auto_connect, favorite; chatroom = create_chatroom (); /* set auto_connect so favorite as a side effect */ empathy_chatroom_set_auto_connect (chatroom, TRUE); fail_if (!empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (!auto_connect); fail_if (!favorite); /* Remove auto_connect. Chatroom is still favorite */ empathy_chatroom_set_auto_connect (chatroom, FALSE); fail_if (empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (auto_connect); fail_if (!favorite); /* Remove favorite too now */ g_object_set (chatroom, "favorite", FALSE, NULL); fail_if (empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (auto_connect); fail_if (favorite); /* Just add favorite but not auto-connect */ g_object_set (chatroom, "favorite", TRUE, NULL); fail_if (empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (auto_connect); fail_if (!favorite); /* ... and re-add auto_connect */ g_object_set (chatroom, "auto_connect", TRUE, NULL); fail_if (!empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (!auto_connect); fail_if (!favorite); /* Remove favorite remove auto_connect too */ g_object_set (chatroom, "favorite", FALSE, NULL); fail_if (empathy_chatroom_get_auto_connect (chatroom)); g_object_get (chatroom, "auto_connect", &auto_connect, "favorite", &favorite, NULL); fail_if (auto_connect); fail_if (favorite); g_object_unref (empathy_chatroom_get_account (chatroom)); g_object_unref (chatroom); } END_TEST static void favorite_changed (EmpathyChatroom *chatroom, GParamSpec *spec, gboolean *changed) { *changed = TRUE; } START_TEST (test_change_favorite) { EmpathyChatroom *chatroom; gboolean changed = FALSE; chatroom = create_chatroom (); g_signal_connect (chatroom, "notify::favorite", G_CALLBACK (favorite_changed), &changed); /* change favorite to TRUE */ g_object_set (chatroom, "favorite", TRUE, NULL); fail_if (!changed); changed = FALSE; /* change favorite to FALSE */ g_object_set (chatroom, "favorite", FALSE, NULL); fail_if (!changed); } END_TEST #endif TCase * make_empathy_chatroom_tcase (void) { TCase *tc = tcase_create ("empathy-chatroom"); /* tcase_add_test (tc, test_empathy_chatroom_new); tcase_add_test (tc, test_favorite_and_auto_connect); tcase_add_test (tc, test_change_favorite); */ return tc; }
/********************************************************************* PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. See LICENSE and COPYING for usage. Do not redistribute without a written permission by the Copyright holders. *********************************************************************/ #ifndef INCLUDE_PICO_F4X7_ETH_H #define INCLUDE_PICO_F4X7_ETH_H #include "pico_config.h" #include "pico_device.h" #include "stm32f4xx_hal_conf.h" void ETH_IRQHandler(void); void pico_eth_destroy(struct pico_device *loop); struct pico_device *pico_eth_create(char *name); #endif /* INCLUDE_PICO_F4X7_ETH_H */
/* * app_config.h * * Created on: 22.03.2013 * Author: guelland */ #ifndef APP_CONFIG_H_ #define APP_CONFIG_H_ #include "config.h" #ifdef _DEBUG //# define DEBUG_TASK_ID_CONF # define DEBUG_LED_TASK_ID 0x3U # define DEBUG_MIDI_TASK_ID 0x2U # define DEBUG_ADC_TASK_ID 0x1U #endif #ifdef STM32_USB_CDC # define STDOUT_USART USB_CDC #endif #endif /* APP_CONFIG_H_ */
// // CXGraphWindowController.h // Conto // // Created by Nicola on Sat May 04 2002. // Copyright (c) 2002 by Nicola Vitacolonna. All rights reserved. // // This file is part of Conto. // // Conto 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. // // Conto 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 Conto; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #import <Cocoa/Cocoa.h> #import "globals.h" @class CXGraphView; @interface CXGraphWindowController : NSWindowController { IBOutlet CXGraphView *graphView; //NSNumberFormatter *numberFormatter; } // Accessor methods - (CXGraphView *)graphView; //- (NSNumberFormatter *)numberFormatter; // Notifications - (void)updateGraph:(NSNotification *)notification; - (void)setNumberFormat:(NSNotification *)notification; // Printing - (IBAction)printDocumentView:(id)sender; @end
/* * WPA Supplicant - Basic AP mode support routines * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi> * Copyright (c) 2009, Atheros Communications * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #ifndef AP_H #define AP_H int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s); void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant *wpa_s, const u8 *src_addr, const u8 *buf, size_t len); int wpa_supplicant_ap_wps_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid, const u8 *p2p_dev_addr); int wpa_supplicant_ap_wps_pin(struct wpa_supplicant *wpa_s, const u8 *bssid, const char *pin, char *buf, size_t buflen); int wpa_supplicant_ap_wps_cancel(struct wpa_supplicant *wpa_s); void wpas_wps_ap_pin_disable(struct wpa_supplicant *wpa_s); const char * wpas_wps_ap_pin_random(struct wpa_supplicant *wpa_s, int timeout); const char * wpas_wps_ap_pin_get(struct wpa_supplicant *wpa_s); int wpas_wps_ap_pin_set(struct wpa_supplicant *wpa_s, const char *pin, int timeout); int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s, char *buf, size_t buflen); int ap_ctrl_iface_sta(struct wpa_supplicant *wpa_s, const char *txtaddr, char *buf, size_t buflen); int ap_ctrl_iface_sta_next(struct wpa_supplicant *wpa_s, const char *txtaddr, char *buf, size_t buflen); int ap_ctrl_iface_sta_deauthenticate(struct wpa_supplicant *wpa_s, const char *txtaddr); int ap_ctrl_iface_sta_disassociate(struct wpa_supplicant *wpa_s, const char *txtaddr); int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen, int verbose); void ap_tx_status(void *ctx, const u8 *addr, const u8 *buf, size_t len, int ack); void ap_eapol_tx_status(void *ctx, const u8 *dst, const u8 *data, size_t len, int ack); void ap_client_poll_ok(void *ctx, const u8 *addr); void ap_rx_from_unknown_sta(void *ctx, const u8 *addr, int wds); void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt); void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok); int wpa_supplicant_ap_update_beacon(struct wpa_supplicant *wpa_s); int wpa_supplicant_ap_mac_addr_filter(struct wpa_supplicant *wpa_s, const u8 *addr); void wpa_supplicant_ap_pwd_auth_fail(struct wpa_supplicant *wpa_s); #endif /* AP_H */
#ifndef BITMAP_H #define BITMAP_H #include <stdint.h> namespace stickman_common { // TODO: bitmap cleanup class bitmap { public: bitmap(void *fileHandle); uint32_t size; /* Size of bitmap in bytes */ int32_t width; /* Image width in pixels */ int32_t height; /* Image height in pixels */ uint16_t bitsPerPixel; /* Number of bits per pixel */ // Pixel format: AA BB GG RR -> bottom up uint32_t *pixels; /* Pixel buffer for the bitmap */ private: // bitmap file format // http://www.fileformat.info/format/bmp/egff.htm // A note on pragma pack // the compiler does not have to create a data structure in the format // your give it. It can byte align things where it sees fit. If we want to be able // to cold cast things, we will have to tell the compiler to not try to byte align // anythign in the structure #pragma pack(push, 1) struct bitmap_header { uint16_t FileType; /* File type, always 4D42h ("BM") */ uint32_t FileSize; /* Size of the file in bytes */ uint16_t Reserved1; /* Always 0 */ uint16_t Reserved2; /* Always 0 */ uint32_t BitmapOffset; /* Starting position of image data in bytes */ uint32_t Size; /* Size of this header in bytes */ int32_t Width; /* Image width in pixels */ int32_t Height; /* Image height in pixels */ uint16_t Planes; /* Number of color planes */ uint16_t BitsPerPixel; /* Number of bits per pixel */ uint32_t Compression; /* Compression methods used */ uint32_t SizeOfBitmap; /* Size of bitmap in bytes */ int32_t HorzResolution; /* Horizontal resolution in pixels per meter */ int32_t VertResolution; /* Vertical resolution in pixels per meter */ uint32_t ColorsUsed; /* Number of colors in the image */ uint32_t ColorsImportant; /* Minimum number of important colors */ /* Fields added for Windows 4.x follow this line */ uint32_t RedMask; /* Mask identifying bits of red component */ uint32_t GreenMask; /* Mask identifying bits of green component */ uint32_t BlueMask; /* Mask identifying bits of blue component */ uint32_t AlphaMask; /* Mask identifying bits of alpha component */ uint32_t CSType; /* Color space type */ int32_t RedX; /* X coordinate of red endpoint */ int32_t RedY; /* Y coordinate of red endpoint */ int32_t RedZ; /* Z coordinate of red endpoint */ int32_t GreenX; /* X coordinate of green endpoint */ int32_t GreenY; /* Y coordinate of green endpoint */ int32_t GreenZ; /* Z coordinate of green endpoint */ int32_t BlueX; /* X coordinate of blue endpoint */ int32_t BlueY; /* Y coordinate of blue endpoint */ int32_t BlueZ; /* Z coordinate of blue endpoint */ uint32_t GammaRed; /* Gamma red coordinate scale value */ uint32_t GammaGreen; /* Gamma green coordinate scale value */ uint32_t GammaBlue; /* Gamma blue coordinate scale value */ }; #pragma pack(pop) }; } #endif // BITMAP_H
#pragma once #include <memory> #include "Padding.h" #include "BlockMode.h" using namespace std; class IBufferCipher { public: virtual void EncipherBuffer( const char * i_pInputBuffer, size_t i_nInputSize, char * o_pOutputBuffer, size_t i_nOutputSize) = 0; }; template<unsigned int NLength> class BufferCipher : public IBufferCipher<NLength> { public: BufferCipher( shared_ptr<IBlockLoader<NLength>> m_pBlockLoader; shared_ptr<IMultiBlockCipher<NLength>> m_pMultiBlockCipher;) : m_pBlockLoader(i_pBlockLoader), m_pMultiBlockCipher(i_pMultiBlockCipher) { assert(m_pBlockLoader.get() && m_pBlockCipher.get()); } virtual void EncipherBuffer( const char * i_pInputBuffer, size_t i_nInputSize, char * o_pOutputBuffer, size_t i_nOutputSize) override; protected: shared_ptr<IBlockLoader<NLength>> m_pBlockLoader; shared_ptr<IMultiBlockCipher<NLength>> m_pMultiBlockCipher; }; template<unsigned int NLength> void BufferCipher<NLength>::EncipherBuffer( const char * i_pInputBuffer, size_t i_nInputSize, char * o_pOutputBuffer, size_t i_nOutputSize) { //Load blocks vector<array<uint64_t, NLength>> vectInputBlocks; vectInputBlocks.reserve( i_nInputSize / sizeof(array<uint64_t, NLength>) + !!(i_nInputSize % sizeof(array<uint64_t, NLength>)); m_pBlockLoader->PreparePaddedBlocks( i_pInputBuffer, i_nInputSize, back_inserter(vectInputBlocks)); //Encipher the blocks vector<array<uint64_t, NLength>> vectOutputBlocks; vectOutputBlocks.reserve(vectInputBlocks.size()); m_pMultiBlockCipher->EncipherBlocks( vectInputBlocks.begin(), vectInputBlocks.end(), back_inserter(vectOutputBlocks)); //Unload blocks m_pBlockLoader->PrepareUnpaddedBuffer( vectOutputBlocks.begin(), vectOutputBlocks.end(), o_pOutputBuffer, i_nOutputSize); } template<unsigned int NLength, unsigned int NDirection> shared_ptr<IBufferCipher> CreateBufferCipherTT( const ProgramOptions & i_oOptions, const char * i_pKeyBuffer, size_t i_nKeyBufferSize) { shared_ptr<IMultiBlockCipher<NLength>> pMultiBlockCipher = CreateMultiBlockCipherTT<NLength, NDirection>( i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); shared_ptr<IBlockLoader<NLength>> pBlockLoader = CreateBlockLoaderTT<NLength, NDirection>( i_oOptions); shared_ptr<IBufferCipher> pBufferCipher = nullptr; if(pBlockLoader.get() && pMultiBlockCipher.get()) { pBufferCipher = shared_ptr<IBufferCipher>( new (nothrow) BufferCipher<NLength>( pBlockLoader.get(), pMultiBlockCipher.get())); } return pBufferCipher; } template<unsigned int NLength> shared_ptr<IBufferCipher> CreateBufferCipherT( const ProgramOptions i_oOptions, const char * i_pKeyBuffer, size_t i_nKeyBufferSize) { switch(i_oOptions.m_eDirectionOption) { case ENCRYPT: return CreateBufferCipherTT<NLength, ENCRYPT>( i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case DECRYPT: return CreateBufferCipherTT<NLength, DECRYPT>( i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); default: return nullptr; } } inline shared_ptr<IBufferCipher> CreateBufferCipher( const ProgramOptions & i_oOptions, const char * i_pKeyBuffer, size_t i_nKeyBufferSize) { switch(i_oOptions.m_eBlockSizeOption) { case BLOCK_SIZE_64: return CreateBufferCipherT<1U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_128: return CreateBufferCipherT<2U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_256: return CreateBufferCipherT<4U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_512: return CreateBufferCipherT<8U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_1024: return CreateBufferCipherT<16U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_2048: return CreateBufferCipherT<32U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); case BLOCK_SIZE_4096: return CreateBufferCipherT<64U>(i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); default: return nullptr; } } inline int EncipherBuffer( const ProgramOptions & i_oOptions, const char * i_pInputBuffer, size_t i_nInputSize, char * o_pOutputBuffer, size_t i_nOutputSize, const char * i_pKey, size_t i_nKeyBufferSize) { //Input validation assert(i_oOptions.IsValid()); assert(i_pInputBuffer && i_nInputSize); assert(io_pOutputBuffer && i_nOutputSize); assert(i_pKey && i_nKeyBufferSize); assert(i_nKeyBufferSize >= EvalKeyBufferSize(i_oOptions)); assert(i_oOptions.m_eDirectionOption != ENCRYPT || i_nOutputSize >= EvalSizeAfterPadding(i_nInputSize, i_oOptions)); //%Output size should be >= floor(size / block size) * block size and // <= ceil(size / block size) * block size to indicate padding if decrypting //%Buffers should not alias eachother if(!(i_oOptions.IsValid() && i_pInputBuffer && i_nInputSize && io_pOutputBuffer && i_nOutputSize && i_pKey && i_nKeyBufferSize && i_nKeyBufferSize >= EvalKeyBufferSize(i_oOptions) && (i_oOptions.m_eDirectionOption != ENCRYPT || i_nOutputSize >= EvalSizeAfterPadding(i_nInputSize, i_oOptions)))) return FAILURE; //Create buffer cipher from options shared_ptr<IBufferCipher> pBufferCipher = CreateBufferCipher( i_oOptions, i_pKeyBuffer, i_nKeyBufferSize); assert(pBufferCipher.get()); if(!pBufferCipher.get()) return FAILURE; //Encipher the buffer pBufferCipher->EncipherBuffer( i_pInputBuffer, i_nInputSize, o_pOutputBuffer, i_nOutputSize); return SUCCESS; }
// Polygonizer.h: Polygonizer // ////////////////////////////////////////////////////////////////////// #include "../DataStructure/PointSet.h" #include "../DataStructure/PolygonalMesh.h" #include "../numericalC/SVD.h" #include "ImplicitFunction.h" class Polygonizer { public: float spaceX, spaceY, spaceZ; int dimX, dimY, dimZ; float originX, originY, originZ; ImplicitFunction* func; int thread_num; public: void searchZero(float p[], float start[], float end[], float f1, float f2, float e); void cutQuad(PolygonalMesh* mesh); void bisection(float p[3], float start[3], float end[3], float e); PolygonalMesh* dualContouring(float epsilon, float tau); float smoothGridPointValue(int i, int j, int k, float ***fValue, bool ***pValid); bool isBoundaryGridPoint(int i, int j, int k, float ***fValue, bool ***pValid); inline void weightD(float g[], double d2, double R2, float vx, float vy, float vz); inline float value(float vx, float vy, float vz, float nx, float ny, float nz, double R2, bool &isValid); void setSpace(float x, float y, float z); void setOrigin(float x, float y, float z); void setDim(int dimX, int dimY, int dimZ); Polygonizer(); virtual ~Polygonizer(); /* static inline BOOL INVERSE(double B[10], double A[10]){ double d = DET(A); if(fabs(d) < EPSILON) return false; B[0] = (A[3]*A[5] - A[4]*A[4])/d; B[1] = (A[2]*A[4] - A[1]*A[5])/d; B[2] = (A[1]*A[4] - A[2]*A[3])/d; B[3] = (A[0]*A[5] - A[2]*A[2])/d; B[4] = (A[1]*A[2] - A[0]*A[4])/d; B[5] = (A[0]*A[3] - A[1]*A[1])/d; return true; } */ static inline double DET(double A[10]){ return A[0]*A[3]*A[5] + 2.0*A[1]*A[4]*A[2] -A[2]*A[2]*A[3] - A[1]*A[1]*A[5] - A[4]*A[4]*A[0]; } static inline void MATRIX(double A[10], double n[3], double d){ A[0] = n[0]*n[0]; A[1] = n[0]*n[1]; A[2] = n[0]*n[2]; A[3] = n[1]*n[1]; A[4] = n[1]*n[2]; A[5] = n[2]*n[2]; A[6] = d*n[0]; A[7] = d*n[1]; A[8] = d*n[2]; A[9] = d*d; } static inline void MAT_TIMES(double A[10], double k){ A[0] *= k; A[1] *= k; A[2] *= k; A[3] *= k; A[4] *= k; A[5] *= k; A[6] *= k; A[7] *= k; A[8] *= k; A[9] *= k; } static inline void MAT_SUM(double B[10], double A[10]){ B[0] += A[0]; B[1] += A[1]; B[2] += A[2]; B[3] += A[3]; B[4] += A[4]; B[5] += A[5]; B[6] += A[6]; B[7] += A[7]; B[8] += A[8]; B[9] += A[9]; } static inline void MAT_BY_VEC(double v[3], double A[10], double b[3]){ v[0] = A[0]*b[0] + A[1]*b[1] + A[2]*b[2]; v[1] = A[1]*b[0] + A[3]*b[1] + A[4]*b[2]; v[2] = A[2]*b[0] + A[4]*b[1] + A[5]*b[2]; } static inline void MAT_BY_VEC(float v[3], double A[10], float b[3]){ v[0] = (float)(A[0]*b[0] + A[1]*b[1] + A[2]*b[2]); v[1] = (float)(A[1]*b[0] + A[3]*b[1] + A[4]*b[2]); v[2] = (float)(A[2]*b[0] + A[4]*b[1] + A[5]*b[2]); } static inline void MAT_INIT(double A[10]){ A[0] = A[1] = A[2] = A[3] = A[4] = A[5] = A[6] = A[7] = A[8] = A[9] = 0; } static inline void MAT_PLUS(double C[10], double A[10], double B[10]){ C[0] = A[0] + B[0]; C[1] = A[1] + B[1]; C[2] = A[2] + B[2]; C[3] = A[3] + B[3]; C[4] = A[4] + B[4]; C[5] = A[5] + B[5]; C[6] = A[6] + B[6]; C[7] = A[7] + B[7]; C[8] = A[8] + B[8]; C[9] = A[9] + B[9]; } static inline void MAT_COPY(double A[10], double B[10]){ A[0] = B[0]; A[1] = B[1]; A[2] = B[2]; A[3] = B[3]; A[4] = B[4]; A[5] = B[5]; A[6] = B[6]; A[7] = B[7]; A[8] = B[8]; A[9] = B[9]; } static inline double Q_ERR(double A[10], float v[3]){ return v[0]*(A[0]*v[0] + A[1]*v[1] + A[2]*v[2]) + v[1]*(A[1]*v[0] + A[3]*v[1] + A[4]*v[2]) + v[2]*(A[2]*v[0] + A[4]*v[1] + A[5]*v[2]) + 2.0*(A[6]*v[0] + A[7]*v[1] + A[8]*v[2]) + A[9]; } static inline double Q_ERR(double A[10], double v[3]){ return v[0]*(A[0]*v[0] + A[1]*v[1] + A[2]*v[2]) + v[1]*(A[1]*v[0] + A[3]*v[1] + A[4]*v[2]) + v[2]*(A[2]*v[0] + A[4]*v[1] + A[5]*v[2]) + 2.0*(A[6]*v[0] + A[7]*v[1] + A[8]*v[2]) + A[9]; } };
/*************************************** * Copyright (c) 2013 Charles Hache <chache@brood.ca>. All rights reserved. * * This file is part of the prjOS project. * prjOS 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. * * prjOS 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 prjOS. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Charles Hache <chache@brood.ca> - initial API and implementation ***************************************/ /* * send.c */ #include <prjOS/include/sys_syscall.h> uint32_t prjSend(task_id_t tid, uint8_t *msg, uint32_t msgLen, uint8_t *reply, uint32_t replyLen) { asm (svcArg(SYSCALL_SEND)); uint32_t ret; asm (" MOV %[ret], R0\n": [ret] "=r" (ret): :); return ret; } static void push(TaskDescriptor* active, TaskDescriptor* receiving){ if(receiving->sendQueueHead==0){ receiving->sendQueueHead=active; receiving->sendQueueTail=active; active->sendQueueNext=0; } else{ TaskDescriptor* lastTask = (TaskDescriptor*)receiving->sendQueueTail; lastTask->sendQueueNext=active; receiving->sendQueueTail=active; active->sendQueueNext=0; } } uint32_t sys_send(TaskDescriptor* active, KernelData * kData) { //NOTE: The return value can also be set from Reply();ERR_SEND_INCOMPLETE //bwprintf("SEND: DEBUG: Sending...\n\r"); uint32_t ret = 0; /* Do error checking on arguments */ /* Is the tid possible? */ uint32_t tid = active->systemCall.param1; uint32_t generationId = (tid & TASKS_ID_GENERATION_MASK) >> TASKS_ID_GENERATION_SHIFTBITS; uint32_t taskIndex = tid & TASKS_ID_INDEX_MASK; if (generationId == 0 || taskIndex < 0 || taskIndex >= kData->tdCount) { active->state = TASKS_STATE_RUNNING; return ERR_SEND_TASKID_DNE; } /* Does the task exist? */ TaskDescriptor* receiveTask = findTd(tid, kData->taskDescriptorList, kData->tdCount); if (receiveTask == 0) { active->state = TASKS_STATE_RUNNING; return ERR_SEND_TASKID_NOTFOUND; } /* Are the buffers any good? */ uint8_t* message = (uint8_t*)active->systemCall.param2; uint32_t messageLen = active->systemCall.param3; uint8_t* reply = (uint8_t*)active->systemCall.param4; uint32_t replyLen = active->systemCall.param5; if (message == 0 || reply == 0 || replyLen == 0) { active->state = TASKS_STATE_RUNNING; return ERR_SEND_BAD_BUFFER; } // Is the receiver ready? //bwprintf("SEND: DEBUG: Checking Receiver\n\r"); if (receiveTask->state == TASKS_STATE_SEND_BLK) { //bwprintf("SEND: DEBUG: Receiver is already ready.\n\r"); // Update the receiver's state receiveTask->state = TASKS_STATE_RUNNING; // Update the sender's state active->state = TASKS_STATE_RPLY_BLK; receiveTask->sendQueueHead = 0; //reset pointer //Copy message to receiver's buffer uint32_t destSize = receiveTask->systemCall.param3; uint8_t* destination = (uint8_t*)receiveTask->systemCall.param2; uint32_t* receiverTidParam = (uint32_t*)receiveTask->systemCall.param1; // Set the tid of the receive *(receiverTidParam) = active->taskId; uint32_t size = messageLen; if (size > destSize) { size = destSize; } memcpy(destination, message, size); if (size < messageLen) { receiveTask->systemCall.returnValue = ERR_RECEIVE_BUFFER_TOO_SMALL; } else { receiveTask->systemCall.returnValue = size; } ret = messageLen; } else { //bwprintf("SEND: DEBUG: Receiver not ready; blocking.\n\r"); //Receiver is not ready, increase its priority if required //Note that this won't have an effect until the next time the task // gets put in the ready queue. //TODO: implement this part //if (receiveTask->currentPriority < activeTask->currentPriority) // receiveTask->currentPriority = activeTask->currentPriority; // Set state to receive blocked active->state = TASKS_STATE_RCVD_BLK; // add active task to send queue push(active,receiveTask); } //bwprintf("SEND: DEBUG: Done Sending...\n\r"); return ret; }
/* * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2004,2006,2007 Free Software Foundation, Inc. * * GRUB 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. * * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 /* FIXME (sparc64). */ typedef unsigned long grub_jmp_buf[20]; int grub_setjmp (grub_jmp_buf env); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); #endif /* ! GRUB_SETJMP_CPU_HEADER */
/* libmetaoptions - A collection of option-related functions. Copyright (C) 2000-2004 B. Augestad, bjorn.augestad@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 */ #include "metaoptions.h" #include <math.h> /* Optimizations: * Calls/sec Action * 171.000 Using gvega_inlined() instead of vega() * 177.000 Removed call to blackscholes() in test program * 196.000 Calling NewtonRaphson_call() and _put(). * 377.000 Quite impressive, can it be correct? Making the _put/call() versions inline. * 395.000 A slight improvement, but is it worth it? Nope, we rollback the changes. * 377.000 Making epsilon a static const common to all functions in this file. * 385.000 Removing the algo from NewtonRaphson(), we don't need three versions of it... */ static const double epsilon = 0.00000000001; int NewtonRaphson(int fCall, double S, double X, double T, double r, double cm, double *piv) { assert_valid_price(S); assert_valid_strike(X); assert_valid_time(T); assert_valid_interest_rate(r); if(fCall) return NewtonRaphson_call(S, X, T, r, cm, piv); else return NewtonRaphson_put(S, X, T, r, cm, piv); } /* * TODO(20070506 boa): * This function (and its _put buddy) is broken by design. If cm(aka price) * is outside sane limits, vi (Vol Implied) goes < 0.0. * The functions gbs() and vega() * don't appreciate such input. * We must figure out a way to handle this, avoiding an eternal loop. */ int NewtonRaphson_call(double S, double X, double T, double r, double cm, double *piv) { double vi, ci, vegai; assert_valid_price(S); assert_valid_strike(X); assert_valid_time(T); assert_valid_interest_rate(r); /* Compute the Manaster and Koehler seed value (vi) */ vi = sqrt(fabs(log(S/X) + r * T) * 2.0/T); ci = gbs_call(S, X, T, r, r, vi); vegai = vega(S, X, T, r, r, vi); while(fabs(cm - ci) > epsilon) { vi -= (ci - cm)/vegai; if(vi < VOLATILITY_MIN || vi > VOLATILITY_MAX) return 0; ci = gbs_call(S, X, T, r, r, vi); vegai = vega(S, X, T, r, r, vi); } *piv = vi; return 1; } int NewtonRaphson_put(double S, double X, double T, double r, double cm, double *piv) { double vi, ci, vegai; assert_valid_price(S); assert_valid_strike(X); assert_valid_time(T); assert_valid_interest_rate(r); /* Compute the Manaster and Koehler seed value (vi) */ vi = sqrt(fabs(log(S/X) + r * T) * 2.0/T); ci = gbs_put(S, X, T, r, r, vi); vegai = vega(S, X, T, r, r, vi); while(fabs(cm - ci) > epsilon) { vi -= (ci - cm)/vegai; if(vi < VOLATILITY_MIN || vi > VOLATILITY_MAX) return 0; ci = gbs_put(S, X, T, r, r, vi); vegai = vega(S, X, T, r, r, vi); } *piv = vi; return 1; } #ifdef NEWTONRAPHSON_CHECK /* * We use NewtonRaphson() to compute the iv of an european option. * How do we test it? We use one of the other functions to compute * the value of an option, given a v. Then we feed the price into * NewtonRaphson() and see if the returned iv is OK. */ void check_NewtonRaphson(void) { int fCall = 1, ok; double iv, S = 100.0, X = 100.0, T = 0.5, r = 0.08, v = 0.20; double cm = blackscholes(fCall, S, X, T, r, v); ok = NewtonRaphson(fCall, S, X, T, r, cm, &iv); assert(ok); assert_equal(v, iv); fCall = 0; cm = blackscholes(fCall, S, X, T, r, v); ok = NewtonRaphson(fCall, S, X, T, r, cm, &iv); assert(ok); assert_equal(v, iv); } /* WTF??? Two functions? */ /* NewtonRhapson for imp. vol of european options */ void check_NewtonRaphson_put(void) { int fCall = 0, ok; double S = 75.0, X = 70.0, T = 0.5, r = 0.10, v = 0.35; double computed, price = gbs(fCall, S, X, T, r, r, v); ok = NewtonRaphson(fCall, S, X, T, r, price, &computed); assert(ok); assert_equal(computed, v); ok = NewtonRaphson_put(S, X, T, r, price, &computed); assert(ok); assert_equal(computed, v); } int main(void) { check_NewtonRaphson(); check_NewtonRaphson_put(); return 0; } #endif
/* LUFA Library Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim 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, 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. */ /** \file * * Main source file for the LEDNotfier project. This file contains the main tasks of * the demo and is responsible for the initial application hardware configuration. */ #include "LEDNotifier.h" /** LUFA CDC Class driver interface configuration and state information. This structure is * passed to all CDC Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. */ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { .ControlInterfaceNumber = 0, .DataINEndpointNumber = CDC_TX_EPNUM, .DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointDoubleBank = false, .DataOUTEndpointNumber = CDC_RX_EPNUM, .DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointDoubleBank = false, .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointDoubleBank = false, }, }; /** Counter for the software PWM */ static volatile uint8_t SoftPWM_Count; /** Duty cycle for the first software PWM channel */ static volatile uint8_t SoftPWM_Channel1_Duty; /** Duty cycle for the second software PWM channel */ static volatile uint8_t SoftPWM_Channel2_Duty; /** Duty cycle for the third software PWM channel */ static volatile uint8_t SoftPWM_Channel3_Duty; /** Interrupt handler for managing the software PWM channels for the LEDs */ ISR(TIMER0_COMPA_vect, ISR_BLOCK) { uint8_t LEDMask = LEDS_ALL_LEDS; if (++SoftPWM_Count == 0b00011111) SoftPWM_Count = 0; if (SoftPWM_Count >= SoftPWM_Channel1_Duty) LEDMask &= ~LEDS_LED1; if (SoftPWM_Count >= SoftPWM_Channel2_Duty) LEDMask &= ~LEDS_LED2; if (SoftPWM_Count >= SoftPWM_Channel3_Duty) LEDMask &= ~LEDS_LED3; LEDs_SetAllLEDs(LEDMask); } /** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be * used like any regular character stream in the C APIs */ static FILE USBSerialStream; /** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. */ int main(void) { SetupHardware(); /* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */ CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream); sei(); for (;;) { /* Read in next LED colour command from the host */ uint8_t ColourUpdate = fgetc(&USBSerialStream); /* Top 3 bits select the LED, bottom 5 control the brightness */ uint8_t Channel = (ColourUpdate & 0b11100000); uint8_t Duty = (ColourUpdate & 0b00011111); if (Channel & (1 << 5)) SoftPWM_Channel1_Duty = Duty; if (Channel & (1 << 6)) SoftPWM_Channel2_Duty = Duty; if (Channel & (1 << 7)) SoftPWM_Channel3_Duty = Duty; CDC_Device_USBTask(&VirtualSerial_CDC_Interface); USB_USBTask(); } } /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) { /* Disable watchdog if enabled by bootloader/fuses */ MCUSR &= ~(1 << WDRF); wdt_disable(); /* Disable clock division */ clock_prescale_set(clock_div_1); /* Hardware Initialization */ LEDs_Init(); USB_Init(); /* Timer Initialization */ OCR0A = 100; TCCR0A = (1 << WGM01); TCCR0B = (1 << CS00); TIMSK0 = (1 << OCIE0A); } /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); } /** Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void) { CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); }
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef CODEEDITOR_H #define CODEEDITOR_H #include <QPlainTextEdit> #include <QObject> #include <QShortcut> class QPaintEvent; class QResizeEvent; class QSize; class QWidget; class LineNumberArea; class CodeEditor : public QPlainTextEdit { Q_OBJECT public: CodeEditor(QWidget *parent = 0); void lineNumberAreaPaintEvent(QPaintEvent *event); int lineNumberAreaWidth(); protected: void resizeEvent(QResizeEvent *event); private slots: void updateLineNumberAreaWidth(int newBlockCount); void highlightCurrentLine(); void updateLineNumberArea(const QRect &, int); public slots: void increaseFont(void); void decreaseFont(void); private: QWidget *lineNumberArea; QShortcut *increase; QShortcut *decrease; }; class LineNumberArea : public QWidget { public: LineNumberArea(CodeEditor *editor) : QWidget(editor) { codeEditor = editor; } QSize sizeHint() const { return QSize(codeEditor->lineNumberAreaWidth(), 0); } protected: void paintEvent(QPaintEvent *event) { codeEditor->lineNumberAreaPaintEvent(event); } private: CodeEditor *codeEditor; }; #endif
//--------------------------------------------------------------------------- /* NeuralNet, a three-layered perceptron class Copyright (C) 2010 Richel Bilderbeek This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see <http://www.gnu.org/licenses/>. */ //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl/CppNeuralNet.htm //--------------------------------------------------------------------------- #ifndef NEURALNET_H #define NEURALNET_H #include <Array/Array.h> #include <ReClaM/FFNet.h> ///NeuralNet is a derived class of FFNet ///to gain access to some protected methods of FFNet struct NeuralNet : public FFNet { NeuralNet( const int n_inputs, const int n_hidden_neurons, const int n_outputs); ///Copy constructor NeuralNet(const NeuralNet& n); ///Assignment operator NeuralNet& operator=(const NeuralNet& n); ///Propagate creates the output of a neural network for certain inputs std::vector<double> Propagate(const std::vector<double> &inputs) const; std::vector<int> GetConnections() const; int GetNumberOfInputs() const; int GetNumberOfHiddenNeurons() const; int GetNumberOfNeurons() const; int GetNumberOfOutputs() const; ///Read the output value from any neuron double GetOutputValue(const int index) const; std::vector<double> GetWeights() const; void Mutate(const double m); static const std::string GetVersion() { return "1.0"; } private: ///Wrapper method due to clumsy createConnectionMatrix behavior Array<int> CreateConnectionMatrix( const int n_inputs, const int n_hidden_neurons, const int n_outputs) const; int m_number_of_inputs; int m_number_of_hidden_neurons; int m_number_of_outputs; ///Activate uses default FFNet::activate method ///Use Propagate instead void Activate(const Array<double> &inputs) const; ///Use Propagate instead std::vector<double> PropagateArray(const Array<double> &inputs) const; ///Read the output from the output layer from this neural network ///Use Propagate instead std::vector<double> GetOutputLayerOutputValues() const; void Swap(NeuralNet& rhs); friend bool operator==(const NeuralNet& lhs, const NeuralNet& rhs); }; bool operator==(const NeuralNet& lhs, const NeuralNet& rhs); ///GetRandomUniform draws a random number in range [0,1> ///From http://www.richelbilderbeek.nl/CppGetRandomUniform.htm double GetRandomUniform(); template <class T> std::vector<T> ConvertToVector(const Array<T> a) { return std::vector<T>(a.begin(),a.end()); } template <class T> Array<T> ConvertToArray(const std::vector<T>& v) { Array<T> a; std::vector<T> v_copy(v); //This is terrible! a.append_elems(v_copy); return a; } #endif // NEURALNET_H
/* * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc. * * GRUB 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. * * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GRUB_GPT_PARTITION_HEADER #define GRUB_GPT_PARTITION_HEADER 1 #include <grub/types.h> struct grub_gpt_part_type { grub_uint32_t data1; grub_uint16_t data2; grub_uint16_t data3; grub_uint8_t data4[8]; } __attribute__ ((aligned(8))); typedef struct grub_gpt_part_type grub_gpt_part_type_t; #define GRUB_GPT_PARTITION_TYPE_EMPTY \ { 0x0, 0x0, 0x0, \ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \ } #define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \ { grub_cpu_to_le32 (0x21686148), grub_cpu_to_le16 (0x6449), grub_cpu_to_le16 (0x6e6f), \ { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \ } struct grub_gpt_header { grub_uint8_t magic[8]; grub_uint32_t version; grub_uint32_t headersize; grub_uint32_t crc32; grub_uint32_t unused1; grub_uint64_t primary; grub_uint64_t backup; grub_uint64_t start; grub_uint64_t end; grub_uint8_t guid[16]; grub_uint64_t partitions; grub_uint32_t maxpart; grub_uint32_t partentry_size; grub_uint32_t partentry_crc32; } __attribute__ ((packed)); struct grub_gpt_partentry { grub_gpt_part_type_t type; grub_uint8_t guid[16]; grub_uint64_t start; grub_uint64_t end; grub_uint8_t attrib; char name[72]; } __attribute__ ((packed)); #endif /* ! GRUB_GPT_PARTITION_HEADER */
/* * EyeDroid.h */ #include "Eye.h" #include "Config.h" #include <string> #include <opencv2/core/core.hpp> #include <opencv2/contrib/contrib.hpp> #include <vector> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/features2d/features2d.hpp> #ifndef EYEDROID_H_ #define EYEDROID_H_ namespace IMGP { /* * All the image processing methods used in EyeDroid. */ class EyeDroid { private: protected: public: static cv::Rect getPupilRoi(cv::Mat&, bool diameter); static void convertToGray(cv::Mat&, cv::Mat&); static void erodeDilate(cv::Mat&, cv::Mat&, int erodes, int dilations); static void thresholdImage(cv::Mat&, cv::Mat&); static std::vector<cv::Vec3f> detectBlobs(cv::Mat&); static void detectPupil(cv::Mat&, std::vector<cv::Vec3f>); static void drawPupil(cv::Mat&, cv::Rect); }; /*end of class EyeDroid.h*/ } #endif /* EYEDROID_H_ */
#include "crane.h" IMAPD_RESP api_cmd_list(USER * user, char *preference, char *preference_m, char *saved_buf, char ***saved_list, int flag) { char sql[1024]; sqlite3 *conn = user->sql_db; char *err_sql; char **result; int nrow; int ncolumn; int i; char *offset, **ppp; sprintf(sql, "SELECT mbox, has_children, subscribe FROM mboxes;"); if ((sqlite3_get_table(conn, sql, &result, &nrow, &ncolumn, &err_sql) != SQLITE_OK)) { return IMAPD_RESP_CORRUPTION; } *saved_list = ppp = (char **)saved_buf; *ppp = 0; offset = saved_buf + 1024; for (i = 0; i < nrow; i++) { if ((flag == 0) && (atoi(result[(i + 1) * ncolumn + 2]) == 0)) { continue; } *ppp++ = offset; *ppp = 0; offset[0] = atoi(result[(i + 1) * ncolumn + 1]) ? '1' : '0'; offset++; strcpy(offset, result[(i + 1) * ncolumn + 0]); offset += strlen(offset) + 1; } sqlite3_free_table(result); return IMAPD_RESP_OK; }
/* * This file is part of Micro Bench * <https://github.com/duckmaestro/Micro-Bench>. * * Micro Bench 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. * * Micro Bench 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 Foobar. If not, see <http://www.gnu.org/licenses/>. * */ #pragma once #include "Experiment.h" class NetworkPeakBandwidth : public Experiment { public: NetworkPeakBandwidth(StopwatchStack& stopwatch); NetworkPeakBandwidth(std::wstring name, StopwatchStack& stopwatch); virtual ~NetworkPeakBandwidth(void); virtual void Run(void); static void ChildProcessMain(int argc, wchar_t* argv[]); protected: static void InitWinsock(); static void CleanupWinsock(); void* CreateLocalChildServer(int numTimesToListen); void ConnectAndSend(uint32_t address, uint16_t port, int chunkSize, int numChunks, const void* tag); };
/* This file is part of Akypuera Akypuera is free software: you can redistribute it and/or modify it under the terms of the GNU Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Akypuera 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 Public License for more details. You should have received a copy of the GNU Public License along with Akypuera. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OTF22PAJE_H #define __OTF22PAJE_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <argp.h> #include <otf2/otf2.h> #include <poti.h> #define _GNU_SOURCE #define __USE_GNU #include <search.h> #include "otf22paje_hostfile.h" #include "aky_private.h" #define PROGRAM "otf22paje" struct arguments { char *input[AKY_INPUT_SIZE]; int input_size; int ignore_errors, no_links, no_states, only_mpi, normalize_mpi, basic, dummy, flat; char *comment; char *comment_file; char *hostfile; }; extern struct arguments arguments; extern struct argp argp; /* Data utilities for convertion */ struct otf2paje_s { OTF2_Reader* reader; double last_timestamp; double time_resolution; }; typedef struct otf2paje_s otf2paje_t; struct otf2paje_region_s { uint32_t region_id; uint32_t string_id; }; typedef struct otf2paje_region_s otf2paje_region_t; struct otf2paje_string_s { uint32_t string_id; char* content; }; typedef struct otf2paje_string_s otf2paje_string_t; OTF2_CallbackCode otf22paje_enter (OTF2_LocationRef locationID, OTF2_TimeStamp time, void *userData, OTF2_AttributeList* attributes, OTF2_RegionRef regionID); OTF2_CallbackCode otf22paje_leave (OTF2_LocationRef locationID, OTF2_TimeStamp time, void *userData, OTF2_AttributeList* attributes, OTF2_RegionRef regionID); OTF2_CallbackCode otf22paje_unknown (OTF2_LocationRef locationID, OTF2_TimeStamp time, void *userData, OTF2_AttributeList* attributes); OTF2_CallbackCode otf22paje_global_def_clock_properties (void *userData, uint64_t timerResolution, uint64_t globalOffset, uint64_t traceLength); OTF2_CallbackCode otf22paje_global_def_string (void *userData, OTF2_StringRef self, const char *string); OTF2_CallbackCode otf22paje_global_def_region (void *userData, OTF2_RegionRef self, OTF2_StringRef name, OTF2_StringRef canonicalName, OTF2_StringRef description, OTF2_RegionRole regionRole, OTF2_Paradigm paradigm, OTF2_RegionFlag regionFlags, OTF2_StringRef sourceFile, uint32_t beginLineNumber, uint32_t endLineNumber); OTF2_CallbackCode otf22paje_global_def_location_group(void* userData, OTF2_LocationGroupRef self, OTF2_StringRef name, OTF2_LocationGroupType locationGroupType, OTF2_SystemTreeNodeRef systemTreeParent ); OTF2_CallbackCode otf22paje_global_def_location_group_hostfile(void* userData, OTF2_LocationGroupRef self, OTF2_StringRef name, OTF2_LocationGroupType locationGroupType, OTF2_SystemTreeNodeRef systemTreeParent ); OTF2_CallbackCode otf22paje_global_def_location_group_flat (void *userData, OTF2_LocationGroupRef self, OTF2_StringRef name, OTF2_LocationGroupType locationGroupType, OTF2_SystemTreeNodeRef systemTreeParen); OTF2_CallbackCode otf22paje_global_def_location (void* userData, OTF2_LocationRef self, OTF2_StringRef name, OTF2_LocationType locationType, uint64_t numberOfEvents, OTF2_LocationGroupRef locationGroup); OTF2_CallbackCode otf22paje_global_def_system_tree_node( void* userData, OTF2_SystemTreeNodeRef self, OTF2_StringRef name, OTF2_StringRef className, OTF2_SystemTreeNodeRef parent ); OTF2_CallbackCode otf22paje_global_def_system_tree_node_hostfile( void* userData, OTF2_SystemTreeNodeRef self, OTF2_StringRef name, OTF2_StringRef className, OTF2_SystemTreeNodeRef parent ); OTF2_CallbackCode otf22paje_global_def_system_tree_node_property(void *userData, unsigned int systemTreeNode, unsigned int ignore, unsigned char name, union OTF2_AttributeValue_union value); OTF2_CallbackCode otf22paje_global_def_system_tree_node_domain( void* userData, OTF2_SystemTreeNodeRef systemTreeNode, OTF2_SystemTreeDomain systemTreeDomain ); #endif
#ifndef ClusterClass_h #define ClusterClass_h 1 #include "Global.hh" #include "LCCluster.hh" #include "MCInfo.h" #include <algorithm> #include <iosfwd> #include <memory> #include <string> // IWYU pragma: no_include <bits/shared_ptr.h> class GlobalMethodsClass; /* -------------------------------------------------------------------------- class .... -------------------------------------------------------------------------- */ class ClusterClass { public: ClusterClass(GlobalMethodsClass& gmc, int idNow, LCCluster const* clusterInfo); ~ClusterClass() = default; ClusterClass(const ClusterClass&) = default; ClusterClass& operator=(const ClusterClass&) = delete; void FillHit(int cellNow, double engyNow); int ResetStats(); void SetStatsMC(SMCInfo const& mcParticle); void SetStatsMC(); void PrintInfo(); private: LCCluster const* m_clusterInfo; SMCInfo m_mcInfo = std::make_shared<MCInfo>(); public: int Id = 0; double DiffTheta = 0.0, DiffPosXY = 0.0; int OutsideFlag = 0, HighestEnergyFlag = 0; std::string OutsideReason{}; const double* getPosition() const { return m_clusterInfo->getPosition(); } const double* getPositionAtFront() const { return m_clusterInfo->getPositionAtFront(); } const double* getMCPosition() const { return m_mcInfo->mcPosition; } friend std::ostream& operator<<(std::ostream & o, const ClusterClass& rhs); GlobalMethodsClass& gmc; double getEnergy() const { return m_clusterInfo->getEnergy(); } double getTheta() const { return m_clusterInfo->getTheta(); } double getPhi() const { return m_clusterInfo->getPhi(); } double getRZStart() const { return m_clusterInfo->getRZStart(); } int getNHits() const { return m_clusterInfo->getCaloHits().size(); } double getEnergyMC() const { return m_mcInfo->engy; } double getThetaMC() const { return m_mcInfo->theta; } double getPhiMC() const { return m_mcInfo->phi; } int getPDG() const { return m_mcInfo->pdg; } int getSign() const { return m_mcInfo->sign; } int getParentId() const { return m_mcInfo->m_parentID; } int getNumMCDaughters() const { return m_mcInfo->m_numMCDaughters; } }; #endif // ClusterClass_h
// // AKFSignalMix.h // AudioKit // // Created by Aurelius Prochazka on 7/22/12. // Copyright (c) 2012 Aurelius Prochazka. All rights reserved. // #import "AKParameter+Operation.h" #import "AKFSignal.h" /** Mix 'seamlessly' two pv signals. This opcode combines the most prominent components of two pvoc streams into a single mixed stream. */ @interface AKFSignalMix : AKFSignal /// Create a mixture of two f-signal. /// @param input1 The first f-signal. /// @param input2 The second f-signal. - (instancetype)initWithInput1:(AKFSignal *)input1 input2:(AKFSignal *)input2; @end
// ************************************************************************************************ // // qt-mvvm: Model-view-view-model framework for large GUI applications // //! @file mvvm/model/mvvm/model/sessionitemtags.h //! @brief Defines class CLASS? //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) //! @copyright Forschungszentrum Jülich GmbH 2020 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS) // // ************************************************************************************************ #ifndef BORNAGAIN_MVVM_MODEL_MVVM_MODEL_SESSIONITEMTAGS_H #define BORNAGAIN_MVVM_MODEL_MVVM_MODEL_SESSIONITEMTAGS_H #include "mvvm/model/tagrow.h" #include "mvvm/model_export.h" #include <string> #include <vector> namespace ModelView { class SessionItemContainer; class TagInfo; class SessionItem; //! Collection of SessionItem's containers according to their tags. class MVVM_MODEL_EXPORT SessionItemTags { public: using container_t = std::vector<SessionItemContainer*>; using const_iterator = container_t::const_iterator; SessionItemTags(); ~SessionItemTags(); SessionItemTags(const SessionItemTags&) = delete; SessionItemTags& operator=(const SessionItemTags&) = delete; // tag void registerTag(const TagInfo& tagInfo, bool set_as_default = false); bool isTag(const std::string& name) const; std::string defaultTag() const; void setDefaultTag(const std::string& name); int itemCount(const std::string& tag_name) const; // adding and removal bool insertItem(SessionItem* item, const TagRow& tagrow); SessionItem* takeItem(const TagRow& tagrow); bool canTakeItem(const TagRow& tagrow) const; // item access SessionItem* getItem(const TagRow& tagrow) const; std::vector<SessionItem*> getItems(const std::string& tag = {}) const; std::vector<SessionItem*> allitems() const; TagRow tagRowOfItem(const SessionItem* item) const; const_iterator begin() const; const_iterator end() const; bool isSinglePropertyTag(const std::string& tag) const; int tagsCount() const; SessionItemContainer& at(int index); private: SessionItemContainer* container(const std::string& tag_name) const; SessionItemContainer* find_container(const std::string& tag_name) const; std::vector<SessionItemContainer*> m_containers; std::string m_default_tag; }; } // namespace ModelView #endif // BORNAGAIN_MVVM_MODEL_MVVM_MODEL_SESSIONITEMTAGS_H
/****************************************************************************** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * This file is part of Real VMX. * Copyright (C) 2013 Surplus Users Ham Society * * Real VMX 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. * * Real VMX 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 Real VMX. If not, see <http://www.gnu.org/licenses/>. */ /* ioctl.h - Ioctl header */ #ifndef _SYS_IOCTL_H #define _SYS_IOCTL_H #ifndef _ASMLANGUAGE #ifdef __cplusplus extern "C" { #endif #include <sys/sockio.h> #include <os/ioLib.h> /****************************************************************************** * ioctl - I/O control function * * RETURNS: Driver specific or ERROR */ int ioctl( int fd, int func, int arg ); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _ASMLANGUAGE */ #endif /* _SYS_IOCTL_H */
!*********************************************************************** ! This is a header file to define macros for static and dynamic memory * ! allocation. Define STATIC_MEMORY_ in MOM_memory.h for static memory * ! allocation. Otherwise dynamic memory allocation will be assumed. * !*********************************************************************** #ifdef STATIC_MEMORY_ # define DEALLOC_(x) # define ALLOC_(x) # define ALLOCABLE_ # define PTR_ # define TO_NULL_ ! NIMEM and NJMEM are the maximum number of grid points in the ! x- and y-directions on each processsor. # define NIMEM_ (((NIGLOBAL_-1)/NIPROC_)+1+2*NIHALO_) # define NJMEM_ (((NJGLOBAL_-1)/NJPROC_)+1+2*NJHALO_) # ifdef SYMMETRIC_MEMORY_ # define NIMEMB_ 0:NIMEM_ # define NJMEMB_ 0:NJMEM_ # else # define NIMEMB_ NIMEM_ # define NJMEMB_ NJMEM_ # endif # define NIMEMB_PTR_ NIMEMB_ # define NJMEMB_PTR_ NJMEMB_ # define NIMEMB_SYM_ 0:NIMEM_ # define NJMEMB_SYM_ 0:NJMEM_ # define NKMEM_ NK_ # define NKMEM0_ 0:NK_ # define NK_INTERFACE_ NK_+1 # define C1_ 1 # define C2_ 2 # define C3_ 3 # define SZI_(G) NIMEM_ # define SZJ_(G) NJMEM_ # define SZK_(G) NK_ # define SZK0_(G) 0:NK_ # define SZIB_(G) NIMEMB_ # define SZJB_(G) NJMEMB_ # define SZIBS_(G) 0:NIMEM_ # define SZJBS_(G) 0:NJMEM_ #else ! Dynamic memory allocation # define DEALLOC_(x) deallocate(x) # define ALLOC_(x) allocate(x) # define ALLOCABLE_ ,allocatable # define PTR_ ,pointer # define TO_NULL_ =>NULL() # define NIMEM_ : # define NJMEM_ : # define NIMEMB_PTR_ : # define NJMEMB_PTR_ : # ifdef SYMMETRIC_MEMORY_ # define NIMEMB_ 0: # define NJMEMB_ 0: # else # define NIMEMB_ : # define NJMEMB_ : # endif # define NIMEMB_SYM_ 0: # define NJMEMB_SYM_ 0: # define NKMEM_ : # define NKMEM0_ 0: # define NK_INTERFACE_ : # define C1_ : # define C2_ : # define C3_ : # define SZI_(G) G%isd:G%ied # define SZJ_(G) G%jsd:G%jed # define SZK_(G) G%ks:G%ke # define SZK0_(G) G%ks-1:G%ke # define SZIB_(G) G%IsdB:G%IedB # define SZJB_(G) G%JsdB:G%JedB # define SZIBS_(G) G%isd-1:G%ied # define SZJBS_(G) G%jsd-1:G%jed #endif ! These dynamic size macros always give the same results (for now). #define SZDI_(G) G%isd:G%ied #define SZDIB_(G) G%IsdB:G%IedB #define SZDJ_(G) G%jsd:G%jed #define SZDJB_(G) G%JsdB:G%JedB
#import <Cocoa/Cocoa.h> #import "URLDropTarget.h" @class CTBrowser; @class CTTabContents; // A controller for the toolbar in the browser window. // // This class is meant to be subclassed -- the default implementation will load // a placeholder/dummy nib. You need to do two things: // // 1. Create a new subclass of CTToolbarController. // // 2. Copy the Toolbar.xib into your project (or create a new) and modify it as // needed (add buttons etc). Make sure the "files owner" type matches your // CTToolbarController subclass. // // 3. Implement createToolbarController in your CTBrowser subclass to initialize // and return a CTToolbarController based on your nib. // @interface CTToolbarController : NSViewController <URLDropTargetController> @property (weak, nonatomic, readonly) CTBrowser *browser; - (id)initWithNibName:(NSString*)nibName bundle:(NSBundle*)bundle browser:(CTBrowser*)browser; // Set the opacity of the divider (the line at the bottom) *if* we have a // |ToolbarView| (0 means don't show it); no-op otherwise. - (void)setDividerOpacity:(CGFloat)opacity; // Called when the current tab is changing. Subclasses should implement this to // update the toolbar's state. - (void)updateToolbarWithContents:(CTTabContents*)contents shouldRestoreState:(BOOL)shouldRestore; // Called by the Window delegate so we can provide a custom field editor if // needed. // Note that this may be called for objects unrelated to the toolbar. // returns nil if we don't want to override the custom field editor for |obj|. // The default implementation returns nil - (id)customFieldEditorForObject:(id)obj; @end
/************************************************************************************//** * \file port\linux\timeutil.c * \brief Time utility source file. * \ingroup openblt-tcp-boot * \internal *---------------------------------------------------------------------------------------- * C O P Y R I G H T *---------------------------------------------------------------------------------------- * Copyright (c) 2014 by Feaser http://www.feaser.com All rights reserved * *---------------------------------------------------------------------------------------- * L I C E N S E *---------------------------------------------------------------------------------------- * This file is part of OpenBLT. OpenBLT 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. * * OpenBLT 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 OpenBLT. * If not, see <http://www.gnu.org/licenses/>. * * A special exception to the GPL is included to allow you to distribute a combined work * that includes OpenBLT without being obliged to provide the source code for any * proprietary components. The exception text is included at the bottom of the license * file <license.html>. * * \endinternal ****************************************************************************************/ /**************************************************************************************** * Include files ****************************************************************************************/ #include <assert.h> /* assertion module */ #include <sb_types.h> /* C types */ #include <unistd.h> /* UNIX standard functions */ #include <fcntl.h> /* file control definitions */ #include <time.h> /* time definitions */ #include <sys/time.h> /************************************************************************************//** ** \brief Get the system time in milliseconds. ** \return Time in milliseconds. ** ****************************************************************************************/ sb_uint32 TimeUtilGetSystemTimeMs(void) { struct timeval tv; if (gettimeofday(&tv, SB_NULL) != 0) { return 0; } return (sb_uint32)((tv.tv_sec * 1000ul) + (tv.tv_usec / 1000ul)); } /*** end of XcpTransportClose ***/ /************************************************************************************//** ** \brief Performs a delay of the specified amount of milliseconds. ** \param delay Delay time in milliseconds. ** \return none. ** ****************************************************************************************/ void TimeUtilDelayMs(sb_uint16 delay) { usleep(1000 * delay); } /*** end of TimeUtilDelayMs **/ /*********************************** end of xcptransport.c *****************************/
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[2]; atomic_int atom_0_r1_2; void *t0(void *arg){ label_1:; int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst); atomic_store_explicit(&vars[1], 1, memory_order_seq_cst); int v10 = (v2_r1 == 2); atomic_store_explicit(&atom_0_r1_2, v10, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; atomic_store_explicit(&vars[1], 2, memory_order_seq_cst); atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); return NULL; } void *t2(void *arg){ label_3:; atomic_store_explicit(&vars[0], 2, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; pthread_t thr2; atomic_init(&vars[0], 0); atomic_init(&vars[1], 0); atomic_init(&atom_0_r1_2, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_create(&thr2, NULL, t2, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); pthread_join(thr2, NULL); int v3 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v4 = (v3 == 2); int v5 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v6 = (v5 == 2); int v7 = atomic_load_explicit(&atom_0_r1_2, memory_order_seq_cst); int v8_conj = v6 & v7; int v9_conj = v4 & v8_conj; if (v9_conj == 1) assert(0); return 0; }
/* * Filename: doubleToString.c * Author: Andrew Laing * Email: parisianconnections@gmail.com * Date: 04/06/2017. * Description: Convert a double to a string * Accurate to 6 decimal places */ #include <stdio.h> #include <stdlib.h> void doubleToString(char [], double ); int main() { double num = 341234.123456; char output[__SIZEOF_FLOAT__]; doubleToString(output, num); printf("double is = %s", output); return 0; } void doubleToString(char s[], double num) { sprintf(s, "%f", num); }
// // NSDate+Extensions.h // VExtensions // // Created by yuan on 14-6-6. // Copyright (c) 2014年 www.heyuan110.com. All rights reserved. // #import <Foundation/Foundation.h> #define D_MINUTE 60 #define D_HOUR 3600 #define D_DAY 86400 #define D_WEEK 604800 #define D_YEAR 31556926 @interface NSDate (NSDate_Extensions) - (NSString *)formatMD; - (NSString *)formatYM; - (NSString *)formatYMD; - (NSString *)formatYMDHM; - (NSString *)formatYMDHMS; - (NSString *)formatMDHM; - (NSString *)formatHM; - (NSString *)formatD; - (NSString *)format; - (NSString *)formatWithStyle:(NSString *)style; + (NSString *)dateFormatToString:(NSDate *)date; // Relative dates from the current date + (NSDate *) dateTomorrow; + (NSDate *) dateTomorrowAndTomorrow; + (NSDate *) dateYesterday; + (NSDate *) dateWithDaysFromNow: (NSInteger) days; + (NSDate *) dateWithDaysBeforeNow: (NSInteger) days; + (NSDate *) dateWithHoursFromNow: (NSInteger) dHours; + (NSDate *) dateWithHoursBeforeNow: (NSInteger) dHours; + (NSDate *) dateWithMinutesFromNow: (NSInteger) dMinutes; + (NSDate *) dateWithMinutesBeforeNow: (NSInteger) dMinutes; + (NSDate *)translateStrToFullDate:(NSString *)strDate; + (NSDate *)translateStrToFullDateWithShorttime:(NSString *)strDate; + (NSDate *)translateStrDateToDate:(NSString *)strDate; //今天到月末还有的天数 + (NSInteger)nowToMonthLastDay; // Comparing dates - (BOOL) isEqualToDateIgnoringTime: (NSDate *) aDate; - (BOOL) isToday; - (BOOL) isTodayEastEightArea; - (BOOL) isTomorrow; - (BOOL) isTomorrowAndTomorrow; - (BOOL) isYesterday; - (BOOL) isSameWeekAsDate: (NSDate *) aDate; - (BOOL) isThisWeek; - (BOOL) isNextWeek; - (BOOL) isLastWeek; - (BOOL) isSameMonthAsDate: (NSDate *) aDate; - (BOOL) isThisMonth; - (BOOL) isSameYearAsDate: (NSDate *) aDate; - (BOOL) isThisYear; - (BOOL) isNextYear; - (BOOL) isLastYear; - (BOOL) isEarlierThanDate: (NSDate *) aDate; - (BOOL) isLaterThanDate: (NSDate *) aDate; - (BOOL) isEarlierOrEqualDate: (NSDate *) aDate; - (BOOL) isEqualDate:(NSDate *)date; - (BOOL) isLaterOrEqualDate: (NSDate *) aDate; - (BOOL) isInFuture; - (BOOL) isInPast; // Date roles - (BOOL) isTypicallyWorkday; - (BOOL) isTypicallyWeekend; // Adjusting dates - (NSDate *) dateByAddingDays: (NSInteger) dDays; - (NSDate *) dateBySubtractingDays: (NSInteger) dDays; - (NSDate *) dateByAddingHours: (NSInteger) dHours; - (NSDate *) dateBySubtractingHours: (NSInteger) dHours; - (NSDate *) dateByAddingMinutes: (NSInteger) dMinutes; - (NSDate *) dateBySubtractingMinutes: (NSInteger) dMinutes; - (NSDate *) dateAtStartOfDay; // Retrieving intervals - (NSInteger) minutesAfterDate: (NSDate *) aDate; - (NSInteger) minutesBeforeDate: (NSDate *) aDate; - (NSInteger) hoursAfterDate: (NSDate *) aDate; - (NSInteger) hoursBeforeDate: (NSDate *) aDate; - (NSInteger) daysAfterDate: (NSDate *) aDate; - (NSInteger) daysBeforeDate: (NSDate *) aDate; - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate; - (NSDate *) monthDateFromDate; - (NSDate *) monthDayDateFromDate; //上个月 - (NSDate *)lastMonth; //下个月 - (NSDate *)nextMonth; //当前月份的上个月 + (NSDate *)lastMonth; //当前月的下个月 + (NSDate *)nextMonth; //返回month月的总天数 + (NSInteger)monthDays:(NSInteger)month year:(NSInteger)year; - (NSDate *)setYear:(NSInteger)year; - (NSDate *)setDay:(NSInteger)day; - (NSDate *)setMonth:(NSInteger)month; - (NSDate *)setHour:(NSInteger)hour; - (NSDate *)setMinute:(NSInteger)minute; - (NSDate *)setSecond:(NSInteger)second; - (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute; - (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; // Decomposing dates @property (readonly) NSInteger nearestHour; @property (readonly) NSInteger hour; @property (readonly) NSInteger minute; @property (readonly) NSInteger seconds; @property (readonly) NSInteger day; @property (readonly) NSInteger month; @property (readonly) NSInteger week; @property (readonly) NSInteger weekday; @property (readonly) NSInteger nthWeekday; // e.g. 2nd Tuesday of the month == 2 @property (readonly) NSInteger year; @end
/* * Project name: Sprintl * Copyright: (c) Mikroelektronika, 2011. * Revision History: 20110105: - initial release; * Description: This is a demonstration of the standard C library sprinti routine usage. Two different representations of the same long integer number obtained by using the sprintf routine are sent via UART. * Test configuration: MCU: STM32F107VC http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00220364.pdf Dev.Board: EasyMx PRO v7 for STM32(R) ARM(R) http://www.mikroe.com/easymx-pro/stm32/ Oscillator: HSE-PLL, 72.000MHz Ext. Modules: None. SW: mikroC PRO for ARM http://www.mikroe.com/mikroc/arm/ * NOTES: - Turn ON UARTA switches at SW12. (board specific) */ unsigned long long_no = 1000000; char buffer[15]; void main(){ UART1_Init(115200); UART1_Write_Text("Integer number representation"); // Write message on UART sprintl(buffer, "%10ld", long_no); // Format long_no and store it to buffer UART1_Write_Text("\r\nd format:"); // Write message on UART UART1_Write_Text(buffer); // Write buffer on UART (decimal format) sprintl(buffer, "%10lx", long_no); // Format long_no and store it to buffer UART1_Write_Text("\r\nx format:"); // Write message on UART UART1_Write_Text(buffer); // Write buffer on UART (hex format) sprintl(buffer, "%10lo", long_no); // Format long_no and store it to buffer UART1_Write_Text("\r\no format:"); // Write message on UART UART1_Write_Text(buffer); // Write buffer on UART (octal format) }
#ifndef __SYSCALLS_H__ #define __SYSCALLS_H__ #include <tipos.h> #define SYS_INT 0x30 #define SYS_GETPID 0 #define SYS_EXIT 1 #define SYS_PALLOC 2 #define SYS_PRINT 3 #define SYS_SLEEP 5 #define SYS_LOCPRINT 6 #define SYS_RUN 7 #define SYS_FORK 8 #define SYS_PIPE 9 #define SYS_SHARE_PAGE 10 #define SYS_LOCPRINTALPHA 50 /* Device */ #define SYS_OPEN 30 #define SYS_CLOSE 31 #define SYS_READ 32 #define SYS_WRITE 33 #define SYS_SEEK 34 #ifdef __KERNEL__ // Sólo se compila en modo "kernel" void syscalls_init(void); #else // __TAREA___ // Sólo se compila en modo "tarea" // Declarar los "wrapers" para los syscalls que incluyen las tareas. void sleep(uint_32 time); uint_32 getpid(void); void exit(void); void* palloc(void); sint_32 run(const char* filename); sint_32 fork(); sint_32 pipe(sint_32 pipes[2]); sint_32 share_page(void* addr); /* Deprecated */ int loc_printf(uint_32 row, uint_32 col, const char* format, ...);// __attribute__ ((format (printf, 3, 4))); int loc_alpha_printf(uint_32 row, uint_32 col, const char* format, ...);// __attribute__ ((format (printf, 3, 4))); int printf(const char* format, ...) __attribute__ ((format (printf, 1, 2))); /* Device */ int open(const char* filename, uint_32 flags); int close(int fd); int read(int fd, void* buf, uint_32 size); int write(int fd, const void* buf, uint_32 size); int seek(int fd, uint_32 size); #endif #endif
#include <linux/init.h> #include <linux/posix_acl.h> #define REISERFS_ACL_VERSION 0x0001 typedef struct { __le16 e_tag; __le16 e_perm; __le32 e_id; } reiserfs_acl_entry; typedef struct { __le16 e_tag; __le16 e_perm; } reiserfs_acl_entry_short; typedef struct { __le32 a_version; } reiserfs_acl_header; static inline size_t reiserfs_acl_size(int count) { if (count <= 4) { return sizeof(reiserfs_acl_header) + count * sizeof(reiserfs_acl_entry_short); } else { return sizeof(reiserfs_acl_header) + 4 * sizeof(reiserfs_acl_entry_short) + (count - 4) * sizeof(reiserfs_acl_entry); } } static inline int reiserfs_acl_count(size_t size) { ssize_t s; size -= sizeof(reiserfs_acl_header); s = size - 4 * sizeof(reiserfs_acl_entry_short); if (s < 0) { if (size % sizeof(reiserfs_acl_entry_short)) { return -1; } return size / sizeof(reiserfs_acl_entry_short); } else { if (s % sizeof(reiserfs_acl_entry)) { return -1; } return s / sizeof(reiserfs_acl_entry) + 4; } } #ifdef CONFIG_REISERFS_FS_POSIX_ACL struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); int reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); int reiserfs_acl_chmod(struct inode *inode); int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, struct inode *dir, struct dentry *dentry, struct inode *inode); int reiserfs_cache_default_acl(struct inode *dir); #else #define reiserfs_cache_default_acl(inode) 0 #define reiserfs_get_acl NULL #define reiserfs_set_acl NULL static inline int reiserfs_acl_chmod(struct inode *inode) { return 0; } static inline int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, const struct inode *dir, struct dentry *dentry, struct inode *inode) { return 0; } #endif
//----------------------------------------------- // Copyright 2010 Wellcome Trust Sanger Institute // Written by Jared Simpson (js18@sanger.ac.uk) // Released under the GPL //----------------------------------------------- // // RLUnit - A run-length encoded unit of the FM-index // #ifndef RLUNIT_H #define RLUNIT_H #include <string.h> #include <inttypes.h> #include <assert.h> #include "alphabet.h" // #define RL_COUNT_MASK 0x1F //00011111 #define RL_SYMBOL_MASK 0xE0 //11100000 #define RL_FULL_COUNT 31 #define RL_SYMBOL_SHIFT 5 #define RLE_VALIDATE // A 5+3 encoded symbol, run pair // The high 3 bits encodes the symbol to store // The low 5 bits encodes the length of the run struct RLUnit { RLUnit() : data(0) {} RLUnit(char b) : data(1) { setChar(b); } // Returns true if the count cannot be incremented inline bool isFull() const { return (data & RL_COUNT_MASK) == RL_FULL_COUNT; } inline bool isEmpty() const { return (data & RL_COUNT_MASK) == 0; } inline bool isInitialized() const { return data > 0; } // inline void incrementCount() { #ifdef RLE_VALIDATE assert(!isFull()); #endif ++data; } // inline void decrementCount() { #ifdef RLE_VALIDATE assert(!isEmpty()); #endif --data; } inline uint8_t getCount() const { #ifdef RLE_VALIDATE assert((data & RL_COUNT_MASK) != 0); #endif return data & RL_COUNT_MASK; } // Set the symbol inline void setChar(char symbol) { // Clear the current symbol data &= RL_COUNT_MASK; uint8_t code = BWT_ALPHABET::getRank(symbol); code <<= RL_SYMBOL_SHIFT; data |= code; } // Get the symbol inline char getChar() const { uint8_t code = data & RL_SYMBOL_MASK; code >>= RL_SYMBOL_SHIFT; return BWT_ALPHABET::getChar(code); } // uint8_t data; }; #endif
#include <stdio.h> #include <stdlib.h> void print(char *str) { printf("test.c print(char *str)\n"); printf("%s\n", str); } void print1(char *str) { printf("test.c print1(char *str)\n"); printf("%s\n", str); } void print2(char *str) { printf("test C testPrint %s\n",str); } void ttargbyte(char *dst, char *src){ printf("test C argbyte\n"); printf("dst:%s,src:%s\n",dst, src); } int isboolok(){ return 1; }
/* * Copyright (C) 2012 - Virtual Open Systems and Columbia University * Author: Christoffer Dall <c.dall@virtualopensystems.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __ARM_KVM_MMU_H__ #define __ARM_KVM_MMU_H__ #include <asm/memory.h> #include <asm/page.h> /* * We directly use the kernel VA for the HYP, as we can directly share * the mapping (HTTBR "covers" TTBR1). */ #define kern_hyp_va(kva) (kva) /* * KVM_MMU_CACHE_MIN_PAGES is the number of stage2 page table translation levels. */ #define KVM_MMU_CACHE_MIN_PAGES 2 #ifndef __ASSEMBLY__ #include <linux/highmem.h> #include <asm/cacheflush.h> #include <asm/pgalloc.h> #include <asm/stage2_pgtable.h> int create_hyp_mappings(void *from, void *to, pgprot_t prot); int create_hyp_io_mappings(void *from, void *to, phys_addr_t); void free_hyp_pgds(void); void stage2_unmap_vm(struct kvm *kvm); int kvm_alloc_stage2_pgd(struct kvm *kvm); void kvm_free_stage2_pgd(struct kvm *kvm); int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, phys_addr_t pa, unsigned long size, bool writable); int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run); void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu); phys_addr_t kvm_mmu_get_httbr(void); phys_addr_t kvm_get_idmap_vector(void); phys_addr_t kvm_get_idmap_start(void); int kvm_mmu_init(void); void kvm_clear_hyp_idmap(void); static inline void kvm_set_pmd(pmd_t *pmd, pmd_t new_pmd) { *pmd = new_pmd; dsb(ishst); } static inline void kvm_set_pte(pte_t *pte, pte_t new_pte) { *pte = new_pte; dsb(ishst); } static inline pte_t kvm_s2pte_mkwrite(pte_t pte) { pte_val(pte) |= L_PTE_S2_RDWR; return pte; } static inline pmd_t kvm_s2pmd_mkwrite(pmd_t pmd) { pmd_val(pmd) |= L_PMD_S2_RDWR; return pmd; } static inline void kvm_set_s2pte_readonly(pte_t *pte) { pte_val(*pte) = (pte_val(*pte) & ~L_PTE_S2_RDWR) | L_PTE_S2_RDONLY; } static inline bool kvm_s2pte_readonly(pte_t *pte) { return (pte_val(*pte) & L_PTE_S2_RDWR) == L_PTE_S2_RDONLY; } static inline void kvm_set_s2pmd_readonly(pmd_t *pmd) { pmd_val(*pmd) = (pmd_val(*pmd) & ~L_PMD_S2_RDWR) | L_PMD_S2_RDONLY; } static inline bool kvm_s2pmd_readonly(pmd_t *pmd) { return (pmd_val(*pmd) & L_PMD_S2_RDWR) == L_PMD_S2_RDONLY; } static inline bool kvm_page_empty(void *ptr) { struct page *ptr_page = virt_to_page(ptr); return page_count(ptr_page) == 1; } #define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep) #define kvm_pmd_table_empty(kvm, pmdp) kvm_page_empty(pmdp) #define kvm_pud_table_empty(kvm, pudp) false #define hyp_pte_table_empty(ptep) kvm_page_empty(ptep) #define hyp_pmd_table_empty(pmdp) kvm_page_empty(pmdp) #define hyp_pud_table_empty(pudp) false struct kvm; #define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l)) static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu) { return (vcpu_cp15(vcpu, c1_SCTLR) & 0b101) == 0b101; } static inline void __coherent_cache_guest_page(struct kvm_vcpu *vcpu, kvm_pfn_t pfn, unsigned long size, bool ipa_uncached) { /* * If we are going to insert an instruction page and the icache is * either VIPT or PIPT, there is a potential problem where the host * (or another VM) may have used the same page as this guest, and we * read incorrect data from the icache. If we're using a PIPT cache, * we can invalidate just that page, but if we are using a VIPT cache * we need to invalidate the entire icache - damn shame - as written * in the ARM ARM (DDI 0406C.b - Page B3-1393). * * VIVT caches are tagged using both the ASID and the VMID and doesn't * need any kind of flushing (DDI 0406C.b - Page B3-1392). * * We need to do this through a kernel mapping (using the * user-space mapping has proved to be the wrong * solution). For that, we need to kmap one page at a time, * and iterate over the range. */ bool need_flush = !vcpu_has_cache_enabled(vcpu) || ipa_uncached; VM_BUG_ON(size & ~PAGE_MASK); if (!need_flush && !icache_is_pipt()) { goto vipt_cache; } while (size) { void *va = kmap_atomic_pfn(pfn); if (need_flush) { kvm_flush_dcache_to_poc(va, PAGE_SIZE); } if (icache_is_pipt()) __cpuc_coherent_user_range((unsigned long)va, (unsigned long)va + PAGE_SIZE); size -= PAGE_SIZE; pfn++; kunmap_atomic(va); } vipt_cache: if (!icache_is_pipt() && !icache_is_vivt_asid_tagged()) { /* any kind of VIPT cache */ __flush_icache_all(); } } static inline void __kvm_flush_dcache_pte(pte_t pte) { void *va = kmap_atomic(pte_page(pte)); kvm_flush_dcache_to_poc(va, PAGE_SIZE); kunmap_atomic(va); } static inline void __kvm_flush_dcache_pmd(pmd_t pmd) { unsigned long size = PMD_SIZE; kvm_pfn_t pfn = pmd_pfn(pmd); while (size) { void *va = kmap_atomic_pfn(pfn); kvm_flush_dcache_to_poc(va, PAGE_SIZE); pfn++; size -= PAGE_SIZE; kunmap_atomic(va); } } static inline void __kvm_flush_dcache_pud(pud_t pud) { } #define kvm_virt_to_phys(x) virt_to_idmap((unsigned long)(x)) void kvm_set_way_flush(struct kvm_vcpu *vcpu); void kvm_toggle_cache(struct kvm_vcpu *vcpu, bool was_enabled); static inline bool __kvm_cpu_uses_extended_idmap(void) { return false; } static inline void __kvm_extend_hypmap(pgd_t *boot_hyp_pgd, pgd_t *hyp_pgd, pgd_t *merged_hyp_pgd, unsigned long hyp_idmap_start) { } static inline unsigned int kvm_get_vmid_bits(void) { return 8; } #endif /* !__ASSEMBLY__ */ #endif /* __ARM_KVM_MMU_H__ */
#pragma once #include <map> #include <memory> #include <set> #include <shared_mutex> #include <string> #include "ValueType.h" struct mqtt_var_type { std::string dataType; std::string format; std::string unit; }; using MqttVarType = struct mqtt_var_type; class VariableStore { mutable std::shared_mutex lock; std::map<std::string, std::weak_ptr<ValueType>> vars; std::map<std::string, MqttVarType> types; public: VariableStore(); void registerVar(const std::string& name, const MqttVarType& mqtt_type, std::shared_ptr<ValueType> var); void unregisterVar(const std::string& name); void cleanUp(); std::set<std::string> keys() const; std::shared_ptr<ValueType> getVar(const std::string& name) const; MqttVarType getMqttType(const std::string& name) const; };
/* * lib/reed_solomon/encode_rs.c * * Overview: * Generic Reed Solomon encoder / decoder library * * Copyright 2002, Phil Karn, KA9Q * May be used under the terms of the GNU General Public License (GPL) * * Adaption to the kernel by Thomas Gleixner (tglx@linutronix.de) * * $Id: encode_rs.c,v 1.5 2005/11/07 11:14:59 gleixner Exp $ * */ /* Generic data width independent code which is included by the * wrappers. * int encode_rsX (struct rs_control *rs, uintX_t *data, int len, uintY_t *par) */ { int i, j, pad; int nn = rs->nn; int nroots = rs->nroots; uint16_t *alpha_to = rs->alpha_to; uint16_t *index_of = rs->index_of; uint16_t *genpoly = rs->genpoly; uint16_t fb; uint16_t msk = (uint16_t) rs->nn; /* Check length parameter for validity */ pad = nn - nroots - len; if (pad < 0 || pad >= nn) { return -ERANGE; } for (i = 0; i < len; i++) { fb = index_of[((((uint16_t) data[i])^invmsk) & msk) ^ par[0]]; /* feedback term is non-zero */ if (fb != nn) { for (j = 1; j < nroots; j++) { par[j] ^= alpha_to[rs_modnn(rs, fb + genpoly[nroots - j])]; } } /* Shift */ memmove(&par[0], &par[1], sizeof(uint16_t) * (nroots - 1)); if (fb != nn) { par[nroots - 1] = alpha_to[rs_modnn(rs, fb + genpoly[0])]; } else { par[nroots - 1] = 0; } } return 0; }
/* RPG Paper Maker Copyright (C) 2017-2021 Wano RPG Paper Maker engine is under proprietary license. This source code is also copyrighted. Use Commercial edition for commercial use of your games. See RPG Paper Maker EULA here: http://rpg-paper-maker.com/index.php/eula. */ #ifndef SYSTEMSTATISTIC_H #define SYSTEMSTATISTIC_H #include <QMetaType> #include "systemtranslatable.h" // ------------------------------------------------------- // // CLASS SystemStatistic // // A particulary statistic (system). // // ------------------------------------------------------- class SystemStatistic : public SystemTranslatable { public: SystemStatistic(); SystemStatistic(int i, QString name, QString abbreviation, bool isFix); virtual ~SystemStatistic(); QString abbreviation() const; void setAbbreviation(QString s); bool isFix() const; void setIsFix(bool b); virtual bool openDialog(); virtual SuperListItem* createCopy() const; virtual void setCopy(const SuperListItem &super); virtual void read(const QJsonObject &json); virtual void write(QJsonObject &json) const; protected: QString m_abbreviation; bool m_isFix; }; Q_DECLARE_METATYPE(SystemStatistic) #endif // SYSTEMSTATISTIC_H
#ifndef CONFIG_H #define CONFIG_H // uart.[ch] defines #define UART_BAUD_RATE 57600 #endif
#include <verifier-builtins.h> #include <stdbool.h> #include <stdlib.h> struct item { struct item *head; struct item *next; }; struct item* alloc_or_die(void) { struct item *pi = malloc(sizeof(*pi)); if (pi) return pi; else abort(); } struct item* create_sll_head(void) { struct item *head = alloc_or_die(); head->head = head; head->next = NULL; return head; } struct item* create_sll(void) { struct item *head = create_sll_head(); struct item *sll = head; // NOTE: running this on bare metal may cause the machine to swap a bit int i; for (i = 0; i < 1024; ++i) { sll->next = alloc_or_die(); sll->next->head = head; sll->next->next = NULL; sll = sll->next; } return head; } bool destroy_by_any(struct item *node) { if (!node) // nothing to destroy here return false; // jump to head and destroy whole list node = node->head; while (node) { struct item *next = node->next; free(node); node = next; } return true; } int main() { struct item *sll = create_sll(); ___sl_plot(NULL); if (!destroy_by_any(sll->next)) // we have only head --> destroy the head free(sll); return 0; } /** * @file test-0118.c * * @brief abstraction of SLL, each node contains a pointer to head * * - improved variant of test-0049 * * @attention * This description is automatically imported from tests/predator-regre/README. * Any changes made to this comment will be thrown away on the next import. */
/* * io.h --- the I/O manager abstraction * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #ifndef _EXT2FS_EXT2_IO_H #define _EXT2FS_EXT2_IO_H /* * ext2_loff_t is defined here since unix_io.c needs it. */ #if defined(__GNUC__) || defined(HAS_LONG_LONG) typedef long long ext2_loff_t; #else typedef long ext2_loff_t; #endif /* llseek.c */ ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); typedef struct struct_io_manager *io_manager; typedef struct struct_io_channel *io_channel; typedef struct struct_io_stats *io_stats; #define CHANNEL_FLAGS_WRITETHROUGH 0x01 struct struct_io_channel { errcode_t magic; io_manager manager; char *name; int block_size; errcode_t (*read_error)(io_channel channel, unsigned long block, int count, void *data, size_t size, int actual_bytes_read, errcode_t error); errcode_t (*write_error)(io_channel channel, unsigned long block, int count, const void *data, size_t size, int actual_bytes_written, errcode_t error); int refcount; int flags; long reserved[14]; void *private_data; void *app_data; }; struct struct_io_stats { int num_fields; int reserved; unsigned long long bytes_read; unsigned long long bytes_written; }; struct struct_io_manager { errcode_t magic; const char *name; errcode_t (*open)(const char *name, int flags, io_channel *channel); errcode_t (*close)(io_channel channel); errcode_t (*set_blksize)(io_channel channel, int blksize); errcode_t (*read_blk)(io_channel channel, unsigned long block, int count, void *data); errcode_t (*write_blk)(io_channel channel, unsigned long block, int count, const void *data); errcode_t (*flush)(io_channel channel); errcode_t (*write_byte)(io_channel channel, unsigned long offset, int count, const void *data); errcode_t (*set_option)(io_channel channel, const char *option, const char *arg); errcode_t (*get_stats)(io_channel channel, io_stats *io_stats); errcode_t (*read_blk64)(io_channel channel, unsigned long long block, int count, void *data); errcode_t (*write_blk64)(io_channel channel, unsigned long long block, int count, const void *data); long reserved[16]; }; #define IO_FLAG_RW 0x0001 #define IO_FLAG_EXCLUSIVE 0x0002 /* * Convenience functions.... */ #define io_channel_close(c) ((c)->manager->close((c))) #define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) #define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) #define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) #define io_channel_flush(c) ((c)->manager->flush((c))) #define io_channel_bumpcount(c) ((c)->refcount++) /* io_manager.c */ extern errcode_t io_channel_set_options(io_channel channel, const char *options); extern errcode_t io_channel_write_byte(io_channel channel, unsigned long offset, int count, const void *data); extern errcode_t io_channel_read_blk64(io_channel channel, unsigned long long block, int count, void *data); extern errcode_t io_channel_write_blk64(io_channel channel, unsigned long long block, int count, const void *data); /* unix_io.c */ extern io_manager unix_io_manager; /* undo_io.c */ extern io_manager undo_io_manager; extern errcode_t set_undo_io_backing_manager(io_manager manager); extern errcode_t set_undo_io_backup_file(char *file_name); /* test_io.c */ extern io_manager test_io_manager, test_io_backing_manager; extern void (*test_io_cb_read_blk) (unsigned long block, int count, errcode_t err); extern void (*test_io_cb_write_blk) (unsigned long block, int count, errcode_t err); extern void (*test_io_cb_set_blksize) (int blksize, errcode_t err); #endif /* _EXT2FS_EXT2_IO_H */
/* ** Zabbix ** Copyright (C) 2001-2017 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ #ifndef ZABBIX_MODULE_H #define ZABBIX_MODULE_H #include "zbxtypes.h" #define ZBX_MODULE_OK 0 #define ZBX_MODULE_FAIL -1 /* zbx_module_api_version() MUST return this constant */ #define ZBX_MODULE_API_VERSION 2 /* old name alias is kept for source compatibility only, SHOULD NOT be used */ #define ZBX_MODULE_API_VERSION_ONE ZBX_MODULE_API_VERSION /* HINT: For conditional compilation with different module.h versions modules can use: */ /* #if ZBX_MODULE_API_VERSION == X */ /* ... */ /* #endif */ #define get_rkey(request) (request)->key #define get_rparams_num(request) (request)->nparam #define get_rparam(request, num) ((request)->nparam > num ? (request)->params[num] : NULL) /* flags for command */ #define CF_HAVEPARAMS 0x01 /* item accepts either optional or mandatory parameters */ #define CF_MODULE 0x02 /* item is defined in a loadable module */ #define CF_USERPARAMETER 0x04 /* item is defined as user parameter */ typedef struct { char *key; unsigned flags; int (*function)(); char *test_param; /* item test parameters; user parameter items keep command here */ } ZBX_METRIC; /* agent request structure */ typedef struct { char *key; int nparam; char **params; zbx_uint64_t lastlogsize; int mtime; } AGENT_REQUEST; typedef struct { char *value; char *source; int timestamp; int severity; int logeventid; } zbx_log_t; /* agent result types */ #define AR_UINT64 0x01 #define AR_DOUBLE 0x02 #define AR_STRING 0x04 #define AR_TEXT 0x08 #define AR_LOG 0x10 #define AR_MESSAGE 0x20 #define AR_META 0x40 /* agent return structure */ typedef struct { zbx_uint64_t lastlogsize; /* meta information */ zbx_uint64_t ui64; double dbl; char *str; char *text; char *msg; /* possible error message */ zbx_log_t *log; int type; /* flags: see AR_* above */ int mtime; /* meta information */ } AGENT_RESULT; /* SET RESULT */ #define SET_UI64_RESULT(res, val) \ ( \ (res)->type |= AR_UINT64, \ (res)->ui64 = (zbx_uint64_t)(val) \ ) #define SET_DBL_RESULT(res, val) \ ( \ (res)->type |= AR_DOUBLE, \ (res)->dbl = (double)(val) \ ) /* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */ #define SET_STR_RESULT(res, val) \ ( \ (res)->type |= AR_STRING, \ (res)->str = (char *)(val) \ ) /* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */ #define SET_TEXT_RESULT(res, val) \ ( \ (res)->type |= AR_TEXT, \ (res)->text = (char *)(val) \ ) /* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */ #define SET_LOG_RESULT(res, val) \ ( \ (res)->type |= AR_LOG, \ (res)->log = (zbx_log_t *)(val) \ ) /* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */ #define SET_MSG_RESULT(res, val) \ ( \ (res)->type |= AR_MESSAGE, \ (res)->msg = (char *)(val) \ ) #define SYSINFO_RET_OK 0 #define SYSINFO_RET_FAIL 1 typedef struct { zbx_uint64_t itemid; int clock; int ns; double value; } ZBX_HISTORY_FLOAT; typedef struct { zbx_uint64_t itemid; int clock; int ns; zbx_uint64_t value; } ZBX_HISTORY_INTEGER; typedef struct { zbx_uint64_t itemid; int clock; int ns; const char *value; } ZBX_HISTORY_STRING; typedef struct { zbx_uint64_t itemid; int clock; int ns; const char *value; } ZBX_HISTORY_TEXT; typedef struct { zbx_uint64_t itemid; int clock; int ns; const char *value; const char *source; int timestamp; int logeventid; int severity; } ZBX_HISTORY_LOG; typedef struct { void (*history_float_cb)(const ZBX_HISTORY_FLOAT *history, int history_num); void (*history_integer_cb)(const ZBX_HISTORY_INTEGER *history, int history_num); void (*history_string_cb)(const ZBX_HISTORY_STRING *history, int history_num); void (*history_text_cb)(const ZBX_HISTORY_TEXT *history, int history_num); void (*history_log_cb)(const ZBX_HISTORY_LOG *history, int history_num); } ZBX_HISTORY_WRITE_CBS; #endif
/////////////////////////////////////////////////////////////////////////////// // // Copyright (2015) Alexander Stukowski // // This file is part of OVITO (Open Visualization Tool). // // OVITO 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. // // OVITO is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // /////////////////////////////////////////////////////////////////////////////// #ifndef __OVITO_FHI_AIMS_LOG_FILE_IMPORTER_H #define __OVITO_FHI_AIMS_LOG_FILE_IMPORTER_H #include <plugins/particles/Particles.h> #include "../ParticleImporter.h" namespace Ovito { namespace Particles { OVITO_BEGIN_INLINE_NAMESPACE(Import) OVITO_BEGIN_INLINE_NAMESPACE(Formats) /** * \brief File parser for log files of the FHI-aims code. */ class OVITO_PARTICLES_EXPORT FHIAimsLogFileImporter : public ParticleImporter { public: /// \brief Constructs a new instance of this class. Q_INVOKABLE FHIAimsLogFileImporter(DataSet* dataset) : ParticleImporter(dataset) { setMultiTimestepFile(true); } /// \brief Returns the file filter that specifies the files that can be imported by this service. /// \return A wild-card pattern that specifies the file types that can be handled by this import class. virtual QString fileFilter() override { return QStringLiteral("*"); } /// \brief Returns the filter description that is displayed in the drop-down box of the file dialog. /// \return A string that describes the file format. virtual QString fileFilterDescription() override { return tr("FHI-aims Log Files"); } /// \brief Checks if the given file has format that can be read by this importer. virtual bool checkFileFormat(QFileDevice& input, const QUrl& sourceLocation) override; /// Returns the title of this object. virtual QString objectTitle() override { return tr("FHI-aims"); } /// Creates an asynchronous loader object that loads the data for the given frame from the external file. virtual std::shared_ptr<FrameLoader> createFrameLoader(const Frame& frame, bool isNewlySelectedFile) override { return std::make_shared<FHIAimsImportTask>(dataset()->container(), frame, isNewlySelectedFile); } protected: /// \brief Scans the given input file to find all contained simulation frames. virtual void scanFileForTimesteps(FutureInterfaceBase& futureInterface, QVector<FileSourceImporter::Frame>& frames, const QUrl& sourceUrl, CompressedTextReader& stream) override; private: /// The format-specific task object that is responsible for reading an input file in the background. class FHIAimsImportTask : public ParticleFrameLoader { public: /// Constructor. FHIAimsImportTask(DataSetContainer* container, const FileSourceImporter::Frame& frame, bool isNewFile) : ParticleFrameLoader(container, frame, isNewFile) {} protected: /// Parses the given input file and stores the data in this container object. virtual void parseFile(CompressedTextReader& stream) override; }; Q_OBJECT OVITO_OBJECT }; OVITO_END_INLINE_NAMESPACE OVITO_END_INLINE_NAMESPACE } // End of namespace } // End of namespace #endif // __OVITO_FHI_AIMS_LOG_FILE_IMPORTER_H
/* * Copyright (C) 2011 Dmitry Skiba * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <inttypes.h> #include <Common/NonCopyable.h> #include <dropins/begin_namespace.h> #include <JNIpp.h>
/* * Copyright (C) 2016 Grzegorz Sygieda * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "stdio.h" #include "stdarg.h" #ifdef __cplusplus extern "C" { #endif void debug_print(const char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stdout, fmt, args); va_end(args); } #ifdef __cplusplus } #endif
/* * This file was generated by qdbusxml2cpp version 0.8 * Command line was: qdbusxml2cpp -p response.cpp resp.xml * * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd. * * This is an auto-generated file. * Do not edit! All changes made to it will be lost. */ #ifndef RESPONSE_CPP #define RESPONSE_CPP #include <QtCore/QByteArray> #include <QtCore/QList> #include <QtCore/QMap> #include <QtCore/QObject> #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> #include <QtDBus/QtDBus> /* * Proxy class for interface org.freedesktop.portal.Request */ class OrgFreedesktopPortalRequestInterface : public QDBusAbstractInterface { Q_OBJECT public: static inline const char* staticInterfaceName() { return "org.freedesktop.portal.Request"; } public: OrgFreedesktopPortalRequestInterface(const QString& service, const QString& path, const QDBusConnection& connection, QObject* parent = nullptr); ~OrgFreedesktopPortalRequestInterface(); public Q_SLOTS: // METHODS inline QDBusPendingReply<> Close() { QList<QVariant> argumentList; return asyncCallWithArgumentList(QStringLiteral("Close"), argumentList); } Q_SIGNALS: // SIGNALS void Response(uint response, QVariantMap results); }; namespace org { namespace freedesktop { namespace portal { typedef ::OrgFreedesktopPortalRequestInterface Request; } } } #endif
#ifndef QUI_AUXILIARYBASISTAB_H #define QUI_AUXILIARYBASISTAB_H /*! * \file AuxiliaryBasis.h * * \brief contains class definitions associated with the Auxiliary Basis * in the toolBoxOptions widget of the QUI. * * \author Andrew Gilbert * \date May 2019 */ #include "ui_AuxiliaryBasisTab.h" namespace Qui { class AuxiliaryBasisTab : public QWidget { Q_OBJECT public: AuxiliaryBasisTab(QWidget* parent) : QWidget(parent) { m_ui.setupUi(this); } // Public access for the logic to operate Ui::AuxiliaryBasisTab m_ui; }; } // end namespaces Qui #endif
/* * (C) 2003-2006 Gabest * (C) 2006-2014 see Authors.txt * * This file is part of MPC-HC. * * MPC-HC is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * MPC-HC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #pragma once #include "SubPicImpl.h" #include "SubPicAllocatorPresenterImpl.h" #include "dx/d3d.h" // CDX7SubPic class CDX7SubPic : public CSubPicImpl { CComPtr<IDirect3DDevice7> m_pD3DDev; CComPtr<IDirectDrawSurface7> m_pSurface; protected: STDMETHODIMP_(void*) GetObject(); // returns IDirectDrawSurface7* public: CDX7SubPic(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pSurface); // ISubPic STDMETHODIMP GetDesc(SubPicDesc& spd); STDMETHODIMP CopyTo(ISubPic* pSubPic); STDMETHODIMP ClearDirtyRect(DWORD color); STDMETHODIMP Lock(SubPicDesc& spd); STDMETHODIMP Unlock(RECT* pDirtyRect); STDMETHODIMP AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget); }; // CDX7SubPicAllocator class CDX7SubPicAllocator : public CSubPicAllocatorImpl, public CCritSec { CComPtr<IDirect3DDevice7> m_pD3DDev; CSize m_maxsize; bool Alloc(bool fStatic, ISubPic** ppSubPic); public: CDX7SubPicAllocator(IDirect3DDevice7* pD3DDev, SIZE maxsize); // ISubPicAllocator STDMETHODIMP ChangeDevice(IUnknown* pDev); STDMETHODIMP SetMaxTextureSize(SIZE MaxTextureSize); };
#pragma once // subtitleeditor -- a tool to create or edit subtitle // // https://kitone.github.io/subtitleeditor/ // https://github.com/kitone/subtitleeditor/ // // Copyright @ 2005-2018, kitone // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #include "waveform.h" class WaveformManager { public: // Virtual destructor virtual ~WaveformManager() { // nothing } // Try to open a waveform file and show or hide the editor. virtual bool open_waveform(const Glib::ustring &uri) = 0; // Init the Waveform Editor and the WaveformRenderer with this wf virtual void set_waveform(const Glib::RefPtr<Waveform> &wf) = 0; // Return the state of waveform. Cab be NULL. virtual bool has_waveform() = 0; // Return a pointer to the waveform. virtual Glib::RefPtr<Waveform> get_waveform() = 0; // A current waveform has changed. virtual sigc::signal<void> &signal_waveform_changed() = 0; // Try to display the current subtitle at the center of the view. virtual void center_with_selected_subtitle() = 0; // Increment the zoom virtual void zoom_in() = 0; // Decrement the zoom virtual void zoom_out() = 0; // Décrément completely the zoom virtual void zoom_all() = 0; // Zooming on the current subtitle. virtual void zoom_selection() = 0; };
// // UserModel.h // XujcClient // // Created by 田奕焰 on 16/3/6. // Copyright © 2016年 luckytianyiyan. All rights reserved. // #import "BaseModel.h" @interface UserModel : BaseModel @property (strong, nonatomic) NSString *nikename; @property (strong, nonatomic) NSString *phone; @property (strong, nonatomic) NSString *email; @property (strong, nonatomic) NSString *avatar; @property (strong, nonatomic) NSString *createdTime; @end
#ifndef LANDMARKS_LANDMARK_COST_ASSIGNMENT_H #define LANDMARKS_LANDMARK_COST_ASSIGNMENT_H #include <set> #include "../globals.h" class LandmarkGraph; class LandmarkNode; class LandmarkCostAssignment { const std::set<int> empty; protected: LandmarkGraph &lm_graph; OperatorCost cost_type; const std::set<int> &get_achievers(int lmn_status, const LandmarkNode &lmn) const; public: LandmarkCostAssignment(LandmarkGraph &graph, OperatorCost cost_type_); virtual ~LandmarkCostAssignment(); virtual double cost_sharing_h_value() = 0; }; class LandmarkUniformSharedCostAssignment : public LandmarkCostAssignment { bool use_action_landmarks; public: LandmarkUniformSharedCostAssignment(LandmarkGraph &graph, bool use_action_landmarks_, OperatorCost cost_type_); virtual ~LandmarkUniformSharedCostAssignment(); virtual double cost_sharing_h_value(); }; #ifdef USE_LP #include <coin/OsiSolverInterface.hpp> #endif class LandmarkEfficientOptimalSharedCostAssignment : public LandmarkCostAssignment { #ifdef USE_LP OsiSolverInterface *si; #endif public: LandmarkEfficientOptimalSharedCostAssignment(LandmarkGraph &graph, OperatorCost cost_type); virtual ~LandmarkEfficientOptimalSharedCostAssignment(); virtual double cost_sharing_h_value(); }; #endif
/* * fifos - fifo statistics * * This file is part of libpjf * Copyright (C) 2005-2009 ASN Sp. z o.o. * Author: Pawel Foremski <pjf@asn.pl> * * libpjf 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. * * libpjf is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _FIFOS_H_ #define _FIFOS_H_ #include "lib.h" struct fifos_el { char *value; /**> value to show */ long wd; /**> ID under inotify */ int fd; /**> fifo opened for r/w */ int state; /**> what were currently waiting for */ }; struct fifos { char *dir; /**> directory for fifos */ int fd; /**> inotify fd */ thash *data; /**> current state "on disk", name => struct fifos_el */ thash *wd2n; /**> for inotify, wd => name */ }; /** Inits fifos in given dir * @param dir directory to create fifos in */ struct fifos *fifos_init(const char *dir); /** Deletes fifos instance * @param f fifos instance data */ void fifos_deinit(struct fifos *f); /** Updates state * Synchronizes internal last state info with the supplied one, creating/deleting fifos under dir selected in * fifos_init(), copies values using mm * @param f fifos instance data * @param state a thash of name => value pairs * @return a fd to monitor for read(2) to be handled by fifos_read() */ int fifos_update(struct fifos *f, thash *state); /** Handle a read(2) request * @param f fifos instance data */ void fifos_read(struct fifos *f); #endif /* _FIFOS_H_ */
#ifndef ARDUINO_LEDS_H #define ARDUINO_LEDS_H #include <Arduino.h> #include "Types.h" #include "Parsing.h" #define FADE_TIME_MS 3000 void leds_reset(); void leds_setup(); void leds_process(); void leds_color_fade(const RGBW & start, const RGBW & stop, unsigned long time = FADE_TIME_MS); void leds_color_fade(byte R, byte G, byte B, unsigned long time = FADE_TIME_MS); void leds_white_fade(const RGBW & start, const RGBW & stop, unsigned long time = FADE_TIME_MS); void leds_white_fade(byte W, unsigned long time = FADE_TIME_MS); void switch_leds_off(); void switch_color_leds_off(); void switch_white_leds_off(); RGBW led_values(); bool leds_is_transition(LedType led_type); void leds_set_transition(LedType led_type, const Transition & transition_); void leds_start_transition(LedType led_type, bool start); #endif //ARDUINO_LEDS_H
#include <stdio.h> #include <math.h> void troca(float* v1, float* v2){ float aux = *v2; *v2 = *v1; *v1 = aux; } int main(){ float a,b,c; scanf("%f %f %f", &a, &b, &c); if(a < c) troca(&a,&c); if(b < c) troca(&b,&c); if(a < b) troca(&a,&b); if(a >= (b+c)){ printf("NAO FORMA TRIANGULO\n"); return 0; } if(pow(a,2) == ((pow(b,2) + pow(c,2)))) printf("TRIANGULO RETANGULO\n"); if(pow(a,2) < ((pow(b,2) + pow(c,2)))) printf("TRIANGULO ACUTANGULO\n"); else if(pow(a,2) > ((pow(b,2) + pow(c,2)))) printf("TRIANGULO OBTUSANGULO\n"); if(a == b && b == c) printf("TRIANGULO EQUILATERO\n"); else if((a==b) || (b==c) || (c==a)) printf("TRIANGULO ISOSCELES\n"); return 0; }