text
stringlengths
4
6.14k
/** * Marlin 3D Printer Firmware * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #pragma once #if ENABLED(REQUIRE_LPC1769) && NOT_TARGET(MCU_LPC1769) #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #elif DISABLED(REQUIRE_LPC1769) && NOT_TARGET(MCU_LPC1768) #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif #undef REQUIRE_LPC1769
/* -*- c++ -*- */ /* * Copyright 2012-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef GR_RUNTIME_BLOCK_REGISTRY_H #define GR_RUNTIME_BLOCK_REGISTRY_H #include <gnuradio/api.h> #include <gnuradio/basic_block.h> #include <map> namespace gr { #ifndef GR_BASIC_BLOCK_H class basic_block; class block; #endif class GR_RUNTIME_API block_registry { public: block_registry(); long block_register(basic_block* block); void block_unregister(basic_block* block); std::string register_symbolic_name(basic_block* block); void register_symbolic_name(basic_block* block, std::string name); basic_block_sptr block_lookup(pmt::pmt_t symbol); void register_primitive(std::string blk, gr::block* ref); void unregister_primitive(std::string blk); void notify_blk(std::string blk); private: //typedef std::map< long, basic_block_sptr > blocksubmap_t; typedef std::map< long, basic_block* > blocksubmap_t; typedef std::map< std::string, blocksubmap_t > blockmap_t; blockmap_t d_map; pmt::pmt_t d_ref_map; std::map< std::string, block*> primitive_map; gr::thread::mutex d_mutex; }; } /* namespace gr */ GR_RUNTIME_API extern gr::block_registry global_block_registry; #endif /* GR_RUNTIME_BLOCK_REGISTRY_H */
// // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org> // #ifndef MARBLE_DECLARATIVE_ZOOMBUTTONINTERCEPTOR_H #define MARBLE_DECLARATIVE_ZOOMBUTTONINTERCEPTOR_H #include <QObject> class MarbleWidget; class ZoomButtonInterceptorPrivate; class ZoomButtonInterceptor : public QObject { Q_OBJECT public: explicit ZoomButtonInterceptor( MarbleWidget* widget, QObject* parent ); ~ZoomButtonInterceptor(); protected: virtual bool eventFilter(QObject *, QEvent *event); private: ZoomButtonInterceptorPrivate* const d; }; #endif // MARBLE_DECLARATIVE_ZOOMBUTTONINTERCEPTOR_H
// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=powerpc-apple-darwin10 -S -o - %s | FileCheck %s // REQUIRES: ppc32-registered-target float fma_test1(float a, float b, float c) { // CHECK: fmadds float x = a * b; float y = x + c; return y; }
/*************************************************************************************************/ /*! * \file * * \brief Link layer (LL) Host Controller Interface (HCI) initialization implementation file. * * Copyright (c) 2019 Arm Ltd. All Rights Reserved. * * Copyright (c) 2019-2020 Packetcraft, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*************************************************************************************************/ #include "lhci_int.h" #include <string.h> /*************************************************************************************************/ /*! * \brief Initialize LL HCI subsystem for BIS slave mode. * * This function initializes the LL HCI subsystem for BIS slave commands. It is typically called * once upon system initialization. */ /*************************************************************************************************/ void LhciBisSlaveInit(void) { lhciCmdTbl[LHCI_MSG_BIS_SLV] = lhciSlvBisDecodeCmdPkt; lhciEvtTbl[LHCI_MSG_BIS_SLV] = lhciSlvBigEncodeEvtPkt; }
// Copyright 2017 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 IOS_WEB_PUBLIC_INIT_IOS_GLOBAL_STATE_H_ #define IOS_WEB_PUBLIC_INIT_IOS_GLOBAL_STATE_H_ #include "base/task/thread_pool/thread_pool_instance.h" namespace base { class SingleThreadTaskExecutor; } namespace ios_global_state { // Contains parameters passed to |Create|. struct CreateParams { CreateParams() : install_at_exit_manager(false), argc(0), argv(nullptr) {} bool install_at_exit_manager; int argc; const char** argv; }; // Creates global state for iOS. This should be called as early as possible in // the application lifecycle. It is safe to call this method more than once, the // initialization will only be performed once. // // An AtExitManager will only be created if |register_exit_manager| is true. If // |register_exit_manager| is false, an AtExitManager must already exist before // calling |Create|. // |argc| and |argv| may be set to the command line options which were passed to // the application. // // Since the initialization will only be performed the first time this method is // called, the values of all the parameters will be ignored after the first // call. void Create(const CreateParams& create_params); // Creates a task executor for the UI thread and attaches it. It is safe to call // this method more than once, the initialization will only be performed once. void BuildSingleThreadTaskExecutor(); // Destroys the message loop create by BuildSingleThreadTaskExecutor. It is safe // to call multiple times. void DestroySingleThreadTaskExecutor(); // Creates a network change notifier. It is safe to call this method more than // once, the initialization will only be performed once. void CreateNetworkChangeNotifier(); // Destroys the network change notifier created by CreateNetworkChangeNotifier. // It is safe to call this method multiple time. void DestroyNetworkChangeNotifier(); // Starts a global base::ThreadPoolInstance. This method must be called to start // the Thread Pool that is created in |Create|. It is safe to call this method // more than once, the thread pool will only be started once. void StartThreadPool(); // Destroys the AtExitManager if one was created in |Create|. It is safe to call // this method even if |install_at_exit_manager| was false in the CreateParams // passed to |Create|. It is safe to call this method more than once, the // AtExitManager will be destroyed on the first call. void DestroyAtExitManager(); // Returns SingleThreadTaskExecutor for the UI thread. base::SingleThreadTaskExecutor* GetMainThreadTaskExecutor(); } // namespace ios_global_state #endif // IOS_WEB_PUBLIC_INIT_IOS_GLOBAL_STATE_H_
/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c,v 1.1 2002/02/22 21:32:58 dawes Exp $ * * GLX Hardware Device Driver for Sun Creator/Creator3D * Copyright (C) 2001 David S. Miller * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * David S. Miller <davem@redhat.com> */ #include "ffb_context.h" #include "ffb_state.h" #include "ffb_lock.h" #include "ffb_bitmap.h" #include "swrast/swrast.h" #include "image.h" #include "macros.h" /* Compute ceiling of integer quotient of A divided by B: */ #define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) #undef FFB_BITMAP_TRACE static void ffb_bitmap(GLcontext *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); ffb_fbcPtr ffb = fmesa->regs; __DRIdrawablePrivate *dPriv = fmesa->driDrawable; unsigned int ppc, pixel; GLint row, col, row_stride; const GLubyte *src; char *buf; if (fmesa->bad_fragment_attrs != 0) _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap); pixel = (((((GLuint)(ctx->Current.RasterColor[0] * 255.0f)) & 0xff) << 0) | ((((GLuint)(ctx->Current.RasterColor[1] * 255.0f)) & 0xff) << 8) | ((((GLuint)(ctx->Current.RasterColor[2] * 255.0f)) & 0xff) << 16) | ((((GLuint)(ctx->Current.RasterColor[3] * 255.0f)) & 0xff) << 24)); #ifdef FFB_BITMAP_TRACE fprintf(stderr, "ffb_bitmap: ppc(%08x) fbc(%08x) cmp(%08x) pixel(%08x)\n", fmesa->ppc, fmesa->fbc, fmesa->cmp, pixel); #endif LOCK_HARDWARE(fmesa); fmesa->hw_locked = 1; if (fmesa->state_dirty) ffbSyncHardware(fmesa); ppc = fmesa->ppc; FFBFifo(fmesa, 4); ffb->ppc = ((ppc & ~(FFB_PPC_TBE_MASK | FFB_PPC_ZS_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK)) | (FFB_PPC_TBE_TRANSPARENT | FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST | (ctx->Color.BlendEnabled ? FFB_PPC_XS_CONST : FFB_PPC_XS_WID))); ffb->constz = ((GLuint) (ctx->Current.RasterPos[2] * 0x0fffffff)); ffb->fg = pixel; ffb->fontinc = (0 << 16) | 32; buf = (char *)(fmesa->sfb32 + (dPriv->x << 2) + (dPriv->y << 13)); row_stride = (unpack->Alignment * CEILING(width, 8 * unpack->Alignment)); src = (const GLubyte *) (bitmap + (unpack->SkipRows * row_stride) + (unpack->SkipPixels / 8)); if (unpack->LsbFirst == GL_TRUE) { for (row = 0; row < height; row++, src += row_stride) { const GLubyte *row_src = src; GLuint base_x, base_y; base_x = dPriv->x + px; base_y = dPriv->y + (dPriv->h - (py + row)); FFBFifo(fmesa, 1); ffb->fontxy = (base_y << 16) | base_x; for (col = 0; col < width; col += 32, row_src += 4) { GLint bitnum, font_w = (width - col); GLuint font_data; if (font_w > 32) font_w = 32; font_data = 0; for (bitnum = 0; bitnum < 32; bitnum++) { const GLubyte val = row_src[bitnum >> 3]; if (val & (1 << (bitnum & (8 - 1)))) font_data |= (1 << (31 - bitnum)); } FFBFifo(fmesa, 2); ffb->fontw = font_w; ffb->font = font_data; } } } else { for (row = 0; row < height; row++, src += row_stride) { const GLubyte *row_src = src; GLuint base_x, base_y; base_x = dPriv->x + px; base_y = dPriv->y + (dPriv->h - (py + row)); FFBFifo(fmesa, 1); ffb->fontxy = (base_y << 16) | base_x; for (col = 0; col < width; col += 32, row_src += 4) { GLint font_w = (width - col); if (font_w > 32) font_w = 32; FFBFifo(fmesa, 2); ffb->fontw = font_w; ffb->font = (((unsigned int)row_src[0]) << 24 | ((unsigned int)row_src[1]) << 16 | ((unsigned int)row_src[2]) << 8 | ((unsigned int)row_src[3]) << 0); } } } FFBFifo(fmesa, 1); ffb->ppc = ppc; fmesa->ffbScreen->rp_active = 1; UNLOCK_HARDWARE(fmesa); fmesa->hw_locked = 0; } void ffbDDInitBitmapFuncs(GLcontext *ctx) { ctx->Driver.Bitmap = ffb_bitmap; }
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /************************************************************************* * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "gvplugin_device.h" #include <IL/il.h> #include <IL/ilu.h> static void Y_inv ( unsigned int width, unsigned int height, char *data) { unsigned int x, y, *a, *b, t; a = (unsigned int*)data; b = a + (height-1) * width; for (y = 0; y < height/2; y++) { for (x = 0; x < width; x++) { t = *a; *a++ = *b; *b++ = t; } b -= 2*width; } } static void devil_format(GVJ_t * job) { ILuint ImgId; ILenum Error; ILboolean rc; // Check if the shared lib's version matches the executable's version. if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { fprintf(stderr, "DevIL version is different...exiting!\n"); } // Initialize DevIL. ilInit(); // Generate the main image name to use. ilGenImages(1, &ImgId); // Bind this image name. ilBindImage(ImgId); // cairo's inmemory image format needs inverting for DevIL Y_inv ( job->width, job->height, job->imagedata ); // let the DevIL do its thing rc = ilTexImage( job->width, job->height, 1, // Depth 4, // Bpp IL_BGRA, // Format IL_UNSIGNED_BYTE,// Type job->imagedata); // output to the provided open file handle ilSaveF(job->device.id, job->output_file); // We're done with the image, so delete it. ilDeleteImages(1, &ImgId); // Simple Error detection loop that displays the Error to the user in a human-readable form. while ((Error = ilGetError())) { fprintf(stderr, "Error: %s\n", iluErrorString(Error)); } } static gvdevice_engine_t devil_engine = { NULL, /* devil_initialize */ devil_format, NULL, /* devil_finalize */ }; static gvdevice_features_t device_features_devil = { GVDEVICE_BINARY_FORMAT | GVDEVICE_NO_WRITER | GVDEVICE_DOES_TRUECOLOR,/* flags */ {0.,0.}, /* default margin - points */ {0.,0.}, /* default page width, height - points */ {96.,96.}, /* svg 72 dpi */ }; gvplugin_installed_t gvdevice_devil_types[] = { {IL_BMP, "bmp:cairo", -1, &devil_engine, &device_features_devil}, {IL_JPG, "jpg:cairo", -1, &devil_engine, &device_features_devil}, {IL_JPG, "jpe:cairo", -1, &devil_engine, &device_features_devil}, {IL_JPG, "jpeg:cairo", -1, &devil_engine, &device_features_devil}, {IL_PNG, "png:cairo", -1, &devil_engine, &device_features_devil}, {IL_TIF, "tif:cairo", -1, &devil_engine, &device_features_devil}, {IL_TIF, "tiff:cairo", -1, &devil_engine, &device_features_devil}, {IL_TGA, "tga:cairo", -1, &devil_engine, &device_features_devil}, {0, NULL, 0, NULL, NULL} };
/* $Id: conf-sunos-4.0.h,v 1.2 1993/08/19 05:27:04 genek Exp $ */ /* * conf-sunos-4.0.h (SunOS versions prior to 4.1) * * Tripwire configuration file * * Gene Kim * Purdue University */ /*** *** Operating System specifics *** *** If the answer to a question in the comment is "Yes", then *** change the corresponding "#undef" to a "#define" ***/ /* * is your OS a System V derivitive? if so, what version? * (e.g., define SYSV 4) */ #undef SYSV /* * does your system have a <malloc.h> like System V? */ #define MALLOCH /* * does your system have a <stdlib.h> like POSIX says you should? */ #undef STDLIBH /* * does your system use readdir(3) that returns (struct dirent *)? */ #define DIRENT /* * is #include <string.h> ok? (as opposed to <strings.h>) */ #define STRINGH /* * does your system have gethostname(2) (instead of uname(2))? */ #define GETHOSTNAME
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. // TODO: Merge this with the original VideoConfigDiag or something // This is an awful way of managing a separate video backend. #pragma once #include <string> #include <vector> #include <wx/button.h> #include <wx/checkbox.h> #include <wx/combobox.h> #include <wx/notebook.h> #include <wx/panel.h> #include <wx/spinctrl.h> #include <wx/stattext.h> #include <wx/textctrl.h> #include <wx/wx.h> #include "Core/ConfigManager.h" #include "VideoBackends/Software/SWVideoConfig.h" #include "VideoCommon/VideoBackendBase.h" class SoftwareVideoConfigDialog : public wxDialog { public: SoftwareVideoConfigDialog(wxWindow* parent, const std::string &title, const std::string& ininame); ~SoftwareVideoConfigDialog(); void Event_Backend(wxCommandEvent &ev) { VideoBackend* new_backend = g_available_video_backends[ev.GetInt()]; if (g_video_backend != new_backend) { Close(); g_video_backend = new_backend; SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend = g_video_backend->GetName(); g_video_backend->ShowConfig(GetParent()); } ev.Skip(); } protected: SWVideoConfig& vconfig; std::string ininame; };
/********************************************************************** * $Id: NodeMap.h 2958 2010-03-29 11:29:40Z mloskot $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2005-2006 Refractions Research Inc. * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * ********************************************************************** * * Last port: geomgraph/NodeMap.java rev. 1.3 (JTS-1.10) * **********************************************************************/ #ifndef GEOS_GEOMGRAPH_NODEMAP_H #define GEOS_GEOMGRAPH_NODEMAP_H #include <geos/export.h> #include <map> #include <vector> #include <string> #include <geos/geom/Coordinate.h> // for CoordinateLessThen #include <geos/geomgraph/Node.h> // for testInvariant #include <geos/inline.h> #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class #endif // Forward declarations namespace geos { namespace geomgraph { class Node; class EdgeEnd; class NodeFactory; } } namespace geos { namespace geomgraph { // geos.geomgraph class GEOS_DLL NodeMap{ public: typedef std::map<geom::Coordinate*,Node*,geom::CoordinateLessThen> container; typedef container::iterator iterator; typedef container::const_iterator const_iterator; typedef std::pair<geom::Coordinate*,Node*> pair; container nodeMap; const NodeFactory &nodeFact; /// \brief /// NodeMap will keep a reference to the NodeFactory, /// keep it alive for the whole NodeMap lifetime NodeMap(const NodeFactory &newNodeFact); virtual ~NodeMap(); Node* addNode(const geom::Coordinate& coord); Node* addNode(Node *n); void add(EdgeEnd *e); Node *find(const geom::Coordinate& coord) const; const_iterator begin() const { return nodeMap.begin(); } const_iterator end() const { return nodeMap.end(); } iterator begin() { return nodeMap.begin(); } iterator end() { return nodeMap.end(); } void getBoundaryNodes(int geomIndex, std::vector<Node*>&bdyNodes) const; std::string print() const; void testInvariant() { #ifndef NDEBUG // Each Coordinate key is a pointer inside the Node value for (iterator it=begin(), itEnd=end(); it != itEnd; ++it) { pair p = *it; geomgraph::Node* n = p.second; geom::Coordinate* c = const_cast<geom::Coordinate*>( &(n->getCoordinate()) ); assert(p.first == c); } #endif } private: // Declare type as noncopyable NodeMap(const NodeMap& other); NodeMap& operator=(const NodeMap& rhs); }; } // namespace geos.geomgraph } // namespace geos //#ifdef GEOS_INLINE //# include "geos/geomgraph/NodeMap.inl" //#endif #ifdef _MSC_VER #pragma warning(pop) #endif #endif // ifndef GEOS_GEOMGRAPH_NODEMAP_H /********************************************************************** * $Log$ * Revision 1.3 2006/05/04 12:54:26 strk * Added invariant tester for NodeMap class, fixed comment about ownership of NodeFactory * * Revision 1.2 2006/03/24 09:52:41 strk * USE_INLINE => GEOS_INLINE * * Revision 1.1 2006/03/09 16:46:49 strk * geos::geom namespace definition, first pass at headers split * **********************************************************************/
/********************************************************************** * $Id: CommonBitsRemover.h 2556 2009-06-06 22:22:28Z strk $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2005-2006 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/ #ifndef GEOS_PRECISION_COMMONBITSREMOVER_H #define GEOS_PRECISION_COMMONBITSREMOVER_H #include <geos/export.h> #include <geos/geom/Coordinate.h> // for composition // Forward declarations namespace geos { namespace geom { class Geometry; } namespace precision { class CommonBitsRemover; class CommonCoordinateFilter; } } namespace geos { namespace precision { // geos.precision /** \brief * Allow computing and removing common mantissa bits from one or * more Geometries. * */ class GEOS_DLL CommonBitsRemover { private: geom::Coordinate commonCoord; CommonCoordinateFilter *ccFilter; public: CommonBitsRemover(); ~CommonBitsRemover(); /** * Add a geometry to the set of geometries whose common bits are * being computed. After this method has executed the * common coordinate reflects the common bits of all added * geometries. * * @param geom a Geometry to test for common bits */ void add(const geom::Geometry *geom); /** * The common bits of the Coordinates in the supplied Geometries. */ geom::Coordinate& getCommonCoordinate(); /** \brief * Removes the common coordinate bits from a Geometry. * The coordinates of the Geometry are changed. * * @param geom the Geometry from which to remove the common * coordinate bits * @return the shifted Geometry */ geom::Geometry* removeCommonBits(geom::Geometry *geom); /** \brief * Adds the common coordinate bits back into a Geometry. * The coordinates of the Geometry are changed. * * @param geom the Geometry to which to add the common coordinate bits * @return the shifted Geometry */ geom::Geometry* addCommonBits(geom::Geometry *geom); }; } // namespace geos.precision } // namespace geos #endif // GEOS_PRECISION_COMMONBITSREMOVER_H /********************************************************************** * $Log$ * Revision 1.3 2006/04/07 08:30:30 strk * made addCommonBits/removeCommonBits interface consistent, doxygen comments * * Revision 1.2 2006/04/06 14:36:52 strk * Cleanup in geos::precision namespace (leaks plugged, auto_ptr use, ...) * * Revision 1.1 2006/03/23 09:17:19 strk * precision.h header split, minor optimizations * **********************************************************************/
// SPDX-License-Identifier: GPL-2.0-only /* iptables module for the IPv4 and TCP ECN bits, Version 1.5 * * (C) 2002 by Harald Welte <laforge@netfilter.org> */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/in.h> #include <linux/module.h> #include <linux/skbuff.h> #include <linux/ip.h> #include <net/ip.h> #include <linux/tcp.h> #include <net/checksum.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ipt_ECN.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); MODULE_DESCRIPTION("Xtables: Explicit Congestion Notification (ECN) flag modification"); /* set ECT codepoint from IP header. * return false if there was an error. */ static inline bool set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo) { struct iphdr *iph = ip_hdr(skb); if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { __u8 oldtos; if (!skb_make_writable(skb, sizeof(struct iphdr))) return false; iph = ip_hdr(skb); oldtos = iph->tos; iph->tos &= ~IPT_ECN_IP_MASK; iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); csum_replace2(&iph->check, htons(oldtos), htons(iph->tos)); } return true; } /* Return false if there was an error. */ static inline bool set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo) { struct tcphdr _tcph, *tcph; __be16 oldval; /* Not enough header? */ tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph); if (!tcph) return false; if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) || tcph->ece == einfo->proto.tcp.ece) && (!(einfo->operation & IPT_ECN_OP_SET_CWR) || tcph->cwr == einfo->proto.tcp.cwr)) return true; if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph))) return false; tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb); oldval = ((__be16 *)tcph)[6]; if (einfo->operation & IPT_ECN_OP_SET_ECE) tcph->ece = einfo->proto.tcp.ece; if (einfo->operation & IPT_ECN_OP_SET_CWR) tcph->cwr = einfo->proto.tcp.cwr; inet_proto_csum_replace2(&tcph->check, skb, oldval, ((__be16 *)tcph)[6], false); return true; } static unsigned int ecn_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ipt_ECN_info *einfo = par->targinfo; if (einfo->operation & IPT_ECN_OP_SET_IP) if (!set_ect_ip(skb, einfo)) return NF_DROP; if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) && ip_hdr(skb)->protocol == IPPROTO_TCP) if (!set_ect_tcp(skb, einfo)) return NF_DROP; return XT_CONTINUE; } static int ecn_tg_check(const struct xt_tgchk_param *par) { const struct ipt_ECN_info *einfo = par->targinfo; const struct ipt_entry *e = par->entryinfo; if (einfo->operation & IPT_ECN_OP_MASK) return -EINVAL; if (einfo->ip_ect & ~IPT_ECN_IP_MASK) return -EINVAL; if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) && (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) { pr_info_ratelimited("cannot use operation on non-tcp rule\n"); return -EINVAL; } return 0; } static struct xt_target ecn_tg_reg __read_mostly = { .name = "ECN", .family = NFPROTO_IPV4, .target = ecn_tg, .targetsize = sizeof(struct ipt_ECN_info), .table = "mangle", .checkentry = ecn_tg_check, .me = THIS_MODULE, }; static int __init ecn_tg_init(void) { return xt_register_target(&ecn_tg_reg); } static void __exit ecn_tg_exit(void) { xt_unregister_target(&ecn_tg_reg); } module_init(ecn_tg_init); module_exit(ecn_tg_exit);
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher * Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev * * This program 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 program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MT32EMU_CONFIG_H #define MT32EMU_CONFIG_H #define MT32EMU_VERSION "2.3.0" #define MT32EMU_VERSION_MAJOR 2 #define MT32EMU_VERSION_MINOR 3 #define MT32EMU_VERSION_PATCH 0 /* Library Exports Configuration * * This reflects the API types actually provided by the library build. * 0: The full-featured C++ API is only available in this build. The client application may ONLY use MT32EMU_API_TYPE 0. * 1: The C-compatible API is only available. The library is built as a shared object, only C functions are exported, * and thus the client application may NOT use MT32EMU_API_TYPE 0. * 2: The C-compatible API is only available. The library is built as a shared object, only the factory function * is exported, and thus the client application may ONLY use MT32EMU_API_TYPE 2. * 3: All the available API types are provided by the library build. */ #define MT32EMU_EXPORTS_TYPE 3 #endif
/* * Copyright (C) 2010-2012 OregonCore <http://www.oregoncore.com/> * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2012 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 SC_INSTANCE_H #define SC_INSTANCE_H #include "InstanceData.h" #include "Map.h" #define OUT_SAVE_INST_DATA debug_log("OSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_SAVE_INST_DATA_COMPLETE debug_log("OSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA(a) debug_log("OSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) #define OUT_LOAD_INST_DATA_COMPLETE debug_log("OSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA_FAIL error_log("OSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define ScriptedInstance InstanceData #endif
/*************************************************************************/ /*! @Title RGX Core BVNC 1.75.2.20 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #ifndef _RGXCORE_KM_1_75_2_20_H_ #define _RGXCORE_KM_1_75_2_20_H_ /***** Automatically generated file (3/4/2015 2:27:36 PM): Do not edit manually ********************/ /***** Timestamp: (3/4/2015 2:27:36 PM)************************************************************/ /***** CS: @2309075 ******************************************************************/ /****************************************************************************** * BVNC = 1.75.2.20 *****************************************************************************/ #define RGX_BVNC_KM_B 1 #define RGX_BVNC_KM_V 75 #define RGX_BVNC_KM_N 2 #define RGX_BVNC_KM_C 20 /****************************************************************************** * Errata *****************************************************************************/ /****************************************************************************** * Enhancements *****************************************************************************/ #endif /* _RGXCORE_KM_1_75_2_20_H_ */
/* Copyright (c) 2010-2013 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef RAMCLOUD_OPTIONPARSER_H #define RAMCLOUD_OPTIONPARSER_H #include <boost/program_options.hpp> #include "Common.h" #include "Transport.h" namespace RAMCloud { /// See boost::program_options, just a synonym for that namespace. namespace ProgramOptions { using namespace boost::program_options; // NOLINT } /// See boost::program_options::options_description, just a type synonym. typedef ProgramOptions::options_description OptionsDescription; /** * Parses command line options for RAMCloud applications. It also allows * one to specify additional options that are program specific. * * Example use: * \code * OptionsDescription telnetOptions("Telnet"); * telnetOptions.add_options() * ("generate,g", * ProgramOptions::bool_switch(&generate), * "Continuously send random data") * ("server,s", * ProgramOptions::value<vector<string> >(&serverLocators), * "Server locator of server, can be repeated to send to all"); * * OptionParser optionParser(telnetOptions, argc, argv); * * if (!serverLocators.size()) { * optionParser.usage(); * DIE("Error: No servers specified to telnet to."); * } * \endcode */ class OptionParser { public: OptionParser(int argc, char* argv[]); OptionParser(const OptionsDescription& appOptions, int argc, char* argv[]); void usage() const; void usageAndExit() const; /// Holds values for generic RAMCloud options. See #options. class Options { public: Options() : coordinatorLocator() , localLocator() , externalStorageLocator() , pcapFilePath() , sessionTimeout(0) , portTimeout(0) , clusterName() { } /// Returns the local locator the application should listen on, if any. const string& getLocalLocator() const { return localLocator; } /** * Returns the locator the application should contact the coordinator * at, if any. */ const string& getCoordinatorLocator() const { return coordinatorLocator; } /** * Returns information about how to connect to an external storage * server that holds coordinator configuration information. */ const string& getExternalStorageLocator() const { return externalStorageLocator; } /** * Returns a name identifying the RAMCloud cluster to connect with. * Allows multiple clusters to coexist without interference. */ const string& getClusterName() const { return clusterName; } /** * Returns the locator the application should contact the coordinator * at, if any. */ const string& getPcapFilePath() const { return pcapFilePath; } /** * Returns the time (in ms) after which transports should assume that * a connection has failed. 0 means use a transport-specific default. */ uint32_t getSessionTimeout() const { return sessionTimeout; } /** * Returns the time (in ms) after which transports should assume that * the client for the lisning port is dead. */ int32_t getPortTimeout() const { return portTimeout; } private: string coordinatorLocator; ///< See getCoordinatorLocator(). string localLocator; ///< See getLocalLocator(). string externalStorageLocator; ///< See getExternalStorageLocator(). string pcapFilePath; ///< Packet log file, "" to disable. uint32_t sessionTimeout; ///< See getSessionTimeout(). int32_t portTimeout; ///< See getSessionTimeout(). string clusterName; ///< See getClusterName(). friend class OptionParser; }; /// Values for options common to all RAMCloud applications. Options options; private: void setup(int argc, char* argv[]); /// The composition of appOptions and the RAMCloud common options. OptionsDescription allOptions; /// Additional application-specific options that should be parsed. const OptionsDescription appOptions; }; } // end RAMCloud #endif // RAMCLOUD_OPTIONPARSER_H
extern zend_class_entry *test_constantsinterface_ce; ZEPHIR_INIT_CLASS(Test_ConstantsInterface); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant1); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant2); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant3); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant4); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant5); PHP_METHOD(Test_ConstantsInterface, testReadInterfaceConstant6); ZEPHIR_INIT_FUNCS(test_constantsinterface_method_entry) { PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_ConstantsInterface, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) PHP_FE_END };
//===-- SBQueueItem.h -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLDB_SBQueueItem_h_ #define LLDB_SBQueueItem_h_ #include <LLDB/SBDefines.h> #include <LLDB/SBAddress.h> namespace lldb { class LLDB_API SBQueueItem { public: SBQueueItem (); SBQueueItem (const lldb::QueueItemSP& queue_item_sp); ~SBQueueItem(); bool IsValid() const; void Clear (); lldb::QueueItemKind GetKind () const; void SetKind (lldb::QueueItemKind kind); lldb::SBAddress GetAddress () const; void SetAddress (lldb::SBAddress addr); void SetQueueItem (const lldb::QueueItemSP& queue_item_sp); SBThread GetExtendedBacktraceThread (const char *type); private: lldb::QueueItemSP m_queue_item_sp; }; } // namespace lldb #endif // LLDB_SBQueueItem_h_
/******************************************************************************* * Copyright (C) 2010, Linaro Limited. * * This file is part of PowerDebug. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Author: * Daniel Lezcano <daniel.lezcano@linaro.org> * *******************************************************************************/ typedef int (*mainloop_callback_t)(int fd, void *data); extern int mainloop(unsigned int timeout); extern int mainloop_add(int fd, mainloop_callback_t cb, void *data); extern int mainloop_del(int fd); extern int mainloop_init(void); extern void mainloop_fini(void);
/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ /** * MegaTronics pin assignments */ #ifndef __AVR_ATmega2560__ #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Megatronics" // // Limit Switches // #define X_MIN_PIN 41 #define X_MAX_PIN 37 #define Y_MIN_PIN 14 #define Y_MAX_PIN 15 #define Z_MIN_PIN 18 #define Z_MAX_PIN 19 // // Z Probe (when not Z_MIN_PIN) // #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN 19 #endif // // Steppers // #define X_STEP_PIN 26 #define X_DIR_PIN 28 #define X_ENABLE_PIN 24 #define Y_STEP_PIN 60 // A6 #define Y_DIR_PIN 61 // A7 #define Y_ENABLE_PIN 22 #define Z_STEP_PIN 54 // A0 #define Z_DIR_PIN 55 // A1 #define Z_ENABLE_PIN 56 // A2 #define E0_STEP_PIN 31 #define E0_DIR_PIN 32 #define E0_ENABLE_PIN 38 #define E1_STEP_PIN 34 #define E1_DIR_PIN 36 #define E1_ENABLE_PIN 30 // // Temperature Sensors // #if TEMP_SENSOR_0 == -1 #define TEMP_0_PIN 8 // Analog Input #else #define TEMP_0_PIN 13 // Analog Input #endif #define TEMP_1_PIN 15 // Analog Input #define TEMP_BED_PIN 14 // Analog Input // // Heaters / Fans // #define HEATER_0_PIN 9 #define HEATER_1_PIN 8 #define HEATER_BED_PIN 10 #define FAN_PIN 7 // IO pin. Buffer needed // // Misc. Functions // #define SDSS 53 #define LED_PIN 13 #define PS_ON_PIN 12 #define CASE_LIGHT_PIN 2 // // LCD / Controller // #define BEEPER_PIN 33 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 #define LCD_PINS_D4 23 #define LCD_PINS_D5 25 #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 // Buttons directly attached using AUX-2 #define BTN_EN1 59 #define BTN_EN2 64 #define BTN_ENC 43 #define SD_DETECT_PIN -1 // RAMPS doesn't use this #endif // ULTRA_LCD && NEWPANEL // // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 3 // MUST BE HARDWARE PWM #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11
/* No user fns here. Pesch 15apr92. */ /* * Copyright (c) 1990, 2007 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * and/or other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #include <_ansi.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include "local.h" /* * Various output routines call wsetup to be sure it is safe to write, * because either _flags does not include __SWR, or _buf is NULL. * _wsetup returns 0 if OK to write, nonzero and set errno otherwise. */ int __swsetup_r (struct _reent *ptr, register FILE * fp) { /* Make sure stdio is set up. */ CHECK_INIT (_REENT, fp); /* * If we are not writing, we had better be reading and writing. */ if ((fp->_flags & __SWR) == 0) { if ((fp->_flags & __SRW) == 0) { ptr->_errno = EBADF; fp->_flags |= __SERR; return EOF; } if (fp->_flags & __SRD) { /* clobber any ungetc data */ if (HASUB (fp)) FREEUB (ptr, fp); fp->_flags &= ~(__SRD | __SEOF); fp->_r = 0; fp->_p = fp->_bf._base; } fp->_flags |= __SWR; } /* * Make a buffer if necessary, then set _w. * A string I/O file should not explicitly allocate a buffer * unless asprintf is being used. */ if (fp->_bf._base == NULL && (!(fp->_flags & __SSTR) || (fp->_flags & __SMBF))) __smakebuf_r (ptr, fp); if (fp->_flags & __SLBF) { /* * It is line buffered, so make _lbfsize be -_bufsize * for the putc() macro. We will change _lbfsize back * to 0 whenever we turn off __SWR. */ fp->_w = 0; fp->_lbfsize = -fp->_bf._size; } else fp->_w = fp->_flags & __SNBF ? 0 : fp->_bf._size; if (!fp->_bf._base && (fp->_flags & __SMBF)) { /* __smakebuf_r set errno, but not flag */ fp->_flags |= __SERR; return EOF; } return 0; }
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * 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 * * ******************************************************************************/ #include "../odm_precomp.h" #if (RTL8188E_SUPPORT == 1) void odm_ConfigRFReg_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Data, IN ODM_RF_RADIO_PATH_E RF_PATH, IN u4Byte RegAddr ) { if(Addr == 0xffe) { #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); #else ODM_delay_ms(50); #endif } else if (Addr == 0xfd) { ODM_delay_ms(5); } else if (Addr == 0xfc) { ODM_delay_ms(1); } else if (Addr == 0xfb) { ODM_delay_us(50); } else if (Addr == 0xfa) { ODM_delay_us(5); } else if (Addr == 0xf9) { ODM_delay_us(1); } else { ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data); // Add 1us delay between BB/RF register setting. ODM_delay_us(1); } } void odm_ConfigRF_RadioA_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Data ) { u4Byte content = 0x1000; // RF_Content: radioa_txt u4Byte maskforPhySet= (u4Byte)(content&0xE000); odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_A, Addr|maskforPhySet); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data)); } void odm_ConfigRF_RadioB_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Data ) { u4Byte content = 0x1001; // RF_Content: radiob_txt u4Byte maskforPhySet= (u4Byte)(content&0xE000); odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_B, Addr|maskforPhySet); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data)); } void odm_ConfigMAC_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u1Byte Data ) { ODM_Write1Byte(pDM_Odm, Addr, Data); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data)); } void odm_ConfigBB_AGC_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Bitmask, IN u4Byte Data ) { ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); // Add 1us delay between BB/RF register setting. ODM_delay_us(1); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data)); } void odm_ConfigBB_PHY_REG_PG_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Bitmask, IN u4Byte Data ) { if (Addr == 0xfe){ #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); #else ODM_delay_ms(50); #endif } else if (Addr == 0xfd){ ODM_delay_ms(5); } else if (Addr == 0xfc){ ODM_delay_ms(1); } else if (Addr == 0xfb){ ODM_delay_us(50); } else if (Addr == 0xfa){ ODM_delay_us(5); } else if (Addr == 0xf9){ ODM_delay_us(1); } else{ ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, ("===> @@@@@@@ ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n", Addr, Bitmask, Data)); #if !(DM_ODM_SUPPORT_TYPE&ODM_AP) storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data); #endif } } void odm_ConfigBB_PHY_8188E( IN PDM_ODM_T pDM_Odm, IN u4Byte Addr, IN u4Byte Bitmask, IN u4Byte Data ) { if (Addr == 0xfe){ #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); #else ODM_delay_ms(50); #endif } else if (Addr == 0xfd){ ODM_delay_ms(5); } else if (Addr == 0xfc){ ODM_delay_ms(1); } else if (Addr == 0xfb){ ODM_delay_us(50); } else if (Addr == 0xfa){ ODM_delay_us(5); } else if (Addr == 0xf9){ ODM_delay_us(1); } else{ if (Addr == 0xa24) pDM_Odm->RFCalibrateInfo.RegA24 = Data; ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); // Add 1us delay between BB/RF register setting. ODM_delay_us(1); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data)); } } #endif
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #pragma once #include "Core/HW/WiimoteEmu/Attachment/Attachment.h" namespace WiimoteEmu { class Turntable : public Attachment { public: Turntable(WiimoteEmu::ExtensionReg& _reg); void GetState(u8* const data) override; enum { BUTTON_EUPHORIA = 0x1000, BUTTON_L_GREEN = 0x0800, BUTTON_L_RED = 0x20, BUTTON_L_BLUE = 0x8000, BUTTON_R_GREEN = 0x2000, BUTTON_R_RED = 0x02, BUTTON_R_BLUE = 0x0400, BUTTON_MINUS = 0x10, BUTTON_PLUS = 0x04, }; private: Buttons* m_buttons; AnalogStick* m_stick; Triggers* m_effect_dial; Slider* m_left_table; Slider* m_right_table; Slider* m_crossfade; }; }
#ifndef __QEDEFS_H__ #define __QEDEFS_H__ #define QE_VERSION 0x0501 #define QE3_STYLE (WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CHILD) #define QE3_STYLE2 (WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) #define QE3_CHILDSTYLE (WS_OVERLAPPED | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZEBOX) #define QE3_SPLITTER_STYLE (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) #define QE_AUTOSAVE_INTERVAL 5 // number of minutes between autosaves #define _3DFXCAMERA_WINDOW_CLASS "Q3DFXCamera" #define CAMERA_WINDOW_CLASS "QCamera" #define XY_WINDOW_CLASS "QXY" #define Z_WINDOW_CLASS "QZ" #define ENT_WINDOW_CLASS "QENT" #define TEXTURE_WINDOW_CLASS "QTEX" #define ZWIN_WIDTH 40 #define CWIN_SIZE (0.4) #define MAX_EDGES 256 #define MAX_POINTS 512 #define CMD_TEXTUREWAD 60000 #define CMD_BSPCOMMAND 61000 #define PITCH 0 #define YAW 1 #define ROLL 2 #define QE_TIMER0 1 #define PLANE_X 0 #define PLANE_Y 1 #define PLANE_Z 2 #define PLANE_ANYX 3 #define PLANE_ANYY 4 #define PLANE_ANYZ 5 #define ON_EPSILON 0.01 #define KEY_FORWARD 1 #define KEY_BACK 2 #define KEY_TURNLEFT 4 #define KEY_TURNRIGHT 8 #define KEY_LEFT 16 #define KEY_RIGHT 32 #define KEY_LOOKUP 64 #define KEY_LOOKDOWN 128 #define KEY_UP 256 #define KEY_DOWN 512 // xy.c #define EXCLUDE_LIGHTS 0x01 #define EXCLUDE_ENT 0x02 #define EXCLUDE_PATHS 0x04 #define EXCLUDE_WATER 0x08 #define EXCLUDE_WORLD 0x10 #define EXCLUDE_CLIP 0x20 #define EXCLUDE_DETAIL 0x40 #define EXCLUDE_CURVES 0x80 #define INCLUDE_EASY 0x100 #define INCLUDE_NORMAL 0x200 #define INCLUDE_HARD 0x400 #define INCLUDE_DEATHMATCH 0x800 #define EXCLUDE_HINT 0x1000 #define EXCLUDE_WAYPOINTS 0x2000 #define EXCLUDE_MISCMODELS 0x4000 #define EXCLUDE_MISCMODELBREAKABLES 0x8000 #define EXCLUDE_TARGETSPEAKERS 0x10000 #define EXCLUDE_REFTAGS 0x20000 #define EXCLUDE_MISCMODELXXXX 0x40000 #define SHOW_GROUPNAMES 0x80000 // a bit misleading, this is used elsewhere than the show/hide menu, but I'm not sure of the side effects of adding to the QE globals structure (invalidate user prefs etc?) and I only need one bit, so... #define SHOW_WAYPOINTS_ONLY 0x100000 // this IS used in view/show, but it's not a single exclude, nor an include in the normal sense #define EXCLUDE_TRIGGERXXXX 0x200000 #define EXCLUDE_NONSOLID 0x400000 #define EXCLUDE_EASY 0x800000 #define EXCLUDE_MEDIUM 0x1000000 #define EXCLUDE_HARD 0x2000000 #define EXCLUDE_ALL_EXCEPT_DETAIL 0x4000000 #define EXCLUDE_FUNC_GROUP 0x8000000 #define EXCLUDE_LIGHTS_RADII 0x10000000 #define SHOW_CURVES_ONLY 0x20000000 // // menu indexes for modifying menus // #define MENU_VIEW 2 #define MENU_BSP 4 #define MENU_TEXTURE 6 #define MENU_PLUGIN 11 // odd things not in windows header... #define VK_COMMA 188 #define VK_PERIOD 190 /* ** window bits */ #define W_CAMERA 0x0001 #define W_XY 0x0002 #define W_XY_OVERLAY 0x0004 #define W_Z 0x0008 #define W_TEXTURE 0x0010 #define W_Z_OVERLAY 0x0020 #define W_CONSOLE 0x0040 #define W_ENTITY 0x0080 #define W_CAMERA_IFON 0x0100 #define W_XZ 0x0200 //--| only used for patch vertex manip stuff #define W_YZ 0x0400 //--| #define W_ALL 0xFFFFFFFF #define COLOR_TEXTUREBACK 0 #define COLOR_GRIDBACK 1 #define COLOR_GRIDMINOR 2 #define COLOR_GRIDMAJOR 3 #define COLOR_CAMERABACK 4 #define COLOR_ENTITY 5 #define COLOR_GRIDBLOCK 6 #define COLOR_GRIDTEXT 7 #define COLOR_BRUSHES 8 #define COLOR_SELBRUSHES 9 #define COLOR_CLIPPER 10 #define COLOR_VIEWNAME 11 #define COLOR_LAST 12 // classes #define ENTITY_WIREFRAME 0x00001 #define ENTITY_SKIN_MODEL 0x00010 #define ENTITY_SELECTED_ONLY 0x00100 #define ENTITY_BOXED 0x01000 // menu settings #define ENTITY_BOX 0x01000 #define ENTITY_WIRE 0x00001 #define ENTITY_SELECTED 0x00101 #define ENTITY_SKINNED 0x00010 #define ENTITY_SKINNED_BOXED 0x01010 #define ENTITY_SELECTED_SKIN 0x00110 #endif
/* * Copyright (C) 2013 Freescale Semiconductor, Inc. * * Configuration settings for Udoo board. * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #include "mx6_common.h" #include <asm/arch/imx-regs.h> #include <asm/imx-common/gpio.h> #include <linux/sizes.h> #define CONFIG_MX6 #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO #define MACH_TYPE_UDOO 4800 #define CONFIG_MACH_TYPE MACH_TYPE_UDOO #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (2 * SZ_1M) #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_MXC_GPIO #define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART2_BASE /* SATA Configs */ #define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 #define CONFIG_DWC_AHSATA_PORT_ID 0 #define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR #define CONFIG_LBA48 #define CONFIG_LIBATA #endif /* Network support */ #define CONFIG_CMD_PING #define CONFIG_CMD_DHCP #define CONFIG_CMD_MII #define CONFIG_CMD_NET #define CONFIG_FEC_MXC #define CONFIG_MII #define IMX_FEC_BASE ENET_BASE_ADDR #define CONFIG_FEC_XCV_TYPE RGMII #define CONFIG_ETHPRIME "FEC" #define CONFIG_FEC_MXC_PHYADDR 6 #define CONFIG_PHYLIB #define CONFIG_PHY_MICREL #define CONFIG_PHY_MICREL_KSZ9031 /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE #define CONFIG_CONS_INDEX 1 #define CONFIG_BAUDRATE 115200 /* Command definition */ #include <config_cmd_default.h> #undef CONFIG_CMD_IMLS #define CONFIG_CMD_BMODE #define CONFIG_CMD_SETEXPR #define CONFIG_BOOTDELAY 3 #define CONFIG_SYS_MEMTEST_START 0x10000000 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) #define CONFIG_LOADADDR 0x12000000 #define CONFIG_SYS_TEXT_BASE 0x17800000 /* MMC Configuration */ #define CONFIG_FSL_ESDHC #define CONFIG_FSL_USDHC #define CONFIG_SYS_FSL_ESDHC_ADDR 0 #define CONFIG_MMC #define CONFIG_CMD_MMC #define CONFIG_GENERIC_MMC #define CONFIG_BOUNCE_BUFFER #define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION #define CONFIG_DEFAULT_FDT_FILE "imx6q-udoo.dtb" #define CONFIG_EXTRA_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc1\0" \ "splashpos=m,m\0" \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ "fdt_addr=0x18000000\0" \ "boot_fdt=try\0" \ "ip_dyn=yes\0" \ "mmcdev=0\0" \ "mmcpart=1\0" \ "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ "update_sd_firmware_filename=u-boot.imx\0" \ "update_sd_firmware=" \ "if test ${ip_dyn} = yes; then " \ "setenv get_cmd dhcp; " \ "else " \ "setenv get_cmd tftp; " \ "fi; " \ "if mmc dev ${mmcdev}; then " \ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ "setexpr fw_sz ${filesize} / 0x200; " \ "setexpr fw_sz ${fw_sz} + 1; " \ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ "fi; " \ "fi\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=${mmcroot}\0" \ "loadbootscript=" \ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ "source\0" \ "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ "mmcboot=echo Booting from mmc ...; " \ "run mmcargs; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if run loadfdt; then " \ "bootz ${loadaddr} - ${fdt_addr}; " \ "else " \ "if test ${boot_fdt} = try; then " \ "bootz; " \ "else " \ "echo WARN: Cannot load the DT; " \ "fi; " \ "fi; " \ "else " \ "bootz; " \ "fi;\0" \ "netargs=setenv bootargs console=${console},${baudrate} " \ "root=/dev/nfs " \ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ "netboot=echo Booting from net ...; " \ "run netargs; " \ "if test ${ip_dyn} = yes; then " \ "setenv get_cmd dhcp; " \ "else " \ "setenv get_cmd tftp; " \ "fi; " \ "${get_cmd} ${image}; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ "bootz ${loadaddr} - ${fdt_addr}; " \ "else " \ "if test ${boot_fdt} = try; then " \ "bootz; " \ "else " \ "echo WARN: Cannot load the DT; " \ "fi; " \ "fi; " \ "else " \ "bootz; " \ "fi;\0" #define CONFIG_BOOTCOMMAND \ "mmc dev ${mmcdev}; if mmc rescan; then " \ "if run loadbootscript; then " \ "run bootscript; " \ "else " \ "if run loadimage; then " \ "run mmcboot; " \ "else run netboot; " \ "fi; " \ "fi; " \ "else run netboot; fi" /* Miscellaneous configurable options */ #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_HUSH_PARSER #define CONFIG_SYS_PROMPT "=> " #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_CBSIZE 256 /* Print Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) #define CONFIG_SYS_MAXARGS 16 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR #define CONFIG_CMDLINE_EDITING /* Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 1 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE #define CONFIG_SYS_INIT_SP_OFFSET \ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) /* FLASH and environment organization */ #define CONFIG_SYS_NO_FLASH #define CONFIG_ENV_SIZE (8 * 1024) #define CONFIG_ENV_IS_IN_MMC #define CONFIG_ENV_OFFSET (6 * 64 * 1024) #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_OF_LIBFDT #define CONFIG_CMD_BOOTZ #ifndef CONFIG_SYS_DCACHE_OFF #define CONFIG_CMD_CACHE #endif #endif /* __CONFIG_H * */
/** @file Defines DiskImage - the view of the file that is visible at any point, as well as the event handlers for editing the file Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _LIB_DISK_IMAGE_H_ #define _LIB_DISK_IMAGE_H_ #include "HexEditor.h" /** Initialization function for HDiskImage. @retval EFI_SUCCESS The operation was successful. @retval EFI_LOAD_ERROR A load error occured. **/ EFI_STATUS HDiskImageInit ( VOID ); /** Cleanup function for HDiskImage. @retval EFI_SUCCESS The operation was successful. **/ EFI_STATUS HDiskImageCleanup ( VOID ); /** Backup function for HDiskImage. Only a few fields need to be backup. This is for making the Disk buffer refresh as few as possible. @retval EFI_SUCCESS The operation was successful. @retval EFI_OUT_OF_RESOURCES gST->ConOut of resources. **/ EFI_STATUS HDiskImageBackup ( VOID ); /** Read a disk from disk into HBufferImage. @param[in] DeviceName filename to read. @param[in] Offset The offset. @param[in] Size The size. @param[in] Recover if is for recover, no information print. @retval EFI_SUCCESS The operation was successful. @retval EFI_OUT_OF_RESOURCES A memory allocation failed. @retval EFI_LOAD_ERROR A load error occured. @retval EFI_INVALID_PARAMETER A parameter was invalid. **/ EFI_STATUS HDiskImageRead ( IN CONST CHAR16 *DeviceName, IN UINTN Offset, IN UINTN Size, IN BOOLEAN Recover ); /** Save lines in HBufferImage to disk. NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!! @param[in] DeviceName The device name. @param[in] Offset The offset. @param[in] Size The size. @retval EFI_SUCCESS The operation was successful. @retval EFI_OUT_OF_RESOURCES A memory allocation failed. @retval EFI_LOAD_ERROR A load error occured. @retval EFI_INVALID_PARAMETER A parameter was invalid. **/ EFI_STATUS HDiskImageSave ( IN CHAR16 *DeviceName, IN UINTN Offset, IN UINTN Size ); #endif
/*************************************************************************** ---------------------------------------------------- date : 18.8.2015 copyright : (C) 2015 by Matthias Kuhn email : matthias (at) opengis.ch *************************************************************************** * * * 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 QGSWELCOMEDIALOG_H #define QGSWELCOMEDIALOG_H #include <QWidget> #include <QLabel> #include "qgswelcomepageitemsmodel.h" class QgsVersionInfo; class QListView; class QgsWelcomePage : public QWidget { Q_OBJECT public: explicit QgsWelcomePage( bool skipVersionCheck = false, QWidget *parent = nullptr ); ~QgsWelcomePage() override; void setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData> &recentProjects ); signals: void projectRemoved( int row ); void projectPinned( int row ); void projectUnpinned( int row ); private slots: void itemActivated( const QModelIndex &index ); void versionInfoReceived(); void showContextMenuForProjects( QPoint point ); private: QgsWelcomePageItemsModel *mModel = nullptr; QLabel *mVersionInformation = nullptr; QgsVersionInfo *mVersionInfo = nullptr; QListView *mRecentProjectsListView = nullptr; }; #endif // QGSWELCOMEDIALOG_H
/* Test program, used by the gettext-7 test. Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <haible@clisp.cons.org>, 2005. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <locale.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #if USE_POSIX_THREADS && ((__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __APPLE__ && defined __MACH__)) && HAVE_USELOCALE #include <pthread.h> /* Make sure we use the included libintl, not the system's one. */ #undef _LIBINTL_H #include "libgnuintl.h" /* Name of German locale in ISO-8859-1 or ISO-8859-15 encoding. */ #if __GLIBC__ >= 2 # define LOCALE_DE_ISO8859 "de_DE.ISO-8859-1" #elif defined __APPLE__ && defined __MACH__ /* MacOS X */ # define LOCALE_DE_ISO8859 "de_DE.ISO8859-1" #else # define LOCALE_DE_ISO8859 "de_DE" #endif /* Name of German locale in UTF-8 encoding. */ #define LOCALE_DE_UTF8 "de_DE.UTF-8" /* Set to 1 if the program is not behaving correctly. */ int result; /* Denotes which thread should run next. */ int flipflop; /* Lock and wait queue used to switch between the threads. */ pthread_mutex_t lock; pthread_cond_t waitqueue; /* Waits until the flipflop has a given value. Before the call, the lock is unlocked. After the call, it is locked. */ static void waitfor (int value) { if (pthread_mutex_lock (&lock)) exit (10); while (flipflop != value) if (pthread_cond_wait (&waitqueue, &lock)) exit (11); } /* Sets the flipflop to a given value. Before the call, the lock is locked. After the call, it is unlocked. */ static void setto (int value) { flipflop = value; if (pthread_cond_signal (&waitqueue)) exit (20); if (pthread_mutex_unlock (&lock)) exit (21); } void * thread1_execution (void *arg) { char *s; waitfor (1); uselocale (newlocale (LC_ALL_MASK, LOCALE_DE_ISO8859, NULL)); setto (2); /* Here we expect output in ISO-8859-1. */ waitfor (1); s = gettext ("cheese"); puts (s); if (strcmp (s, "K\344se")) { fprintf (stderr, "thread 1 call 1 returned: %s\n", s); result = 1; } setto (2); waitfor (1); s = gettext ("cheese"); puts (s); if (strcmp (s, "K\344se")) { fprintf (stderr, "thread 1 call 2 returned: %s\n", s); result = 1; } setto (2); return NULL; } void * thread2_execution (void *arg) { char *s; waitfor (2); uselocale (newlocale (LC_ALL_MASK, LOCALE_DE_UTF8, NULL)); setto (1); /* Here we expect output in UTF-8. */ waitfor (2); s = gettext ("cheese"); puts (s); if (strcmp (s, "K\303\244se")) { fprintf (stderr, "thread 2 call 1 returned: %s\n", s); result = 1; } setto (1); waitfor (2); s = gettext ("cheese"); puts (s); if (strcmp (s, "K\303\244se")) { fprintf (stderr, "thread 2 call 2 returned: %s\n", s); result = 1; } setto (1); return NULL; } static void check_locale_exists (const char *name) { if (newlocale (LC_ALL_MASK, name, NULL) == NULL) { printf ("%s\n", name); exit (1); } } int main (int argc, char *argv[]) { int arg; pthread_t thread1; pthread_t thread2; arg = (argc > 1 ? atoi (argv[1]) : 0); switch (arg) { case 1: /* Check for the existence of the first locale. */ check_locale_exists (LOCALE_DE_ISO8859); /* Check for the existence of the second locale. */ check_locale_exists (LOCALE_DE_UTF8); return 0; default: break; } unsetenv ("LANGUAGE"); unsetenv ("OUTPUT_CHARSET"); textdomain ("tstthread"); bindtextdomain ("tstthread", "gt-7"); result = 0; flipflop = 1; if (pthread_mutex_init (&lock, NULL)) exit (2); if (pthread_cond_init (&waitqueue, NULL)) exit (2); if (pthread_create (&thread1, NULL, &thread1_execution, NULL)) exit (2); if (pthread_create (&thread2, NULL, &thread2_execution, NULL)) exit (2); if (pthread_join (thread2, NULL)) exit (3); return result; } #else /* This test is not executed. */ int main (void) { return 77; } #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ #include "base/basictypes.h" #include "chrome/browser/history/url_database.h" #include "chrome/browser/history/visit_database.h" #include "sql/connection.h" #include "sql/init_status.h" #include "sql/meta_table.h" namespace base { class FilePath; } namespace history { // Encapsulates the database operations for archived history. // // IMPORTANT NOTE: The IDs in this system for URLs and visits will be // different than those in the main database. This is to eliminate the // dependency between them so we can deal with each one on its own. class ArchivedDatabase : public URLDatabase, public VisitDatabase { public: // Must call Init() before using other members. ArchivedDatabase(); virtual ~ArchivedDatabase(); // Initializes the database connection. This must return true before any other // functions on this class are called. bool Init(const base::FilePath& file_name); // Transactions on the database. We support nested transactions and only // commit when the outermost one is committed (sqlite doesn't support true // nested transactions). void BeginTransaction(); void CommitTransaction(); // Returns the current version that we will generate archived databases with. static int GetCurrentVersion(); private: bool InitTables(); // Implemented for the specialized databases. virtual sql::Connection& GetDB() OVERRIDE; // Makes sure the version is up-to-date, updating if necessary. If the // database is too old to migrate, the user will be notified. In this case, or // for other errors, false will be returned. True means it is up-to-date and // ready for use. // // This assumes it is called from the init function inside a transaction. It // may commit the transaction and start a new one if migration requires it. sql::InitStatus EnsureCurrentVersion(); // The database. sql::Connection db_; sql::MetaTable meta_table_; DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); }; } // namespace history #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_
//===----------------------------------------------------------------------===// // // Peloton // // sdbench_loader.h // // Identification: src/include/benchmark/sdbench/sdbench_loader.h // // Copyright (c) 2015-16, Carnegie Mellon University Database Group // //===----------------------------------------------------------------------===// #pragma once #include "benchmark/sdbench/sdbench_configuration.h" namespace peloton { namespace benchmark { namespace sdbench { extern configuration state; extern std::unique_ptr<storage::DataTable> sdbench_table; void CreateTable(); void LoadTable(); void CreateAndLoadTable(LayoutType layout_type); void DropIndexes(); } // namespace sdbench } // namespace benchmark } // namespace peloton
#include "../../../src/xmlpatterns/expr/qtemplateparameterreference_p.h"
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2007-2009, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of Image Engine Design nor the names of any // other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #ifndef IE_CORE_TIMEPERIODPARAMETER_H #define IE_CORE_TIMEPERIODPARAMETER_H #include "IECore/TimePeriodData.h" #include "IECore/TypedParameter.h" namespace IECore { typedef TypedParameter<TimePeriod> TimePeriodParameter; IE_CORE_DECLAREPTR( TimePeriodParameter ); } #endif // IE_CORE_TIMEPERIODPARAMETER_H
/* * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Id: strerror.h,v 1.10 2008/12/01 23:47:45 tbox Exp $ */ #ifndef ISC_STRERROR_H #define ISC_STRERROR_H /*! \file */ #include <sys/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*% String Error Size */ #define ISC_STRERRORSIZE 128 /*% * Provide a thread safe wrapper to strerror(). * * Requires: * 'buf' to be non NULL. */ void isc__strerror(int num, char *buf, size_t bufsize); ISC_LANG_ENDDECLS #endif /* ISC_STRERROR_H */
/* Native-dependent code for SPARC. Copyright (C) 2003-2016 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SPARC_NAT_H #define SPARC_NAT_H 1 struct sparc_gregmap; struct sparc_fpregmap; extern const struct sparc_gregmap *sparc_gregmap; extern const struct sparc_fpregmap *sparc_fpregmap; extern void (*sparc_supply_gregset) (const struct sparc_gregmap *, struct regcache *, int , const void *); extern void (*sparc_collect_gregset) (const struct sparc_gregmap *, const struct regcache *, int, void *); extern void (*sparc_supply_fpregset) (const struct sparc_fpregmap *, struct regcache *, int , const void *); extern void (*sparc_collect_fpregset) (const struct sparc_fpregmap *, const struct regcache *, int , void *); extern int (*sparc_gregset_supplies_p) (struct gdbarch *gdbarch, int); extern int (*sparc_fpregset_supplies_p) (struct gdbarch *gdbarch, int); extern int sparc32_gregset_supplies_p (struct gdbarch *gdbarch, int regnum); extern int sparc32_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum); /* Create a prototype generic SPARC target. The client can override it with local methods. */ extern struct target_ops *sparc_target (void); extern void sparc_fetch_inferior_registers (struct target_ops *, struct regcache *, int); extern void sparc_store_inferior_registers (struct target_ops *, struct regcache *, int); #endif /* sparc-nat.h */
/** * @file * * mpudr2.c * * Platform specific settings for DR DDR2 U-DIMM system * * @xrefitem bom "File Content Label" "Release Content" * @e project: AGESA * @e sub-project: (Mem/Ps) * @e \$Revision: 8446 $ @e \$Date: 2008-09-23 10:52:09 -0500 (Tue, 23 Sep 2008) $ * **/ /***************************************************************************** * * Copyright (c) 2011, Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Advanced Micro Devices, Inc. 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 ADVANCED MICRO DEVICES, INC. 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. * * *************************************************************************** * */ /* This file contains routine that add platform specific support L1 */ #include "AGESA.h" #include "AdvancedApi.h" #include "mport.h" #include "PlatformMemoryConfiguration.h" #include "ma.h" #include "Ids.h" #include "cpuFamRegisters.h" #include "mm.h" #include "mn.h" #include "mp.h" #include "Filecode.h" #define FILECODE PROC_MEM_PS_DR_MPUDR2_FILECODE /*---------------------------------------------------------------------------- * DEFINITIONS AND MACROS * *---------------------------------------------------------------------------- */ /*---------------------------------------------------------------------------- * TYPEDEFS AND STRUCTURES * *---------------------------------------------------------------------------- */ /*---------------------------------------------------------------------------- * PROTOTYPES OF LOCAL FUNCTIONS * *---------------------------------------------------------------------------- */ BOOLEAN STATIC MemPDoPsUDr2 ( IN OUT MEM_NB_BLOCK *NBPtr ); /* *----------------------------------------------------------------------------- * EXPORTED FUNCTIONS * *----------------------------------------------------------------------------- */ STATIC CONST DRAM_TERM_ENTRY DrUDdr2DramTerm[] = { {DDR400 + DDR533 + DDR667, ONE_DIMM, ANY_NUM, 1, 0, 0}, {DDR400 + DDR533, TWO_DIMM + THREE_DIMM + FOUR_DIMM, ANY_NUM, 1, 0, 0}, {DDR667, TWO_DIMM + THREE_DIMM, ANY_NUM, 1, 0, 0}, {DDR667, FOUR_DIMM, ANY_NUM, 3, 0, 0}, {DDR800, ONE_DIMM, ANY_NUM, 1, 0, 0}, {DDR800, TWO_DIMM + THREE_DIMM + FOUR_DIMM, ANY_NUM, 3, 0, 0}, {DDR1066, ONE_DIMM, ANY_NUM, 1, 0, 0} }; /* -----------------------------------------------------------------------------*/ /** * * This function is the constructor platform specific settings for U DIMM-DDR2 DR DDR2 * * @param[in,out] *MemPtr Pointer to MEM_DATA_STRUCTURE * @param[in,out] *ChannelPtr Pointer to CH_DEF_STRUCT * @param[in,out] *PsPtr Pointer to MEM_PS_BLOCK * * @return AGESA_SUCCESS * */ AGESA_STATUS MemPConstructPsUDr2 ( IN OUT MEM_DATA_STRUCT *MemPtr, IN OUT CH_DEF_STRUCT *ChannelPtr, IN OUT MEM_PS_BLOCK *PsPtr ) { ASSERT (MemPtr != 0); ASSERT (ChannelPtr != 0); if ((ChannelPtr->MCTPtr->LogicalCpuid.Family & AMD_FAMILY_10_RB) == 0) { return AGESA_UNSUPPORTED; } if (ChannelPtr->TechType != DDR2_TECHNOLOGY) { return AGESA_UNSUPPORTED; } if ((ChannelPtr->RegDimmPresent != 0) || (ChannelPtr->SODimmPresent != 0)) { return AGESA_UNSUPPORTED; } PsPtr->MemPDoPs = MemPDoPsUDr2; PsPtr->MemPGetPORFreqLimit = MemPGetPORFreqLimitDef; return AGESA_SUCCESS; } /* -----------------------------------------------------------------------------*/ /** * * This is function sets the platform specific settings for U-DDR2 DR DDR2 * * @param[in,out] *NBPtr Pointer to MEM_NB_BLOCK * * @return TRUE - Find settings for corresponding platform and dimm population. * @return FALSE - Fail to find settings for corresponding platform and dimm population. * */ BOOLEAN STATIC MemPDoPsUDr2 ( IN OUT MEM_NB_BLOCK *NBPtr ) { if (!MemPGetDramTerm (NBPtr, GET_SIZE_OF (DrUDdr2DramTerm), DrUDdr2DramTerm)) { return FALSE; } return TRUE; }
/* * (C) 2007-2010 TaoBao Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * ob_client_proxy.h is for what ... * * Version: $id$ * * Authors: * MaoQi maoqi@taobao.com * */ #ifndef OCEANBASE_COMMON_OB_CLIENT_PROXY_H_ #define OCEANBASE_COMMON_OB_CLIENT_PROXY_H_ #include <stdint.h> #include "ob_mutator.h" #include "ob_server.h" #include "ob_scanner.h" #include "ob_ms_list.h" namespace oceanbase { namespace common { class ObClientManager; class ThreadSpecificBuffer; class ObScanParam; class ObGetParam; class ObClientProxy { public: ObClientProxy(); virtual ~ObClientProxy(); void init(ObClientManager* client_manager, ThreadSpecificBuffer *thread_buffer, MsList* ms_list, int64_t timeout); virtual int scan(const ObScanParam& scan_param,ObScanner& scanner); virtual int apply(const ObMutator& mutator); virtual int get(const ObGetParam& get_param,ObScanner& scanner); private: int scan(const ObServer& server,const ObScanParam& scan_param,ObScanner& scanner); int get(const ObServer& server,const ObGetParam& get_param,ObScanner& scanner); private: int get_thread_buffer_(ObDataBuffer& data_buff); private: bool inited_; ObClientManager* client_manager_; ThreadSpecificBuffer* thread_buffer_; int64_t timeout_; MsList* ms_list_; }; } /* common */ } /* oceanbase */ #endif
/* * linux/drivers/video/fb_notify.c * * Copyright (C) 2006 Antonino Daplas <adaplas@pol.net> * * 2001 - Documented with DocBook * - Brad Douglas <brad@neruo.com> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #include <linux/fb.h> #include <linux/notifier.h> static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); /** * fb_register_client - register a client notifier * @nb: notifier block to callback on events */ int fb_register_client(struct notifier_block *nb) { return blocking_notifier_chain_register(&fb_notifier_list, nb); } EXPORT_SYMBOL(fb_register_client); /** * fb_unregister_client - unregister a client notifier * @nb: notifier block to callback on events */ int fb_unregister_client(struct notifier_block *nb) { return blocking_notifier_chain_unregister(&fb_notifier_list, nb); } EXPORT_SYMBOL(fb_unregister_client); /** * fb_notifier_call_chain - notify clients of fb_events * */ int fb_notifier_call_chain(unsigned long val, void *v) { printk("%s(%d): val= 0x%x+-\n", __FUNCTION__, __LINE__, val); return blocking_notifier_call_chain(&fb_notifier_list, val, v); } EXPORT_SYMBOL_GPL(fb_notifier_call_chain);
// mdc.h - written and placed in the public domain by Wei Dai #ifndef CRYPTOPP_MDC_H #define CRYPTOPP_MDC_H /** \file */ #include "seckey.h" #include "secblock.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) //! _ template <class T> struct MDC_Info : public FixedBlockSize<T::DIGESTSIZE>, public FixedKeyLength<T::BLOCKSIZE> { static std::string StaticAlgorithmName() {return std::string("MDC/")+T::StaticAlgorithmName();} }; //! <a href="http://www.weidai.com/scan-mirror/cs.html#MDC">MDC</a> /*! a construction by Peter Gutmann to turn an iterated hash function into a PRF */ template <class T> class MDC : public MDC_Info<T> { class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl<MDC_Info<T> > { typedef typename T::HashWordType HashWordType; public: void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params) { this->AssertValidKeyLength(length); memcpy_s(m_key, m_key.size(), userKey, this->KEYLENGTH); T::CorrectEndianess(Key(), Key(), this->KEYLENGTH); } void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { T::CorrectEndianess(Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); T::Transform(Buffer(), Key()); if (xorBlock) { T::CorrectEndianess(Buffer(), Buffer(), this->BLOCKSIZE); xorbuf(outBlock, xorBlock, m_buffer, this->BLOCKSIZE); } else T::CorrectEndianess((HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); } bool IsPermutation() const {return false;} unsigned int OptimalDataAlignment() const {return sizeof(HashWordType);} private: HashWordType *Key() {return (HashWordType *)m_key.data();} const HashWordType *Key() const {return (const HashWordType *)m_key.data();} HashWordType *Buffer() const {return (HashWordType *)m_buffer.data();} // VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup FixedSizeSecBlock<byte, MDC_Info<T>::KEYLENGTH, AllocatorWithCleanup<byte> > m_key; mutable FixedSizeSecBlock<byte, MDC_Info<T>::BLOCKSIZE, AllocatorWithCleanup<byte> > m_buffer; }; public: //! use BlockCipher interface typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption; }; NAMESPACE_END #endif
//===- llvm-pdbutil.h ----------------------------------------- *- C++ --*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H #define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H #include "llvm/ADT/Optional.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" #include <memory> #include <stdint.h> namespace llvm { namespace pdb { class PDBSymbolData; class PDBSymbolFunc; uint32_t getTypeLength(const PDBSymbolData &Symbol); } } namespace opts { enum class DumpLevel { None, Basic, Verbose }; enum class ModuleSubsection { Unknown, Lines, FileChecksums, InlineeLines, CrossScopeImports, CrossScopeExports, StringTable, Symbols, FrameData, CoffSymbolRVAs, All }; namespace pretty { enum class ClassDefinitionFormat { None, Layout, All }; enum class ClassSortMode { None, Name, Size, Padding, PaddingPct, PaddingImmediate, PaddingPctImmediate }; enum class SymbolSortMode { None, Name, Size }; enum class SymLevel { Functions, Data, Thunks, All }; bool shouldDumpSymLevel(SymLevel Level); bool compareFunctionSymbols( const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F1, const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F2); bool compareDataSymbols(const std::unique_ptr<llvm::pdb::PDBSymbolData> &F1, const std::unique_ptr<llvm::pdb::PDBSymbolData> &F2); extern llvm::cl::opt<bool> Compilands; extern llvm::cl::opt<bool> Symbols; extern llvm::cl::opt<bool> Globals; extern llvm::cl::opt<bool> Classes; extern llvm::cl::opt<bool> Enums; extern llvm::cl::opt<bool> Typedefs; extern llvm::cl::opt<bool> All; extern llvm::cl::opt<bool> ExcludeCompilerGenerated; extern llvm::cl::opt<bool> NoEnumDefs; extern llvm::cl::list<std::string> ExcludeTypes; extern llvm::cl::list<std::string> ExcludeSymbols; extern llvm::cl::list<std::string> ExcludeCompilands; extern llvm::cl::list<std::string> IncludeTypes; extern llvm::cl::list<std::string> IncludeSymbols; extern llvm::cl::list<std::string> IncludeCompilands; extern llvm::cl::opt<SymbolSortMode> SymbolOrder; extern llvm::cl::opt<ClassSortMode> ClassOrder; extern llvm::cl::opt<uint32_t> SizeThreshold; extern llvm::cl::opt<uint32_t> PaddingThreshold; extern llvm::cl::opt<uint32_t> ImmediatePaddingThreshold; extern llvm::cl::opt<ClassDefinitionFormat> ClassFormat; extern llvm::cl::opt<uint32_t> ClassRecursionDepth; } namespace bytes { struct NumberRange { uint64_t Min; llvm::Optional<uint64_t> Max; }; extern llvm::Optional<NumberRange> DumpBlockRange; extern llvm::Optional<NumberRange> DumpByteRange; extern llvm::cl::list<std::string> DumpStreamData; extern llvm::cl::opt<bool> NameMap; extern llvm::cl::opt<bool> SectionContributions; extern llvm::cl::opt<bool> SectionMap; extern llvm::cl::opt<bool> ModuleInfos; extern llvm::cl::opt<bool> FileInfo; extern llvm::cl::opt<bool> TypeServerMap; extern llvm::cl::opt<bool> ECData; extern llvm::cl::list<uint32_t> TypeIndex; extern llvm::cl::list<uint32_t> IdIndex; extern llvm::cl::opt<uint32_t> ModuleIndex; extern llvm::cl::opt<bool> ModuleSyms; extern llvm::cl::opt<bool> ModuleC11; extern llvm::cl::opt<bool> ModuleC13; extern llvm::cl::opt<bool> SplitChunks; } // namespace bytes namespace dump { extern llvm::cl::opt<bool> DumpSummary; extern llvm::cl::opt<bool> DumpStreams; extern llvm::cl::opt<bool> DumpStreamBlocks; extern llvm::cl::opt<bool> DumpLines; extern llvm::cl::opt<bool> DumpInlineeLines; extern llvm::cl::opt<bool> DumpXmi; extern llvm::cl::opt<bool> DumpXme; extern llvm::cl::opt<bool> DumpStringTable; extern llvm::cl::opt<bool> DumpTypes; extern llvm::cl::opt<bool> DumpTypeData; extern llvm::cl::opt<bool> DumpTypeExtras; extern llvm::cl::list<uint32_t> DumpTypeIndex; extern llvm::cl::opt<bool> DumpTypeDependents; extern llvm::cl::opt<bool> DumpIds; extern llvm::cl::opt<bool> DumpIdData; extern llvm::cl::opt<bool> DumpIdExtras; extern llvm::cl::list<uint32_t> DumpIdIndex; extern llvm::cl::opt<bool> DumpSymbols; extern llvm::cl::opt<bool> DumpSymRecordBytes; extern llvm::cl::opt<bool> DumpPublics; extern llvm::cl::opt<bool> DumpSectionContribs; extern llvm::cl::opt<bool> DumpSectionMap; extern llvm::cl::opt<bool> DumpModules; extern llvm::cl::opt<bool> DumpModuleFiles; extern llvm::cl::opt<bool> RawAll; } namespace pdb2yaml { extern llvm::cl::opt<bool> All; extern llvm::cl::opt<bool> NoFileHeaders; extern llvm::cl::opt<bool> Minimal; extern llvm::cl::opt<bool> StreamMetadata; extern llvm::cl::opt<bool> StreamDirectory; extern llvm::cl::opt<bool> StringTable; extern llvm::cl::opt<bool> PdbStream; extern llvm::cl::opt<bool> DbiStream; extern llvm::cl::opt<bool> TpiStream; extern llvm::cl::opt<bool> IpiStream; extern llvm::cl::list<std::string> InputFilename; extern llvm::cl::opt<bool> DumpModules; extern llvm::cl::opt<bool> DumpModuleFiles; extern llvm::cl::list<ModuleSubsection> DumpModuleSubsections; extern llvm::cl::opt<bool> DumpModuleSyms; } // namespace pdb2yaml namespace diff { extern llvm::cl::opt<bool> PrintValueColumns; extern llvm::cl::opt<bool> PrintResultColumn; extern llvm::cl::opt<std::string> LeftRoot; extern llvm::cl::opt<std::string> RightRoot; } // namespace diff } #endif
/* * Copyright (c) 2019 Winner Microelectronics Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-09-15 flyingcys 1st version */ #ifndef __DRV_UART_H__ #define __DRV_UART_H__ int wm_hw_uart_init(void); #endif /* __DRV_UART_H__ */
/** * @file * * @brief RTEMS Register IO Name * @ingroup ClassicIO */ /* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * * Modifications to support reference counting in the file system are * Copyright (c) 2012 embedded brains GmbH. * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <sys/stat.h> #include <string.h> #include <rtems/libio_.h> rtems_status_code rtems_io_register_name( const char *device_name, rtems_device_major_number major, rtems_device_minor_number minor ) { int status; dev_t dev; dev = rtems_filesystem_make_dev_t( major, minor ); status = mknod( device_name, 0777 | S_IFCHR, dev ); /* this is the only error returned by the old version */ if ( status ) return RTEMS_TOO_MANY; return RTEMS_SUCCESSFUL; } rtems_status_code rtems_io_lookup_name( const char *name, rtems_driver_name_t *device_info ) { rtems_status_code sc = RTEMS_SUCCESSFUL; struct stat st; int rv = stat( name, &st ); if ( rv == 0 && S_ISCHR( st.st_mode ) ) { device_info->device_name = name; device_info->device_name_length = strlen( name ); device_info->major = rtems_filesystem_dev_major_t( st.st_rdev ); device_info->minor = rtems_filesystem_dev_minor_t( st.st_rdev ); } else { sc = RTEMS_UNSATISFIED; } return sc; }
/*************************************************************************** qgswmtsutils.h Define WMTS service utility functions ------------------------------------ begin : July 23 , 2017 copyright : (C) 2018 by René-Luc D'Hont email : rldhont at 3liz dot com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSWMTSUTILS_H #define QGSWMTSUTILS_H #include "qgsmodule.h" #include "qgswmtsparameters.h" #include "qgswmtsserviceexception.h" #include "qgsserversettings.h" #include "qgsunittypes.h" #include "qgsrectangle.h" #include <QDomDocument> /** * \ingroup server * \brief WMTS implementation * \since QGIS 3.4 */ //! WMTS implementation namespace QgsWmts { struct tileMatrixInfo { QString ref; QgsRectangle extent; QgsUnitTypes::DistanceUnit unit = QgsUnitTypes::DistanceMeters; bool hasAxisInverted = false; double resolution = 0.0; double scaleDenominator = 0.0; int lastLevel = -1; }; struct tileMatrixDef { double resolution = 0.0; double scaleDenominator = 0.0; int col = 0; int row = 0; double left = 0.0; double top = 0.0; }; struct tileMatrixSetDef { QString ref; QgsRectangle extent; QgsUnitTypes::DistanceUnit unit; bool hasAxisInverted = false; QList< tileMatrixDef > tileMatrixList; }; struct tileMatrixLimitDef { int minCol; int maxCol; int minRow; int maxRow; }; struct tileMatrixSetLinkDef { QString ref; QMap< int, tileMatrixLimitDef > tileMatrixLimits; }; struct layerDef { QString id; QString title; QString abstract; QgsRectangle wgs84BoundingRect; QStringList formats; bool queryable = false; double maxScale = 0.0; double minScale = 0.0; }; /** * Returns the highest version supported by this implementation */ QString implementationVersion(); /** * Service URL string */ QString serviceUrl( const QgsServerRequest &request, const QgsProject *project, const QgsServerSettings &settings ); // Define namespaces used in WMTS documents const QString WMTS_NAMESPACE = QStringLiteral( "http://www.opengis.net/wmts/1.0" ); const QString GML_NAMESPACE = QStringLiteral( "http://www.opengis.net/gml" ); const QString OWS_NAMESPACE = QStringLiteral( "http://www.opengis.net/ows/1.1" ); tileMatrixInfo calculateTileMatrixInfo( const QString &crsStr, const QgsProject *project ); tileMatrixSetDef calculateTileMatrixSet( tileMatrixInfo tmi, double minScale ); double getProjectMinScale( const QgsProject *project ); QList< tileMatrixSetDef > getTileMatrixSetList( const QgsProject *project, const QString &tms_ref = QString() ); QList< layerDef > getWmtsLayerList( QgsServerInterface *serverIface, const QgsProject *project ); tileMatrixSetLinkDef getLayerTileMatrixSetLink( const layerDef layer, const tileMatrixSetDef tms, const QgsProject *project ); /** * Translate WMTS parameters to WMS query item */ QUrlQuery translateWmtsParamToWmsQueryItem( const QString &request, const QgsWmtsParameters &params, const QgsProject *project, QgsServerInterface *serverIface ); } // namespace QgsWmts #endif
/* * Copyright 2014 Canonical * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Andreas Pokorny */ #include "qxl_drv.h" /* Empty Implementations as there should not be any other driver for a virtual * device that might share buffers with qxl */ int qxl_gem_prime_pin(struct drm_gem_object *obj) { WARN_ONCE(1, "not implemented"); return -ENOSYS; } void qxl_gem_prime_unpin(struct drm_gem_object *obj) { WARN_ONCE(1, "not implemented"); } void *qxl_gem_prime_vmap(struct drm_gem_object *obj) { WARN_ONCE(1, "not implemented"); return ERR_PTR(-ENOSYS); } void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) { WARN_ONCE(1, "not implemented"); } int qxl_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *area) { WARN_ONCE(1, "not implemented"); return -ENOSYS; }
#include <deal.II/base/polynomial.h> #include <fstream> #include <iostream> #ifndef dealii__polynomials_bernstein_h #define dealii__polynomials_bernstein_h DEAL_II_NAMESPACE_OPEN /** * This class implements Bernstein basis polynomials of desire degree as * described in http://www.idav.ucdavis.edu/education/CAGDNotes/Bernstein- * Polynomials.pdf in the paragraph "Converting from the Bernstein Basis to * the Power Basis". * * They are used to create the Bernstein finite element FE_Bernstein. * * @ingroup Polynomials * @author Luca Heltai, Marco Tezzele * @date 2013, 2015 */ template <typename number> class PolynomialsBernstein : public Polynomials::Polynomial<number> { public: /** * Construct the @p index -th Bernstein Polynomial of degree @p degree. * * @f{align*}{ * B_{\text{index}, \text{degree}} (t) * &= \text{binom}(\text{degree}, \text{index}) * \cdot t^{\text{index}} * \cdot (1 - t)^{\text{degree} - \text{index}} \\ * &= \sum_{i = \text{index}}^\text{degree} * \cdot (-1)^{i - \text{index}} * \cdot \text{binom}(\text{degree}, i) * \cdot \text{binom}(i, \text{index}) * \cdot t^i * @f} * * @param index * @param degree */ PolynomialsBernstein ( const unsigned int index, const unsigned int degree); }; template <typename number> std::vector<Polynomials::Polynomial<number> > generate_complete_bernstein_basis ( const unsigned int degree) { std::vector<Polynomials::Polynomial<number> > v; for (unsigned int i = 0; i < degree + 1; ++i) v.push_back(PolynomialsBernstein<number>(i, degree)); return v; } DEAL_II_NAMESPACE_CLOSE #endif
{ for (int c1 = 0; c1 <= 1; c1 += 1) { if (c1 == 1) { s0(1, 1, 1, 0, 0); s0(1, 1, 1, N - 1, 0); } else { for (int c3 = 0; c3 < N; c3 += 1) s0(1, 0, 1, c3, 0); } } for (int c1 = 0; c1 <= floord(T - 1, 1000); c1 += 1) for (int c2 = 1000 * c1 + 1; c2 <= min(N + T - 3, N + 1000 * c1 + 997); c2 += 1) for (int c3 = max(0, -N - 1000 * c1 + c2 + 2); c3 <= min(min(999, T - 1000 * c1 - 1), -1000 * c1 + c2 - 1); c3 += 1) s1(2, 1000 * c1 + c3, 1, -1000 * c1 + c2 - c3, 1); }
#import "GPUImageContext.h" #import "GPUImageFramebuffer.h" #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #import <UIKit/UIKit.h> #else // For now, just redefine this on the Mac typedef NS_ENUM(NSInteger, UIImageOrientation) { UIImageOrientationUp, // default orientation UIImageOrientationDown, // 180 deg rotation UIImageOrientationLeft, // 90 deg CCW UIImageOrientationRight, // 90 deg CW UIImageOrientationUpMirrored, // as above but image mirrored along other axis. horizontal flip UIImageOrientationDownMirrored, // horizontal flip UIImageOrientationLeftMirrored, // vertical flip UIImageOrientationRightMirrored, // vertical flip }; #endif void runOnMainQueueWithoutDeadlocking(void (^block)(void)); void runSynchronouslyOnVideoProcessingQueue(void (^block)(void)); void runAsynchronouslyOnVideoProcessingQueue(void (^block)(void)); void reportAvailableMemoryForGPUImage(NSString *tag); @class GPUImageMovieWriter; /** GPUImage's base source object Images or frames of video are uploaded from source objects, which are subclasses of GPUImageOutput. These include: - GPUImageVideoCamera (for live video from an iOS camera) - GPUImageStillCamera (for taking photos with the camera) - GPUImagePicture (for still images) - GPUImageMovie (for movies) Source objects upload still image frames to OpenGL ES as textures, then hand those textures off to the next objects in the processing chain. */ @interface GPUImageOutput : NSObject { GPUImageFramebuffer *outputFramebuffer; NSMutableArray *targets, *targetTextureIndices; CGSize inputTextureSize, cachedMaximumOutputSize, forcedMaximumSize; BOOL overrideInputSize; BOOL allTargetsWantMonochromeData; BOOL usingNextFrameForImageCapture; } @property(readwrite, nonatomic) BOOL shouldSmoothlyScaleOutput; @property(readwrite, nonatomic) BOOL shouldIgnoreUpdatesToThisTarget; @property(readwrite, nonatomic, retain) GPUImageMovieWriter *audioEncodingTarget; @property(readwrite, nonatomic, unsafe_unretained) id<GPUImageInput> targetToIgnoreForUpdates; @property(nonatomic, copy) void(^frameProcessingCompletionBlock)(GPUImageOutput*, CMTime); @property(nonatomic) BOOL enabled; @property(readwrite, nonatomic) GPUTextureOptions outputTextureOptions; /// @name Managing targets - (void)setInputFramebufferForTarget:(id<GPUImageInput>)target atIndex:(NSInteger)inputTextureIndex; - (GPUImageFramebuffer *)framebufferForOutput; - (void)removeOutputFramebuffer; - (void)notifyTargetsAboutNewOutputTexture; /** Returns an array of the current targets. */ - (NSArray*)targets; /** Adds a target to receive notifications when new frames are available. The target will be asked for its next available texture. See [GPUImageInput newFrameReadyAtTime:] @param newTarget Target to be added */ - (void)addTarget:(id<GPUImageInput>)newTarget; /** Adds a target to receive notifications when new frames are available. See [GPUImageInput newFrameReadyAtTime:] @param newTarget Target to be added */ - (void)addTarget:(id<GPUImageInput>)newTarget atTextureLocation:(NSInteger)textureLocation; /** Removes a target. The target will no longer receive notifications when new frames are available. @param targetToRemove Target to be removed */ - (void)removeTarget:(id<GPUImageInput>)targetToRemove; /** Removes all targets. */ - (void)removeAllTargets; /// @name Manage the output texture - (void)forceProcessingAtSize:(CGSize)frameSize; - (void)forceProcessingAtSizeRespectingAspectRatio:(CGSize)frameSize; /// @name Still image processing - (void)useNextFrameForImageCapture; - (CGImageRef)newCGImageFromCurrentlyProcessedOutput; - (CGImageRef)newCGImageByFilteringCGImage:(CGImageRef)imageToFilter; // Platform-specific image output methods // If you're trying to use these methods, remember that you need to set -useNextFrameForImageCapture before running -processImage or running video and calling any of these methods, or you will get a nil image #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE - (UIImage *)imageFromCurrentFramebuffer; - (UIImage *)imageFromCurrentFramebufferWithOrientation:(UIImageOrientation)imageOrientation; - (UIImage *)imageByFilteringImage:(UIImage *)imageToFilter; - (CGImageRef)newCGImageByFilteringImage:(UIImage *)imageToFilter; #else - (NSImage *)imageFromCurrentFramebuffer; - (NSImage *)imageFromCurrentFramebufferWithOrientation:(UIImageOrientation)imageOrientation; - (NSImage *)imageByFilteringImage:(NSImage *)imageToFilter; - (CGImageRef)newCGImageByFilteringImage:(NSImage *)imageToFilter; #endif - (BOOL)providesMonochromeOutput; @end
/* * 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/>. * */ #pragma once #include "filesystem/File.h" #include "AddonClass.h" #include "LanguageHook.h" namespace XBMCAddon { namespace xbmcvfs { // /// \defgroup python_stat Stat /// \ingroup python_xbmcvfs /// @{ /// @brief **Get file or file system status.** /// /// \python_class{ xbmcvfs.Stat(path) } /// /// These class return information about a file. Execute (search) permission /// is required on all of the directories in path that lead to the file. /// /// @param path [string] file or folder /// /// /// ------------------------------------------------------------------------ /// /// **Example:** /// ~~~~~~~~~~~~~{.py} /// .. /// st = xbmcvfs.Stat(path) /// modified = st.st_mtime() /// .. /// ~~~~~~~~~~~~~ // class Stat : public AddonClass { struct __stat64 st; public: Stat(const String& path) { DelayedCallGuard dg; XFILE::CFile::Stat(path, &st); } #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_mode() } ///----------------------------------------------------------------------- /// To get file protection. /// /// @return st_mode /// st_mode(); #else inline long long st_mode() { return st.st_mode; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_ino() } ///----------------------------------------------------------------------- /// To get inode number. /// /// @return st_ino /// st_ino(); #else inline long long st_ino() { return st.st_ino; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_dev() } ///----------------------------------------------------------------------- /// To get ID of device containing file. /// /// The st_dev field describes the device on which this file resides. /// /// @return st_dev /// st_dev(); #else inline long long st_dev() { return st.st_dev; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_nlink() } ///----------------------------------------------------------------------- /// To get number of hard links. /// /// @return st_nlink /// st_nlink(); #else inline long long st_nlink() { return st.st_nlink; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_uid() } ///----------------------------------------------------------------------- /// To get user ID of owner. /// /// @return st_uid /// st_uid(); #else inline long long st_uid() { return st.st_uid; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_gid() } ///----------------------------------------------------------------------- /// To get group ID of owner. /// /// @return st_gid /// st_gid(); #else inline long long st_gid() { return st.st_gid; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ st_size() } ///----------------------------------------------------------------------- /// To get total size, in bytes. /// /// The st_size field gives the size of the file (if it is a regular file /// or a symbolic link) in bytes. The size of a symbolic link (only on /// Linux and Mac OS X) is the length of the pathname it contains, without /// a terminating null byte. /// /// @return st_size /// st_size(); #else inline long long st_size() { return st.st_size; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ atime() } ///----------------------------------------------------------------------- /// To get time of last access. /// /// @return st_atime /// atime(); #else inline long long atime() { return st.st_atime; }; //names st_atime/st_mtime/st_ctime are used by sys/stat.h #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ mtime() } ///----------------------------------------------------------------------- /// To get time of last modification. /// /// @return st_mtime /// mtime(); #else inline long long mtime() { return st.st_mtime; }; #endif #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_stat /// @brief \python_func{ ctime() } ///----------------------------------------------------------------------- /// To get time of last status change. /// /// @return st_ctime /// ctime(); #else inline long long ctime() { return st.st_ctime; }; #endif }; /// @} } }
/*************************************************************************** * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * File : lgtp_device_ft6x36.h * Author(s) : D3 BSP Touch Team < d3-bsp-touch@lge.com > * Description : * ***************************************************************************/ #if !defined ( _LGTP_DEVICE_FT6X36_H_ ) #define _LGTP_DEVICE_FT6X36_H_ /**************************************************************************** * Nested Include Files ****************************************************************************/ /**************************************************************************** * Mainfest Constants / Defines ****************************************************************************/ /**************************************************************************** * Type Definitions ****************************************************************************/ /**************************************************************************** * Exported Variables ****************************************************************************/ /**************************************************************************** * Macros ****************************************************************************/ /**************************************************************************** * Global Function Prototypes ****************************************************************************/ #endif /* _LGTP_DEVICE_FT6X36_H_ */ /* End Of File */
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // copyright : (C) 2013 by Eran Ifrah // file name : compilation_database.h // // ------------------------------------------------------------------------- // A // _____ _ _ _ _ // / __ \ | | | | (_) | // | / \/ ___ __| | ___| | _| |_ ___ // | | / _ \ / _ |/ _ \ | | | __/ _ ) // | \__/\ (_) | (_| | __/ |___| | || __/ // \____/\___/ \__,_|\___\_____/_|\__\___| // // F i l e // // 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 COMPILATIONDATABASE_H #define COMPILATIONDATABASE_H #include "codelite_exports.h" #include <wx/string.h> #include <wx/filename.h> #include <wx/wxsqlite3.h> #include "project.h" class WXDLLIMPEXP_SDK CompilationDatabase { wxSQLite3Database* m_db; wxFileName m_filename; protected: void DropTables(); void CreateDatabase(); wxString GetDbVersion(); /** * @brief create our compilation database out of CMake's compile_commands.json file */ void ProcessCMakeCompilationDatabase( const wxFileName &compile_commands ); wxFileName ConvertCodeLiteCompilationDatabaseToCMake( const wxFileName &compile_file ); public: CompilationDatabase(); CompilationDatabase(const wxString &filename); virtual ~CompilationDatabase(); static bool IsDbVersionUpToDate(const wxFileName &fn); void Open(); void Close(); bool IsOpened() const { return m_db && m_db->IsOpen(); } /** * @brief return the database file name (compilation.db), usually under the workspace private folder WORKSPACE_PATH/.codelite/compilation.db */ wxFileName GetFileName() const; /** * @brief return the location of the CMake (usually compile_commands.json) * Note that this function does not check for the existance of the file */ FileNameVector_t GetCompileCommandsFiles() const; void CompilationLine(const wxString &filename, wxString &compliationLine, wxString &cwd); void Initialize(); bool IsOk() const; }; #endif // COMPILATIONDATABASE_H
/* * Copyright (c) The Shogun Machine Learning Toolbox * Written (w) 2014 Parijat Mazumdar * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of the Shogun Development Team. */ #ifndef _RANDOMFOREST_H__ #define _RANDOMFOREST_H__ #include <shogun/lib/config.h> #include <shogun/machine/BaggingMachine.h> namespace shogun { /** @brief This class implements the Random Forests algorithm. In Random Forests algorithm, we train a number of randomized CART trees * (see class CRandomCARTree) using the supplied training data. The number of trees to be trained is a parameter (called number of bags) * controlled by the user. Test feature vectors are classified/regressed by combining the outputs of all these trained candidate trees using a * combination rule (see class CCombinationRule). The feature for calculating out-of-box error is also provided to help determine the * appropriate number of bags. The evaluatin criteria for calculating this out-of-box error is specified by the user (see class CEvaluation). */ class CRandomForest : public CBaggingMachine { public: /** constructor */ CRandomForest(); /** constructor * * @param num_rand_feats number of attributes chosen randomly during node split in candidate trees * @param num_bags number of trees in forest */ CRandomForest(int32_t num_rand_feats, int32_t num_bags=10); /** constructor * * @param features training features * @param labels training labels * @param num_bags number of trees in forest * @param num_rand_feats number of attributes chosen randomly during node split in candidate trees */ CRandomForest(CFeatures* features, CLabels* labels, int32_t num_bags=10, int32_t num_rand_feats=0); /** constructor * * @param features training features * @param labels training labels * @param weights weights of training feature vectors * @param num_bags number of trees in forest * @param num_rand_feats number of attributes chosen randomly during node split in candidate trees */ CRandomForest(CFeatures* features, CLabels* labels, SGVector<float64_t> weights, int32_t num_bags=10, int32_t num_rand_feats=0); /** destructor */ virtual ~CRandomForest(); /** get name * * @return RandomForest */ virtual const char* get_name() const { return "RandomForest"; } /** machine is set to modified CART(RandomCART) and cannot be changed * * @param machine the machine to use for bagging */ virtual void set_machine(CMachine* machine); /** set weights * * @param weights of training feature vectors */ void set_weights(SGVector<float64_t> weights); /** get weights * * @return weights of training feature vectors */ SGVector<float64_t> get_weights() const; /** set feature types of various features * * @param ft bool vector true for nominal feature false for continuous feature type */ void set_feature_types(SGVector<bool> ft); /** get feature types of various features * * @return bool vector - true for nominal feature false for continuous feature type */ SGVector<bool> get_feature_types() const; /** get problem type - multiclass classification or regression * * @return PT_MULTICLASS or PT_REGRESSION */ virtual EProblemType get_machine_problem_type() const; /** set problem type - multiclass classification or regression * * @param mode EProblemType PT_MULTICLASS or PT_REGRESSION */ void set_machine_problem_type(EProblemType mode); /** set number of random features to be chosen during node splits * * @param rand_featsize number of randomly chosen features during each node split */ void set_num_random_features(int32_t rand_featsize); /** get number of random features to be chosen during node splits * * @return number of randomly chosen features during each node split */ int32_t get_num_random_features() const; protected: virtual bool train_machine(CFeatures* data=NULL); /** sets parameters of CARTree - sets machine labels and weights here * * @param m machine * @param idx indices of training vectors chosen in current bag */ virtual void set_machine_parameters(CMachine* m, SGVector<index_t> idx); private: /** initialize parameters */ void init(); private: /** weights */ SGVector<float64_t> m_weights; /** Pre-sorted features */ SGMatrix<float64_t> m_sorted_transposed_feats; /** Indices of pre-sorted features */ SGMatrix<index_t> m_sorted_indices; }; } /* namespace shogun */ #endif /* _RANDOMFOREST_H__ */
/* * Copyright (c) 2010, * Gavriloaie Eugen-Andrei (shiretu@gmail.com) * * This file is part of crtmpserver. * crtmpserver is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * crtmpserver 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 crtmpserver. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAS_PROTOCOL_RTMP #ifndef _OUTBOUNDRTMPPROTOCOL_H #define _OUTBOUNDRTMPPROTOCOL_H #include "protocols/rtmp/basertmpprotocol.h" class DHWrapper; class DLLEXP OutboundRTMPProtocol : public BaseRTMPProtocol { private: uint8_t *_pClientPublicKey; uint8_t *_pOutputBuffer; uint8_t *_pClientDigest; RC4_KEY* _pKeyIn; RC4_KEY* _pKeyOut; DHWrapper *_pDHWrapper; uint8_t _usedScheme; bool _encrypted; public: OutboundRTMPProtocol(); virtual ~OutboundRTMPProtocol(); protected: virtual bool PerformHandshake(IOBuffer &buffer); public: static bool Connect(string ip, uint16_t port, Variant customParameters); static bool SignalProtocolCreated(BaseProtocol *pProtocol, Variant customParameters); private: bool PerformHandshakeStage1(bool encrypted); bool VerifyServer(IOBuffer &inputBuffer); bool PerformHandshakeStage2(IOBuffer &inputBuffer, bool encrypted); }; #endif /* _OUTBOUNDRTMPPROTOCOL_H */ #endif /* HAS_PROTOCOL_RTMP */
/****************************************************************************** * The MIT License * * Copyright (c) 2011 LeafLabs, LLC. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. *****************************************************************************/ /** * @file bitband.h * * @brief Bit-banding utility functions */ #ifndef _BITBAND_H_ #define _BITBAND_H_ #include "hal_types.h" #ifdef __cplusplus extern "C" { #endif static inline volatile uint32_t* __bb_addr(volatile void*, uint32_t, uint32_t, uint32_t); /** * @brief Obtain a pointer to the bit-band address corresponding to a * bit in a volatile SRAM address. * @param address Address in the bit-banded SRAM region * @param bit Bit in address to bit-band */ static inline volatile uint32_t* bb_sramp(volatile void *address, uint32_t bit) { return __bb_addr(address, bit, SRAM1_BB_BASE, SRAM_BASE); } /** * @brief Get a bit from an address in the SRAM bit-band region. * @param address Address in the SRAM bit-band region to read from * @param bit Bit in address to read * @return bit's value in address. */ static inline uint8_t bb_sram_get_bit(volatile void *address, uint32_t bit) { return *bb_sramp(address, bit); } /** * @brief Set a bit in an address in the SRAM bit-band region. * @param address Address in the SRAM bit-band region to write to * @param bit Bit in address to write to * @param val Value to write for bit, either 0 or 1. */ static inline void bb_sram_set_bit(volatile void *address, uint32_t bit, uint8_t val) { *bb_sramp(address, bit) = val; } /** * @brief Obtain a pointer to the bit-band address corresponding to a * bit in a peripheral address. * @param address Address in the bit-banded peripheral region * @param bit Bit in address to bit-band */ static inline volatile uint32_t* bb_perip(volatile void *address, uint32_t bit) { return __bb_addr(address, bit, PERIPH_BB_BASE, PERIPH_BASE); } /** * @brief Get a bit from an address in the peripheral bit-band region. * @param address Address in the peripheral bit-band region to read from * @param bit Bit in address to read * @return bit's value in address. */ static inline uint8_t bb_peri_get_bit(volatile void *address, uint32_t bit) { return *bb_perip(address, bit); } /** * @brief Set a bit in an address in the peripheral bit-band region. * @param address Address in the peripheral bit-band region to write to * @param bit Bit in address to write to * @param val Value to write for bit, either 0 or 1. */ static inline void bb_peri_set_bit(volatile void *address, uint32_t bit, uint8_t val) { *bb_perip(address, bit) = val; } static inline volatile uint32_t* __bb_addr(volatile void *address, uint32_t bit, uint32_t bb_base, uint32_t bb_ref) { return (volatile uint32_t*)(bb_base + ((uint32_t)address - bb_ref) * 32 + bit * 4); } #ifdef __cplusplus } #endif #endif /* _BITBAND_H_ */
// Copyright 2014 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 COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ #include <string> #include "base/memory/scoped_ptr.h" #include "base/supports_user_data.h" #include "components/autofill/content/browser/request_autocomplete_manager.h" #include "components/autofill/core/browser/autofill_driver.h" #include "components/autofill/core/browser/autofill_external_delegate.h" #include "components/autofill/core/browser/autofill_manager.h" namespace content { class BrowserContext; class RenderFrameHost; struct FrameNavigateParams; struct LoadCommittedDetails; } namespace IPC { class Message; } namespace autofill { class AutofillClient; // Class that drives autofill flow in the browser process based on // communication from the renderer and from the external world. There is one // instance per RenderFrameHost. class ContentAutofillDriver : public AutofillDriver { public: ContentAutofillDriver( content::RenderFrameHost* render_frame_host, AutofillClient* client, const std::string& app_locale, AutofillManager::AutofillDownloadManagerState enable_download_manager); ~ContentAutofillDriver() override; // AutofillDriver: bool IsOffTheRecord() const override; net::URLRequestContextGetter* GetURLRequestContext() override; base::SequencedWorkerPool* GetBlockingPool() override; bool RendererIsAvailable() override; void SendFormDataToRenderer(int query_id, RendererFormDataAction action, const FormData& data) override; void PingRenderer() override; void PropagateAutofillPredictions( const std::vector<autofill::FormStructure*>& forms) override; void SendAutofillTypePredictionsToRenderer( const std::vector<FormStructure*>& forms) override; void RendererShouldAcceptDataListSuggestion( const base::string16& value) override; void RendererShouldClearFilledForm() override; void RendererShouldClearPreviewedForm() override; void RendererShouldFillFieldWithValue(const base::string16& value) override; void RendererShouldPreviewFieldWithValue( const base::string16& value) override; void PopupHidden() override; // Handles a message that came from the associated render frame. bool HandleMessage(const IPC::Message& message); // Called when the frame has navigated. void DidNavigateFrame(const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params); AutofillExternalDelegate* autofill_external_delegate() { return &autofill_external_delegate_; } AutofillManager* autofill_manager() { return autofill_manager_.get(); } content::RenderFrameHost* render_frame_host() { return render_frame_host_; } protected: // Sets the manager to |manager| and sets |manager|'s external delegate // to |autofill_external_delegate_|. Takes ownership of |manager|. void SetAutofillManager(scoped_ptr<AutofillManager> manager); private: // Weak ref to the RenderFrameHost the driver is associated with. Should // always be non-NULL and valid for lifetime of |this|. content::RenderFrameHost* const render_frame_host_; // The per-tab client. AutofillClient* client_; // AutofillManager instance via which this object drives the shared Autofill // code. scoped_ptr<AutofillManager> autofill_manager_; // AutofillExternalDelegate instance that this object instantiates in the // case where the Autofill native UI is enabled. AutofillExternalDelegate autofill_external_delegate_; // Driver for the interactive autocomplete dialog. RequestAutocompleteManager request_autocomplete_manager_; }; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_
// The MIT License // // Copyright (c) 2014 Gwendal Roué // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <Foundation/Foundation.h> #import "GRMustacheAvailabilityMacros_private.h" /** * The kinds of tokens */ typedef NS_ENUM(NSInteger, GRMustacheTokenType) { /** * The kind of tokens representing raw template text. */ GRMustacheTokenTypeText, /** * The kind of tokens representing escaped variable tags such as `{{name}}`. */ GRMustacheTokenTypeEscapedVariable, /** * The kind of tokens representing a comment tag such as `{{! comment }}`. */ GRMustacheTokenTypeComment, /** * The kind of tokens representing unescaped variable tag such as * `{{{name}}}` and `{{&name}}`. */ GRMustacheTokenTypeUnescapedVariable, /** * The kind of tokens representing section opening tags such as `{{#name}}`. */ GRMustacheTokenTypeSectionOpening, /** * The kind of tokens representing inverted section opening tags such as * `{{^name}}`. */ GRMustacheTokenTypeInvertedSectionOpening, /** * The kind of tokens representing closing tags such as `{{/name}}`. */ GRMustacheTokenTypeClosing, /** * The kind of tokens representing partial tags such as `{{>name}}`. */ GRMustacheTokenTypePartial, /** * The kind of tokens representing delimiters tags such as `{{=< >=}}`. */ GRMustacheTokenTypeSetDelimiter, /** * The kind of tokens representing pragma tags such as `{{%FILTERS}}`. */ GRMustacheTokenTypePragma, /** * The kind of tokens representing inheritable partial tags such as * `{{<name}}`. */ GRMustacheTokenTypeInheritablePartial, /** * The kind of tokens representing inheritable ection opening tags such as * `{{$name}}`. */ GRMustacheTokenTypeInheritableSectionOpening, }; /** * A GRMustacheToken is the product of GRMustacheTemplateParser. It represents a * {{Mustache}} tag, or raw text between tags. * * For example, the template string "hello {{name}}!" would be represented by * three tokens: * * - a token of type GRMustacheTokenTypeText holding "hello " * - a token of type GRMustacheTokenTypeEscapedVariable holding "{{name}}" * - a token of type GRMustacheTokenTypeText holding "!" */ @interface GRMustacheToken : NSObject { @private GRMustacheTokenType _type; NSString *_templateString; id _templateID; NSUInteger _line; NSRange _range; NSRange _tagInnerRange; } /** * The type of the token. */ @property (nonatomic) GRMustacheTokenType type GRMUSTACHE_API_INTERNAL; /** * The Mustache template string this token comes from. */ @property (nonatomic, retain) NSString *templateString GRMUSTACHE_API_INTERNAL; /** * The template ID of the template this token comes from. * * @see GRMustacheTemplateRepository */ @property (nonatomic, retain) id templateID GRMUSTACHE_API_INTERNAL; /** * The line in templateString where this token lies. */ @property (nonatomic) NSUInteger line GRMUSTACHE_API_INTERNAL; /** * The range in templateString where this token lies. * * For tokens of type GRMustacheTokenTypeText, the range is the full range of * the represented text. * * For tokens of a tag type, the range is the full range of the tag, from * `{{` to `}}` included. */ @property (nonatomic) NSRange range GRMUSTACHE_API_INTERNAL; /** * @see range */ @property (nonatomic, readonly) NSString *templateSubstring GRMUSTACHE_API_INTERNAL; /** * The range of the inner content of the tag. * * GRMustacheTemplateParser sets it for tokens of types: * * - GRMustacheTokenTypeSetDelimiter * - GRMustacheTokenTypeComment; * - GRMustacheTokenTypeSectionOpening; * - GRMustacheTokenTypeInvertedSectionOpening; * - GRMustacheTokenTypeInheritableSectionOpening; * - GRMustacheTokenTypeClosing; * - GRMustacheTokenTypePartial; * - GRMustacheTokenTypeInheritablePartial; * - GRMustacheTokenTypeUnescapedVariable; * - GRMustacheTokenTypePragma; * - GRMustacheTokenTypeEscapedVariable; */ @property (nonatomic) NSRange tagInnerRange GRMUSTACHE_API_INTERNAL; /** * @see tagInnerRange */ @property (nonatomic, readonly) NSString *tagInnerContent GRMUSTACHE_API_INTERNAL; /** * Builds and return a token. */ + (instancetype)tokenWithType:(GRMustacheTokenType)type templateString:(NSString *)templateString templateID:(id)templateID line:(NSUInteger)line range:(NSRange)range GRMUSTACHE_API_INTERNAL; @end
#ifndef _LINUX_TTY_LDISC_H #define _LINUX_TTY_LDISC_H /* * This structure defines the interface between the tty line discipline * implementation and the tty routines. The following routines can be * defined; unless noted otherwise, they are optional, and can be * filled in with a null pointer. * * int (*open)(struct tty_struct *); * * This function is called when the line discipline is associated * with the tty. The line discipline can use this as an * opportunity to initialize any state needed by the ldisc routines. * * void (*close)(struct tty_struct *); * * This function is called when the line discipline is being * shutdown, either because the tty is being closed or because * the tty is being changed to use a new line discipline * * void (*flush_buffer)(struct tty_struct *tty); * * This function instructs the line discipline to clear its * buffers of any input characters it may have queued to be * delivered to the user mode process. * * ssize_t (*chars_in_buffer)(struct tty_struct *tty); * * This function returns the number of input characters the line * discipline may have queued up to be delivered to the user mode * process. * * ssize_t (*read)(struct tty_struct * tty, struct file * file, * unsigned char * buf, size_t nr); * * This function is called when the user requests to read from * the tty. The line discipline will return whatever characters * it has buffered up for the user. If this function is not * defined, the user will receive an EIO error. * * ssize_t (*write)(struct tty_struct * tty, struct file * file, * const unsigned char * buf, size_t nr); * * This function is called when the user requests to write to the * tty. The line discipline will deliver the characters to the * low-level tty device for transmission, optionally performing * some processing on the characters first. If this function is * not defined, the user will receive an EIO error. * * int (*ioctl)(struct tty_struct * tty, struct file * file, * unsigned int cmd, unsigned long arg); * * This function is called when the user requests an ioctl which * is not handled by the tty layer or the low-level tty driver. * It is intended for ioctls which affect line discpline * operation. Note that the search order for ioctls is (1) tty * layer, (2) tty low-level driver, (3) line discpline. So a * low-level driver can "grab" an ioctl request before the line * discpline has a chance to see it. * * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); * * This function notifies the line discpline that a change has * been made to the termios structure. * * int (*poll)(struct tty_struct * tty, struct file * file, * poll_table *wait); * * This function is called when a user attempts to select/poll on a * tty device. It is solely the responsibility of the line * discipline to handle poll requests. * * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, * char *fp, int count); * * This function is called by the low-level tty driver to send * characters received by the hardware to the line discpline for * processing. <cp> is a pointer to the buffer of input * character received by the device. <fp> is a pointer to a * pointer of flag bytes which indicate whether a character was * received with a parity error, etc. * * void (*write_wakeup)(struct tty_struct *); * * This function is called by the low-level tty driver to signal * that line discpline should try to send more characters to the * low-level driver for transmission. If the line discpline does * not have any more data to send, it can just return. * * int (*hangup)(struct tty_struct *) * * Called on a hangup. Tells the discipline that it should * cease I/O to the tty driver. Can sleep. The driver should * seek to perform this action quickly but should wait until * any pending driver I/O is completed. */ #include <linux/fs.h> #include <linux/wait.h> struct tty_ldisc { int magic; char *name; int num; int flags; /* * The following routines are called from above. */ int (*open)(struct tty_struct *); void (*close)(struct tty_struct *); void (*flush_buffer)(struct tty_struct *tty); ssize_t (*chars_in_buffer)(struct tty_struct *tty); ssize_t (*read)(struct tty_struct * tty, struct file * file, unsigned char __user * buf, size_t nr); ssize_t (*write)(struct tty_struct * tty, struct file * file, const unsigned char * buf, size_t nr); int (*ioctl)(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct ktermios * old); unsigned int (*poll)(struct tty_struct *, struct file *, struct poll_table_struct *); int (*hangup)(struct tty_struct *tty); /* * The following routines are called from below. */ void (*receive_buf)(struct tty_struct *, const unsigned char *cp, char *fp, int count); void (*write_wakeup)(struct tty_struct *); struct module *owner; int refcount; }; #define TTY_LDISC_MAGIC 0x5403 #define LDISC_FLAG_DEFINED 0x00000001 #define MODULE_ALIAS_LDISC(ldisc) \ MODULE_ALIAS("tty-ldisc-" __stringify(ldisc)) #endif /* _LINUX_TTY_LDISC_H */
#ifndef AC_GEOFFC3D_H #define AC_GEOFFC3D_H // // (C) Copyright 1993-1999 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // // DESCRIPTION: // // This file contains the class AcGeOffsetCurve3d - A mathematical // entity used to represent an exact offset of a 3d curve. #include "gecurv3d.h" #pragma pack (push, 8) class GE_DLLEXPIMPORT AcGeOffsetCurve3d : public AcGeCurve3d { public: // Constructors // AcGeOffsetCurve3d (const AcGeCurve3d& baseCurve, const AcGeVector3d& planeNormal, double offsetDistance); AcGeOffsetCurve3d (const AcGeOffsetCurve3d& offsetCurve); // Query methods // const AcGeCurve3d* curve () const; AcGeVector3d normal () const; double offsetDistance () const; Adesk::Boolean paramDirection () const; AcGeMatrix3d transformation () const; // Set methods // AcGeOffsetCurve3d& setCurve (const AcGeCurve3d& baseCurve); AcGeOffsetCurve3d& setNormal (const AcGeVector3d& planeNormal); AcGeOffsetCurve3d& setOffsetDistance (double offsetDistance); // Assignment operator. // AcGeOffsetCurve3d& operator = (const AcGeOffsetCurve3d& offsetCurve); }; #pragma pack (pop) #endif
/* Copyright (C) 2000-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <spawn.h> #include <string.h> /* Store process group ID in the attribute structure. */ int posix_spawnattr_setpgroup (posix_spawnattr_t *attr, pid_t pgroup) { /* Store the process group ID. */ attr->__pgrp = pgroup; return 0; }
/* * Copyright (C) 2013 INRIA. * Copyright (C) 2015 Cenk Gündoğan <cnkgndgn@gmail.com> * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup net_gnrc_rpl * @{ * * @file * @brief DODAG-related functions for RPL * * Header file, which defines all public known DODAG-related functions for RPL. * * @author Eric Engel <eric.engel@fu-berlin.de> * @author Cenk Gündoğan <cnkgndgn@gmail.com> */ #ifndef NET_GNRC_RPL_DODAG_H #define NET_GNRC_RPL_DODAG_H #ifdef __cplusplus extern "C" { #endif #include "net/ipv6/addr.h" #include "trickle.h" #include "net/gnrc/rpl.h" #include "net/gnrc/rpl/structs.h" /** * @brief Number of RPL instances */ #ifndef GNRC_RPL_INSTANCES_NUMOF #define GNRC_RPL_INSTANCES_NUMOF (1) #endif /** * @brief Number of RPL parents */ #ifndef GNRC_RPL_PARENTS_NUMOF #define GNRC_RPL_PARENTS_NUMOF (3) #endif /** * @brief RPL instance table */ extern gnrc_rpl_instance_t gnrc_rpl_instances[GNRC_RPL_INSTANCES_NUMOF]; /** * @brief RPL parent table */ extern gnrc_rpl_parent_t gnrc_rpl_parents[GNRC_RPL_PARENTS_NUMOF]; /** * @brief Add a new RPL instance with the id @p instance_id. * * @param[in] instance_id The instance id of the new RPL instance. * @param[out] inst Pointer to an existing or new instance. Otherwise NULL. * * @return true, if instance could be created. * @return false, if instance could not be created or exists already. */ bool gnrc_rpl_instance_add(uint8_t instance_id, gnrc_rpl_instance_t **inst); /** * @brief Remove a RPL instance with the id @p instance_id. * * @param[in] instance_id The instance id of the RPL instance to remove. * * @return true, on success. * @return false, otherwise. */ bool gnrc_rpl_instance_remove_by_id(uint8_t instance_id); /** * @brief Remove a RPL instance with the pointer @p inst. * * @param[in] inst Pointer to the the RPL instance to remove. * * @return true, on success. * @return false, otherwise. */ bool gnrc_rpl_instance_remove(gnrc_rpl_instance_t *inst); /** * @brief Get the RPL instance with the id @p instance_id. * * @param[in] instance_id The instance id of the RPL instance to get. * * @return Pointer to the RPL instance, on success. * @return NULL, otherwise. */ gnrc_rpl_instance_t *gnrc_rpl_instance_get(uint8_t instance_id); /** * @brief Initialize a new RPL DODAG with the id @p dodag_id for the instance @p instance. * * @param[in] instance Pointer to the instance to add the DODAG to * @param[in] dodag_id The DODAG-ID of the new DODAG * @param[in] iface Interface PID where the DODAG operates * @param[in] netif_addr netif address for this DODAG * * @return true, if DODAG could be created. * @return false, if DODAG could not be created or exists already. */ bool gnrc_rpl_dodag_init(gnrc_rpl_instance_t *instance, ipv6_addr_t *dodag_id, kernel_pid_t iface, gnrc_ipv6_netif_addr_t *netif_addr); /** * @brief Remove all parents from the @p dodag. * * @param[in] dodag Pointer to the dodag. */ void gnrc_rpl_dodag_remove_all_parents(gnrc_rpl_dodag_t *dodag); /** * @brief Add a new parent with the IPv6 address @p addr to the @p dodag. * * @param[in] dodag Pointer to the DODAG * @param[in] addr IPV6 address of the parent * @param[out] parent Pointer to an existing or new parent. Otherwise NULL. * * @return true. if parent could be created. * @return false, if parent could not be created or exists already. */ bool gnrc_rpl_parent_add_by_addr(gnrc_rpl_dodag_t *dodag, ipv6_addr_t *addr, gnrc_rpl_parent_t **parent); /** * @brief Remove the @p parent from its DODAG. * * @param[in] parent Pointer to the parent. * * @return true, on success. * @return false, otherwise. */ bool gnrc_rpl_parent_remove(gnrc_rpl_parent_t *parent); /** * @brief Update a @p parent of the @p dodag. * * @param[in] dodag Pointer to the DODAG * @param[in] parent Pointer to the parent */ void gnrc_rpl_parent_update(gnrc_rpl_dodag_t *dodag, gnrc_rpl_parent_t *parent); /** * @brief Start a local repair. * * @param[in] dodag Pointer to the DODAG */ void gnrc_rpl_local_repair(gnrc_rpl_dodag_t *dodag); /** * @brief Operate as leaf. * * @param[in] dodag Pointer to the DODAG */ void gnrc_rpl_leaf_operation(gnrc_rpl_dodag_t *dodag); /** * @brief Operate as router. * * @param[in] dodag Pointer to the DODAG */ void gnrc_rpl_router_operation(gnrc_rpl_dodag_t *dodag); #ifdef __cplusplus } #endif #endif /* NET_GNRC_RPL_DODAG_H */ /** * @} */
// Copyright 2010-2014 Google // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef OR_TOOLS_BASE_FILELINEREADER_H_ #define OR_TOOLS_BASE_FILELINEREADER_H_ #include <cstdlib> #include <cstdio> #include <memory> #include <string> #include "base/callback.h" #include "base/integral_types.h" #include "base/file.h" namespace operations_research { // The FileLineReader class will read a text file specified by // 'filename' line by line. Each line will be cleaned with respect to // termination ('\n' and '\r'). The line callback will be called in // sequence on each line. class FileLineReader { public: // Creates a file line reader object that will read the file 'filename' // line by line. explicit FileLineReader(const char* const filename); ~FileLineReader(); // Sets the line callback and takes ownership. void set_line_callback(Callback1<char*>* const callback); // Reloads the file line by line. void Reload(); // Indicates if the file was loaded successfully. bool loaded_successfully() const; private: const char* filename_; std::unique_ptr<Callback1<char*> > line_callback_; bool loaded_successfully_; }; } // namespace operations_research #endif // OR_TOOLS_BASE_FILELINEREADER_H_
/* * Copyright (C) 2013 Michael Brown <mbrown@fensystems.co.uk>. * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ FILE_LICENCE ( GPL2_OR_LATER ); /** @file * * Neighbour management commands * */ #include <getopt.h> #include <ipxe/parseopt.h> #include <ipxe/command.h> #include <usr/neighmgmt.h> /** "nstat" options */ struct nstat_options {}; /** "nstat" option list */ static struct option_descriptor nstat_opts[] = {}; /** "nstat" command descriptor */ static struct command_descriptor nstat_cmd = COMMAND_DESC ( struct nstat_options, nstat_opts, 0, 0, NULL ); /** * The "nstat" command * * @v argc Argument count * @v argv Argument list * @ret rc Return status code */ static int nstat_exec ( int argc, char **argv ) { struct nstat_options opts; int rc; /* Parse options */ if ( ( rc = parse_options ( argc, argv, &nstat_cmd, &opts ) ) != 0) return rc; nstat(); return 0; } /** Neighbour management commands */ struct command neighbour_commands[] __command = { { .name = "nstat", .exec = nstat_exec, }, };
/* ** $Id: llex.h,v 1.72.1.1 2013/04/12 18:48:47 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ #ifndef llex_h #define llex_h #include "lobject.h" #include "lzio.h" #define FIRST_RESERVED 257 /* * WARNING: if you change the order of this enumeration, * grep "ORDER RESERVED" */ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, TK_CONTINUE, /* other terminal symbols */ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS, TK_NUMBER, TK_NAME, TK_STRING }; /* number of reserved words */ #define NUM_RESERVED (cast(int, TK_CONTINUE-FIRST_RESERVED+1)) typedef union { lua_Number r; TString *ts; } SemInfo; /* semantics information */ typedef struct Token { int token; SemInfo seminfo; } Token; /* state of the lexer plus state of the parser when shared by all functions */ typedef struct LexState { int current; /* current character (charint) */ int linenumber; /* input line counter */ int lastline; /* line of last token `consumed' */ Token t; /* current token */ Token lookahead; /* look ahead token */ struct FuncState *fs; /* current function (parser) */ struct lua_State *L; ZIO *z; /* input stream */ Mbuffer *buff; /* buffer for tokens */ struct Dyndata *dyd; /* dynamic structures used by the parser */ TString *source; /* current source name */ TString *envn; /* environment variable name */ char decpoint; /* locale decimal point */ } LexState; LUAI_FUNC void luaX_init (lua_State *L); LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar); LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC int luaX_lookahead (LexState *ls); LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); #endif
/**************************************************************************** * * Copyright 2016 Samsung Electronics All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************/ /**************************************************************************** * libc/stdlib/lib_checkbase.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * 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 NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <tinyara/config.h> #include <string.h> #include <ctype.h> #include "lib_internal.h" /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: lib_checkbase * * Description: * This is part of the strol() family implementation. This function checks * the initial part of a string to see if it can determine the numeric * base that is represented. * * Assumptions: * *ptr points to the first, non-whitespace character in the string. * ****************************************************************************/ int lib_checkbase(int base, FAR const char **pptr) { const char *ptr = *pptr; /* Check for unspecified base */ if (!base) { /* Assume base 10 */ base = 10; /* Check for leading '0' - that would signify octal or hex (or binary) */ if (*ptr == '0') { /* Assume octal */ base = 8; ptr++; /* Check for hexadecimal */ if ((*ptr == 'X' || *ptr == 'x') && lib_isbasedigit(ptr[1], 16, NULL)) { base = 16; ptr++; } } } /* If it a hexadecimal representation, than discard any leading "0X" or "0x" */ else if (base == 16) { if (ptr[0] == '0' && (ptr[1] == 'X' || ptr[1] == 'x')) { ptr += 2; } } /* Return the updated pointer and base */ *pptr = ptr; return base; }
// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm < %s | FileCheck %s // Check that, just because we emitted a function from a different file doesn't // mean we insert a file-change inside the next function. // CHECK: ret void, !dbg [[F1_LINE:![0-9]*]] // CHECK: ret void, !dbg [[F2_LINE:![0-9]*]] // CHECK: [[F1:![0-9]*]] = distinct !DISubprogram(name: "f1",{{.*}} DISPFlagDefinition // CHECK: [[F1_LINE]] = !DILocation({{.*}}, scope: [[F1]]) // CHECK: [[F2:![0-9]*]] = distinct !DISubprogram(name: "f2",{{.*}} DISPFlagDefinition // CHECK: [[F2_LINE]] = !DILocation({{.*}}, scope: [[F2]]) void f1() { } # 2 "foo.c" void f2() { }
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "DirectoryNode.h" namespace XFILE { namespace MUSICDATABASEDIRECTORY { class CDirectoryNodeYearSong : public CDirectoryNode { public: CDirectoryNodeYearSong(const std::string& strName, CDirectoryNode* pParent); protected: bool GetContent(CFileItemList& items) const override; }; } }
/* * PNM image format * Copyright (c) 2002, 2003 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "pnm.h" static inline int pnm_space(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; } static void pnm_get(PNMContext *sc, char *str, int buf_size) { char *s; int c; /* skip spaces and comments */ for (;;) { c = *sc->bytestream++; if (c == '#') { do { c = *sc->bytestream++; } while (c != '\n' && sc->bytestream < sc->bytestream_end); } else if (!pnm_space(c)) { break; } } s = str; while (sc->bytestream < sc->bytestream_end && !pnm_space(c)) { if ((s - str) < buf_size - 1) *s++ = c; c = *sc->bytestream++; } *s = '\0'; } int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) { char buf1[32], tuple_type[32]; int h, w, depth, maxval; pnm_get(s, buf1, sizeof(buf1)); s->type= buf1[1]-'0'; if(buf1[0] != 'P') return -1; if (s->type==1 || s->type==4) { avctx->pix_fmt = PIX_FMT_MONOWHITE; } else if (s->type==2 || s->type==5) { if (avctx->codec_id == CODEC_ID_PGMYUV) avctx->pix_fmt = PIX_FMT_YUV420P; else avctx->pix_fmt = PIX_FMT_GRAY8; } else if (s->type==3 || s->type==6) { avctx->pix_fmt = PIX_FMT_RGB24; } else if (s->type==7) { w = -1; h = -1; maxval = -1; depth = -1; tuple_type[0] = '\0'; for (;;) { pnm_get(s, buf1, sizeof(buf1)); if (!strcmp(buf1, "WIDTH")) { pnm_get(s, buf1, sizeof(buf1)); w = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "HEIGHT")) { pnm_get(s, buf1, sizeof(buf1)); h = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "DEPTH")) { pnm_get(s, buf1, sizeof(buf1)); depth = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "MAXVAL")) { pnm_get(s, buf1, sizeof(buf1)); maxval = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "TUPLETYPE")) { pnm_get(s, tuple_type, sizeof(tuple_type)); } else if (!strcmp(buf1, "ENDHDR")) { break; } else { return -1; } } /* check that all tags are present */ if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || avcodec_check_dimensions(avctx, w, h)) return -1; avctx->width = w; avctx->height = h; if (depth == 1) { if (maxval == 1) avctx->pix_fmt = PIX_FMT_MONOWHITE; else avctx->pix_fmt = PIX_FMT_GRAY8; } else if (depth == 3) { if (maxval < 256) { avctx->pix_fmt = PIX_FMT_RGB24; } else { av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n"); avctx->pix_fmt = PIX_FMT_NONE; return -1; } } else if (depth == 4) { avctx->pix_fmt = PIX_FMT_RGB32; } else { return -1; } return 0; } else { return -1; } pnm_get(s, buf1, sizeof(buf1)); avctx->width = atoi(buf1); if (avctx->width <= 0) return -1; pnm_get(s, buf1, sizeof(buf1)); avctx->height = atoi(buf1); if(avcodec_check_dimensions(avctx, avctx->width, avctx->height)) return -1; if (avctx->pix_fmt != PIX_FMT_MONOWHITE) { pnm_get(s, buf1, sizeof(buf1)); s->maxval = atoi(buf1); if (s->maxval >= 256) { if (avctx->pix_fmt == PIX_FMT_GRAY8) { avctx->pix_fmt = PIX_FMT_GRAY16BE; if (s->maxval != 65535) avctx->pix_fmt = PIX_FMT_GRAY16; } else if (avctx->pix_fmt == PIX_FMT_RGB24) { if (s->maxval > 255) avctx->pix_fmt = PIX_FMT_RGB48BE; } else { av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n"); avctx->pix_fmt = PIX_FMT_NONE; return -1; } } }else s->maxval=1; /* more check if YUV420 */ if (avctx->pix_fmt == PIX_FMT_YUV420P) { if ((avctx->width & 1) != 0) return -1; h = (avctx->height * 2); if ((h % 3) != 0) return -1; h /= 3; avctx->height = h; } return 0; } av_cold int ff_pnm_end(AVCodecContext *avctx) { PNMContext *s = avctx->priv_data; if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); return 0; } av_cold int ff_pnm_init(AVCodecContext *avctx) { PNMContext *s = avctx->priv_data; avcodec_get_frame_defaults((AVFrame*)&s->picture); avctx->coded_frame = (AVFrame*)&s->picture; return 0; }
/***************************************************************************** Copyright (c) 2011, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function zpprfs * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_zpprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ) { lapack_int info = 0; double* rwork = NULL; lapack_complex_double* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zpprfs", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zpp_nancheck( n, afp ) ) { return -6; } if( LAPACKE_zpp_nancheck( n, ap ) ) { return -5; } if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -7; } if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, x, ldx ) ) { return -9; } #endif /* Allocate memory for working array(s) */ rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_zpprfs_work( matrix_order, uplo, n, nrhs, ap, afp, b, ldb, x, ldx, ferr, berr, work, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zpprfs", info ); } return info; }
/***************************************************************************** Copyright (c) 2011, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function sporfsx * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_sporfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const float* s, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ) { lapack_int info = 0; lapack_int* iwork = NULL; float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sporfsx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_ssy_nancheck( matrix_order, uplo, n, a, lda ) ) { return -6; } if( LAPACKE_ssy_nancheck( matrix_order, uplo, n, af, ldaf ) ) { return -8; } if( LAPACKE_sge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -11; } if( nparams>0 ) { if( LAPACKE_s_nancheck( nparams, params, 1 ) ) { return -21; } } if( LAPACKE_lsame( equed, 'y' ) ) { if( LAPACKE_s_nancheck( n, s, 1 ) ) { return -10; } } if( LAPACKE_sge_nancheck( matrix_order, n, nrhs, x, ldx ) ) { return -13; } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,4*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sporfsx_work( matrix_order, uplo, equed, n, nrhs, a, lda, af, ldaf, s, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sporfsx", info ); } return info; }
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * tw68 driver common header file * * Much of this code is derived from the cx88 and sa7134 drivers, which * were in turn derived from the bt87x driver. The original work was by * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab, * Hans Verkuil, Andy Walls and many others. Their work is gratefully * acknowledged. Full credit goes to them - any problems within this code * are mine. * * Copyright (C) 2009 William M. Brack * * Refactored and updated to the latest v4l core frameworks: * * Copyright (C) 2014 Hans Verkuil <hverkuil@xs4all.nl> */ #include <linux/pci.h> #include <linux/videodev2.h> #include <linux/notifier.h> #include <linux/delay.h> #include <linux/mutex.h> #include <linux/io.h> #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> #include <media/videobuf2-v4l2.h> #include <media/videobuf2-dma-sg.h> #include "tw68-reg.h" #define UNSET (-1U) #define TW68_NORMS ( \ V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM | \ V4L2_STD_PAL_M | V4L2_STD_PAL_Nc | V4L2_STD_PAL_60) #define TW68_VID_INTS (TW68_FFERR | TW68_PABORT | TW68_DMAPERR | \ TW68_FFOF | TW68_DMAPI) /* TW6800 chips have trouble with these, so we don't set them for that chip */ #define TW68_VID_INTSX (TW68_FDMIS | TW68_HLOCK | TW68_VLOCK) #define TW68_I2C_INTS (TW68_SBERR | TW68_SBDONE | TW68_SBERR2 | \ TW68_SBDONE2) enum tw68_decoder_type { TW6800, TW6801, TW6804, TWXXXX, }; /* ----------------------------------------------------------- */ /* static data */ struct tw68_tvnorm { char *name; v4l2_std_id id; /* video decoder */ u32 sync_control; u32 luma_control; u32 chroma_ctrl1; u32 chroma_gain; u32 chroma_ctrl2; u32 vgate_misc; /* video scaler */ u32 h_delay; u32 h_delay0; /* for TW6800 */ u32 h_start; u32 h_stop; u32 v_delay; u32 video_v_start; u32 video_v_stop; u32 vbi_v_start_0; u32 vbi_v_stop_0; u32 vbi_v_start_1; /* Techwell specific */ u32 format; }; struct tw68_format { u32 fourcc; u32 depth; u32 twformat; }; /* ----------------------------------------------------------- */ /* card configuration */ #define TW68_BOARD_NOAUTO UNSET #define TW68_BOARD_UNKNOWN 0 #define TW68_BOARD_GENERIC_6802 1 #define TW68_MAXBOARDS 16 #define TW68_INPUT_MAX 4 /* ----------------------------------------------------------- */ /* device / file handle status */ #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ struct tw68_dev; /* forward delclaration */ /* buffer for one video/vbi/ts frame */ struct tw68_buf { struct vb2_v4l2_buffer vb; struct list_head list; unsigned int size; __le32 *cpu; __le32 *jmp; dma_addr_t dma; }; struct tw68_fmt { char *name; u32 fourcc; /* v4l2 format id */ int depth; int flags; u32 twformat; }; /* global device status */ struct tw68_dev { struct mutex lock; spinlock_t slock; u16 instance; struct v4l2_device v4l2_dev; /* various device info */ enum tw68_decoder_type vdecoder; struct video_device vdev; struct v4l2_ctrl_handler hdl; /* pci i/o */ char *name; struct pci_dev *pci; unsigned char pci_rev, pci_lat; u32 __iomem *lmmio; u8 __iomem *bmmio; u32 pci_irqmask; /* The irq mask to be used will depend upon the chip type */ u32 board_virqmask; /* video capture */ const struct tw68_format *fmt; unsigned width, height; unsigned seqnr; unsigned field; struct vb2_queue vidq; struct list_head active; /* various v4l controls */ const struct tw68_tvnorm *tvnorm; /* video */ int input; }; /* ----------------------------------------------------------- */ #define tw_readl(reg) readl(dev->lmmio + ((reg) >> 2)) #define tw_readb(reg) readb(dev->bmmio + (reg)) #define tw_writel(reg, value) writel((value), dev->lmmio + ((reg) >> 2)) #define tw_writeb(reg, value) writeb((value), dev->bmmio + (reg)) #define tw_andorl(reg, mask, value) \ writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ ((value) & (mask)), dev->lmmio+((reg)>>2)) #define tw_andorb(reg, mask, value) \ writeb((readb(dev->bmmio + (reg)) & ~(mask)) |\ ((value) & (mask)), dev->bmmio+(reg)) #define tw_setl(reg, bit) tw_andorl((reg), (bit), (bit)) #define tw_setb(reg, bit) tw_andorb((reg), (bit), (bit)) #define tw_clearl(reg, bit) \ writel((readl(dev->lmmio + ((reg) >> 2)) & ~(bit)), \ dev->lmmio + ((reg) >> 2)) #define tw_clearb(reg, bit) \ writeb((readb(dev->bmmio+(reg)) & ~(bit)), \ dev->bmmio + (reg)) #define tw_wait(us) { udelay(us); } /* ----------------------------------------------------------- */ /* tw68-video.c */ void tw68_set_tvnorm_hw(struct tw68_dev *dev); int tw68_video_init1(struct tw68_dev *dev); int tw68_video_init2(struct tw68_dev *dev, int video_nr); void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status); int tw68_video_start_dma(struct tw68_dev *dev, struct tw68_buf *buf); /* ----------------------------------------------------------- */ /* tw68-risc.c */ int tw68_risc_buffer(struct pci_dev *pci, struct tw68_buf *buf, struct scatterlist *sglist, unsigned int top_offset, unsigned int bottom_offset, unsigned int bpl, unsigned int padding, unsigned int lines);
/* * Copyright (c) 2003, 2007-11 Matteo Frigo * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "ifftw.h" #if HAVE_SIMD # define ALGN 16 #else /* disable the alignment machinery, because it will break, e.g., if sizeof(R) == 12 (as in long-double/x86) */ # define ALGN 0 #endif /* NONPORTABLE */ int X(alignment_of)(R *p) { #if ALGN == 0 UNUSED(p); return 0; #else return (int)(((uintptr_t) p) % ALGN); #endif }
/****************************************************************************** * * Module Name: cfsize - Common get file size function * *****************************************************************************/ /* * Copyright (C) 2000 - 2018, Intel Corp. * 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, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * substantially similar to the "NO WARRANTY" disclaimer below * ("Disclaimer") and any redistribution must be conditioned upon * including a substantially similar Disclaimer requirement for further * binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * 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 MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. */ #include <acpi/acpi.h> #include "accommon.h" #include "acapps.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME("cmfsize") /******************************************************************************* * * FUNCTION: cm_get_file_size * * PARAMETERS: file - Open file descriptor * * RETURN: File Size. On error, -1 (ACPI_UINT32_MAX) * * DESCRIPTION: Get the size of a file. Uses seek-to-EOF. File must be open. * Does not disturb the current file pointer. * ******************************************************************************/ u32 cm_get_file_size(ACPI_FILE file) { long file_size; long current_offset; acpi_status status; /* Save the current file pointer, seek to EOF to obtain file size */ current_offset = ftell(file); if (current_offset < 0) { goto offset_error; } status = fseek(file, 0, SEEK_END); if (ACPI_FAILURE(status)) { goto seek_error; } file_size = ftell(file); if (file_size < 0) { goto offset_error; } /* Restore original file pointer */ status = fseek(file, current_offset, SEEK_SET); if (ACPI_FAILURE(status)) { goto seek_error; } return ((u32)file_size); offset_error: fprintf(stderr, "Could not get file offset\n"); return (ACPI_UINT32_MAX); seek_error: fprintf(stderr, "Could not set file offset\n"); return (ACPI_UINT32_MAX); }
/* * SH7705 Setup * * Copyright (C) 2006, 2007 Paul Mundt * Copyright (C) 2007 Nobuhiro Iwamatsu * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #include <linux/platform_device.h> #include <linux/init.h> #include <linux/irq.h> #include <linux/serial.h> #include <asm/sci.h> #include <asm/rtc.h> enum { UNUSED = 0, /* interrupt sources */ IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, PINT07, PINT815, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI, ADC_ADI, USB_USI0, USB_USI1, TPU0, TPU1, TPU2, TPU3, TMU0, TMU1, TMU2_TUNI, TMU2_TICPI, RTC_ATI, RTC_PRI, RTC_CUI, WDT, REF_RCMI, /* interrupt groups */ RTC, TMU2, DMAC, USB, SCIF2, SCIF0, }; static struct intc_vect vectors[] __initdata = { INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720), INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0), INTC_VECT(SCIF0_TXI, 0x8e0), INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920), INTC_VECT(SCIF2_TXI, 0x960), INTC_VECT(ADC_ADI, 0x980), INTC_VECT(USB_USI0, 0xa20), INTC_VECT(USB_USI1, 0xa40), INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20), INTC_VECT(TPU3, 0xc80), INTC_VECT(TPU1, 0xca0), INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460), INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0), INTC_VECT(RTC_CUI, 0x4c0), INTC_VECT(WDT, 0x560), INTC_VECT(REF_RCMI, 0x580), }; static struct intc_group groups[] __initdata = { INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI), INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI), INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3), INTC_GROUP(USB, USB_USI0, USB_USI1), INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI), INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI), }; static struct intc_prio priorities[] __initdata = { INTC_PRIO(DMAC, 7), INTC_PRIO(SCIF2, 3), INTC_PRIO(SCIF0, 3), }; static struct intc_prio_reg prio_registers[] __initdata = { { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } }, { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } }, { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } }, { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } }, { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } }, { 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } }, { 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } }, }; static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, groups, priorities, NULL, prio_registers, NULL); static struct intc_vect vectors_irq[] __initdata = { INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), }; static DECLARE_INTC_DESC(intc_desc_irq, "sh7705-irq", vectors_irq, NULL, priorities, NULL, prio_registers, NULL); static struct plat_sci_port sci_platform_data[] = { { .mapbase = 0xa4410000, .flags = UPF_BOOT_AUTOCONF, .type = PORT_SCIF, .irqs = { 56, 57, 59 }, }, { .mapbase = 0xa4400000, .flags = UPF_BOOT_AUTOCONF, .type = PORT_SCIF, .irqs = { 52, 53, 55 }, }, { .flags = 0, } }; static struct platform_device sci_device = { .name = "sh-sci", .id = -1, .dev = { .platform_data = sci_platform_data, }, }; static struct resource rtc_resources[] = { [0] = { .start = 0xfffffec0, .end = 0xfffffec0 + 0x1e, .flags = IORESOURCE_IO, }, [1] = { .start = 20, .flags = IORESOURCE_IRQ, }, [2] = { .start = 21, .flags = IORESOURCE_IRQ, }, [3] = { .start = 22, .flags = IORESOURCE_IRQ, }, }; static struct sh_rtc_platform_info rtc_info = { .capabilities = RTC_CAP_4_DIGIT_YEAR, }; static struct platform_device rtc_device = { .name = "sh-rtc", .id = -1, .num_resources = ARRAY_SIZE(rtc_resources), .resource = rtc_resources, .dev = { .platform_data = &rtc_info, }, }; static struct platform_device *sh7705_devices[] __initdata = { &sci_device, &rtc_device, }; static int __init sh7705_devices_setup(void) { return platform_add_devices(sh7705_devices, ARRAY_SIZE(sh7705_devices)); } __initcall(sh7705_devices_setup); void __init plat_irq_setup_pins(int mode) { if (mode == IRQ_MODE_IRQ) { register_intc_controller(&intc_desc_irq); return; } BUG(); } void __init plat_irq_setup(void) { register_intc_controller(&intc_desc); }
/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ /* { dg-do run { target { ! avr_tiny } } } */ #include <stdlib.h> const __flash char c0 = 1; const __flash1 char c1 = 1; int main (void) { const __memx void *p; p = &c0; if (__builtin_avr_flash_segment (p) != 0) abort(); p = &c1; if (__builtin_avr_flash_segment (p) != 1) abort(); if (__builtin_avr_flash_segment ("p") != -1) abort(); exit (0); return 0; }
/* Unix SMB/CIFS implementation. Xattr manipulation bindings. Copyright (C) Matthieu Patou <mat@matws.net> 2009-2010 Base on work of pyglue.c by Jelmer Vernooij <jelmer@samba.org> 2007 and Matthias Dieter Wallnöfer 2009 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <Python.h> #include "includes.h" #include <tdb.h> #include "lib/util/tdb_wrap.h" #include "librpc/ndr/libndr.h" #include "lib/util/wrap_xattr.h" #include "ntvfs/posix/vfs_posix.h" #include "libcli/util/pyerrors.h" static PyObject *py_is_xattr_supported(PyObject *self) { return Py_True; } static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args) { char *filename, *attribute, *tdbname; DATA_BLOB blob; int blobsize; NTSTATUS status; TALLOC_CTX *mem_ctx; struct tdb_wrap *eadb; if (!PyArg_ParseTuple(args, "ssss#", &tdbname, &filename, &attribute, &blob.data, &blobsize)) return NULL; blob.length = blobsize; mem_ctx = talloc_new(NULL); eadb = tdb_wrap_open(mem_ctx, tdbname, 50000, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (eadb == NULL) { PyErr_SetFromErrno(PyExc_IOError); talloc_free(mem_ctx); return NULL; } status = push_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, -1, &blob); if (!NT_STATUS_IS_OK(status)) { PyErr_FromNTSTATUS(status); talloc_free(mem_ctx); return NULL; } talloc_free(mem_ctx); Py_RETURN_NONE; } static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args) { char *filename, *attribute, *tdbname; TALLOC_CTX *mem_ctx; DATA_BLOB blob; PyObject *ret; NTSTATUS status; struct tdb_wrap *eadb = NULL; if (!PyArg_ParseTuple(args, "sss", &tdbname, &filename, &attribute)) return NULL; mem_ctx = talloc_new(NULL); eadb = tdb_wrap_open(mem_ctx, tdbname, 50000, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (eadb == NULL) { PyErr_SetFromErrno(PyExc_IOError); talloc_free(mem_ctx); return NULL; } status = pull_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, -1, 100, &blob); if (!NT_STATUS_IS_OK(status) || blob.length < 0) { PyErr_FromNTSTATUS(status); talloc_free(mem_ctx); return NULL; } ret = PyString_FromStringAndSize((char *)blob.data, blob.length); talloc_free(mem_ctx); return ret; } static PyMethodDef py_xattr_methods[] = { { "wrap_getxattr", (PyCFunction)py_wrap_getxattr, METH_VARARGS, "wrap_getxattr(filename,attribute) -> blob\n" "Retreive given attribute on the given file." }, { "wrap_setxattr", (PyCFunction)py_wrap_setxattr, METH_VARARGS, "wrap_setxattr(filename,attribute,value)\n" "Set the given attribute to the given value on the given file." }, { "is_xattr_supported", (PyCFunction)py_is_xattr_supported, METH_NOARGS, "Return true if xattr are supported on this system\n"}, { NULL } }; void initxattr_tdb(void) { PyObject *m; m = Py_InitModule3("xattr_tdb", py_xattr_methods, "Python bindings for xattr manipulation."); if (m == NULL) return; }
/* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <mgroeger@sysgo.de> * * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Alex Zuepke <azu@sysgo.de> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 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 * ******************************************************************** * NOTE: This header file defines an interface to U-Boot. Including * this (unmodified) header file in another file is considered normal * use of U-Boot, and does *not* fall under the heading of "derived * work". ******************************************************************** */ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1 typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ unsigned long bi_ip_addr; /* IP Address */ unsigned char bi_enetaddr[6]; /* Ethernet adress */ struct environment_s *bi_env; ulong bi_arch_number; /* unique id for this board */ ulong bi_boot_params; /* where this board expects params */ struct /* RAM configuration */ { ulong start; ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; #ifdef CONFIG_HAS_ETH1 /* second onboard ethernet port */ unsigned char bi_enet1addr[6]; #endif } bd_t; #define bi_env_data bi_env->data #define bi_env_crc bi_env->crc #endif /* _U_BOOT_H_ */
// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SOURCE_REDUCE_STRUCTURED_LOOP_TO_SELECTION_REDUCTION_OPPORTUNITY_FINDER_H #define SOURCE_REDUCE_STRUCTURED_LOOP_TO_SELECTION_REDUCTION_OPPORTUNITY_FINDER_H #include "source/reduce/reduction_opportunity_finder.h" namespace spvtools { namespace reduce { // A finder for opportunities to turn structured loops into selections, // generalizing from a human-writable language the idea of turning a loop: // // while (c) { // body; // } // // into: // // if (c) { // body; // } // // Applying such opportunities results in continue constructs of transformed // loops becoming unreachable, so that it may be possible to remove them // subsequently. class StructuredLoopToSelectionReductionOpportunityFinder : public ReductionOpportunityFinder { public: StructuredLoopToSelectionReductionOpportunityFinder() = default; ~StructuredLoopToSelectionReductionOpportunityFinder() override = default; std::string GetName() const final; std::vector<std::unique_ptr<ReductionOpportunity>> GetAvailableOpportunities( opt::IRContext* context) const final; private: }; } // namespace reduce } // namespace spvtools #endif // SOURCE_REDUCE_STRUCTURED_LOOP_TO_SELECTION_REDUCTION_OPPORTUNITY_FINDER_H
/* * LZO1X Decompressor from MiniLZO * * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com> * * The full LZO package can be found at: * http://www.oberhumer.com/opensource/lzo/ * * Changed for kernel use by: * Nitin Gupta <nitingupta910@gmail.com> * Richard Purdie <rpurdie@openedhand.com> */ #include <linux/module.h> #include <linux/kernel.h> #include <asm/byteorder.h> #include <asm/unaligned.h> #include "lzodefs.h" #include "lzo.h" #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) #define HAVE_OP(x, op_end, op) ((size_t)(op_end - op) < (x)) #define HAVE_LB(m_pos, out, op) (m_pos < out || m_pos >= op) #define COPY4(dst, src) \ put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst)) int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) { const unsigned char * const ip_end = in + in_len; unsigned char * const op_end = out + *out_len; const unsigned char *ip = in, *m_pos; unsigned char *op = out; size_t t; *out_len = 0; if (*ip > 17) { t = *ip++ - 17; if (t < 4) goto match_next; if (HAVE_OP(t, op_end, op)) goto output_overrun; if (HAVE_IP(t + 1, ip_end, ip)) goto input_overrun; do { *op++ = *ip++; } while (--t > 0); goto first_literal_run; } while ((ip < ip_end)) { t = *ip++; if (t >= 16) goto match; if (t == 0) { if (HAVE_IP(1, ip_end, ip)) goto input_overrun; while (*ip == 0) { t += 255; ip++; if (HAVE_IP(1, ip_end, ip)) goto input_overrun; } t += 15 + *ip++; } if (HAVE_OP(t + 3, op_end, op)) goto output_overrun; if (HAVE_IP(t + 4, ip_end, ip)) goto input_overrun; COPY4(op, ip); op += 4; ip += 4; if (--t > 0) { if (t >= 4) { do { COPY4(op, ip); op += 4; ip += 4; t -= 4; } while (t >= 4); if (t > 0) { do { *op++ = *ip++; } while (--t > 0); } } else { do { *op++ = *ip++; } while (--t > 0); } } first_literal_run: t = *ip++; if (t >= 16) goto match; m_pos = op - (1 + M2_MAX_OFFSET); m_pos -= t >> 2; m_pos -= *ip++ << 2; if (HAVE_LB(m_pos, out, op)) goto lookbehind_overrun; if (HAVE_OP(3, op_end, op)) goto output_overrun; *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; goto match_done; do { match: if (t >= 64) { m_pos = op - 1; m_pos -= (t >> 2) & 7; m_pos -= *ip++ << 3; t = (t >> 5) - 1; if (HAVE_LB(m_pos, out, op)) goto lookbehind_overrun; if (HAVE_OP(t + 3 - 1, op_end, op)) goto output_overrun; goto copy_match; } else if (t >= 32) { t &= 31; if (t == 0) { if (HAVE_IP(1, ip_end, ip)) goto input_overrun; while (*ip == 0) { t += 255; ip++; if (HAVE_IP(1, ip_end, ip)) goto input_overrun; } t += 31 + *ip++; } m_pos = op - 1; m_pos -= le16_to_cpu(get_unaligned( (const unsigned short *)ip)) >> 2; ip += 2; } else if (t >= 16) { m_pos = op; m_pos -= (t & 8) << 11; t &= 7; if (t == 0) { if (HAVE_IP(1, ip_end, ip)) goto input_overrun; while (*ip == 0) { t += 255; ip++; if (HAVE_IP(1, ip_end, ip)) goto input_overrun; } t += 7 + *ip++; } m_pos -= le16_to_cpu(get_unaligned( (const unsigned short *)ip)) >> 2; ip += 2; if (m_pos == op) goto eof_found; m_pos -= 0x4000; } else { m_pos = op - 1; m_pos -= t >> 2; m_pos -= *ip++ << 2; if (HAVE_LB(m_pos, out, op)) goto lookbehind_overrun; if (HAVE_OP(2, op_end, op)) goto output_overrun; *op++ = *m_pos++; *op++ = *m_pos; goto match_done; } if (HAVE_LB(m_pos, out, op)) goto lookbehind_overrun; if (HAVE_OP(t + 3 - 1, op_end, op)) goto output_overrun; if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) { COPY4(op, m_pos); op += 4; m_pos += 4; t -= 4 - (3 - 1); do { COPY4(op, m_pos); op += 4; m_pos += 4; t -= 4; } while (t >= 4); if (t > 0) do { *op++ = *m_pos++; } while (--t > 0); } else { copy_match: *op++ = *m_pos++; *op++ = *m_pos++; do { *op++ = *m_pos++; } while (--t > 0); } match_done: t = ip[-2] & 3; if (t == 0) break; match_next: if (HAVE_OP(t, op_end, op)) goto output_overrun; if (HAVE_IP(t + 1, ip_end, ip)) goto input_overrun; *op++ = *ip++; if (t > 1) { *op++ = *ip++; if (t > 2) *op++ = *ip++; } t = *ip++; } while (ip < ip_end); } *out_len = op - out; return LZO_E_EOF_NOT_FOUND; eof_found: *out_len = op - out; return (ip == ip_end ? LZO_E_OK : (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); input_overrun: *out_len = op - out; return LZO_E_INPUT_OVERRUN; output_overrun: *out_len = op - out; return LZO_E_OUTPUT_OVERRUN; lookbehind_overrun: *out_len = op - out; return LZO_E_LOOKBEHIND_OVERRUN; } EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("LZO1X Decompressor");
#ifndef GRIM_LTASK_H #define GRIM_LTASK_H #include "engines/grim/lua/lua.h" #include "engines/grim/lua/lstate.h" namespace Grim { struct lua_Task { lua_Task *next; struct Stack *S; Closure *cl; TProtoFunc *tf; StkId base; byte *pc; TObject *consts; int32 aux; bool some_flag; StkId some_base; int32 some_results; }; void lua_taskinit(lua_Task *task, lua_Task *next, StkId tbase, int results); void lua_taskresume(lua_Task *task, Closure *closure, TProtoFunc *protofunc, StkId tbase); StkId luaV_execute(lua_Task *task); void start_script(); void stop_script(); void next_script(); void identify_script(); void pause_script(); void pause_scripts(); void unpause_script(); void unpause_scripts(); void find_script(); void break_here(); void sleep_for(); void runtasks(LState *const rootState); } // end of namespace Grim #endif
/* cast128.h * * The CAST-128 block cipher. */ /* CAST-128 in C * Written by Steve Reid <sreid@sea-to-sky.net> * 100% Public Domain - no warranty * Released 1997.10.11 */ /* nettle, low-level cryptographics library * * Copyright (C) 2001 Niels Möller * * The nettle 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. * * The nettle 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 the nettle library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02111-1301, USA. */ #ifndef NETTLE_CAST128_H_INCLUDED #define NETTLE_CAST128_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define cast128_set_key nettle_cast128_set_key #define cast128_encrypt nettle_cast128_encrypt #define cast128_decrypt nettle_cast128_decrypt #define CAST128_BLOCK_SIZE 8 /* Variable key size between 40 and 128. */ #define CAST128_MIN_KEY_SIZE 5 #define CAST128_MAX_KEY_SIZE 16 #define CAST128_KEY_SIZE 16 struct cast128_ctx { uint32_t keys[32]; /* Key, after expansion */ unsigned rounds; /* Number of rounds to use, 12 or 16 */ }; void cast128_set_key(struct cast128_ctx *ctx, unsigned length, const uint8_t *key); void cast128_encrypt(const struct cast128_ctx *ctx, unsigned length, uint8_t *dst, const uint8_t *src); void cast128_decrypt(const struct cast128_ctx *ctx, unsigned length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_CAST128_H_INCLUDED */
/*- * Copyright (c) 2005 Doug Rabson * 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 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 AUTHOR 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. * * $FreeBSD: src/lib/libgssapi/gss_release_name.c,v 1.1 2005/12/29 14:40:20 dfr Exp $ */ #include "mech_locl.h" /** * Free a name * * import_name can point to NULL or be NULL, or a pointer to a * gss_name_t structure. If it was a pointer to gss_name_t, the * pointer will be set to NULL on success and failure. * * @param minor_status minor status code * @param input_name name to free * * @returns a gss_error code, see gss_display_status() about printing * the error code. * * @ingroup gssapi */ GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_name(OM_uint32 *minor_status, gss_name_t *input_name) { struct _gss_name *name; *minor_status = 0; if (input_name == NULL || *input_name == NULL) return GSS_S_COMPLETE; name = (struct _gss_name *) *input_name; if (name->gn_type.elements) free(name->gn_type.elements); while (HEIM_SLIST_FIRST(&name->gn_mn)) { struct _gss_mechanism_name *mn; mn = HEIM_SLIST_FIRST(&name->gn_mn); HEIM_SLIST_REMOVE_HEAD(&name->gn_mn, gmn_link); mn->gmn_mech->gm_release_name(minor_status, &mn->gmn_name); free(mn); } gss_release_buffer(minor_status, &name->gn_value); free(name); *input_name = GSS_C_NO_NAME; return (GSS_S_COMPLETE); }
/* * Atmel maXTouch Touchscreen driver * * Copyright (C) 2010 Samsung Electronics Co.Ltd * Author: Joonyoung Shim <jy0922.shim@samsung.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #ifndef __LINUX_ATMEL_MXT_TS_H #define __LINUX_ATMEL_MXT_TS_H #ifndef CUST_A_TOUCH #define CUST_A_TOUCH #endif #ifndef USE_FW_11AA #define USE_FW_11AA #endif #include <linux/types.h> #include <linux/fb.h> #define MXT_DEVICE_NAME "touch_mxt1188S" #define MXT_MAX_NUM_TOUCHES 10 #ifdef USE_FW_11AA #define MXT_LATEST_FW_VERSION 0x11 #ifdef CONFIG_TOUCHSCREEN_LGE_LPWG #define MXT_LATEST_FW_BUILD 0xFD #else #define MXT_LATEST_FW_BUILD 0xAA #endif #else //USE_FW_11AA #define MXT_LATEST_FW_VERSION 0x20 #define MXT_LATEST_FW_BUILD 0xAB #endif //USE_FW_11AA #define LGE_TOUCH_NAME "lge_touch" enum { MXT_RESERVED_T0 = 0, MXT_RESERVED_T1, MXT_DEBUG_DELTAS_T2, MXT_DEBUG_REFERENCES_T3, MXT_DEBUG_SIGNALS_T4, MXT_GEN_MESSAGE_T5, MXT_GEN_COMMAND_T6, MXT_GEN_POWER_T7, MXT_GEN_ACQUIRE_T8, MXT_TOUCH_MULTI_T9, MXT_TOUCH_SINGLETOUCHSCREEN_T10, MXT_TOUCH_XSLIDER_T11, MXT_TOUCH_YSLIDER_T12, MXT_TOUCH_XWHEEL_T13, MXT_TOUCH_YWHEEL_T14, MXT_TOUCH_KEYARRAY_T15, MXT_PROCG_SIGNALFILTER_T16, MXT_PROCI_LINEARIZATIONTABLE_T17, MXT_SPT_COMMSCONFIG_T18, MXT_SPT_GPIOPWM_T19, MXT_PROCI_GRIPFACE_T20, MXT_RESERVED_T21, MXT_PROCG_NOISE_T22, MXT_TOUCH_PROXIMITY_T23, MXT_PROCI_ONETOUCH_T24, MXT_SPT_SELFTEST_T25, MXT_DEBUG_CTERANGE_T26, MXT_PROCI_TWOTOUCH_T27, MXT_SPT_CTECONFIG_T28, MXT_SPT_GPI_T29, MXT_SPT_GATE_T30, MXT_TOUCH_KEYSET_T31, MXT_TOUCH_XSLIDERSET_T32, MXT_RESERVED_T33, MXT_GEN_MESSAGEBLOCK_T34, MXT_SPT_GENERICDATA_T35, MXT_RESERVED_T36, MXT_DEBUG_DIAGNOSTIC_T37, MXT_SPT_USERDATA_T38, MXT_SPARE_T39, MXT_PROCI_GRIP_T40, MXT_SPARE_T41, MXT_PROCI_TOUCHSUPPRESSION_T42, MXT_SPT_DIGITIZER_T43, MXT_SPT_MESSAGECOUNT_T44, MXT_SPARE_T45, MXT_SPT_CTECONFIG_T46, MXT_PROCI_STYLUS_T47, MXT_SPT_NOISESUPPRESSION_T48, MXT_SPARE_T49, MXT_SPARE_T50, MXT_SPARE_T51, MXT_TOUCH_PROXKEY_T52, MXT_GEN_DATASOURCE_T53, MXT_SPARE_T54, MXT_PROCI_ADAPTIVETHRESHOLD_T55, MXT_PROCI_SHIELDLESS_T56, MXT_PROCI_EXTRATOUCHSCREENDATA_T57, MXT_SPARE_T58, MXT_SPARE_T59, MXT_SPARE_T60, MXT_SPT_TIMER_T61, MXT_PROCG_NOISESUPPRESSION_T62, MXT_PROCI_ACTIVE_STYLUS_T63, MXT_PROCI_LENSBENDING_T65 = 65, MXT_GOLDENREFERENCES_T66, MXT_SERIALDATACOMMAND_T68 = 68, MXT_SPT_DYNAMICCONFIGURATIONCONTROLLER_T70 = 70, MXT_SPT_DYNAMICCONFIGURATIONCONTAINER_T71, MXT_PROCI_ZONEINDICATION_T73 = 73, MXT_SPT_CTESCANCONFIG_T77 = 77, MXT_SPT_TOUCHEVENTTRIGGER_T79 = 79, #ifdef USE_FW_11AA MXT_SPT_NOISESUPEXTENSION_T82 = 82, #endif MXT_TOUCH_MULTITOUCHSCREEN_T100 = 100, #ifdef CONFIG_TOUCHSCREEN_LGE_LPWG MXT_PROCI_TOUCH_SEQUENCE_LOGGER_T93 = 93, #endif MXT_RESERVED_T255 = 255, }; #ifdef CUST_A_TOUCH enum{ FINGER_INACTIVE = 0, FINGER_RELEASED, FINGER_PRESSED, FINGER_MOVED }; #endif enum{ CARD_X_PORT = 1800, CARD_Y_PORT = 1800, CARD_X_LAND = 2900, CARD_Y_LAND = 1000 }; /* The platform data for the Atmel maXTouch touchscreen driver */ struct mxt_platform_data { u8 numtouch; /* Number of touches to report */ int display_res_x; int display_res_y; int min_x; int min_y; int max_x; /* The default reported X range */ int max_y; /* The default reported Y range */ bool wakeup; unsigned long irqflags; u8 t19_num_keys; const unsigned int *t19_keymap; int t15_num_keys; const unsigned int *t15_keymap; unsigned long gpio_reset; unsigned long gpio_int; const char *cfg_name; const u8 **config; const u8 **charger_config; const u8 **restore_config; const u8 **pen_config; const u8 **pen_high_speed_config; const u8 **pen_low_speed_config; const u8 **unpen_config; #ifdef CONFIG_TOUCHSCREEN_ATMEL_KNOCK_ON const u8 **sus_config; const u8 **sus_charger_config; const u8 **act_config; char knock_on_type; #endif const u8 **sus_udf_config; const u8 **sus_udf_charger_config; const u8 **act_udf_config; #ifdef CUST_A_TOUCH int accuracy_filter_enable; int ghost_detection_enable; #endif }; int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data); #endif /* __LINUX_ATMEL_MXT_TS_H */
/* Functional tests for the function hotpatching feature. */ /* { dg-do compile { target { ! lp64 } } } */ /* { dg-options "-mesa -march=g5 -Wno-deprecated -mhotpatch=0,4" } */ #include <stdio.h> void hp1(void) { printf("hello, world!\n"); } /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ /* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(4 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 2 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */
#define STANDALONE #include "application.c"
/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef __INC_ENTROPYMV_H #define __INC_ENTROPYMV_H #include "treecoder.h" enum { mv_max = 1023, /* max absolute value of a MV component */ MVvals = (2 * mv_max) + 1, /* # possible values "" */ mvlong_width = 10, /* Large MVs have 9 bit magnitudes */ mvnum_short = 8, /* magnitudes 0 through 7 */ /* probability offsets for coding each MV component */ mvpis_short = 0, /* short (<= 7) vs long (>= 8) */ MVPsign, /* sign for non-zero */ MVPshort, /* 8 short values = 7-position tree */ MVPbits = MVPshort + mvnum_short - 1, /* mvlong_width long value bits */ MVPcount = MVPbits + mvlong_width /* (with independent probabilities) */ }; typedef struct mv_context { vp8_prob prob[MVPcount]; /* often come in row, col pairs */ } MV_CONTEXT; extern const MV_CONTEXT vp8_mv_update_probs[2], vp8_default_mv_context[2]; #endif
/* Raise given exceptions. Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Huggins-Daines <dhd@debian.org> The GNU C 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. The GNU C 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 the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #include <fenv.h> #include <float.h> #include <math.h> /* Please see section 10, page 10-5 "Delayed Trapping" in the PA-RISC 2.0 Architecture manual */ int __feraiseexcept (int excepts) { /* Raise exceptions represented by EXCEPTS. But we must raise only one signal at a time. It is important that if the overflow/underflow exception and the divide by zero exception are given at the same time, the overflow/underflow exception follows the divide by zero exception. */ /* We do these bits in assembly to be certain GCC doesn't optimize away something important, and so we can force delayed traps to occur. */ /* We use "fldd 0(%%sr0,%%sp),%0" to flush the delayed exception */ /* First: Invalid exception. */ if (excepts & FE_INVALID) { /* One example of an invalid operation is 0 * Infinity. */ double d = HUGE_VAL; __asm__ __volatile__ ( " fcpy,dbl %%fr0,%%fr22\n" " fmpy,dbl %0,%%fr22,%0\n" " fldd 0(%%sr0,%%sp),%0" : "+f" (d) : : "%fr22" ); } /* Second: Division by zero. */ if (excepts & FE_DIVBYZERO) { double d = 1.0; __asm__ __volatile__ ( " fcpy,dbl %%fr0,%%fr22\n" " fdiv,dbl %0,%%fr22,%0\n" " fldd 0(%%sr0,%%sp),%0" : "+f" (d) : : "%fr22" ); } /* Third: Overflow. */ if (excepts & FE_OVERFLOW) { double d = DBL_MAX; __asm__ __volatile__ ( " fadd,dbl %0,%0,%0\n" " fldd 0(%%sr0,%%sp),%0" : "+f" (d) ); } /* Fourth: Underflow. */ if (excepts & FE_UNDERFLOW) { double d = DBL_MIN; double e = 3.0; __asm__ __volatile__ ( " fdiv,dbl %0,%1,%0\n" " fldd 0(%%sr0,%%sp),%0" : "+f" (d) : "f" (e) ); } /* Fifth: Inexact */ if (excepts & FE_INEXACT) { double d = M_PI; double e = 69.69; __asm__ __volatile__ ( " fdiv,dbl %0,%1,%%fr22\n" " fcnvfxt,dbl,sgl %%fr22,%%fr22L\n" " fldd 0(%%sr0,%%sp),%%fr22" : : "f" (d), "f" (e) : "%fr22" ); } /* Success. */ return 0; } libm_hidden_def (__feraiseexcept) weak_alias (__feraiseexcept, feraiseexcept) libm_hidden_weak (feraiseexcept)
#ifndef __LWP_OBJMGR_H__ #define __LWP_OBJMGR_H__ #include <gctypes.h> #include "lwp_queue.h" #define LWP_OBJMASKTYPE(type) ((type)<<16) #define LWP_OBJMASKID(id) ((id)&0xffff) #define LWP_OBJTYPE(id) ((id)>>16) #ifdef __cplusplus extern "C" { #endif typedef struct _lwp_objinfo lwp_objinfo; typedef struct _lwp_obj { lwp_node node; s32 id; lwp_objinfo *information; } lwp_obj; struct _lwp_objinfo { u32 min_id; u32 max_id; u32 max_nodes; u32 node_size; lwp_obj **local_table; void *obj_blocks; lwp_queue inactives; u32 inactives_cnt; }; void __lwp_objmgr_initinfo(lwp_objinfo *info,u32 max_nodes,u32 node_size); void __lwp_objmgr_free(lwp_objinfo *info,lwp_obj *object); lwp_obj* __lwp_objmgr_allocate(lwp_objinfo *info); lwp_obj* __lwp_objmgr_get(lwp_objinfo *info,u32 id); lwp_obj* __lwp_objmgr_getisrdisable(lwp_objinfo *info,u32 id,u32 *p_level); lwp_obj* __lwp_objmgr_getnoprotection(lwp_objinfo *info,u32 id); #ifdef LIBOGC_INTERNAL #include <libogc/lwp_objmgr.inl> #endif #ifdef __cplusplus } #endif #endif
/*------------------------------------------------------------------------- * * catversion.h * "Catalog version number" for PostgreSQL. * * The catalog version number is used to flag incompatible changes in * the PostgreSQL system catalogs. Whenever anyone changes the format of * a system catalog relation, or adds, deletes, or modifies standard * catalog entries in such a way that an updated backend wouldn't work * with an old database (or vice versa), the catalog version number * should be changed. The version number stored in pg_control by initdb * is checked against the version number compiled into the backend at * startup time, so that a backend can refuse to run in an incompatible * database. * * The point of this feature is to provide a finer grain of compatibility * checking than is possible from looking at the major version number * stored in PG_VERSION. It shouldn't matter to end users, but during * development cycles we usually make quite a few incompatible changes * to the contents of the system catalogs, and we don't want to bump the * major version number for each one. What we can do instead is bump * this internal version number. This should save some grief for * developers who might otherwise waste time tracking down "bugs" that * are really just code-vs-database incompatibilities. * * The rule for developers is: if you commit a change that requires * an initdb, you should update the catalog version number (as well as * notifying the pghackers mailing list, which has been the informal * practice for a long time). * * The catalog version number is placed here since modifying files in * include/catalog is the most common kind of initdb-forcing change. * But it could be used to protect any kind of incompatible change in * database contents or layout, such as altering tuple headers. * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.531 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef CATVERSION_H #define CATVERSION_H /* * We could use anything we wanted for version numbers, but I recommend * following the "YYYYMMDDN" style often used for DNS zone serial numbers. * YYYYMMDD are the date of the change, and N is the number of the change * on that day. (Hopefully we'll never commit ten independent sets of * catalog changes on the same day...) */ /* yyyymmddN */ #define CATALOG_VERSION_NO 201507221 #endif
/* * * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <grpc/support/port_platform.h> #ifdef GPR_POSIX_ENV #include "src/core/lib/support/env.h" #include <stdlib.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include "src/core/lib/support/string.h" const char *gpr_getenv_silent(const char *name, char **dst) { *dst = gpr_getenv(name); return NULL; } char *gpr_getenv(const char *name) { char *result = getenv(name); return result == NULL ? result : gpr_strdup(result); } void gpr_setenv(const char *name, const char *value) { int res = setenv(name, value, 1); GPR_ASSERT(res == 0); } #endif /* GPR_POSIX_ENV */
// license:BSD-3-Clause // copyright-holders:Nigel Barnes /********************************************************************** ACP Advanced Plus 5 **********************************************************************/ #ifndef MAME_BUS_ELECTRON_CART_AP5_H #define MAME_BUS_ELECTRON_CART_AP5_H #include "slot.h" #include "machine/6522via.h" #include "machine/input_merger.h" #include "bus/bbc/1mhzbus/1mhzbus.h" #include "bus/bbc/tube/tube.h" #include "bus/bbc/userport/userport.h" #include "bus/generic/slot.h" #include "bus/generic/carts.h" //************************************************************************** // TYPE DEFINITIONS //************************************************************************** class electron_ap5_device : public device_t, public device_electron_cart_interface { public: // construction/destruction electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides virtual void device_start() override; // optional information overrides virtual void device_add_mconfig(machine_config &config) override; // electron_cart_interface overrides virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override; virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override; private: image_init_result load_rom(device_image_interface &image, generic_slot_device *slot); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romslot[0]); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); } required_device<input_merger_device> m_irqs; required_device<via6522_device> m_via; required_device<bbc_tube_slot_device> m_tube; required_device<bbc_1mhzbus_slot_device> m_1mhzbus; required_device<bbc_userport_slot_device> m_userport; required_device_array<generic_slot_device, 2> m_romslot; }; // device type definition DECLARE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device) #endif // MAME_BUS_ELECTRON_CART_AP5_H
// license:CC0 // copyright-holders:Aaron Giles #ifndef MAME_AUDIO_NL_SEGAUSB_H #define MAME_AUDIO_NL_SEGAUSB_H #pragma once NETLIST_EXTERNAL(segausb) #endif // MAME_AUDIO_NL_SEGAUSB_H
/* * This file is part of ltrace. * Copyright (C) 2012 Petr Machata, Red Hat Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /* _GNU_SOURCE may be necessary for open_memstream visibility (see * configure.ac), and there's no harm defining it just in case. */ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include "config.h" #include "memstream.h" int memstream_init(struct memstream *memstream) { #if HAVE_OPEN_MEMSTREAM memstream->stream = open_memstream(&memstream->buf, &memstream->size); #else memstream->stream = tmpfile(); memstream->buf = NULL; #endif return memstream->stream != NULL ? 0 : -1; } int memstream_close(struct memstream *memstream) { #if !defined(HAVE_OPEN_MEMSTREAM) || !HAVE_OPEN_MEMSTREAM if (fseek(memstream->stream, 0, SEEK_END) < 0) { fail: fclose(memstream->stream); return -1; } memstream->size = ftell(memstream->stream); if (memstream->size == (size_t)-1) goto fail; memstream->buf = malloc(memstream->size); if (memstream->buf == NULL) goto fail; rewind(memstream->stream); if (fread(memstream->buf, 1, memstream->size, memstream->stream) < memstream->size) goto fail; #endif return fclose(memstream->stream) == 0 ? 0 : -1; } void memstream_destroy(struct memstream *memstream) { free(memstream->buf); }
/* * LPC utility code * Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_LPC_H #define AVCODEC_LPC_H #include <stdint.h> #include "libavutil/avassert.h" #define ORDER_METHOD_EST 0 #define ORDER_METHOD_2LEVEL 1 #define ORDER_METHOD_4LEVEL 2 #define ORDER_METHOD_8LEVEL 3 #define ORDER_METHOD_SEARCH 4 #define ORDER_METHOD_LOG 5 #define MIN_LPC_ORDER 1 #define MAX_LPC_ORDER 32 /** * LPC analysis type */ enum FFLPCType { FF_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type FF_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients FF_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients FF_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion FF_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization FF_LPC_TYPE_NB , ///< Not part of ABI }; typedef struct LPCContext { int blocksize; int max_order; enum FFLPCType lpc_type; double *windowed_buffer; double *windowed_samples; /** * Apply a Welch window to an array of input samples. * The output samples have the same scale as the input, but are in double * sample format. * @param data input samples * @param len number of input samples * @param w_data output samples */ void (*lpc_apply_welch_window)(const int32_t *data, int len, double *w_data); /** * Perform autocorrelation on input samples with delay of 0 to lag. * @param data input samples. * constraints: no alignment needed, but must have have at * least lag*sizeof(double) valid bytes preceding it, and * size must be at least (len+1)*sizeof(double) if data is * 16-byte aligned or (len+2)*sizeof(double) if data is * unaligned. * @param len number of input samples to process * @param lag maximum delay to calculate * @param autoc output autocorrelation coefficients. * constraints: array size must be at least lag+1. */ void (*lpc_compute_autocorr)(const double *data, int len, int lag, double *autoc); } LPCContext; /** * Calculate LPC coefficients for multiple orders */ int ff_lpc_calc_coefs(LPCContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, enum FFLPCType lpc_type, int lpc_passes, int omethod, int max_shift, int zero_shift); int ff_lpc_calc_ref_coefs(LPCContext *s, const int32_t *samples, int order, double *ref); /** * Initialize LPCContext. */ int ff_lpc_init(LPCContext *s, int blocksize, int max_order, enum FFLPCType lpc_type); void ff_lpc_init_x86(LPCContext *s); /** * Uninitialize LPCContext. */ void ff_lpc_end(LPCContext *s); #ifdef LPC_USE_DOUBLE #define LPC_TYPE double #else #define LPC_TYPE float #endif /** * Schur recursion. * Produces reflection coefficients from autocorrelation data. */ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *ref, LPC_TYPE *error) { int i, j; LPC_TYPE err; LPC_TYPE gen0[MAX_LPC_ORDER], gen1[MAX_LPC_ORDER]; for (i = 0; i < max_order; i++) gen0[i] = gen1[i] = autoc[i + 1]; err = autoc[0]; ref[0] = -gen1[0] / err; err += gen1[0] * ref[0]; if (error) error[0] = err; for (i = 1; i < max_order; i++) { for (j = 0; j < max_order - i; j++) { gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j]; gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j]; } ref[i] = -gen1[0] / err; err += gen1[0] * ref[i]; if (error) error[i] = err; } } /** * Levinson-Durbin recursion. * Produce LPC coefficients from autocorrelation data. */ static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize) { int i, j; LPC_TYPE err; LPC_TYPE *lpc_last = lpc; av_assert2(normalize || !fail); if (normalize) err = *autoc++; if (fail && (autoc[max_order - 1] == 0 || err <= 0)) return -1; for(i=0; i<max_order; i++) { LPC_TYPE r = -autoc[i]; if (normalize) { for(j=0; j<i; j++) r -= lpc_last[j] * autoc[i-j-1]; r /= err; err *= 1.0 - (r * r); } lpc[i] = r; for(j=0; j < (i+1)>>1; j++) { LPC_TYPE f = lpc_last[ j]; LPC_TYPE b = lpc_last[i-1-j]; lpc[ j] = f + r * b; lpc[i-1-j] = b + r * f; } if (fail && err < 0) return -1; lpc_last = lpc; lpc += lpc_stride; } return 0; } #endif /* AVCODEC_LPC_H */
/* * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ #ifndef ctrlplane_db_client_h #define ctrlplane_db_client_h #include "base/util.h" class DBClient { public: private: DISALLOW_COPY_AND_ASSIGN(DBClient); }; #endif
/* * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) * * References: * IETF RFC 1321: The MD5 Message-Digest Algorithm * Ron Rivest. IETF, April, 1992 * * based on http://ubiqx.org/libcifs/source/Auth/MD5.c * from Christopher R. Hertel (crh@ubiqx.mn.org) * Simplified, cleaned and IMO redundant comments removed by michael. * * If you use gcc, then version 4.1 or later and -fomit-frame-pointer is * strongly recommended. * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "common.h" #include <string.h> #include "md5.h" typedef struct AVMD5{ uint64_t len; uint8_t block[64]; uint32_t ABCD[4]; } AVMD5; const int av_md5_size= sizeof(AVMD5); static const uint8_t S[4][4] = { { 7, 12, 17, 22 }, /* Round 1 */ { 5, 9, 14, 20 }, /* Round 2 */ { 4, 11, 16, 23 }, /* Round 3 */ { 6, 10, 15, 21 } /* Round 4 */ }; static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32) 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */ 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* Round 2 */ 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* Round 3 */ 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* Round 4 */ 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, }; #define CORE(i, a, b, c, d) \ t = S[i>>4][i&3];\ a += T[i];\ \ if(i<32){\ if(i<16) a += (d ^ (b&(c^d))) + X[ i &15 ];\ else a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ];\ }else{\ if(i<48) a += (b^c^d) + X[ (5+3*i)&15 ];\ else a += (c^(b|~d)) + X[ ( 7*i)&15 ];\ }\ a = b + (( a << t ) | ( a >> (32 - t) )); static void body(uint32_t ABCD[4], uint32_t X[16]){ int t; int i av_unused; unsigned int a= ABCD[3]; unsigned int b= ABCD[2]; unsigned int c= ABCD[1]; unsigned int d= ABCD[0]; #ifdef WORDS_BIGENDIAN for(i=0; i<16; i++) X[i]= bswap_32(X[i]); #endif #ifdef CONFIG_SMALL for( i = 0; i < 64; i++ ){ CORE(i,a,b,c,d) t=d; d=c; c=b; b=a; a=t; } #else #define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a) #define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12)) CORE4(0) CORE4(16) CORE4(32) CORE4(48) #endif ABCD[0] += d; ABCD[1] += c; ABCD[2] += b; ABCD[3] += a; } void av_md5_init(AVMD5 *ctx){ ctx->len = 0; ctx->ABCD[0] = 0x10325476; ctx->ABCD[1] = 0x98badcfe; ctx->ABCD[2] = 0xefcdab89; ctx->ABCD[3] = 0x67452301; } void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){ int i, j; j= ctx->len & 63; ctx->len += len; for( i = 0; i < len; i++ ){ ctx->block[j++] = src[i]; if( 64 == j ){ body(ctx->ABCD, (uint32_t*) ctx->block); j = 0; } } } void av_md5_final(AVMD5 *ctx, uint8_t *dst){ int i; uint64_t finalcount= le2me_64(ctx->len<<3); av_md5_update(ctx, "\200", 1); while((ctx->len & 63)<56) av_md5_update(ctx, "", 1); av_md5_update(ctx, (uint8_t*)&finalcount, 8); for(i=0; i<4; i++) ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); } void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){ AVMD5 ctx[1]; av_md5_init(ctx); av_md5_update(ctx, src, len); av_md5_final(ctx, dst); } #ifdef TEST #include <stdio.h> #undef printf int main(void){ uint64_t md5val; int i; uint8_t in[1000]; for(i=0; i<1000; i++) in[i]= i*i; av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%"PRId64"\n", md5val); av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%"PRId64"\n", md5val); av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%"PRId64"\n", md5val); av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%"PRId64"\n", md5val); for(i=0; i<1000; i++) in[i]= i % 127; av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%"PRId64"\n", md5val); return 0; } #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ #include <string> #include "base/macros.h" #include "base/threading/thread_checker.h" #include "net/base/net_export.h" #include "net/url_request/url_request.h" namespace base { template <typename T> struct DefaultSingletonTraits; } // namespace base namespace net { // This class is responsible for managing the set of protocol factories and // request interceptors that determine how an URLRequestJob gets created to // handle an URLRequest. // // MULTI-THREADING NOTICE: // URLRequest is designed to have all consumers on a single thread, and // so no attempt is made to support Interceptor instances being // registered/unregistered or in any way poked on multiple threads. class NET_EXPORT URLRequestJobManager { public: // Returns the singleton instance. static URLRequestJobManager* GetInstance(); // Instantiate an URLRequestJob implementation based on the registered // interceptors and protocol factories. This will always succeed in // returning a job unless we are--in the extreme case--out of memory. URLRequestJob* CreateJob(URLRequest* request, NetworkDelegate* network_delegate) const; // Allows interceptors to hijack the request after examining the new location // of a redirect. Returns NULL if no interceptor intervenes. URLRequestJob* MaybeInterceptRedirect(URLRequest* request, NetworkDelegate* network_delegate, const GURL& location) const; // Allows interceptors to hijack the request after examining the response // status and headers. This is also called when there is no server response // at all to allow interception of failed requests due to network errors. // Returns NULL if no interceptor intervenes. URLRequestJob* MaybeInterceptResponse( URLRequest* request, NetworkDelegate* network_delegate) const; // Returns true if the manager has a built-in handler for |scheme|. static bool SupportsScheme(const std::string& scheme); private: friend struct base::DefaultSingletonTraits<URLRequestJobManager>; URLRequestJobManager(); ~URLRequestJobManager(); // The first guy to call this function sets the allowed thread. This way we // avoid needing to define that thread externally. Since we expect all // callers to be on the same thread, we don't worry about threads racing to // set the allowed thread. bool IsAllowedThread() const { #if 0 return thread_checker_.CalledOnValidThread(); } // We use this to assert that CreateJob and the registration functions all // run on the same thread. base::ThreadChecker thread_checker_; #else // The previous version of this check used GetCurrentThread on Windows to // get thread handles to compare. Unfortunately, GetCurrentThread returns // a constant pseudo-handle (0xFFFFFFFE), and therefore IsAllowedThread // always returned true. The above code that's turned off is the correct // code, but causes the tree to turn red because some caller isn't // respecting our thread requirements. We're turning off the check for now; // bug http://b/issue?id=1338969 has been filed to fix things and turn the // check back on. return true; } #endif DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); }; } // namespace net #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_
/* This testcase is part of GDB, the GNU debugger. Copyright 2010-2012 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ int symbol_without_target_section;
/* * Copyright (C) 2005-2011 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MANGOS_GRIDSTATES_H #define MANGOS_GRIDSTATES_H #include "Map.h" class MANGOS_DLL_DECL GridState { public: virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0; }; class MANGOS_DLL_DECL InvalidState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; class MANGOS_DLL_DECL ActiveState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; class MANGOS_DLL_DECL IdleState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; class MANGOS_DLL_DECL RemovalState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; #endif
// SPDX-License-Identifier: ISC /* Copyright (C) 2020 MediaTek Inc. */ #include "mt7915.h" #include "eeprom.h" static u32 mt7915_eeprom_read(struct mt7915_dev *dev, u32 offset) { u8 *data = dev->mt76.eeprom.data; if (data[offset] == 0xff) mt7915_mcu_get_eeprom(dev, offset); return data[offset]; } static int mt7915_eeprom_load(struct mt7915_dev *dev) { int ret; ret = mt76_eeprom_init(&dev->mt76, MT7915_EEPROM_SIZE); if (ret < 0) return ret; if (ret) dev->flash_mode = true; else memset(dev->mt76.eeprom.data, -1, MT7915_EEPROM_SIZE); return 0; } static int mt7915_check_eeprom(struct mt7915_dev *dev) { u8 *eeprom = dev->mt76.eeprom.data; u16 val; mt7915_eeprom_read(dev, MT_EE_CHIP_ID); val = get_unaligned_le16(eeprom); switch (val) { case 0x7915: return 0; default: return -EINVAL; } } void mt7915_eeprom_parse_band_config(struct mt7915_phy *phy) { struct mt7915_dev *dev = phy->dev; bool ext_phy = phy != &dev->phy; u32 val; val = mt7915_eeprom_read(dev, MT_EE_WIFI_CONF + ext_phy); val = FIELD_GET(MT_EE_WIFI_CONF0_BAND_SEL, val); if (val == MT_EE_BAND_SEL_DEFAULT && dev->dbdc_support) val = ext_phy ? MT_EE_BAND_SEL_5GHZ : MT_EE_BAND_SEL_2GHZ; switch (val) { case MT_EE_BAND_SEL_5GHZ: phy->mt76->cap.has_5ghz = true; break; case MT_EE_BAND_SEL_2GHZ: phy->mt76->cap.has_2ghz = true; break; default: phy->mt76->cap.has_2ghz = true; phy->mt76->cap.has_5ghz = true; break; } } static void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev) { u8 nss, nss_band, *eeprom = dev->mt76.eeprom.data; mt7915_eeprom_parse_band_config(&dev->phy); /* read tx mask from eeprom */ nss = FIELD_GET(MT_EE_WIFI_CONF0_TX_PATH, eeprom[MT_EE_WIFI_CONF]); if (!nss || nss > 4) nss = 4; nss_band = nss; if (dev->dbdc_support) { nss_band = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, eeprom[MT_EE_WIFI_CONF + 3]); if (!nss_band || nss_band > 2) nss_band = 2; if (nss_band >= nss) nss = 4; } dev->chainmask = BIT(nss) - 1; dev->mphy.antenna_mask = BIT(nss_band) - 1; dev->mphy.chainmask = dev->mphy.antenna_mask; } int mt7915_eeprom_init(struct mt7915_dev *dev) { int ret; ret = mt7915_eeprom_load(dev); if (ret < 0) return ret; ret = mt7915_check_eeprom(dev); if (ret) return ret; mt7915_eeprom_parse_hw_cap(dev); memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, ETH_ALEN); mt76_eeprom_override(&dev->mphy); return 0; } int mt7915_eeprom_get_target_power(struct mt7915_dev *dev, struct ieee80211_channel *chan, u8 chain_idx) { int index; bool tssi_on; if (chain_idx > 3) return -EINVAL; tssi_on = mt7915_tssi_enabled(dev, chan->band); if (chan->band == NL80211_BAND_2GHZ) { index = MT_EE_TX0_POWER_2G + chain_idx * 3 + !tssi_on; } else { int group = tssi_on ? mt7915_get_channel_group(chan->hw_value) : 8; index = MT_EE_TX0_POWER_5G + chain_idx * 12 + group; } return mt7915_eeprom_read(dev, index); } static const u8 sku_cck_delta_map[] = { SKU_CCK_GROUP0, SKU_CCK_GROUP0, SKU_CCK_GROUP1, SKU_CCK_GROUP1, }; static const u8 sku_ofdm_delta_map[] = { SKU_OFDM_GROUP0, SKU_OFDM_GROUP0, SKU_OFDM_GROUP1, SKU_OFDM_GROUP1, SKU_OFDM_GROUP2, SKU_OFDM_GROUP2, SKU_OFDM_GROUP3, SKU_OFDM_GROUP4, }; static const u8 sku_mcs_delta_map[] = { SKU_MCS_GROUP0, SKU_MCS_GROUP1, SKU_MCS_GROUP1, SKU_MCS_GROUP2, SKU_MCS_GROUP2, SKU_MCS_GROUP3, SKU_MCS_GROUP4, SKU_MCS_GROUP5, SKU_MCS_GROUP6, SKU_MCS_GROUP7, SKU_MCS_GROUP8, SKU_MCS_GROUP9, }; #define SKU_GROUP(_mode, _len, _ofs_2g, _ofs_5g, _map) \ [_mode] = { \ .len = _len, \ .offset = { \ _ofs_2g, \ _ofs_5g, \ }, \ .delta_map = _map \ } const struct sku_group mt7915_sku_groups[] = { SKU_GROUP(SKU_CCK, 4, 0x252, 0, sku_cck_delta_map), SKU_GROUP(SKU_OFDM, 8, 0x254, 0x29d, sku_ofdm_delta_map), SKU_GROUP(SKU_HT_BW20, 8, 0x259, 0x2a2, sku_mcs_delta_map), SKU_GROUP(SKU_HT_BW40, 9, 0x262, 0x2ab, sku_mcs_delta_map), SKU_GROUP(SKU_VHT_BW20, 12, 0x259, 0x2a2, sku_mcs_delta_map), SKU_GROUP(SKU_VHT_BW40, 12, 0x262, 0x2ab, sku_mcs_delta_map), SKU_GROUP(SKU_VHT_BW80, 12, 0, 0x2b4, sku_mcs_delta_map), SKU_GROUP(SKU_VHT_BW160, 12, 0, 0, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU26, 12, 0x27f, 0x2dd, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU52, 12, 0x289, 0x2e7, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU106, 12, 0x293, 0x2f1, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU242, 12, 0x26b, 0x2bf, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU484, 12, 0x275, 0x2c9, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU996, 12, 0, 0x2d3, sku_mcs_delta_map), SKU_GROUP(SKU_HE_RU2x996, 12, 0, 0, sku_mcs_delta_map), }; static s8 mt7915_get_sku_delta(struct mt7915_dev *dev, u32 addr) { u32 val = mt7915_eeprom_read(dev, addr); s8 delta = FIELD_GET(SKU_DELTA_VAL, val); if (!(val & SKU_DELTA_EN)) return 0; return val & SKU_DELTA_ADD ? delta : -delta; } static void mt7915_eeprom_init_sku_band(struct mt7915_dev *dev, struct ieee80211_supported_band *sband) { int i, band = sband->band; s8 *rate_power = dev->rate_power[band], max_delta = 0; u8 idx = 0; for (i = 0; i < ARRAY_SIZE(mt7915_sku_groups); i++) { const struct sku_group *sku = &mt7915_sku_groups[i]; u32 offset = sku->offset[band]; int j; if (!offset) { idx += sku->len; continue; } rate_power[idx++] = mt7915_get_sku_delta(dev, offset); if (rate_power[idx - 1] > max_delta) max_delta = rate_power[idx - 1]; if (i == SKU_HT_BW20 || i == SKU_VHT_BW20) offset += 1; for (j = 1; j < sku->len; j++) { u32 addr = offset + sku->delta_map[j]; rate_power[idx++] = mt7915_get_sku_delta(dev, addr); if (rate_power[idx - 1] > max_delta) max_delta = rate_power[idx - 1]; } } rate_power[idx] = max_delta; } void mt7915_eeprom_init_sku(struct mt7915_dev *dev) { mt7915_eeprom_init_sku_band(dev, &dev->mphy.sband_2g.sband); mt7915_eeprom_init_sku_band(dev, &dev->mphy.sband_5g.sband); }
/* * OMAP4 CDC TCXO support * The Clock Divider Chip (TCXO) is used on OMAP4 based SDP platforms * * Copyright (C) 2010 Texas Instruments, Inc. * Written by Rajendra Nayak <rnayak@ti.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/platform_device.h> #include <linux/i2c.h> #define DRIVER_DESC "CDC TCXO driver" #define DRIVER_NAME "cdc_tcxo_driver" static int cdc_tcxo_probe(struct i2c_client *client, \ const struct i2c_device_id *id) { int r = 0; struct i2c_msg msg; /* * The Clock Driver Chip (TCXO) on OMAP4 based SDP needs to * be programmed to output CLK1 based on REQ1 from OMAP. * By default CLK1 is driven based on an internal REQ1INT signal * which is always set to 1. * Doing this helps gate sysclk (from CLK1) to OMAP while OMAP * is in sleep states. * Please refer to the TCXO Data sheet for understanding the * programming sequence further. */ u8 buf[4] = {0x9f, 0xf0, 0, 0}; msg.addr = client->addr; msg.flags = 0; msg.len = 4; msg.buf = buf; r = i2c_transfer(client->adapter, &msg, 1); return 0; } static const struct i2c_device_id cdc_tcxo_id[] = { { "cdc_tcxo_driver", 0 }, { } }; static struct i2c_driver cdc_tcxo_i2c_driver = { .driver = { .name = DRIVER_NAME, }, .probe = cdc_tcxo_probe, .id_table = cdc_tcxo_id, }; static int __init cdc_tcxo_init(void) { int r; r = i2c_add_driver(&cdc_tcxo_i2c_driver); if (r < 0) { printk(KERN_WARNING DRIVER_NAME " driver registration failed\n"); return r; } return 0; } static void __exit cdc_tcxo_exit(void) { i2c_del_driver(&cdc_tcxo_i2c_driver); } module_init(cdc_tcxo_init); module_exit(cdc_tcxo_exit);
/* vim: set expandtab ts=4 sw=4: */ /* * You may redistribute this program and/or modify it under the terms of * the GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "util/AverageRoller.h" #include "util/AverageRoller_pvt.h" #include "util/Bits.h" #include "util/events/Time.h" /** @see AverageRoller.h */ struct AverageRoller* AverageRoller_new(const uint32_t windowSeconds, struct EventBase* eventBase, struct Allocator* allocator) { size_t size = sizeof(struct AverageRoller_pvt) + (sizeof(struct AverageRoller_SumAndEntryCount) * (windowSeconds - 1)); struct AverageRoller_pvt* roller = Allocator_calloc(allocator, size, 1); Bits_memcpyConst(roller, (&(struct AverageRoller_pvt) { .windowSeconds = windowSeconds, .eventBase = eventBase, .lastUpdateTime = (uint32_t) Time_currentTimeSeconds(eventBase) }), sizeof(struct AverageRoller_pvt)); Identity_set(roller); return &roller->pub; } /** @see AverageRoller.h */ uint32_t AverageRoller_getAverage(struct AverageRoller* averageRoller) { struct AverageRoller_pvt* roller = Identity_check((struct AverageRoller_pvt*) averageRoller); return roller->average; } /** * Update the roller with a new entry. * * @param averageRoller the roller to update. * @param now the number of seconds since the epoch. * @param newEntry the a new number to be factored into the average. * @return the average over the last windowSeconds seconds. */ uint32_t AverageRoller_updateAtTime(struct AverageRoller* averageRoller, const uint64_t now, const uint32_t newEntry) { struct AverageRoller_pvt* roller = Identity_check((struct AverageRoller_pvt*) averageRoller); uint32_t index = (now - roller->lastUpdateTime + roller->lastUpdateIndex) % roller->windowSeconds; if (((uint32_t) now) > roller->lastUpdateTime) { roller->sum -= roller->seconds[index].sum; roller->entryCount -= roller->seconds[index].entryCount; roller->seconds[index].sum = newEntry; roller->seconds[index].entryCount = 1; } else { roller->seconds[index].sum += newEntry; roller->seconds[index].entryCount++; } roller->sum += newEntry; roller->entryCount++; roller->average = roller->sum / roller->entryCount; roller->lastUpdateTime = now; roller->lastUpdateIndex = index; return roller->average; } /** @see AverageRoller.h */ uint32_t AverageRoller_update(struct AverageRoller* averageRoller, const uint32_t newEntry) { struct AverageRoller_pvt* roller = Identity_check((struct AverageRoller_pvt*) averageRoller); return AverageRoller_updateAtTime(averageRoller, Time_currentTimeSeconds(roller->eventBase), newEntry); }