text
stringlengths
4
6.14k
/* liblxcapi * * Copyright © 2012 Serge Hallyn <serge.hallyn@ubuntu.com>. * Copyright © 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <lxc/lxccontainer.h> #include <unistd.h> #include <signal.h> #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> #include <errno.h> #define MYNAME "lxctest1" int main(int argc, char *argv[]) { struct lxc_container *c; int ret = 1; if ((c = lxc_container_new(MYNAME, NULL)) == NULL) { fprintf(stderr, "%d: error opening lxc_container %s\n", __LINE__, MYNAME); ret = 1; goto out; } if (c->is_defined(c)) { fprintf(stderr, "%d: %s thought it was defined\n", __LINE__, MYNAME); goto out; } if (!c->set_config_item(c, "lxc.net.0.type", "veth")) { fprintf(stderr, "%d: failed to set network type\n", __LINE__); goto out; } c->set_config_item(c, "lxc.net.0.link", "lxcbr0"); c->set_config_item(c, "lxc.net.0.flags", "up"); if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) { fprintf(stderr, "%d: failed to create a container\n", __LINE__); goto out; } if (!c->is_defined(c)) { fprintf(stderr, "%d: %s thought it was not defined\n", __LINE__, MYNAME); goto out; } c->clear_config(c); c->load_config(c, NULL); c->want_daemonize(c, true); if (!c->startl(c, 0, NULL)) { fprintf(stderr, "%d: failed to start %s\n", __LINE__, MYNAME); goto out; } /* Wait for init to be ready for SIGPWR */ sleep(20); if (!c->shutdown(c, 120)) { fprintf(stderr, "%d: failed to shut down %s\n", __LINE__, MYNAME); if (!c->stop(c)) fprintf(stderr, "%d: failed to kill %s\n", __LINE__, MYNAME); goto out; } if (!c->destroy(c)) { fprintf(stderr, "%d: error deleting %s\n", __LINE__, MYNAME); goto out; } if (c->is_defined(c)) { fprintf(stderr, "%d: %s thought it was defined\n", __LINE__, MYNAME); goto out; } fprintf(stderr, "all lxc_container tests passed for %s\n", c->name); ret = 0; out: if (c && c->is_defined(c)) c->destroy(c); lxc_container_put(c); exit(ret); }
#ifndef H_RED_TIME #define H_RED_TIME #include <time.h> static inline uint64_t red_now(void) { struct timespec time; clock_gettime(CLOCK_MONOTONIC, &time); return ((uint64_t) time.tv_sec) * 1000000000 + time.tv_nsec; } #endif
/* ********************************************************** * Copyright (c) 2012 Google, Inc. All rights reserved. * Copyright (c) 2009 VMware, 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 VMware, 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 VMWARE, INC. 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. */ /* * nudgeunix.c: nudges a target Linux process * * XXX: share code with DRcontrol.c? */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stddef.h> #include <unistd.h> #include <sys/syscall.h> #include <assert.h> #include "configure.h" #include "globals_shared.h" extern bool create_nudge_signal_payload(siginfo_t *info OUT, uint action_mask, client_id_t client_id, uint64 client_arg); static const char *usage_str = "usage: nudgeunix [-help] [-v] [-pid <pid>] [-type <type>] [-client <ID> <arg>]\n" " -help Display this usage information\n" " -v Display version information\n" " -pid <pid> Nudge the process with id <pid>\n" " -client <ID> <arg>\n" " Nudge the client with ID <ID> in the process specified\n" " with -pid <pid>, and pass <arg> as an argument to the\n" " client's nudge callback. <ID> must be the 8-digit hex\n" " ID of the target client. <arg> should be a hex\n" " literal (0, 1, 3f etc.).\n" " -type <type>\n" " Send a nudge of type <type> to the process specified\n" " with -pid <pid>. Type can be a numeric value or a\n" " symbolic name. This argument can be repeated.\n" " E.g., \"-type reset -type stats\".\n" ; static int usage(void) { fprintf(stderr, "%s", usage_str); return 1; } int main(int argc, const char *argv[]) { process_id_t target_pid = 0; uint action_mask = 0; client_id_t client_id = 0; uint64 client_arg = 0; int i; siginfo_t info; int arg_offs = 1; bool success; /* parse command line */ if (argc <= 1) return usage(); while (arg_offs < argc && argv[arg_offs][0] == '-') { if (strcmp(argv[arg_offs], "-help") == 0) { return usage(); } else if (strcmp(argv[arg_offs], "-v") == 0) { printf("nudgeunix version %s -- build %d\n", STRINGIFY(VERSION_NUMBER), BUILD_NUMBER); exit(0); } else if (strcmp(argv[arg_offs], "-pid") == 0) { if (argc <= arg_offs+1) return usage(); target_pid = strtoul(argv[arg_offs+1], NULL, 10); arg_offs += 2; } else if (strcmp(argv[arg_offs], "-client") == 0) { if (argc <= arg_offs+2) return usage(); action_mask |= NUDGE_GENERIC(client); client_id = strtoul(argv[arg_offs+1], NULL, 16); client_arg = strtoull(argv[arg_offs+2], NULL, 16); arg_offs += 3; } else if (strcmp(argv[arg_offs], "-type") == 0) { int type_numeric; if (argc <= arg_offs+1) return usage(); type_numeric = strtoul(argv[arg_offs+1], NULL, 10); action_mask |= type_numeric; /* compare against symbolic names */ { int found = 0; #define NUDGE_DEF(name, comment) \ if (strcmp(#name, argv[arg_offs+1]) == 0) { \ found = 1; \ action_mask |= NUDGE_GENERIC(name); \ } NUDGE_DEFINITIONS(); #undef NUDGE_DEF if (!found && type_numeric == 0) { fprintf(stderr, "ERROR: unknown -nudge %s\n", argv[arg_offs+1]); return usage(); } } arg_offs += 2; } else return usage(); } if (arg_offs < argc) return usage(); /* construct the payload */ success = create_nudge_signal_payload(&info, action_mask, client_id, client_arg); assert(success); /* failure means kernel's sigqueueinfo has changed */ /* send the nudge */ i = syscall(SYS_rt_sigqueueinfo, target_pid, NUDGESIG_SIGNUM, &info); if (i < 0) fprintf(stderr, "nudge FAILED with error %d\n", i); return i; }
/**** * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development. * Created 2015 by Skurydin Alexey * http://github.com/anakod/Sming * All files of the Sming Core are provided under the LGPL v3 license. ****/ /** @defgroup httpconsts HTTP constants to be used with HTTP client or HTTP server * @brief Provides HTTP constants * @ingroup httpserver * @ingroup httpclient * @{ */ #ifndef _SMING_CORE_NETWORK_WEBCONSTANTS_H_ #define _SMING_CORE_NETWORK_WEBCONSTANTS_H_ #define MIME_TYPE_MAP(XX) \ /* Type, extension start, Mime type */ \ \ /* Texts */ \ XX(HTML, "htm", "text/html") \ XX(TEXT, "txt", "text/plain") \ XX(JS, "js", "text/javascript") \ XX(CSS, "css", "text/css") \ XX(XML, "xml", "text/xml") \ XX(JSON, "json", "application/json") \ \ /* Images */ \ XX(JPEG, "jpg", "image/jpeg") \ XX(GIF, "git", "image/gif") \ XX(PNG, "png", "image/png") \ XX(SVG, "svg", "image/svg+xml") \ XX(ICO, "ico", "image/x-icon") \ \ /* Archives */ \ XX(GZIP, "gzip", "application/x-gzip") \ XX(ZIP, "zip", "application/zip") \ \ /* Binary and Form */ \ XX(BINARY, "", "application/octet-stream") \ XX(FORM_URL_ENCODED, "", "application/x-www-form-urlencoded") \ XX(FORM_MULTIPART, "", "multipart/form-data") \ enum MimeType { #define XX(name, extensionStart, mime) MIME_##name, MIME_TYPE_MAP(XX) #undef XX }; namespace ContentType { static const char* fromFileExtension(const String extension) { String ext = extension; ext.toLowerCase(); #define XX(name, extensionStart, mime) if(ext.startsWith(extensionStart)) { return mime; } MIME_TYPE_MAP(XX) #undef XX // Unknown return "<unknown>"; } static const char *toString(enum MimeType m) { #define XX(name, extensionStart, mime) if(MIME_##name == m) { return mime; } MIME_TYPE_MAP(XX) #undef XX // Unknown return "<unknown>"; } static const char* fromFullFileName(const String fileName) { int p = fileName.lastIndexOf('.'); if (p != -1) { String ext = fileName.substring(p + 1); const char *mime = ContentType::fromFileExtension(ext); return mime; } return NULL; } }; /** @} */ #endif /* _SMING_CORE_NETWORK_WEBCONSTANTS_H_ */
#ifndef MANDIR #define MANDIR "/usr/local/man" #endif
/*========================================================================= * * Copyright Insight Software Consortium * * 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.txt * * 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 __itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter_h #define __itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter_h #include "itkEdgeDecimationQuadEdgeMeshFilter.h" namespace itk { /** * \class SquaredEdgeLengthDecimationQuadEdgeMeshFilter * \brief * \ingroup ITKQuadEdgeMeshFiltering */ template< class TInput, class TOutput, class TCriterion > class ITK_EXPORT SquaredEdgeLengthDecimationQuadEdgeMeshFilter: public EdgeDecimationQuadEdgeMeshFilter< TInput, TOutput, TCriterion > { public: typedef SquaredEdgeLengthDecimationQuadEdgeMeshFilter Self; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; typedef EdgeDecimationQuadEdgeMeshFilter< TInput, TOutput, TCriterion > Superclass; /** Run-time type information (and related methods). */ itkTypeMacro(SquaredEdgeLengthDecimationQuadEdgeMeshFilter, EdgeDecimationQuadEdgeMeshFilter); /** New macro for creation of through a Smart Pointer */ itkNewMacro(Self); typedef TInput InputMeshType; typedef typename InputMeshType::Pointer InputMeshPointer; typedef TOutput OutputMeshType; typedef typename OutputMeshType::Pointer OutputMeshPointer; typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier; typedef typename OutputMeshType::PointType OutputPointType; typedef typename OutputMeshType::QEType OutputQEType; typedef typename OutputMeshType::EdgeCellType OutputEdgeCellType; typedef typename OutputMeshType::CellsContainerIterator OutputCellsContainerIterator; typedef TCriterion CriterionType; typedef typename CriterionType::MeasureType MeasureType; typedef typename Superclass::PriorityType PriorityType; typedef typename Superclass::PriorityQueueItemType PriorityQueueItemType; typedef typename Superclass::PriorityQueueType PriorityQueueType; typedef typename Superclass::PriorityQueuePointer PriorityQueuePointer; typedef typename Superclass::QueueMapType QueueMapType; typedef typename Superclass::QueueMapIterator QueueMapIterator; typedef typename Superclass::OperatorType OperatorType; typedef typename Superclass::OperatorPointer OperatorPointer; protected: SquaredEdgeLengthDecimationQuadEdgeMeshFilter(); virtual ~SquaredEdgeLengthDecimationQuadEdgeMeshFilter(); /** * \brief Compute the measure value for iEdge * \param[in] iEdge * \return measure value, here the squared edge length */ inline MeasureType MeasureEdge(OutputQEType *iEdge) { OutputMeshPointer output = this->GetOutput(); OutputPointIdentifier id_org = iEdge->GetOrigin(); OutputPointIdentifier id_dest = iEdge->GetDestination(); OutputPointType org = output->GetPoint(id_org); OutputPointType dest = output->GetPoint(id_dest); return static_cast< MeasureType >( org.SquaredEuclideanDistanceTo(dest) ); } /** * \param[in] iEdge * \return the optimal point location */ OutputPointType Relocate(OutputQEType *iEdge); private: SquaredEdgeLengthDecimationQuadEdgeMeshFilter(const Self &); void operator=(const Self &); }; } #include "itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.hxx" #endif
/* Copyright 2016-present the Material Components for iOS authors. 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. */ #import <CoreGraphics/CoreGraphics.h> #import <Foundation/Foundation.h> #import "MDCButton.h" /** Shapes for Material Floating buttons. The mini size should only be used when required for visual continuity with other elements on the screen. */ typedef NS_ENUM(NSInteger, MDCFloatingButtonShape) { MDCFloatingButtonShapeDefault, MDCFloatingButtonShapeMini }; /** A "floating" MDCButton. Floating action buttons are circular, float a considerable amount above their parent, have their own background color, and also raise briefly when touched. Floating action buttons should only be used rarely, for the main action of a screen. @see http://www.google.com/design/spec/components/buttons.html#buttons-main-buttons */ @interface MDCFloatingButton : MDCButton /** Returns a MDCFloatingButton with default colors and the given @c shape. @param shape Button shape. @return Button with shape. */ + (nonnull instancetype)floatingButtonWithShape:(MDCFloatingButtonShape)shape; /** @return The default floating button size dimension. */ + (CGFloat)defaultDimension; /** @return The mini floating button size dimension. */ + (CGFloat)miniDimension; /** Initializes self to a button with the given @c shape. @param frame Button frame. @param shape Button shape. @return Button with shape. */ - (nonnull instancetype)initWithFrame:(CGRect)frame shape:(MDCFloatingButtonShape)shape NS_DESIGNATED_INITIALIZER; /** Initializes self to a button with the MDCFloatingButtonShapeDefault shape. @param frame Button frame. @return Button with MDCFloatingButtonShapeDefault shape. */ - (nonnull instancetype)initWithFrame:(CGRect)frame; - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; #pragma mark - Deprecations + (nonnull instancetype)buttonWithShape:(MDCFloatingButtonShape)shape __deprecated_msg("Use floatingButtonWithShape: instead."); @end
/* * Copyright (c) 2014 The WebRTC 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 COMMON_AUDIO_FIR_FILTER_FACTORY_H_ #define COMMON_AUDIO_FIR_FILTER_FACTORY_H_ #include <string.h> namespace webrtc { class FIRFilter; // Creates a filter with the given coefficients. All initial state values will // be zeros. // The length of the chunks fed to the filter should never be greater than // |max_input_length|. This is needed because, when vectorizing it is // necessary to concatenate the input after the state, and resizing this array // dynamically is expensive. FIRFilter* CreateFirFilter(const float* coefficients, size_t coefficients_length, size_t max_input_length); } // namespace webrtc #endif // COMMON_AUDIO_FIR_FILTER_FACTORY_H_
/*========================================================================= Library: CTK Copyright (c) Kitware 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.txt 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 __ctkDoubleRangeSliderEventPlayer_h #define __ctkDoubleRangeSliderEventPlayer_h // QtTesting includes #include <pqWidgetEventPlayer.h> // CTK includes #include <ctkPimpl.h> #include "ctkWidgetsExport.h" /// Concrete implementation of pqWidgetEventPlayer that translates /// high-level events into low-level Qt events. class CTK_WIDGETS_EXPORT ctkDoubleRangeSliderEventPlayer : public pqWidgetEventPlayer { Q_OBJECT public: typedef pqWidgetEventPlayer Superclass; ctkDoubleRangeSliderEventPlayer(QObject* parent = 0); using Superclass::playEvent; bool playEvent(QObject *Object, const QString &Command, const QString &Arguments, bool &Error); private: Q_DISABLE_COPY(ctkDoubleRangeSliderEventPlayer); }; #endif
#include <stdlib.h> int main(void) { int a = 1; int b = 1; switch (a) { case 1 : b = 3; break; case 2 : b = 5; break; } return (0); }
/* * Copyright (c) 2019 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ #define ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ #ifndef _ASMLANGUAGE /* * Multiboot (version 1) boot information structure. * * Only fields/values of interest to Zephyr are enumerated: at * present, that means only those pertaining to the framebuffer. */ struct multiboot_info { uint32_t flags; uint32_t mem_lower; uint32_t mem_upper; uint32_t unused0[8]; uint32_t mmap_length; uint32_t mmap_addr; uint32_t unused1[9]; uint32_t fb_addr_lo; uint32_t fb_addr_hi; uint32_t fb_pitch; uint32_t fb_width; uint32_t fb_height; uint8_t fb_bpp; uint8_t fb_type; uint8_t fb_color_info[6]; }; extern struct multiboot_info multiboot_info; extern void z_multiboot_init(struct multiboot_info *info_pa); /* * the mmap_addr field points to a series of entries of the following form. */ struct multiboot_mmap { uint32_t size; uint64_t base; uint64_t length; uint32_t type; } __packed; #endif /* _ASMLANGUAGE */ /* * Possible values for multiboot_mmap.type field. * Other values should be assumed to be unusable ranges. */ #define MULTIBOOT_MMAP_RAM 1 /* available RAM */ #define MULTIBOOT_MMAP_ACPI 3 /* reserved for ACPI */ #define MULTIBOOT_MMAP_NVS 4 /* ACPI non-volatile */ #define MULTIBOOT_MMAP_DEFECTIVE 5 /* defective RAM module */ /* * Magic numbers: the kernel multiboot header (see crt0.S) begins with * MULTIBOOT_HEADER_MAGIC to signal to the booter that it supports * multiboot. On kernel entry, EAX is set to MULTIBOOT_EAX_MAGIC to * signal that the boot loader is multiboot compliant. */ #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 #define MULTIBOOT_EAX_MAGIC 0x2BADB002 /* * Typically, we put no flags in the multiboot header, as it exists solely * to reassure the loader that we're a valid binary. The exception to this * is when we want the loader to configure the framebuffer for us. */ #define MULTIBOOT_HEADER_FLAG_MEM BIT(1) /* want mem_/mmap_* info */ #define MULTIBOOT_HEADER_FLAG_FB BIT(2) /* want fb_* info */ #ifdef CONFIG_MULTIBOOT_FRAMEBUF #define MULTIBOOT_HEADER_FLAGS \ (MULTIBOOT_HEADER_FLAG_FB | MULTIBOOT_HEADER_FLAG_MEM) #else #define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_FLAG_MEM #endif /* The flags in the boot info structure tell us which fields are valid. */ #define MULTIBOOT_INFO_FLAGS_MEM (1 << 0) /* mem_* valid */ #define MULTIBOOT_INFO_FLAGS_MMAP (1 << 6) /* mmap_* valid */ #define MULTIBOOT_INFO_FLAGS_FB (1 << 12) /* fb_* valid */ /* The only fb_type we support is RGB. No text modes and no color palettes. */ #define MULTIBOOT_INFO_FB_TYPE_RGB 1 #endif /* ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ */
// -*- mode: C++ -*- // // Copyright (c) 2007, 2008, 2009, 2010, 2011 The University of Utah // All rights reserved. // // This file is part of `csmith', a random generator of C programs. // // 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. // // 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 STATEMENT_BREAK_H #define STATEMENT_BREAK_H /////////////////////////////////////////////////////////////////////////////// #include <ostream> #include "Statement.h" class Expression; class Block; class CGContext; /* * */ class StatementBreak : public Statement { public: // Factory method. static StatementBreak *make_random(CGContext &cg_context); StatementBreak(Block* parent, const Expression &test, const Block& b); StatementBreak(const StatementBreak &sc); virtual ~StatementBreak(void); // virtual bool must_jump(void) const; virtual void get_blocks(std::vector<const Block*>& /* blks */) const {}; virtual void get_exprs(std::vector<const Expression*>& exps) const {exps.push_back(&test);} virtual bool visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) const; virtual void Output(std::ostream &out, FactMgr* fm, int indent = 0) const; const Expression &test; const Block& loop_blk; }; /////////////////////////////////////////////////////////////////////////////// #endif // STATEMENT_BREAK_H // Local Variables: // c-basic-offset: 4 // tab-width: 4 // End: // End of file.
/* * Copyright (c) 2019, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * This file includes k32w061 compile-time configuration constants * for OpenThread. */ #ifndef OPENTHREAD_CORE_K32W061_CONFIG_H_ #define OPENTHREAD_CORE_K32W061_CONFIG_H_ /** * @def OPENTHREAD_CONFIG_LOG_OUTPUT * * The emsk platform provides an otPlatLog() function. */ #ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */ #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED #endif /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * * The platform-specific string to insert into the OpenThread version string. * */ #define OPENTHREAD_CONFIG_PLATFORM_INFO "K32W061" /** * @def SETTINGS_CONFIG_BASE_ADDRESS * * The base address of settings. * */ #define SETTINGS_CONFIG_BASE_ADDRESS 0 /** * @def SETTINGS_CONFIG_PAGE_SIZE * * The page size of settings. * */ #define SETTINGS_CONFIG_PAGE_SIZE 0x200 /** * @def SETTINGS_CONFIG_PAGE_NUM * * The page number of settings. * */ #define SETTINGS_CONFIG_PAGE_NUM 64 /** * @def RADIO_CONFIG_SRC_MATCH_ENTRY_NUM * * The number of source address table entries. * */ #define RADIO_CONFIG_SRC_MATCH_ENTRY_NUM 128 /** * @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT * * Define to 1 if you want to enable software retransmission logic. * */ /* TODO */ /** * @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_CSMA_BACKOFF * * Define to 1 if you want to enable software CSMA-CA backoff logic. * */ /* TODO */ /** * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE * * Define to 1 to enable NCP UART support. * */ #define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1 /** * @def OPENTHREAD_SETTINGS_RAM * * Define to 1 if you want to use K32W061 Flash implementation. * */ #define OPENTHREAD_SETTINGS_RAM 0 /** * @def OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE * * The size of NCP message buffer in bytes. * */ #define OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 1024 /** * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE * * The size of heap buffer when DTLS is enabled. * */ #ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *)) #endif /** * @def OPENTHREAD_CONFIG_COAP_API_ENABLE * * Define to 1 to enable the CoAP API. * */ #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 /** * @def OPENTHREAD_CONFIG_JOINER_ENABLE * * Define to 1 to enable Joiner support. * */ #define OPENTHREAD_CONFIG_JOINER_ENABLE 1 /** * @def OPENTHREAD_CONFIG_COMMISSIONER_ENABLE * * Define to 1 to enable Commissioner support. * */ #define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 /** * @def OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE * * Define to 1 to enable UDP forward support. * */ #define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1 /** * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE * * Define to 1 to enable the Border Router service. * */ #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 /** * @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE * * Define to 1 to enable the DHCP CLIENT service. * */ #define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 /** * @def OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE * * Define to 1 to enable the DHCP SERVER service. * */ #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 /** * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE * * Define as 1 to enable the time synchronization service feature. * */ #ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE #define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 #endif /** * @def OPENTHREAD_CONFIG_DIAG_ENABLE * * Define as 1 to enable the diag feature. * */ #ifndef OPENTHREAD_CONFIG_DIAG_ENABLE #define OPENTHREAD_CONFIG_DIAG_ENABLE 0 #endif #endif // OPENTHREAD_CORE_K32W061_CONFIG_H_
// Copyright 2013 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 CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_ #define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/strings/string16.h" #include "content/common/content_export.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "v8/include/v8.h" namespace blink { class WebFormElement; class WebFrame; class WebNode; class WebString; struct WebURLError; } namespace content { class RendererPpapiHost; class RenderFrame; class RenderFrameImpl; // Base class for objects that want to filter incoming IPCs, and also get // notified of changes to the frame. class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, public IPC::Sender { public: // By default, observers will be deleted when the RenderFrame goes away. If // they want to outlive it, they can override this function. virtual void OnDestruct(); // Called when a Pepper plugin is created. virtual void DidCreatePepperPlugin(RendererPpapiHost* host) {} // Called when a load is explicitly stopped by the user or browser. virtual void OnStop() {} // Called when the RenderFrame visiblity is changed. virtual void WasHidden() {} virtual void WasShown() {} // Called when associated widget is about to close. virtual void WidgetWillClose() {} // These match the Blink API notifications virtual void DidCreateNewDocument() {} virtual void DidCreateDocumentElement() {} virtual void DidCommitProvisionalLoad(bool is_new_navigation, bool is_same_page_navigation) {} virtual void DidStartProvisionalLoad() {} virtual void DidFailProvisionalLoad(const blink::WebURLError& error) {} virtual void DidFinishLoad() {} virtual void DidFinishDocumentLoad() {} virtual void DidCreateScriptContext(v8::Local<v8::Context> context, int extension_group, int world_id) {} virtual void WillReleaseScriptContext(v8::Local<v8::Context> context, int world_id) {} virtual void DidClearWindowObject() {} virtual void DidChangeManifest() {} virtual void DidChangeScrollOffset() {} virtual void WillSendSubmitEvent(const blink::WebFormElement& form) {} virtual void WillSubmitForm(const blink::WebFormElement& form) {} virtual void DidMatchCSS( const blink::WebVector<blink::WebString>& newly_matching_selectors, const blink::WebVector<blink::WebString>& stopped_matching_selectors) {} // Called before FrameWillClose, when this frame has been detached from the // view, but has not been closed yet. This *will* be called when parent frames // are closing. Since the frame is already detached from the DOM at this time // it should not be inspected. virtual void FrameDetached() {} // Called when the frame will soon be closed. This is the last opportunity to // send messages to the host (e.g., for clean-up, shutdown, etc.). This is // *not* called on child frames when parent frames are being closed. virtual void FrameWillClose() {} // Called when we receive a console message from Blink for which we requested // extra details (like the stack trace). |message| is the error message, // |source| is the Blink-reported source of the error (either external or // internal), and |stack_trace| is the stack trace of the error in a // human-readable format (each frame is formatted as // "\n at function_name (source:line_number:column_number)"). virtual void DetailedConsoleMessageAdded(const base::string16& message, const base::string16& source, const base::string16& stack_trace, int32 line_number, int32 severity_level) {} // Called when a compositor frame has committed. virtual void DidCommitCompositorFrame() {} // Called when the focused node has changed to |node|. virtual void FocusedNodeChanged(const blink::WebNode& node) {} // IPC::Listener implementation. bool OnMessageReceived(const IPC::Message& message) override; // IPC::Sender implementation. bool Send(IPC::Message* message) override; RenderFrame* render_frame() const; int routing_id() const { return routing_id_; } protected: explicit RenderFrameObserver(RenderFrame* render_frame); ~RenderFrameObserver() override; private: friend class RenderFrameImpl; // This is called by the RenderFrame when it's going away so that this object // can null out its pointer. void RenderFrameGone(); RenderFrame* render_frame_; // The routing ID of the associated RenderFrame. int routing_id_; DISALLOW_COPY_AND_ASSIGN(RenderFrameObserver); }; } // namespace content #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_GFX_IMAGE_SKIA_OPERATIONS_H_ #define UI_GFX_IMAGE_SKIA_OPERATIONS_H_ #include "base/gtest_prod_util.h" #include "skia/ext/image_operations.h" #include "ui/base/ui_export.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/shadow_value.h" namespace gfx { class ImageSkia; class Rect; class Size; class UI_EXPORT ImageSkiaOperations { public: // Create an image that is a blend of two others. The alpha argument // specifies the opacity of the second imag. The provided image must // use the kARGB_8888_Config config and be of equal dimensions. static ImageSkia CreateBlendedImage(const ImageSkia& first, const ImageSkia& second, double alpha); // Creates an image that is the original image with opacity set to |alpha|. static ImageSkia CreateTransparentImage(const ImageSkia& image, double alpha); // Creates new image by painting first and second image respectively. // The second image is centered in respect to the first image. static ImageSkia CreateSuperimposedImage(const ImageSkia& first, const ImageSkia& second); // Create an image that is the original image masked out by the mask defined // in the alpha image. The images must use the kARGB_8888_Config config and // be of equal dimensions. static ImageSkia CreateMaskedImage(const ImageSkia& first, const ImageSkia& alpha); // Create an image that is cropped from another image. This is special // because it tiles the original image, so your coordinates can extend // outside the bounds of the original image. static ImageSkia CreateTiledImage(const ImageSkia& image, int src_x, int src_y, int dst_w, int dst_h); // Shift an image's HSL values. The shift values are in the range of 0-1, // with the option to specify -1 for 'no change'. The shift values are // defined as: // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map // to 0 and 360 on the hue color wheel (red). // hsl_shift[1] (saturation): A saturation shift for the image, with the // following key values: // 0 = remove all color. // 0.5 = leave unchanged. // 1 = fully saturate the image. // hsl_shift[2] (lightness): A lightness shift for the image, with the // following key values: // 0 = remove all lightness (make all pixels black). // 0.5 = leave unchanged. // 1 = full lightness (make all pixels white). static ImageSkia CreateHSLShiftedImage(const gfx::ImageSkia& image, const color_utils::HSL& hsl_shift); // Creates a button background image by compositing the color and image // together, then applying the mask. This is a highly specialized composite // operation that is the equivalent of drawing a background in |color|, // tiling |image| over the top, and then masking the result out with |mask|. // The images must use kARGB_8888_Config config. static ImageSkia CreateButtonBackground(SkColor color, const gfx::ImageSkia& image, const gfx::ImageSkia& mask); // Returns an image which is a subset of |image| with bounds |subset_bounds|. // The |image| cannot use kA1_Config config. static ImageSkia ExtractSubset(const gfx::ImageSkia& image, const gfx::Rect& subset_bounds); // Creates an image by resizing |source| to given |target_dip_size|. static ImageSkia CreateResizedImage(const ImageSkia& source, skia::ImageOperations::ResizeMethod methd, const Size& target_dip_size); // Creates an image with drop shadow defined in |shadows| for |source|. static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, const ShadowValues& shadows); private: ImageSkiaOperations(); // Class for scoping only. }; } // namespace gfx #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_ANDROID_BUILD_INFO_H_ #define BASE_ANDROID_BUILD_INFO_H_ #include <jni.h> #include <string> #include "base/base_export.h" #include "base/memory/singleton.h" namespace base { namespace android { // This enumeration maps to the values returned by BuildInfo::sdk_int(), // indicating the Android release associated with a given SDK version. enum SdkVersion { SDK_VERSION_ICE_CREAM_SANDWICH = 14, SDK_VERSION_ICE_CREAM_SANDWICH_MR1 = 15, SDK_VERSION_JELLY_BEAN = 16, SDK_VERSION_JELLY_BEAN_MR1 = 17, SDK_VERSION_JELLY_BEAN_MR2 = 18, SDK_VERSION_KITKAT = 19, SDK_VERSION_KITKAT_WEAR = 20, SDK_VERSION_LOLLIPOP = 21, SDK_VERSION_LOLLIPOP_MR1 = 22 }; // BuildInfo is a singleton class that stores android build and device // information. It will be called from Android specific code and gets used // primarily in crash reporting. // It is also used to store the last java exception seen during JNI. // TODO(nileshagrawal): Find a better place to store this info. class BASE_EXPORT BuildInfo { public: ~BuildInfo() {} // Static factory method for getting the singleton BuildInfo instance. // Note that ownership is not conferred on the caller and the BuildInfo in // question isn't actually freed until shutdown. This is ok because there // should only be one instance of BuildInfo ever created. static BuildInfo* GetInstance(); // Const char* is used instead of std::strings because these values must be // available even if the process is in a crash state. Sadly // std::string.c_str() doesn't guarantee that memory won't be allocated when // it is called. const char* device() const { return device_; } const char* manufacturer() const { return manufacturer_; } const char* model() const { return model_; } const char* brand() const { return brand_; } const char* android_build_id() const { return android_build_id_; } const char* android_build_fp() const { return android_build_fp_; } const char* package_version_code() const { return package_version_code_; } const char* package_version_name() const { return package_version_name_; } const char* package_label() const { return package_label_; } const char* package_name() const { return package_name_; } const char* build_type() const { return build_type_; } int sdk_int() const { return sdk_int_; } int has_language_apk_splits() const { return has_language_apk_splits_; } const char* java_exception_info() const { return java_exception_info_; } void SetJavaExceptionInfo(const std::string& info); void ClearJavaExceptionInfo(); static bool RegisterBindings(JNIEnv* env); private: friend struct BuildInfoSingletonTraits; explicit BuildInfo(JNIEnv* env); // Const char* is used instead of std::strings because these values must be // available even if the process is in a crash state. Sadly // std::string.c_str() doesn't guarantee that memory won't be allocated when // it is called. const char* const device_; const char* const manufacturer_; const char* const model_; const char* const brand_; const char* const android_build_id_; const char* const android_build_fp_; const char* const package_version_code_; const char* const package_version_name_; const char* const package_label_; const char* const package_name_; const char* const build_type_; const int sdk_int_; const bool has_language_apk_splits_; // This is set via set_java_exception_info, not at constructor time. const char* java_exception_info_; DISALLOW_COPY_AND_ASSIGN(BuildInfo); }; } // namespace android } // namespace base #endif // BASE_ANDROID_BUILD_INFO_H_
/* Copyright (C) 2014, The University of Texas at Austin This file is part of libflame and is available under the 3-Clause BSD license, which can be found in the LICENSE file at the top-level directory, or at http://opensource.org/licenses/BSD-3-Clause */ #include "FLAME.h" FLA_Error FLA_Bsvd_find_split( FLA_Obj d, FLA_Obj e ) { FLA_Datatype datatype; int m_A; int inc_d; int inc_e; datatype = FLA_Obj_datatype( d ); m_A = FLA_Obj_vector_dim( d ); inc_d = FLA_Obj_vector_inc( d ); inc_e = FLA_Obj_vector_inc( e ); switch ( datatype ) { case FLA_FLOAT: { float* buff_d = FLA_FLOAT_PTR( d ); float* buff_e = FLA_FLOAT_PTR( e ); FLA_Bsvd_find_split_ops( m_A, buff_d, inc_d, buff_e, inc_e ); break; } case FLA_DOUBLE: { double* buff_d = FLA_DOUBLE_PTR( d ); double* buff_e = FLA_DOUBLE_PTR( e ); FLA_Bsvd_find_split_opd( m_A, buff_d, inc_d, buff_e, inc_e ); break; } } return FLA_SUCCESS; } FLA_Error FLA_Bsvd_find_split_ops( int m_A, float* buff_d, int inc_d, float* buff_e, int inc_e ) { FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED ); return FLA_SUCCESS; } FLA_Error FLA_Bsvd_find_split_opd( int m_A, double* buff_d, int inc_d, double* buff_e, int inc_e ) { int i; for ( i = 0; i < m_A - 1; ++i ) { double* epsilon1 = buff_e + (i )*inc_e; if ( *epsilon1 == 0.0 ) { // Return index of split as i+1 since e_i is in the same // column as d_(i+1). return i + 1; } } // Return with no split found found. return FLA_FAILURE; }
/* * libjingle * Copyright 2004--2005, Google Inc. * * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef TALK_XMPP_JID_H_ #define TALK_XMPP_JID_H_ #include <string> #include "webrtc/libjingle/xmllite/xmlconstants.h" #include "webrtc/base/basictypes.h" namespace buzz { // The Jid class encapsulates and provides parsing help for Jids. A Jid // consists of three parts: the node, the domain and the resource, e.g.: // // node@domain/resource // // The node and resource are both optional. A valid jid is defined to have // a domain. A bare jid is defined to not have a resource and a full jid // *does* have a resource. class Jid { public: explicit Jid(); explicit Jid(const std::string& jid_string); explicit Jid(const std::string& node_name, const std::string& domain_name, const std::string& resource_name); ~Jid(); const std::string & node() const { return node_name_; } const std::string & domain() const { return domain_name_; } const std::string & resource() const { return resource_name_; } std::string Str() const; Jid BareJid() const; bool IsEmpty() const; bool IsValid() const; bool IsBare() const; bool IsFull() const; bool BareEquals(const Jid& other) const; void CopyFrom(const Jid& jid); bool operator==(const Jid& other) const; bool operator!=(const Jid& other) const { return !operator==(other); } bool operator<(const Jid& other) const { return Compare(other) < 0; }; bool operator>(const Jid& other) const { return Compare(other) > 0; }; int Compare(const Jid & other) const; private: void ValidateOrReset(); static std::string PrepNode(const std::string& node, bool* valid); static char PrepNodeAscii(char ch, bool* valid); static std::string PrepResource(const std::string& start, bool* valid); static char PrepResourceAscii(char ch, bool* valid); static std::string PrepDomain(const std::string& domain, bool* valid); static void PrepDomain(const std::string& domain, std::string* buf, bool* valid); static void PrepDomainLabel( std::string::const_iterator start, std::string::const_iterator end, std::string* buf, bool* valid); static char PrepDomainLabelAscii(char ch, bool *valid); std::string node_name_; std::string domain_name_; std::string resource_name_; }; } #endif // TALK_XMPP_JID_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ #include <list> #include <set> #include <vector> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/file_path.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/time.h" #include "content/public/browser/dom_storage_context.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" class Profile; // This class fetches local storage information and provides a // means to delete the data associated with an origin. class BrowsingDataLocalStorageHelper : public base::RefCounted<BrowsingDataLocalStorageHelper> { public: // Contains detailed information about local storage. struct LocalStorageInfo { LocalStorageInfo( const GURL& origin_url, int64 size, base::Time last_modified); ~LocalStorageInfo(); GURL origin_url; int64 size; base::Time last_modified; }; explicit BrowsingDataLocalStorageHelper(Profile* profile); // Starts the fetching process, which will notify its completion via // callback. This must be called only in the UI thread. virtual void StartFetching( const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback); // Deletes the local storage for the |origin|. virtual void DeleteOrigin(const GURL& origin); protected: friend class base::RefCounted<BrowsingDataLocalStorageHelper>; virtual ~BrowsingDataLocalStorageHelper(); void CallCompletionCallback(); content::DOMStorageContext* dom_storage_context_; // Owned by the profile base::Callback<void(const std::list<LocalStorageInfo>&)> completion_callback_; bool is_fetching_; std::list<LocalStorageInfo> local_storage_info_; private: void GetUsageInfoCallback( const std::vector<dom_storage::LocalStorageUsageInfo>& infos); DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); }; // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does // not fetch its information from the local storage tracker, but gets them // passed as a parameter during construction. class CannedBrowsingDataLocalStorageHelper : public BrowsingDataLocalStorageHelper { public: explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); // Return a copy of the local storage helper. Only one consumer can use the // StartFetching method at a time, so we need to create a copy of the helper // every time we instantiate a cookies tree model for it. CannedBrowsingDataLocalStorageHelper* Clone(); // Add a local storage to the set of canned local storages that is returned // by this helper. void AddLocalStorage(const GURL& origin); // Clear the list of canned local storages. void Reset(); // True if no local storages are currently stored. bool empty() const; // Returns the number of local storages currently stored. size_t GetLocalStorageCount() const; // Returns the set of origins that use local storage. const std::set<GURL>& GetLocalStorageInfo() const; // BrowsingDataLocalStorageHelper implementation. virtual void StartFetching( const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) OVERRIDE; private: virtual ~CannedBrowsingDataLocalStorageHelper(); // Convert the pending local storage info to local storage info objects. void ConvertPendingInfo(); std::set<GURL> pending_local_storage_info_; Profile* profile_; DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); }; #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
/*++ Copyright (c) 2004, Intel Corporation All rights reserved. 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. Module Name: SimpleFileParsing.h Abstract: Function prototypes and defines for the simple file parsing routines. --*/ #ifndef _SIMPLE_FILE_PARSING_H_ #define _SIMPLE_FILE_PARSING_H_ #define T_CHAR char STATUS SFPInit ( VOID ) ; STATUS SFPOpenFile ( char *FileName ) ; BOOLEAN SFPIsKeyword ( T_CHAR *Str ) ; BOOLEAN SFPIsToken ( T_CHAR *Str ) ; BOOLEAN SFPGetNextToken ( T_CHAR *Str, unsigned int Len ) ; BOOLEAN SFPGetGuidToken ( T_CHAR *Str, UINT32 Len ) ; #define PARSE_GUID_STYLE_5_FIELDS 0 BOOLEAN SFPGetGuid ( int GuidStyle, EFI_GUID *Value ) ; BOOLEAN SFPSkipToToken ( T_CHAR *Str ) ; BOOLEAN SFPGetNumber ( unsigned int *Value ) ; BOOLEAN SFPGetQuotedString ( T_CHAR *Str, int Length ) ; BOOLEAN SFPIsEOF ( VOID ) ; STATUS SFPCloseFile ( VOID ) ; unsigned int SFPGetLineNumber ( VOID ) ; T_CHAR * SFPGetFileName ( VOID ) ; #endif // #ifndef _SIMPLE_FILE_PARSING_H_
/* * scenerenderer.h * * Created on: 09.05.2012 * @author Ralph Schurade */ #ifndef NAVRENDERERSAGITTAL_H_ #define NAVRENDERERSAGITTAL_H_ #include "navrenderer.h" class QGLShaderProgram; class NavRendererSagittal : public NavRenderer { public: NavRendererSagittal( QString name ); virtual ~NavRendererSagittal(); void draw(); void leftMouseDown( int x, int y ); void adjustRatios(); private: void initGeometry(); QMatrix4x4 m_pMatrix; QMatrix4x4 m_pMatrixWorkaround; }; #endif /* SCENERENDERER_H_ */
#ifndef vm_h #define vm_h #include "uv.h" #include "wren.h" // Executes the Wren script at [path] in a new VM. // // Exits if the script failed or could not be loaded. void runFile(const char* path); // Runs the Wren interactive REPL. int runRepl(); // Gets the currently running VM. WrenVM* getVM(); // Gets the event loop the VM is using. uv_loop_t* getLoop(); // Set the exit code the CLI should exit with when done. void setExitCode(int exitCode); // Adds additional callbacks to use when binding foreign members from Wren. // // Used by the API test executable to let it wire up its own foreign functions. // This must be called before calling [createVM()]. void setTestCallbacks(WrenBindForeignMethodFn bindMethod, WrenBindForeignClassFn bindClass, void (*afterLoad)(WrenVM* vm)); #endif
// ------------------------------- // Copyright (c) Corman Technologies Inc. // See LICENSE.txt for license information. // ------------------------------- // // File: plserver_internal.h // Contents: Server internal functions for Corman Lisp // History: 8/5/97 RGC Created. // #include "CharBuf.h" extern IUnknown* ClientUnknown; extern ICormanLispTextOutput* ClientTextOutput; extern ICormanLispStatusMessage* ClientMessage; extern CharBuf TerminalInputBuf;
// // Copyright 2011 Jeff Verkoeyen // // 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. // #import <UIKit/UIKit.h> #if defined(DEBUG) || defined(NI_DEBUG) @class NIOverviewPageView; /** * The root scrolling page view of the Overview. * * @ingroup Overview */ @interface NIOverviewView : UIView { @private UIImage* _backgroundImage; // State BOOL _translucent; NSMutableArray* _pageViews; // Views UIScrollView* _pagingScrollView; } /** * Whether the view has a translucent background or not. */ @property (nonatomic, readwrite, assign) BOOL translucent; /** * Prepends a new page to the Overview. */ - (void)prependPageView:(NIOverviewPageView *)page; /** * Adds a new page to the Overview. */ - (void)addPageView:(NIOverviewPageView *)page; /** * Removes a page from the Overview. */ - (void)removePageView:(NIOverviewPageView *)page; /** * Update all of the views. */ - (void)updatePages; - (void)flashScrollIndicators; @end #endif
/* * Copyright (c) 2001-2007, Tom St Denis * 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 HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* LibTomCrypt, modular cryptographic library -- Tom St Denis * * LibTomCrypt is a library that provides various cryptographic * algorithms in a highly modular and flexible manner. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_memory.c LTC_HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC /** LTC_HMAC a block of memory to produce the authentication tag @param hash The index of the hash to use @param key The secret key @param keylen The length of the secret key (octets) @param in The data to LTC_HMAC @param inlen The length of the data to LTC_HMAC (octets) @param out [out] Destination of the authentication tag @param outlen [in/out] Max size and resulting size of authentication tag @return CRYPT_OK if successful */ int hmac_memory(int hash, const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) { hmac_state *hmac; int err; LTC_ARGCHK(key != NULL); LTC_ARGCHK(in != NULL); LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); /* make sure hash descriptor is valid */ if ((err = hash_is_valid(hash)) != CRYPT_OK) { return err; } /* is there a descriptor? */ if (hash_descriptor[hash].hmac_block != NULL) { return hash_descriptor[hash].hmac_block(key, keylen, in, inlen, out, outlen); } /* nope, so call the hmac functions */ /* allocate ram for hmac state */ hmac = XMALLOC(sizeof(hmac_state)); if (hmac == NULL) { return CRYPT_MEM; } if ((err = hmac_init(hmac, hash, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } if ((err = hmac_process(hmac, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } if ((err = hmac_done(hmac, out, outlen)) != CRYPT_OK) { goto LBL_ERR; } err = CRYPT_OK; LBL_ERR: #ifdef LTC_CLEAN_STACK zeromem(hmac, sizeof(hmac_state)); #endif XFREE(hmac); return err; } #endif /* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory.c,v $ */ /* $Revision: 1.8 $ */ /* $Date: 2007/05/12 14:37:41 $ */
// -*- C++ -*- // Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved. // // Redistribution and use in source and binary forms, with or without modifica- // tion, 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 ``AS IS'' AND ANY EXPRESSED 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 // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- // DING, 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. /** @file */ #ifndef LOG4CPLUS_TCHAR_HEADER_ #define LOG4CPLUS_TCHAR_HEADER_ #include <log4cplus/config.hxx> #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) #pragma once #endif #if defined (_WIN32) #include <cstddef> #endif #ifdef UNICODE # define LOG4CPLUS_TEXT2(STRING) L##STRING #else # define LOG4CPLUS_TEXT2(STRING) STRING #endif // UNICODE #define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING) namespace log4cplus { #if defined (UNICODE) typedef wchar_t tchar; #else typedef char tchar; #endif } // namespace log4cplus #endif // LOG4CPLUS_TCHAR_HEADER_
// // UIBarItem+CASAdditions.h // // // Created by Jonas Budelmann on 5/11/13. // // #import <UIKit/UIKit.h> #import "CASStyleableItem.h" @interface UIBarItem (CASAdditions) <CASStyleableItem> + (void)bootstrapClassy; @property (nonatomic, weak, readwrite) id<CASStyleableItem> cas_parent; @end
// // REComposeViewController.h // REComposeViewController // // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) // // 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 <UIKit/UIKit.h> #import "RECommonFunctions.h" #import "REComposeSheetView.h" #import "REComposeBackgroundView.h" @class REComposeViewController; typedef enum _REComposeResult { REComposeResultCancelled, REComposeResultPosted } REComposeResult; typedef void (^REComposeViewControllerCompletionHandler)(REComposeViewController *composeViewController, REComposeResult result); @protocol REComposeViewControllerDelegate; @interface REComposeViewController : UIViewController <REComposeSheetViewDelegate> { REComposeSheetView *_sheetView; REComposeBackgroundView *_backgroundView; UIView *_backView; UIView *_containerView; UIImageView *_paperclipView; } @property (copy, readwrite, nonatomic) REComposeViewControllerCompletionHandler completionHandler; @property (weak, readwrite, nonatomic) id<REComposeViewControllerDelegate> delegate; @property (assign, readwrite, nonatomic) NSInteger cornerRadius; @property (assign, readwrite, nonatomic) BOOL hasAttachment; @property (assign, readonly, nonatomic) BOOL userUpdatedAttachment; @property (strong, readwrite, nonatomic) NSString *text; @property (strong, readwrite, nonatomic) NSString *placeholderText; @property (strong, readonly, nonatomic) UINavigationBar *navigationBar; @property (strong, readonly, nonatomic) UINavigationItem *navigationItem; @property (strong, readwrite, nonatomic) UIColor *tintColor; @property (strong, readwrite, nonatomic) UIImage *attachmentImage; @property (weak, readonly, nonatomic) UIViewController *rootViewController; - (void)presentFromRootViewController; - (void)presentFromViewController:(UIViewController *)controller; @end @protocol REComposeViewControllerDelegate <NSObject> - (void)composeViewController:(REComposeViewController *)composeViewController didFinishWithResult:(REComposeResult)result; @end
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- /*** * banned.h - list of Microsoft Security Development Lifecycle banned APIs * * Purpose: * This include file contains a list of banned API which should not be used in new code and * removed from legacy code over time * History * 01-Jan-2006 - mikehow - Initial Version * 22-Apr-2008 - mikehow - Updated to SDL 4.1, commented out recommendations and added memcpy * 26-Jan-2009 - mikehow - Updated to SDL 5.0, made the list sane, added compliance levels * 10-Feb-2009 - mikehow - Updated based on feedback from MS Office * 12-May-2009 - jpardue - Updated based on feedback from mikehow (added wmemcpy) * ***/ // IMPORTANT: // Some of these functions are Windows specific, so you may want to add *nix specific banned function calls #ifndef _INC_BANNED # define _INC_BANNED #endif #ifdef _MSC_VER # pragma once # pragma deprecated (strcpy, strcpyA, strcpyW, wcscpy, _tcscpy, _mbscpy, StrCpy, StrCpyA, StrCpyW, lstrcpy, lstrcpyA, lstrcpyW, _tccpy, _mbccpy, _ftcscpy) # pragma deprecated (strcat, strcatA, strcatW, wcscat, _tcscat, _mbscat, StrCat, StrCatA, StrCatW, lstrcat, lstrcatA, lstrcatW, StrCatBuff, StrCatBuffA, StrCatBuffW, StrCatChainW, _tccat, _mbccat, _ftcscat) # pragma deprecated (wvsprintf, wvsprintfA, wvsprintfW, vsprintf, _vstprintf, vswprintf) # pragma deprecated (strncpy, wcsncpy, _tcsncpy, _mbsncpy, _mbsnbcpy, StrCpyN, StrCpyNA, StrCpyNW, StrNCpy, strcpynA, StrNCpyA, StrNCpyW, lstrcpyn, lstrcpynA, lstrcpynW) # pragma deprecated (strncat, wcsncat, _tcsncat, _mbsncat, _mbsnbcat, StrCatN, StrCatNA, StrCatNW, StrNCat, StrNCatA, StrNCatW, lstrncat, lstrcatnA, lstrcatnW, lstrcatn) # pragma deprecated (IsBadWritePtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadHugeReadPtr, IsBadCodePtr, IsBadStringPtr) # pragma deprecated (gets, _getts, _gettws) # pragma deprecated (RtlCopyMemory, CopyMemory) # pragma deprecated (wnsprintf, wnsprintfA, wnsprintfW, sprintfW, sprintfA, wsprintf, wsprintfW, wsprintfA, sprintf, swprintf, _stprintf, _snwprintf, _snprintf, _sntprintf) # pragma deprecated (_vsnprintf, vsnprintf, _vsnwprintf, _vsntprintf, wvnsprintf, wvnsprintfA, wvnsprintfW) # pragma deprecated (strtok, _tcstok, wcstok, _mbstok) # pragma deprecated (makepath, _tmakepath, _makepath, _wmakepath) # pragma deprecated (_splitpath, _tsplitpath, _wsplitpath) # pragma deprecated (scanf, wscanf, _tscanf, sscanf, swscanf, _stscanf, snscanf, snwscanf, _sntscanf) # pragma deprecated (_itoa, _itow, _i64toa, _i64tow, _ui64toa, _ui64tot, _ui64tow, _ultoa, _ultot, _ultow) #if (_SDL_BANNED_LEVEL3) # pragma deprecated (CharToOem, CharToOemA, CharToOemW, OemToChar, OemToCharA, OemToCharW, CharToOemBuffA, CharToOemBuffW) # pragma deprecated (alloca, _alloca) # pragma deprecated (strlen, wcslen, _mbslen, _mbstrlen, StrLen, lstrlen) # pragma deprecated (ChangeWindowMessageFilter) #endif #ifndef PATHCCH_NO_DEPRECATE // Path APIs which assume MAX_PATH instead of requiring the caller to specify // the buffer size have been deprecated. Include <PathCch.h> and use the PathCch // equivalents instead. # pragma deprecated (PathAddBackslash, PathAddBackslashA, PathAddBackslashW) # pragma deprecated (PathAddExtension, PathAddExtensionA, PathAddExtensionW) # pragma deprecated (PathAppend, PathAppendA, PathAppendW) # pragma deprecated (PathCanonicalize, PathCanonicalizeA, PathCanonicalizeW) # pragma deprecated (PathCombine, PathCombineA, PathCombineW) # pragma deprecated (PathRenameExtension, PathRenameExtensionA, PathRenameExtensionW) #endif // PATHCCH_NO_DEPRECATE #else // _MSC_VER #endif /* _INC_BANNED */
/* * Copyright (c) 2011-2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * 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. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __OS_OBJECT__ #define __OS_OBJECT__ #ifdef __APPLE__ #include <Availability.h> #endif #include <os/base.h> /*! * @header * * @preprocinfo * By default, libSystem objects such as GCD and XPC objects are declared as * Objective-C types when building with an Objective-C compiler. This allows * them to participate in ARC, in RR management by the Blocks runtime and in * leaks checking by the static analyzer, and enables them to be added to Cocoa * collections. * * NOTE: this requires explicit cancellation of dispatch sources and xpc * connections whose handler blocks capture the source/connection object, * resp. ensuring that such captures do not form retain cycles (e.g. by * declaring the source as __weak). * * To opt-out of this default behavior, add -DOS_OBJECT_USE_OBJC=0 to your * compiler flags. * * This mode requires a platform with the modern Objective-C runtime, the * Objective-C GC compiler option to be disabled, and at least a Mac OS X 10.8 * or iOS 6.0 deployment target. */ #ifndef OS_OBJECT_HAVE_OBJC_SUPPORT #if defined(__OBJC__) && defined(__OBJC2__) && !defined(__OBJC_GC__) && ( \ __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 || \ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0) #define OS_OBJECT_HAVE_OBJC_SUPPORT 1 #else #define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #endif #endif #if OS_OBJECT_HAVE_OBJC_SUPPORT #ifndef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 1 #endif #elif defined(OS_OBJECT_USE_OBJC) && OS_OBJECT_USE_OBJC /* Unsupported platform for OS_OBJECT_USE_OBJC=1 */ #undef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 0 #else #define OS_OBJECT_USE_OBJC 0 #endif #if OS_OBJECT_USE_OBJC #import <objc/NSObject.h> #if defined(__has_attribute) #if __has_attribute(objc_independent_class) #define OS_OBJC_INDEPENDENT_CLASS __attribute__((objc_independent_class)) #endif #endif // __has_attribute(objc_independent_class) #ifndef OS_OBJC_INDEPENDENT_CLASS #define OS_OBJC_INDEPENDENT_CLASS #endif #define OS_OBJECT_CLASS(name) OS_##name #define OS_OBJECT_DECL_IMPL(name, ...) \ @protocol OS_OBJECT_CLASS(name) __VA_ARGS__ \ @end \ typedef NSObject<OS_OBJECT_CLASS(name)> \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL(name, ...) \ OS_OBJECT_DECL_IMPL(name, <NSObject>) #define OS_OBJECT_DECL_SUBCLASS(name, super) \ OS_OBJECT_DECL_IMPL(name, <OS_OBJECT_CLASS(super)>) #if defined(__has_attribute) #if __has_attribute(ns_returns_retained) #define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__)) #else #define OS_OBJECT_RETURNS_RETAINED #endif #if __has_attribute(ns_consumed) #define OS_OBJECT_CONSUMED __attribute__((__ns_consumed__)) #else #define OS_OBJECT_CONSUMED #endif #else #define OS_OBJECT_RETURNS_RETAINED #define OS_OBJECT_CONSUMED #endif #if defined(__has_feature) #if __has_feature(objc_arc) #define OS_OBJECT_BRIDGE __bridge #define OS_WARN_RESULT_NEEDS_RELEASE #else #define OS_OBJECT_BRIDGE #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #endif #else #define OS_OBJECT_BRIDGE #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #endif #ifndef OS_OBJECT_USE_OBJC_RETAIN_RELEASE #if defined(__clang_analyzer__) #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #elif defined(__has_feature) #if __has_feature(objc_arc) #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #else #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif #else #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif #endif #else /*! @parseOnly */ #define OS_OBJECT_RETURNS_RETAINED /*! @parseOnly */ #define OS_OBJECT_CONSUMED /*! @parseOnly */ #define OS_OBJECT_BRIDGE /*! @parseOnly */ #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif #define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) __BEGIN_DECLS /*! * @function os_retain * * @abstract * Increment the reference count of an os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[retain] message. * * @param object * The object to retain. * * @result * The retained object. */ __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0) OS_EXPORT void* os_retain(void *object); #if OS_OBJECT_USE_OBJC #undef os_retain #define os_retain(object) [object retain] #endif /*! * @function os_release * * @abstract * Decrement the reference count of a os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[release] message. * * @param object * The object to release. */ __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0) OS_EXPORT void os_release(void *object); #if OS_OBJECT_USE_OBJC #undef os_release #define os_release(object) [object release] #endif #define fastpath(x) ((typeof(x))__builtin_expect((long)(x), ~0l)) #define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l)) __END_DECLS #endif
/**************************************************************************** ** ** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. ** ** This file is part of the qmake spec of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License versions 2.0 or 3.0 as published by the Free Software ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Alternatively you may (at ** your option) use any later version of the GNU General Public ** License if such license has been publicly approved by Trolltech ASA ** (or its successors, if any) and the KDE Free Qt Foundation. In ** addition, as a special exception, Trolltech gives you certain ** additional rights. These rights are described in the Trolltech GPL ** Exception version 1.2, which can be found at ** http://www.trolltech.com/products/qt/gplexception/ and in the file ** GPL_EXCEPTION.txt in this package. ** ** Please review the following information to ensure GNU General ** Public Licensing requirements will be met: ** http://trolltech.com/products/qt/licenses/licensing/opensource/. If ** you are unsure which license is appropriate for your use, please ** review the following information: ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview ** or contact the sales department at sales@trolltech.com. ** ** In addition, as a special exception, Trolltech, as the sole ** copyright holder for Qt Designer, grants users of the Qt/Eclipse ** Integration plug-in the right for the Qt/Eclipse Integration to ** link to functionality provided by Qt Designer and its related ** libraries. ** ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly ** granted herein. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include "../linux-g++/qplatformdefs.h"
#ifndef _LINUX_PTRACE_H #define _LINUX_PTRACE_H /* ptrace.h */ /* structs and defines to help the user use the ptrace system call. */ /* has the defines to get at the registers. */ #define PTRACE_TRACEME 0 #define PTRACE_PEEKTEXT 1 #define PTRACE_PEEKDATA 2 #define PTRACE_PEEKUSR 3 #define PTRACE_POKETEXT 4 #define PTRACE_POKEDATA 5 #define PTRACE_POKEUSR 6 #define PTRACE_CONT 7 #define PTRACE_KILL 8 #define PTRACE_SINGLESTEP 9 #define PTRACE_ATTACH 0x10 #define PTRACE_DETACH 0x11 #define PTRACE_SYSCALL 24 /* 0x4200-0x4300 are reserved for architecture-independent additions. */ #define PTRACE_SETOPTIONS 0x4200 #define PTRACE_GETEVENTMSG 0x4201 #define PTRACE_GETSIGINFO 0x4202 #define PTRACE_SETSIGINFO 0x4203 /* options set using PTRACE_SETOPTIONS */ #define PTRACE_O_TRACESYSGOOD 0x00000001 #define PTRACE_O_TRACEFORK 0x00000002 #define PTRACE_O_TRACEVFORK 0x00000004 #define PTRACE_O_TRACECLONE 0x00000008 #define PTRACE_O_TRACEEXEC 0x00000010 #define PTRACE_O_TRACEVFORKDONE 0x00000020 #define PTRACE_O_TRACEEXIT 0x00000040 #define PTRACE_O_MASK 0x0000007f /* Wait extended result codes for the above trace options. */ #define PTRACE_EVENT_FORK 1 #define PTRACE_EVENT_VFORK 2 #define PTRACE_EVENT_CLONE 3 #define PTRACE_EVENT_EXEC 4 #define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_EXIT 6 #include <asm/ptrace.h> #ifdef __KERNEL__ /* * Ptrace flags */ #define PT_PTRACED 0x00000001 #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ #define PT_TRACESYSGOOD 0x00000004 #define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */ #define PT_TRACE_FORK 0x00000010 #define PT_TRACE_VFORK 0x00000020 #define PT_TRACE_CLONE 0x00000040 #define PT_TRACE_EXEC 0x00000080 #define PT_TRACE_VFORK_DONE 0x00000100 #define PT_TRACE_EXIT 0x00000200 #define PT_ATTACHED 0x00000400 /* parent != real_parent */ #define PT_TRACE_MASK 0x000003f4 /* single stepping state bits (used on ARM and PA-RISC) */ #define PT_SINGLESTEP_BIT 31 #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) #define PT_BLOCKSTEP_BIT 30 #define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT) #include <linux/compiler.h> /* For unlikely. */ #include <linux/sched.h> /* For struct task_struct. */ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); extern int ptrace_attach(struct task_struct *tsk); extern int ptrace_detach(struct task_struct *, unsigned int); extern void ptrace_disable(struct task_struct *); extern int ptrace_check_attach(struct task_struct *task, int kill); extern int ptrace_request(struct task_struct *child, long request, long addr, long data); extern void ptrace_notify(int exit_code); extern void __ptrace_link(struct task_struct *child, struct task_struct *new_parent); extern void __ptrace_unlink(struct task_struct *child); static inline void ptrace_link(struct task_struct *child, struct task_struct *new_parent) { if (unlikely(child->ptrace)) __ptrace_link(child, new_parent); } static inline void ptrace_unlink(struct task_struct *child) { if (unlikely(child->ptrace)) __ptrace_unlink(child); } #ifndef force_successful_syscall_return /* * System call handlers that, upon successful completion, need to return a * negative value should call force_successful_syscall_return() right before * returning. On architectures where the syscall convention provides for a * separate error flag (e.g., alpha, ia64, ppc{,64}, sparc{,64}, possibly * others), this macro can be used to ensure that the error flag will not get * set. On architectures which do not support a separate error flag, the macro * is a no-op and the spurious error condition needs to be filtered out by some * other means (e.g., in user-level, by passing an extra argument to the * syscall handler, or something along those lines). */ #define force_successful_syscall_return() do { } while (0) #endif #endif #endif
/* * Copyright (C) 2014 Apple 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: * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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. */ #import <Foundation/Foundation.h> #ifndef RunLoopThread_h #define RunLoopThread_h @interface RunLoopThread : NSObject typedef void* (*ThreadMainType)(void*); + (ThreadMainType)threadMain; - (void)didFinishRunLoopInitialization; - (void)start; - (void)join; @end #endif // RunLoopThread_h
/* Copyright (C) 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell <philb@gnu.org>, 1999. 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <bits/armsigctx.h> #define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext #define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4, #define GET_PC(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \ ctx.v20.reg.ARM_pc : ctx.v21.arm_pc)) #define GET_FRAME(ctx) \ ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \ ctx.v20.reg.ARM_fp : ctx.v21.arm_fp)) #define GET_STACK(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \ ctx.v20.reg.ARM_sp : ctx.v21.arm_sp)) #define ADVANCE_STACK_FRAME(frm) \ ((struct layout *)frm - 1) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
/* * (C) Copyright 2010 * Texas Instruments, <www.ti.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 _SYS_PROTO_H_ #define _SYS_PROTO_H_ #include <asm/arch/omap4.h> #include <asm/io.h> struct omap_sysinfo { char *board_string; }; void gpmc_init(void); void watchdog_init(void); u32 get_device_type(void); void invalidate_dcache(u32); void set_muxconf_regs(void); extern const struct omap_sysinfo sysinfo; #endif
/* GStreamer * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com> * * gsturidownloader.h: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * Youshould have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __GSTURI_DOWNLOADER_H__ #define __GSTURI_DOWNLOADER_H__ #include <glib-object.h> #include <gst/gst.h> #include "gstfragment.h" G_BEGIN_DECLS #define GST_TYPE_URI_DOWNLOADER (gst_uri_downloader_get_type()) #define GST_URI_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_URI_DOWNLOADER,GstUriDownloader)) #define GST_URI_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_URI_DOWNLOADER,GstUriDownloaderClass)) #define GST_IS_URI_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_URI_DOWNLOADER)) #define GST_IS_URI_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_URI_DOWNLOADER)) typedef struct _GstUriDownloader GstUriDownloader; typedef struct _GstUriDownloaderPrivate GstUriDownloaderPrivate; typedef struct _GstUriDownloaderClass GstUriDownloaderClass; struct _GstUriDownloader { GstObject parent; GstUriDownloaderPrivate *priv; }; struct _GstUriDownloaderClass { GstObjectClass parent_class; /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; GType gst_uri_downloader_get_type (void); GstUriDownloader * gst_uri_downloader_new (void); GstFragment * gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, gboolean refresh, gboolean allow_cache, GError ** err); GstFragment * gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, gboolean refresh, gboolean allow_cache, gint64 range_start, gint64 range_end, GError ** err); void gst_uri_downloader_reset (GstUriDownloader *downloader); void gst_uri_downloader_cancel (GstUriDownloader *downloader); void gst_uri_downloader_free (GstUriDownloader *downloader); G_END_DECLS #endif /* __GSTURIDOWNLOADER_H__ */
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #pragma once #include <wx/bitmap.h> #include <wx/defs.h> #include <wx/event.h> #include <wx/gdicmn.h> #include <wx/panel.h> #include <wx/string.h> #include <wx/translation.h> #include <wx/windowid.h> #include "Common/CommonTypes.h" #include "Common/Event.h" #include "DolphinWX/Globals.h" class CFrame; class CRegisterWindow; class CWatchWindow; class CBreakPointWindow; class CMemoryWindow; class CJitWindow; class CCodeView; class DSPDebuggerLLE; class GFXDebuggerPanel; struct SCoreStartupParameter; class wxToolBar; class wxListBox; class wxMenu; class wxMenuBar; class CCodeWindow : public wxPanel { public: CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame * parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxBORDER_NONE, const wxString& name = _("Code")); void Load(); void Save(); // Parent interaction CFrame *Parent; wxMenuBar * GetMenuBar(); wxToolBar * GetToolBar(); wxBitmap m_Bitmaps[Toolbar_Debug_Bitmap_Max]; bool UseInterpreter(); bool BootToPause(); bool AutomaticStart(); bool JITNoBlockCache(); bool JITNoBlockLinking(); bool JumpToAddress(u32 address); void Update() override; void NotifyMapLoaded(); void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar); void CreateMenuOptions(wxMenu *pMenu); void CreateMenuSymbols(wxMenuBar *pMenuBar); void RecreateToolbar(wxToolBar*); void PopulateToolbar(wxToolBar* toolBar); void UpdateButtonStates(); void OpenPages(); void UpdateManager(); // Menu bar // ------------------- void OnCPUMode(wxCommandEvent& event); // CPU Mode menu void OnJITOff(wxCommandEvent& event); void ToggleCodeWindow(bool bShow); void ToggleRegisterWindow(bool bShow); void ToggleWatchWindow(bool bShow); void ToggleBreakPointWindow(bool bShow); void ToggleMemoryWindow(bool bShow); void ToggleJitWindow(bool bShow); void ToggleSoundWindow(bool bShow); void ToggleVideoWindow(bool bShow); void OnChangeFont(wxCommandEvent& event); void OnCodeStep(wxCommandEvent& event); void OnAddrBoxChange(wxCommandEvent& event); void OnSymbolsMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event); void OnProfilerMenu(wxCommandEvent& event); // Sub dialogs CRegisterWindow* m_RegisterWindow; CWatchWindow* m_WatchWindow; CBreakPointWindow* m_BreakpointWindow; CMemoryWindow* m_MemoryWindow; CJitWindow* m_JitWindow; DSPDebuggerLLE* m_SoundWindow; GFXDebuggerPanel* m_VideoWindow; // Settings bool bAutomaticStart; bool bBootToPause; bool bShowOnStart[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW + 1]; int iNbAffiliation[IDM_CODE_WINDOW - IDM_LOG_WINDOW + 1]; private: void OnSymbolListChange(wxCommandEvent& event); void OnSymbolListContextMenu(wxContextMenuEvent& event); void OnCallstackListChange(wxCommandEvent& event); void OnCallersListChange(wxCommandEvent& event); void OnCallsListChange(wxCommandEvent& event); void OnCodeViewChange(wxCommandEvent &event); void OnHostMessage(wxCommandEvent& event); // Debugger functions void SingleStep(); void StepOver(); void StepOut(); void ToggleBreakpoint(); void UpdateLists(); void UpdateCallstack(); void InitBitmaps(); CCodeView* codeview; wxListBox* callstack; wxListBox* symbols; wxListBox* callers; wxListBox* calls; Common::Event sync_event; };
#ifndef __USB3503_H__ #define __USB3503_H__ #define USB3503_I2C_NAME "usb3503" enum usb3503_mode { USB3503_MODE_UNKNOWN, USB3503_MODE_HUB, USB3503_MODE_STANDBY, }; enum usb3503_ref_clk { USB3503_REFCLK_24M, USB3503_REFCLK_26M, }; struct usb3503_platform_data { enum usb3503_mode initial_mode; enum usb3503_ref_clk ref_clk; int gpio_intn; int gpio_connect; int gpio_reset; }; #endif
/*************************************************************************** NWNXFuncs.cpp - Implementation of the CNWNXFuncs class. Copyright (C) 2007 Doug Swarin (zac@intertex.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ #include "NWNXDefenses.h" int Local_GetIsDeathAttackImmune(CNWSCreatureStats *target, uint8_t immtype, CNWSCreature *attacker) { return -1; } /* vim: set sw=4: */
/* This file is part of the KDE libraries * Copyright (C) 1999 Waldo Bastian <bastian@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation; * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #ifndef KSYCOCADICT_H #define KSYCOCADICT_H #include <kdecore_export.h> #include "ksycocaentry.h" #include <QList> class QString; class QDataStream; /** * @internal * Hash table implementation for the sycoca database file * * Only exported for the unit test */ class KDECORE_EXPORT KSycocaDict //krazy:exclude=dpointer (not const because it gets deleted by clear()) { public: /** * Create an empty dict, for building the database */ KSycocaDict(); /** * Create a dict from an existing database */ KSycocaDict(QDataStream *str, int offset); ~KSycocaDict(); /** * Adds a 'payload' to the dictionary with key 'key'. * * 'payload' should have a valid offset by the time * the dictionary gets saved. **/ void add(const QString &key, const KSycocaEntry::Ptr& payload); /** * Removes the 'payload' from the dictionary with key 'key'. * * Not very fast, use with care O(N) **/ void remove(const QString &key); /** * Looks up an entry identified by 'key'. * * If 0 is returned, no matching entry exists. * Otherwise, the offset of the entry is returned. * * NOTE: It is not guaranteed that this entry is * indeed the one you were looking for. * After loading the entry you should check that it * indeed matches the search key. If it doesn't * then no matching entry exists. */ int find_string(const QString &key ) const; /** * Looks up all entries identified by 'key'. * This is useful when the dict is used as a multi-hash. * * If an empty list is returned, no matching entry exists. * Otherwise, the offset of the matching entries are returned. * * NOTE: It is not guaranteed that each entry is * indeed among the ones you were looking for. * After loading each entry you should check that it * indeed matches the search key. */ QList<int> findMultiString(const QString &key ) const; /** * The number of entries in the dictionary. * * Only valid when building the database. */ uint count() const; /** * Reset the dictionary. * * Only valid when building the database. */ void clear(); /** * Save the dictionary to the stream * A reasonable fast hash algorithm will be created. * * Typically this will find 90% of the entries directly. * Average hash table size: nrOfItems * 20 bytes. * Average duplicate list size: nrOfItms * avgKeyLength / 5. * * Unknown keys have an average 20% chance to give a false hit. * (That's why your program should check the result) * * Example: * Assume 1000 items with an average key length of 60 bytes. * * Approx. 900 items will hash directly to the right entry. * Approx. 100 items require a lookup in the duplicate list. * * The hash table size will be approx. 20Kb. * The duplicate list size will be approx. 12Kb. **/ void save(QDataStream &str); private: Q_DISABLE_COPY(KSycocaDict) class Private; Private* d; }; #endif
#pragma once namespace vm { using namespace ps3; } // Return Codes enum { CELL_ATRAC_ERROR_API_FAIL = 0x80610301, CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311, CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312, CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313, CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314, CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315, CELL_ATRAC_ERROR_NO_DECODER = 0x80610321, CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322, CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323, CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331, CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332, CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333, CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334, CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341, CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342, CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351, CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361, CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371, CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372, CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610381, CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382, }; // Remain Frame enum : s32 { CELL_ATRAC_ALLDATA_IS_ON_MEMORY = -1, CELL_ATRAC_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2, CELL_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, }; struct set_alignment(8) CellAtracHandle { vm::ptr<u8> pucWorkMem; // ... }; CHECK_MAX_SIZE(CellAtracHandle, 512); struct CellAtracBufferInfo { vm::ptr<u8> pucWriteAddr; be_t<u32> uiWritableByte; be_t<u32> uiMinWriteByte; be_t<u32> uiReadPosition; }; struct CellAtracExtRes { vm::ptr<struct CellSpurs> pSpurs; u8 priority[8]; }; extern Module cellAtrac;
/* * pata_ninja32.c - Ninja32 PATA for new ATA layer * (C) 2007 Red Hat Inc * Alan Cox <alan@redhat.com> * * Note: The controller like many controllers has shared timings for * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back * in the dma_stop function. Thus we actually don't need a set_dmamode * method as the PIO method is always called and will set the right PIO * timing parameters. * * The Ninja32 Cardbus is not a generic SFF controller. Instead it is * laid out as follows off BAR 0. This is based upon Mark Lord's delkin * driver and the extensive analysis done by the BSD developers, notably * ITOH Yasufumi. * * Base + 0x00 IRQ Status * Base + 0x01 IRQ control * Base + 0x02 Chipset control * Base + 0x03 Unknown * Base + 0x04 VDMA and reset control + wait bits * Base + 0x08 BMIMBA * Base + 0x0C DMA Length * Base + 0x10 Taskfile * Base + 0x18 BMDMA Status ? * Base + 0x1C * Base + 0x1D Bus master control * bit 0 = enable * bit 1 = 0 write/1 read * bit 2 = 1 sgtable * bit 3 = go * bit 4-6 wait bits * bit 7 = done * Base + 0x1E AltStatus * Base + 0x1F timing register */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #define DRV_NAME "pata_ninja32" #define DRV_VERSION "0.0.1" /** * ninja32_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Called to do the PIO mode setup. Our timing registers are shared * but we want to set the PIO timing by default. */ static void ninja32_set_piomode(struct ata_port *ap, struct ata_device *adev) { static u16 pio_timing[5] = { 0xd6, 0x85, 0x44, 0x33, 0x13 }; iowrite8(pio_timing[adev->pio_mode - XFER_PIO_0], ap->ioaddr.bmdma_addr + 0x1f); ap->private_data = adev; } static void ninja32_dev_select(struct ata_port *ap, unsigned int device) { struct ata_device *adev = &ap->link.device[device]; if (ap->private_data != adev) { iowrite8(0xd6, ap->ioaddr.bmdma_addr + 0x1f); ata_std_dev_select(ap, device); ninja32_set_piomode(ap, adev); } } static struct scsi_host_template ninja32_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, .sg_tablesize = LIBATA_MAX_PRD, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, .use_clustering = ATA_SHT_USE_CLUSTERING, .proc_name = DRV_NAME, .dma_boundary = ATA_DMA_BOUNDARY, .slave_configure = ata_scsi_slave_config, .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, }; static struct ata_port_operations ninja32_port_ops = { .set_piomode = ninja32_set_piomode, .mode_filter = ata_pci_default_filter, .tf_load = ata_tf_load, .tf_read = ata_tf_read, .check_status = ata_check_status, .exec_command = ata_exec_command, .dev_select = ninja32_dev_select, .freeze = ata_bmdma_freeze, .thaw = ata_bmdma_thaw, .error_handler = ata_bmdma_error_handler, .post_internal_cmd = ata_bmdma_post_internal_cmd, .cable_detect = ata_cable_40wire, .bmdma_setup = ata_bmdma_setup, .bmdma_start = ata_bmdma_start, .bmdma_stop = ata_bmdma_stop, .bmdma_status = ata_bmdma_status, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .data_xfer = ata_data_xfer, .irq_handler = ata_interrupt, .irq_clear = ata_bmdma_irq_clear, .irq_on = ata_irq_on, .port_start = ata_sff_port_start, }; static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) { struct ata_host *host; struct ata_port *ap; void __iomem *base; int rc; host = ata_host_alloc(&dev->dev, 1); if (!host) return -ENOMEM; ap = host->ports[0]; /* Set up the PCI device */ rc = pcim_enable_device(dev); if (rc) return rc; rc = pcim_iomap_regions(dev, 1 << 0, DRV_NAME); if (rc == -EBUSY) pcim_pin_device(dev); if (rc) return rc; host->iomap = pcim_iomap_table(dev); rc = pci_set_dma_mask(dev, ATA_DMA_MASK); if (rc) return rc; rc = pci_set_consistent_dma_mask(dev, ATA_DMA_MASK); if (rc) return rc; pci_set_master(dev); /* Set up the register mappings */ base = host->iomap[0]; if (!base) return -ENOMEM; ap->ops = &ninja32_port_ops; ap->pio_mask = 0x1F; ap->flags |= ATA_FLAG_SLAVE_POSS; ap->ioaddr.cmd_addr = base + 0x10; ap->ioaddr.ctl_addr = base + 0x1E; ap->ioaddr.altstatus_addr = base + 0x1E; ap->ioaddr.bmdma_addr = base; ata_std_ports(&ap->ioaddr); iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ iowrite8(0x01, base + 0x03); /* Unknown */ iowrite8(0x20, base + 0x04); /* WAIT0 */ iowrite8(0x8f, base + 0x05); /* Unknown */ iowrite8(0xa4, base + 0x1c); /* Unknown */ iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ /* FIXME: Should we disable them at remove ? */ return ata_host_activate(host, dev->irq, ata_interrupt, IRQF_SHARED, &ninja32_sht); } static const struct pci_device_id ninja32[] = { { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { }, }; static struct pci_driver ninja32_pci_driver = { .name = DRV_NAME, .id_table = ninja32, .probe = ninja32_init_one, .remove = ata_pci_remove_one }; static int __init ninja32_init(void) { return pci_register_driver(&ninja32_pci_driver); } static void __exit ninja32_exit(void) { pci_unregister_driver(&ninja32_pci_driver); } MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("low-level driver for Ninja32 ATA"); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, ninja32); MODULE_VERSION(DRV_VERSION); module_init(ninja32_init); module_exit(ninja32_exit);
/* Implementation of the BSD usleep function using nanosleep. Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. 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 <time.h> #include <unistd.h> int usleep (useconds_t useconds) { struct timespec ts = { .tv_sec = (long int) (useconds / 1000000), .tv_nsec = (long int) (useconds % 1000000) * 1000ul }; /* Note the usleep() is a cancellation point. But since we call nanosleep() which itself is a cancellation point we do not have to do anything here. */ return __nanosleep (&ts, NULL); }
#include <config.h> #include "testutils.h" #ifdef WITH_OPENVZ # include <stdio.h> # include <string.h> # include <unistd.h> # include "internal.h" # include "viralloc.h" # include "openvz/openvz_conf.h" # include "virstring.h" # define VIR_FROM_THIS VIR_FROM_OPENVZ static int testLocateConfFile(int vpsid ATTRIBUTE_UNUSED, char **conffile, const char *ext ATTRIBUTE_UNUSED) { return virAsprintf(conffile, "%s/openvzutilstest.conf", abs_srcdir); } struct testConfigParam { const char *param; const char *value; int ret; }; static struct testConfigParam configParams[] = { { "OSTEMPLATE", "rhel-5-lystor", 1 }, { "IP_ADDRESS", "194.44.18.88", 1 }, { "THIS_PARAM_IS_MISSING", NULL, 0 }, }; static int testReadConfigParam(const void *data ATTRIBUTE_UNUSED) { int result = -1; size_t i; char *conf = NULL; char *value = NULL; if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0) return -1; for (i = 0; i < ARRAY_CARDINALITY(configParams); ++i) { if (openvzReadConfigParam(conf, configParams[i].param, &value) != configParams[i].ret) { goto cleanup; } if (configParams[i].ret != 1) continue; if (STRNEQ(configParams[i].value, value)) { virtTestDifference(stderr, configParams[i].value, value); goto cleanup; } } result = 0; cleanup: VIR_FREE(conf); VIR_FREE(value); return result; } static int testReadNetworkConf(const void *data ATTRIBUTE_UNUSED) { int result = -1; virDomainDefPtr def = NULL; char *actual = NULL; virErrorPtr err = NULL; const char *expected = "<domain type='openvz'>\n" " <uuid>00000000-0000-0000-0000-000000000000</uuid>\n" " <memory unit='KiB'>0</memory>\n" " <currentMemory unit='KiB'>0</currentMemory>\n" " <vcpu placement='static'>0</vcpu>\n" " <os>\n" " <type>exe</type>\n" " <init>/sbin/init</init>\n" " </os>\n" " <clock offset='utc'/>\n" " <on_poweroff>destroy</on_poweroff>\n" " <on_reboot>destroy</on_reboot>\n" " <on_crash>destroy</on_crash>\n" " <devices>\n" " <interface type='ethernet'>\n" " <mac address='00:00:00:00:00:00'/>\n" " <ip address='194.44.18.88' family='ipv4'/>\n" " </interface>\n" " <interface type='bridge'>\n" " <mac address='00:18:51:c1:05:ee'/>\n" " <target dev='veth105.10'/>\n" " </interface>\n" " </devices>\n" "</domain>\n"; if (!(def = virDomainDefNew()) || VIR_STRDUP(def->os.type, "exe") < 0 || VIR_STRDUP(def->os.init, "/sbin/init") < 0) goto cleanup; def->virtType = VIR_DOMAIN_VIRT_OPENVZ; if (openvzReadNetworkConf(def, 1) < 0) { err = virGetLastError(); fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>"); goto cleanup; } actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE); if (actual == NULL) { err = virGetLastError(); fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>"); goto cleanup; } if (STRNEQ(expected, actual)) { virtTestDifference(stderr, expected, actual); goto cleanup; } result = 0; cleanup: VIR_FREE(actual); virDomainDefFree(def); return result; } static int mymain(void) { int result = 0; openvzLocateConfFile = testLocateConfFile; # define DO_TEST(_name) \ do { \ if (virtTestRun("OpenVZ "#_name, test##_name, \ NULL) < 0) { \ result = -1; \ } \ } while (0) DO_TEST(ReadConfigParam); DO_TEST(ReadNetworkConf); return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } VIRT_TEST_MAIN(mymain) #else int main(void) { return EXIT_AM_SKIP; } #endif /* WITH_OPENVZ */
/* Install given floating-point environment. Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. 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 <fpu_control.h> #include <assert.h> #include <unistd.h> #include <ldsodefs.h> #include <dl-procinfo.h> /* All exceptions, including the x86-specific "denormal operand" exception. */ #define FE_ALL_EXCEPT_X86 (FE_ALL_EXCEPT | __FE_DENORM) int __fesetenv (const fenv_t *envp) { fenv_t temp; /* The memory block used by fstenv/fldenv has a size of 28 bytes. */ assert (sizeof (fenv_t) == 28); /* Install the environment specified by ENVP. But there are a few values which we do not want to come from the saved environment. Therefore, we get the current environment and replace the values we want to use from the environment specified by the parameter. */ __asm__ ("fnstenv %0" : "=m" (*&temp)); if (envp == FE_DFL_ENV) { temp.__control_word |= FE_ALL_EXCEPT_X86; temp.__control_word &= ~FE_TOWARDZERO; temp.__control_word |= _FPU_EXTENDED; temp.__status_word &= ~FE_ALL_EXCEPT_X86; } else if (envp == FE_NOMASK_ENV) { temp.__control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO); /* Keep the "denormal operand" exception masked. */ temp.__control_word |= __FE_DENORM; temp.__control_word |= _FPU_EXTENDED; temp.__status_word &= ~FE_ALL_EXCEPT_X86; } else { temp.__control_word &= ~(FE_ALL_EXCEPT_X86 | FE_TOWARDZERO | _FPU_EXTENDED); temp.__control_word |= (envp->__control_word & (FE_ALL_EXCEPT_X86 | FE_TOWARDZERO | _FPU_EXTENDED)); temp.__status_word &= ~FE_ALL_EXCEPT_X86; temp.__status_word |= envp->__status_word & FE_ALL_EXCEPT_X86; } temp.__eip = 0; temp.__cs_selector = 0; temp.__opcode = 0; temp.__data_offset = 0; temp.__data_selector = 0; __asm__ ("fldenv %0" : : "m" (temp)); if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) { unsigned int mxcsr; __asm__ ("stmxcsr %0" : "=m" (mxcsr)); if (envp == FE_DFL_ENV) { /* Clear SSE exceptions. */ mxcsr &= ~FE_ALL_EXCEPT_X86; /* Set mask for SSE MXCSR. */ mxcsr |= (FE_ALL_EXCEPT_X86 << 7); /* Set rounding to FE_TONEAREST. */ mxcsr &= ~0x6000; mxcsr |= (FE_TONEAREST << 3); /* Clear the FZ and DAZ bits. */ mxcsr &= ~0x8040; } else if (envp == FE_NOMASK_ENV) { /* Clear SSE exceptions. */ mxcsr &= ~FE_ALL_EXCEPT_X86; /* Do not mask exceptions. */ mxcsr &= ~(FE_ALL_EXCEPT << 7); /* Keep the "denormal operand" exception masked. */ mxcsr |= (__FE_DENORM << 7); /* Set rounding to FE_TONEAREST. */ mxcsr &= ~0x6000; mxcsr |= (FE_TONEAREST << 3); /* Clear the FZ and DAZ bits. */ mxcsr &= ~0x8040; } else mxcsr = envp->__eip; __asm__ ("ldmxcsr %0" : : "m" (mxcsr)); } /* Success. */ return 0; } #include <shlib-compat.h> #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
/*************************************************************************** qgslabelposition.h ------------------- begin : February 2021 copyright : (C) Nyall Dawson email : nyall dot dawson at gmail 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 QGSLABELPOSITION_H #define QGSLABELPOSITION_H #include "qgis_core.h" #include "qgis_sip.h" #include "qgspointxy.h" #include "qgsrectangle.h" #include "qgsgeometry.h" #include <QFont> /** * \ingroup core * \class QgsLabelPosition * \brief Represents the calculated placement of a map label. */ class CORE_EXPORT QgsLabelPosition { public: /** * Constructor for QgsLabelPosition. * \param id associated feature ID * \param r label rotation in degrees clockwise * \param corners corner points of label bounding box, in map units * \param rect label bounding box, in map units * \param w width of label, in map units * \param h height of label, in map units * \param layer ID of associated map layer * \param labeltext text rendered for label * \param labelfont font used to render label * \param upside_down TRUE if label is upside down * \param diagram TRUE if label is a diagram * \param pinned TRUE if label has pinned placement * \param providerId ID of associated label provider * \param labelGeometry polygon geometry of label boundary * \param isUnplaced set to TRUE if label was unplaced (e.g. due to collisions with other labels) */ QgsLabelPosition( QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString(), const QgsGeometry &labelGeometry = QgsGeometry(), bool isUnplaced = false ) : featureId( id ) , rotation( r ) , cornerPoints( corners ) , labelRect( rect ) , labelGeometry( labelGeometry ) , width( w ) , height( h ) , layerID( layer ) , labelText( labeltext ) , labelFont( labelfont ) , upsideDown( upside_down ) , isDiagram( diagram ) , isPinned( pinned ) , providerID( providerId ) , isUnplaced( isUnplaced ) {} //! Constructor for QgsLabelPosition QgsLabelPosition() = default; /** * ID of feature associated with this label. */ QgsFeatureId featureId = FID_NULL; /** * Rotation of label, in degrees clockwise. */ double rotation = 0; QVector< QgsPointXY > cornerPoints; QgsRectangle labelRect; /** * A polygon geometry representing the label's bounds in map coordinates. * \since QGIS 3.4.9 */ QgsGeometry labelGeometry; /** * Width of label bounding box, in map units. */ double width = 0; /** * Heeght of label bounding box, in map units. */ double height = 0; /** * ID of associated map layer. */ QString layerID; /** * String shown in label. */ QString labelText; /** * Font which the label is rendered using. */ QFont labelFont; /** * TRUE if label is upside down. */ bool upsideDown = false; /** * TRUE if label is a diagram. */ bool isDiagram = false; /** * TRUE if label position has been pinned. */ bool isPinned = false; /** * ID of the associated label provider. * \since QGIS 2.14 */ QString providerID; /** * TRUE if label position corresponds to an unplaced label. * \since QGIS 3.10 */ bool isUnplaced = false; }; #endif // QGSLABELPOSITION_H
/* * Flash partitions described by the OF (or flattened) device tree * * Copyright (C) 2006 MontaVista Software Inc. * Author: Vitaly Wool <vwool@ru.mvista.com> * * Revised to handle newer style flash binding by: * Copyright (C) 2007 David Gibson, IBM Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/module.h> #include <linux/init.h> #include <linux/of.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> int __devinit of_mtd_parse_partitions(struct device *dev, struct mtd_info *mtd, struct device_node *node, struct mtd_partition **pparts) { const char *partname; struct device_node *pp; int nr_parts, i; /* First count the subnodes */ pp = NULL; nr_parts = 0; while ((pp = of_get_next_child(node, pp))) nr_parts++; if (nr_parts == 0) return 0; *pparts = kzalloc(nr_parts * sizeof(**pparts), GFP_KERNEL); if (!*pparts) return -ENOMEM; pp = NULL; i = 0; while ((pp = of_get_next_child(node, pp))) { const u32 *reg; int len; reg = of_get_property(pp, "reg", &len); if (!reg || (len != 2 * sizeof(u32))) { of_node_put(pp); dev_err(dev, "Invalid 'reg' on %s\n", node->full_name); kfree(*pparts); *pparts = NULL; return -EINVAL; } (*pparts)[i].offset = reg[0]; (*pparts)[i].size = reg[1]; partname = of_get_property(pp, "label", &len); if (!partname) partname = of_get_property(pp, "name", &len); (*pparts)[i].name = (char *)partname; if (of_get_property(pp, "read-only", &len)) (*pparts)[i].mask_flags = MTD_WRITEABLE; i++; } return nr_parts; } EXPORT_SYMBOL(of_mtd_parse_partitions);
//================================================================= // common.h //================================================================= // This file is part of a Software Defined Radio. // Copyright (C) 2006, 2007 FlexRadio Systems // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // 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. // // You may contact us via email at: sales@flex-radio.com. // Paper mail may be sent to: // FlexRadio Systems // 12100 Technology Blvd. // Austin, TX 78727 // USA //================================================================= #ifndef _common_h #define _common_h #ifndef BOOLEAN typedef unsigned char BOOLEAN; #endif #ifndef TRUE #define TRUE 1 #define true 1 #endif #ifndef FALSE #define FALSE 0 #define false 0 #endif typedef unsigned char uint8; typedef char int8; typedef unsigned short uint16; typedef short int16; typedef unsigned int uint32; typedef int int32; typedef unsigned long long uint64; typedef long long int64; #endif // _common_h
/* testsuite.h - failif */ process test_addargs(bool8); process test_bigargs(bool8); process test_schedule(bool8 verbose); process test_preempt(bool8 verbose); process test_recursion(bool8 verbose); process test_semaphore(bool8 verbose); process test_semaphore2(bool8 verbose); process test_semaphore3(bool8 verbose); process test_semaphore4(bool8 verbose); process test_semaphore5(bool8 verbose); process test_libStdio(bool8 verbose); void testPass(bool8, const char *); void testFail(bool8, const char *); void testSkip(bool8, const char *); void testPrint(bool8, const char *); /*------------------------------------------------------------------------ * failif - report failure by displaying a message is condition is met *------------------------------------------------------------------------ */ #define failif(cond, failmsg) \ if ( cond ) { testFail(verbose, failmsg); passed = FALSE; } \ else { testPass(verbose, ""); } /* Define the strcuture of an entry in the table of test cases */ struct testcase { char *name; /* Name of test case */ process (*test) (bool8);/* Test case function */ }; extern int ntests; /* total number of tests */ extern struct testcase testtab[]; /* table of test cases */ #define TESTSTK 8192 /* size of process stack used for test */
/* pmlastmsg.c * This is a parser module specifically for those horrible * "<PRI>last message repeated n times" messages notoriously generated * by some syslog implementations. Note that this parser should be placed * on top of the parser stack -- it takes out only these messages and * leaves all others for processing by the other parsers. * * NOTE: read comments in module-template.h to understand how this file * works! * * File begun on 2010-07-13 by RGerhards * * Copyright 2014-2016 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * * 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 * -or- * see COPYING.ASL20 in the source distribution * * 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 "config.h" #include "rsyslog.h" #include <stdlib.h> #include <string.h> #include <assert.h> #include <ctype.h> #include "conf.h" #include "syslogd-types.h" #include "template.h" #include "msg.h" #include "module-template.h" #include "glbl.h" #include "errmsg.h" #include "parser.h" #include "datetime.h" #include "unicode-helper.h" MODULE_TYPE_PARSER MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.lastline") /* internal structures */ DEF_PMOD_STATIC_DATA DEFobjCurrIf(errmsg) DEFobjCurrIf(glbl) DEFobjCurrIf(parser) DEFobjCurrIf(datetime) /* static data */ static int bParseHOSTNAMEandTAG; /* cache for the equally-named global param - performance enhancement */ BEGINisCompatibleWithFeature CODESTARTisCompatibleWithFeature if(eFeat == sFEATUREAutomaticSanitazion) iRet = RS_RET_OK; if(eFeat == sFEATUREAutomaticPRIParsing) iRet = RS_RET_OK; ENDisCompatibleWithFeature /* parse a legay-formatted syslog message. */ BEGINparse uchar *p2parse; int lenMsg; #define OpeningText "last message repeated " #define ClosingText " times" CODESTARTparse dbgprintf("Message will now be parsed by \"last message repated n times\" parser.\n"); assert(pMsg != NULL); assert(pMsg->pszRawMsg != NULL); lenMsg = pMsg->iLenRawMsg - pMsg->offAfterPRI; /* note: offAfterPRI is already the number of PRI chars (do not add one!) */ p2parse = pMsg->pszRawMsg + pMsg->offAfterPRI; /* point to start of text, after PRI */ /* check if this message is of the type we handle in this (very limited) parser */ /* first, we permit SP */ while(lenMsg && *p2parse == ' ') { --lenMsg; ++p2parse; } if((unsigned) lenMsg < sizeof(OpeningText)-1 + sizeof(ClosingText)-1 + 1) { /* too short, can not be "our" message */ ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE); } if(strncasecmp((char*) p2parse, OpeningText, sizeof(OpeningText)-1) != 0) { /* wrong opening text */ ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE); } lenMsg -= sizeof(OpeningText) - 1; p2parse += sizeof(OpeningText) - 1; /* now we need an integer --> digits */ while(lenMsg && isdigit(*p2parse)) { --lenMsg; ++p2parse; } if(lenMsg != sizeof(ClosingText)-1) { /* size must fit, else it is not "our" message... */ ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE); } if(strncasecmp((char*) p2parse, ClosingText, lenMsg) != 0) { /* wrong closing text */ ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE); } /* OK, now we know we need to process this message, so we do that * (and it is fairly simple in our case...) */ DBGPRINTF("pmlastmsg detected a \"last message repeated n times\" message\n"); setProtocolVersion(pMsg, MSG_LEGACY_PROTOCOL); memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime)); MsgSetMSGoffs(pMsg, pMsg->offAfterPRI); /* we don't have a header! */ MsgSetTAG(pMsg, (uchar*)"", 0); finalize_it: ENDparse BEGINmodExit CODESTARTmodExit /* release what we no longer need */ objRelease(errmsg, CORE_COMPONENT); objRelease(glbl, CORE_COMPONENT); objRelease(parser, CORE_COMPONENT); objRelease(datetime, CORE_COMPONENT); ENDmodExit BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_PMOD_QUERIES CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES ENDqueryEtryPt BEGINmodInit() CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(glbl, CORE_COMPONENT)); CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(objUse(parser, CORE_COMPONENT)); CHKiRet(objUse(datetime, CORE_COMPONENT)); dbgprintf("lastmsg parser init called, compiled with version %s\n", VERSION); bParseHOSTNAMEandTAG = glbl.GetParseHOSTNAMEandTAG(); /* cache value, is set only during rsyslogd option processing */ ENDmodInit /* vim:set ai: */
#pragma once #include "ASyncTCP.h" #include "P1MeterBase.h" class P1MeterTCP : public P1MeterBase, ASyncTCP { public: P1MeterTCP(int ID, const std::string &IPAddress, unsigned short usIPPort, bool disable_crc, int ratelimit, const std::string &DecryptionKey); ~P1MeterTCP() override = default; bool WriteToHardware(const char *pdata, unsigned char length) override; public: // signals boost::signals2::signal<void()> sDisconnected; private: bool StartHardware() override; bool StopHardware() override; protected: std::string m_szIPAddress; unsigned short m_usIPPort; void Do_Work(); void OnConnect() override; void OnDisconnect() override; void OnData(const unsigned char *pData, size_t length) override; void OnError(const boost::system::error_code &error) override; std::shared_ptr<std::thread> m_thread; };
/* Copyright (C) 2015-2016 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 <nss.h> #include <string.h> const char __nss_invalid_field_characters[] = NSS_INVALID_FIELD_CHARACTERS; /* Check that VALUE is either NULL or a NUL-terminated string which does not contain characters not permitted in NSS database fields. */ _Bool internal_function __nss_valid_field (const char *value) { return value == NULL || strpbrk (value, __nss_invalid_field_characters) == NULL; }
#ifndef __LV2_STORAGE_H__ #define __LV2_STORAGE_H__ #include <stdint.h> #include <lv2/lv2.h> #include <lv1/lv1.h> /* Devices */ #define ATA_HDD 0x101000000000007 #define BDVD_DRIVE 0x101000000000006 #define PATA0_HDD_DRIVE 0x101000000000008 #define PATA0_BDVD_DRIVE BDVD_DRIVE #define PATA1_HDD_DRIVE ATA_HDD #define BUILTIN_FLASH 0x100000000000001 #define NAND_FLASH BUILTIN_FLASH #define NOR_FLASH 0x100000000000004 #define MEMORY_STICK 0x103000000000010 #define SD_CARD 0x103000100000010 #define COMPACT_FLASH 0x103000200000010 #define USB_MASS_STORAGE_1(n) (0x10300000000000A+n) /* For 0-5 */ #define USB_MASS_STORAGE_2(n) (0x10300000000001F+(n-6)) /* For 6-127 */ #define HDD_PARTITION(n) (ATA_HDD | (n<<32)) #define FLASH_PARTITION(n) (BUILTIN_FLASH | (n<<32)) /* Commands for storage_send_device_command */ #define STORAGE_COMMAND_NATIVE 0x01 #define STORAGE_COMMAND_GET_DEVICE_SIZE 0x10 #define STORAGE_COMMAND_GET_DEVICE_TYPE 0x11 /* Device types returned by STORAGE_COMMAND_GET_DEVICE_TYPE and some scsi commands */ #define DEVICE_TYPE_PS3_DVD 0xFF70 #define DEVICE_TYPE_PS3_BD 0xFF71 #define DEVICE_TYPE_PS2_CD 0xFF60 #define DEVICE_TYPE_PS2_DVD 0xFF61 #define DEVICE_TYPE_PSX_CD 0xFF50 #define DEVICE_TYPE_BDROM 0x40 #define DEVICE_TYPE_BDMR_SR 0x41 /* Sequential record */ #define DEVICE_TYPE_BDMR_RR 0x42 /* Random record */ #define DEVICE_TYPE_BDMRE 0x43 #define DEVICE_TYPE_DVD 0x10 /* DVD-ROM, DVD+-R, DVD+-RW etc, they are differenced by booktype field in some scsi command */ #define DEVICE_TYPE_CD 0x08 /* CD-ROM, CD-DA, CD-R, CD-RW, etc, they are differenced somehow with scsi commands */ typedef uint32_t device_handle_t; // Kernel typedef uint32_t sys_device_handle_t; // User typedef struct { char *label; // 0 uint32_t unk_08; // 8 0xB8 0x90 uint32_t unk_0C; // 0x0C 0xBC 0x94 uint64_t unk_10; // 0x10 not copied in sys_storage_get_device_info 0xC0 unused uint64_t sector_count; // 0x18 0xC8 0x98 uint32_t sector_size; // 0x20 0xD0 0xA0 uint32_t unk_24; // 0x24 not copied in sys_storage_get_device_info 0xD4 unused uint32_t unk_28; // 0x28 not copied in sys_storage_get_device_info 0xD8 unused uint32_t unk_2C; // 0x2C not copied in sys_storage_get_device_info 0xDC unused uint32_t unk_30; // 0x30 0xE0 0xA4 uint32_t unk_34; // 0x34 not copied in sys_storage_get_device_info 0xE4 unused uint64_t unk_38; // 0x38 not copied in sys_storage_get_device_info 0xE8 unused uint8_t unk_40[8]; // 0x40 0xF0 0xA8 } __attribute__((packed)) device_info_t; typedef struct { uint32_t inlen; uint32_t unk1; uint32_t outlen; uint32_t unk2; uint32_t unk3; } __attribute__((packed)) StorageCmdScsiData; LV2_EXPORT int storage_get_device_info(uint64_t device_id, device_info_t *device_info); LV2_EXPORT int storage_get_device_config(int *unk, int *unk2); // storage_open(0x0101000000000006, 0, &device_handle, 0); // dev_bdvd LV2_EXPORT int storage_open(uint64_t device_id, uint64_t unk, device_handle_t *device_handle, uint64_t unk2); LV2_EXPORT int storage_close(device_handle_t device_handle); // storage_read(3, 0, 0x220, 0x10, buf, &nread, 4); // flash? // storage_read(0x13, 0, 0x030761E0, 0x80, buf, &nread, 0); // hdd // storage_read(0x24, 0, 0x3C01, 0x20, buf, &nread, 4); // usb. Raw sector, not partition one. // storage_read(0x41, 0, 0x10, 0x10, buf, &nread, 0); // dev_bdvd LV2_EXPORT int storage_read(device_handle_t device_handle, uint64_t unk, uint64_t start_sector, uint32_t sector_count, void *buf, uint32_t *nread, uint64_t flags); LV2_EXPORT int storage_write(device_handle_t device_handle, uint64_t unk, uint64_t start_sector, uint32_t sector_count, void *buf, uint32_t *nwrite, uint64_t flags); /* get device type? command = 0x11 indata = 0x01010071 (also works with indata 00000000) outdata = 0x0000FF71 PS3 BD game outdata = 0x00000040 BD-ROM outdata = 0x00000041 BD-R outdata = 0x0000FF61 PS2 DVD game outdata = 0x00000010 DVD (any except ps2) outdata = 0x00000008 CD (any except ps1?) */ LV2_EXPORT int storage_send_device_command(device_handle_t device_handle, unsigned int command, void *indata, uint64_t inlen, void *outdata, uint64_t outlen, uint64_t *unkret); LV2_EXPORT int storage_map_io_memory(uint64_t device, void *buf, uint64_t size); LV2_EXPORT int storage_unmap_io_memory(uint64_t device, void *buf); static INLINE uint64_t storage_get_flash_device(void) { uint64_t value, v2; lv1_get_repository_node_value(PS3_LPAR_ID_PME, FIELD_FIRST("sys", 0), FIELD("flash", 0), FIELD("ext", 0), 0, &value, &v2); if (value&1) return NAND_FLASH; return NOR_FLASH; } #endif /* __LV2_STORAGE_H__ */
#ifndef MACTYPES_H #define MACTYPES_H #include <stdint.h> #include <CoreFoundation/CFBase.h> class _StringHandle; #if 0 // declared in CFBase.h typedef int8_t SInt8; typedef uint8_t UInt8; typedef int16_t SInt16; typedef uint16_t UInt16; typedef int32_t SInt32; typedef uint32_t UInt32; typedef int64_t SInt64; typedef uint64_t UInt64; typedef float Float32; typedef double Float64; #endif typedef uint32_t OptionBits; typedef int32_t Fixed; // 16/16 typedef Fixed* FixedPtr; typedef int32_t Fract; // 2/30 typedef Fract* FractPtr; typedef uint32_t UnsignedFixed; // 16u/16 typedef UnsignedFixed* UnsignedFixedPtr; typedef short ShortFixed; typedef ShortFixed * ShortFixedPtr; // 8/8 typedef int64_t wide; typedef uint64_t UnsignedWide; typedef uint64_t AbsoluteTime; typedef int32_t Duration; // milliseconds typedef uint8_t Boolean; // Pascal strings typedef unsigned char Str255[256]; typedef unsigned char Str63[64]; typedef unsigned char Str32[33]; typedef unsigned char Str31[32]; typedef unsigned char Str27[28]; typedef unsigned char Str15[16]; typedef unsigned char* StringPtr; typedef unsigned char** StringHandle; typedef char* Ptr; typedef char** Handle; typedef int16_t OSErr; typedef int32_t OSStatus; typedef uint32_t OSType; #endif
/* * Doubly linked list construction and deletion. */ #include <stdlib.h> #include <verifier-builtins.h> int main() { struct T { struct T* next; struct T* prev; int data; }; struct T* x = NULL; struct T* y = NULL; x = malloc(sizeof(struct T)); x->next = NULL; x->prev = NULL; while (__VERIFIER_nondet_int()) { y = malloc(sizeof(struct T)); y->next = x; x->prev = y; y->prev = NULL; x = y; } __VERIFIER_plot("test-f0028-fixpoint"); while (x) { y = x->next; free(x); x = y; } return 0; }
#ifndef __al_included_allegro5_fullscreen_mode_h #define __al_included_allegro5_fullscreen_mode_h #include "allegro5/base.h" #ifdef __cplusplus extern "C" { #endif /* Type: ALLEGRO_DISPLAY_MODE */ typedef struct ALLEGRO_DISPLAY_MODE { int width; int height; int format; int refresh_rate; } ALLEGRO_DISPLAY_MODE; AL_FUNC(int, al_get_num_display_modes, (void)); AL_FUNC(ALLEGRO_DISPLAY_MODE*, al_get_display_mode, (int index, ALLEGRO_DISPLAY_MODE *mode)); #ifdef __cplusplus } #endif #endif /* vim: set ts=8 sts=3 sw=3 et: */
/* Cubesat Space Protocol - A small network-layer protocol designed for Cubesats Copyright (C) 2012 Gomspace ApS (http://www.gomspace.com) Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* Inspired by c-pthread-queue by Matthew Dickinson http://code.google.com/p/c-pthread-queue/ */ #include <pthread.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <mach/clock.h> #include <mach/mach.h> /* CSP includes */ #include "pthread_queue.h" pthread_queue_t * pthread_queue_create(int length, size_t item_size) { pthread_queue_t * q = malloc(sizeof(pthread_queue_t)); if (q != NULL) { q->buffer = malloc(length*item_size); if (q->buffer != NULL) { q->size = length; q->item_size = item_size; q->items = 0; q->in = 0; q->out = 0; if (pthread_mutex_init(&(q->mutex), NULL) || pthread_cond_init(&(q->cond_full), NULL) || pthread_cond_init(&(q->cond_empty), NULL)) { free(q->buffer); free(q); q = NULL; } } else { free(q); q = NULL; } } return q; } void pthread_queue_delete(pthread_queue_t * q) { if (q == NULL) return; free(q->buffer); free(q); return; } int pthread_queue_enqueue(pthread_queue_t * queue, void * value, uint32_t timeout) { int ret; /* Calculate timeout */ struct timespec ts; clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); ts.tv_sec = mts.tv_sec; ts.tv_nsec = mts.tv_nsec; uint32_t sec = timeout / 1000; uint32_t nsec = (timeout - 1000 * sec) * 1000000; ts.tv_sec += sec; if (ts.tv_nsec + nsec > 1000000000) ts.tv_sec++; ts.tv_nsec = (ts.tv_nsec + nsec) % 1000000000; /* Get queue lock */ pthread_mutex_lock(&(queue->mutex)); while (queue->items == queue->size) { ret = pthread_cond_timedwait(&(queue->cond_full), &(queue->mutex), &ts); if (ret != 0) { pthread_mutex_unlock(&(queue->mutex)); return PTHREAD_QUEUE_FULL; } } /* Coby object from input buffer */ memcpy(queue->buffer+(queue->in * queue->item_size), value, queue->item_size); queue->items++; queue->in = (queue->in + 1) % queue->size; pthread_mutex_unlock(&(queue->mutex)); /* Nofify blocked threads */ pthread_cond_broadcast(&(queue->cond_empty)); return PTHREAD_QUEUE_OK; } int pthread_queue_dequeue(pthread_queue_t * queue, void * buf, uint32_t timeout) { int ret; /* Calculate timeout */ struct timespec ts; clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); ts.tv_sec = mts.tv_sec; ts.tv_nsec = mts.tv_nsec; uint32_t sec = timeout / 1000; uint32_t nsec = (timeout - 1000 * sec) * 1000000; ts.tv_sec += sec; if (ts.tv_nsec + nsec > 1000000000) ts.tv_sec++; ts.tv_nsec = (ts.tv_nsec + nsec) % 1000000000; /* Get queue lock */ pthread_mutex_lock(&(queue->mutex)); while (queue->items == 0) { ret = pthread_cond_timedwait(&(queue->cond_empty), &(queue->mutex), &ts); if (ret != 0) { pthread_mutex_unlock(&(queue->mutex)); return PTHREAD_QUEUE_EMPTY; } } /* Coby object to output buffer */ memcpy(buf, queue->buffer+(queue->out * queue->item_size), queue->item_size); queue->items--; queue->out = (queue->out + 1) % queue->size; pthread_mutex_unlock(&(queue->mutex)); /* Nofify blocked threads */ pthread_cond_broadcast(&(queue->cond_full)); return PTHREAD_QUEUE_OK; } int pthread_queue_items(pthread_queue_t * queue) { pthread_mutex_lock(&(queue->mutex)); int items = queue->items; pthread_mutex_unlock(&(queue->mutex)); return items; }
// @(#)root/cont:$Id$ // Author: Rene Brun 28/09/2001 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TProcessID #define ROOT_TProcessID ////////////////////////////////////////////////////////////////////////// // // // TProcessID // // // // Process Identifier object // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TNamed #include "TNamed.h" #endif #ifndef ROOT_TObjArray #include "TObjArray.h" #endif #include <atomic> #include <type_traits> class TExMap; namespace ROOT { namespace Internal { /** * \class ROOT::Internal::TAtomicPointer * \brief Helper class to manage atomic pointers. * \tparam T Pointer type to be made atomic * * Helper class to manage atomic pointers. The class enforces that the templated type * is a pointer. */ template <typename T> class TAtomicPointer { private: std::atomic<T> fAtomic; public: TAtomicPointer() : fAtomic(nullptr) { static_assert(std::is_pointer<T>::value, "Only pointer types supported"); } ~TAtomicPointer() { delete fAtomic.load(); } T operator->() const { return fAtomic; } operator T() const { return fAtomic; } T operator=(const T& t) { fAtomic = t; return t; } }; } // End of namespace Internal } // End of namespace ROOT class TProcessID : public TNamed { private: TProcessID(const TProcessID &ref); // TProcessID are not copiable. TProcessID& operator=(const TProcessID &ref); // TProcessID are not copiable. protected: std::atomic_int fCount; //!Reference count to this object (from TFile) ROOT::Internal::TAtomicPointer<TObjArray*> fObjects; //!Array pointing to the referenced objects std::atomic_flag fLock; //!Spin lock for initialization of fObjects static TProcessID *fgPID; //Pointer to current session ProcessID static TObjArray *fgPIDs; //Table of ProcessIDs static TExMap *fgObjPIDs; //Table pointer to pids static UInt_t fgNumber; //Referenced objects count public: TProcessID(); virtual ~TProcessID(); void CheckInit(); virtual void Clear(Option_t *option=""); Int_t DecrementCount(); Int_t IncrementCount(); Int_t GetCount() const {return fCount;} TObjArray *GetObjects() const {return fObjects;} TObject *GetObjectWithID(UInt_t uid); void PutObjectWithID(TObject *obj, UInt_t uid=0); virtual void RecursiveRemove(TObject *obj); static TProcessID *AddProcessID(); static UInt_t AssignID(TObject *obj); static void Cleanup(); static UInt_t GetNProcessIDs(); static TProcessID *GetPID(); static TObjArray *GetPIDs(); static TProcessID *GetProcessID(UShort_t pid); static TProcessID *GetProcessWithUID(const TObject *obj); static TProcessID *GetProcessWithUID(UInt_t uid,const void *obj); static TProcessID *GetSessionProcessID(); static UInt_t GetObjectCount(); static Bool_t IsValid(TProcessID *pid); static void SetObjectCount(UInt_t number); ClassDef(TProcessID,1) //Process Unique Identifier in time and space }; #endif
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef ADDBOUNDSVECTORSACTION_H #define ADDBOUNDSVECTORSACTION_H #include "Action.h" class AddBoundsVectorsAction; template <> InputParameters validParams<AddBoundsVectorsAction>(); class AddBoundsVectorsAction : public Action { public: AddBoundsVectorsAction(InputParameters params); virtual void act() override; }; #endif // ADDBOUNDSVECTORSACTION_H
/** @defgroup crc_file CRC @ingroup STM32F4xx @brief <b>libopencm3 STM32F4xx CRC</b> @version 1.0.0 @date 15 October 2012 LGPL License Terms @ref lgpl_license */ /* * This file is part of the libopencm3 project. * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. */ #include <libopencm3/stm32/crc.h> #include <libopencm3/stm32/common/crc_common_all.h>
/*------------------------------------------------------------------------------ * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team * * Distributable under the terms of either the Apache License (Version 2.0) or * the GNU Lesser General Public License, as specified in the COPYING file. ------------------------------------------------------------------------------*/ #ifndef _lucene_search_Scorer_ #define _lucene_search_Scorer_ CL_CLASS_DEF(search,Similarity) CL_CLASS_DEF(search,HitCollector) CL_CLASS_DEF(search,Explanation) CL_NS_DEF(search) /** * Expert: Common scoring functionality for different types of queries. * * <p> * A <code>Scorer</code> either iterates over documents matching a * query in increasing order of doc Id, or provides an explanation of * the score for a query for a given document. * </p> * <p> * Document scores are computed using a given <code>Similarity</code> * implementation. * </p> * @see BooleanQuery#setAllowDocsOutOfOrder */ class CLUCENE_EXPORT Scorer { private: Similarity* similarity; protected: /** Constructs a Scorer. * @param similarity The <code>Similarity</code> implementation used by this scorer. */ Scorer(Similarity* _similarity); public: virtual ~Scorer(); /** Returns the Similarity implementation used by this scorer. */ Similarity* getSimilarity() const; /** Scores and collects all matching documents. * @param hc The collector to which all matching documents are passed through * {@link HitCollector#collect(int, float)}. * <br>When this method is used the {@link #explain(int)} method should not be used. */ virtual void score(HitCollector* hc) ; /** Expert: Collects matching documents in a range. Hook for optimization. * Note that {@link #next()} must be called once before this method is called * for the first time. * @param hc The collector to which all matching documents are passed through * {@link HitCollector#collect(int, float)}. * @param max Do not score documents past this. * @return true if more matching documents may remain. */ virtual bool score( HitCollector* results, const int32_t maxDoc ); /** * Advances to the document matching this Scorer with the lowest doc Id * greater than the current value of {@link #doc()} (or to the matching * document with the lowest doc Id if next has never been called on * this Scorer). * * <p> * When this method is used the {@link #explain(int)} method should not * be used. * </p> * * @return true iff there is another document matching the query. * @see BooleanQuery#setAllowDocsOutOfOrder */ virtual bool next() = 0; /** Returns the current document number matching the query. * Initially invalid, until {@link #next()} is called the first time. */ virtual int32_t doc() const = 0; /** Returns the score of the current document matching the query. * Initially invalid, until {@link #next()} or {@link #skipTo(int)} * is called the first time. */ virtual float_t score() = 0; /** * Skips to the document matching this Scorer with the lowest doc Id * greater than or equal to a given target. * * <p> * The behavior of this method is undefined if the target specified is * less than or equal to the current value of {@link #doc()}. * <p> * Behaves as if written: * <pre> * boolean skipTo(int target) { * do { * if (!next()) * return false; * } while (target > doc()); * return true; * } * </pre> * Most implementations are considerably more efficient than that. * </p> * * <p> * When this method is used the {@link #explain(int)} method should not * be used. * </p> * * @param target The target document number. * @return true iff there is such a match. * @see BooleanQuery#setAllowDocsOutOfOrder */ virtual bool skipTo(int32_t target) = 0; /** Returns an explanation of the score for a document. * <br>When this method is used, the {@link #next()}, {@link #skipTo(int)} and * {@link #score(HitCollector)} methods should not be used. * @param doc The document number for the explanation. */ virtual Explanation* explain(int32_t doc) = 0; /** Returns a string which explains the object */ virtual TCHAR* toString() = 0; static bool sort(const Scorer* elem1, const Scorer* elem2); }; CL_NS_END #endif
/* $Xorg: XrmI.h,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Macros to abstract out reading the file, and getting its size. * * You may need to redefine these for various other operating systems. */ #include <X11/Xos.h> #include <sys/stat.h> #define GetSizeOfFile(fd,size) \ { \ struct stat status_buffer; \ if ( (fstat((fd), &status_buffer)) == -1 ) \ size = -1; \ else \ size = status_buffer.st_size; \ }
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #pragma once #include <string> #include "db/table_properties_collector.h" #include "rocksdb/types.h" #include "util/coding.h" #include "util/string_util.h" namespace ROCKSDB_NAMESPACE { // Table Properties that are specific to tables created by SstFileWriter. struct ExternalSstFilePropertyNames { // value of this property is a fixed uint32 number. static const std::string kVersion; // value of this property is a fixed uint64 number. static const std::string kGlobalSeqno; }; // PropertiesCollector used to add properties specific to tables // generated by SstFileWriter class SstFileWriterPropertiesCollector : public IntTblPropCollector { public: explicit SstFileWriterPropertiesCollector(int32_t version, SequenceNumber global_seqno) : version_(version), global_seqno_(global_seqno) {} virtual Status InternalAdd(const Slice& /*key*/, const Slice& /*value*/, uint64_t /*file_size*/) override { // Intentionally left blank. Have no interest in collecting stats for // individual key/value pairs. return Status::OK(); } virtual void BlockAdd(uint64_t /* block_raw_bytes */, uint64_t /* block_compressed_bytes_fast */, uint64_t /* block_compressed_bytes_slow */) override { // Intentionally left blank. No interest in collecting stats for // blocks. return; } virtual Status Finish(UserCollectedProperties* properties) override { // File version std::string version_val; PutFixed32(&version_val, static_cast<uint32_t>(version_)); properties->insert({ExternalSstFilePropertyNames::kVersion, version_val}); // Global Sequence number std::string seqno_val; PutFixed64(&seqno_val, static_cast<uint64_t>(global_seqno_)); properties->insert({ExternalSstFilePropertyNames::kGlobalSeqno, seqno_val}); return Status::OK(); } virtual const char* Name() const override { return "SstFileWriterPropertiesCollector"; } virtual UserCollectedProperties GetReadableProperties() const override { return {{ExternalSstFilePropertyNames::kVersion, ToString(version_)}}; } private: int32_t version_; SequenceNumber global_seqno_; }; class SstFileWriterPropertiesCollectorFactory : public IntTblPropCollectorFactory { public: explicit SstFileWriterPropertiesCollectorFactory(int32_t version, SequenceNumber global_seqno) : version_(version), global_seqno_(global_seqno) {} virtual IntTblPropCollector* CreateIntTblPropCollector( uint32_t /*column_family_id*/, int /* level_at_creation */) override { return new SstFileWriterPropertiesCollector(version_, global_seqno_); } virtual const char* Name() const override { return "SstFileWriterPropertiesCollector"; } private: int32_t version_; SequenceNumber global_seqno_; }; } // namespace ROCKSDB_NAMESPACE
// Copyright 2014 CoreOS, 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. /* just enough ELF support for finding the interpreter in the program header * table, this should theoretically work as-is on both big-endian and * little-endian */ /* values of interest */ #define ELF_BITS_32 0x1 #define ELF_BITS_64 0x2 #define ELF_ENDIAN_LITL 0x1 #define ELF_ENDIAN_BIG 0x2 #define ELF_PT_INTERP 0x3 /* offsets of interest */ #define ELF_BITS 0x4 #define ELF_ENDIAN 0x5 #define ELF_VERSION 0x6 #define ELF32_PHT_OFF 0x1c #define ELF32_PHTE_SIZE 0x2a #define ELF32_PHTE_CNT 0x2c #define ELF32_PHE_OFF 0x4 #define ELF32_PHE_SIZE 0x10 #define ELF64_PHT_OFF 0x20 #define ELF64_PHTE_SIZE 0x36 #define ELF64_PHTE_CNT 0x38 #define ELF64_PHE_OFF 0x8 #define ELF64_PHE_SIZE 0x20 /* multibyte value accessors, choose which based on ELF_BITS and ELF_ENDIAN */ #define SHIFT(_val, _bytes) ((unsigned long long)(_val) << ((_bytes) * 8)) static uint64_t le32_lget(const uint8_t *addr) { uint64_t val = 0; val += SHIFT(addr[3], 3); val += SHIFT(addr[2], 2); val += SHIFT(addr[1], 1); val += SHIFT(addr[0], 0); return val; } static uint64_t be32_lget(const uint8_t *addr) { uint64_t val = 0; val += SHIFT(addr[0], 3); val += SHIFT(addr[1], 2); val += SHIFT(addr[2], 1); val += SHIFT(addr[3], 0); return val; } static uint64_t le64_lget(const uint8_t *addr) { uint64_t val = 0; val += SHIFT(addr[7], 7); val += SHIFT(addr[6], 6); val += SHIFT(addr[5], 5); val += SHIFT(addr[4], 4); val += SHIFT(addr[3], 3); val += SHIFT(addr[2], 2); val += SHIFT(addr[1], 1); val += SHIFT(addr[0], 0); return val; } static uint64_t be64_lget(const uint8_t *addr) { uint64_t val = 0; val += SHIFT(addr[0], 7); val += SHIFT(addr[1], 6); val += SHIFT(addr[2], 5); val += SHIFT(addr[3], 4); val += SHIFT(addr[4], 3); val += SHIFT(addr[5], 2); val += SHIFT(addr[6], 1); val += SHIFT(addr[7], 0); return val; } static uint32_t le_iget(const uint8_t *addr) { return (uint32_t)le32_lget(addr); } static uint32_t be_iget(const uint8_t *addr) { return (uint32_t)be32_lget(addr); } static uint16_t le_sget(const uint8_t *addr) { uint16_t val = 0; val += SHIFT(addr[1], 1); val += SHIFT(addr[0], 0); return val; } static uint16_t be_sget(const uint8_t *addr) { uint16_t val = 0; val += SHIFT(addr[0], 0); val += SHIFT(addr[1], 1); return val; }
/*++ Copyright (c) 2004, 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. Module Name: EfiShell.c Abstract: FFS Filename for EFI Shell --*/ #include "Tiano.h" #include EFI_GUID_DEFINITION (EfiShell) EFI_GUID gEfiShellFileGuid = EFI_SHELL_FILE_GUID; EFI_GUID gEfiMiniShellFileGuid = EFI_MINI_SHELL_FILE_GUID; EFI_GUID_STRING (&gEfiShellFileGuid, "EfiShell", "Efi Shell FFS file name GUID") EFI_GUID_STRING (&gEfiMiniShellFileGuid, "EfiMiniShell", "Efi Mini-Shell FFS file name GUID")
/* * Copyright (c) 2013 Intel Corporation * * 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 _VMEXIT_MSR_H_ #define _VMEXIT_MSR_H_ #include "list.h" // return TRUE if instruction was executed, FAULSE in case of exception typedef BOOLEAN (*MSR_ACCESS_HANDLER)(GUEST_CPU_HANDLE gcpu, MSR_ID msr_id, UINT64 *p_value, void *context); typedef struct _MSR_VMEXIT_CONTROL { UINT8 *msr_bitmap; LIST_ELEMENT msr_list[1]; } MSR_VMEXIT_CONTROL; // FUNCTION : msr_vmexit_on_all() // PURPOSE : Turns VMEXIT on all ON/OFF // ARGUMENTS: GUEST_CPU_HANDLE gcpu // : BOOLEAN enable // RETURNS : none, must succeed. void msr_vmexit_on_all(GUEST_CPU_HANDLE gcpu, BOOLEAN enable) ; // FUNCTION : msr_vmexit_guest_setup() // PURPOSE : Allocates structures for MSR virtualization // : Must be called prior any other function from the package on this gcpu, // : but after gcpu VMCS was loaded // ARGUMENTS: GUEST_HANDLE guest // RETURNS : none, must succeed. void msr_vmexit_guest_setup(GUEST_HANDLE guest); // FUNCTION : msr_vmexit_activate() // PURPOSE : Register MSR related structures with HW (VMCS) // ARGUMENTS: GUEST_CPU_HANDLE gcpu // RETURNS : none, must succeed. void msr_vmexit_activate(GUEST_CPU_HANDLE gcpu); // FUNCTION : msr_vmexit_handler_register() // PURPOSE : Register specific MSR handler with VMEXIT // ARGUMENTS: GUEST_HANDLE guest // : MSR_ID msr_id // : MSR_ACCESS_HANDLER msr_handler, // : RW_ACCESS access // : void *context // RETURNS : VMM_OK if succeeded VMM_STATUS msr_vmexit_handler_register( GUEST_HANDLE guest, MSR_ID msr_id, MSR_ACCESS_HANDLER msr_handler, RW_ACCESS access, void *context); // FUNCTION : msr_vmexit_handler_unregister() // PURPOSE : Unregister specific MSR VMEXIT handler // ARGUMENTS: GUEST_HANDLE guest // : MSR_ID msr_id // RETURNS : VMM_OK if succeeded VMM_STATUS msr_vmexit_handler_unregister( GUEST_HANDLE guest, MSR_ID msr_id, RW_ACCESS access); // FUNCTION : msr_guest_access_inhibit() // PURPOSE : Install handler which prevents access to MSR from the guest space // ARGUMENTS: GUEST_HANDLE guest // : MSR_ID msr_id // RETURNS : VMM_OK if succeeded VMM_STATUS msr_guest_access_inhibit( GUEST_HANDLE guest, MSR_ID msr_id); // FUNCTION : msr_trial_access() // PURPOSE : Try to execute real MSR read/write // : If exception was generated, inject it into guest // ARGUMENTS: GUEST_CPU_HANDLE gcpu // : MSR_ID msr_id // : RW_ACCESS access // RETURNS : TRUE if instruction was executed, FALSE otherwise (fault occured) BOOLEAN msr_trial_access( GUEST_CPU_HANDLE gcpu, MSR_ID msr_id, RW_ACCESS access, UINT64 *msr_value); // FUNCTION : vmexit_enable_disable_for_msr_in_exclude_list() // PURPOSE : enable/disable msr read/write vmexit for msrs in the exclude list // ARGUMENTS: GUEST_CPU_HANDLE gcpu // : MSR_ID msr_id // : RW_ACCESS access // : BOOLEAN TRUE to enable write/read vmexit, FALSE to disable vmexit // RETURNS : TRUE if parameters are correct. BOOLEAN vmexit_register_unregister_for_efer( GUEST_HANDLE guest, MSR_ID msr_id, RW_ACCESS access, BOOLEAN reg_dereg); #endif // _VMEXIT_MSR_H_
// // Licensed to Green Energy Corp (www.greenenergycorp.com) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Green Enery Corp licenses this file // to you 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 __TYPES_H_ #define __TYPES_H_ #include <boost/cstdint.hpp> namespace apl { #ifndef SIZE_MAX #define SIZE_MAX ~0 #endif typedef boost::int64_t millis_t; #ifdef _DEBUG //#define STRONGLY_TYPED_TIMESTAMPS #endif #ifdef STRONGLY_TYPED_TIMESTAMPS class TimeStamp_t_Explicit { millis_t value; public: explicit TimeStamp_t_Explicit(millis_t aT): value(aT) {} operator millis_t () const { return value; } }; class UTCTimeStamp_t_Explicit { millis_t value; public: explicit UTCTimeStamp_t_Explicit(millis_t aT): value(aT) {} operator millis_t () const { return value; } }; //this is some c++ trickery to make sure that we get strong //typesaftey on the 2 different types of timestamp typedef TimeStamp_t_Explicit TimeStamp_t; typedef UTCTimeStamp_t_Explicit UTCTimeStamp_t; #else //if we are not using the strong typing it should be faster //since the values are all simple 64bit value types rather than //overloaded classes. typedef millis_t TimeStamp_t; typedef millis_t UTCTimeStamp_t; #endif } //end namespace #endif
/* $NetBSD: citrus_gbk2k.h,v 1.2 2003/06/25 09:51:43 tshiozak Exp $ */ /*- * Copyright (c)2003 Citrus Project, * 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. */ #ifndef _CITRUS_GBK2K_H_ #define _CITRUS_GBK2K_H_ __BEGIN_DECLS _CITRUS_CTYPE_GETOPS_FUNC(GBK2K); _CITRUS_STDENC_GETOPS_FUNC(GBK2K); __END_DECLS #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 UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ #define UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ #include "base/containers/flat_set.h" #include "base/time/time.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/viz/common/surfaces/frame_sink_id.h" #include "ui/compositor/compositor_export.h" namespace gfx { class Size; struct PresentationFeedback; } // namespace gfx namespace ui { class Compositor; // A compositor observer is notified when compositing completes. class COMPOSITOR_EXPORT CompositorObserver { public: virtual ~CompositorObserver() = default; // A commit proxies information from the main thread to the compositor // thread. It typically happens when some state changes that will require a // composite. In the multi-threaded case, many commits may happen between // two successive composites. In the single-threaded, a single commit // between two composites (just before the composite as part of the // composite cycle). If the compositor is locked, it will not send this // this signal. virtual void OnCompositingDidCommit(Compositor* compositor) {} // Called when compositing started: it has taken all the layer changes into // account and has issued the graphics commands. virtual void OnCompositingStarted(Compositor* compositor, base::TimeTicks start_time) {} // Called when compositing completes: the present to screen has completed. virtual void OnCompositingEnded(Compositor* compositor) {} // Called when a child of the compositor is resizing. virtual void OnCompositingChildResizing(Compositor* compositor) {} // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) // Called when a swap with new size is completed. virtual void OnCompositingCompleteSwapWithNewSize(ui::Compositor* compositor, const gfx::Size& size) {} #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // Called at the top of the compositor's destructor, to give observers a // chance to remove themselves. virtual void OnCompositingShuttingDown(Compositor* compositor) {} // Called when the presentation feedback was received from the viz. virtual void OnDidPresentCompositorFrame( uint32_t frame_token, const gfx::PresentationFeedback& feedback) {} virtual void OnFirstAnimationStarted(Compositor* compositor) {} virtual void OnLastAnimationEnded(Compositor* compositor) {} virtual void OnFrameSinksToThrottleUpdated( const base::flat_set<viz::FrameSinkId>& ids) {} }; } // namespace ui #endif // UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/views/controls/menu/menu_item_view.h" namespace views { class MenuButton; class Widget; namespace internal { class DisplayChangeListener; class MenuRunnerImpl; } // MenuRunner is responsible for showing (running) the menu and additionally // owning the MenuItemView. RunMenuAt() runs a nested message loop. It is safe // to delete MenuRunner at any point, but MenuRunner internally only deletes the // MenuItemView *after* the nested message loop completes. If MenuRunner is // deleted while the menu is showing the delegate of the menu is reset. This is // done to ensure delegates aren't notified after they may have been deleted. // // NOTE: while you can delete a MenuRunner at any point, the nested message loop // won't return immediately. This means if you delete the object that owns // the MenuRunner while the menu is running, your object is effectively still // on the stack. A return value of MENU_DELETED indicated this. In most cases // if RunMenuAt() returns MENU_DELETED, you should return immediately. // // Similarly you should avoid creating MenuRunner on the stack. Doing so means // MenuRunner may not be immediately destroyed if your object is destroyed, // resulting in possible callbacks to your now deleted object. Instead you // should define MenuRunner as a scoped_ptr in your class so that when your // object is destroyed MenuRunner initiates the proper cleanup and ensures your // object isn't accessed again. class VIEWS_EXPORT MenuRunner { public: enum RunTypes { // The menu has mnemonics. HAS_MNEMONICS = 1 << 0, // The menu is a nested context menu. For example, click a folder on the // bookmark bar, then right click an entry to get its context menu. IS_NESTED = 1 << 1, // Used for showing a menu during a drop operation. This does NOT block the // caller, instead the delegate is notified when the menu closes via the // DropMenuClosed method. FOR_DROP = 1 << 2, // The menu is a context menu (not necessarily nested), for example right // click on a link on a website in the browser. CONTEXT_MENU = 1 << 3, }; enum RunResult { // Indicates RunMenuAt is returning because the MenuRunner was deleted. MENU_DELETED, // Indicates RunMenuAt returned and MenuRunner was not deleted. NORMAL_EXIT }; // Creates a new MenuRunner. MenuRunner owns the supplied menu. explicit MenuRunner(MenuItemView* menu); ~MenuRunner(); // Returns the menu. MenuItemView* GetMenu(); // Takes ownership of |menu|, deleting it when MenuRunner is deleted. You // only need call this if you create additional menus from // MenuDelegate::GetSiblingMenu. void OwnMenu(MenuItemView* menu); // Runs the menu. |types| is a bitmask of RunTypes. If this returns // MENU_DELETED the method is returning because the MenuRunner was deleted. // Typically callers should NOT do any processing if this returns // MENU_DELETED. RunResult RunMenuAt(Widget* parent, MenuButton* button, const gfx::Rect& bounds, MenuItemView::AnchorPosition anchor, int32 types) WARN_UNUSED_RESULT; // Returns true if we're in a nested message loop running the menu. bool IsRunning() const; // Hides and cancels the menu. This does nothing if the menu is not open. void Cancel(); private: internal::MenuRunnerImpl* holder_; scoped_ptr<internal::DisplayChangeListener> display_change_listener_; DISALLOW_COPY_AND_ASSIGN(MenuRunner); }; namespace internal { // DisplayChangeListener is intended to listen for changes in the display size // and cancel the menu. DisplayChangeListener is created when the menu is // shown. class DisplayChangeListener { public: virtual ~DisplayChangeListener() {} // Creates the platform specified DisplayChangeListener, or NULL if there // isn't one. Caller owns the returned value. static DisplayChangeListener* Create(Widget* parent, MenuRunner* runner); protected: DisplayChangeListener() {} }; } } // namespace views #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
// Copyright 2022 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_ROW_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_ROW_VIEW_H_ #include "base/memory/weak_ptr.h" #include "base/task/cancelable_task_tracker.h" #include "chrome/browser/download/download_ui_model.h" #include "chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace views { class ImageView; } // namespace views class DownloadBubbleRowView : public views::View { public: METADATA_HEADER(DownloadBubbleRowView); explicit DownloadBubbleRowView(DownloadUIModel::DownloadUIModelPtr model); DownloadBubbleRowView(const DownloadBubbleRowView&) = delete; DownloadBubbleRowView& operator=(const DownloadBubbleRowView&) = delete; ~DownloadBubbleRowView() override; // Overrides views::View: void AddedToWidget() override; protected: // Overrides ui::LayerDelegate: void OnDeviceScaleFactorChanged(float old_device_scale_factor, float new_device_scale_factor) override; private: // Load the icon, from the cache or from IconManager::LoadIcon. void LoadIcon(); // Called when icon has been loaded by IconManager::LoadIcon. void SetIcon(gfx::Image icon); // TODO(bhatiarohit): Add platform-independent icons. // The icon for the file. We get platform-specific icons from IconLoader. raw_ptr<views::ImageView> icon_ = nullptr; // Device scale factor, used to load icons. float current_scale_ = 1.0f; // Tracks tasks requesting file icons. base::CancelableTaskTracker cancelable_task_tracker_; // The model controlling this object's state. const DownloadUIModel::DownloadUIModelPtr model_; base::WeakPtrFactory<DownloadBubbleRowView> weak_factory_{this}; }; #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_ROW_VIEW_H_
#include "../../src/gui/embedded/qmouselinuxtp_qws.h"
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** // WindowsDataXmlXsl.h // Generated from winmd2objc #pragma once #include <UWP/interopBase.h> @class WDXXXsltProcessor; @protocol WDXXIXsltProcessor , WDXXIXsltProcessor2, WDXXIXsltProcessorFactory; #include "WindowsDataXmlDom.h" #import <Foundation/Foundation.h> // Windows.Data.Xml.Xsl.XsltProcessor #ifndef __WDXXXsltProcessor_DEFINED__ #define __WDXXXsltProcessor_DEFINED__ WINRT_EXPORT @interface WDXXXsltProcessor : RTObject + (WDXXXsltProcessor*)makeInstance:(WDXDXmlDocument*)document ACTIVATOR; - (NSString*)transformToString:(RTObject<WDXDIXmlNode>*)inputNode; - (WDXDXmlDocument*)transformToDocument:(RTObject<WDXDIXmlNode>*)inputNode; @end #endif // __WDXXXsltProcessor_DEFINED__
// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once #include <cstddef> #include <cstring> #include <functional> #define CRYPTO_MAKE_COMPARABLE(type) \ namespace Crypto { \ inline bool operator==(const type &_v1, const type &_v2) { \ return std::memcmp(&_v1, &_v2, sizeof(type)) == 0; \ } \ inline bool operator!=(const type &_v1, const type &_v2) { \ return std::memcmp(&_v1, &_v2, sizeof(type)) != 0; \ } \ } #define CRYPTO_MAKE_HASHABLE(type) \ CRYPTO_MAKE_COMPARABLE(type) \ namespace Crypto { \ static_assert(sizeof(size_t) <= sizeof(type), "Size of " #type " must be at least that of size_t"); \ inline size_t hash_value(const type &_v) { \ return reinterpret_cast<const size_t &>(_v); \ } \ } \ namespace std { \ template<> \ struct hash<Crypto::type> { \ size_t operator()(const Crypto::type &_v) const { \ return reinterpret_cast<const size_t &>(_v); \ } \ }; \ }
// // CCHDevice.h // ContextHub // // Created by Kevin Lee on 7/24/14. // Copyright (c) 2014 ChaiOne. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #define kDeviceErrorDomain @"com.contexthub.device.error" /** ContextHub Device error codes. */ typedef NS_ENUM(NSInteger, CCHDeviceErrorCode) { /** Device id cannot be nil */ CCHInvalidDeviceIdParameter, /** Alias cannot be nil */ CCHInvalidDeviceAliasParameter, /** Tags cannot be nil */ CCHInvalidDeviceTagsParameter }; /** The CCHDevice class is used work with devices. Structure of device NSDictionary | key | value | | --------- | --------- | | additional_info | NSDictionary of device specific information (not always present) | | alias | alias that is set for the device (not always present) | | device_type | describes the device, often pulled for the user agent | | id | database id for the device | | last_profile | NSDictionary of contextual information from the last time the device was seen by the server | | push_token | push token assigned to the device (not always present) | | tag_string | a comma separated string of the tags associated with the device | | tags | NSArray of tags associated with the device | */ @interface CCHDevice : NSObject /** @return The singleton instance of CCHDevice. */ + (instancetype)sharedInstance; /** @return The vendor device id as UUIDString. */ - (NSString *)deviceId; /** Gets a device from ContextHub using the device Id. @param deviceId The id of the device stored in ContextHub. @param completionHandler Called when the request completes. The block is passed an NSDictionary object that represents the device. If an error occurs, the NSError will be passed to the block. */ - (void)getDeviceWithId:(NSString *)deviceId completionHandler:(void(^)(NSDictionary *device, NSError *error))completionHandler; /** Gets devices from ContextHub using the device alias. @param alias The alias associated with the devices that you are interested in. @param completionHandler Called when the request completes. The block is passed an NSArray of NSDictionary objects that represent the devices. If an error occurs, the NSError will be passed to the block. */ - (void)getDevicesWithAlias:(NSString *)alias completionHandler:(void(^)(NSArray *devices, NSError *error))completionHandler; /** Gets devices from ContextHub using tags. @param tags Tags of the devices that you are interested in. @param completionHandler Called when the request completes. The block is passed an NSArray of NSDictionary objects that represent the devices. If an error occurs, the NSError will be passed to the block. */ - (void)getDevicesWithTags:(NSArray *)tags completionHandler:(void(^)(NSArray *devices, NSError *error))completionHandler; /** Updates the device record on contexthub. @param alias (optional) The alias associated with the device. @param tags (optional) The tags to be applied to the device. @param completionHandler Called when the request completes. The block is passed an NSDictionary object that represents the device. If an error occurs, the NSError will be passed to the block. @note This method updates the data for the current device. The tags and alias that are set here can be used with CCHPush. The tags can also be used with the CCHSubscriptionService. This method gathers meta-data about the device and sends it to ContextHub along with the alias and tags. You can call this method multiple times. */ - (void)setDeviceAlias:(NSString *)alias tags:(NSArray *)tags completionHandler:(void(^)(NSDictionary *device, NSError *error))completionHandler; @end
/* Copyright (c) 2016 Google 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. */ // // GTLDriveReply.h // // ---------------------------------------------------------------------------- // NOTE: This file is generated from Google APIs Discovery Service. // Service: // Drive API (drive/v3) // Description: // Manages files in Drive including uploading, downloading, searching, // detecting changes, and updating sharing permissions. // Documentation: // https://developers.google.com/drive/ // Classes: // GTLDriveReply (0 custom class methods, 9 custom properties) #if GTL_BUILT_AS_FRAMEWORK #import "GTL/GTLObject.h" #else #import "GTLObject.h" #endif @class GTLDriveUser; // ---------------------------------------------------------------------------- // // GTLDriveReply // // A reply to a comment on a file. @interface GTLDriveReply : GTLObject // The action the reply performed to the parent comment. Valid values are: // - resolve // - reopen @property (nonatomic, copy) NSString *action; // The user who created the reply. @property (nonatomic, retain) GTLDriveUser *author; // The plain text content of the reply. This field is used for setting the // content, while htmlContent should be displayed. This is required on creates // if no action is specified. @property (nonatomic, copy) NSString *content; // The time at which the reply was created (RFC 3339 date-time). @property (nonatomic, retain) GTLDateTime *createdTime; // Whether the reply has been deleted. A deleted reply has no content. @property (nonatomic, retain) NSNumber *deleted; // boolValue // The content of the reply with HTML formatting. @property (nonatomic, copy) NSString *htmlContent; // The ID of the reply. // identifier property maps to 'id' in JSON (to avoid Objective C's 'id'). @property (nonatomic, copy) NSString *identifier; // This is always drive#reply. @property (nonatomic, copy) NSString *kind; // The last time the reply was modified (RFC 3339 date-time). @property (nonatomic, retain) GTLDateTime *modifiedTime; @end
// // JDFAppDelegate.h // JDFPeekaboo // // Created by CocoaPods on 02/01/2015. // Copyright (c) 2014 Joe Fryer. All rights reserved. // #import <UIKit/UIKit.h> @interface JDFAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "example.h"
#pragma once // Do³¹czenie nag³ówka SDKDDKVer.h definiuje najwy¿sz¹ dostêpn¹ platformê systemu Windows. // Jeœli chcesz skompilowaæ aplikacjê dla wczeœniejszej platformy systemu Windows, do³¹cz nag³ówek WinSDKVer.h i // ustaw makro _WIN32_WINNT na platformê, któr¹ chcesz wspieraæ, przed do³¹czeniem nag³ówka SDKDDKVer.h. #include <SDKDDKVer.h>
/* arch/arm/mach-msm/include/mach/vmalloc.h * * Copyright (C) 2007 Google, Inc. * Copyright (c) 2009, Code Aurora Forum. All rights reserved. * * 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. * */ #ifndef __ASM_ARCH_MSM_VMALLOC_H #define __ASM_ARCH_MSM_VMALLOC_H #ifdef CONFIG_VMSPLIT_2G #define VMALLOC_END (PAGE_OFFSET + 0x7A000000) #else #if defined (CONFIG_LGE_4G_DDR) /* 2010-06-29 [junyeong.han@lge.com] Support 512MB SDRAM */ /* To support 512MB SDRAM in VMSPLIT_3G */ #define VMALLOC_END (PAGE_OFFSET + 0x3A000000) #else /* original */ #define VMALLOC_END (PAGE_OFFSET + 0x20000000) #endif #endif #endif
/* * This file contains the RTC driver table for Motorola MCF5206eLITE * ColdFire evaluation board. * * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia * Author: Victor V. Vengerov <vvv@oktet.ru> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * * http://www.rtems.com/license/LICENSE. */ #include <bsp.h> #include <libchip/rtc.h> #include <ds1307.h> /* Forward function declaration */ bool mcf5206elite_ds1307_probe(int minor); extern rtc_fns ds1307_fns; /* The following table configures the RTC drivers used in this BSP */ rtc_tbl RTC_Table[] = { { "/dev/rtc", /* sDeviceName */ RTC_CUSTOM, /* deviceType */ &ds1307_fns, /* pDeviceFns */ mcf5206elite_ds1307_probe, /* deviceProbe */ NULL, /* pDeviceParams */ 0x00, /* ulCtrlPort1, for DS1307-I2C bus number */ DS1307_I2C_ADDRESS, /* ulDataPort, for DS1307-I2C device addr */ NULL, /* getRegister - not applicable to DS1307 */ NULL /* setRegister - not applicable to DS1307 */ } }; /* Some information used by the RTC driver */ #define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl)) size_t RTC_Count = NUM_RTCS; rtems_device_minor_number RTC_Minor; /* mcf5206elite_ds1307_probe -- * RTC presence probe function. Return TRUE, if device is present. * Device presence checked by probe access to RTC device over I2C bus. * * PARAMETERS: * minor - minor RTC device number * * RETURNS: * TRUE, if RTC device is present */ bool mcf5206elite_ds1307_probe(int minor) { int try = 0; i2c_message_status status; rtc_tbl *rtc; i2c_bus_number bus; i2c_address addr; if (minor >= NUM_RTCS) return false; rtc = RTC_Table + minor; bus = rtc->ulCtrlPort1; addr = rtc->ulDataPort; do { status = i2c_wrbyte(bus, addr, 0); if (status == I2C_NO_DEVICE) return false; try++; } while ((try < 15) && (status != I2C_SUCCESSFUL)); if (status == I2C_SUCCESSFUL) return true; else return false; }
/* The IGEN simulator generator for GDB, the GNU Debugger. Copyright 2002 Free Software Foundation, Inc. Contributed by Andrew Cagney. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern void gen_model_h (lf *file, insn_table *isa); extern void gen_model_c (lf *file, insn_table *isa);
/* * Copyright (C) 2009 Apple 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: * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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. */ #if TARGET_OS_IPHONE #import <CoreGraphics/CoreGraphics.h> #import <Foundation/Foundation.h> #import <WebKitLegacy/WebFrameIOS.h> @interface WebSelectionRect : NSObject <NSCopying> { CGRect m_rect; WKWritingDirection m_writingDirection; BOOL m_isLineBreak; BOOL m_isFirstOnLine; BOOL m_isLastOnLine; BOOL m_containsStart; BOOL m_containsEnd; BOOL m_isInFixedPosition; BOOL m_isHorizontal; } @property (nonatomic, assign) CGRect rect; @property (nonatomic, assign) WKWritingDirection writingDirection; @property (nonatomic, assign) BOOL isLineBreak; @property (nonatomic, assign) BOOL isFirstOnLine; @property (nonatomic, assign) BOOL isLastOnLine; @property (nonatomic, assign) BOOL containsStart; @property (nonatomic, assign) BOOL containsEnd; @property (nonatomic, assign) BOOL isInFixedPosition; @property (nonatomic, assign) BOOL isHorizontal; + (WebSelectionRect *)selectionRect; + (CGRect)startEdge:(NSArray *)rects; + (CGRect)endEdge:(NSArray *)rects; @end #endif // TARGET_OS_IPHONE
/* * SPU file system -- SPU context management * * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 * * Author: Arnd Bergmann <arndb@de.ibm.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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/fs.h> #include <linux/mm.h> #include <linux/slab.h> #include <asm/spu.h> #include <asm/spu_csa.h> #include "spufs.h" struct spu_context *alloc_spu_context(void) { struct spu_context *ctx; ctx = kzalloc(sizeof *ctx, GFP_KERNEL); if (!ctx) goto out; /* Binding to physical processor deferred * until spu_activate(). */ spu_init_csa(&ctx->csa); if (!ctx->csa.lscsa) { goto out_free; } spin_lock_init(&ctx->mmio_lock); kref_init(&ctx->kref); init_rwsem(&ctx->state_sema); init_MUTEX(&ctx->run_sema); init_waitqueue_head(&ctx->ibox_wq); init_waitqueue_head(&ctx->wbox_wq); init_waitqueue_head(&ctx->stop_wq); init_waitqueue_head(&ctx->mfc_wq); ctx->state = SPU_STATE_SAVED; ctx->ops = &spu_backing_ops; ctx->owner = get_task_mm(current); goto out; out_free: kfree(ctx); ctx = NULL; out: return ctx; } void destroy_spu_context(struct kref *kref) { struct spu_context *ctx; ctx = container_of(kref, struct spu_context, kref); down_write(&ctx->state_sema); spu_deactivate(ctx); up_write(&ctx->state_sema); spu_fini_csa(&ctx->csa); kfree(ctx); } struct spu_context * get_spu_context(struct spu_context *ctx) { kref_get(&ctx->kref); return ctx; } int put_spu_context(struct spu_context *ctx) { return kref_put(&ctx->kref, &destroy_spu_context); } /* give up the mm reference when the context is about to be destroyed */ void spu_forget(struct spu_context *ctx) { struct mm_struct *mm; spu_acquire_saved(ctx); mm = ctx->owner; ctx->owner = NULL; mmput(mm); spu_release(ctx); } void spu_acquire(struct spu_context *ctx) { down_read(&ctx->state_sema); } void spu_release(struct spu_context *ctx) { up_read(&ctx->state_sema); } void spu_unmap_mappings(struct spu_context *ctx) { if (ctx->local_store) unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); if (ctx->mfc) unmap_mapping_range(ctx->mfc, 0, 0x4000, 1); if (ctx->cntl) unmap_mapping_range(ctx->cntl, 0, 0x4000, 1); if (ctx->signal1) unmap_mapping_range(ctx->signal1, 0, 0x4000, 1); if (ctx->signal2) unmap_mapping_range(ctx->signal2, 0, 0x4000, 1); } int spu_acquire_runnable(struct spu_context *ctx) { int ret = 0; down_read(&ctx->state_sema); if (ctx->state == SPU_STATE_RUNNABLE) { ctx->spu->prio = current->prio; return 0; } up_read(&ctx->state_sema); down_write(&ctx->state_sema); /* ctx is about to be freed, can't acquire any more */ if (!ctx->owner) { ret = -EINVAL; goto out; } if (ctx->state == SPU_STATE_SAVED) { ret = spu_activate(ctx, 0); if (ret) goto out; ctx->state = SPU_STATE_RUNNABLE; } downgrade_write(&ctx->state_sema); /* On success, we return holding the lock */ return ret; out: /* Release here, to simplify calling code. */ up_write(&ctx->state_sema); return ret; } void spu_acquire_saved(struct spu_context *ctx) { down_read(&ctx->state_sema); if (ctx->state == SPU_STATE_SAVED) return; up_read(&ctx->state_sema); down_write(&ctx->state_sema); if (ctx->state == SPU_STATE_RUNNABLE) { spu_deactivate(ctx); ctx->state = SPU_STATE_SAVED; } downgrade_write(&ctx->state_sema); }
#if defined HAVE_FMA4_SUPPORT || defined HAVE_AVX_SUPPORT # include <init-arch.h> # include <math.h> # include <math_private.h> extern double __ieee754_atan2_sse2 (double, double); extern double __ieee754_atan2_avx (double, double); # ifdef HAVE_FMA4_SUPPORT extern double __ieee754_atan2_fma4 (double, double); # else # undef HAS_FMA4 # define HAS_FMA4 0 # define __ieee754_atan2_fma4 ((void *) 0) # endif libm_ifunc (__ieee754_atan2, HAS_FMA4 ? __ieee754_atan2_fma4 : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); strong_alias (__ieee754_atan2, __atan2_finite) # define __ieee754_atan2 __ieee754_atan2_sse2 #endif #include <sysdeps/ieee754/dbl-64/e_atan2.c>
/****************************************************************************** * * * * Copyright (C) 1997-2014 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ #ifndef DECLINFO_H #define DECLINFO_H #include <stdio.h> #include <qcstring.h> extern void parseFuncDecl(const QCString &decl, bool objC, QCString &clName, QCString &type, QCString &name, QCString &args, QCString &funcTempList, QCString &exceptions ); #endif
/* * PROJECT: ReactOS Kernel * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/config/cmcheck.c * PURPOSE: Configuration Manager - Hive and Key Validation * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) */ /* INCLUDES ******************************************************************/ #include "ntoskrnl.h" #define NDEBUG #include "debug.h" /* GLOBALS *******************************************************************/ /* FUNCTIONS *****************************************************************/ ULONG NTAPI CmCheckRegistry(IN PCMHIVE RegistryHive, IN ULONG Flags) { /* FIXME: HACK! */ DPRINT1("CmCheckRegistry(0x%p, %lu) is UNIMPLEMENTED!\n", RegistryHive, Flags); return 0; }
/* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others * * gimp-gradients.c * Copyright (C) 2002 Michael Natterer <mitch@gimp.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 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 "config.h" #include <gegl.h> #include "core-types.h" #include "gimp.h" #include "gimp-gradients.h" #include "gimpcontext.h" #include "gimpcontainer.h" #include "gimpdatafactory.h" #include "gimpgradient.h" #include "gimp-intl.h" #define FG_BG_RGB_KEY "gimp-gradient-fg-bg-rgb" #define FG_BG_HARDEDGE_KEY "gimp-gradient-fg-bg-rgb" #define FG_BG_HSV_CCW_KEY "gimp-gradient-fg-bg-hsv-ccw" #define FG_BG_HSV_CW_KEY "gimp-gradient-fg-bg-hsv-cw" #define FG_TRANSPARENT_KEY "gimp-gradient-fg-transparent" /* local function prototypes */ static GimpGradient * gimp_gradients_add_gradient (Gimp *gimp, const gchar *name, const gchar *id); /* public functions */ void gimp_gradients_init (Gimp *gimp) { GimpGradient *gradient; g_return_if_fail (GIMP_IS_GIMP (gimp)); /* FG to BG (RGB) */ gradient = gimp_gradients_add_gradient (gimp, _("FG to BG (RGB)"), FG_BG_RGB_KEY); gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; gimp_context_set_gradient (gimp->user_context, gradient); /* FG to BG (Hardedge) */ gradient = gimp_gradients_add_gradient (gimp, _("FG to BG (Hardedge)"), FG_BG_HARDEDGE_KEY); gradient->segments->left = 0.00; gradient->segments->middle = 0.25; gradient->segments->right = 0.50; gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->next = gimp_gradient_segment_new (); gradient->segments->next->prev = gradient->segments; gradient->segments->next->left = 0.50; gradient->segments->next->middle = 0.75; gradient->segments->next->right = 1.00; gradient->segments->next->left_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; gradient->segments->next->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; /* FG to BG (HSV counter-clockwise) */ gradient = gimp_gradients_add_gradient (gimp, _("FG to BG (HSV counter-clockwise)"), FG_BG_HSV_CCW_KEY); gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; gradient->segments->color = GIMP_GRADIENT_SEGMENT_HSV_CCW; /* FG to BG (HSV clockwise hue) */ gradient = gimp_gradients_add_gradient (gimp, _("FG to BG (HSV clockwise hue)"), FG_BG_HSV_CW_KEY); gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; gradient->segments->color = GIMP_GRADIENT_SEGMENT_HSV_CW; /* FG to Transparent */ gradient = gimp_gradients_add_gradient (gimp, _("FG to Transparent"), FG_TRANSPARENT_KEY); gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT; } /* private functions */ static GimpGradient * gimp_gradients_add_gradient (Gimp *gimp, const gchar *name, const gchar *id) { GimpGradient *gradient; gradient = GIMP_GRADIENT (gimp_gradient_new (gimp_get_user_context (gimp), name)); gimp_data_make_internal (GIMP_DATA (gradient), id); gimp_container_add (gimp_data_factory_get_container (gimp->gradient_factory), GIMP_OBJECT (gradient)); g_object_unref (gradient); g_object_set_data (G_OBJECT (gimp), id, gradient); return gradient; }
#pragma once #include <wrl.h> namespace DX { // Helper class for animation and simulation timing. class StepTimer { public: StepTimer() : m_elapsedTicks(0), m_totalTicks(0), m_leftOverTicks(0), m_frameCount(0), m_framesPerSecond(0), m_framesThisSecond(0), m_qpcSecondCounter(0), m_isFixedTimeStep(false), m_targetElapsedTicks(TicksPerSecond / 60) { if (!QueryPerformanceFrequency(&m_qpcFrequency)) { throw ref new Platform::FailureException(); } if (!QueryPerformanceCounter(&m_qpcLastTime)) { throw ref new Platform::FailureException(); } // Initialize max delta to 1/10 of a second. m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10; } // Get elapsed time since the previous Update call. uint64 GetElapsedTicks() const { return m_elapsedTicks; } double GetElapsedSeconds() const { return TicksToSeconds(m_elapsedTicks); } // Get total time since the start of the program. uint64 GetTotalTicks() const { return m_totalTicks; } double GetTotalSeconds() const { return TicksToSeconds(m_totalTicks); } // Get total number of updates since start of the program. uint32 GetFrameCount() const { return m_frameCount; } // Get the current framerate. uint32 GetFramesPerSecond() const { return m_framesPerSecond; } // Set whether to use fixed or variable timestep mode. void SetFixedTimeStep(bool isFixedTimestep) { m_isFixedTimeStep = isFixedTimestep; } // Set how often to call Update when in fixed timestep mode. void SetTargetElapsedTicks(uint64 targetElapsed) { m_targetElapsedTicks = targetElapsed; } void SetTargetElapsedSeconds(double targetElapsed) { m_targetElapsedTicks = SecondsToTicks(targetElapsed); } // Integer format represents time using 10,000,000 ticks per second. static const uint64 TicksPerSecond = 10000000; static double TicksToSeconds(uint64 ticks) { return static_cast<double>(ticks) / TicksPerSecond; } static uint64 SecondsToTicks(double seconds) { return static_cast<uint64>(seconds * TicksPerSecond); } // After an intentional timing discontinuity (for instance a blocking IO operation) // call this to avoid having the fixed timestep logic attempt a set of catch-up // Update calls. void ResetElapsedTime() { if (!QueryPerformanceCounter(&m_qpcLastTime)) { throw ref new Platform::FailureException(); } m_leftOverTicks = 0; m_framesPerSecond = 0; m_framesThisSecond = 0; m_qpcSecondCounter = 0; } // Update timer state, calling the specified Update function the appropriate number of times. template<typename TUpdate> void Tick(const TUpdate& update) { // Query the current time. LARGE_INTEGER currentTime; if (!QueryPerformanceCounter(&currentTime)) { throw ref new Platform::FailureException(); } uint64 timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart; m_qpcLastTime = currentTime; m_qpcSecondCounter += timeDelta; // Clamp excessively large time deltas (e.g. after paused in the debugger). if (timeDelta > m_qpcMaxDelta) { timeDelta = m_qpcMaxDelta; } // Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp. timeDelta *= TicksPerSecond; timeDelta /= m_qpcFrequency.QuadPart; uint32 lastFrameCount = m_frameCount; if (m_isFixedTimeStep) { // Fixed timestep update logic // If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp // the clock to exactly match the target value. This prevents tiny and irrelevant errors // from accumulating over time. Without this clamping, a game that requested a 60 fps // fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually // accumulate enough tiny errors that it would drop a frame. It is better to just round // small deviations down to zero to leave things running smoothly. if (abs(static_cast<int64>(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000) { timeDelta = m_targetElapsedTicks; } m_leftOverTicks += timeDelta; while (m_leftOverTicks >= m_targetElapsedTicks) { m_elapsedTicks = m_targetElapsedTicks; m_totalTicks += m_targetElapsedTicks; m_leftOverTicks -= m_targetElapsedTicks; m_frameCount++; update(); } } else { // Variable timestep update logic. m_elapsedTicks = timeDelta; m_totalTicks += timeDelta; m_leftOverTicks = 0; m_frameCount++; update(); } // Track the current framerate. if (m_frameCount != lastFrameCount) { m_framesThisSecond++; } if (m_qpcSecondCounter >= static_cast<uint64>(m_qpcFrequency.QuadPart)) { m_framesPerSecond = m_framesThisSecond; m_framesThisSecond = 0; m_qpcSecondCounter %= m_qpcFrequency.QuadPart; } } private: // Source timing data uses QPC units. LARGE_INTEGER m_qpcFrequency; LARGE_INTEGER m_qpcLastTime; uint64 m_qpcMaxDelta; // Derived timing data uses a canonical tick format. uint64 m_elapsedTicks; uint64 m_totalTicks; uint64 m_leftOverTicks; // Members for tracking the framerate. uint32 m_frameCount; uint32 m_framesPerSecond; uint32 m_framesThisSecond; uint64 m_qpcSecondCounter; // Members for configuring fixed timestep mode. bool m_isFixedTimeStep; uint64 m_targetElapsedTicks; }; }
/* This file is part of cpp-ethereum. cpp-ethereum 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. cpp-ethereum 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 cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. */ /** * @author Christian <c@ethdev.com> * @date 2014 * Solidity AST to EVM bytecode compiler. */ #pragma once #include <ostream> #include <functional> #include <libsolidity/ASTVisitor.h> #include <libsolidity/CompilerContext.h> #include <libevmasm/Assembly.h> namespace dev { namespace solidity { class Compiler: private ASTConstVisitor { public: explicit Compiler(bool _optimize = false, unsigned _runs = 200): m_optimize(_optimize), m_optimizeRuns(_runs), m_context(), m_returnTag(m_context.newTag()) { } void compileContract(ContractDefinition const& _contract, std::map<ContractDefinition const*, bytes const*> const& _contracts); bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } bytes getRuntimeBytecode() { return m_context.getAssembledRuntimeBytecode(m_runtimeSub); } /// @arg _sourceCodes is the map of input files to source code strings /// @arg _inJsonFromat shows whether the out should be in Json format Json::Value streamAssembly(std::ostream& _stream, StringMap const& _sourceCodes = StringMap(), bool _inJsonFormat = false) const { return m_context.streamAssembly(_stream, _sourceCodes, _inJsonFormat); } /// @returns Assembly items of the normal compiler context eth::AssemblyItems const& getAssemblyItems() const { return m_context.getAssembly().getItems(); } /// @returns Assembly items of the runtime compiler context eth::AssemblyItems const& getRuntimeAssemblyItems() const { return m_context.getAssembly().getSub(m_runtimeSub).getItems(); } /// @returns the entry label of the given function. Might return an AssemblyItem of type /// UndefinedItem if it does not exist yet. eth::AssemblyItem getFunctionEntryLabel(FunctionDefinition const& _function) const; private: /// Registers the non-function objects inside the contract with the context. void initializeContext(ContractDefinition const& _contract, std::map<ContractDefinition const*, bytes const*> const& _contracts); /// Adds the code that is run at creation time. Should be run after exchanging the run-time context /// with a new and initialized context. Adds the constructor code. void packIntoContractCreator(ContractDefinition const& _contract, CompilerContext const& _runtimeContext); void appendBaseConstructor(FunctionDefinition const& _constructor); void appendConstructor(FunctionDefinition const& _constructor); void appendFunctionSelector(ContractDefinition const& _contract); /// Creates code that unpacks the arguments for the given function represented by a vector of TypePointers. /// From memory if @a _fromMemory is true, otherwise from call data. /// Expects source offset on the stack. void appendCalldataUnpacker( TypePointers const& _typeParameters, bool _fromMemory = false, u256 _startOffset = u256(-1) ); void appendReturnValuePacker(TypePointers const& _typeParameters); void registerStateVariables(ContractDefinition const& _contract); void initializeStateVariables(ContractDefinition const& _contract); /// Initialises all memory arrays in the local variables to point to an empty location. void initialiseMemoryArrays(std::vector<VariableDeclaration const*> _variables); /// Pushes the initialised value of the given type to the stack. If the type is a memory /// reference type, allocates memory and pushes the memory pointer. /// Not to be used for storage references. void initialiseInMemory(Type const& _type); virtual bool visit(VariableDeclaration const& _variableDeclaration) override; virtual bool visit(FunctionDefinition const& _function) override; virtual bool visit(IfStatement const& _ifStatement) override; virtual bool visit(WhileStatement const& _whileStatement) override; virtual bool visit(ForStatement const& _forStatement) override; virtual bool visit(Continue const& _continue) override; virtual bool visit(Break const& _break) override; virtual bool visit(Return const& _return) override; virtual bool visit(VariableDeclarationStatement const& _variableDeclarationStatement) override; virtual bool visit(ExpressionStatement const& _expressionStatement) override; virtual bool visit(PlaceholderStatement const&) override; /// Appends one layer of function modifier code of the current function, or the function /// body itself if the last modifier was reached. void appendModifierOrFunctionCode(); void appendStackVariableInitialisation(VariableDeclaration const& _variable); void compileExpression(Expression const& _expression, TypePointer const& _targetType = TypePointer()); bool const m_optimize; unsigned const m_optimizeRuns; CompilerContext m_context; size_t m_runtimeSub = size_t(-1); ///< Identifier of the runtime sub-assembly CompilerContext m_runtimeContext; std::vector<eth::AssemblyItem> m_breakTags; ///< tag to jump to for a "break" statement std::vector<eth::AssemblyItem> m_continueTags; ///< tag to jump to for a "continue" statement eth::AssemblyItem m_returnTag; ///< tag to jump to for a "return" statement unsigned m_modifierDepth = 0; FunctionDefinition const* m_currentFunction = nullptr; unsigned m_stackCleanupForReturn = 0; ///< this number of stack elements need to be removed before jump to m_returnTag // arguments for base constructors, filled in derived-to-base order std::map<FunctionDefinition const*, std::vector<ASTPointer<Expression>> const*> m_baseArguments; }; } }
/* * Copyright (C) 1997-2013 JDERobot Developers Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. * * Authors : Borja Menéndez <borjamonserrano@gmail.com> * */ #ifndef IMPORTDIALOG_H #define IMPORTDIALOG_H #include "../guisubautomata.h" // Definition of this class class ImportDialog { public: // Constructor ImportDialog ( GuiSubautomata* gsubautomata ); // Destructor virtual ~ImportDialog (); // Popup initializer void init (); protected: // Data structure GuiSubautomata* gsubautomata; Gtk::Dialog* dialog; Gtk::Button* button_accept; Gtk::Button* button_cancel; Gtk::CheckButton *checkbutton_laser, *checkbutton_sonar, *checkbutton_camera; Gtk::CheckButton *checkbutton_pose3dencoders, *checkbutton_pose3dmotors; // Private methods void on_button_accept (); void on_button_cancel (); bool on_key_released ( GdkEventKey* event ); }; #endif // IMPORTDIALOG_H
/* Provide a working getlogin for systems which lack it. Copyright (C) 2010-2013 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, 2010. */ #include <config.h> /* Specification. */ #include <unistd.h> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif char * getlogin (void) { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ static char login_name[1024]; DWORD sz = sizeof (login_name); if (GetUserName (login_name, &sz)) return login_name; #endif return NULL; }
#ifndef DYNET_NODES_LSTM_H_ #define DYNET_NODES_LSTM_H_ #include "dynet/dynet.h" #include "dynet/nodes-def-macros.h" namespace dynet { struct VanillaLSTMGates : public Node { explicit VanillaLSTMGates(const std::vector<VariableIndex>& a, bool dropout, real weightnoise_std) : Node(a), dropout(dropout), weightnoise_std(weightnoise_std), forget_gate_bias(1.0) {} virtual bool supports_multibatch() const override { return true; } virtual int autobatch_sig(const ComputationGraph &cg, SigMap &sm) const override; virtual std::vector<int> autobatch_concat(const ComputationGraph & cg) const override; virtual void autobatch_reshape(const ComputationGraph & cg, const std::vector<VariableIndex> & batch_ids, const std::vector<int> & concat, std::vector<const Tensor*>& xs, Tensor& fx) const override { autobatch_reshape_concatonly(cg, batch_ids, concat, xs, fx); } bool dropout; real weightnoise_std; const real forget_gate_bias; DYNET_NODE_DEFINE_DEV_IMPL() }; struct VanillaLSTMC : public Node { explicit VanillaLSTMC(const std::initializer_list<VariableIndex>& a) : Node(a) {} virtual bool supports_multibatch() const override { return true; } virtual int autobatch_sig(const ComputationGraph &cg, SigMap &sm) const override; virtual std::vector<int> autobatch_concat(const ComputationGraph & cg) const override; virtual void autobatch_reshape(const ComputationGraph & cg, const std::vector<VariableIndex> & batch_ids, const std::vector<int> & concat, std::vector<const Tensor*>& xs, Tensor& fx) const override { autobatch_reshape_concatonly(cg, batch_ids, concat, xs, fx); } DYNET_NODE_DEFINE_DEV_IMPL() }; struct VanillaLSTMH : public Node { explicit VanillaLSTMH(const std::initializer_list<VariableIndex>& a) : Node(a) {} virtual bool supports_multibatch() const override { return true; } virtual int autobatch_sig(const ComputationGraph &cg, SigMap &sm) const override; virtual std::vector<int> autobatch_concat(const ComputationGraph & cg) const override; virtual void autobatch_reshape(const ComputationGraph & cg, const std::vector<VariableIndex> & batch_ids, const std::vector<int> & concat, std::vector<const Tensor*>& xs, Tensor& fx) const override { autobatch_reshape_concatonly(cg, batch_ids, concat, xs, fx); } DYNET_NODE_DEFINE_DEV_IMPL() }; } // namespace dynet #endif
/* * Copyright (C) 2015 Freie Universität Berlin * * 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 cpu_stm32f4 * @{ * * @file * @brief CPU specific definitions for internal peripheral handling * * @author Hauke Petersen <hauke.peterse@fu-berlin.de> */ #ifndef PERIPH_CPU_H #define PERIPH_CPU_H #include "cpu.h" #ifdef __cplusplus extern "C" { #endif /** * @brief Overwrite the default gpio_t type definition * @{ */ #define HAVE_GPIO_T typedef uint32_t gpio_t; /** @} */ /** * @brief Definition of a fitting UNDEF value */ #define GPIO_UNDEF (0xffffffff) /** * @brief Define a CPU specific GPIO pin generator macro */ #define GPIO_PIN(x, y) ((GPIOA_BASE + (x << 10)) | y) /** * @brief declare needed generic SPI functions * @{ */ #define PERIPH_SPI_NEEDS_TRANSFER_BYTES #define PERIPH_SPI_NEEDS_TRANSFER_REG #define PERIPH_SPI_NEEDS_TRANSFER_REGS /** @} */ /** * @brief Available ports on the STM32F4 family */ enum { PORT_A = 0, /**< port A */ PORT_B = 1, /**< port B */ PORT_C = 2, /**< port C */ PORT_D = 3, /**< port D */ PORT_E = 4, /**< port E */ PORT_F = 5, /**< port F */ PORT_G = 6, /**< port G */ PORT_H = 7, /**< port H */ PORT_I = 8 /**< port I */ }; /** * @brief Available MUX values for configuring a pin's alternate function */ typedef enum { GPIO_AF0 = 0, /**< use alternate function 0 */ GPIO_AF1, /**< use alternate function 1 */ GPIO_AF2, /**< use alternate function 2 */ GPIO_AF3, /**< use alternate function 3 */ GPIO_AF4, /**< use alternate function 4 */ GPIO_AF5, /**< use alternate function 5 */ GPIO_AF6, /**< use alternate function 6 */ GPIO_AF7, /**< use alternate function 7 */ GPIO_AF8, /**< use alternate function 8 */ GPIO_AF9, /**< use alternate function 9 */ GPIO_AF10, /**< use alternate function 10 */ GPIO_AF11, /**< use alternate function 11 */ GPIO_AF12, /**< use alternate function 12 */ GPIO_AF13, /**< use alternate function 13 */ GPIO_AF14 /**< use alternate function 14 */ } gpio_af_t; /** * @brief Structure for UART configuration data * @{ */ typedef struct { USART_TypeDef *dev; /**< UART device base register address */ uint32_t rcc_mask; /**< bit in clock enable register */ gpio_t rx_pin; /**< RX pin */ gpio_t tx_pin; /**< TX pin */ gpio_af_t af; /**< alternate pin function to use */ uint8_t irqn; /**< IRQ channel */ uint8_t dma_stream; /**< DMA stream used for TX */ uint8_t dma_chan; /**< DMA channel used for TX */ } uart_conf_t; /** @} */ /** * @brief Configure the alternate function for the given pin * * @note This is meant for internal use in STM32F4 peripheral drivers only * * @param[in] pin pin to configure * @param[in] af alternate function to use */ void gpio_init_af(gpio_t pin, gpio_af_t af); /** * @brief Power on the DMA device the given stream belongs to * * @param[in] stream logical DMA stream */ static inline void dma_poweron(int stream) { if (stream < 8) { RCC->AHB1ENR |= RCC_AHB1ENR_DMA1EN; } else { RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN; } } /** * @brief Get DMA base register * * For simplifying DMA stream handling, we map the DMA channels transparently to * one integer number, such that DMA1 stream0 equals 0, DMA2 stream0 equals 8, * DMA2 stream 7 equals 15 and so on. * * @param[in] stream logical DMA stream */ static inline DMA_TypeDef *dma_base(int stream) { return (stream < 8) ? DMA1 : DMA2; } /** * @brief Get the DMA stream base address * * @param[in] stream logical DMA stream * * @return base address for the selected DMA stream */ static inline DMA_Stream_TypeDef *dma_stream(int stream) { uint32_t base = (uint32_t)dma_base(stream); return (DMA_Stream_TypeDef *)(base + (0x10 + (0x18 * (stream & 0x7)))); } /** * @brief Select high or low DMA interrupt register based on stream number * * @param[in] stream logical DMA stream * * @return 0 for streams 0-3, 1 for streams 3-7 */ static inline int dma_hl(int stream) { return ((stream & 0x4) >> 2); } /** * @brief Get the interrupt flag clear bit position in the DMA LIFCR register * * @param[in] stream logical DMA stream */ static inline uint32_t dma_ifc(int stream) { switch (stream & 0x3) { case 0: return (1 << 5); case 1: return (1 << 11); case 2: return (1 << 21); case 3: return (1 << 27); default: return 0; } } static inline void dma_isr_enable(int stream) { if (stream < 7) { NVIC_EnableIRQ((IRQn_Type)((int)DMA1_Stream0_IRQn + stream)); } else if (stream == 8) { NVIC_EnableIRQ(DMA1_Stream7_IRQn); } else if (stream < 14) { NVIC_EnableIRQ((IRQn_Type)((int)DMA2_Stream0_IRQn + stream)); } else if (stream < 17) { NVIC_EnableIRQ((IRQn_Type)((int)DMA2_Stream5_IRQn + stream)); } } #ifdef __cplusplus } #endif #endif /* PERIPH_CPU_H */ /** @} */
// #include <ia32/arch/board-ia32_pc-config.h>
#pragma once #include "platform/network_policy.hpp" @class NSDate; namespace network_policy { enum Stage { Ask, Always, Never, Today, NotToday }; void SetStage(Stage state); Stage GetStage(); bool CanUseNetwork(); bool IsActivePolicyDate(); NSDate* GetPolicyDate(); } // namespace network_policy
// This may look like C code, but it's really -*- C++ -*- /* * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium. * * See the LICENSE file for terms of use. */ #ifndef WT_DBO_FIELD_IMPL_H_ #define WT_DBO_FIELD_IMPL_H_ #include <Wt/Dbo/Session> #include <Wt/Dbo/Exception> #include <Wt/Dbo/SqlStatement> #include <Wt/Dbo/SqlTraits> #include <Wt/Dbo/DbAction> namespace Wt { namespace Dbo { template <typename V> FieldRef<V>::FieldRef(V& value, const std::string& name, int size) : value_(value), name_(name), size_(size) { } template <typename V> const std::string& FieldRef<V>::name() const { return name_; } template <typename V> int FieldRef<V>::size() const { return size_; } template <typename V> std::string FieldRef<V>::sqlType(Session& session) const { return sql_value_traits<V>::type(session.connection(false), size_); } template <typename V> const std::type_info *FieldRef<V>::type() const { return &typeid(V); } template <typename V> void FieldRef<V>::bindValue(SqlStatement *statement, int column) const { sql_value_traits<V>::bind(value_, statement, column, size_); } template <typename V> void FieldRef<V>::setValue(Session& session, SqlStatement *statement, int column) const { sql_value_traits<V>::read(value_, statement, column, size_); } template <class C> CollectionRef<C>::CollectionRef(collection< ptr<C> >& value, RelationType type, const std::string& joinName, const std::string& joinId, int fkConstraints) : value_(value), joinName_(joinName), joinId_(joinId), type_(type), fkConstraints_(fkConstraints) { } template <class C> PtrRef<C>::PtrRef(ptr<C>& value, const std::string& name, int size, int fkConstraints) : value_(value), name_(name), size_(size), fkConstraints_(fkConstraints) { } template <class C, class A, class Enable = void> struct LoadLazyHelper { static void loadLazy(ptr<C>& p, typename dbo_traits<C>::IdType id, Session *session) { } }; template <class C, class A> struct LoadLazyHelper<C, A, typename boost::enable_if<action_sets_value<A> >::type> { static void loadLazy(ptr<C>& p, typename dbo_traits<C>::IdType id, Session *session) { if (!(id == dbo_traits<C>::invalidId())) { if (session) p = session->loadLazy<C>(id); else throw Exception("Could not load referenced Dbo::ptr, no session?"); } } }; template <class C> template <class A> void PtrRef<C>::visit(A& action, Session *session) const { typename dbo_traits<C>::IdType id; if (action.setsValue()) id = dbo_traits<C>::invalidId(); else id = value_.id(); std::string idFieldName = "stub"; int size = size_; if (session) { Impl::MappingInfo *mapping = session->getMapping<C>(); action.actMapping(mapping); idFieldName = mapping->naturalIdFieldName; size = mapping->naturalIdFieldSize; if (idFieldName.empty()) idFieldName = mapping->surrogateIdFieldName; } field(action, id, name_ + "_" + idFieldName, size); LoadLazyHelper<C, A>::loadLazy(value_, id, session); } template <class C> WeakPtrRef<C>::WeakPtrRef(weak_ptr<C>& value, const std::string& joinName) : value_(value), joinName_(joinName) { } template <class C> const std::type_info *PtrRef<C>::type() const { return &typeid(typename dbo_traits<C>::IdType); } template <class A, typename V> void id(A& action, V& value, const std::string& name, int size) { action.actId(value, name, size); } template <class A, class C> void id(A& action, ptr<C>& value, const std::string& name, ForeignKeyConstraint constraint, int size) { action.actId(value, name, size, constraint.value()); } template <class A, typename V> void field(A& action, V& value, const std::string& name, int size) { action.act(FieldRef<V>(value, name, size)); } template <class A, class C> void field(A& action, ptr<C>& value, const std::string& name, int size) { action.actPtr(PtrRef<C>(value, name, size, 0)); } template <class A, class C> void belongsToImpl(A& action, ptr<C>& value, const std::string& name, int fkConstraints, int size) { if (name.empty() && action.session()) action.actPtr(PtrRef<C>(value, action.session()->template tableName<C>(), size, fkConstraints)); else action.actPtr(PtrRef<C>(value, name, size, fkConstraints)); } template <class A, class C> void belongsTo(A& action, ptr<C>& value, const std::string& name, int size) { belongsToImpl(action, value, name, 0, size); } template <class A, class C> void belongsTo(A& action, ptr<C>& value, const std::string& name, ForeignKeyConstraint constraint, int size) { belongsToImpl(action, value, name, constraint.value(), size); } template <class A, class C> void belongsTo(A& action, ptr<C>& value, ForeignKeyConstraint constraint, int size) { belongsToImpl(action, value, std::string(), constraint.value(), size); } template <class A, class C> void hasOne(A& action, weak_ptr<C>& value, const std::string& joinName) { action.actWeakPtr(WeakPtrRef<C>(value, joinName)); } template <class A, class C> void hasMany(A& action, collection< ptr<C> >& value, RelationType type, const std::string& joinName) { action.actCollection(CollectionRef<C>(value, type, joinName, std::string(), Impl::FKNotNull | Impl::FKOnDeleteCascade)); } template <class A, class C> void hasMany(A& action, collection< ptr<C> >& value, RelationType type, const std::string& joinName, const std::string& joinId, ForeignKeyConstraint constraint) { if (type != ManyToMany) throw Exception("hasMany() with named joinId only for a ManyToMany relation"); action.actCollection(CollectionRef<C>(value, type, joinName, joinId, constraint.value())); } } } #endif // WT_DBO_FIELD_IMPL_H_
/* * Copyright (C) 2013 Google 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 Google 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 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 SharedWorkerRepositoryClientImpl_h #define SharedWorkerRepositoryClientImpl_h #include "core/workers/SharedWorkerRepositoryClient.h" #include "wtf/Noncopyable.h" #include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink { class WebSharedWorkerRepositoryClient; class SharedWorkerRepositoryClientImpl final : public SharedWorkerRepositoryClient { WTF_MAKE_NONCOPYABLE(SharedWorkerRepositoryClientImpl); public: static PassOwnPtr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client) { return adoptPtr(new SharedWorkerRepositoryClientImpl(client)); } ~SharedWorkerRepositoryClientImpl() override { } void connect(PassRefPtrWillBeRawPtr<SharedWorker>, PassOwnPtr<WebMessagePortChannel>, const KURL&, const String& name, ExceptionState&) override; void documentDetached(Document*) override; private: explicit SharedWorkerRepositoryClientImpl(WebSharedWorkerRepositoryClient*); WebSharedWorkerRepositoryClient* m_client; }; } // namespace blink #endif // SharedWorkerRepositoryClientImpl_h
// // CAEmitterBehavior+TFEasyCoder.h // TFEasyCoder // // Created by ztf on 16/10/26. // Copyright © 2016年 ztf. All rights reserved. // #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "TFEasyCoderConst.h" typedef void(^CAEmitterBehaviorEasyCoderBlock) (CAEmitterBehavior * ins); @interface CAEmitterBehavior (TFEasyCoder) +( CAEmitterBehavior *)easyCoder:(CAEmitterBehaviorEasyCoderBlock)block; -(CAEmitterBehavior *)easyCoder:(CAEmitterBehaviorEasyCoderBlock)block; -(CAEmitterBehavior *(^)(NSString * name))set_name; -(CAEmitterBehavior *(^)(BOOL enabled))set_enabled; //superclass pros NSObject -(CAEmitterBehavior *(^)(NSArray * accessibilityElements))set_accessibilityElements; -(CAEmitterBehavior *(^)(NSArray * accessibilityCustomActions))set_accessibilityCustomActions; -(CAEmitterBehavior *(^)(BOOL isAccessibilityElement))set_isAccessibilityElement; -(CAEmitterBehavior *(^)(NSString * accessibilityLabel))set_accessibilityLabel; -(CAEmitterBehavior *(^)(NSString * accessibilityHint))set_accessibilityHint; -(CAEmitterBehavior *(^)(NSString * accessibilityValue))set_accessibilityValue; -(CAEmitterBehavior *(^)(unsigned long long accessibilityTraits))set_accessibilityTraits; -(CAEmitterBehavior *(^)(UIBezierPath * accessibilityPath))set_accessibilityPath; -(CAEmitterBehavior *(^)(CGPoint accessibilityActivationPoint))set_accessibilityActivationPoint; -(CAEmitterBehavior *(^)(NSString * accessibilityLanguage))set_accessibilityLanguage; -(CAEmitterBehavior *(^)(BOOL accessibilityElementsHidden))set_accessibilityElementsHidden; -(CAEmitterBehavior *(^)(BOOL accessibilityViewIsModal))set_accessibilityViewIsModal; -(CAEmitterBehavior *(^)(BOOL shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren; -(CAEmitterBehavior *(^)(long long accessibilityNavigationStyle))set_accessibilityNavigationStyle; -(CAEmitterBehavior *(^)(id value,NSString *key))set_ValueKey; @end
/* *@brief RDTSC implementation * *@date 22.10.2013 * * */ #include <stdint.h> #include <hal/cpu_info.h> uint64_t get_cpu_counter(void) { uint64_t hi = 0, lo = 0; asm volatile ( "rdtsc\n\t" "movl %%eax, %0\n\t" "movl %%edx, %1\n\t" : "=r"(lo), "=r"(hi) :); return (hi << 32) + lo; }