text
stringlengths
4
6.14k
/* Copyright 2008,2009 Will Stephenson <wstephenson@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PPPOEWIDGET_H #define PPPOEWIDGET_H #include "settingwidget.h" #include "knm_export.h" class PppoeWidgetPrivate; class KNM_EXPORT PppoeWidget : public SettingWidget { Q_OBJECT Q_DECLARE_PRIVATE(PppoeWidget) public: PppoeWidget(Knm::Connection *, QWidget * parent = 0 ); virtual ~PppoeWidget(); QString settingName() const; void readConfig(); void writeConfig(); void readSecrets(); protected Q_SLOTS: void validate(); void chkShowPassToggled(); }; #endif
#ifndef _TSUBTITLESSETTINGS_H_ #define _TSUBTITLESSETTINGS_H_ #include "TfilterSettings.h" #include "TfontSettings.h" class Ttranslate; class Twindow; struct TsubtitlesSettings : TfilterSettingsVideo { private: static const TfilterIDFF idffs; protected: virtual const int *getResets(unsigned int pageId); public: TsubtitlesSettings(TintStrColl *Icoll = NULL, TfilterIDFFs *filters = NULL, int filtermode = 0); virtual void copy(const TfilterSettings *src); char_t flnm[MAX_PATH], tempflnm[MAX_PATH]; int autoFlnm; int posX, posY; int align; static const char_t *alignments[], *subfilesmodes[]; static void getPosHoriz(int x, char_t *s, Twindow *w, int id, size_t len), getPosVert(int x, char_t *s, Twindow *w, int id, size_t len); int isExpand, expandCode; void getExpand(int *x, int *y) const; static void getExpand(int is, int code, int *x, int *y); int delay, speed, speed2; int stereoscopic, stereoscopicPar; int deflang, deflang2; struct Tlang { const char_t *desc; const char_t *lang, *isolang; LCID landId; }; static const Tlang langs[]; static const char_t *getLangDescr(const char_t *lang), *getLangDescrIso(const char_t *isolang); static LCID getLangId(const char_t *isolang); int vobsub; int vobsubAA; static const char_t *vobsubAAs[]; int vobsubAAswgauss; int vobsubChangePosition, subimgscale; int linespacing; int isMinDuration, minDurationType, minDurationSubtitle, minDurationLine, minDurationChar; static const char_t *durations[]; int wordWrap; static const char_t *wordWraps[]; int opacity; int textMargin; int cc; int filtermode; int extendedTags; int subSSA; int SSAOverridePlacement; int SSAMaintainInside; int SSAUseMovieDimensions; int pgs; int isSubFiles; int isSubText; static const int delayDef = 0, speedDef = 1000; virtual void createFilters(size_t filtersorder, Tfilters *filters, TfilterQueue &queue) const; virtual void createPages(TffdshowPageDec *parent) const; virtual bool getTip(unsigned int pageId, char_t *buf, size_t buflen); virtual void reg_op(TregOp &t); TfontSettingsSub font; //HACK: must be last }; #endif
/* #include "../include/global.h" */ /************************************* * General Header Files *************************************/ #ifdef HAVE_STDIO_H #include <stdio.h> #endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_SYSLOG_H #include <syslog.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> #endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif #ifdef HAVE_SIGNAL_H #include <signal.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_DIRENT_H #include <dirent.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_TIME_H #include <time.h> #endif #ifdef HAVE_PTHREAD_H #include <pthread.h> #endif #ifdef HAVE_GETOPT_H #include <getopt.h> #endif #ifdef HAVE_GRP_H #include <grp.h> #endif #ifdef HAVE_PWD_H #include <pwd.h> #endif #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif #ifdef HAVE_LIMITS_H #include <limits.h> #endif #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif /************************************* Default defines **************************************/ extern int do_log(char*); #define LOG(level, msg) (loglevel >= level || loglevel == -1) ? (do_log(msg)) : (0) #define OK 0 #define ERROR -2 #define MAX_FILENAME_LENGTH 256 #define MAX_VARIABLE_LENGTH 256 #define MAX_VALUE_LENGTH 256 #define MAX_COMMANDLINE_LENGTH 512 #define MAX_BUFFER_SIZE 1024 #define MAX_LOGMESSAGE_SIZE 768 #define CONFIG_OPT_COUNT 15 #define CONFIG_OPT_LOGTYPE 0 #define CONFIG_OPT_LOGFILE 1 #define CONFIG_OPT_LOGFILESIZE 2 #define CONFIG_OPT_LOGLEVEL 3 #define CONFIG_OPT_SCANDIR 4 #define CONFIG_OPT_RUNCMD 5 #define CONFIG_OPT_RUNCMD_ARG 6 #define CONFIG_OPT_MAXTHREADS 7 #define CONFIG_OPT_USER 8 #define CONFIG_OPT_GROUP 9 #define CONFIG_OPT_PIDFILE 10 #define CONFIG_OPT_USELOAD 11 #define CONFIG_OPT_LOAD 12 #define CONFIG_OPT_SLEEPTIME 13 #define CONFIG_OPT_IDENTMYSELF 14
#ifndef _PCF8574_CONTROLLER_CONSTS_h #define _PCF8574_CONTROLLER_CONSTS_h #include "I2C_Controller_Consts.h" static int const PCF8574_CONTROLLER_TYPE = I2C_CONTROLLER_LAST_MESSAGE + 1000; static int const PCF8574_CONTROLLER_LAST_MESSAGE = PCF8574_CONTROLLER_TYPE; static int const PCF8574_CONTROLLER_PIN_ID_START = PCF8574_CONTROLLER_TYPE + 100; #endif
#ifndef __DRV_TYPES_LINUX_H__ #define __DRV_TYPES_LINUX_H__ #endif
typedef enum { CPC_0, CPC_1, CPC_2, CPC_3, CPC_4, CPC_5, CPC_6, CPC_7, CPC_8, CPC_9, CPC_A, CPC_B, CPC_C, CPC_D, CPC_E, CPC_F, CPC_G, CPC_H, CPC_I, CPC_J, CPC_K, CPC_L, CPC_M, CPC_N, CPC_O, CPC_P, CPC_Q, CPC_R, CPC_S, CPC_T, CPC_U, CPC_V, CPC_W, CPC_X, CPC_Y, CPC_Z, CPC_AT, CPC_BACKSLASH, CPC_CAPSLOCK, CPC_CLR, CPC_COLON, CPC_COMMA, CPC_CONTROL, CPC_COPY, CPC_CUR_DOWN, CPC_CUR_LEFT, CPC_CUR_RIGHT, CPC_CUR_UP, CPC_DEL, CPC_ENTER, CPC_ESC, CPC_F0, CPC_F1, CPC_F2, CPC_F3, CPC_F4, CPC_F5, CPC_F6, CPC_F7, CPC_F8, CPC_F9, CPC_FPERIOD, CPC_LBRACKET, CPC_LSHIFT, CPC_MINUS, CPC_PERIOD, CPC_POWER, CPC_RBRACKET, CPC_RETURN, CPC_RSHIFT, CPC_SEMICOLON, CPC_SLASH, CPC_SPACE, CPC_TAB, CPC_J0_UP, CPC_J0_DOWN, CPC_J0_LEFT, CPC_J0_RIGHT, CPC_J0_FIRE1, CPC_J0_FIRE2, CPC_J1_UP, CPC_J1_DOWN, CPC_J1_LEFT, CPC_J1_RIGHT, CPC_J1_FIRE1, CPC_J1_FIRE2, } CPC_KEYS;
// // Config.h // CodeGeneratorByJSONSchema // // Created by Alexander.Ivlev on 1/18/16. // Copyright © 2016 themsteam. All rights reserved. // #pragma once #ifndef JSON_SCHEMA_CODE_CONFIG_H__ #define JSON_SCHEMA_CODE_CONFIG_H__ #include "JSCTypes.h" class Config { private: static Config config; Config(); public: static bool Load(std::string filename); static const std::string& languageName() { return config.m_languageName; } static const std::string& languageLib() { return config.m_languageLib; } static const std::string& tab() { return config.m_tab; } static const std::string& prefix() { return config.m_prefix; } static const std::string& inputFile() { return config.m_inputFile; } static const std::string& outputDirectory() { return config.m_outputDirectory; } static const std::string& licenceHeader() { return config.m_licenceHeader; } static const IgnoreList& ignoreList() { return config.m_ignoreList; } static const RenameMap& renameMap() { return config.m_renameMap; } static const std::vector<LeafClass>& leafClasses() { return config.m_leafClasses; } static const std::vector<AdditionalClass>& additionalClasses() { return config.m_additionalClasses; } private: static bool privateLoad(std::string filename); private: std::string m_languageName; std::string m_languageLib; std::string m_inputFile; std::string m_tab; std::string m_prefix; std::string m_outputDirectory; std::string m_licenceHeader; IgnoreList m_ignoreList; std::vector<LeafClass> m_leafClasses; RenameMap m_renameMap; std::vector<AdditionalClass> m_additionalClasses; }; #endif /* JSON_SCHEMA_CODE_CONFIG_H__ */
/*************************************************************************** * Copyright 2007 Robert Gruber <rgruber@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. * * * ***************************************************************************/ #ifndef KDEVPLATFORM_PLUGIN_IMPORTDIALOG_H #define KDEVPLATFORM_PLUGIN_IMPORTDIALOG_H #include <KDialog> #include <KUrl> #include <KJob> class ImportMetadataWidget; class CvsPlugin; /** * Asks the user for all options needed to import an existing directory into * a CVS repository * @author Robert Gruber <rgruber@users.sourceforge.net> */ class ImportDialog : public KDialog { Q_OBJECT public: ImportDialog(CvsPlugin *plugin, const KUrl& url, QWidget* parent=0); virtual ~ImportDialog(); public slots: virtual void accept(); void jobFinished(KJob* job); private: KUrl m_url; CvsPlugin* m_plugin; ImportMetadataWidget* m_widget; }; #endif
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * 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 version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * * GPL HEADER END */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/winnt/lltrace.h * * Basic library routines. */ #ifndef __LIBCFS_WINNT_LLTRACE_H__ #define __LIBCFS_WINNT_LLTRACE_H__ #ifndef __LIBCFS_LLTRACE_H__ #error Do not #include this file directly. #include <libcfs/lltrace.h> instead #endif #endif
/* ---------------------------------------------------------------------- * * monument.h * This file is part of lincity. * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001. * (c) Corey Keasling, 2004 * ---------------------------------------------------------------------- */ #ifndef __monument_h__ #define __monument_h__ void do_monument(int x, int y); void mps_monument(int x, int y); #endif /* __monument_h__ */
/**************************************************************************** ** $Id: rs_ptrqueue.h,v 1.1 2004/05/15 09:09:20 andrew Exp $ ** ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. ** ** This file is part of the qcadlib Library project. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding valid qcadlib Professional Edition licenses may use ** this file in accordance with the qcadlib Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.ribbonsoft.com for further details. ** ** Contact info@ribbonsoft.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef RS_PTRQUEUE_H #define RS_PTRQUEUE_H #if QT_VERSION>=0x030000 #include <qptrqueue.h> #define RS_PtrQueue QPtrQueue #else #include <qqueue.h> #define RS_PtrQueue QQueue #endif #endif
#ifndef GRAPH_H #define GRAPH_H #include <map> #include <vector> #include <set> #include <stdexcept> #include <string> using namespace std; typedef unsigned int node_t; struct edge_t{ node_t start; node_t end; edge_t(node_t start, node_t end); }; class Graph { map<node_t,set<node_t> > outgoing_adjacency_list; map<node_t,set<node_t> > incoming_adjacency_list; set<node_t> node_list; const bool directed_graph; public: Graph(bool directed_graph=false); Graph(vector<edge_t> edge_list,bool directed_graph=false); Graph(char* edge_list_file, bool directed_graph=false); ~Graph(); bool add_edge(edge_t edge); bool remove(edge_t edge); vector<edge_t> get_edges(void); vector<edge_t> get_incoming_edges(node_t node); vector<edge_t> get_outgoing_edges(node_t node); set<node_t> get_nodes(void); vector<node_t> get_root_nodes(void); vector<node_t> get_leaf_nodes(void); // Graph Algorithms static vector<node_t> toposort(Graph graph); }; class GraphException: public runtime_error{ public: explicit GraphException(const string& msg):runtime_error(msg){}; }; #endif // GRAPH_H
//---------------------------------------------------------- -*- Mode: C++ -*- // Copyright (C) 2006 Josh Taylor (Kosmix Corporation) // Created 2006-12-30 // // This file is part of the warp library. // // The warp library is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation; either version 2 of the License, or any later // version. // // The warp library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General // Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //---------------------------------------------------------------------------- #ifndef WARP_LOCKFILE_H #define WARP_LOCKFILE_H #include <string> namespace warp { /// Attempt to exclusively create the local file \c fn. If \c cmt /// is non-empty, fill the lock file with the given comment /// string. The lock file may be released by deleting it. /// @return True if the file was created, false if it already existed. /// @throws IOError if some other error condition occurs. bool attemptLock(std::string const & fn, std::string const & cmt); /// Exclusively create the local lock file \c fn. If \c cmt is /// non-empty, fill the lock file with the given comment string /// when it is created. If the attempt to create the lock file /// fails, this function will retry up to \c maxRetries times. If /// \c maxRetries is negative, it will never give up. Between /// each attempt, it will sleep for \c sleepTime seconds. If \c /// lockTimeout is positive and a previously existing lock file is /// older than \c lockTimeout seconds, the lock will be forced /// (deleted), and the function will sleep for \c suspendTime /// seconds before attempting to acquire the lock. Typically \c /// suspendTime is greater than \c sleepTime to prevent multiple /// processes from forcing each other's lock. If \c verbose is /// true, status updates will be written to stderr. This function /// will not return until the lock succeeds. It will throw an /// exception if it fails for some reason. The lock file may be /// released by deleting it. /// @throws RuntimeError if \c maxRetries is exceeded /// @throws IOError if there is a problem with the lock file void lockFile(std::string const & fn, std::string const & cmt, int maxRetries, double lockTimeout, double sleepTime, double suspendTime, bool verbose); } #endif // WARP_LOCKFILE_H
/* * $Id$ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ #ifndef SQUID_STOREHASHINDEX_H #define SQUID_STOREHASHINDEX_H #include "Store.h" #include "StoreSearch.h" /* A summary store that indexs all its children * into a memory hash */ class StoreSearch; class StoreHashIndex : public Store { public: StoreHashIndex(); StoreHashIndex(StoreHashIndex const &); /* to cause link failures */ virtual ~StoreHashIndex(); virtual int callback(); virtual void create(); virtual StoreEntry * get (const cache_key *); virtual void get (String const, STOREGETCLIENT, void * cbdata); virtual void init(); virtual void sync(); virtual uint64_t maxSize() const; virtual uint64_t minSize() const; virtual void stat(StoreEntry&) const; virtual void reference(StoreEntry&); virtual void dereference(StoreEntry&); virtual void maintain(); virtual void updateSize(int64_t, int); virtual StoreSearch *search(String const url, HttpRequest *); private: /* migration logic */ StorePointer store(int const x) const; }; class StoreHashIndexEntry : public StoreEntry {}; class StoreSearchHashIndex : public StoreSearch { public: StoreSearchHashIndex(RefCount<StoreHashIndex> sd); StoreSearchHashIndex(StoreSearchHashIndex const &); virtual ~StoreSearchHashIndex(); /* Iterator API - garh, wrong place */ /* callback the client when a new StoreEntry is available * or an error occurs */ virtual void next(void (callback)(void *cbdata), void *cbdata); /* return true if a new StoreEntry is immediately available */ virtual bool next(); virtual bool error() const; virtual bool isDone() const; virtual StoreEntry *currentItem(); RefCount<StoreHashIndex> sd; private: void copyBucket(); void (*callback)(void *cbdata); void *cbdata; bool _done; int bucket; Vector<StoreEntry *> entries; // keep this last. it plays with private/public CBDATA_CLASS2(StoreSearchHashIndex); }; #endif /* SQUID_STOREHASHINDEX_H */
/* * Re-map IO memory to kernel address space so that we can access it. * This is needed for high PCI addresses that aren't mapped in the * 640k-1MB IO memory area on PC's * * (C) Copyright 1995 1996 Linus Torvalds */ #include <linux/vmalloc.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/io.h> #include <linux/export.h> #include <asm/cacheflush.h> #include <asm/pgtable.h> // pmd : 0xC0004780, addr : 0xF0000000, next : 0xF0001000, phys_addr : 0x10481000 // prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot) { pte_t *pte; u64 pfn; // phys_addr : 0x10481000 pfn = phys_addr >> PAGE_SHIFT; // pfn : 0x10481 // pmd : 0xC0004780, addr : 0xF0000000 pte = pte_alloc_kernel(pmd, addr); // ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, addr)) ? NULL : pte_offset_kernel(pmd, addr)) // 로 변경되고 결국 // __pte_alloc_kernel(pmd, addr) 이 호출됨 // __pte_alloc_kernel 에서는 pte용 page를 할당받고 first-level table에 // page table을 생성시켜 줌 // // pte_offset_kernel(pmd, addr) : 생성한 second-level table에서 addr에 해당하는 곳의 // 주소를 뽑아냄 // pte : 해당 pte if (!pte) return -ENOMEM; // 통과 do { BUG_ON(!pte_none(*pte)); // pte에 값이 있는지 확인하는데, free 페이지를 받았으므로 // 아무것도 없음 // pfn : 0x10481, prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED // pfn_pte(pfn, prot) : 물리 주소가 0x10481000이고 prot 속성을 가진 small page 데이터 반환 // init_mm, addr : 0xF0000000, pte, 0x10481653 set_pte_at(&init_mm, addr, pte, pfn_pte(pfn, prot)); // second-level table에 적절한 값을 설정해 줌 pfn++; // pfn : 0x10482 // pte, addr : 0xF0000000, end : 0xF0001000 } while (pte++, addr += PAGE_SIZE, addr != end); // 4KB 영역에 대해서만 small page를 만들어주고 빠져나옴 return 0; } // pud : 0xC0004780, addr : 0xF0000000, end : 0xF0001000, phys_addr : 0x10481000 // prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot) { pmd_t *pmd; unsigned long next; phys_addr -= addr; // phys_addr : 0x20481000 // init_mm, pud : 0xC0004780, addr : 0xF0000000 pmd = pmd_alloc(&init_mm, pud, addr); // ((unlikely(pgd_none(*(pud))) && __pmd_alloc(&init_mm, pud, addr)) ? NULL : pmd_offset(pud, addr)) // pmd : 0xC0004780 // pud 값이 그냥 반환됨 if (!pmd) return -ENOMEM; // 통과 do { // addr : 0xF0000000, end : 0xF0001000 next = pmd_addr_end(addr, end); // next : 0xF0001000 // end 값이 그대로 반환됨 // pmd : 0xC0004780, addr : 0xF0000000, next : 0xF0001000, phys_addr + addr : 0x10481000 // prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED if (ioremap_pte_range(pmd, addr, next, phys_addr + addr, prot)) // page table과 이를 위한 page를 할당받고 적절한 small page를 설정해줌 return -ENOMEM; } while (pmd++, addr = next, addr != end); // 바로 탈출 return 0; } // pgd : 0xC0004780, addr : 0xF0000000, end : 0xF0001000 // phys_addr : 0x10481000, prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot) { pud_t *pud; unsigned long next; // phys_addr : 0x10481000, addr : 0xF0000000 phys_addr -= addr; // phys_addr : 0x20481000 // init_mm : 전역 변수, pgd : 0xC0004780, addr : 0xF0000000 pud = pud_alloc(&init_mm, pgd, addr); // pgd를 그냥 반환함 // pud : 0xC0004780 if (!pud) return -ENOMEM; // 통과 do { // addr : 0xF0000000, end : 0xF0001000 next = pud_addr_end(addr, end); // end가 그냥 반환됨 // next : 0xF0001000 // pud : 0xC0004780, addr : 0xF0000000, next : 0xF0001000, phys_addr + addr : 0x10481000 // prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED if (ioremap_pmd_range(pud, addr, next, phys_addr + addr, prot)) // pte 생성 return -ENOMEM; } while (pud++, addr = next, addr != end); // 바로 탈출 return 0; } // addr : 0xF0000000, end : 0xF0001000, phys_addr : 0x10481000, // prot : mem_types[MT_DEVICE].prot_pte int ioremap_page_range(unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot) { pgd_t *pgd; unsigned long start; unsigned long next; int err; BUG_ON(addr >= end); start = addr; // start : 0xF0000000 // addr : 0xF0000000 phys_addr -= addr; // phys_addr : 0x20481000 pgd = pgd_offset_k(addr); // pgd : 0xC0004780 do { // addr : 0xF0000000, end : 0xF0001000 next = pgd_addr_end(addr, end); // next : 0xF0001000 // pgd : 0xC0004780, addr : 0xF0000000, next : 0xF0001000 // phys_addr + addr : 0x10481000, prot : PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | L_PTE_SHARED err = ioremap_pud_range(pgd, addr, next, phys_addr+addr, prot); // 적절한 페이지 테이블 생성 // err : 0 if (err) break; } while (pgd++, addr = next, addr != end); // 바로 탈출 flush_cache_vmap(start, end); // 캐시를 flush 해줌 return err; // return 0 } EXPORT_SYMBOL_GPL(ioremap_page_range);
/******************************************************************************* * File Name: ADC_SAR_Seq_1_INT.c * Version 2.0 * * Description: * This file contains the code that operates during the ADC_SAR interrupt * service routine. * * Note: * ******************************************************************************** * Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. *******************************************************************************/ #include "ADC_SAR_Seq_1.h" /****************************************************************************** * Custom Declarations and Variables * - add user inlcude files, prototypes and variables between the following * #START and #END tags ******************************************************************************/ /* `#START ADC_SYS_VAR` */ /* `#END` */ #if(ADC_SAR_Seq_1_IRQ_REMOVE == 0u) /****************************************************************************** * Function Name: ADC_SAR_Seq_1_ISR ******************************************************************************* * * Summary: * Handle Interrupt Service Routine. * * Parameters: * None. * * Return: * None. * * Reentrant: * No. * ******************************************************************************/ CY_ISR( ADC_SAR_Seq_1_ISR ) { uint32 intr_status; /* Read interrupt status register */ intr_status = ADC_SAR_Seq_1_SAR_INTR_REG; /************************************************************************ * Custom Code * - add user ISR code between the following #START and #END tags *************************************************************************/ /* `#START MAIN_ADC_ISR` */ /* `#END` */ /* Clear handled interrupt */ ADC_SAR_Seq_1_SAR_INTR_REG = intr_status; } #endif /* End ADC_SAR_Seq_1_IRQ_REMOVE */ /* [] END OF FILE */
#ifndef K3DSDK_IMIME_TYPE_HANDLER_H #define K3DSDK_IMIME_TYPE_HANDLER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.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 /** \file \author Tim Shead (tshead@k-3d.com) */ #include <k3dsdk/iunknown.h> #include <k3dsdk/types.h> #include <boost/filesystem/path.hpp> namespace k3d { /// Abstract interface for objects that can identify the MIME Type of a file class imime_type_handler : public virtual iunknown { public: /// Called to identify the MIME Type of a file. Returns true iff the MIME Type was successfully identified. virtual bool_t identify_mime_type(const boost::filesystem::path& File, string_t& FileType) = 0; /// Called to identify the MIME Type of a data stream. Returns true iff the MIME Type was successfully identified. virtual bool_t identify_mime_type(const string_t& Data, string_t& DataType) = 0; protected: imime_type_handler() {} imime_type_handler(const imime_type_handler&) {} imime_type_handler& operator=(const imime_type_handler&) { return *this; } virtual ~imime_type_handler() {} }; } // namespace k3d #endif // !K3DSDK_IMIME_TYPE_HANDLER_H
/* UICompositeViewController.h * * Copyright (C) 2012 Belledonne Comunications, Grenoble, France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> #import "LinphoneManager.h" #import "TPMultiLayoutViewController.h" @interface UICompositeViewDescription: NSObject{ } @property (retain) NSString *name; @property (retain) NSString *content; @property (retain) NSString *stateBar; @property (assign) BOOL stateBarEnabled; @property (retain) NSString *tabBar; @property (assign) BOOL tabBarEnabled; @property (assign) BOOL fullscreen; @property (assign) BOOL landscapeMode; @property (assign) BOOL portraitMode; @property (assign) BOOL darkBackground; @property (nonatomic, retain) UIColor *statusBarColor; @property (nonatomic, assign) UIStatusBarStyle statusBarStyle; @property (nonatomic, assign) int statusBarMargin; - (id)copy; - (BOOL)equal:(UICompositeViewDescription*) description; - (id)init:(NSString *)name content:(NSString *)content stateBar:(NSString*)stateBar stateBarEnabled:(BOOL) stateBarEnabled tabBar:(NSString*)tabBar tabBarEnabled:(BOOL) tabBarEnabled fullscreen:(BOOL) fullscreen landscapeMode:(BOOL) landscapeMode portraitMode:(BOOL) portraitMode; @end @protocol UICompositeViewDelegate <NSObject> + (UICompositeViewDescription*) compositeViewDescription; + (UICompositeViewDescription*) compositeSMSViewDescription; + (UICompositeViewDescription*) compositeProcessSMSViewDescription; + (UICompositeViewDescription*) compositeSMSViewController; // Added by ankit khanna on 5 March 2015 for Activate SMS change @end @interface UICompositeViewController : TPMultiLayoutViewController { @private NSMutableDictionary *viewControllerCache; UICompositeViewDescription *currentViewDescription; UIInterfaceOrientation currentOrientation; } @property (retain) CATransition *viewTransition; @property (nonatomic, retain) IBOutlet UIView* stateBarView; @property (nonatomic, retain) IBOutlet UIView* contentView; @property (nonatomic, retain) IBOutlet UIView* tabBarView; - (void)changeView:(UICompositeViewDescription *)description; - (void)setFullScreen:(BOOL) enabled; - (void)setStateBarHidden:(BOOL) hidden; - (void)setToolBarHidden:(BOOL) hidden; - (BOOL)currentViewSupportsLandscape; - (UIViewController *)getCachedController:(NSString*)name; - (UIViewController *)getCurrentViewController; - (UIInterfaceOrientation)currentOrientation; - (void)clearCache:(NSArray*)exclude; @end
/** * This header file contains global constant/enum definitions, * global variable declaration. */ #ifndef _LBS_DEB_DEFS_H_ #define _LBS_DEB_DEFS_H_ #ifndef DRV_NAME #define DRV_NAME "libertas_tf" #endif #include <linux/spinlock.h> #ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG #define DEBUG #define PROC_DEBUG #endif #define LBTF_DEB_ENTER 0x00000001 #define LBTF_DEB_LEAVE 0x00000002 #define LBTF_DEB_MAIN 0x00000004 #define LBTF_DEB_NET 0x00000008 #define LBTF_DEB_MESH 0x00000010 #define LBTF_DEB_WEXT 0x00000020 #define LBTF_DEB_IOCTL 0x00000040 #define LBTF_DEB_SCAN 0x00000080 #define LBTF_DEB_ASSOC 0x00000100 #define LBTF_DEB_JOIN 0x00000200 #define LBTF_DEB_11D 0x00000400 #define LBTF_DEB_DEBUGFS 0x00000800 #define LBTF_DEB_ETHTOOL 0x00001000 #define LBTF_DEB_HOST 0x00002000 #define LBTF_DEB_CMD 0x00004000 #define LBTF_DEB_RX 0x00008000 #define LBTF_DEB_TX 0x00010000 #define LBTF_DEB_USB 0x00020000 #define LBTF_DEB_CS 0x00040000 #define LBTF_DEB_FW 0x00080000 #define LBTF_DEB_THREAD 0x00100000 #define LBTF_DEB_HEX 0x00200000 #define LBTF_DEB_SDIO 0x00400000 #define LBTF_DEB_MACOPS 0x00800000 extern unsigned int lbtf_debug; #ifdef DEBUG #define LBTF_DEB_LL(grp, grpnam, fmt, args...) \ do { if ((lbtf_debug & (grp)) == (grp)) \ printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ in_interrupt() ? " (INT)" : "", ## args); } while (0) #else #define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) #endif #define lbtf_deb_enter(grp) \ LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__); #define lbtf_deb_enter_args(grp, fmt, args...) \ LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args); #define lbtf_deb_leave(grp) \ LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__); #define lbtf_deb_leave_args(grp, fmt, args...) \ LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \ __func__, ##args); #define lbtf_deb_main(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args) #define lbtf_deb_net(fmt, args...) LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args) #define lbtf_deb_mesh(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args) #define lbtf_deb_wext(fmt, args...) LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args) #define lbtf_deb_ioctl(fmt, args...) LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args) #define lbtf_deb_scan(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args) #define lbtf_deb_assoc(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args) #define lbtf_deb_join(fmt, args...) LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args) #define lbtf_deb_11d(fmt, args...) LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args) #define lbtf_deb_debugfs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args) #define lbtf_deb_ethtool(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args) #define lbtf_deb_host(fmt, args...) LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args) #define lbtf_deb_cmd(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args) #define lbtf_deb_rx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args) #define lbtf_deb_tx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args) #define lbtf_deb_fw(fmt, args...) LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args) #define lbtf_deb_usb(fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args) #define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args) #define lbtf_deb_cs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args) #define lbtf_deb_thread(fmt, args...) LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args) #define lbtf_deb_sdio(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args) #define lbtf_deb_macops(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args) #ifdef DEBUG static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) { char newprompt[32]; if (len && (lbtf_debug & LBTF_DEB_HEX) && (lbtf_debug & grp)) { snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt); print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len); } } #else #define lbtf_deb_hex(grp, prompt, buf, len) do {} while (0) #endif #endif
/** * @file * @author Chrisitan Urich <christian.urich@gmail.com> * @version 1.0 * @section LICENSE * * This file is part of DynaMind * * Copyright (C) 2011 Christian Urich * 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 DMSIMULATIONREADER_H #define DMSIMULATIONREADER_H #include "dmcompilersettings.h" #include <QXmlDefaultHandler> #include <QVector> struct DM_HELPER_DLL_EXPORT ModuleEntry { QString ClassName; QString UUID; QString Name; QString GroupUUID; bool DebugMode; QMap<QString, QString> parameters; }; class DM_HELPER_DLL_EXPORT PortEntry { public: QString UUID; QString PortName; int isTuplePort; PortEntry () { isTuplePort = -1; } }; struct DM_HELPER_DLL_EXPORT LinkEntry { PortEntry InPort; PortEntry OutPort; bool backlink; }; struct DM_HELPER_DLL_EXPORT GroupEntry { QString id; QString desc_file; QString name; }; class DM_HELPER_DLL_EXPORT SimulationReader : QXmlDefaultHandler { public: SimulationReader(QIODevice* source); QVector<ModuleEntry> getModules() { return moduleEntries; } QVector<LinkEntry> getLinks() { return linkEntries; } QString getRootGroupUUID() { return this->RootUUID; } private: ModuleEntry tmpNode; LinkEntry tmpLink; QString tmpParameterName; QString tmpValue; QVector<ModuleEntry> moduleEntries; QVector<LinkEntry> linkEntries; QString ParentName; QString RootUUID; long id; bool startElement(const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts); bool fatalError(const QXmlParseException & exception); bool endElement(const QString & namespaceURI, const QString & localName, const QString & qName); bool characters(const QString & ch); }; #endif // SIMULATIONREADER_H
/************************************************************************* sndhrdw\hitme.c *************************************************************************/ #include "driver.h" #include "hitme.h" #include "sound/discrete.h" const struct discrete_555_desc desc_hitme_555 = { DISC_555_OUT_SQW | DISC_555_OUT_DC, 5, // B+ voltage of 555 DEFAULT_555_VALUES }; static struct discrete_comp_adder_table desc_hitme_adder = { DISC_COMP_P_CAPACITOR, 0, 5, { 0.100e-6, // C19 0.022e-6, // C18 0.033e-6, // C17 0.010e-6, // C16 0.005e-6 // C15 } }; /* Nodes - Adjustment */ #define HITME_GAME_SPEED NODE_05 /* Nodes - Sounds */ #define HITME_FINAL_SND NODE_90 DISCRETE_SOUND_START(hitme_discrete_interface) /* These are the inputs; PULSE-type inputs are used for oneshot latching signals */ DISCRETE_INPUT_DATA (HITME_DOWNCOUNT_VAL) DISCRETE_INPUT_PULSE(HITME_OUT0, 0) DISCRETE_INPUT_DATA (HITME_ENABLE_VAL) DISCRETE_INPUT_PULSE(HITME_OUT1, 0) /* This represents the resistor at R3, which controls the speed of the sound effects */ DISCRETE_ADJUSTMENT(HITME_GAME_SPEED,1,0.0,25000.0,DISC_LINADJ,6) /* The clock for the main downcounter is a "404", or LS123 retriggerable multivibrator. * It is clocked by IPH2 (8.945MHz/16 = 559kHz), then triggers a pulse which is adjustable * via the resistor R3. When the pulse is finished, it immediately retriggers itself to * form a clock. The length of the clock pulse is 0.45*R*C, where R is the variable R3 * resistor value, and C is 6.8uF. Thus the frequency of the resulting wave is * 1.0/(0.45*R*C). We compute that frequency and use a standard 50% duty cycle square wave. * This is because the "off time" of the clock is very small (559kHz), and we will miss * edges if we model it perfectly accurately. */ DISCRETE_TRANSFORM3(NODE_16,1,1,0.45*6.8e-6,HITME_GAME_SPEED,"012*/") DISCRETE_SQUAREWAVE(NODE_17,1,NODE_16,1,50,0.5,0) /* There are 2 cascaded 4-bit downcounters (2R = low, 2P = high), effectively * making an 8-bit downcounter, clocked by the clock from the 404 chip. * The initial count is latched by writing OUT0. */ DISCRETE_COUNTER(NODE_20,1,HITME_OUT0,NODE_17,255,0,HITME_DOWNCOUNT_VAL,DISC_CLK_ON_F_EDGE) /* When the counter rolls over from 0->255, we clock a D-type flipflop at 2N. */ DISCRETE_TRANSFORM2(NODE_21,1,NODE_20,255,"01=!") /* This flipflop represents the latch at 1L. It is clocked when OUT1 is written and latches * the value from the processor. When the downcounter above rolls over, it clears the latch. */ DISCRETE_LOGIC_DFLIPFLOP(NODE_22,1,NODE_21,1,HITME_OUT1,HITME_ENABLE_VAL) /* The output of the latch goes through a series of various capacitors in parallel. */ DISCRETE_COMP_ADDER(NODE_23,1,NODE_22,&desc_hitme_adder) /* The combined capacitance is input to a 555 timer in astable mode. */ DISCRETE_555_ASTABLE(NODE_24,1,22e3,39e3,NODE_23,&desc_hitme_555) /* The output of the 555 timer is fed through a simple CR filter in the amp stage. */ DISCRETE_CRFILTER(HITME_FINAL_SND,1,NODE_24,1e3,50e-6) /* We scale the final output of 3.3 to 16-bit range and output it at full volume */ DISCRETE_OUTPUT(HITME_FINAL_SND,32000.0/3.3) DISCRETE_SOUND_END
#include <stdio.h> // printf() #include <stdlib.h> // malloc() struct person { int age; // years int height_cm; // cm }; void printPerson(struct person *p) { printf("printPerson() age is [%i] and height in cm is [%i] \n", p->age, p->height_cm); p->age = 70; p->height_cm = 40; } int main() { struct person *Fred; Fred = (struct person*) malloc(sizeof(struct person)); Fred->age = 45; Fred->height_cm = 70; printPerson(Fred); printf("main() age is [%i] and height in cm is [%i] \n", Fred->age, Fred->height_cm); return 0; }
#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include <utility> #include <vector> #include "guilib/Resolution.h" #include "guilib/Geometry.h" #include "RenderFormats.h" #include "VideoShaders/ShaderFormats.h" #include "cores/IPlayer.h" #define MAX_PLANES 3 #define MAX_FIELDS 3 #define NUM_BUFFERS 6 class CSetting; typedef struct YV12Image { uint8_t* plane[MAX_PLANES]; int planesize[MAX_PLANES]; unsigned stride[MAX_PLANES]; unsigned width; unsigned height; unsigned flags; unsigned cshift_x; /* this is the chroma shift used */ unsigned cshift_y; unsigned bpp; /* bytes per pixel */ } YV12Image; enum EFIELDSYNC { FS_NONE, FS_TOP, FS_BOT }; // Render Methods enum RenderMethods { RENDER_METHOD_AUTO = 0, RENDER_METHOD_ARB, RENDER_METHOD_GLSL, RENDER_METHOD_SOFTWARE, RENDER_METHOD_D3D_PS, RENDER_METHOD_DXVA, RENDER_OVERLAYS = 99 // to retain compatibility }; struct VideoPicture; class CRenderCapture; class CBaseRenderer { public: CBaseRenderer(); virtual ~CBaseRenderer(); // Player functions virtual bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, void* hwPic, unsigned int orientation) = 0; virtual bool IsConfigured() = 0; virtual int GetImage(YV12Image *image, int source = -1, bool readonly = false) = 0; virtual void ReleaseImage(int source, bool preserve = false) = 0; virtual void AddVideoPictureHW(VideoPicture &picture, int index) {}; virtual bool IsPictureHW(VideoPicture &picture) { return false; }; virtual void FlipPage(int source) = 0; virtual void PreInit() = 0; virtual void UnInit() = 0; virtual void Reset() = 0; virtual void Flush() {}; virtual void SetBufferSize(int numBuffers) { } virtual void ReleaseBuffer(int idx) { } virtual bool NeedBuffer(int idx) { return false; } virtual bool IsGuiLayer() { return true; } // Render info, can be called before configure virtual CRenderInfo GetRenderInfo() { return CRenderInfo(); } virtual void Update() = 0; virtual void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255) = 0; virtual bool RenderCapture(CRenderCapture* capture) = 0; virtual bool HandlesRenderFormat(ERenderFormat format) { return format == m_format; }; virtual bool ConfigChanged(void *hwPic) { return false; }; // Feature support virtual bool SupportsMultiPassRendering() = 0; virtual bool Supports(ERENDERFEATURE feature) { return false; }; virtual bool Supports(ESCALINGMETHOD method) = 0; virtual bool WantsDoublePass() { return false; }; void SetViewMode(int viewMode); /*! \brief Get video rectangle and view window \param source is original size of the video \param dest is the target rendering area honoring aspect ratio of source \param view is the entire target rendering area for the video (including black bars) */ void GetVideoRect(CRect &source, CRect &dest, CRect &view); float GetAspectRatio() const; static void SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data); protected: void CalcNormalRenderRect(float offsetX, float offsetY, float width, float height, float inputFrameRatio, float zoomAmount, float verticalShift); void CalculateFrameAspectRatio(unsigned int desired_width, unsigned int desired_height); void ManageRenderArea(); virtual void ReorderDrawPoints();//might be overwritten (by egl e.x.) virtual EShaderFormat GetShaderFormat(ERenderFormat renderFormat); void saveRotatedCoords();//saves the current state of m_rotatedDestCoords void syncDestRectToRotatedPoints();//sync any changes of m_destRect to m_rotatedDestCoords void restoreRotatedCoords();//restore the current state of m_rotatedDestCoords from saveRotatedCoords void MarkDirty(); unsigned int m_sourceWidth; unsigned int m_sourceHeight; float m_sourceFrameRatio; float m_fps; unsigned int m_renderOrientation; // orientation of the video in degrees counter clockwise unsigned int m_oldRenderOrientation; // orientation of the previous frame // for drawing the texture with glVertex4f (holds all 4 corner points of the destination rect // with correct orientation based on m_renderOrientation // 0 - top left, 1 - top right, 2 - bottom right, 3 - bottom left CPoint m_rotatedDestCoords[4]; CPoint m_savedRotatedDestCoords[4];//saved points from saveRotatedCoords call CRect m_destRect; CRect m_oldDestRect; // destrect of the previous frame CRect m_sourceRect; CRect m_viewRect; // rendering flags unsigned m_iFlags; ERenderFormat m_format; };
/* * Created on: 28.5.2012 * Author: Antti Kamppi * filename: namegroupeditor.h * Project: Kactus 2 */ #ifndef NAMEGROUPEDITOR_H #define NAMEGROUPEDITOR_H #include <IPXACTmodels/common/NameGroup.h> #include <QGroupBox> #include <QLineEdit> #include <QPlainTextEdit> #include <QString> /*! Editor to edit the details of a NameGroup-struct. * */ class NameGroupEditor : public QGroupBox { Q_OBJECT public: //! The maximum height for the editor static const int MAX_EDITOR_HEIGHT = 130; NameGroupEditor(QSharedPointer<NameGroup> nameGroup, QWidget *parent, const QString& title = QString("Names")); //! The destructor virtual ~NameGroupEditor(); /*! Get the name of the name group. * * \return The contents of the name field. */ QString name() const; /*! Get the display name of the name group. * * \return The contents of the display name field. */ QString displayName() const; /*! Get the description of the name group. * * \return The contents of the description field. */ QString description() const; /*! Check if the editor is in valid state. * * \return True if the name-field is not empty. */ bool isValid() const; public slots: /*! Refresh the edit fields. * */ void refresh(); signals: //! Emitted when user edits one of the fields. void contentChanged(); /*! * Informs of change in name. */ void nameChanged(); private slots: /*! Handler for editing of the name field. * * \param newName The new name for the name group. * */ void onNameChanged(const QString& newName); /*! Handler for editing of the display name field. * * \param newName The new display name for the name group. * */ void onDisplayNameChanged(const QString& newName); /*! Handler for editing of the description field. * */ void onDescriptionChanged(); private: //! No copying NameGroupEditor(const NameGroupEditor& other); void setupLayout(); //! No assignment NameGroupEditor& operator=(const NameGroupEditor& other); //! The name group to edit. QSharedPointer<NameGroup> nameGroup_; //! Line edit to set the name. QLineEdit nameEdit_; //! Line edit to set the displayName. QLineEdit displayNameEdit_; //! Editor to write the description. QPlainTextEdit descriptionEdit_; }; #endif // NAMEGROUPEDITOR_H
/* This file is part of UFFS, the Ultra-low-cost Flash File System. uffs filesystem examples. */ #include <rtthread.h> //#include <stdio.h> #include <string.h> #include <stdlib.h> #include "uffs/uffs_config.h" #include "uffs/uffs_public.h" #include "uffs/uffs_fs.h" #include "uffs/uffs_utils.h" #include "uffs/uffs_core.h" #include "uffs/uffs_mtb.h" #include "uffs/uffs_find.h" #include "uffs/uffs_fd.h" #include "emu/cmdline.h" #include "uffs_ext.h" #include <dfs_posix.h> #include <rtgui/filerw.h> #ifdef RT_USING_FINSH #include <finsh.h> #endif #define PFX "exp: " #define MAX_PATH_LENGTH 128 #if (0) //uffs¿½±´º¯Êý,²ÎÊýÖ®¼ä¼Ó¿Õ¸ñ //ÐèÒª´Óelm¿½±´µ½uffsʱ(¿çÎļþϵͳ),²ÎÊýÃû³ÆÇ°¼Ó:: //ÀýÈçuffs_copy("::/01.hdc /dir1/01.hdc") //ÉÏÀý´ÓSD¿¨¿½±´Ò»¸öÎļþ01.hdcµ½flashÖÐ, //Ò²¿ÉÓÃdfsµÄº¯Êý,ÄÇÑù¾Í²»Óÿ¼ÂÇÊÇ·ñ¿çÎļþϵͳÁË. int uffs_copy(const char *tail) { const char *src; const char *des; char buf[100]; int fd1=-1, fd2=-1; int len; int src_local = FALSE, des_local = FALSE; int fd3=-1, fd4=-1; if(!tail) return FALSE; src = cli_getparam(tail, &des); if(!des) return FALSE; if(memcmp(src, "::", 2) == 0) { src += 2; src_local = TRUE; } if(memcmp(des, "::", 2) == 0) { des += 2; des_local = TRUE; } if(src_local) { //if((fp1 = fopen(src, "rb")) == NULL) if((fd3 = open(src,O_RDONLY,0)) < 0) { uffs_Perror(UFFS_ERR_NORMAL, "Can't open %s for copy.", src); goto fail_ext; } } else { if((fd1 = uffs_open(src, UO_RDONLY)) < 0) { uffs_Perror(UFFS_ERR_NORMAL, "Can't open %s for copy.", src); goto fail_ext; } } if(des_local) { if((fd4 = open(des,O_WRONLY | O_CREAT,0)) < 0) { uffs_Perror(UFFS_ERR_NORMAL, "Can't open %s for copy.", des); goto fail_ext; } } else { if((fd2 = uffs_open(des, UO_RDWR|UO_CREATE|UO_TRUNC)) < 0) { uffs_Perror(UFFS_ERR_NORMAL, "Can't open %s for copy.", des); goto fail_ext; } } uffs_Perror(UFFS_ERR_NORMAL, "copy %s to %s... ",src,des); while((src_local ? (1) : (uffs_eof(fd1) == 0))) { if(src_local) { len = read(fd3, buf, sizeof(buf)); } else { len = uffs_read(fd1, buf, sizeof(buf)); } if(len == 0) break; if(len < 0) { uffs_Perror(UFFS_ERR_NORMAL, "read file %s fail!", src); break; } if(des_local) { if(write(fd4, buf, len) != len) { uffs_Perror(UFFS_ERR_NORMAL, "write file %s fail!", des); break; } } else { if(uffs_write(fd2, buf, len) != len) { uffs_Perror(UFFS_ERR_NORMAL, "write file %s fail ?", des); break; } } } uffs_Perror(UFFS_ERR_NORMAL, "succ."); fail_ext: if(fd1 > 0) uffs_close(fd1); if(fd2 > 0) uffs_close(fd2); if(fd3 > 0) close(fd3); if(fd4 > 0) close(fd4); return TRUE; } FINSH_FUNCTION_EXPORT(uffs_copy, copy files. local file start with ::) #endif //¼ÆËã·¾¶ÏµÄÎļþ(¼Ð)¸öÊý int CountFileUnder(const char *dir) { int count = 0; uffs_DIR *dirp; dirp = uffs_opendir(dir); if(dirp) { while(uffs_readdir(dirp) != NULL) count++; if(dirp != NULL) uffs_closedir(dirp); } return count; } /* * º¯Êý¹¦ÄÜ: ÁгöÎļþÇåµ¥ * ÊäÈë²ÎÊý: name:·ÖÇøÃû³Æ * ·µ»Ø²ÎÊý: ³É¹¦:TRUE,ʧ°Ü:rt_false */ int uffs_ls(const char *name) { uffs_DIR *dirp; struct uffs_dirent *ent; struct uffs_stat stat_buf; int count = 0; char buf[MAX_FILENAME_LENGTH+2]; char *sub; if(name == NULL) { return FALSE; } dirp = uffs_opendir(name); //»á»ñµÃÒ»¸öuffs_DIRʵÀý if(dirp == NULL) { rt_kprintf("Can't open '%s' for list\n", name); } else { rt_kprintf("%-16s%-8s%-8s%-8s\n","name","type","size","serial"); rt_kprintf("-----------------------------------------\n"); ent = uffs_readdir(dirp); while(ent) { rt_kprintf("%-16s", ent->d_name); strcpy(buf, name); sub = buf; if(name[strlen(name)-1] != '/') sub = strcat(buf, "/"); sub = strcat(sub, ent->d_name); if(ent->d_type & FILE_ATTR_DIR) { sub = strcat(sub, "/"); rt_kprintf("%-8s", "<DIR>"); rt_kprintf("%-8d", CountFileUnder(sub)); } else { uffs_stat(sub, &stat_buf); rt_kprintf("%-8s", ""); rt_kprintf("%-8d", stat_buf.st_size); } rt_kprintf("%-8d\n", ent->d_ino); count++; ent = uffs_readdir(dirp); } if(dirp != NULL) uffs_closedir(dirp); rt_kprintf("Total: %d objects.\n", count); } return TRUE; } /* * º¯Êý¹¦ÄÜ: ¸ñʽ»¯·ÖÇø * ÊäÈë²ÎÊý: ·ÖÇøÃû³Æ * ·µ»Ø²ÎÊý: */ int uffs_format(const char *name) { int ret; const char *mount = "/"; uffs_Device *dev; if(name) { mount = name; } dev = uffs_GetDeviceFromMountPoint(mount); if(dev == NULL) { uffs_Perror(UFFS_ERR_NORMAL, "Can't get device from mount point."); } else { if(dev->ref_count == 1) { ret = uffs_FormatDevice(dev); uffs_Perror(UFFS_ERR_NORMAL, "Format %s.",ret==RT_EOK?"succ":"fail"); } else { uffs_Perror(UFFS_ERR_NORMAL, "dev->ref_count: %d, can't format this device.", dev->ref_count); } uffs_PutDevice(dev); } return TRUE; } /* * º¯Êý¹¦ÄÜ: ´´½¨Ò»¸öÎļþ * ÊäÈë²ÎÊý: ÎļþÃû³Æ * ·µ»Ø²ÎÊý: */ int uffs_mkfile(const char *name) { uffs_Object *fp; int ret = 0; int err = 0; fp = uffs_GetObject(); if(fp != NULL) { if(uffs_CreateObject(fp, name, UO_CREATE) != U_SUCC) { err = fp->err; ret = -1; uffs_Perror(UFFS_ERR_NORMAL, "Create %s fail, err: %d", name, uffs_get_error()); } else { uffs_Perror(UFFS_ERR_NORMAL, "Create %s succ.", name); uffs_CloseObject(fp); ret = 0; } uffs_PutObject(fp); } else { err = UEMFILE; ret = -1; } uffs_set_error(-err); return ret; } #if (0) #ifdef RT_USING_FINSH FINSH_FUNCTION_EXPORT(uffs_ls, list uffs system files.) FINSH_FUNCTION_EXPORT(uffs_mkfile, make uffs system file.) FINSH_FUNCTION_EXPORT(uffs_mkdir, make uffs system dir.) FINSH_FUNCTION_EXPORT(uffs_rmdir, remove uffs system dir.) FINSH_FUNCTION_EXPORT(uffs_format, format uffs partition.) #endif #endif
/* * Copyright (C) 2011 Petr Benes. * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <rtems/system.h> #include <rtems/config.h> #include <rtems/score/scheduler.h> #include <rtems/score/schedulercbs.h> int _Scheduler_CBS_Get_parameters ( Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params ) { if ( server_id >= _Scheduler_CBS_Maximum_servers ) return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; if ( !_Scheduler_CBS_Server_list[server_id] ) return SCHEDULER_CBS_ERROR_NOSERVER; *params = _Scheduler_CBS_Server_list[server_id]->parameters; return SCHEDULER_CBS_OK; }
/* * cpphighlighter.h - simplistic highlighter of C++ code * Copyright (C) 2008 Yandex LLC (Alexei Matiouchkine) * * 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 library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef CPPHIGHLIGHTER_H #define CPPHIGHLIGHTER_H #include "syntaxhighlighter.h" class QTextEdit; #include <QRegExp> #include <QTextCharFormat> class CppHighlighter : public SyntaxHighlighter { Q_OBJECT public: CppHighlighter(CombinedSyntaxHighlighter* parent, QTextEdit* textEdit); CppHighlighter(CombinedSyntaxHighlighter* parent, QTextDocument* textDocument); protected: bool highlightBlock(const QString &text); void highlightCppCode(const QString & text, int iFrom, int iTo); bool keyPressEvent(QKeyEvent* e); }; #endif
/* * Copyright (C) 2005-2013 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #ifndef _AVCLOCK_H_ #define _AVCLOCK_H_ #if defined(HAVE_OMXLIB) #include "OMXCore.h" #include "DVDClock.h" #include "linux/XTimeUtils.h" #ifdef OMX_SKIP64BIT static inline OMX_TICKS ToOMXTime(int64_t pts) { OMX_TICKS ticks; ticks.nLowPart = pts; ticks.nHighPart = pts >> 32; return ticks; } static inline int64_t FromOMXTime(OMX_TICKS ticks) { int64_t pts = ticks.nLowPart | ((uint64_t)(ticks.nHighPart) << 32); return pts; } #else #define FromOMXTime(x) (x) #define ToOMXTime(x) (x) #endif enum { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_MASTER, }; class OMXClock { protected: bool m_pause; bool m_has_video; bool m_has_audio; int m_play_speed; pthread_mutex_t m_lock; double SystemToAbsolute(int64_t system); double SystemToPlaying(int64_t system); int64_t m_systemUsed; int64_t m_startClock; int64_t m_pauseClock; double m_iDisc; bool m_bReset; static int64_t m_systemFrequency; static int64_t m_systemOffset; int64_t m_ClockOffset; double m_maxspeedadjust; bool m_speedadjust; static bool m_ismasterclock; double m_fps; int m_omx_speed; bool m_video_start; bool m_audio_start; bool m_audio_buffer; CDVDClock m_clock; OMX_TIME_CONFIG_CLOCKSTATETYPE m_clock_state; private: COMXCoreComponent m_omx_clock; public: OMXClock(); ~OMXClock(); void Lock(); void UnLock(); double GetAbsoluteClock(bool interpolated = true); double GetFrequency() { return (double)m_systemFrequency ; } double WaitAbsoluteClock(double target); double GetClock(bool interpolated = true); double GetClock(double& absolute, bool interpolated = true); void CheckSystemClock(); void SetSpeed(int iSpeed); void SetMasterClock(bool ismasterclock) { m_ismasterclock = ismasterclock; } bool IsMasterClock() { return m_ismasterclock; } void Discontinuity(double currentPts = 0LL); void Reset() { m_bReset = true; } void Pause(); void Resume(); int UpdateFramerate(double fps, double* interval = NULL); bool SetMaxSpeedAdjust(double speed); void OMXSetClockPorts(OMX_TIME_CONFIG_CLOCKSTATETYPE *clock); bool OMXSetReferenceClock(bool lock = true); bool OMXInitialize(bool has_video, bool has_audio); void OMXDeinitialize(); bool OMXIsPaused() { return m_pause; }; void OMXSaveState(bool lock = true); void OMXRestoreState(bool lock = true); bool OMXStop(bool lock = true); bool OMXStart(bool lock = true); bool OMXReset(bool lock = true); double OMXWallTime(bool lock = true); double OMXMediaTime(bool fixPreroll = true, bool lock = true); bool OMXPause(bool lock = true); bool OMXResume(bool lock = true); bool OMXUpdateClock(double pts, bool lock = true); bool OMXWaitStart(double pts, bool lock = true); void OMXHandleBackward(bool lock = true); bool OMXSetSpeed(int speed, bool lock = true); int OMXPlaySpeed() { return m_omx_speed; }; int OMXGetPlaySpeed() { return m_omx_speed; }; COMXCoreComponent *GetOMXClock(); bool OMXStatePause(bool lock = true); bool OMXStateExecute(bool lock = true); void OMXStateIdle(bool lock = true); static void AddTimespecs(struct timespec &time, long millisecs); bool HDMIClockSync(bool lock = true); static int64_t CurrentHostCounter(void); static int64_t CurrentHostFrequency(void); bool HasVideo() { return m_has_video; }; bool HasAudio() { return m_has_audio; }; void HasVideo(bool has_video) { m_has_video = has_video; }; void HasAudio(bool has_audio) { m_has_audio = has_audio; }; bool VideoStart() { return m_video_start; }; bool AudioStart() { return m_audio_start; }; void VideoStart(bool video_start); void AudioStart(bool audio_start); static void AddTimeSpecNano(struct timespec &time, uint64_t nanoseconds); void OMXAudioBufferStart(); void OMXAudioBufferStop(); bool OMXAudioBuffer() { return m_audio_buffer; }; int GetRefreshRate(double* interval = NULL); void SetRefreshRate(double fps) { m_fps = fps; }; static double NormalizeFrameduration(double frameduration); }; #endif #endif
/* $Id: capifs.c,v 1.1.2.3 2004/01/16 21:09:26 keil Exp $ * * Copyright 2000 by Carsten Paeth <calle@calle.de> * * Heavily based on devpts filesystem from H. Peter Anvin * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #include <linux/fs.h> #include <linux/mount.h> #include <linux/slab.h> #include <linux/namei.h> #include <linux/module.h> #include <linux/init.h> #include <linux/ctype.h> #include <linux/sched.h> /* current */ #include "capifs.h" MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem"); MODULE_AUTHOR("Carsten Paeth"); MODULE_LICENSE("GPL"); /* ------------------------------------------------------------------ */ #define CAPIFS_SUPER_MAGIC (('C'<<8)|'N') static struct vfsmount *capifs_mnt; static int capifs_mnt_count; static struct { int setuid; int setgid; uid_t uid; gid_t gid; umode_t mode; } config = {.mode = 0600}; /* ------------------------------------------------------------------ */ static int capifs_remount(struct super_block *s, int *flags, char *data) { int setuid = 0; int setgid = 0; uid_t uid = 0; gid_t gid = 0; umode_t mode = 0600; char *this_char; char *new_opt = kstrdup(data, GFP_KERNEL); this_char = NULL; while ((this_char = strsep(&data, ",")) != NULL) { int n; char dummy; if (!*this_char) continue; if (sscanf(this_char, "uid=%i%c", &n, &dummy) == 1) { setuid = 1; uid = n; } else if (sscanf(this_char, "gid=%i%c", &n, &dummy) == 1) { setgid = 1; gid = n; } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1) mode = n & ~S_IFMT; else { kfree(new_opt); printk("capifs: called with bogus options\n"); return -EINVAL; } } mutex_lock(&s->s_root->d_inode->i_mutex); replace_mount_options(s, new_opt); config.setuid = setuid; config.setgid = setgid; config.uid = uid; config.gid = gid; config.mode = mode; mutex_unlock(&s->s_root->d_inode->i_mutex); return 0; } static const struct super_operations capifs_sops = { .statfs = simple_statfs, .remount_fs = capifs_remount, .show_options = generic_show_options, }; static int capifs_fill_super(struct super_block *s, void *data, int silent) { struct inode * inode; s->s_blocksize = 1024; s->s_blocksize_bits = 10; s->s_magic = CAPIFS_SUPER_MAGIC; s->s_op = &capifs_sops; s->s_time_gran = 1; inode = new_inode(s); if (!inode) goto fail; inode->i_ino = 1; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; inode->i_nlink = 2; s->s_root = d_alloc_root(inode); if (s->s_root) return 0; printk("capifs: get root dentry failed\n"); iput(inode); fail: return -ENOMEM; } static int capifs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) { return get_sb_single(fs_type, flags, data, capifs_fill_super, mnt); } static struct file_system_type capifs_fs_type = { .owner = THIS_MODULE, .name = "capifs", .get_sb = capifs_get_sb, .kill_sb = kill_anon_super, }; static struct dentry *new_ncci(unsigned int number, dev_t device) { struct super_block *s = capifs_mnt->mnt_sb; struct dentry *root = s->s_root; struct dentry *dentry; struct inode *inode; char name[10]; int namelen; mutex_lock(&root->d_inode->i_mutex); namelen = sprintf(name, "%d", number); dentry = lookup_one_len(name, root, namelen); if (IS_ERR(dentry)) { dentry = NULL; goto unlock_out; } if (dentry->d_inode) { dput(dentry); dentry = NULL; goto unlock_out; } inode = new_inode(s); if (!inode) { dput(dentry); dentry = NULL; goto unlock_out; } /* config contents is protected by root's i_mutex */ inode->i_uid = config.setuid ? config.uid : current_fsuid(); inode->i_gid = config.setgid ? config.gid : current_fsgid(); inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_ino = number + 2; init_special_inode(inode, S_IFCHR|config.mode, device); d_instantiate(dentry, inode); dget(dentry); unlock_out: mutex_unlock(&root->d_inode->i_mutex); return dentry; } struct dentry *capifs_new_ncci(unsigned int number, dev_t device) { struct dentry *dentry; if (simple_pin_fs(&capifs_fs_type, &capifs_mnt, &capifs_mnt_count) < 0) return NULL; dentry = new_ncci(number, device); if (!dentry) simple_release_fs(&capifs_mnt, &capifs_mnt_count); return dentry; } void capifs_free_ncci(struct dentry *dentry) { struct dentry *root = capifs_mnt->mnt_sb->s_root; struct inode *inode; if (!dentry) return; mutex_lock(&root->d_inode->i_mutex); inode = dentry->d_inode; if (inode) { drop_nlink(inode); d_delete(dentry); dput(dentry); } dput(dentry); mutex_unlock(&root->d_inode->i_mutex); simple_release_fs(&capifs_mnt, &capifs_mnt_count); } static int __init capifs_init(void) { return register_filesystem(&capifs_fs_type); } static void __exit capifs_exit(void) { unregister_filesystem(&capifs_fs_type); } EXPORT_SYMBOL(capifs_new_ncci); EXPORT_SYMBOL(capifs_free_ncci); module_init(capifs_init); module_exit(capifs_exit);
#ifndef TG4_STEP_LIMITER_PHYSICS_H #define TG4_STEP_LIMITER_PHYSICS_H //------------------------------------------------ // The Geant4 Virtual Monte Carlo package // Copyright (C) 2007 - 2014 Ivana Hrivnacova // All rights reserved. // // For the licensing terms see geant4_vmc/LICENSE. // Contact: root-vmc@cern.ch //------------------------------------------------- /// \file TG4StepLimiterPhysics.h /// \brief Definition of the TG4StepLimiterPhysics class /// /// \author I. Hrivnacova; IPN Orsay #include "TG4VPhysicsConstructor.h" #include <globals.hh> class G4StepLimiter; /// \ingroup physics_list /// \brief The builder for step limiter process. /// /// \author I. Hrivnacova; IPN Orsay class TG4StepLimiterPhysics: public TG4VPhysicsConstructor { public: TG4StepLimiterPhysics(const G4String& name = "StepLimiter"); TG4StepLimiterPhysics(G4int theVerboseLevel, const G4String& name = "StepLimiter"); virtual ~TG4StepLimiterPhysics(); protected: // methods // construct particle and physics virtual void ConstructParticle(); virtual void ConstructProcess(); // data members G4StepLimiter* fStepLimiterProcess; ///< step limiter process private: /// Not implemented TG4StepLimiterPhysics(const TG4StepLimiterPhysics& right); /// Not implemented TG4StepLimiterPhysics& operator=(const TG4StepLimiterPhysics& right); }; #endif //TG4_STEP_LIMITER_PHYSICS_H
/* * isl6271a-regulator.c * * Support for Intersil ISL6271A voltage regulator * * Copyright (C) 2010 Marek Vasut <marek.vasut@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 version 2. * * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, * whether express or implied; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/err.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/i2c.h> #include <linux/delay.h> #include <linux/slab.h> #define ISL6271A_VOLTAGE_MIN 850000 #define ISL6271A_VOLTAGE_MAX 1600000 #define ISL6271A_VOLTAGE_STEP 50000 /* PMIC details */ struct isl_pmic { struct i2c_client *client; struct regulator_dev *rdev[3]; struct mutex mtx; }; static int isl6271a_get_voltage(struct regulator_dev *dev) { struct isl_pmic *pmic = rdev_get_drvdata(dev); int idx, data; mutex_lock(&pmic->mtx); idx = i2c_smbus_read_byte(pmic->client); if (idx < 0) { dev_err(&pmic->client->dev, "Error getting voltage\n"); data = idx; goto out; } /* Convert the data from chip to microvolts */ data = ISL6271A_VOLTAGE_MIN + (ISL6271A_VOLTAGE_STEP * (idx & 0xf)); out: mutex_unlock(&pmic->mtx); return data; } static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV, unsigned *selector) { struct isl_pmic *pmic = rdev_get_drvdata(dev); int vsel, err, data; if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX) return -EINVAL; if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX) return -EINVAL; /* Align to 50000 mV */ vsel = minuV - (minuV % ISL6271A_VOLTAGE_STEP); /* If the result fell out of [minuV,maxuV] range, put it back */ if (vsel < minuV) vsel += ISL6271A_VOLTAGE_STEP; /* Convert the microvolts to data for the chip */ data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP; *selector = data; mutex_lock(&pmic->mtx); err = i2c_smbus_write_byte(pmic->client, data); if (err < 0) dev_err(&pmic->client->dev, "Error setting voltage\n"); mutex_unlock(&pmic->mtx); return err; } static int isl6271a_list_voltage(struct regulator_dev *dev, unsigned selector) { return ISL6271A_VOLTAGE_MIN + (ISL6271A_VOLTAGE_STEP * selector); } static struct regulator_ops isl_core_ops = { .get_voltage = isl6271a_get_voltage, .set_voltage = isl6271a_set_voltage, .list_voltage = isl6271a_list_voltage, }; static int isl6271a_get_fixed_voltage(struct regulator_dev *dev) { int id = rdev_get_id(dev); return (id == 1) ? 1100000 : 1300000; } static int isl6271a_list_fixed_voltage(struct regulator_dev *dev, unsigned selector) { int id = rdev_get_id(dev); return (id == 1) ? 1100000 : 1300000; } static struct regulator_ops isl_fixed_ops = { .get_voltage = isl6271a_get_fixed_voltage, .list_voltage = isl6271a_list_fixed_voltage, }; static struct regulator_desc isl_rd[] = { { .name = "Core Buck", .id = 0, .n_voltages = 16, .ops = &isl_core_ops, .type = REGULATOR_VOLTAGE, .owner = THIS_MODULE, }, { .name = "LDO1", .id = 1, .n_voltages = 1, .ops = &isl_fixed_ops, .type = REGULATOR_VOLTAGE, .owner = THIS_MODULE, }, { .name = "LDO2", .id = 2, .n_voltages = 1, .ops = &isl_fixed_ops, .type = REGULATOR_VOLTAGE, .owner = THIS_MODULE, }, }; static int __devinit isl6271a_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct regulator_init_data *init_data = i2c->dev.platform_data; struct isl_pmic *pmic; int err, i; if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; if (!init_data) { dev_err(&i2c->dev, "no platform data supplied\n"); return -EIO; } pmic = kzalloc(sizeof(struct isl_pmic), GFP_KERNEL); if (!pmic) return -ENOMEM; pmic->client = i2c; mutex_init(&pmic->mtx); for (i = 0; i < 3; i++) { pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev, init_data, pmic); if (IS_ERR(pmic->rdev[i])) { dev_err(&i2c->dev, "failed to register %s\n", id->name); err = PTR_ERR(pmic->rdev[i]); goto error; } } i2c_set_clientdata(i2c, pmic); return 0; error: while (--i >= 0) regulator_unregister(pmic->rdev[i]); kfree(pmic); return err; } static int __devexit isl6271a_remove(struct i2c_client *i2c) { struct isl_pmic *pmic = i2c_get_clientdata(i2c); int i; for (i = 0; i < 3; i++) regulator_unregister(pmic->rdev[i]); kfree(pmic); return 0; } static const struct i2c_device_id isl6271a_id[] = { {.name = "isl6271a", 0 }, { }, }; MODULE_DEVICE_TABLE(i2c, isl6271a_id); static struct i2c_driver isl6271a_i2c_driver = { .driver = { .name = "isl6271a", .owner = THIS_MODULE, }, .probe = isl6271a_probe, .remove = __devexit_p(isl6271a_remove), .id_table = isl6271a_id, }; static int __init isl6271a_init(void) { return i2c_add_driver(&isl6271a_i2c_driver); } static void __exit isl6271a_cleanup(void) { i2c_del_driver(&isl6271a_i2c_driver); } subsys_initcall(isl6271a_init); module_exit(isl6271a_cleanup); MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); MODULE_DESCRIPTION("Intersil ISL6271A voltage regulator driver"); MODULE_LICENSE("GPL v2");
/*- * Copyright (c) 2004 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * * $FreeBSD: release/8.2.0/sys/arm/include/kdb.h 170473 2007-06-09 21:55:17Z marcel $ */ #ifndef _MACHINE_KDB_H_ #define _MACHINE_KDB_H_ #include <machine/frame.h> #include <machine/psl.h> #include <machine/cpufunc.h> static __inline void kdb_cpu_clear_singlestep(void) { } static __inline void kdb_cpu_set_singlestep(void) { } static __inline void kdb_cpu_sync_icache(unsigned char *addr, size_t size) { } static __inline void kdb_cpu_trap(int type, int code) { cpu_idcache_wbinv_all(); } #endif /* _MACHINE_KDB_H_ */
/*** bootchart.h - This file is part of systemd-bootchart Copyright (C) 2009-2013 Intel Coproration Authors: Auke Kok <auke-jan.h.kok@intel.com> systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <dirent.h> #include <stdbool.h> #define MAXCPUS 16 #define MAXPIDS 65535 #define MAXSAMPLES 8192 struct block_stat_struct { /* /proc/vmstat pgpgin & pgpgout */ int bi; int bo; }; struct cpu_stat_sample_struct { /* /proc/schedstat fields 10 & 11 (after name) */ double runtime; double waittime; }; struct cpu_stat_struct { /* per cpu array */ struct cpu_stat_sample_struct sample[MAXSAMPLES]; }; /* per process, per sample data we will log */ struct ps_sched_struct { /* /proc/<n>/schedstat fields 1 & 2 */ double runtime; double waittime; int pss; }; /* process info */ struct ps_struct { struct ps_struct *next_ps; /* SLL pointer */ struct ps_struct *parent; /* ppid ref */ struct ps_struct *children; /* children */ struct ps_struct *next; /* siblings */ /* must match - otherwise it's a new process with same PID */ char name[16]; int pid; int ppid; /* cache fd's */ int sched; int schedstat; FILE *smaps; /* index to first/last seen timestamps */ int first; int last; /* records actual start time, may be way before bootchart runs */ double starttime; /* record human readable total cpu time */ double total; /* largest PSS size found */ int pss_max; /* for drawing connection lines later */ double pos_x; double pos_y; struct ps_sched_struct *sample; }; extern int entropy_avail[]; extern double graph_start; extern double log_start; extern double sampletime[]; extern struct ps_struct *ps_first; extern struct block_stat_struct blockstat[]; extern struct cpu_stat_struct cpustat[]; extern int pscount; extern bool relative; extern bool filter; extern bool pss; extern bool entropy; extern bool initcall; extern int samples; extern int cpus; extern int len; extern double hz; extern double scale_x; extern double scale_y; extern int overrun; extern double interval; extern char output_path[PATH_MAX]; extern char init_path[PATH_MAX]; extern FILE *of; extern DIR *proc; extern int procfd; extern int sysfd; extern double gettime_ns(void); extern void log_uptime(void); extern void log_sample(int sample); extern void svg_do(const char *build);
#ifndef _ASM_CRIS_ARCH_PINMUX_H #define _ASM_CRIS_ARCH_PINMUX_H #define PORT_A 0 #define PORT_B 1 #define PORT_C 2 enum pin_mode { pinmux_none = 0, pinmux_fixed, pinmux_gpio, pinmux_iop }; enum fixed_function { pinmux_eth, pinmux_geth, pinmux_tg_ccd, pinmux_tg_cmos, pinmux_vout, pinmux_ser1, pinmux_ser2, pinmux_ser3, pinmux_ser4, pinmux_sser, pinmux_pio, pinmux_pwm0, pinmux_pwm1, pinmux_pwm2, pinmux_i2c0, pinmux_i2c1, pinmux_i2c1_3wire, pinmux_i2c1_sda1, pinmux_i2c1_sda2, pinmux_i2c1_sda3, }; int crisv32_pinmux_init(void); int crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode); int crisv32_pinmux_alloc_fixed(enum fixed_function function); int crisv32_pinmux_dealloc(int port, int first_pin, int last_pin); int crisv32_pinmux_dealloc_fixed(enum fixed_function function); void crisv32_pinmux_dump(void); #endif
#ifndef WREPORT_PYTHON_COMMON_H #define WREPORT_PYTHON_COMMON_H #include <wreport/error.h> #include <wreport/varinfo.h> #include "utils/core.h" namespace wreport { namespace python { /** * Return a python string representing a varcode */ PyObject* wrpy_varcode_format(wreport::Varcode code); /// Given a wreport exception, set the Python error indicator appropriately. void set_wreport_exception(const wreport::error& e); /** * Given a wreport exception, set the Python error indicator appropriately. * * @retval * Always returns NULL, so one can do: * try { * // ...code... * } catch (wreport::error& e) { * return raise_wreport_exception(e); * } */ PyObject* raise_wreport_exception(const wreport::error& e); /// Given a generic exception, set the Python error indicator appropriately. void set_std_exception(const std::exception& e); /** * Given a generic exception, set the Python error indicator appropriately. * * @retval * Always returns NULL, so one can do: * try { * // ...code... * } catch (std::exception& e) { * return raise_std_exception(e); * } */ PyObject* raise_std_exception(const std::exception& e); #define WREPORT_CATCH_RETURN_PYO \ catch (PythonException&) { \ return nullptr; \ } catch (wreport::error& e) { \ set_wreport_exception(e); return nullptr; \ } catch (std::exception& se) { \ set_std_exception(se); return nullptr; \ } #define WREPORT_CATCH_RETURN_INT \ catch (PythonException&) { \ return -1; \ } catch (wreport::error& e) { \ set_wreport_exception(e); return -1; \ } catch (std::exception& se) { \ set_std_exception(se); return -1; \ } #define WREPORT_CATCH_RETHROW_PYTHON \ catch (PythonException&) { \ throw; \ } catch (wreport::error& e) { \ set_wreport_exception(e); throw PythonException(); \ } catch (std::exception& se) { \ set_std_exception(se); throw PythonException(); \ } /// Call repr() on \a o, and return the result in \a out std::string object_repr(PyObject* o); /** * call o.fileno() and return its result. * * In case of AttributeError and IOError (parent of UnsupportedOperation, not * available from C), it clear the error indicator. * * Returns -1 if fileno() was not available or some other exception happened. * Use PyErr_Occurred to tell between the two. */ int file_get_fileno(PyObject* o); /** * call o.data() and return its result, both as a PyObject and as a buffer. * * The data returned in buf and len will be valid as long as the returned * object stays valid. */ PyObject* file_get_data(PyObject* o, char*&buf, Py_ssize_t& len); } } #endif
/* Hey EMACS -*- linux-c -*- */ /* $Id$ */ /* libticables2 - link cable library, a part of the TiLP project * Copyright (C) 1999-2005 Romain Lievin * * 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 */ /* TI-GRAPH LINK USB support */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifndef NO_CABLE_SLV #if defined(__WIN32__) && !defined(__MINGW32__) # define HAVE_LIBUSB #endif #ifdef HAVE_LIBUSB # include "linux/link_usb.c" #elif defined(HAVE_LIBUSB_1_0) # include "linux/link_usb1.c" #endif #ifdef HAVE_LINUX_TICABLE_H # include "linux/link_dev.c" #endif #endif
/* * linux/arch/arm/kernel/xscale-cp0.c * * XScale DSP and iWMMXt coprocessor context switching and handling * * 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/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/init.h> #include <linux/io.h> #include <asm/thread_notify.h> static inline void dsp_save_state(u32 *state) { __asm__ __volatile__ ( "mrrc p0, 0, %0, %1, c0\n" : "=r" (state[0]), "=r" (state[1])); } static inline void dsp_load_state(u32 *state) { __asm__ __volatile__ ( "mcrr p0, 0, %0, %1, c0\n" : : "r" (state[0]), "r" (state[1])); } static int dsp_do(struct notifier_block *self, unsigned long cmd, void *t) { struct thread_info *thread = t; switch (cmd) { case THREAD_NOTIFY_FLUSH: thread->cpu_context.extra[0] = 0; thread->cpu_context.extra[1] = 0; break; case THREAD_NOTIFY_SWITCH: dsp_save_state(current_thread_info()->cpu_context.extra); dsp_load_state(thread->cpu_context.extra); break; } return NOTIFY_DONE; } static struct notifier_block dsp_notifier_block = { .notifier_call = dsp_do, }; #ifdef CONFIG_IWMMXT static int iwmmxt_do(struct notifier_block *self, unsigned long cmd, void *t) { struct thread_info *thread = t; switch (cmd) { case THREAD_NOTIFY_FLUSH: /* * flush_thread() zeroes thread->fpstate, so no need * to do anything here. * * FALLTHROUGH: Ensure we don't try to overwrite our newly * initialised state information on the first fault. */ case THREAD_NOTIFY_EXIT: iwmmxt_task_release(thread); break; case THREAD_NOTIFY_SWITCH: iwmmxt_task_switch(thread); break; } return NOTIFY_DONE; } static struct notifier_block iwmmxt_notifier_block = { .notifier_call = iwmmxt_do, }; #endif static u32 __init xscale_cp_access_read(void) { u32 value; __asm__ __volatile__ ( "mrc p15, 0, %0, c15, c1, 0\n\t" : "=r" (value)); return value; } static void __init xscale_cp_access_write(u32 value) { u32 temp; __asm__ __volatile__ ( "mcr p15, 0, %1, c15, c1, 0\n\t" "mrc p15, 0, %0, c15, c1, 0\n\t" "mov %0, %0\n\t" "sub pc, pc, #4\n\t" : "=r" (temp) : "r" (value)); } /* * Detect whether we have a MAC coprocessor (40 bit register) or an * iWMMXt coprocessor (64 bit registers) by loading 00000100:00000000 * into a coprocessor register and reading it back, and checking * whether the upper word survived intact. */ static int __init cpu_has_iwmmxt(void) { u32 lo; u32 hi; /* * This sequence is interpreted by the DSP coprocessor as: * mar acc0, %2, %3 * mra %0, %1, acc0 * * And by the iWMMXt coprocessor as: * tmcrr wR0, %2, %3 * tmrrc %0, %1, wR0 */ __asm__ __volatile__ ( "mcrr p0, 0, %2, %3, c0\n" "mrrc p0, 0, %0, %1, c0\n" : "=r" (lo), "=r" (hi) : "r" (0), "r" (0x100)); return !!hi; } /* * If we detect that the CPU has iWMMXt (and CONFIG_IWMMXT=y), we * disable CP0/CP1 on boot, and let call_fpe() and the iWMMXt lazy * switch code handle iWMMXt context switching. If on the other * hand the CPU has a DSP coprocessor, we keep access to CP0 enabled * all the time, and save/restore acc0 on context switch in non-lazy * fashion. */ static int __init xscale_cp0_init(void) { u32 cp_access; cp_access = xscale_cp_access_read() & ~3; xscale_cp_access_write(cp_access | 1); if (cpu_has_iwmmxt()) { #ifndef CONFIG_IWMMXT printk(KERN_WARNING "CAUTION: XScale iWMMXt coprocessor " "detected, but kernel support is missing.\n"); #else printk(KERN_INFO "XScale iWMMXt coprocessor detected.\n"); elf_hwcap |= HWCAP_IWMMXT; thread_register_notifier(&iwmmxt_notifier_block); #endif } else { printk(KERN_INFO "XScale DSP coprocessor detected.\n"); thread_register_notifier(&dsp_notifier_block); cp_access |= 1; } xscale_cp_access_write(cp_access); return 0; } late_initcall(xscale_cp0_init);
/* * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2019 The ManaPlus Developers * Copyright (C) 2019-2022 Andrei Karas * * This file is part of The ManaPlus Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RESOURCES_MOBILEOPENGLSCREENSHOTHELPER_H #define RESOURCES_MOBILEOPENGLSCREENSHOTHELPER_H #if defined(USE_OPENGL) && !defined(ANDROID) #include "resources/screenshothelper.h" #include "resources/fboinfo.h" #include "localconsts.h" class MobileOpenGLScreenshotHelper final : public ScreenshotHelper { public: MobileOpenGLScreenshotHelper(); A_DELETE_COPY(MobileOpenGLScreenshotHelper) ~MobileOpenGLScreenshotHelper() override final; void prepare() override final; SDL_Surface *getScreenshot() override final; private: FBOInfo mFbo; }; #endif // defined(USE_OPENGL) && !defined(ANDROID) #endif // RESOURCES_MOBILEOPENGLSCREENSHOTHELPER_H
/* * Copyright (C) 2010-2011 Izb00shka <http://izbooshka.net/> * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRINITY_HOMEMOVEMENTGENERATOR_H #define TRINITY_HOMEMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" #include "Path.h" #include "Traveller.h" #include "PathFinder.h" class Creature; template < class T > class HomeMovementGenerator; template <> class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> > { public: HomeMovementGenerator():i_currentNode(0) {} ~HomeMovementGenerator() {} void Initialize(Creature &); void Finalize(Creature &); void Reset(Creature &); bool Update(Creature &, const uint32 &); void modifyTravelTime(uint32 travel_time) { i_travel_timer = travel_time; } MovementGeneratorType GetMovementGeneratorType() { return HOME_MOTION_TYPE; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } private: void _setTargetLocation(Creature &); DestinationHolder< Traveller<Creature> > i_destinationHolder; void MoveToNextNode(Creature &); float ori; uint32 i_travel_timer; PointPath i_path; uint32 i_currentNode; }; #endif
// // ZiXunCellModel.h // Zipingguo // // Created by sunny on 15/10/12. // Copyright © 2015年 fuyonghua. All rights reserved. // #import <Foundation/Foundation.h> #import "ZiXunListSM.h" @interface ZiXunCellModel : NSObject //@property (nonatomic,retain) NSString * title; //@property (nonatomic,retain) NSString * content; //@property (nonatomic,retain) NSString * createid; //@property (nonatomic,retain) NSString * createtime; //@property (nonatomic,assign) int status; //@property (nonatomic,retain) NSString * imgurl; //@property (nonatomic,retain) NSString * infotypeid; //@property (nonatomic,retain) NSString * companyid; //@property (nonatomic,assign) int ishomepage; //@property(nonatomic,assign)int readamount; //@property (nonatomic,retain) NSString * time; @property (nonatomic,retain) NSString * createid; @property (nonatomic,retain) NSString * ziXunID; @property (nonatomic,copy) NSString *iconImage; @property (nonatomic,copy) NSString *titleName; @property (nonatomic,copy) NSString *time; @property (nonatomic,assign) int commentCount; - (void)setModelWithSM:(ZiXunListSubSM *)sm; @end
/* * UtilFunctions.h * * * Created on: Aug 17, 2011 * Author: Martin Uhrin */ #ifndef UTIL_FUNCTIONS_H #define UTIL_FUNCTIONS_H // INCLUDES ///////////////////////////////////////////// #include <string> // FORWARD DECLARES //////////////////////////////// // DEFINES //////////////////////////////////////// // FUNCTIONS //////////////////////////////////////// namespace spl { namespace utility { std::string generateUniqueName(const size_t randPostfixLength = 4); std::string generateUniqueName(const ::std::string & prefix, const size_t randPostfixLength = 4); } } #endif /* UTIL_FUNCTIONS_H */
/*************************************************************************** * Project: RAPI * * Author: Jens Wawerla (jwawerla@sfu.ca) * * $Id: $ *************************************************************************** * 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 RAPIBOOLEANSTATEVARIABLE_H #define RAPIBOOLEANSTATEVARIABLE_H #include "statevariable.h" namespace Rapi { /** * A boolean state variable that keeps track of changes over time * @author Jens Wawerla */ class CBooleanStateVariable : public CStateVariable { public: /** * Default constructor */ CBooleanStateVariable(); /** Default destructor */ virtual ~CBooleanStateVariable(); /** Overloaded = operator */ bool operator= ( const bool b ); /** Overloaded != operator */ bool operator== ( const bool b ); /** Overloaded != operator */ bool operator!= ( const bool b ); /** * Called by the frame work to update the state variable * @param dt time since last call [s] */ virtual void updateData(float dt); protected: /** Actual variable */ bool mValue; }; } // namespace #endif
/* * Copyright (C) 1994-1996 Linus Torvalds & authors * * This file contains the powerpc architecture specific IDE code. */ #ifndef _ASM_POWERPC_IDE_H #define _ASM_POWERPC_IDE_H #ifdef __KERNEL__ #ifndef __powerpc64__ #include <linux/sched.h> #include <asm/mpc8xx.h> #endif #include <asm/io.h> #ifndef MAX_HWIFS #ifdef __powerpc64__ #define MAX_HWIFS 10 #else #define MAX_HWIFS 8 #endif #endif #define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c)) #define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c)) #define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c)) #define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c)) #ifndef __powerpc64__ #include <linux/hdreg.h> #include <linux/ioport.h> struct ide_machdep_calls { int (*default_irq)(unsigned long base); unsigned long (*default_io_base)(int index); void (*ide_init_hwif)(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq); }; extern struct ide_machdep_calls ppc_ide_md; #undef SUPPORT_SLOW_DATA_PORTS #define SUPPORT_SLOW_DATA_PORTS 0 #define IDE_ARCH_OBSOLETE_DEFAULTS static __inline__ int ide_default_irq(unsigned long base) { if (ppc_ide_md.default_irq) return ppc_ide_md.default_irq(base); return 0; } static __inline__ unsigned long ide_default_io_base(int index) { if (ppc_ide_md.default_io_base) return ppc_ide_md.default_io_base(index); return 0; } #ifdef CONFIG_PCI #define ide_init_default_irq(base) (0) #else #define ide_init_default_irq(base) ide_default_irq(base) #endif #if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE ) #define IDE_ARCH_ACK_INTR 1 #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) #endif #endif /* __powerpc64__ */ #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_IDE_H */
/** * DeviceFactory.c * (c) 2004 - 2006 SkyeTek, Inc. All Rights Reserved. * * Implementation of the DeviceFactory. */ #include "../SkyeTekAPI.h" #include "../SkyeTekProtocol.h" #include "DeviceFactory.h" #include <string.h> #include <stdlib.h> #include <stdio.h> #include <malloc.h> static LPDEVICE_FACTORY DeviceFactories[] = { #if defined(WIN32) && !defined(WINCE) && defined(STAPI_SPI) &SPIDeviceFactory, #endif #if defined(LINUX) && defined(STAPI_USB) &USBDeviceFactory, #endif #if defined(WIN32) && defined(STAPI_USB) &USBDeviceFactory, #endif #if defined(STAPI_SERIAL) &SerialDeviceFactory #endif }; #define DEVICEFACTORIES_COUNT sizeof(DeviceFactories)/sizeof(LPDEVICE_FACTORY) unsigned int DeviceFactory_GetCount(void) { return DEVICEFACTORIES_COUNT; } LPDEVICE_FACTORY DeviceFactory_GetFactory( unsigned int i ) { if(i > DEVICEFACTORIES_COUNT) return NULL; else return DeviceFactories[i]; } unsigned int DiscoverDevicesImpl( LPSKYETEK_DEVICE **lpDevices ) { LPDEVICE_FACTORY pDeviceFactory; unsigned int ix, deviceCount, localCount; LPSKYETEK_DEVICE *localDevices; deviceCount = 0; for(ix = 0; ix < DeviceFactory_GetCount(); ix++) { pDeviceFactory = DeviceFactory_GetFactory(ix); localDevices = NULL; localCount = pDeviceFactory->DiscoverDevices(&localDevices); if(localCount > 0) { *lpDevices = (LPSKYETEK_DEVICE*)realloc(*lpDevices, (deviceCount + localCount) * sizeof(LPSKYETEK_DEVICE)); memcpy(((*lpDevices) + deviceCount), localDevices, localCount*sizeof(LPSKYETEK_DEVICE)); free(localDevices); deviceCount += localCount; } } return deviceCount; } void FreeDevicesImpl( LPSKYETEK_DEVICE *lpDevices, unsigned int count ) { LPDEVICE_FACTORY pDeviceFactory; unsigned int ix; for(ix = 0; ix < DeviceFactory_GetCount(); ix++) { pDeviceFactory = DeviceFactory_GetFactory(ix); pDeviceFactory->FreeDevices(lpDevices,count); } } SKYETEK_STATUS CreateDeviceImpl( TCHAR *addr, LPSKYETEK_DEVICE *lpDevice ) { LPDEVICE_FACTORY pDeviceFactory; unsigned int ix; for(ix = 0; ix < DeviceFactory_GetCount(); ix++) { pDeviceFactory = DeviceFactory_GetFactory(ix); if(pDeviceFactory->CreateDevice(addr, lpDevice) == SKYETEK_SUCCESS) { return SkyeTek_OpenDevice(*lpDevice); } } return SKYETEK_FAILURE; } void FreeDeviceImpl( LPSKYETEK_DEVICE lpDevice ) { LPDEVICE_FACTORY pDeviceFactory; unsigned int ix; for(ix = 0; ix < DeviceFactory_GetCount(); ix++) { pDeviceFactory = DeviceFactory_GetFactory(ix); if( pDeviceFactory->FreeDevice(lpDevice) ) break; } }
#ifndef TEST_H #define TEST_H enum protocol_ids { /* always first */ PROTOCOL_HTTP = 0, PROTOCOL_JITTERTRAP, /* always last */ PROTOCOL_TERMINATOR }; extern char *resource_path; void dump_handshake_info(struct lws *wsi); #endif
/* * Copyright (c) 2017, 2020, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ struct { char a; char b[3]; } a3 = { 'o', { "wx" } }; int main() { return (a3.b[0] + a3.b[1] + a3.b[2]) % 128; }
/***************************************************************************** * Copyright Statement: * -------------------- * This software is protected by Copyright and the information contained * herein is confidential. The software may not be copied and the information * contained herein may not be used or disclosed except with the written * permission of MediaTek Inc. (C) 2009 * * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). * *****************************************************************************/ /* */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/fs.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/vmalloc.h> #include <linux/wait.h> #include <linux/spinlock.h> #include <linux/semaphore.h> #if defined(MT6577) #include <mach/mt_typedefs.h> #elif defined(MT6575) #include <mach/mt_typedefs.h> #elif defined(MT6573) #include <mach/mt_typedefs.h> #else #include <mach/mt_typedefs.h> #endif #ifndef _YUSU_ANDROID_SPEAKER_H_ #define _YUSU_ANDROID_SPEAKER_H_ enum EAMP_CONTROL_SUBCOMMAND { EAMP_SPEAKER_CLOSE =0, EAMP_SPEAKER_OPEN, EAMP_HEADPHONE_OPEN, EAMP_HEADPHONE_CLOSE, EAMP_EARPIECE_OPEN, EAMP_EARPIECE_CLOSE, EAMP_GETREGISTER_VALUE, EAMP_SETREGISTER_VALUE, EAMP_SETAMP_GAIN, EAMP_GETAMP_GAIN, EAMP_GET_CTRP_NUM , EAMP_GET_CTRP_BITS, EAMP_GET_CTRP_TABLE, EAMP_SETMODE, }; enum AUDIO_AMP_CONTROL_COMMAND{ AUD_AMP_GET_CTRP_NUM , AUD_AMP_GET_CTRP_BITS, AUD_AMP_GET_CTRP_TABLE, AUD_AMP_GET_REGISTER, AUD_AMP_SET_REGISTER, AUD_AMP_SET_AMPGAIN, // gain is use for low 24bits as external amp , device should base on control point set to AMPLL_CON0_REG AUD_AMP_GET_AMPGAIN, AUD_AMP_SET_MODE, NUM_AUD_AMP_COMMAND }; typedef struct { unsigned long int command; unsigned long int param1; unsigned long int param2; }AMP_Control; enum SPEAKER_CHANNEL { Channel_None = 0 , Channel_Right, Channel_Left, Channel_Stereo }; bool Speaker_Init(void); bool Speaker_DeInit(void); bool Speaker_Register(void); int ExternalAmp(void); void Sound_Speaker_Turnon(int channel); void Sound_Speaker_Turnoff(int channel); void Sound_Speaker_SetVolLevel(int level); void Sound_Headset_Turnon(void); void Sound_Headset_Turnoff(void); //now for kernal use void AudioAMPDevice_Suspend(void); void AudioAMPDevice_Resume(void); // used for AEE beep sound void AudioAMPDevice_SpeakerLouderOpen(void); //some times kernal need to force speaker for notification void AudioAMPDevice_SpeakerLouderClose(void); void AudioAMPDevice_mute(void); int Audio_eamp_command(unsigned int type, unsigned long args, unsigned int count); kal_int32 Sound_ExtFunction(const char* name, void* param, int param_size); #endif
/* P D S P L Y * * Copyright (C) 1981, D. C. Roe * Copyright (C) 2012,2018,2019 Duncan Roe * * Written by Duncan Roe while a staff member & part time student at * Caulfield Institute of Technology, Melbourne, Australia. * Support from Des Fitzgerald & Associates gratefully acknowledged. * Project started 1980. * * * Sets the prompt as supplied then does a DISPLY */ #include <stdio.h> #include <string.h> #include <sys/types.h> #include "prototypes.h" #include "scrnedit.h" void pdsply(scrbuf5 *buf, uint8_t *prm, int pch) { /* */ pchars = pch; if (pchars > PRSIZ - 1) { pchars = PRSIZ - 1; prm[PRSIZ] = '\0'; } strcpy((char *)prompt, (char *)prm); /* Move in the prompt */ if (forych) { forych = false; /* YCH sets it every line */ sdsply(); } else disply(buf, false); return; }
/* * Copyright 2000-2015 Rochus Keller <mailto:rkeller@nmr.ch> * * This file is part of the CARA (Computer Aided Resonance Assignment, * see <http://cara.nmr.ch/>) NMR Application Framework (NAF) library. * * The following is the license that applies to this copy of the * library. For a license to use the library under conditions * other than those described here, please email to rkeller@nmr.ch. * * GNU General Public License Usage * This file may be used under the terms of the GNU General Public * License (GPL) versions 2.0 or 3.0 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in * the packaging of this file. Please review the following information * to ensure GNU General Public Licensing requirements will be met: * http://www.fsf.org/licensing/licenses/info/GPLv2.html and * http://www.gnu.org/copyleft/gpl.html. */ #ifndef LUA_H #define LUA_H extern "C" { #include <Lua/lua.h> #include <Lua/lauxlib.h> #include <Lua/lualib.h> /// Holt den lokalen Data-Table von User-Object an objindex /// Stack pre: - / post: table or nil /// VORSICHT: wenn keine Datatable vorhanden, ist return=0 und nichts geht auf den Stack!!! LUA_API int (lua_getdatatable) (lua_State *L, int objindex); /// Setzt den lokalen Data-Table von User-Object an objindex auf pre und poppt table. /// Stack pre: table / post: - LUA_API int (lua_setdatatable) (lua_State *L, int objindex); /// Setzt das userdata auf den Stack. RISK: Keine Prüfung, ob wirklich UserData. /// Stack pre: - / post: object LUA_API void (lua_pushuserdata) (lua_State *L, void* userdata ); } #endif // LUA_H
#ifndef _FTAPE_WRITE_H #define _FTAPE_WRITE_H /* * Copyright (C) 1994-1995 Bas Laarhoven, * (C) 1996-1997 Claus-Justus Heine. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * $Source$ $Author: stsp2 $ * $Revision: 573 $ $Date: 2006-02-20 18:09:11 +0100 (Mon, 20 Feb 2006) $ $State$ * * This file contains the definitions for the write functions * for the QIC-117 floppy-tape driver for Linux. * */ /* ftape-write.c defined global functions. */ typedef enum { FT_WR_ASYNC = 0, /* start tape only when all buffers are full */ FT_WR_MULTI = 1, /* start tape, but don't necessarily stop */ FT_WR_SINGLE = 2, /* write a single segment and stop afterwards */ FT_WR_DELETE = 3 /* write deleted data marks */ } ft_write_mode_t; extern int ftape_start_writing(const ft_write_mode_t mode); extern int ftape_write_segment(const int segment, const void *address, const ft_write_mode_t flushing); extern void ftape_zap_write_buffers(void); extern int ftape_loop_until_writes_done(void); #endif /* _FTAPE_WRITE_H */
/* MICE Xbox 360 Controller driver for Mac OS X Copyright (C) 2006-2013 Colin Munro _60Controller.h - declaration of the driver main class This file is part of Xbox360Controller. Xbox360Controller 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. Xbox360Controller 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, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XBOX360CONTROLLER_H__ #define __XBOX360CONTROLLER_H__ #include <IOKit/hid/IOHIDDevice.h> #include <IOKit/usb/IOUSBDevice.h> #include <IOKit/usb/IOUSBInterface.h> class Xbox360ControllerClass; class ChatPadKeyboardClass; class Xbox360Peripheral : public IOService { OSDeclareDefaultStructors(Xbox360Peripheral) private: void ReleaseAll(void); bool QueueRead(void); bool QueueSerialRead(void); static void SerialReadCompleteInternal(void *target,void *parameter,IOReturn status,UInt32 bufferSizeRemaining); static void ReadCompleteInternal(void *target,void *parameter,IOReturn status,UInt32 bufferSizeRemaining); static void WriteCompleteInternal(void *target,void *parameter,IOReturn status,UInt32 bufferSizeRemaining); void SerialReadComplete(void *parameter, IOReturn status, UInt32 bufferSizeRemaining); void readSettings(void); static void ChatPadTimerActionWrapper(OSObject *owner, IOTimerEventSource *sender); void ChatPadTimerAction(IOTimerEventSource *sender); void SendToggle(void); void SendSpecial(UInt16 value); void SendInit(UInt16 value, UInt16 index); bool SendSwitch(bool sendOut); void PadConnect(void); void PadDisconnect(void); void SerialConnect(void); void SerialDisconnect(void); void SerialMessage(IOBufferMemoryDescriptor *data, size_t length); protected: typedef enum TIMER_STATE { tsToggle, tsReset1, tsReset2, tsMiniToggle, tsSet1, tsSet2, tsSet3, } TIMER_STATE; typedef enum CONTROLLER_TYPE { Xbox360 = 0, XboxOriginal = 1, XboxOne = 2 } CONTROLLER_TYPE; IOUSBDevice *device; IOLock *mainLock; // Joypad IOUSBInterface *interface; IOUSBPipe *inPipe,*outPipe; IOBufferMemoryDescriptor *inBuffer; // Keyboard IOUSBInterface *serialIn; IOUSBPipe *serialInPipe; IOBufferMemoryDescriptor *serialInBuffer; IOTimerEventSource *serialTimer; bool serialToggle, serialHeard, serialActive; int serialResetCount; TIMER_STATE serialTimerState; ChatPadKeyboardClass *serialHandler; Xbox360ControllerClass *padHandler; UInt8 chatpadInit[2]; CONTROLLER_TYPE controllerType; // Settings bool invertLeftX,invertLeftY; bool invertRightX,invertRightY; short deadzoneLeft,deadzoneRight; bool relativeLeft,relativeRight; bool deadOffLeft, deadOffRight; public: // Controller specific UInt8 rumbleType; UInt8 mapping[15]; // this is from the IORegistryEntry - no provider yet virtual bool init(OSDictionary *propTable); virtual void free(void); bool start(IOService *provider); void stop(IOService *provider); // IOKit methods. These methods are defines in <IOKit/IOService.h> virtual IOReturn setProperties(OSObject *properties); virtual IOReturn message(UInt32 type, IOService *provider, void *argument); virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); // Hooks virtual void ReadComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining); virtual void WriteComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining); bool QueueWrite(const void *bytes,UInt32 length); virtual void fiddleReport(IOBufferMemoryDescriptor *buffer); IOHIDDevice* getController(int index); }; #endif /* __XBOX360CONTROLLER_H__ */
/* * Basic Parser - TurboBasic XL compatible parsing and transformation tool. * Copyright (C) 2015 Daniel Serpell * * 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/> */ #include "convertbas.h" #include "procparams.h" #include "expr.h" #include "program.h" static int remove_comments(expr *ex) { // For each line/statement: for(; ex != 0 ; ex = ex->lft) { // Hide REM and '--' if( ex->type == et_stmt && (ex->stmt == STMT_REM_ || ex->stmt == STMT_REM ) ) ex->stmt = STMT_REM_HIDDEN; } return 0; } int convert_to_turbobas(program *p, int keep_comments) { int err = 0; expr *ex = pgm_get_expr(p); // Converts PROC/EXEC with parameters and local variables to standard PROC/EXEC. err |= convert_proc_exec(ex); // Remove comments, replace with "hidden comment" if( !keep_comments ) err |= remove_comments(ex); return err; }
/* Author: Aaron Clark - EpochMod.com Contributors: Description: Epoch gamemode server Side map specific configs for Mountains_ACR. Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike Github: https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_settngs/configs/maps/Mountains_ACR.h */ class Mountains_ACR : Default { worldSize = 0; // 0 = default to worldSize command plantLimit = 5; vehicleSpawnTypes[] = { {"FlatAreaCity",1}, {"FlatAreaCitySmall",1}, {"NameCity",2}, {"NameVillage",1}, {"NameCityCapital",4}, {"Airport",5}, {"NameLocal",2}, {"StrongpointArea",1}, {"VegetationBroadleaf",1}, {"VegetationFir",1}, {"ViewPoint",1} }; traderBlds[] = {}; containerPos[] = {}; telePos[] = { // N [-0.286865,8.17383,-10.3098] // S [-0.415527,-7.05298,-10.3098] // E [13.5127,0.410156,-10.3098] // W [-14.4316,0.112793,-10.3098] { "Transport_N_EPOCH", { -0.286865, 8.17383, -10.3098 }, "", "north" }, { "Transport_W_EPOCH", { -14.4316, 0.112793, -10.3098 }, "", "west" }, { "Transport_E_EPOCH", { 13.5127,0.410156,-10.3098 }, "", "east" }, { "Transport_C_EPOCH", { 13.5127, 0.410156, -10.3098 }, "", "south" } }; propsPos[] = { }; staticNpcPos[] = { }; };
#ifndef BACKUPTHREAD_H #define BACKUPTHREAD_H #include <QThread> #include "backupcore.h" class BackupThread : public QThread { Q_OBJECT void run() Q_DECL_OVERRIDE { int exitCode = BackupCore::backup(); emit resultReady(exitCode); } signals: void resultReady(int resultCode); }; #endif // BACKUPTHREAD_H
/* * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX * * 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. */ #if !defined(DMRDEFINES_H) #define DMRDEFINES_H const unsigned int DMR_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate const unsigned int DMR_FRAME_LENGTH_BYTES = 33U; const unsigned int DMR_FRAME_LENGTH_BITS = DMR_FRAME_LENGTH_BYTES * 8U; const unsigned int DMR_FRAME_LENGTH_SYMBOLS = DMR_FRAME_LENGTH_BYTES * 4U; const unsigned int DMR_FRAME_LENGTH_SAMPLES = DMR_FRAME_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_SYNC_LENGTH_BYTES = 6U; const unsigned int DMR_SYNC_LENGTH_BITS = DMR_SYNC_LENGTH_BYTES * 8U; const unsigned int DMR_SYNC_LENGTH_SYMBOLS = DMR_SYNC_LENGTH_BYTES * 4U; const unsigned int DMR_SYNC_LENGTH_SAMPLES = DMR_SYNC_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_EMB_LENGTH_BITS = 16U; const unsigned int DMR_EMB_LENGTH_SYMBOLS = 8U; const unsigned int DMR_EMB_LENGTH_SAMPLES = DMR_EMB_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_EMBSIG_LENGTH_BITS = 32U; const unsigned int DMR_EMBSIG_LENGTH_SYMBOLS = 16U; const unsigned int DMR_EMBSIG_LENGTH_SAMPLES = DMR_EMBSIG_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_SLOT_TYPE_LENGTH_BITS = 20U; const unsigned int DMR_SLOT_TYPE_LENGTH_SYMBOLS = 10U; const unsigned int DMR_SLOT_TYPE_LENGTH_SAMPLES = DMR_SLOT_TYPE_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_INFO_LENGTH_BITS = 196U; const unsigned int DMR_INFO_LENGTH_SYMBOLS = 98U; const unsigned int DMR_INFO_LENGTH_SAMPLES = DMR_INFO_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_AUDIO_LENGTH_BITS = 216U; const unsigned int DMR_AUDIO_LENGTH_SYMBOLS = 108U; const unsigned int DMR_AUDIO_LENGTH_SAMPLES = DMR_AUDIO_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const unsigned int DMR_CACH_LENGTH_BYTES = 3U; const unsigned int DMR_CACH_LENGTH_BITS = DMR_CACH_LENGTH_BYTES * 8U; const unsigned int DMR_CACH_LENGTH_SYMBOLS = DMR_CACH_LENGTH_BYTES * 4U; const unsigned int DMR_CACH_LENGTH_SAMPLES = DMR_CACH_LENGTH_SYMBOLS * DMR_RADIO_SYMBOL_LENGTH; const uint8_t DMR_SYNC_BYTES_LENGTH = 7U; const uint8_t DMR_MS_DATA_SYNC_BYTES[] = {0x0DU, 0x5DU, 0x7FU, 0x77U, 0xFDU, 0x75U, 0x70U}; const uint8_t DMR_MS_VOICE_SYNC_BYTES[] = {0x07U, 0xF7U, 0xD5U, 0xDDU, 0x57U, 0xDFU, 0xD0U}; const uint8_t DMR_BS_DATA_SYNC_BYTES[] = {0x0DU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD0U}; const uint8_t DMR_BS_VOICE_SYNC_BYTES[] = {0x07U, 0x55U, 0xFDU, 0x7DU, 0xF7U, 0x5FU, 0x70U}; const uint8_t DMR_S1_DATA_SYNC_BYTES[] = {0x0FU, 0x7FU, 0xDDU, 0x5DU, 0xDFU, 0xD5U, 0x50U}; const uint8_t DMR_S1_VOICE_SYNC_BYTES[] = {0x05U, 0xD5U, 0x77U, 0xF7U, 0x75U, 0x7FU, 0xF0U}; const uint8_t DMR_S2_DATA_SYNC_BYTES[] = {0x0DU, 0x75U, 0x57U, 0xF5U, 0xFFU, 0x7FU, 0x50U}; const uint8_t DMR_S2_VOICE_SYNC_BYTES[] = {0x07U, 0xDFU, 0xFDU, 0x5FU, 0x55U, 0xD5U, 0xF0U}; const uint8_t DMR_SYNC_BYTES_MASK[] = {0x0FU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xF0U}; const uint64_t DMR_MS_DATA_SYNC_BITS = 0x0000D5D7F77FD757U; const uint64_t DMR_MS_VOICE_SYNC_BITS = 0x00007F7D5DD57DFDU; const uint64_t DMR_BS_DATA_SYNC_BITS = 0x0000DFF57D75DF5DU; const uint64_t DMR_BS_VOICE_SYNC_BITS = 0x0000755FD7DF75F7U; const uint64_t DMR_S1_DATA_SYNC_BITS = 0x0000F7FDD5DDFD55U; const uint64_t DMR_S1_VOICE_SYNC_BITS = 0x00005D577F7757FFU; const uint64_t DMR_S2_DATA_SYNC_BITS = 0x0000D7557F5FF7F5U; const uint64_t DMR_S2_VOICE_SYNC_BITS = 0x00007DFFD5F55D5FU; const uint64_t DMR_SYNC_BITS_MASK = 0x0000FFFFFFFFFFFFU; const uint32_t DMR_MS_DATA_SYNC_SYMBOLS = 0x0076286EU; const uint32_t DMR_MS_VOICE_SYNC_SYMBOLS = 0x0089D791U; const uint32_t DMR_BS_DATA_SYNC_SYMBOLS = 0x00439B4DU; const uint32_t DMR_BS_VOICE_SYNC_SYMBOLS = 0x00BC64B2U; const uint32_t DMR_S1_DATA_SYNC_SYMBOLS = 0x0021751FU; const uint32_t DMR_S1_VOICE_SYNC_SYMBOLS = 0x00DE8AE0U; const uint32_t DMR_S2_DATA_SYNC_SYMBOLS = 0x006F8C23U; const uint32_t DMR_S2_VOICE_SYNC_SYMBOLS = 0x009073DCU; const uint32_t DMR_SYNC_SYMBOLS_MASK = 0x00FFFFFFU; const uint8_t DT_VOICE_PI_HEADER = 0U; const uint8_t DT_VOICE_LC_HEADER = 1U; const uint8_t DT_TERMINATOR_WITH_LC = 2U; const uint8_t DT_CSBK = 3U; const uint8_t DT_DATA_HEADER = 6U; const uint8_t DT_RATE_12_DATA = 7U; const uint8_t DT_RATE_34_DATA = 8U; const uint8_t DT_IDLE = 9U; const uint8_t DT_RATE_1_DATA = 10U; #endif
/* * %kadu copyright begin% * Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) * %kadu copyright end% * * 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/>. */ #pragma once #include "injeqt-type-roles.h" #include <QtCore/QPointer> #include <injeqt/injeqt.h> class DomVisitorProviderRepository; class GTalkProtocolFactory; class JabberActions; class JabberProtocolFactory; class JabberProtocolMenuManager; class JabberUrlDomVisitorProvider; class JabberUrlHandler; class MenuInventory; class ProtocolsManager; class UrlHandlerManager; class JabberPluginObject : public QObject { Q_OBJECT INJEQT_TYPE_ROLE(PLUGIN) public: Q_INVOKABLE explicit JabberPluginObject(QObject *parent = nullptr); virtual ~JabberPluginObject(); private: QPointer<DomVisitorProviderRepository> m_domVisitorProviderRepository; QPointer<GTalkProtocolFactory> m_gtalkProtocolFactory; QPointer<JabberActions> m_jabberActions; QPointer<JabberProtocolFactory> m_jabberProtocolFactory; QPointer<JabberProtocolMenuManager> m_jabberProtocolMenuManager; QPointer<JabberUrlDomVisitorProvider> m_jabberUrlDomVisitorProvider; QPointer<JabberUrlHandler> m_jabberUrlHandler; QPointer<MenuInventory> m_menuInventory; QPointer<ProtocolsManager> m_protocolsManager; QPointer<UrlHandlerManager> m_urlHandlerManager; private slots: INJEQT_INIT void init(); INJEQT_DONE void done(); INJEQT_SET void setDomVisitorProviderRepository(DomVisitorProviderRepository *domVisitorProviderRepository); INJEQT_SET void setGTalkProtocolFactory(GTalkProtocolFactory *gtalkProtocolFactory); INJEQT_SET void setJabberActions(JabberActions *jabberActions); INJEQT_SET void setJabberProtocolFactory(JabberProtocolFactory *jabberProtocolFactory); INJEQT_SET void setJabberProtocolMenuManager(JabberProtocolMenuManager *jabberProtocolMenuManager); INJEQT_SET void setJabberUrlDomVisitorProvider(JabberUrlDomVisitorProvider *jabberUrlDomVisitorProvider); INJEQT_SET void setJabberUrlHandler(JabberUrlHandler *jabberUrlHandler); INJEQT_SET void setMenuInventory(MenuInventory *menuInventory); INJEQT_SET void setProtocolsManager(ProtocolsManager *protocolsManager); INJEQT_SET void setUrlHandlerManager(UrlHandlerManager *urlHandlerManager); };
class speed_algorithm_RD_t : public speed_algorithm_base_t { private: time_t warning_beginning; speed_state_t previous_state; speed_state_t current_state(time_t now, double actual, double the_lo_limit, double the_hi_limit, double shutdown_limit); void reset_state(); public: speed_algorithm_RD_t(void); void evaluate(time_t now, double actual_speed, double actual_distance, current_speed_limits_t limits, speed_results_t *results); };
// // PBGitRevList.h // GitX // // Created by Pieter de Bie on 17-06-08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @class PBGitRepository; @class PBGitRevSpecifier; @interface PBGitRevList : NSObject { NSMutableArray *commits; __dct_weak PBGitRepository *repository; PBGitRevSpecifier *currentRev; BOOL isGraphing; NSThread *parseThread; BOOL isParsing; BOOL resetCommits; } - (id) initWithRepository:(PBGitRepository *)repo rev:(PBGitRevSpecifier *)rev shouldGraph:(BOOL)graph; - (void) loadRevisons; - (void)cancel; @property NSMutableArray *commits; @property (readonly) BOOL isParsing; @end
// ********************************************************************** // // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef ICE_SSL_TRANSCEIVER_I_H #define ICE_SSL_TRANSCEIVER_I_H #include <IceSSL/InstanceF.h> #include <IceSSL/Plugin.h> #include <Ice/LoggerF.h> #include <Ice/StatsF.h> #include <Ice/Transceiver.h> typedef struct ssl_st SSL; typedef struct bio_st BIO; namespace IceSSL { class ConnectorI; class AcceptorI; class TransceiverI : public IceInternal::Transceiver, public IceInternal::NativeInfo { enum State { StateNeedConnect, StateConnectPending, StateConnected, StateHandshakeComplete }; public: virtual IceInternal::NativeInfoPtr getNativeInfo(); #ifdef ICE_USE_IOCP virtual IceInternal::AsyncInfo* getAsyncInfo(IceInternal::SocketOperation); #endif virtual IceInternal::SocketOperation initialize(); virtual void close(); virtual bool write(IceInternal::Buffer&); virtual bool read(IceInternal::Buffer&); #ifdef ICE_USE_IOCP virtual bool startWrite(IceInternal::Buffer&); virtual void finishWrite(IceInternal::Buffer&); virtual void startRead(IceInternal::Buffer&); virtual void finishRead(IceInternal::Buffer&); #endif virtual std::string type() const; virtual std::string toString() const; virtual Ice::ConnectionInfoPtr getInfo() const; virtual void checkSendSize(const IceInternal::Buffer&, size_t); private: TransceiverI(const InstancePtr&, SOCKET, const std::string&, const struct sockaddr_storage&); TransceiverI(const InstancePtr&, SOCKET, const std::string&); virtual ~TransceiverI(); virtual NativeConnectionInfoPtr getNativeConnectionInfo() const; #ifdef ICE_USE_IOCP bool send(); bool receive(); #endif friend class ConnectorI; friend class AcceptorI; const InstancePtr _instance; const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; SSL* _ssl; const std::string _host; const bool _incoming; const std::string _adapterName; State _state; std::string _desc; struct sockaddr_storage _connectAddr; #ifdef ICE_USE_IOCP int _maxSendPacketSize; int _maxReceivePacketSize; BIO* _iocpBio; IceInternal::AsyncInfo _read; IceInternal::AsyncInfo _write; std::vector<char> _writeBuffer; std::vector<char>::iterator _writeI; std::vector<char> _readBuffer; std::vector<char>::iterator _readI; int _sentBytes; int _sentPacketSize; #endif }; typedef IceUtil::Handle<TransceiverI> TransceiverIPtr; } #endif
/* linux/include/asm/arch-socle/regs-pwm.h * * Copyright (c) 2007 Socle-tech Corp * http://www.socle-tech.com.tw/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #ifndef __SOCLE_PWM_REG_H #define __SOCLE_PWM_REG_H #include <mach/platform.h> #if defined(CONFIG_ARCH_P7DK) || defined(CONFIG_ARCH_PDK_PC7210) || defined(CONFIG_ARCH_MDK_3D) #define SOCLE_PWM_NUM 4 #else #define SOCLE_PWM_NUM 2 #endif #define SOCLE_PWMT0_BASE (IO_ADDRESS(SOCLE_TIMER_PWM0)) #define SOCLE_PWMT1_BASE (IO_ADDRESS(SOCLE_TIMER_PWM0) + PWMT1_BASE_OFFSET) #define PWMT_BASE_OFFSET 0X0010 #define PWMT_CNTR 0X0000 #define PWMT_HRC 0X0004 #define PWMT_LRC 0X0008 #define PWMT_CTRL 0X000C // 20090209 cyli fix #ifndef BIT_MASK #define BIT_MASK(bit) ((0x1 << bit) - 1) #endif #define BIT_SHIHT(bit) (0x1 << bit) // PWMT_CTRL (0X000C) #define PWMT_CTRL_PRESCALE_MSK 0x00003E00 #define PWMT_CTRL_PRESCALE_S 9 #define PWMT_CTRL_CAP BIT_SHIHT(8) #define PWMT_CTRL_RST BIT_SHIHT(7) #define PWMT_CTRL_INT_CLR BIT_SHIHT(6) #define PWMT_CTRL_INT_EN BIT_SHIHT(5) #define PWMT_CTRL_SIG_CNTR BIT_SHIHT(4) #define PWMT_CTRL_OPT_EN BIT_SHIHT(3) #define PWMT_CTRL_EN BIT_SHIHT(0) struct socle_pwmt { int busy; unsigned int base; int irq; struct socle_pwmt_driver *drv; int index; }; struct socle_pwmt_driver { void (*claim_pwm_lock)(void); void (*release_pwm_lock)(void); void (*reset)(struct socle_pwmt *); void (*output_enable)(struct socle_pwmt *, int); // 1:enable, 0:disable void (*enable)(struct socle_pwmt *, int); // 1:enable, 0:disable void (*capture_mode_enable)(struct socle_pwmt *, int); // 1:enable, 0:disable void (*clear_interrupt)(struct socle_pwmt *); void (*enable_interrupt)(struct socle_pwmt *, int); // 1:enable, 0:disable void (*single_counter_mode_enable)(struct socle_pwmt *, int); // 1:enable, 0:disable void (*set_counter)(struct socle_pwmt *, unsigned int); unsigned int (*read_hrc)(struct socle_pwmt *); unsigned int (*read_lrc)(struct socle_pwmt *); void (*write_hrc)(struct socle_pwmt *, unsigned int); void (*write_lrc)(struct socle_pwmt *, unsigned int); unsigned int (*read_prescale_factor)(struct socle_pwmt *); void (*write_prescale_factor)(struct socle_pwmt *, unsigned int); void (*suspend)(struct socle_pwmt *); void (*resume)(struct socle_pwmt *); #ifdef CONFIG_ARCH_PDK_PC7210 void (*i2s_phy_clock_on)(struct socle_pwmt *); void (*i2s_phy_clock_off)(struct socle_pwmt *); #endif }; extern struct socle_pwmt * get_socle_pwmt_structure(int num); extern int release_socle_pwmt_structure(int num); #endif //__SOCLE_PWM_REG_H
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __java_util_logging_MemoryHandler__ #define __java_util_logging_MemoryHandler__ #pragma interface #include <java/util/logging/Handler.h> #include <gcj/array.h> class java::util::logging::MemoryHandler : public ::java::util::logging::Handler { public: MemoryHandler (); MemoryHandler (::java::util::logging::Handler *, jint, ::java::util::logging::Level *); virtual void publish (::java::util::logging::LogRecord *); virtual void push (); virtual void flush (); virtual void close (); virtual ::java::util::logging::Level *getPushLevel () { return pushLevel; } virtual void setPushLevel (::java::util::logging::Level *); private: JArray< ::java::util::logging::LogRecord *> * __attribute__((aligned(__alignof__( ::java::util::logging::Handler )))) buffer; jint position; jint numPublished; ::java::util::logging::Level *pushLevel; ::java::util::logging::Handler *target; public: static ::java::lang::Class class$; }; #endif /* __java_util_logging_MemoryHandler__ */
#include "buffer.h" char buffer_1_space[BUFFER_OUTSIZE]; static buffer it = BUFFER_INIT (buffer_unixwrite, 1, buffer_1_space, sizeof (buffer_1_space)); buffer *buffer_1 = &it;
#include <linux/module.h> #include <linux/bitops.h> #include <asm/types.h> unsigned int __sw_hweight32(unsigned int w) { #ifdef ARCH_HAS_FAST_MULTIPLIER w -= (w >> 1) & 0x55555555; w = (w & 0x33333333) + ((w >> 2) & 0x33333333); w = (w + (w >> 4)) & 0x0f0f0f0f; return (w * 0x01010101) >> 24; #else unsigned int res = w - ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); res = (res + (res >> 4)) & 0x0F0F0F0F; res = res + (res >> 8); return (res + (res >> 16)) & 0x000000FF; #endif } EXPORT_SYMBOL(__sw_hweight32); unsigned int __sw_hweight16(unsigned int w) { unsigned int res = w - ((w >> 1) & 0x5555); res = (res & 0x3333) + ((res >> 2) & 0x3333); res = (res + (res >> 4)) & 0x0F0F; return (res + (res >> 8)) & 0x00FF; } EXPORT_SYMBOL(__sw_hweight16); unsigned int __sw_hweight8(unsigned int w) { unsigned int res = w - ((w >> 1) & 0x55); res = (res & 0x33) + ((res >> 2) & 0x33); return (res + (res >> 4)) & 0x0F; } EXPORT_SYMBOL(__sw_hweight8); unsigned long __sw_hweight64(__u64 w) { #if BITS_PER_LONG == 32 return __sw_hweight32((unsigned int)(w >> 32)) + __sw_hweight32((unsigned int)w); #elif BITS_PER_LONG == 64 #ifdef ARCH_HAS_FAST_MULTIPLIER w -= (w >> 1) & 0x5555555555555555ul; w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; return (w * 0x0101010101010101ul) >> 56; #else __u64 res = w - ((w >> 1) & 0x5555555555555555ul); res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul); res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful; res = res + (res >> 8); res = res + (res >> 16); return (res + (res >> 32)) & 0x00000000000000FFul; #endif #endif } EXPORT_SYMBOL(__sw_hweight64);
/* * LinuxPlatformPlugin.h - declaration of LinuxPlatformPlugin class * * Copyright (c) 2017-2022 Tobias Junghans <tobydox@veyon.io> * * This file is part of Veyon - https://veyon.io * * 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 (see COPYING); if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #pragma once #include "ConfigurationPagePluginInterface.h" #include "PluginInterface.h" #include "PlatformPluginInterface.h" #include "LinuxCoreFunctions.h" #include "LinuxFilesystemFunctions.h" #include "LinuxInputDeviceFunctions.h" #include "LinuxNetworkFunctions.h" #include "LinuxServiceFunctions.h" #include "LinuxSessionFunctions.h" #include "LinuxUserFunctions.h" class LinuxPlatformPlugin : public QObject, PlatformPluginInterface, PluginInterface, ConfigurationPagePluginInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "io.veyon.Veyon.Plugins.LinuxPlatform") Q_INTERFACES(PluginInterface PlatformPluginInterface ConfigurationPagePluginInterface) public: explicit LinuxPlatformPlugin( QObject* parent = nullptr ); ~LinuxPlatformPlugin() override; Plugin::Uid uid() const override { return Plugin::Uid{ QStringLiteral("63928a8a-4c51-4bfd-888e-9e13c6f3907a") }; } QVersionNumber version() const override { return QVersionNumber( 1, 1 ); } QString name() const override { return QStringLiteral( "LinuxPlatformPlugin" ); } QString description() const override { return tr( "Plugin implementing abstract functions for the Linux platform" ); } QString vendor() const override { return QStringLiteral( "Veyon Community" ); } QString copyright() const override { return QStringLiteral( "Tobias Junghans" ); } Plugin::Flags flags() const override { return Plugin::ProvidesDefaultImplementation; } PlatformCoreFunctions& coreFunctions() override { return m_linuxCoreFunctions; } PlatformFilesystemFunctions& filesystemFunctions() override { return m_linuxFilesystemFunctions; } PlatformInputDeviceFunctions& inputDeviceFunctions() override { return m_linuxInputDeviceFunctions; } PlatformNetworkFunctions& networkFunctions() override { return m_linuxNetworkFunctions; } PlatformServiceFunctions& serviceFunctions() override { return m_linuxServiceFunctions; } PlatformSessionFunctions& sessionFunctions() override { return m_linuxSessionFunctions; } PlatformUserFunctions& userFunctions() override { return m_linuxUserFunctions; } ConfigurationPage* createConfigurationPage() override; private: LinuxCoreFunctions m_linuxCoreFunctions{}; LinuxFilesystemFunctions m_linuxFilesystemFunctions{}; LinuxInputDeviceFunctions m_linuxInputDeviceFunctions{}; LinuxNetworkFunctions m_linuxNetworkFunctions{}; LinuxServiceFunctions m_linuxServiceFunctions{}; LinuxSessionFunctions m_linuxSessionFunctions{}; LinuxUserFunctions m_linuxUserFunctions{}; };
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2015 Simon Stuerz <simon.stuerz@guh.guru> * * * * This file is part of guh. * * * * Guh is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, version 2 of the License. * * * * Guh 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 guh. If not, see <http://www.gnu.org/licenses/>. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef LOGGINGCATEGORYS_H #define LOGGINGCATEGORYS_H #include <QLoggingCategory> // Core / libguh Q_DECLARE_LOGGING_CATEGORY(dcApplication) Q_DECLARE_LOGGING_CATEGORY(dcDeviceManager) Q_DECLARE_LOGGING_CATEGORY(dcRuleEngine) Q_DECLARE_LOGGING_CATEGORY(dcHardware) Q_DECLARE_LOGGING_CATEGORY(dcConnection) Q_DECLARE_LOGGING_CATEGORY(dcLogEngine) Q_DECLARE_LOGGING_CATEGORY(dcTcpServer) Q_DECLARE_LOGGING_CATEGORY(dcWebServer) Q_DECLARE_LOGGING_CATEGORY(dcWebSocketServer) Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc) Q_DECLARE_LOGGING_CATEGORY(dcRest) Q_DECLARE_LOGGING_CATEGORY(dcOAuth2) #endif // LOGGINGCATEGORYS_H
// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <map> #include <memory> #include <string> #include <vector> #include "Common/CommonTypes.h" #include "DiscIO/Volume.h" // --- this volume type is used for GC disc images --- namespace DiscIO { enum class BlobType; enum class Country; enum class Language; enum class Region; enum class Platform; class CVolumeGC : public IVolume { public: CVolumeGC(std::unique_ptr<IBlobReader> reader); ~CVolumeGC(); bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override; std::string GetGameID() const override; std::string GetMakerID() const override; u16 GetRevision() const override; std::string GetInternalName() const override; std::map<Language, std::string> GetShortNames() const override; std::map<Language, std::string> GetLongNames() const override; std::map<Language, std::string> GetShortMakers() const override; std::map<Language, std::string> GetLongMakers() const override; std::map<Language, std::string> GetDescriptions() const override; std::vector<u32> GetBanner(int* width, int* height) const override; u64 GetFSTSize() const override; std::string GetApploaderDate() const override; u8 GetDiscNumber() const override; Platform GetVolumeType() const override; Region GetRegion() const override; Country GetCountry() const override; BlobType GetBlobType() const override; u64 GetSize() const override; u64 GetRawSize() const override; private: static const int GC_BANNER_WIDTH = 96; static const int GC_BANNER_HEIGHT = 32; struct GCBannerInformation { char short_name[32]; // Short game title shown in IPL menu char short_maker[32]; // Short developer, publisher names shown in IPL menu char long_name[64]; // Long game title shown in IPL game start screen char long_maker[64]; // Long developer, publisher names shown in IPL game // start screen char description[128]; // Game description shown in IPL game start screen in // two lines. }; struct GCBanner { u32 id; // "BNR1" for NTSC, "BNR2" for PAL u32 padding[7]; u16 image[GC_BANNER_WIDTH * GC_BANNER_HEIGHT]; // RGB5A3 96x32 image GCBannerInformation information[6]; // information comes in six languages // (only one for BNR1 type) }; void LoadBannerFile() const; void ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const; static const size_t BNR1_SIZE = sizeof(GCBanner) - sizeof(GCBannerInformation) * 5; static const size_t BNR2_SIZE = sizeof(GCBanner); mutable std::map<Language, std::string> m_short_names; mutable std::map<Language, std::string> m_long_names; mutable std::map<Language, std::string> m_short_makers; mutable std::map<Language, std::string> m_long_makers; mutable std::map<Language, std::string> m_descriptions; mutable bool m_banner_loaded = false; mutable std::vector<u32> m_image_buffer; mutable int m_image_height = 0; mutable int m_image_width = 0; std::unique_ptr<IBlobReader> m_pReader; }; } // namespace
#include "AgentMessenger.h" #include "AgentTransport.h" #include "AgentRequest.h" #include "Logger.h" #include <string.h> // Extern data structure from AgentTransport files. extern AgentRequestQueue_t *rxQueue, *txQueue; // Global agent logger extern Logger* logger; /** * Return the next message in the receive queue */ MAGIMessage_t* next(int block) { AgentRequest_t* req; if (block) { //replace spin by notify while ((req = dequeue(rxQueue)) == NULL) { //block } } else { req = dequeue(rxQueue); } if (req == NULL) return NULL; MAGIMessage_t* magiMsg = NULL; if (req->reqType == MESSAGE) { log_info(logger, "Agent Request with MAGI message received"); magiMsg = decodeMagiMessage(req->data); } else { log_info(logger, "Agent Request with Non-MAGI message received"); } freeAgentRequest(req); return magiMsg; } /** * Send out a message */ void sendMsg(MAGIMessage_t* magiMsg, char* arg, ...) { entrylog(logger, __func__, __FILE__, __LINE__); //Encoded magi message length uint32_t encodedMsgLength = 0; /*MAGI header and data is encoded*/ char* encodedMsg = encodeMagiMessage(magiMsg, &encodedMsgLength); log_debug(logger, "Encoded Magi Message Length: %d", encodedMsgLength); AgentRequest_t* req = createAgentRequest(MESSAGE, encodedMsg, encodedMsgLength); free(encodedMsg); if (arg != NULL) { va_list kw; va_start(kw, arg); char* args = arg; char* key, *value, *tok; char* str; do { str = (char*) malloc(strlen(args)); strncpy(str, args, strlen(args)); tok = strtok(str, "="); key = (char*) malloc(strlen(tok)); strncpy(key, tok, strlen(tok)); if (key == NULL) { log_error(logger, "Invalid option"); free(key); continue; } tok = strtok(NULL, "="); value = (char*) malloc(strlen(tok)); strncpy(value, tok, strlen(tok)); if (value == NULL) { log_error(logger, "Invalid option"); free(key); free(value); continue; } add_options(&req->options, key, strlen(value), value); free(str); free(key); } while ((args = va_arg(kw, char*)) != NULL); va_end(kw); } sendOut(req); exitlog(logger, __func__, __FILE__, __LINE__); } /** * Create a trigger and send it as a MAGI Message * * @param group if not null, group is added to the list of destination groups * @param dock if not null, dock is add to the list of destination docks * @param contenttype the contenttype for the data as specified in the Messenger interface * @param data encoded data for the message or null for none. */ void trigger(char* groups, char* docks, contentType_t contenttype, char* data) { entrylog(logger, __func__, __FILE__, __LINE__); log_info(logger, "Sending out trigger: %s", data); MAGIMessage_t* msg = createMagiMessage(NULL, NULL, groups, docks, contenttype, data); sendMsg(msg, NULL); exitlog(logger, __func__, __FILE__, __LINE__); } /** * Would like to see messages for group */ void joinGroup(char* group) { entrylog(logger, __func__, __FILE__, __LINE__); AgentRequest_t* req = createAgentRequest(JOIN_GROUP, group, (uint32_t) strlen(group)); sendOut(req); exitlog(logger, __func__, __FILE__, __LINE__); } /** * No longer care about messages for group */ void leaveGroup(char* group) { entrylog(logger, __func__, __FILE__, __LINE__); AgentRequest_t* req = createAgentRequest(LEAVE_GROUP, group, (uint32_t) strlen(group)); sendOut(req); exitlog(logger, __func__, __FILE__, __LINE__); } /** * Start listening for messages destined for 'dock' */ void listenDock(char* dock) { entrylog(logger, __func__, __FILE__, __LINE__); AgentRequest_t* req = createAgentRequest(LISTEN_DOCK, dock, (uint32_t) strlen(dock)); exitlog(logger, __func__, __FILE__, __LINE__); sendOut(req); } /** * Stop listening for messages destined for 'dock' */ void unlistenDock(char* dock) { entrylog(logger, __func__, __FILE__, __LINE__); AgentRequest_t* req = createAgentRequest(UNLISTEN_DOCK, dock, (uint32_t) strlen(dock)); sendOut(req); exitlog(logger, __func__, __FILE__, __LINE__); }
/***************************************************************** * libircservice is (C) CopyRight PTlink IRC Software 1999-2004 * * http://software.pt-link.net * * This program is distributed under GNU Public License * * Please read the file COPYING for copyright information. * ***************************************************************** Description: sample service that will join every channel when its created and leave it when it gets empty * $Id: changuard.c,v 1.2 2005/09/08 18:09:55 jpinto Exp $ */ #include "setup.h" #include "ircservice.h" #define SERVICENAME "ChanGuard" /* internal functions declaration */ void ev_chan_join(IRC_Chan* chan, IRC_ChanNode* cn); void ev_chan_part(IRC_Chan* chan, IRC_ChanNode* cn); IRC_User* changuard_user; /* info user */ /* this is called after join */ void ev_chan_join(IRC_Chan* chan, IRC_ChanNode* cn) { int remote_users = chan->users_count - chan->lusers_count; if(remote_users == 1 ) /* first user joining the channel */ { irc_ChanJoin(changuard_user, chan->name, CU_MODE_OP); } } /* this is called before the part */ void ev_chan_part(IRC_Chan* chan, IRC_ChanNode* cn) { int remote_users = chan->users_count - chan->lusers_count; /* we must count 1 for our user */ if(remote_users == 1) irc_ChanPart(changuard_user, chan); } /* main program */ int main(void) { int cr; /* set server service info */ irc_Init(IRCDTYPE, SERVERNAME, "Sample IRC Service", stderr); /* Create the service user */ changuard_user = irc_CreateLocalUser(SERVICENAME,"Services","PTlink.net","PTlink.net", "Sample IRC Service","+r"); /* Add user events */ irc_AddEvent(ET_CHAN_JOIN, ev_chan_join); irc_AddEvent(ET_CHAN_PART, ev_chan_part); printf("Connecting to "CONNECTO"\n"); cr = irc_FullConnect(CONNECTO,6667, CONNECTPASS, 0); if(cr<0) { printf("Error connecting to irc server: %s\n", irc_GetLastMsg()); return 1; } else printf("--- Connected ----\n"); /* Loop while connected */ irc_LoopWhileConnected(); printf("Connection terminated: %s\n", irc_GetLastMsg()); return 0; }
@interface MyJsonTogglerFeature : FeatureToggler -(id)initWithFeatureToggles:(NSArray *)featureToggles; @end
/* * This file is part of the coreboot project. * * Copyright (C) 2013 Google Inc. * Copyright (C) 2015 Intel Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _SOC_RAMSTAGE_H_ #define _SOC_RAMSTAGE_H_ #include <chip.h> #include <device/device.h> #include <fsp/ramstage.h> #define V_PCH_LPC_RID_A0 0x00 // A0 Stepping #define V_PCH_LPC_RID_A1 0x04 // A1 Stepping #define V_PCH_LPC_RID_A2 0x08 // A2 Stepping #define V_PCH_LPC_RID_A3 0x0C // A3 Stepping #define V_PCH_LPC_RID_A4 0x80 // A4 Stepping #define V_PCH_LPC_RID_A5 0x84 // A5 Stepping #define V_PCH_LPC_RID_A6 0x88 // A6 Stepping #define V_PCH_LPC_RID_A7 0x8C // A7 Stepping #define V_PCH_LPC_RID_B0 0x10 // B0 Stepping #define V_PCH_LPC_RID_B1 0x14 // B1 Stepping #define V_PCH_LPC_RID_B2 0x18 // B2 Stepping #define V_PCH_LPC_RID_B3 0x1C // B3 Stepping #define V_PCH_LPC_RID_B4 0x90 // B4 Stepping #define V_PCH_LPC_RID_B5 0x94 // B5 Stepping #define V_PCH_LPC_RID_B6 0x98 // B6 Stepping #define V_PCH_LPC_RID_B7 0x9C // B7 Stepping #define V_PCH_LPC_RID_C0 0x20 // C0 Stepping #define V_PCH_LPC_RID_C1 0x24 // C1 Stepping #define V_PCH_LPC_RID_C2 0x28 // C2 Stepping #define V_PCH_LPC_RID_C3 0x2C // C3 Stepping #define V_PCH_LPC_RID_C4 0xA0 // C4 Stepping #define V_PCH_LPC_RID_C5 0xA4 // C5 Stepping #define V_PCH_LPC_RID_C6 0xA8 // C6 Stepping #define V_PCH_LPC_RID_C7 0xAC // C7 Stepping #define V_PCH_LPC_RID_D0 0x30 // D0 Stepping #define V_PCH_LPC_RID_D1 0x34 // D1 Stepping #define V_PCH_LPC_RID_D2 0x38 // D2 Stepping #define V_PCH_LPC_RID_D3 0x3C // D3 Stepping #define V_PCH_LPC_RID_D4 0xB0 // D4 Stepping #define V_PCH_LPC_RID_D5 0xB4 // D5 Stepping #define V_PCH_LPC_RID_D6 0xB8 // D6 Stepping #define V_PCH_LPC_RID_D7 0xBC // D7 Stepping #define B_PCH_LPC_RID_STEPPING_MASK 0xFC // SoC Stepping Mask (Ignoring Package Type) enum { SocA0 = 0, SocA1 = 1, SocA2 = 2, SocA3 = 3, SocA4 = 4, SocA5 = 5, SocA6 = 6, SocA7 = 7, SocB0 = 8, SocB1 = 9, SocB2 = 10, SocB3 = 11, SocB4 = 12, SocB5 = 13, SocB6 = 14, SocB7 = 15, SocC0 = 16, SocC1 = 17, SocC2 = 18, SocC3 = 19, SocC4 = 20, SocC5 = 21, SocC6 = 22, SocC7 = 23, SocD0 = 24, SocD1 = 25, SocD2 = 26, SocD3 = 27, SocD4 = 28, SocD5 = 29, SocD6 = 30, SocD7 = 31, SocSteppingMax }; /* * The soc_init_pre_device() function is called prior to device * initialization, but it's after console and cbmem has been reinitialized. */ void soc_init_pre_device(struct soc_intel_braswell_config *config); void soc_init_cpus(device_t dev); void set_max_freq(void); void southcluster_enable_dev(device_t dev); void scc_enable_acpi_mode(device_t dev, int iosf_reg, int nvs_index); int SocStepping(void); void board_silicon_USB2_override(SILICON_INIT_UPD *params); extern struct pci_operations soc_pci_ops; #endif /* _SOC_RAMSTAGE_H_ */
/*! * Copyright (C) 2005-2012 Gekko Emulator * * @file gc_controller.h * @author ShizZy <shizzy247@gmail.com> * @date 2012-03-03 * @brief GC controller state for use with input plugins * * @section LICENSE * 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 at * http://www.gnu.org/copyleft/gpl.html * * Official project repository can be found at: * http://code.google.com/p/gekko-gc-emu/ */ #ifndef INPUT_COMMON_GC_CONTROLLER_ #define INPUT_COMMON_GC_CONTROLLER_ #include "common.h" #include "config.h" //TODO: Add documentation (shonumi) /// Macro for checking if a button is pressed #define IS_GCBUTTON_PRESSED(val) (val == input_common::GCController::PRESSED) namespace input_common { class GCController { public: /// Used for contoller button state enum GCButtonState { GC_CONTROLLER_NULL = 0, ///< Undefined state RELEASED, ///< Controller button is pressed PRESSED ///< COntroller button is released }; /// Used to determine the type of input being used. enum InputType { NULL_INPUT = 0, KEYBOARD_INPUT, SDLJOYPAD_INPUT }; GCController() { for (unsigned int i = 0; i < common::Config::NUM_CONTROLS; ++i) status_[i] = RELEASED; } ~GCController() { } GCButtonState control_status(common::Config::Control control) { return status_[control]; } void set_control_status(common::Config::Control control, GCButtonState val) { status_[control] = val; } InputType get_input_type() { return current_input_type; } void set_input_type(InputType i_type) { current_input_type = i_type; } bool get_rumble_status() { return rumble_status; } void set_rumble_status(bool r_stat) { rumble_status = r_stat; } /// Axis positions for SI - Between 0x20 and 0xE0 u8 ANALOG_X; u8 ANALOG_Y; u8 C_X; u8 C_Y; private: GCButtonState status_[common::Config::NUM_CONTROLS]; InputType current_input_type; bool rumble_status; DISALLOW_COPY_AND_ASSIGN(GCController); }; } // namespace #endif // INPUT_COMMON_GC_CONTROLLER_
/********************************************************************\ * dialog-new-user.c -- new user dialog for GnuCash * * Copyright (C) 2001 Dave Peticolas <dave@krondo.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, contact: * * * * Free Software Foundation Voice: +1-617-542-5942 * * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * Boston, MA 02110-1301, USA gnu@gnu.org * \********************************************************************/ #include "config.h" #include <gtk/gtk.h> #include <glib/gi18n.h> #include "dialog-new-user.h" #include "dialog-utils.h" #include "dialog-file-access.h" #include "assistant-hierarchy.h" #include "gnc-engine.h" #include "gnc-gconf-utils.h" #include "gnc-hooks.h" #include "gnc-ui.h" #include "gnc-file.h" #include "gnc-main-window.h" #include "gnc-plugin-page-account-tree.h" #include "gnc-session.h" #define GCONF_SECTION "dialogs/new_user" #define FIRST_STARTUP "first_startup" /* This static indicates the debugging module that this .o belongs to. */ static QofLogModule log_module = GNC_MOD_GUI; /* function to open a qif import assistant */ static void (*qifImportAssistantFcn)(void) = NULL; static void gnc_ui_new_user_cancel_dialog (void); void gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void)) { g_return_if_fail (qifImportAssistantFcn == NULL); qifImportAssistantFcn = cb_fcn; } void gnc_set_first_startup (gboolean first_startup) { gnc_gconf_set_bool(GCONF_SECTION, FIRST_STARTUP, first_startup, NULL); } static void after_hierarchy_assistant(void) { GncPluginPage *page; gncp_new_user_finish (); gnc_set_first_startup (FALSE); page = gnc_plugin_page_account_tree_new(); gnc_main_window_open_page(NULL, page); gnc_ui_file_access_for_save_as(); } void gnc_ui_new_user_dialog (void) { GtkWidget *dialog; GtkWidget *new_accounts_button; GtkWidget *import_qif_button; GtkWidget *tutorial_button; GtkBuilder *builder; gint result; ENTER(" "); builder = gtk_builder_new(); gnc_builder_add_from_file (builder, "dialog-new-user.glade", "New User Dialog"); dialog = GTK_WIDGET(gtk_builder_get_object (builder, "New User Dialog")); new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button")); import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button")); tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button")); /* Set the sensitivity of the qif-import button based on the availability * of the qif-import assistant. */ gtk_widget_set_sensitive (import_qif_button, (qifImportAssistantFcn != NULL)); result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: gnc_ui_new_user_cancel_dialog (); break; case GTK_RESPONSE_OK: if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_accounts_button))) { gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant); } else if ((qifImportAssistantFcn != NULL) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button))) { qifImportAssistantFcn(); gncp_new_user_finish (); } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button))) { gnc_gnome_help (HF_GUIDE, NULL); gncp_new_user_finish (); } break; default: g_print ("DEBUG: Response: %d", result); g_assert_not_reached (); break; } g_object_unref(G_OBJECT(builder)); gtk_widget_destroy (dialog); LEAVE(" "); } static void gnc_ui_new_user_cancel_dialog (void) { GtkWidget *dialog; GtkBuilder *builder; gint result; gboolean keepshowing; builder = gtk_builder_new(); gnc_builder_add_from_file (builder, "dialog-new-user.glade", "New User Cancel Dialog"); dialog = GTK_WIDGET(gtk_builder_get_object (builder, "New User Cancel Dialog")); result = gtk_dialog_run (GTK_DIALOG (dialog)); keepshowing = (result == GTK_RESPONSE_YES); gnc_set_first_startup (keepshowing); gncp_new_user_finish (); g_object_unref(G_OBJECT(builder)); gtk_widget_destroy(dialog); } void gncp_new_user_finish (void) { gnc_hook_run(HOOK_BOOK_OPENED, gnc_get_current_session()); }
/* * This file is part of the coreboot project. * * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdint.h> #include <device/pci_def.h> #include <arch/io.h> #include <device/pnp_def.h> #include <arch/romcc_io.h> #include <arch/hlt.h> #include <stdlib.h> #include <console/console.h> #include "superio/smsc/lpc47b272/lpc47b272_early_serial.c" #include "northbridge/intel/i82810/raminit.h" #include "cpu/x86/bist.h" #include "southbridge/intel/i82801ax/i82801ax_early_smbus.c" #include "lib/debug.c" #include "pc80/udelay_io.c" #include "lib/delay.c" #include "northbridge/intel/i82810/raminit.c" #include "northbridge/intel/i82810/debug.c" #include <lib.h> #define SERIAL_DEV PNP_DEV(0x2e, LPC47B272_SP1) void main(unsigned long bist) { lpc47b272_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); uart_init(); console_init(); enable_smbus(); report_bist_failure(bist); dump_spd_registers(); sdram_set_registers(); sdram_set_spd_registers(); sdram_enable(); }
// part of SDL2lazy // author: Ulrike Hager /*! \file SlTextureManager.h \brief SlTextureManager class creates and stores textures. */ #ifndef SLTEXTUREMANAGER_H #define SLTEXTUREMANAGER_H #include <memory> #include <string> #include <vector> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_ttf.h> class SlManager; class SlSprite; class SlTexture; class SlValueParser; class SlFont; class SlTextureManager { public: /*! Initializes SDL, creates window with name and width, height */ SlTextureManager(SlManager* manager); ~SlTextureManager(); /*! Delete copy constructor. The manager owns the window, don't want copies of that. */ SlTextureManager(const SlTextureManager&) = delete; /*! Deleted, same reason as copy constructor. */ SlTextureManager& operator=(const SlTextureManager&) = delete; /*! Load texture from image filename */ SlTexture* createTextureFromFile(const std::string& name, const std::string& filename); /*! Creates SlTexture using a rectangle of dimension width x height filled with the specified colour. \n Creates SlSprite of same name that holds the whole texture. */ SlTexture* createTextureFromRectangle(const std::string& name, int width, int height, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 0xFF); /*! Create a new texture by rendering a sprite on this texture. \n Creates SlSprite of same name that holds the whole texture. */ SlTexture* createTextureFromSpriteOnTexture(const std::string& name, const std::string& backgroundTexture, const std::string& foregroundSprite); /*! Create a new texture from the message using the specified font. The text will be wrapped to fit the width. */ SlTexture* createTextureFromText(const std::string& name, const std::string& fontname, const std::string& message, int width); /*! Creates a new texture with dimensions w x h and fills it with tiles of SlSprite tile. \n Creates SlSprite of same name that holds the whole texture. The SlRenderSettings::destinationRect at position 0 in the SlSprite::destinations_ is used to determine the width of the tile. If the SlSprite::destinations_ is empty, addDefaultDestination() is called which sets the destinationRect to equal the sourceRect. */ SlTexture* createTextureFromTile(const std::string& name, const std::string& sprite, int width, int height); /*! Delete the specified texture and remove from #textures_ . \n Also deletes the SlSprite of same name that was created automatically with the texture. */ void deleteTexture(const std::string& name); /*! Returns pointer to the named font. \retval nullptr if not found */ std::shared_ptr<SlFont> findFont(const std::string& name); /*! Returns pointer to the named texture. \retval nullptr if not found */ SlTexture* findTexture(const std::string& name); /*! Read font file, size, colour from file */ std::shared_ptr<SlFont> parseFont(std::ifstream& input); /*! Read texture configurations from file */ SlTexture* parseTexture(std::ifstream& input); /*! Helper object to translate file input into values. */ SlValueParser* valParser = nullptr; protected: /*!Default constructor. */ SlTextureManager(void); /*! Adds toAdd to #textures_ and creates SlSprite of same name. */ void addTexture(SlTexture* toAdd); /*! Deletes all textures and sprites, empties render queue. */ void clear(); private: /*! Holds all SlTextures that were created using SlTextureManager methods. Texture will be deleted when the SlTextureManager instance is deleted. */ std::vector<SlTexture*> textures_; /*! Pointer to the running SlManager that created this TextureManager. */ SlManager* mngr_ = nullptr; /*! Font used for rendering. This is kept open until program exits to reduce overhead from opening and closing font file. */ std::vector<std::shared_ptr<SlFont>> fonts_ ; }; #endif // SLTEXTUREMANAGER_H
/* * Sprite Pack V2.0 * * Spectrum and Timex Computers Game Engine * Visit http://justme895.tripod.com/main.htm * * Alvin Albrecht 01.2003 */ #define _SPLIB #include "spritepack.h" void sp_PrintAtInv(uchar row, uchar col, uchar colour, uchar graphic) { #asm LIB SPPrintAtInv ld hl,2 add hl,sp ld e,(hl) inc hl inc hl ld d,(hl) inc hl inc hl ld c,(hl) inc hl inc hl ld a,(hl) call SPPrintAtInv #endasm } /* enter: A = row position (0..23) C = col position (0..31) or (0..63 for sprites-hires) D = pallette # E = graphic # */
/* @(#) $Id: ./src/os_maild/maild.h, 2011/09/08 dcid Exp $ */ /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * * This program is a 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 FSF - Free Software * Foundation. * * License details at the LICENSE file included with OSSEC or * online at: http://www.ossec.net/en/licensing.html */ #ifndef _MAILD_H #define _MAILD_H #define MAIL_LIST_SIZE 96 /* Max number of emails to be saved */ #define MAXCHILDPROCESS 6 /* Maximum simultaneos childs */ /* Each timeout is x * 5 */ #define NEXTMAIL_TIMEOUT 2 /* Time to check for next msg - 5 */ #define DEFAULT_TIMEOUT 18 /* socket read timeout - 18 (*5)*/ #define SUBJECT_SIZE 128 /* Maximum subject size */ /* Maximum body size */ #define BODY_SIZE OS_MAXSTR + OS_SIZE_1024 #define SMS_SUBJECT "OSSEC %d - %d - %s" #define MAIL_SUBJECT "OSSEC Notification - %s - Alert level %d" #define MAIL_SUBJECT_FULL "OSSEC Alert - %s - Level %d - %s" /* Full subject without ossec in the name */ #ifdef CLEANFULL #define MAIL_SUBJECT_FULL2 "%d - %s - %s" #endif #define MAIL_BODY "\r\nOSSEC HIDS Notification.\r\n" \ "%s\r\n\r\n" \ "Received From: %s\r\n" \ "Rule: %d fired (level %d) -> \"%s\"\r\n" \ "Portion of the log(s):\r\n\r\n%s\r\n" \ "\r\n\r\n --END OF NOTIFICATION\r\n\r\n\r\n" /* Mail msg structure */ typedef struct _MailMsg { char *subject; char *body; }MailMsg; #include "shared.h" #include "config/mail-config.h" /* Config function */ int MailConf(int test_config, char *cfgfile, MailConfig *Mail); /* Receive the e-mail message */ MailMsg *OS_RecvMailQ(file_queue *fileq, struct tm *p, MailConfig *mail, MailMsg **msg_sms); /* Sends an email */ int OS_Sendmail(MailConfig *mail, struct tm *p); int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg); int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, FILE *fp, struct tm *p); /* Mail timeout used by the file-queue */ int mail_timeout; /* Global var for highest level on mail subjects */ int _g_subject_level; char _g_subject[SUBJECT_SIZE +2]; #endif
// Copyright (c) 2010 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 WEBKIT_GLUE_DOM_OPERATIONS_H__ #define WEBKIT_GLUE_DOM_OPERATIONS_H__ #include <string> #include <vector> #include "googleurl/src/gurl.h" namespace WebKit { class WebDocument; class WebElement; class WebString; class WebView; } namespace webkit_glue { struct SavableResourcesResult { std::vector<GURL>* resources_list; std::vector<GURL>* referrers_list; std::vector<GURL>* frames_list; SavableResourcesResult(std::vector<GURL>* resources_list, std::vector<GURL>* referrers_list, std::vector<GURL>* frames_list) : resources_list(resources_list), referrers_list(referrers_list), frames_list(frames_list) { } private: DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); }; bool GetAllSavableResourceLinksForCurrentPage(WebKit::WebView* view, const GURL& page_url, SavableResourcesResult* savable_resources_result, const char** savable_schemes); bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view, const std::string& animation_name, double time, const std::string& element_id); bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view, const std::string& property_name, double time, const std::string& element_id); bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view, const std::string& element_id); int NumberOfActiveAnimations(WebKit::WebView* view); WebKit::WebString GetSubResourceLinkFromElement( const WebKit::WebElement& element); void GetMetaElementsWithAttribute( WebKit::WebDocument* document, const string16& attribute_name, const string16& atribute_value, std::vector<WebKit::WebElement>* meta_elements); } #endif
#ifndef _SORT_API_H_ #define _SORT_API_H_ #include <stdio.h> #include <stdlib.h> /* atoi */ #include <stdbool.h> /* bool, true, false */ #include <ctype.h> /* isspace */ #include <string.h> /* memset */ #include <assert.h> /* assert */ #include <limits.h> /* INT_MAX */ /* Wrapper to collectively try different sorts */ #ifndef SORT_OBJ_TYPE #define SORT_OBJ_TYPE int #endif enum SORT_TYPE { SELECTION_SORT = 0, INSERTION_SORT, SHELL_SORT, MERGE_SORT_RECURSE, MERGE_SORT_ITERATE, MERGE_SORT_RECURSE_INV_CNT, INVALID_SORT, }; static const char *sort_name[] = { "Selection Sort", "Insertion Sort", "Shell Sort", "Merge Sort - recurse", "Merge Sort - iterate", "Merge Sort - recurse + inv_cnt", }; static const char *sort_name_abbrv[] = { "Select", "Insert", "Shell", "Mrg(Rec)", "Mrg(Itr)", "Mrg(R+Inv)", }; static inline bool sort_api(enum SORT_TYPE st, SORT_OBJ_TYPE objs[], unsigned int cnt) { bool ret = true; switch(st) { case SELECTION_SORT: selection_sort(objs, cnt, def_ss_inc_comp); break; case INSERTION_SORT: insertion_sort(objs, cnt, def_is_inc_comp); break; case SHELL_SORT: shell_sort(objs, cnt, def_shell_sort_inc_comp); break; case MERGE_SORT_RECURSE: merge_sort_recurse(objs, cnt, def_ms_inc_comp); break; case MERGE_SORT_ITERATE: merge_sort(objs, cnt, def_ms_inc_comp); break; case MERGE_SORT_RECURSE_INV_CNT: merge_sort_recurse_inversion_cnt(objs, cnt, def_ms_inc_comp); break; default: printf("Error: Invalid sort type %d\n", st); ret = false; } return ret; } /* Given a sorted dynamic array, check if elements are in sorted order * * If total of elements is provided, check if the elements in the dynamic * * array sum up to this value */ static inline bool validate_sort_order(const int *array, int n, unsigned long long total) { int i; bool total_check = true; if(n == 0) return true; /* Nothing to validate */ if(total == 0) total_check = false; total -= array[0]; for(i = 1; i < n; i++) { if(array[i] < array[i-1]) { printf("Error: Sort Invariant not met - "); printf("%d found before %d\n", array[i-1], array[i]); return false; } total -= array[i]; } /* Avoid checking if user wanted to do total checks until now */ if(total_check && total) { printf("Error: SUM(Array) < User_Total (by %llu)\n", total); return false; } return true; } /* Find element which re-occurs the most. If more than one mode * * present, return the first occuring mode */ static inline bool find_mode_in_sorted_array(const int *array, int n, int *mode, int *mode_freq) { int i, gmode, lmode; unsigned gmode_freq, lmode_freq; if(n == 0) return true; /* Nothing to validate */ if(array == NULL) return false; /* Empty array - errro */ /* Make sure the Input array is already sorted */ if(validate_sort_order(array, n, 0) == false) { return false; } gmode = lmode = array[0]; gmode_freq = lmode_freq = 1; for(i = 1; i < n; i++) { if(array[i] == lmode) lmode_freq++; else { if(lmode_freq > gmode_freq) { gmode_freq = lmode_freq; gmode = lmode; } lmode = array[i]; lmode_freq = 1; } } if(mode) *mode = gmode; if(mode_freq) *mode_freq = gmode_freq; return true; } /* Find first or last occurence of particular number in the given * * sorted array (invariant). * * Time Complexity = O(log n) very similar to binary search */ static inline int find_first_or_last_idx(const int *array, int n, int k, bool first) { int low = 0, high = n-1, mid; int idx = -1; if(n == 0 || array == NULL) /* Sanity Checks */ return idx; while(low <= high) { bool go_low; mid = low + (high - low) / 2; if(array[mid] < k) /* Search only in right sub-tree */ go_low = false; else if(array[mid] > k) /* Search only in left sub-tree */ go_low = true; /* Found element. Binary search ends here, we go further */ else { idx = mid; go_low = first; } /* Based on decisions above, adjust low or high */ if(go_low) high = mid - 1; else low = mid + 1; } return idx; } #endif //_SORT_API_H_
// // Created by Paolo Achdjian on 12/1/15. // Copyright (c) 2015 Paolo Achdjian All rights reserved. // #ifndef CC2530SIM_INSTRUCTIONS_H #define CC2530SIM_INSTRUCTIONS_H enum class Instructions { NOP=0, AJMP=1, LJMP=2, RR_A=0x03, INC_A=0x04, INC_ADDR=0x05, INC_AT_Rn=0x06, INC_RN=0x08, JBC=0x10, ACALL=0x11, LCALL=0x12, RRC_A=0x13, DEC_A=0x14, DEC_ADDR=0x15, DEC_AT_Rn=0x16, DEC_RN=0x18, JB=0x20, RET=0x22, RL_A=0x23, ADD_A_DATA=0x24, ADD_A_DIRECT=0x25, ADD_A_AT_RN=0x26, ADD_A_RN=0x28, JNB=0x30, RETI=0x32, RLC_A=0x33, ADDC_A_DATA=0x34, ADDC_A_DIRECT=0x35, ADDC_A_AT_RN=0x36, ADDC_A_RN=0x38, JC=0x40, ORL_AND_DIRECT_A=0x42, ORL_AND_DIRECT_DATA=0x43, ORL_AND_A_DATA=0x44, ORL_AND_A_DIRECT=0x45, ORL_AND_A_AT_R0=0x46, ORL_AND_A_RN=0x48, JNC=0x50, ANL_A_DATA=0x54, JZ=0x60, JNZ=0x70, ORL_C_BIT=0x72, JMP_A_DPTR=0x73, MOV_A_DATA=0x74, MOV_DATA_DIRECT=0x75, MOV_AT_R0_DATA=0x76, MOV_RN_DATA=0x78, SJMP=0x80, ANL_C_BIT=0x82, MOV_A_AT_A_PC=0x83, DIV_AB=0x84, MOV_DIRECT_DIRECT=0x85, MOV_DIRECT_AT_R=0x86, MOV_DIRECT_RN=0x88, MOV_DPTR_DATA=0x90, MOV_BIT_ADDR_C=0x92, MOVC_A_DPTR=0x93, SUBB_A_DATA=0x94, SUBB_A_DIRECT=0x95, SUBB_A_AT_RN=0x96, SUBB_A_RN=0x98, ORL_C_NOT_BIT=0xA0, INC_DPTR=0xA3, MOV_C_BIT_ADDR=0xA2, MUL_AB=0xA4, MOV_AT_R_DIRECT=0xA6, MOV_RN_DIRECT=0xA8, ANL_C_NOT_BIT=0xB0, CPL_BIT_ADDR=0xB2, CPL_C=0xB3, CJNE_A_DATA=0xB4, CJNE_A_DIRECT=0xB5, CJNE_AT_RN_DATA=0xB6, CJNE_RN_DATA=0xB8, PUSH=0xC0, CLR_BIT=0xC2, CLR_C=0xC3, SWAP_A=0xC4, XCH_A_DIRECT=0xC5, XCH_A_AT_RN=0xC6, XCH_A_RN=0xC8, POP=0xD0, SETB_BIT_ADDR=0xD2, SET_C=0xD3, DA=0xD4, DJNZ_RN=0xD8, MOVX_A_AT_DPTR=0xE0, MOVX_A_AT_R=0xE2, CLR_A=0xE4, MOV_A_DIRECT=0xE5, MOV_A_AT_RN=0xE6, MOV_A_RN=0xE8, MOVX_AT_DPTR_A=0xF0, MOVX_AT_R_A=0xF2, CPL_A=0xF4, MOV_DIRECT_A=0xF5, MOV_AT_RN_A=0xF6, MOV_RN_A = 0xF8 }; #endif //CC2530SIM_INSTRUCTIONS_H
/****************************************************************************** * * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. * * Portions of this file are derived from the ipw3945 project, as well * as portions of the ieee80211 subsystem header files. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * Intel Linux Wireless <ilw@linux.intel.com> * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *****************************************************************************/ #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/init.h> #include <net/mac80211.h> #include "iwl-eeprom.h" #include "iwl-dev.h" #include "iwl-core.h" #include "iwl-io.h" #include "iwl-commands.h" #include "iwl-debug.h" #include "iwl-power.h" /* * Setting power level allows the card to go to sleep when not busy. * * We calculate a sleep command based on the required latency, which * we get from mac80211. In order to handle thermal throttling, we can * also use pre-defined power levels. */ /* * This defines the old power levels. They are still used by default * (level 1) and for thermal throttle (levels 3 through 5) */ struct iwl_power_vec_entry { struct iwl_powertable_cmd cmd; u8 no_dtim; /* number of skip dtim */ }; static void iwl_legacy_power_sleep_cam_cmd(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) { memset(cmd, 0, sizeof(*cmd)); if (priv->power_data.pci_pm) cmd->flags |= IWL_POWER_PCI_PM_MSK; IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); } static int iwl_legacy_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) { IWL_DEBUG_POWER(priv, "Sending power/sleep command\n"); IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout)); IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout)); IWL_DEBUG_POWER(priv, "Sleep interval vector = { %d , %d , %d , %d , %d }\n", le32_to_cpu(cmd->sleep_interval[0]), le32_to_cpu(cmd->sleep_interval[1]), le32_to_cpu(cmd->sleep_interval[2]), le32_to_cpu(cmd->sleep_interval[3]), le32_to_cpu(cmd->sleep_interval[4])); return iwl_legacy_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(struct iwl_powertable_cmd), cmd); } int iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, bool force) { int ret; bool update_chains; lockdep_assert_held(&priv->mutex); /* Don't update the RX chain when chain noise calibration is running */ update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) return 0; if (!iwl_legacy_is_ready_rf(priv)) return -EIO; /* scan complete use sleep_power_next, need to be updated */ memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); if (test_bit(STATUS_SCANNING, &priv->status) && !force) { IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); return 0; } if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK) set_bit(STATUS_POWER_PMI, &priv->status); ret = iwl_legacy_set_power(priv, cmd); if (!ret) { if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)) clear_bit(STATUS_POWER_PMI, &priv->status); if (priv->cfg->ops->lib->update_chain_flags && update_chains) priv->cfg->ops->lib->update_chain_flags(priv); else if (priv->cfg->ops->lib->update_chain_flags) IWL_DEBUG_POWER(priv, "Cannot update the power, chain noise " "calibration running: %d\n", priv->chain_noise_data.state); memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); } else IWL_ERR(priv, "set power fail, ret = %d", ret); return ret; } int iwl_legacy_power_update_mode(struct iwl_priv *priv, bool force) { struct iwl_powertable_cmd cmd; iwl_legacy_power_sleep_cam_cmd(priv, &cmd); return iwl_legacy_power_set_mode(priv, &cmd, force); } EXPORT_SYMBOL(iwl_legacy_power_update_mode); /* initialize to default */ void iwl_legacy_power_initialize(struct iwl_priv *priv) { u16 lctl = iwl_legacy_pcie_link_ctl(priv); priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); priv->power_data.debug_sleep_level_override = -1; memset(&priv->power_data.sleep_cmd, 0, sizeof(priv->power_data.sleep_cmd)); } EXPORT_SYMBOL(iwl_legacy_power_initialize);
/* * "STEAL" demo target extension for Xtables * written by Jan Engelhardt, 2008 - 2009 * placed in the Public Domain */ #include <linux/module.h> #include <linux/netfilter.h> #include <linux/skbuff.h> #include "compat_xtables.h" static unsigned int steal_tg(struct sk_buff **pskb, const struct xt_action_param *par) { kfree_skb(*pskb); return NF_STOLEN; } static struct xt_target steal_tg_reg[] __read_mostly = { { .name = "STEAL", .revision = 0, .family = NFPROTO_UNSPEC, .target = steal_tg, .me = THIS_MODULE, }, { .name = "STEAL", .revision = 0, .family = NFPROTO_IPV6, .target = steal_tg, .me = THIS_MODULE, }, { .name = "STEAL", .revision = 0, .family = NFPROTO_ARP, .target = steal_tg, .me = THIS_MODULE, }, { .name = "STEAL", .revision = 0, .family = NFPROTO_BRIDGE, .target = steal_tg, .me = THIS_MODULE, }, }; static int __init steal_tg_init(void) { return xt_register_targets(steal_tg_reg, ARRAY_SIZE(steal_tg_reg)); } static void __exit steal_tg_exit(void) { xt_unregister_targets(steal_tg_reg, ARRAY_SIZE(steal_tg_reg)); } module_init(steal_tg_init); module_exit(steal_tg_exit); MODULE_AUTHOR("Jan Engelhardt "); MODULE_DESCRIPTION("Xtables: Silently DROP packets on output chain"); MODULE_LICENSE("GPL"); MODULE_ALIAS("ipt_STEAL"); MODULE_ALIAS("ip6t_STEAL"); MODULE_ALIAS("arpt_STEAL"); MODULE_ALIAS("ebt_STEAL");
/* Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ardour_plugin_types_h__ #define __ardour_plugin_types_h__ namespace ARDOUR { enum PluginType { AudioUnit, LADSPA, LV2, Windows_VST, LXVST, MacVST, Lua, }; } #endif
/* $Id$ */ /* ** Copyright (C) 2002-2009 Sourcefire, Inc. ** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.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. You may not use, modify or ** distribute this program under any other version of the GNU General ** Public License. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <syslog.h> #include <stdarg.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <wchar.h> #include "debug.h" #include "squirrel.h" #ifdef DEBUG int debuglevel = DEBUG_ALL; char *DebugMessageFile = NULL; int DebugMessageLine = 0; extern Barnyard2Config *barnyard2_conf; int DebugThis(int level) { if (!(level & GetDebugLevel())) return 0; return 1; } int GetDebugLevel(void) { static int debug_init = 0; static unsigned int debug_level = 0; // declared here for compatibility with older compilers // not initialized here cuz the next step is done once const char* key; if (debug_init) return debug_level; key = getenv(DEBUG_VARIABLE); if ( key ) debug_level = strtoul(key, NULL, 0); else debug_level = 0; debug_init = 1; return debug_level; } void DebugMessageFunc(int level, char *fmt, ...) { va_list ap; if (!(level & GetDebugLevel())) return; va_start(ap, fmt); if ((barnyard2_conf != NULL) && BcDaemonMode()) { char buf[STD_BUF]; int buf_len = sizeof(buf); char *buf_ptr = buf; buf[buf_len - 1] = '\0'; /* filename and line number information */ if (DebugMessageFile != NULL) { snprintf(buf, buf_len - 1, "%s:%d: ", DebugMessageFile, DebugMessageLine); buf_ptr += strlen(buf); buf_len -= strlen(buf); } vsnprintf(buf_ptr, buf_len - 1, fmt, ap); syslog(LOG_DAEMON | LOG_DEBUG, "%s", buf); } else { if (DebugMessageFile != NULL) printf("%s:%d: ", DebugMessageFile, DebugMessageLine); vprintf(fmt, ap); } va_end(ap); } #ifdef HAVE_WCHAR_H void DebugWideMessageFunc(int level, wchar_t *fmt, ...) { va_list ap; wchar_t buf[STD_BUF+1]; if (!(level & GetDebugLevel())) { return; } buf[STD_BUF]= (wchar_t)0; /* filename and line number information */ if (DebugMessageFile != NULL) printf("%s:%d: ", DebugMessageFile, DebugMessageLine); va_start(ap, fmt); if(BcDaemonMode()) { #if defined(WIN32) && (defined(__USE_ISOC95) || defined(__USE_UNIX98)) _vsnwprintf(buf, STD_BUF, fmt, ap); #else #if defined(HAVE_VSWPRINTF) && (defined(__USE_ISOC95) || defined(__USE_UNIX98)) vswprintf(buf, STD_BUF, fmt, ap); #endif #endif //syslog(LOG_DAEMON | LOG_DEBUG, "%s", buf); } else { #if defined(HAVE_WPRINTF) && (defined(__USE_ISOC95) || defined(__USE_UNIX98)) vwprintf(fmt, ap); #endif } va_end(ap); } #endif #else void DebugMessageFunc(int level, char *fmt, ...) { } #ifdef HAVE_WCHAR_H void DebugWideMessageFunc(int level, wchar_t *fmt, ...) { } #endif #endif /* DEBUG */
#ifndef _LINUX_HRTIMER_H #define _LINUX_HRTIMER_H #endif
#ifndef _ZV_H_ #define _ZV_H_ #include "types.h" #include "vars.h" void getZvCube(u8* bodyPtr, ZVStruct* zvPtr); void getZvNormal(u8 *bodyPtr, ZVStruct* zvPtr); void getZvMax(u8 *bodyPtr, ZVStruct* zvPtr); void makeDefaultZV(ZVStruct* zvPtr); void getZvMax(u8* bodyPtr, ZVStruct* zvPtr); #endif
// Aseprite // Copyright (C) 2001-2015 David Capello // // 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. #pragma once #include "render/zoom.h" #include "ui/int_entry.h" #include "ui/slider.h" namespace app { class ZoomEntry : public ui::IntEntry , public ui::SliderDelegate { public: ZoomEntry(); void setZoom(const render::Zoom& zoom); base::Signal1<void, const render::Zoom&> ZoomChange; private: // SliderDelegate impl std::string onGetTextFromValue(int value) override; int onGetValueFromText(const std::string& text) override; void onValueChange() override; }; } // namespace app
/* Authorg - a GNOME DVD authoring tool * * Copyright (C) 2005 Jens Georg <mail@jensge.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 Street #330, Boston, MA 02111-1307, USA. */ #include <config.h> #include <glib-object.h> #include <glib.h> #include <glib/gi18n.h> #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include "video-file-mpeg.h" G_DEFINE_TYPE (AuthorgVideoFileMpeg, authorg_video_file_mpeg, AUTHORG_TYPE_VIDEO_FILE); static void authorg_video_file_mpeg_info (AuthorgVideoFile *file) { AVFormatContext *pFormatCtx; av_register_all(); av_open_input_file (&pFormatCtx, file->filename, NULL, 0, NULL); av_find_stream_info (pFormatCtx); file->length = pFormatCtx->duration / AV_TIME_BASE; av_close_input_file (pFormatCtx); /* chain up */ AUTHORG_VIDEO_FILE_CLASS (authorg_video_file_mpeg_parent_class)->info (file); } static void authorg_video_file_mpeg_init (AuthorgVideoFileMpeg *video_file_mpeg) { /* nothing to do */ } static void authorg_video_file_mpeg_finalize (GObject *object) { g_return_if_fail (object != NULL); if (G_OBJECT_CLASS (authorg_video_file_mpeg_parent_class)->finalize) G_OBJECT_CLASS (authorg_video_file_mpeg_parent_class)->finalize (object); } static void authorg_video_file_mpeg_class_init (AuthorgVideoFileMpegClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); AuthorgVideoFileClass *video_file_class = AUTHORG_VIDEO_FILE_CLASS (klass); gobject_class->finalize = authorg_video_file_mpeg_finalize; video_file_class->info = authorg_video_file_mpeg_info; } AuthorgVideoFile * authorg_video_file_mpeg_new (const gchar *filename) { AuthorgVideoFile *file; file = AUTHORG_VIDEO_FILE (g_object_new (AUTHORG_TYPE_VIDEO_FILE_MPEG, NULL)); authorg_video_file_construct (file, filename); return file; }
/* linux/include/asm/arch-s3c2410/regs-clock.h * * Copyright (c) 2003,2004,2005 Simtec Electronics <linux@simtec.co.uk> * http://armlinux.simtec.co.uk/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * S3C2410 clock register definitions * * Changelog: * 18-Aug-2004 Ben Dooks Added 2440 definitions * 08-Aug-2004 Herbert Pötzl Added CLKCON definitions * 19-06-2003 Ben Dooks Created file * 12-03-2004 Ben Dooks Updated include protection * 29-Sep-2004 Ben Dooks Fixed usage for assembly inclusion * 10-Feb-2005 Ben Dooks Fixed CAMDIVN address (Guillaume Gourat) * 10-Mar-2005 Lucas Villa Real Changed S3C2410_VA to S3C24XX_VA * 27-Aug-2005 Ben Dooks Add clock-slow info * 20-Oct-2005 Ben Dooks Fixed overflow in PLL (Guillaume Gourat) * 20-Oct-2005 Ben Dooks Add masks for DCLK (Guillaume Gourat) */ #ifndef __ASM_ARM_REGS_CLOCK #define __ASM_ARM_REGS_CLOCK "$Id: regs-clock.h,v 1.1.1.1 2006/01/06 00:52:01 jsantiago Exp $" #define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR) #define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s))) #define S3C2410_LOCKTIME S3C2410_CLKREG(0x00) #define S3C2410_MPLLCON S3C2410_CLKREG(0x04) #define S3C2410_UPLLCON S3C2410_CLKREG(0x08) #define S3C2410_CLKCON S3C2410_CLKREG(0x0C) #define S3C2410_CLKSLOW S3C2410_CLKREG(0x10) #define S3C2410_CLKDIVN S3C2410_CLKREG(0x14) #define S3C2410_CLKCON_IDLE (1<<2) #define S3C2410_CLKCON_POWER (1<<3) #define S3C2410_CLKCON_NAND (1<<4) #define S3C2410_CLKCON_LCDC (1<<5) #define S3C2410_CLKCON_USBH (1<<6) #define S3C2410_CLKCON_USBD (1<<7) #define S3C2410_CLKCON_PWMT (1<<8) #define S3C2410_CLKCON_SDI (1<<9) #define S3C2410_CLKCON_UART0 (1<<10) #define S3C2410_CLKCON_UART1 (1<<11) #define S3C2410_CLKCON_UART2 (1<<12) #define S3C2410_CLKCON_GPIO (1<<13) #define S3C2410_CLKCON_RTC (1<<14) #define S3C2410_CLKCON_ADC (1<<15) #define S3C2410_CLKCON_IIC (1<<16) #define S3C2410_CLKCON_IIS (1<<17) #define S3C2410_CLKCON_SPI (1<<18) #define S3C2410_PLLCON_MDIVSHIFT 12 #define S3C2410_PLLCON_PDIVSHIFT 4 #define S3C2410_PLLCON_SDIVSHIFT 0 #define S3C2410_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1) #define S3C2410_PLLCON_PDIVMASK ((1<<5)-1) #define S3C2410_PLLCON_SDIVMASK 3 /* DCLKCON register addresses in gpio.h */ #define S3C2410_DCLKCON_DCLK0EN (1<<0) #define S3C2410_DCLKCON_DCLK0_PCLK (0<<1) #define S3C2410_DCLKCON_DCLK0_UCLK (1<<1) #define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4) #define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8) #define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4) #define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8) #define S3C2410_DCLKCON_DCLK1EN (1<<16) #define S3C2410_DCLKCON_DCLK1_PCLK (0<<17) #define S3C2410_DCLKCON_DCLK1_UCLK (1<<17) #define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20) #define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24) #define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20) #define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24) #define S3C2410_CLKDIVN_PDIVN (1<<0) #define S3C2410_CLKDIVN_HDIVN (1<<1) #define S3C2410_CLKSLOW_UCLK_OFF (1<<7) #define S3C2410_CLKSLOW_MPLL_OFF (1<<5) #define S3C2410_CLKSLOW_SLOW (1<<4) #define S3C2410_CLKSLOW_SLOWVAL(x) (x) #define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7) #ifndef __ASSEMBLY__ #include <asm/div64.h> static inline unsigned int s3c2410_get_pll(unsigned int pllval, unsigned int baseclk) { unsigned int mdiv, pdiv, sdiv; uint64_t fvco; mdiv = pllval >> S3C2410_PLLCON_MDIVSHIFT; pdiv = pllval >> S3C2410_PLLCON_PDIVSHIFT; sdiv = pllval >> S3C2410_PLLCON_SDIVSHIFT; mdiv &= S3C2410_PLLCON_MDIVMASK; pdiv &= S3C2410_PLLCON_PDIVMASK; sdiv &= S3C2410_PLLCON_SDIVMASK; fvco = (uint64_t)baseclk * (mdiv + 8); do_div(fvco, (pdiv + 2) << sdiv); return (unsigned int)fvco; } #endif /* __ASSEMBLY__ */ #ifdef CONFIG_CPU_S3C2440 /* extra registers */ #define S3C2440_CAMDIVN S3C2410_CLKREG(0x18) #define S3C2440_CLKCON_CAMERA (1<<19) #define S3C2440_CLKCON_AC97 (1<<20) #define S3C2440_CLKDIVN_PDIVN (1<<0) #define S3C2440_CLKDIVN_HDIVN_MASK (3<<1) #define S3C2440_CLKDIVN_HDIVN_1 (0<<1) #define S3C2440_CLKDIVN_HDIVN_2 (1<<1) #define S3C2440_CLKDIVN_HDIVN_4_8 (2<<1) #define S3C2440_CLKDIVN_HDIVN_3_6 (3<<1) #define S3C2440_CLKDIVN_UCLK (1<<3) #define S3C2440_CAMDIVN_CAMCLK_MASK (0xf<<0) #define S3C2440_CAMDIVN_CAMCLK_SEL (1<<4) #define S3C2440_CAMDIVN_HCLK3_HALF (1<<8) #define S3C2440_CAMDIVN_HCLK4_HALF (1<<9) #define S3C2440_CAMDIVN_DVSEN (1<<12) #endif /* CONFIG_CPU_S3C2440 */ #endif /* __ASM_ARM_REGS_CLOCK */
#ifndef FINDFILE_H #define FINDFILE_H #include <string> #include <vector> extern void buildDirectoryVector(std::vector<std::string> &directoryVector, const std::string &subdir); extern bool findFile(std::string &filename, const std::string &subdir); #endif
/* * Auteur: Botu Sun * * Cet programme permet de rechercher une variable d'environnement dans * le systeme. * * Utilisation de la fonction getenv(3). */ #include <stdio.h> #include <stdlib.h> #include <string.h> // Declare external var. extern char **environ; /* Petite fonction qui se charge d'envoyer les messages d'erreur et qui ensuite "suicide" le processus. */ void erreur_grave(char *msg) { perror(msg); exit(EXIT_FAILURE); } /* Fonction principale (fournie avec erreur(s?)) */ int main(int argc, char **argv) { if (argc != 2) { erreur_grave("This program will accept exact 1 argument!"); } // Methode 1: printf("Methode 1:\n"); int i = 0; char *iter; for (iter = *(environ + i); iter; iter = *(environ + ++i)) { // If the current env var starts with request var. if (strstr(iter, argv[1]) == iter) { // Print out.(omit "REQUEST_VAR=") printf("Environment variable %s=%s\n", argv[1], iter + strlen(argv[1]) + 1); break; } } // If iter ends with NULL, then not find! if (!iter) { printf("Environment variable %s is not found!\n", argv[1]); } // Methode 2: printf("Methode 2:\n"); char* result = getenv(argv[1]); if(!result) { printf("Environment variable %s is not found!\n", argv[1]); } else { printf("Environment variable %s=%s\n", argv[1], result); } exit(0); }
/** vegas_time.h * * Routines to deal with time convsrsions, etc. */ #ifndef _VEGAS_TIME_H #define _VEGAS_TIME_H #include "vegas_defines.h" /** Return current time using PSRFITS-style integer MJD, integer * second time of day, and fractional second offset. */ int get_current_mjd(int *stt_imjd, int *stt_smjd, double *stt_offs); /** Return Y, M, D, h, m, and s for an MJD */ int datetime_from_mjd(long double MJD, int *YYYY, int *MM, int *DD, int *h, int *m, double *s); /** Return the LST (in sec) for the GBT at a specific MJD (UTC) */ int get_current_lst(double mjd, int *lst_secs); #ifdef NEW_GBT /** Return the time in MJD, with microsecond resolution */ int get_current_mjd_double(double *mjd); #endif #endif
/* * tools/rsa_respond/respond.c * A simple RSA authentification challenge response generator for the * ircd-hybrid CHALLENGE command. * This code is Copyright(C)2001 by the past and present ircd-hybrid * developers. * 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. * $Id$ */ #include <stdio.h> #include <string.h> #include <openssl/err.h> #include <openssl/rsa.h> #include <openssl/pem.h> #include <openssl/md5.h> #include <unistd.h> static int insecure_mode = 0; static char *pass_param = NULL; static int pass_cb(char *buf, int size, int rwflag, void *u) { int len; char *tmp; if (insecure_mode != 0) { if (pass_param == NULL) return 0; len = strlen(pass_param); if (len <= 0) /* This SHOULDN'T happen */ return 0; if (len > size) len = size; memcpy(buf, pass_param, len); return len; } tmp = getpass("Enter passphrase for challenge: "); if (!tmp) { puts("Couldn't read passphrase from stdin!"); exit(-1); } len = strlen(tmp); if (len <= 0) return 0; if (len > size) len = size; memcpy(buf, tmp, len); return len; } static void binary_to_hex( unsigned char * bin, char * hex, int length ) { char * trans = "0123456789ABCDEF"; int i; for( i = 0; i < length; i++ ) { hex[i<<1] = trans[bin[i] >> 4]; hex[(i<<1)+1] = trans[bin[i] & 0xf]; } hex[i<<1] = '\0'; } static int hex_to_binary(const char *from, char *to, int len) { char a, b=1; int p=0; const char *ptr = from; while (-1) { a = *ptr++; if (!a) break; b = *ptr++; /* If this happens, we got bad input. */ if (!b) break; if (p >= len) break; if (!((a >= '0' && a <= '9') || (a >= 'A' && a <= 'F'))) break; if (!((b >= '0' && b <= '9') || (b >= 'A' && b <= 'F'))) break; to[p++] = ((a <= '9') ? (a - '0') : (a - 'A' + 0xA))<<4 | ((b <= '9') ? (b - '0') : (b - 'A' + 0xA)); } return p; } int main(int argc, char **argv) { FILE *kfile; RSA *rsa = NULL; char ndata[257], ddata[257]; /* respond privatefile challenge */ if (argc < 3) { puts("Usage: respond privatefile challenge [passphrase]"); return 0; } if (argc == 4) { /* This is TOTALLY insecure and not recommended, but for ** interfacing with irc client scripts, it's either this ** or don't use a passphrase. ** ** The likelihood of a passphrase leaking isn't TOO great, ** only ps auxww will show it, and even then, only at the ** precise moment this is called. */ insecure_mode = 1; pass_param = argv[3]; } if (!(kfile = fopen(argv[1], "r"))) { puts("Could not open the private keyfile."); return 0; } SSLeay_add_all_ciphers(); rsa = PEM_read_RSAPrivateKey(kfile, NULL,pass_cb, NULL); if(!rsa) { puts("Unable to read your private key, is the passphrase wrong?"); return 0; } fclose(kfile); if (hex_to_binary(argv[2], ndata, 128) != 128) { puts("Bad challenge."); return -1; } if (RSA_private_decrypt(128, (unsigned char*)ndata, (unsigned char*)ddata, rsa, RSA_PKCS1_PADDING) == -1) { puts("Decryption error."); return -1; } binary_to_hex((unsigned char*)ddata, ndata, 32); puts(ndata); return 0; }
/**************************************************************************** * mcintegrator.h: A basic abstract integrator for MC sampling * This is part of the yafray package * Copyright (C) 2010 Rodrigo Placencia (DarkTide) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef Y_MCINTEGRATOR_H #define Y_MCINTEGRATOR_H #include <core_api/tiledintegrator.h> #include <yafraycore/photon.h> #include <boost/filesystem.hpp> __BEGIN_YAFRAY enum photonMapProcessing_t { PHOTONS_GENERATE_ONLY, PHOTONS_GENERATE_AND_SAVE, PHOTONS_LOAD, PHOTONS_REUSE }; class YAFRAYCORE_EXPORT mcIntegrator_t: public tiledIntegrator_t { public: mcIntegrator_t() {}; protected: /*! Estimates direct light from all sources in a mc fashion and completing MIS (Multiple Importance Sampling) for a given surface point */ virtual color_t estimateAllDirectLight(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, colorPasses_t &colorPasses) const; /*! Like previous but for only one random light source for a given surface point */ virtual color_t estimateOneDirectLight(renderState_t &state, const surfacePoint_t &sp, vector3d_t wo, int n, colorPasses_t &colorPasses) const; /*! Does the actual light estimation on a specific light for the given surface point */ virtual color_t doLightEstimation(renderState_t &state, light_t *light, const surfacePoint_t &sp, const vector3d_t &wo, const unsigned int &loffs, colorPasses_t &colorPasses) const; /*! Does recursive mc raytracing with MIS (Multiple Importance Sampling) for a given surface point */ virtual void recursiveRaytrace(renderState_t &state, diffRay_t &ray, BSDF_t bsdfs, surfacePoint_t &sp, vector3d_t &wo, color_t &col, float &alpha, colorPasses_t &colorPasses, int additionalDepth) const; /*! Creates and prepares the caustic photon map */ virtual bool createCausticMap(); /*! Estimates caustic photons for a given surface point */ virtual color_t estimateCausticPhotons(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const; /*! Samples ambient occlusion for a given surface point */ virtual color_t sampleAmbientOcclusion(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const; virtual color_t sampleAmbientOcclusionPass(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const; virtual color_t sampleAmbientOcclusionPassClay(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const; virtual void causticWorker(photonMap_t * causticMap, int threadID, const scene_t *scene, unsigned int nCausPhotons, pdf1D_t *lightPowerD, int numLights, const std::string &integratorName, const std::vector<light_t *> &causLights, int causDepth, progressBar_t *pb, int pbStep, unsigned int &totalPhotonsShot); int rDepth; //! Ray depth bool trShad; //! Use transparent shadows int sDepth; //! Shadow depth for transparent shadows bool usePhotonCaustics; //! Use photon caustics unsigned int nCausPhotons; //! Number of caustic photons (to be shoot but it should be the target int nCausSearch; //! Amount of caustic photons to be gathered in estimation float causRadius; //! Caustic search radius for estimation int causDepth; //! Caustic photons max path depth pdf1D_t *lightPowerD; bool useAmbientOcclusion; //! Use ambient occlusion int aoSamples; //! Ambient occlusion samples float aoDist; //! Ambient occlusion distance color_t aoCol; //! Ambient occlusion color photonMapProcessing_t photonMapProcessing = PHOTONS_GENERATE_ONLY; background_t *background; //! Background shader int nPaths; //! Number of samples for mc raytracing int maxBounces; //! Max. path depth for mc raytracing std::vector<light_t*> lights; //! An array containing all the scene lights bool transpBackground; //! Render background as transparent bool transpRefractedBackground; //! Render refractions of background as transparent }; __END_YAFRAY #endif
/* FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** * * * FreeRTOS provides completely free yet professionally developed, * * robust, strictly quality controlled, supported, and cross * * platform software that has become a de facto standard. * * * * Help yourself get started quickly and support the FreeRTOS * * project by purchasing a FreeRTOS tutorial book, reference * * manual, or both from: http://www.FreeRTOS.org/Documentation * * * * Thank you! * * * *************************************************************************** This file is part of the FreeRTOS distribution. FreeRTOS 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 >>!AND MODIFIED BY!<< the FreeRTOS exception. >>! NOTE: The modification to the GPL is included to allow you to distribute >>! a combined work that includes FreeRTOS without being obliged to provide >>! the source code for proprietary components outside of the FreeRTOS >>! kernel. FreeRTOS 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. Full license text is available from the following link: http://www.freertos.org/a00114.html 1 tab == 4 spaces! *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * * not run, what could be wrong?" * * * * http://www.FreeRTOS.org/FAQHelp.html * * * *************************************************************************** http://www.FreeRTOS.org - Documentation, books, training, latest versions, license and Real Time Engineers Ltd. contact details. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, including FreeRTOS+Trace - an indispensable productivity tool, a DOS compatible FAT file system, and our tiny thread aware UDP/IP stack. http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS licenses offer ticketed support, indemnification and middleware. http://www.SafeRTOS.com - High Integrity Systems also provide a safety engineered and independently SIL3 certified version for use in safety and mission critical applications that require provable dependability. 1 tab == 4 spaces! */ /* FreeRTOS includes. */ #include "FreeRTOS.h" /* Hardware includes. */ #include "msp430.h" #include "hal_MSP-EXP430F5438.h" /* This demo uses Timer A1 to generate the time base for gathering run time statistics information. Run time statistics show much processing time has been allocated to each task since the application booted. */ /* The time base for the run time stats is generated by a 16 bit timer. Each time the timer overflows ulStatsOverflowCount is incremented. Therefore, when converting the total run time to a 32 bit number, the most significant two bytes are given by ulStatsOverflowCount and the least significant two bytes are given by the current timer counter value. Care must be taken with data consistency when combining the two in case a timer overflow occurs as the value is being read. */ volatile unsigned long ulStatsOverflowCount = 0; /*-----------------------------------------------------------*/ void vConfigureTimerForRunTimeStats( void ) { /* Ensure the timer is stopped. */ TA1CTL = 0; /* Run the timer from the ACLK/2. */ TA1CTL = TASSEL_1 | ID__2; /* Clear everything to start with. */ TA1CTL |= TACLR; /* Enable the interrupts. */ TA1CCTL0 = CCIE; /* Start up clean. */ TA1CTL |= TACLR; /* Continuous mode. */ TA1CTL |= MC__CONTINOUS; } /*-----------------------------------------------------------*/ #pragma vector=TIMER1_A0_VECTOR static __interrupt void prvRunTimeStatsOverflowISR( void ) { ulStatsOverflowCount++; } /*-----------------------------------------------------------*/
/** ****************************************************************************** * @file main.h * @author MCD Application Team * @version V1.1.0 * @date 09-October-2015 * @brief Header for main.c file ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_hal.h" #include "stm32f4xx_it.h" /* EVAL includes component */ #include "stm32469i_eval.h" #include "stm32469i_eval_lcd.h" #include "stm32469i_eval_ts.h" #include "stm32469i_eval_sdram.h" #include "stm32469i_eval_camera.h" #include "stm32469i_eval_sd.h" #include "stm32469i_eval_audio.h" #include "stm32469i_eval_qspi.h" #include "stm32469i_eval_eeprom.h" #include "stm32469i_eval_nor.h" /* FatFs includes components */ #include "ff_gen_drv.h" #include "usbh_diskio.h" #include "sd_diskio.h" /* GUI includes components */ #include "gui.h" #include "dialog.h" #include "ST_GUI_Addons.h" /* Kernel includes components */ #include "k_module.h" #include "k_storage.h" #include "k_rtc.h" #include "k_bsp.h" /* utilities and standard includes components */ #include "cpu_utils.h" #include <stddef.h> #include <stdlib.h> #include <string.h> #include <math.h> /* Exported types ------------------------------------------------------------*/ /* Exported variables --------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #ifdef INCLUDE_THIRD_PARTY_MODULE #define GFX_DEMO_ADDRESS 0x08100000 #define GFX_DEMO_SIGNATURE_A 0x5AA55AAA #define GFX_DEMO_SIGNATURE_B 0x5AA55BBB #endif /* Exported macros -----------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #ifdef __cplusplus } #endif #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/*---------------------------------------------------------------------------*\ * Copyright (C) 2000 AVM GmbH. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY, without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, and WITHOUT * ANY LIABILITY FOR ANY DAMAGES arising out of or in connection * with the use or performance of this software. See the * GNU General Public License for further details. \*---------------------------------------------------------------------------*/ #ifndef _BASICFAX_H_ #define _BASICFAX_H_ #include "ftif2huf.h" #include "sff2huf.h" #include "huf2ftif.h" #include "huf2sff.h" #include "MultiStr.h" #include "InfoType.h" #include "defaults.h" #include "CCSParam.h" #include <time.h> /*===========================================================================*\ \*===========================================================================*/ class CBasicFaxConversion { public: CBasicFaxConversion (void); virtual ~CBasicFaxConversion (void); void ConnectLog (cp_ncpi_all *pNCPI); void WriteXferLog (const char *cmd, tUInt commid, tUChar *jobtag, tUInt *pJobid, char *devname, CDynamicString *pUser, CDynamicString *pDestination, const char *statustext); tSInfo OpenSend (CMultiString *pSendFileList, tUInt Resolution); void StopSend (void); void CloseSend (void); tSInfo SendSFF (tUByte *buffer, tUInt maxLen, tUInt *pLen); tSInfo OpenRecv (void); void StopRecv (void); void CloseRecv (void); tSInfo RecvSFF (tUByte *buffer, tUInt len); FaxFormatType GetFormat (void); void SetFormat (FaxFormatType faxtype); tUInt GetPageCount (void); void SetPageCount (tUInt pc); tUInt GetBaudRate (void); CMultiString *GetRecvFiles (void); tUInt GetResolution (void); tUInt GetSendState (void); tUInt GetRecvState (void); tBool GetRecvIllegalLines (tUInt *pCountIllegalLines, tUInt *pCountAllLines); void ConnectionInd (void); void ConnectionStarted (void); void SetReceiveID (CDynamicString *pRecvIDStr); CDynamicString *GetReceiveID (void); time_t GetStartTime (void); virtual void PageEndReached (tBool IsLastPage) = 0; virtual void WriteLog (tSInt /*priority*/, const char * /*text*/, ...) {} virtual tUInt GetRecvFileMode (void) { return DEFAULT_FILE_MODE; } virtual CDynamicString *GetSpoolDir (void) { return 0; } private: time_t GetStopTime (void); time_t GetConnectionTime (void); tSInfo FillSffFilter (void); tSInt GetRecvFile (void); tSInt GetNextRecvFile (void); CSFilter_fTif2Huf m_sTifFilter; CSFilter_Huf2Sff m_sSffFilter; CSFilter_Huf2fTif m_rTifFilter; CSFilter_Sff2Huf m_rSffFilter; FaxFormatType m_format; COneMultiString *m_pCurSendFile; CDynamicString *m_pRecvString; CMultiString m_RecvFileList; tUInt m_PageCount; tUInt m_BaudRate; tUInt m_VResolution; tUInt m_finishedFaxFile; tUInt m_recvState; tUInt m_faxFileNr; tSInt m_FaxFileD; tSInt m_RecvFile; time_t m_StartTime; time_t m_ConnectStartTime; time_t m_StartPageTime; time_t m_StopTime; }; /*===========================================================================*\ \*===========================================================================*/ inline FaxFormatType CBasicFaxConversion::GetFormat (void) { return m_format; } inline void CBasicFaxConversion::SetFormat (FaxFormatType faxtype) { m_format = faxtype; } inline tUInt CBasicFaxConversion::GetPageCount (void) { return m_PageCount; } inline void CBasicFaxConversion::SetPageCount (tUInt pc) { m_PageCount = pc; } inline tUInt CBasicFaxConversion::GetBaudRate (void) { return m_BaudRate; } inline tUInt CBasicFaxConversion::GetResolution (void) { return m_VResolution; } inline tUInt CBasicFaxConversion::GetSendState (void) { return m_finishedFaxFile; } inline tUInt CBasicFaxConversion::GetRecvState (void) { return m_recvState; } inline tBool CBasicFaxConversion::GetRecvIllegalLines (tUInt *pCountIllegalLines, tUInt *pCountAllLines) { return m_rSffFilter.GetIllegalLines (pCountIllegalLines, pCountAllLines); } inline void CBasicFaxConversion::ConnectionInd (void) { m_StartTime = m_StartPageTime = m_StopTime = time (0); m_ConnectStartTime = 0; } inline void CBasicFaxConversion::ConnectionStarted (void) { m_ConnectStartTime = m_StartPageTime = time (0); } inline void CBasicFaxConversion::SetReceiveID (CDynamicString *pRecvIDStr) { m_pRecvString = pRecvIDStr; } inline CDynamicString *CBasicFaxConversion::GetReceiveID (void) { return m_pRecvString; } inline time_t CBasicFaxConversion::GetStartTime (void) { return m_StartTime; } inline time_t CBasicFaxConversion::GetStopTime (void) { return m_StopTime; } inline time_t CBasicFaxConversion::GetConnectionTime (void) { return m_StopTime - m_ConnectStartTime; } /*===========================================================================*\ \*===========================================================================*/ #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __java_lang_IncompatibleClassChangeError__ #define __java_lang_IncompatibleClassChangeError__ #pragma interface #include <java/lang/LinkageError.h> class java::lang::IncompatibleClassChangeError : public ::java::lang::LinkageError { public: IncompatibleClassChangeError (); IncompatibleClassChangeError (::java::lang::String *); private: static const jlong serialVersionUID = -4914975503642802119LL; public: static ::java::lang::Class class$; }; #endif /* __java_lang_IncompatibleClassChangeError__ */
/** * Copyright (C) 2011-2014 Joao Paulo de Souza Medeiros * * Author(s): Joao Paulo de Souza Medeiros <ignotus21@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 "kmeans.h" clann_void_type kmeans_initialize(struct kmeans *ann, clann_size_type n_centers, clann_size_type center_size, clann_real_type noticeable_change_rate) { ann->n_centers = n_centers; ann->center_size = center_size; ann->noticeable_change_rate = noticeable_change_rate; ann->old_centers = NULL; clann_matrix_initialize(&ann->centers, ann->n_centers, ann->center_size); clann_matrix_fill_rand(&ann->centers, -1, 1); } clann_void_type kmeans_finalize(struct kmeans *ann) { clann_matrix_finalize(&ann->centers); } clann_void_type kmeans_train(struct kmeans *ann, const clann_matrix_type *x, clann_real_type learning_rate) { clann_size_type s, i, *mess = malloc(sizeof(clann_size_type) * x->rows); clann_real_type e, distance, minimun, *sample, *winner = NULL; ann->old_centers = clann_matrix_copy_new(&ann->centers); /* * Index vector used to shuffle the input presentation sequence */ for (s = 0; s < x->rows; s++) mess[s] = s; do { /* * For each input in the shuffle list */ clann_shuffle((clann_int_type *) mess, x->rows); e = 0; for (s = 0; s < x->rows; s++) { sample = clann_matrix_value(x, mess[s], 0); /* * Find the center most closer to current input sample */ minimun = metric_euclidean(sample, clann_matrix_value(&ann->centers, 0, 0), ann->center_size); winner = clann_matrix_value(&ann->centers, 0, 0); for (i = 1; i < ann->n_centers; i++) { distance = metric_euclidean(sample, clann_matrix_value(&ann->centers, i, 0), ann->center_size); if (distance < minimun) { minimun = distance; winner = clann_matrix_value(&ann->centers, i, 0); } } /* * Adjust winning center positions */ for (i = 0; i < ann->center_size; i++) winner[i] += learning_rate * (sample[i] - winner[i]); } /* * Compute the mean of changes */ for (i = 0; i < ann->n_centers; i++) { e += metric_euclidean(clann_matrix_value(&ann->centers, i, 0), clann_matrix_value(ann->old_centers, i, 0), ann->center_size); } e = e / ann->n_centers; #if CLANN_VERBOSE printf("N. [KMEANS] Mean centers' update: " CLANN_PRINTF ".\n", e); #endif clann_matrix_copy(&ann->centers, ann->old_centers); } while (e > ann->noticeable_change_rate); free((clann_void_type *) ann->old_centers); ann->old_centers = NULL; }
#pragma once #ifndef DAWG_DETAILS_MUTT_GEN_H #define DAWG_DETAILS_MUTT_GEN_H /**************************************************************************** * Copyright (C) 2009-2012 Reed A. Cartwright, PhD <reed@scit.us> * ****************************************************************************/ #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS 1 #endif #ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS 1 #endif #include <boost/cstdint.hpp> extern "C" { using boost::uint32_t; using boost::uint64_t; #define SFMT_UINT32_DEFINED 1 #include <dawg/details/SFMTx.h> } namespace dawg { namespace details { struct sfmt_mutt_gen { typedef boost::uint32_t native_t; inline native_t rand_native() { return rand_uint32(); } boost::uint32_t rand_uint32() { return sfmt_gen_rand32(&state); } boost::uint64_t rand_uint64() { return to_uint64(rand_uint32(),rand_uint32()); } double rand_real() { return to_double52(rand_uint64()); } void seed(uint32_t x) { sfmt_init_gen_rand(&state, x); } template<int N> void seed(uint32_t (&x)[N]) { sfmt_init_by_array(&state, &x[0], N); } template<typename _It> void seed(_It first, _It last) { std::size_t sz = last-first; boost::uint32_t *p = new boost::uint32_t[sz]; std::copy(first, last, p); sfmt_init_by_array(&state, p, sz); delete[] p; } private: sfmt_t state; }; typedef sfmt_mutt_gen mutt_gen_default; }} //namespace dawg::details #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __java_io_PipedInputStream__ #define __java_io_PipedInputStream__ #pragma interface #include <java/io/InputStream.h> #include <gcj/array.h> class java::io::PipedInputStream : public ::java::io::InputStream { public: PipedInputStream (); PipedInputStream (::java::io::PipedOutputStream *); virtual void connect (::java::io::PipedOutputStream *); public: // actually protected virtual void receive (jint); public: // actually package-private virtual void receive (jbyteArray, jint, jint); public: virtual jint read (); virtual jint read (jbyteArray, jint, jint); virtual jint available (); virtual void close (); public: // actually package-private ::java::io::PipedOutputStream * __attribute__((aligned(__alignof__( ::java::io::InputStream )))) source; jboolean closed; public: // actually protected static const jint PIPE_SIZE = 1024L; jbyteArray buffer; jint in; jint out; private: jbyteArray read_buf; public: static ::java::lang::Class class$; }; #endif /* __java_io_PipedInputStream__ */