text
stringlengths
4
6.14k
// Copyright 2015 Google Inc. 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. // // This file allows reading the content of the type info stream of a PDB. #ifndef SYZYGY_PDB_PDB_TYPE_INFO_STREAM_ENUM_H_ #define SYZYGY_PDB_PDB_TYPE_INFO_STREAM_ENUM_H_ #include <stdint.h> #include <memory> #include <unordered_map> #include "base/callback.h" #include "base/memory/ref_counted.h" #include "syzygy/pdb/pdb_byte_stream.h" #include "syzygy/pdb/pdb_data.h" #include "syzygy/pdb/pdb_data_types.h" #include "syzygy/pdb/pdb_stream.h" #include "syzygy/pdb/pdb_stream_reader.h" namespace pdb { // Simple type info stream enumerator which crawls through a type info stream. class TypeInfoEnumerator { public: class BinaryTypeRecordReader; // Creates an uninitialized enumerator for type info stream. // @param stream the stream to parse. explicit TypeInfoEnumerator(PdbStream* stream); // Initializes the enumerator with given stream. Needs to be called before // any further work. // @returns true on success, false means bad header format. bool Init(); // Moves to the next record in the type info stream. Expects stream position // at the beginning of a type info record. // @returns true on success, false on failure. bool NextTypeInfoRecord(); // Moves position to the desired type id. // @param type index of the desired record. // @returns true on success, false on failure. bool SeekRecord(uint32_t type_id); // Checks if the end of stream was reached. // @returns true at the end of the stream, false otherwise. bool EndOfStream(); // Resets stream to its beginning. // @returns true on success, false on failure. bool ResetStream(); // Creates and returns a class that implements common::BinaryStreamReader // over the current record. BinaryTypeRecordReader CreateRecordReader(); // @name Accessors. // @{ // @returns the starting position of current type record. // @note this is currently past the length and type fields of the record. size_t start_position() const { return current_record_.start + sizeof(current_record_.length) + sizeof(current_record_.type); } // @returns the length of the current type record. // @note this currently excludes the length and type fields, which are // assumed to be consumed already. uint16_t len() const { return current_record_.length - sizeof(current_record_.type); } // @returns the type of the current type record. uint16_t type() const { return current_record_.type; } // @returns the type ID of the current type record. uint32_t type_id() const { return type_id_; } // @returns the type info header of the type info stream. TypeInfoHeader type_info_header() const { return type_info_header_; } // @} private: friend class BinaryTypeRecordReader; // Information about a specific type record. struct TypeRecordInfo { // The stream position of the first byte of the type record (which starts // with the record length). size_t start; // The type of the record. uint16_t type; // The length of the record, this is exclusive the length itself. uint16_t length; }; // Ensure that the type with ID @p type_id has been located and stored // in @p located_records_. bool EnsureTypeLocated(uint32_t type_id); // Adds the start position @p position for @p type_id, which must be a valid // type id, and must be one larger than the last added start position. bool AddRecordInfo(uint32_t type_id, const TypeRecordInfo& record); bool FindRecordInfo(uint32_t type_id, TypeRecordInfo* record); // Pointer to the PDB type info stream. scoped_refptr<PdbStream> stream_; // The reader used to parse out the locations of type records. PdbStreamReaderWithPosition reader_; // Header of the type info stream. TypeInfoHeader type_info_header_; // A vector with the positions of located records. std::vector<TypeRecordInfo> located_records_; // The largest type index we already saved in @p located_records_. uint32_t largest_located_id_; // Position of the end of data in the stream. size_t data_end_; // The largest type ID according to header. uint32_t type_id_max_; // The smallest type ID in the stream according to header. // This is typically 0x1000, as lower type id values are reserved for built // in types. uint32_t type_id_min_; // The type ID of the current type record. uint32_t type_id_; // Details of the current type record. TypeRecordInfo current_record_; }; class TypeInfoEnumerator::BinaryTypeRecordReader : public PdbStreamReaderWithPosition { private: friend class TypeInfoEnumerator; BinaryTypeRecordReader(size_t start_offset, size_t len, PdbStream* stream); }; } // namespace pdb #endif // SYZYGY_PDB_PDB_TYPE_INFO_STREAM_ENUM_H_
/* Copyright (c) 2013, Project OSRM, Dennis Luxen, others 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. 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. */ #ifndef XOR_FAST_HASH_STORAGE_H #define XOR_FAST_HASH_STORAGE_H #include "XORFastHash.h" #include <limits> #include <vector> template <typename NodeID, typename Key> class XORFastHashStorage { public: struct HashCell { Key key; NodeID id; unsigned time; HashCell() : key(std::numeric_limits<unsigned>::max()), id(std::numeric_limits<unsigned>::max()), time(std::numeric_limits<unsigned>::max()) { } HashCell(const HashCell &other) : key(other.key), id(other.id), time(other.time) {} inline operator Key() const { return key; } inline void operator=(const Key &key_to_insert) { key = key_to_insert; } }; explicit XORFastHashStorage(size_t) : positions(2 << 16), current_timestamp(0) {} inline HashCell &operator[](const NodeID node) { unsigned short position = fast_hasher(node); while ((positions[position].time == current_timestamp) && (positions[position].id != node)) { ++position %= (2 << 16); } positions[position].id = node; positions[position].time = current_timestamp; return positions[position]; } inline void Clear() { ++current_timestamp; if (std::numeric_limits<unsigned>::max() == current_timestamp) { positions.clear(); positions.resize((2 << 16)); } } private: XORFastHashStorage() : positions(2 << 16), current_timestamp(0) {} std::vector<HashCell> positions; XORFastHash fast_hasher; unsigned current_timestamp; }; #endif // XOR_FAST_HASH_STORAGE_H
/******************************************************************************* License: This software and/or related materials was developed at the National Institute of Standards and Technology (NIST) by employees of the Federal Government in the course of their official duties. Pursuant to title 17 Section 105 of the United States Code, this software is not subject to copyright protection and is in the public domain. This software and/or related materials have been determined to be not subject to the EAR (see Part 734.3 of the EAR for exact details) because it is a publicly available technology and software, and is freely distributed to any interested party with no licensing requirements. Therefore, it is permissible to distribute this software as a free download from the internet. Disclaimer: This software and/or related materials was developed to promote biometric standards and biometric technology testing for the Federal Government in accordance with the USA PATRIOT Act and the Enhanced Border Security and Visa Entry Reform Act. Specific hardware and software products identified in this software were used in order to perform the software development. In no case does such identification imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the products and equipment identified are necessarily the best available for the purpose. This software and/or related materials are provided "AS-IS" without warranty of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY, NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the licensed product, however used. In no event shall NIST be liable for any damages and/or costs, including but not limited to incidental or consequential damages of any kind, including economic damage or injury to property and lost profits, regardless of whether NIST shall be advised, have reason to know, or in fact shall know of the possibility. By using this software, you agree to bear all risk relating to quality, use and performance of the software and/or related materials. You agree to hold the Government harmless from any claim arising from your use of the software. *******************************************************************************/ #ifndef _IOUTIL_H #define _IOUTIL_H #ifndef True #define True 1 #define False 0 #endif #define MaxLineLength 512 #define EOL EOF /* fileexst.c */ extern int file_exists(char *); /* filehead.c */ extern void filehead(char *); /* fileroot.c */ extern void fileroot(char *); /* filesize.c */ extern int filesize(char *); /* filetail.c */ extern void filetail(char *); /* findfile.c */ extern int find_file(char *, char *); /* newext.c */ extern void newext(char *, const int, char *); extern int newext_ret(char *, int, char *); extern void newextlong(char **, char *); /* readutil.c */ extern int read_strstr_file(char *, char ***, char ***, int *, const int); extern int read_fltflt_file(char *, float **, float **, int *, const int); #endif /* !_IOUTIL_H */
/* * Copyright (c) 2012, 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 WritingMode_h #define WritingMode_h namespace blink { enum WritingMode { TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode }; // Lines have horizontal orientation; modes horizontal-tb. inline bool isHorizontalWritingMode(WritingMode writingMode) { return writingMode == TopToBottomWritingMode; } // Bottom of the line occurs earlier in the block; modes vertical-lr. inline bool isFlippedLinesWritingMode(WritingMode writingMode) { return writingMode == LeftToRightWritingMode; } // Block progression increases in the opposite direction to normal; modes // vertical-rl. inline bool isFlippedBlocksWritingMode(WritingMode writingMode) { return writingMode == RightToLeftWritingMode; } } // namespace blink #endif // WritingMode_h
/*********************************************************************************************************************** ** ** Copyright (c) 2015 ETH Zurich ** 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 the ETH Zurich 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. ** **********************************************************************************************************************/ #pragma once #include "../modelbase_api.h" #include "../nodes/Node.h" namespace Model { class SymbolMatcher; class MODELBASE_API NameResolver { public: using IsSuggestable = std::function<bool (Node::SymbolTypes)>; static QList<QPair<QString, Node*>> findAllMatches(const SymbolMatcher& matcher, QString nameSoFar, Node* root, IsSuggestable suggestable); static QList<QPair<QString, Node*>> mostLikelyMatches(const QString& nodeName, int matchLimit, Node* root = nullptr, IsSuggestable suggestable = isSuggestable); private: static bool isSuggestable(Node::SymbolTypes symbolType); }; }
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** 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 the ETH Zurich 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. ** **********************************************************************************************************************/ #pragma once #include "Style.h" namespace Visualization { template <typename T, typename > // was template <typename T, typename = void> but that is now declard in Style.h class StyleProperty { public: inline StyleProperty(Style* containingStyle, const QString& styleName) { containingStyle->addPropertyLoader([=](StyleLoader& sl) { sl.load(styleName, value_); }); } inline const T& operator()() const { return value_; } private: T value_{}; }; template <typename T> class StyleProperty<T, typename std::enable_if<std::is_enum<T>::value>::type> { public: inline StyleProperty(Style* containingStyle, const QString& styleName) { containingStyle->addPropertyLoader([=](StyleLoader& sl) { int enumVal{}; sl.load(styleName, enumVal); value_ = (T) enumVal; }); } inline T operator()() const { return value_; } private: T value_{}; }; template <typename T> class StyleProperty<T, typename std::enable_if<std::is_integral<T>::value>::type> { public: inline StyleProperty(Style* containingStyle, const QString& styleName) { containingStyle->addPropertyLoader([=](StyleLoader& sl) { sl.load(styleName, value_); }); } inline T operator()() const { return value_; } private: T value_{}; }; }
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <limits.h> #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/asn1.h> #include "asn1_local.h" int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) { return ASN1_STRING_set(x, d, len); } int ossl_i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) { int ret, j, bits, len; unsigned char *p, *d; if (a == NULL) return 0; len = a->length; if (len > 0) { if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) { bits = (int)a->flags & 0x07; } else { for (; len > 0; len--) { if (a->data[len - 1]) break; } j = a->data[len - 1]; if (j & 0x01) bits = 0; else if (j & 0x02) bits = 1; else if (j & 0x04) bits = 2; else if (j & 0x08) bits = 3; else if (j & 0x10) bits = 4; else if (j & 0x20) bits = 5; else if (j & 0x40) bits = 6; else if (j & 0x80) bits = 7; else bits = 0; /* should not happen */ } } else bits = 0; ret = 1 + len; if (pp == NULL) return ret; p = *pp; *(p++) = (unsigned char)bits; d = a->data; if (len > 0) { memcpy(p, d, len); p += len; p[-1] &= (0xff << bits); } *pp = p; return ret; } ASN1_BIT_STRING *ossl_c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) { ASN1_BIT_STRING *ret = NULL; const unsigned char *p; unsigned char *s; int i; if (len < 1) { i = ASN1_R_STRING_TOO_SHORT; goto err; } if (len > INT_MAX) { i = ASN1_R_STRING_TOO_LONG; goto err; } if ((a == NULL) || ((*a) == NULL)) { if ((ret = ASN1_BIT_STRING_new()) == NULL) return NULL; } else ret = (*a); p = *pp; i = *(p++); if (i > 7) { i = ASN1_R_INVALID_BIT_STRING_BITS_LEFT; goto err; } /* * We do this to preserve the settings. If we modify the settings, via * the _set_bit function, we will recalculate on output */ ret->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); /* clear */ ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | i); /* set */ if (len-- > 1) { /* using one because of the bits left byte */ s = OPENSSL_malloc((int)len); if (s == NULL) { i = ERR_R_MALLOC_FAILURE; goto err; } memcpy(s, p, (int)len); s[len - 1] &= (0xff << i); p += len; } else s = NULL; ret->length = (int)len; OPENSSL_free(ret->data); ret->data = s; ret->type = V_ASN1_BIT_STRING; if (a != NULL) (*a) = ret; *pp = p; return ret; err: ERR_raise(ERR_LIB_ASN1, i); if ((a == NULL) || (*a != ret)) ASN1_BIT_STRING_free(ret); return NULL; } /* * These next 2 functions from Goetz Babin-Ebell. */ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) { int w, v, iv; unsigned char *c; w = n / 8; v = 1 << (7 - (n & 0x07)); iv = ~v; if (!value) v = 0; if (a == NULL) return 0; a->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); /* clear, set on write */ if ((a->length < (w + 1)) || (a->data == NULL)) { if (!value) return 1; /* Don't need to set */ c = OPENSSL_clear_realloc(a->data, a->length, w + 1); if (c == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE); return 0; } if (w + 1 - a->length > 0) memset(c + a->length, 0, w + 1 - a->length); a->data = c; a->length = w + 1; } a->data[w] = ((a->data[w]) & iv) | v; while ((a->length > 0) && (a->data[a->length - 1] == 0)) a->length--; return 1; } int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n) { int w, v; w = n / 8; v = 1 << (7 - (n & 0x07)); if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) return 0; return ((a->data[w] & v) != 0); } /* * Checks if the given bit string contains only bits specified by * the flags vector. Returns 0 if there is at least one bit set in 'a' * which is not specified in 'flags', 1 otherwise. * 'len' is the length of 'flags'. */ int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, const unsigned char *flags, int flags_len) { int i, ok; /* Check if there is one bit set at all. */ if (!a || !a->data) return 1; /* * Check each byte of the internal representation of the bit string. */ ok = 1; for (i = 0; i < a->length && ok; ++i) { unsigned char mask = i < flags_len ? ~flags[i] : 0xff; /* We are done if there is an unneeded bit set. */ ok = (a->data[i] & mask) == 0; } return ok; }
/*========================================================================= Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmForEachCommand.h,v $ Language: C++ Date: $Date: 2012/03/29 17:21:08 $ Version: $Revision: 1.1.1.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef cmForEachCommand_h #define cmForEachCommand_h #include "cmCommand.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" /** \class cmForEachFunctionBlocker * \brief subclass of function blocker * * */ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: cmForEachFunctionBlocker() {this->Executing = false; Depth = 0;} virtual ~cmForEachFunctionBlocker() {} virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); virtual void ScopeEnded(cmMakefile &mf); std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; bool Executing; private: int Depth; }; /** \class cmForEachCommand * \brief starts an if block * * cmForEachCommand starts an if block */ class cmForEachCommand : public cmCommand { public: /** * This is a virtual constructor for the command. */ virtual cmCommand* Clone() { return new cmForEachCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. */ virtual bool IsScriptable() { return true; } /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() { return "foreach";} /** * Succinct documentation. */ virtual const char* GetTerseDocumentation() { return "Evaluate a group of commands for each value in a list."; } /** * More documentation. */ virtual const char* GetFullDocumentation() { return " foreach(loop_var arg1 arg2 ...)\n" " COMMAND1(ARGS ...)\n" " COMMAND2(ARGS ...)\n" " ...\n" " endforeach(loop_var)\n" " foreach(loop_var RANGE total)\n" " foreach(loop_var RANGE start stop [step])\n" "All commands between foreach and the matching endforeach are recorded " "without being invoked. Once the endforeach is evaluated, the " "recorded list of commands is invoked once for each argument listed " "in the original foreach command. Before each iteration of the loop " "\"${loop_var}\" will be set as a variable with " "the current value in the list.\n" "Foreach can also iterate over a generated range of numbers. " "There are three types of this iteration:\n" "* When specifying single number, the range will have elements " "0 to \"total\".\n" "* When specifying two numbers, the range will have elements from " "the first number to the second number.\n" "* The third optional number is the increment used to iterate from " "the first number to the second number."; } cmTypeMacro(cmForEachCommand, cmCommand); }; #endif
/* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. * If you develop a field type that might be of general use, please send * it back to the ncurses maintainers for inclusion in the next version. */ /*************************************************************************** * * * Author : Per Foreby, perf@efd.lth.se * * * ***************************************************************************/ #include "form.priv.h" MODULE_ID("$Id: fty_ipv4.c,v 1.1.1.1 2012/03/29 17:21:09 uid42307 Exp $") /*--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_IPV4_Field( | FIELD * field, | const void * argp) | | Description : Validate buffer content to be a valid IP number (Ver. 4) | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ static bool Check_IPV4_Field(FIELD * field, const void * argp) { char *bp = field_buffer(field,0); int num = 0, len; unsigned int d1, d2, d3, d4; argp=0; /* Silence unused parameter warning. */ if(isdigit((int)(*bp))) /* Must start with digit */ { num = sscanf(bp, "%u.%u.%u.%u%n", &d1, &d2, &d3, &d4, &len); if (num == 4) { bp += len; /* Make bp point to what sscanf() left */ while (*bp && isspace((int)(*bp))) bp++; /* Allow trailing whitespace */ } } return ((num != 4 || *bp || d1 > 255 || d2 > 255 || d3 > 255 || d4 > 255) ? FALSE : TRUE); } /*--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_IPV4_Character( | int c, | const void *argp ) | | Description : Check a character for unsigned type or period. | | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ static bool Check_IPV4_Character(int c, const void * argp) { argp=0; /* Silence unused parameter warning. */ return ((isdigit(c) || (c=='.')) ? TRUE : FALSE); } static FIELDTYPE typeIPV4 = { _RESIDENT, 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, NULL, NULL, NULL, Check_IPV4_Field, Check_IPV4_Character, NULL, NULL }; FIELDTYPE* TYPE_IPV4 = &typeIPV4; /* fty_ipv4.c ends here */
/*- * Copyright (c) 2009 Yohanes Nugroho <yohanes@gmail.com> * 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 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 AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _ARM_ECONA_REG_H #define _ARM_ECONA_REG_H #define ECONA_SRAM_SIZE 0x10000000 #define ECONA_DRAM_BASE 0x00000000 /* DRAM (via DDR Control Module) */ #define ECONA_SDRAM_BASE 0x40000000 #define ECONA_SDRAM_SIZE 0x1000000 #define ECONA_IO_BASE 0x70000000 #define ECONA_IO_SIZE 0x0E000000 #define ECONA_PIC_BASE 0x0D000000 #define ECONA_PIC_SIZE 0x01000000 #define ECONA_UART_BASE 0x08000000 #define ECONA_UART_SIZE 0x01000000 #define ECONA_IRQ_UART 0xA #define ECONA_TIMER_BASE 0x09000000 #define ECONA_TIMER_SIZE 0x01000000 #define ECONA_IRQ_TIMER_1 0 #define ECONA_IRQ_TIMER_2 1 #define ECONA_IRQ_OHCI 23 #define ECONA_IRQ_EHCI 24 #define ECONA_NET_BASE 0x00000000 #define ECONA_SYSTEM_BASE 0x07000000 #define ECONA_SYSTEM_SIZE 0x01000000 #define ECONA_NET_SIZE 0x01000000 #define ECONA_CFI_PBASE 0x10000000 #define ECONA_CFI_VBASE 0xD0000000 #define ECONA_CFI_SIZE 0x10000000 #define ECONA_IRQ_STATUS 18 #define ECONA_IRQ_TSTC 19 #define ECONA_IRQ_FSRC 20 #define ECONA_IRQ_TSQE 21 #define ECONA_IRQ_FSQF 22 #define ECONA_IRQ_SYSTEM 0 #define ECONA_EHCI_PBASE 0xC8000000 #define ECONA_EHCI_VBASE 0xF8000000 #define ECONA_EHCI_SIZE 0x8000000 #define ECONA_OHCI_PBASE 0xC0000000 #define ECONA_OHCI_VBASE 0xF0000000 #define ECONA_OHCI_SIZE 0x8000000 #define ECONA_USB_SIZE 0xf000000 /*Interrupt controller*/ #define INTC_LEVEL_TRIGGER 0 #define INTC_EDGE_TRIGGER 1 #define INTC_ACTIVE_HIGH 0 #define INTC_ACTIVE_LOW 1 /* * define rising/falling edge for edge trigger mode */ #define INTC_RISING_EDGE 0 #define INTC_FALLING_EDGE 1 #define INTC_INTERRUPT_SOURCE_REG_OFFSET 0x00 #define INTC_INTERRUPT_MASK_REG_OFFSET 0x04 #define INTC_INTERRUPT_CLEAR_EDGE_TRIGGER_REG_OFFSET 0x08 #define INTC_INTERRUPT_TRIGGER_MODE_REG_OFFSET 0x0C #define INTC_INTERRUPT_TRIGGER_LEVEL_REG_OFFSET 0x10 #define INTC_INTERRUPT_STATUS_REG_OFFSET 0x14 #define INTC_FIQ_MODE_SELECT_REG_OFFSET 0x18 #define INTC_SOFTWARE_INTERRUPT_REG_OFFSET 0x1C /* * define rising/falling edge for edge trigger mode */ #define INTC_RISING_EDGE 0 #define INTC_FALLING_EDGE 1 #define TIMER_TM1_COUNTER_REG 0x00 #define TIMER_TM1_LOAD_REG 0x04 #define TIMER_TM1_MATCH1_REG 0x08 #define TIMER_TM1_MATCH2_REG 0x0C #define TIMER_TM2_COUNTER_REG 0x10 #define TIMER_TM2_LOAD_REG 0x14 #define TIMER_TM2_MATCH1_REG 0x18 #define TIMER_TM2_MATCH2_REG 0x1C #define TIMER_TM_CR_REG 0x30 #define TIMER_TM_INTR_STATUS_REG 0x34 #define TIMER_TM_INTR_MASK_REG 0x38 #define TIMER_TM_REVISION_REG 0x3C #define INTC_TIMER1_BIT_INDEX 0 #define TIMER1_UP_DOWN_COUNT (1<<9) #define TIMER2_UP_DOWN_COUNT (1<<10) #define TIMER1_MATCH1_INTR (1<<0) #define TIMER1_MATCH2_INTR (1<<1) #define TIMER1_OVERFLOW_INTR (1<<2) #define TIMER2_MATCH1_INTR (1<<3) #define TIMER2_MATCH2_INTR (1<<4) #define TIMER2_OVERFLOW_INTR (1<<5) #define TIMER_CLOCK_SOURCE_PCLK 0 #define TIMER_CLOCK_SOURCE_EXT_CLK 1 /* * define interrupt trigger mode */ #define INTC_LEVEL_TRIGGER 0 #define INTC_EDGE_TRIGGER 1 #define INTC_TRIGGER_UNKNOWN -1 #define TIMER1_OVERFLOW_INTERRUPT (1<<2) #define TIMER2_OVERFLOW_INTERRUPT (1<<5) #define TIMER_INTERRUPT_STATUS_REG 0x34 #define TIMER1_ENABLE (1<<0) #define TIMER1_CLOCK_SOURCE (1<<1) #define TIMER1_OVERFLOW_ENABLE (1<<2) #define TIMER2_ENABLE (1<<3) #define TIMER2_CLOCK_SOURCE (1<<4) #define TIMER2_OVERFLOW_ENABLE (1<<5) #define TIMER_1 1 #define EC_UART_CLOCK 14769200 #define EC_UART_REGSHIFT 2 #define SYSTEM_CLOCK 0x14 #define RESET_CONTROL 0x4 #define GLOBAL_RESET 0x1 #define NET_INTERFACE_RESET (0x1 << 4) #endif
/***************************************************************************** Copyright (c) 2014, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************** * Contents: Native middle-level C interface to LAPACK function clacp2 * Author: Intel Corporation * Generated January, 2013 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_clacp2_work( int matrix_layout, char uplo, lapack_int m, lapack_int n, const float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ) { lapack_int info = 0; if( matrix_layout == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_clacp2( &uplo, &m, &n, a, &lda, b, &ldb ); if( info < 0 ) { info = info - 1; } } else if( matrix_layout == LAPACK_ROW_MAJOR ) { lapack_int lda_t = MAX(1,m); lapack_int ldb_t = MAX(1,m); float* a_t = NULL; lapack_complex_float* b_t = NULL; /* Check leading dimension(s) */ if( lda < n ) { info = -6; LAPACKE_xerbla( "LAPACKE_clacp2_work", info ); return info; } if( ldb < n ) { info = -8; LAPACKE_xerbla( "LAPACKE_clacp2_work", info ); return info; } /* Allocate memory for temporary array(s) */ a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) ); if( a_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } b_t = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * ldb_t * MAX(1,n) ); if( b_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_1; } /* Transpose input matrices */ LAPACKE_sge_trans( matrix_layout, m, n, a, lda, a_t, lda_t ); /* Call LAPACK function and adjust info */ LAPACK_clacp2( &uplo, &m, &n, a_t, &lda_t, b_t, &ldb_t ); info = 0; /* LAPACK call is ok! */ /* Transpose output matrices */ LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb ); /* Release memory and exit */ LAPACKE_free( b_t ); exit_level_1: LAPACKE_free( a_t ); exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_clacp2_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_clacp2_work", info ); } return info; }
// Copyright 2015 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 MEDIA_FILTERS_LIBWEBM_MUXER_H_ #define MEDIA_FILTERS_LIBWEBM_MUXER_H_ #include <set> #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/numerics/safe_math.h" #include "base/strings/string_piece.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "media/base/media_export.h" #include "third_party/libwebm/source/mkvmuxer.hpp" #include "ui/gfx/geometry/size.h" namespace media { // Adapter class to manage a WebM container [1], a simplified version of a // Matroska container [2], composed of an EBML header, and a single Segment // including at least a Track Section and a number of SimpleBlocks each // containing a single encoded video frame. WebM container has no Trailer. // Clients will push encoded VPx video frames one by one via OnEncodedVideo() // with indication of the Track they belong to, and libwebm will eventually ping // the WriteDataCB passed on contructor with the wrapped encoded data. All // operations must happen in a single thread, where WebmMuxer is created and // destroyed. // [1] http://www.webmproject.org/docs/container/ // [2] http://www.matroska.org/technical/specs/index.html // TODO(mcasas): Add support for Audio muxing. class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) { public: // Callback to be called when WebmMuxer is ready to write a chunk of data, // either any file header or a SingleBlock. The chunk is described as a byte // array and a byte length. using WriteDataCB = base::Callback<void(const base::StringPiece&)>; explicit WebmMuxer(const WriteDataCB& write_data_callback); ~WebmMuxer() override; // Creates and adds a new video track. Called before receiving the first // frame of a given Track, adds |frame_size| and |frame_rate| to the Segment // info, although individual frames passed to OnEncodedVideo() can have any // frame size. Returns the track_index to be used for OnEncodedVideo(). uint64_t AddVideoTrack(const gfx::Size& frame_size, double frame_rate); // Adds a frame with |encoded_data.data()| to WebM Segment. |track_number| is // a caller-side identifier and must have been provided by AddVideoTrack(). // TODO(mcasas): Revisit how |encoded_data| is passed once the whole recording // chain is setup (http://crbug.com/262211). void OnEncodedVideo(uint64_t track_number, const base::StringPiece& encoded_data, base::TimeDelta timestamp, bool keyframe); private: friend class WebmMuxerTest; // IMkvWriter interface. mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; mkvmuxer::int64 Position() const override; mkvmuxer::int32 Position(mkvmuxer::int64 position) override; bool Seekable() const override; void ElementStartNotify(mkvmuxer::uint64 element_id, mkvmuxer::int64 position) override; // Used to DCHECK that we are called on the correct thread. base::ThreadChecker thread_checker_; // Callback to dump written data as being called by libwebm. const WriteDataCB write_data_callback_; // Rolling counter of the position in bytes of the written goo. base::CheckedNumeric<mkvmuxer::int64> position_; // The MkvMuxer active element. mkvmuxer::Segment segment_; DISALLOW_COPY_AND_ASSIGN(WebmMuxer); }; } // namespace media #endif // MEDIA_FILTERS_LIBWEBM_MUXER_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: FlashMap.c Abstract: Flash Map PPI GUID as defined in Tiano --*/ #include "Tiano.h" #include "Pei.h" #include EFI_PPI_DEFINITION (FlashMap) EFI_GUID gPeiFlashMapPpiGuid = PEI_FLASH_MAP_PPI_GUID; EFI_GUID_STRING(&gPeiFlashMapPpiGuid, "Flash Map", "Flash Map PPI");
// ACE configuration for building on top of the FACE Conformance Test Suite's // safety base replacement headers for libc and libstdc++. #ifndef ACE_MT_SAFE #define ACE_MT_SAFE 1 #endif #define ACE_EMULATE_POSIX_DEVCTL 0 #define ACE_HOSTENT_H_ADDR h_addr_list[0] #define ACE_PAGE_SIZE 4096 #define ACE_SIZEOF_FLOAT 4 #define ACE_SIZEOF_DOUBLE 8 #define ACE_SIZEOF_LONG_DOUBLE 16 #define ACE_SIZEOF_LONG 8 #define ACE_SIZEOF_LONG_LONG 8 #define ACE_THREAD_T_IS_A_STRUCT #define ACE_DEFAULT_SEM_KEY {} #define ACE_HAS_3_PARAM_READDIR_R #define ACE_HAS_CLOCK_GETTIME #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES #define ACE_HAS_DIRENT #define ACE_HAS_IPPORT_RESERVED #define ACE_HAS_MSG #define ACE_HAS_POSIX_TIME #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE #define ACE_HAS_PTHREADS #define ACE_HAS_OPAQUE_PTHREAD_T #define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SIGINFO_T #define ACE_HAS_SIGWAIT #define ACE_HAS_STRBUF_T #define ACE_HAS_STRERROR_R #define ACE_HAS_STRERROR_R_XSI #define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_THREADS 1 #define ACE_HAS_UCONTEXT_T #define ACE_LACKS_BSD_TYPES #define ACE_LACKS_CADDR_T #define ACE_LACKS_IFCONF #define ACE_LACKS_IFREQ #define ACE_LACKS_IP_MREQ #define ACE_LACKS_ISCTYPE #define ACE_LACKS_MEMORY_H #define ACE_LACKS_SELECT // safetyBase headers are missing select() #define ACE_LACKS_SETENV #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_SYS_IOCTL_H #define ACE_LACKS_SYS_PARAM_H #define ACE_LACKS_SYS_SYSCTL_H #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_UCONTEXT_H #define ACE_LACKS_UNSETENV #define ACE_LACKS_USECONDS_T #define ACE_HAS_NEW_THROW_SPEC #ifndef stdin # define stdin 0 #endif #ifndef stderr # define stderr 0 #endif #ifndef stdout # define stdout 0 #endif #define NSIG 32 #define NFDBITS 64 #define FD_ZERO(x) #define FD_SET(x, y) #define FD_CLR(x, y) #define FD_ISSET(x ,y) 0 #define ACE_FDS_BITS __0 typedef long fd_mask; #define FIONBIO 0x5421 typedef unsigned long uintptr_t; #define __FACE_CONFORM____PTRDIFF_T__ typedef long ptrdiff_t; #define __FACE_CONFORM____INTPTR_T__ typedef long intptr_t; #include "ace/config-posix.h" #include "ace/config-g++-common.h"
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * 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. * * * The names of its contributors may not 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. * */ #pragma once #include <pthread.h> struct gearman_server_thread_st { uint32_t con_count; uint32_t io_count; uint32_t proc_count; uint32_t to_be_freed_count; uint32_t free_con_count; uint32_t free_packet_count; gearmand_connection_list_st *gearman; gearman_server_thread_st *next; gearman_server_thread_st *prev; gearman_log_server_fn *log_fn; gearmand_thread_st *log_context; gearman_server_thread_run_fn *run_fn; void *run_fn_arg; gearman_server_con_st *con_list; gearman_server_con_st *io_list; gearman_server_con_st *proc_list; gearman_server_con_st *free_con_list; gearman_server_con_st *to_be_freed_list; gearman_server_packet_st *free_packet_list; gearmand_connection_list_st gearmand_connection_list_static; pthread_mutex_t lock; };
/* * Licensed Materials - Property of IBM * * trousers - An open source TCG Software Stack * * (C) Copyright International Business Machines Corp. 2004-2006 * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/mman.h> #include <errno.h> #include "trousers/tss.h" #include "trousers/trousers.h" #include "trousers_types.h" #include "trousers_types.h" #include "spi_utils.h" #include "capabilities.h" #include "tsplog.h" #include "obj.h" TSS_RESULT internal_GetCap(TSS_HCONTEXT tspContext, TSS_FLAG capArea, UINT32 subCap, UINT32 * respSize, BYTE ** respData) { UINT64 offset = 0; TSS_VERSION v = INTERNAL_CAP_VERSION; TSS_BOOL bValue = FALSE; UINT32 u32value = 0; switch (capArea) { case TSS_TSPCAP_VERSION: if ((*respData = calloc_tspi(tspContext, sizeof(TSS_VERSION))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(TSS_VERSION)); return TSPERR(TSS_E_OUTOFMEMORY); } Trspi_LoadBlob_TSS_VERSION(&offset, *respData, v); *respSize = offset; break; case TSS_TSPCAP_ALG: switch (subCap) { case TSS_ALG_RSA: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_RSA; break; case TSS_ALG_AES: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_AES; break; case TSS_ALG_SHA: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_SHA; break; case TSS_ALG_HMAC: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_HMAC; break; case TSS_ALG_DES: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_DES; break; case TSS_ALG_3DES: *respSize = sizeof(TSS_BOOL); bValue = INTERNAL_CAP_TSP_ALG_3DES; break; case TSS_ALG_DEFAULT: *respSize = sizeof(UINT32); u32value = INTERNAL_CAP_TSP_ALG_DEFAULT; break; case TSS_ALG_DEFAULT_SIZE: *respSize = sizeof(UINT32); u32value = INTERNAL_CAP_TSP_ALG_DEFAULT_SIZE; break; default: LogError("Unknown TSP subCap: %u", subCap); return TSPERR(TSS_E_BAD_PARAMETER); } if ((*respData = calloc_tspi(tspContext, *respSize)) == NULL) { LogError("malloc of %u bytes failed", *respSize); return TSPERR(TSS_E_OUTOFMEMORY); } if (*respSize == sizeof(TSS_BOOL)) *(TSS_BOOL *)respData = bValue; else *(UINT32 *)respData = u32value; break; case TSS_TSPCAP_PERSSTORAGE: if ((*respData = calloc_tspi(tspContext, sizeof(TSS_BOOL))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(TSS_BOOL)); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = sizeof(TSS_BOOL); (*respData)[0] = INTERNAL_CAP_TSP_PERSSTORAGE; break; case TSS_TSPCAP_RETURNVALUE_INFO: if (subCap != TSS_TSPCAP_PROP_RETURNVALUE_INFO) return TSPERR(TSS_E_BAD_PARAMETER); if ((*respData = calloc_tspi(tspContext, sizeof(UINT32))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(UINT32)); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = sizeof(UINT32); *(UINT32 *)(*respData) = INTERNAL_CAP_TSP_RETURNVALUE_INFO; break; case TSS_TSPCAP_PLATFORM_INFO: switch (subCap) { case TSS_TSPCAP_PLATFORM_TYPE: if ((*respData = calloc_tspi(tspContext, sizeof(UINT32))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(UINT32)); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = sizeof(UINT32); *(UINT32 *)(*respData) = INTERNAL_CAP_TSP_PLATFORM_TYPE; break; case TSS_TSPCAP_PLATFORM_VERSION: if ((*respData = calloc_tspi(tspContext, sizeof(UINT32))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(UINT32)); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = sizeof(UINT32); *(UINT32 *)(*respData) = INTERNAL_CAP_TSP_PLATFORM_VERSION; break; default: return TSPERR(TSS_E_BAD_PARAMETER); } break; case TSS_TSPCAP_MANUFACTURER: switch (subCap) { case TSS_TSPCAP_PROP_MANUFACTURER_ID: if ((*respData = calloc_tspi(tspContext, sizeof(UINT32))) == NULL) { LogError("malloc of %zd bytes failed", sizeof(UINT32)); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = sizeof(UINT32); *(UINT32 *)(*respData) = INTERNAL_CAP_MANUFACTURER_ID; break; case TSS_TSPCAP_PROP_MANUFACTURER_STR: { BYTE str[] = INTERNAL_CAP_MANUFACTURER_STR; if ((*respData = calloc_tspi(tspContext, INTERNAL_CAP_MANUFACTURER_STR_LEN)) == NULL) { LogError("malloc of %d bytes failed", INTERNAL_CAP_MANUFACTURER_STR_LEN); return TSPERR(TSS_E_OUTOFMEMORY); } *respSize = INTERNAL_CAP_MANUFACTURER_STR_LEN; memcpy(*respData, str, INTERNAL_CAP_MANUFACTURER_STR_LEN); break; } default: return TSPERR(TSS_E_BAD_PARAMETER); } break; default: return TSPERR(TSS_E_BAD_PARAMETER); } return TSS_SUCCESS; }
/** ****************************************************************************** * File Name : aos_pd_dma.h * Date : 15/05/2015 19:11:53 * Description : This file contains all the function prototypes for * the dma.c file ****************************************************************************** * * COPYRIGHT(c) 2015 STMicroelectronics * * 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 STMicroelectronics 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. * ****************************************************************************** */ /** ****************************************************************************** * Modified : 01/07/2016 * Version : 1.0 * Author : Asaad Kaadan * License : The MIT Open-source License (MIT). * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __aos_pd_dma_H #define __aos_pd_dma_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_hal.h" /* Check which DMA interrupt occured */ #define HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->ISR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) /* External variables --------------------------------------------------------*/ extern DMA_HandleTypeDef uplinkDMA1; extern DMA_HandleTypeDef uplinkDMA2; extern DMA_HandleTypeDef downlinkDMA1; extern DMA_HandleTypeDef downlinkDMA2; extern DMA_HandleTypeDef downlinkDMA3; /* External function prototypes ----------------------------------------------*/ extern void MX_DMA_Init(void); extern void DownlinkDMA1_Setup(UART_HandleTypeDef* huart, uint8_t num, uint8_t start); extern void DownlinkDMA2_Setup(UART_HandleTypeDef* huart, uint8_t num, uint8_t start); extern void DownlinkDMA3_Setup(UART_HandleTypeDef* huart, uint8_t num, uint8_t start); extern void UplinkDMA1_Setup(UART_HandleTypeDef* huartSrc, UART_HandleTypeDef* huartDst); extern void UplinkDMA2_Setup(UART_HandleTypeDef* huartSrc, UART_HandleTypeDef* huartDst); #ifdef __cplusplus } #endif #endif /* __aos_pd_dma_H */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2017 Damien P. George * * 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. */ #ifndef MICROPY_INCLUDED_STM32_PYBTHREAD_H #define MICROPY_INCLUDED_STM32_PYBTHREAD_H typedef struct _pyb_thread_t { void *sp; uint32_t local_state; void *arg; // thread Python args, a GC root pointer void *stack; // pointer to the stack size_t stack_len; // number of words in the stack uint32_t timeslice; struct _pyb_thread_t *all_next; struct _pyb_thread_t *run_prev; struct _pyb_thread_t *run_next; struct _pyb_thread_t *queue_next; } pyb_thread_t; typedef pyb_thread_t *pyb_mutex_t; extern volatile int pyb_thread_enabled; extern pyb_thread_t *volatile pyb_thread_all; extern pyb_thread_t *volatile pyb_thread_cur; void pyb_thread_init(pyb_thread_t *th); void pyb_thread_deinit(); uint32_t pyb_thread_new(pyb_thread_t *th, void *stack, size_t stack_len, void *entry, void *arg); void pyb_thread_dump(void); static inline uint32_t pyb_thread_get_id(void) { return (uint32_t)pyb_thread_cur; } static inline void pyb_thread_set_local(void *value) { pyb_thread_cur->local_state = (uint32_t)value; } static inline void *pyb_thread_get_local(void) { return (void*)pyb_thread_cur->local_state; } static inline void pyb_thread_yield(void) { if (pyb_thread_cur->run_next == pyb_thread_cur) { __WFI(); } else { SCB->ICSR = SCB_ICSR_PENDSVSET_Msk; } } void pyb_mutex_init(pyb_mutex_t *m); int pyb_mutex_lock(pyb_mutex_t *m, int wait); void pyb_mutex_unlock(pyb_mutex_t *m); #endif // MICROPY_INCLUDED_STM32_PYBTHREAD_H
// // This source file is part of appleseed. // Visit https://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization // // 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. // #pragma once // appleseed.foundation headers. #include "foundation/core/concepts/iunknown.h" #include "foundation/memory/autoreleaseptr.h" // appleseed.main headers. #include "main/dllsymbol.h" // Forward declarations. namespace foundation { class Dictionary; } namespace foundation { class DictionaryArray; } namespace foundation { class SearchPaths; } namespace renderer { class ParamArray; } namespace renderer { class Texture; } namespace renderer { // // Texture factory interface. // class APPLESEED_DLLSYMBOL ITextureFactory : public foundation::IUnknown { public: // Return a string identifying this texture model. virtual const char* get_model() const = 0; // Return metadata for this texture model. virtual foundation::Dictionary get_model_metadata() const = 0; // Return metadata for the inputs of this texture model. virtual foundation::DictionaryArray get_input_metadata() const = 0; // Create a new texture instance. virtual foundation::auto_release_ptr<Texture> create( const char* name, const ParamArray& params, const foundation::SearchPaths& search_paths) const = 0; }; } // namespace renderer
/***************************************************************************** $Id$ File: project.h Date: 06Apr06 Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. Gmail: blackhedd This program is free software; you can redistribute it and/or modify it under the terms of either: 1) 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; or 2) Ruby's License. See the file COPYING for complete licensing information. *****************************************************************************/ #ifndef __Project__H_ #define __Project__H_ #ifdef OS_WIN32 #pragma warning(disable:4786) #endif #include <iostream> #include <map> #include <set> #include <vector> #include <deque> #include <string> #include <sstream> #include <stdexcept> #ifdef OS_UNIX #include <signal.h> #include <netdb.h> #include <time.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> #include <sys/resource.h> #include <sys/wait.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <pwd.h> #include <string.h> typedef int SOCKET; #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #ifdef OS_SOLARIS8 #include <strings.h> #include <sys/un.h> #ifndef AF_LOCAL #define AF_LOCAL AF_UNIX #endif // INADDR_NONE is undefined on Solaris < 8. Thanks to Brett Eisenberg and Tim Pease. #ifndef INADDR_NONE #define INADDR_NONE ((unsigned long)-1) #endif #endif /* OS_SOLARIS8 */ #ifdef _AIX #include <strings.h> #ifndef AF_LOCAL #define AF_LOCAL AF_UNIX #endif #endif /* _AIX */ #ifdef OS_DARWIN #include <mach/mach.h> #include <mach/mach_time.h> #endif /* OS_DARWIN */ #endif /* OS_UNIX */ #ifdef OS_WIN32 // 21Sep09: windows limits select() to 64 sockets by default, we increase it to 1024 here (before including winsock2.h) // 18Jun12: fd_setsize must be changed in the ruby binary (not in this extension). redefining it also causes segvs, see eventmachine/eventmachine#333 //#define FD_SETSIZE 1024 // WIN32_LEAN_AND_MEAN excludes APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets. #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #include <rpc.h> #include <fcntl.h> #include <assert.h> // Use the Win32 wrapper library that Ruby owns to be able to close sockets with the close() function #define RUBY_EXPORT #include <ruby/defines.h> #include <ruby/win32.h> #endif /* OS_WIN32 */ #if !defined(_MSC_VER) || _MSC_VER > 1500 #include <stdint.h> #endif using namespace std; #ifdef WITH_SSL #include <openssl/ssl.h> #include <openssl/err.h> #endif #ifdef HAVE_EPOLL #include <sys/epoll.h> #endif #ifdef HAVE_KQUEUE #include <sys/event.h> #include <sys/queue.h> #endif #ifdef HAVE_INOTIFY #include <sys/inotify.h> #endif #ifdef HAVE_OLD_INOTIFY #include <sys/syscall.h> #include <linux/inotify.h> static inline int inotify_init (void) { return syscall (__NR_inotify_init); } static inline int inotify_add_watch (int fd, const char *name, __u32 mask) { return syscall (__NR_inotify_add_watch, fd, name, mask); } static inline int inotify_rm_watch (int fd, __u32 wd) { return syscall (__NR_inotify_rm_watch, fd, wd); } #define HAVE_INOTIFY 1 #endif #ifdef HAVE_INOTIFY #define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event)) #endif #ifdef HAVE_WRITEV #include <sys/uio.h> #endif #if __cplusplus extern "C" { #endif typedef void (*EMCallback)(const unsigned long, int, const char*, const unsigned long); #if __cplusplus } #endif #include "binder.h" #include "em.h" #include "ed.h" #include "page.h" #include "ssl.h" #include "eventmachine.h" #endif // __Project__H_
/* * (C) Copyright 2016 Rockchip Electronics Co., Ltd * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #define ROCKCHIP_DEVICE_SETTINGS \ "stdin=serial,cros-ec-keyb\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" #include <configs/rk3288_common.h> #define CONFIG_SYS_MMC_ENV_DEV 0 #endif
/** * BlueCove - Java library for Bluetooth * Copyright (C) 2007-2008 Vlad Skarzhevskyy * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF 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. * * @version $Id: OSXStackSDPQuery.h 2416 2008-10-09 17:59:55Z skarzhevskyy $ */ #import <Cocoa/Cocoa.h> #include "OSXStack.h" class StackSDPQueryStart: public Runnable { public: volatile BOOL complete; jlong address; CFAbsoluteTime startTime; volatile IOReturn status; volatile int recordsSize; IOBluetoothDeviceRef deviceRef; StackSDPQueryStart(); virtual void run(); void sdpQueryComplete(IOBluetoothDeviceRef deviceRef, IOReturn status); }; #define DATA_BLOB_MAX 0x4000 class GetAttributeDataElement: public Runnable { public: jlong address; jlong serviceRecordIndex; jint attrID; // To avoid memory allocation problem we return standard BLOB to Java thread. See com.intel.bluetooth.SDPInputStream int dataLen; UInt8 data[DATA_BLOB_MAX]; GetAttributeDataElement(); virtual void run(); void getData(const IOBluetoothSDPDataElementRef dataElement); }; class SDPOutputStream { public: CFMutableDataRef data; SDPOutputStream(); ~SDPOutputStream(); void write(const UInt8 byte); void write(const UInt8 *bytes, CFIndex length); void writeLong(UInt64 l, int size); BOOL writeElement(const IOBluetoothSDPDataElementRef dataElement); int getLength(const IOBluetoothSDPDataElementRef dataElement); void getBytes(int max, int* dataLen, UInt8* buf); };
/* * TLB shootdown specifics for powerpc * * Copyright (C) 2002 Anton Blanchard, IBM Corp. * Copyright (C) 2002 Paul Mackerras, IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _ASM_POWERPC_TLB_H #define _ASM_POWERPC_TLB_H #ifdef __KERNEL__ #ifndef __powerpc64__ #include <asm/pgtable.h> #endif #include <asm/pgalloc.h> #include <asm/tlbflush.h> #ifndef __powerpc64__ #include <asm/page.h> #include <asm/mmu.h> #endif #include <linux/pagemap.h> #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) #define HAVE_ARCH_MMU_GATHER 1 struct pte_freelist_batch; struct arch_mmu_gather { struct pte_freelist_batch *batch; }; #define ARCH_MMU_GATHER_INIT (struct arch_mmu_gather){ .batch = NULL, } extern void tlb_flush(struct mmu_gather *tlb); /* Get the generic bits... */ #include <asm-generic/tlb.h> extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long address); static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long address) { #ifdef CONFIG_PPC_STD_MMU_32 if (pte_val(*ptep) & _PAGE_HASHPTE) flush_hash_entry(tlb->mm, ptep, address); #endif } #endif /* __KERNEL__ */ #endif /* __ASM_POWERPC_TLB_H */
/* Copyright (C) 2007 Eric Seidel <eric@webkit.org> Copyright (C) 2008 Apple Inc. All Rights Reserved. This file is part of the WebKit project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SVGAnimateMotionElement_h #define SVGAnimateMotionElement_h #if ENABLE(SVG_ANIMATION) #include "SVGAnimationElement.h" #include "AffineTransform.h" #include "Path.h" namespace WebCore { class SVGAnimateMotionElement : public SVGAnimationElement { public: SVGAnimateMotionElement(const QualifiedName&, Document*); virtual ~SVGAnimateMotionElement(); virtual bool hasValidTarget() const; virtual void parseMappedAttribute(MappedAttribute*); private: virtual const SVGElement* contextElement() const { return this; } virtual void resetToBaseValue(const String&); virtual bool calculateFromAndToValues(const String& fromString, const String& toString); virtual bool calculateFromAndByValues(const String& fromString, const String& byString); virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement); virtual void applyResultsToTarget(); virtual float calculateDistance(const String& fromString, const String& toString); virtual Path animationPath() const; enum RotateMode { RotateAngle, RotateAuto, RotateAutoReverse }; RotateMode rotateMode() const; FloatSize m_animatedTranslation; float m_animatedAngle; // Note: we do not support percentage values for to/from coords as the spec implies we should (opera doesn't either) FloatPoint m_fromPoint; float m_fromAngle; FloatPoint m_toPoint; float m_toAngle; unsigned m_baseIndexInTransformList; Path m_path; Vector<float> m_keyPoints; float m_angle; }; } // namespace WebCore #endif // ENABLE(SVG_ANIMATION) #endif // SVGAnimateMotionElement_h // vim:ts=4:noet
/* V4L2 device support. Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl> 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 <linux/module.h> #include <linux/types.h> #include <linux/ioctl.h> #include <linux/i2c.h> #if defined(CONFIG_SPI) #include <linux/spi/spi.h> #endif #include <linux/videodev2.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) { if (v4l2_dev == NULL) return -EINVAL; INIT_LIST_HEAD(&v4l2_dev->subdevs); spin_lock_init(&v4l2_dev->lock); mutex_init(&v4l2_dev->ioctl_lock); v4l2_prio_init(&v4l2_dev->prio); kref_init(&v4l2_dev->ref); v4l2_dev->dev = dev; if (dev == NULL) { WARN_ON(!v4l2_dev->name[0]); return 0; } if (!v4l2_dev->name[0]) snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s", dev->driver->name, dev_name(dev)); if (!dev_get_drvdata(dev)) dev_set_drvdata(dev, v4l2_dev); return 0; } EXPORT_SYMBOL_GPL(v4l2_device_register); static void v4l2_device_release(struct kref *ref) { struct v4l2_device *v4l2_dev = container_of(ref, struct v4l2_device, ref); if (v4l2_dev->release) v4l2_dev->release(v4l2_dev); } int v4l2_device_put(struct v4l2_device *v4l2_dev) { return kref_put(&v4l2_dev->ref, v4l2_device_release); } EXPORT_SYMBOL_GPL(v4l2_device_put); int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename, atomic_t *instance) { int num = atomic_inc_return(instance) - 1; int len = strlen(basename); if (basename[len - 1] >= '0' && basename[len - 1] <= '9') snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s-%d", basename, num); else snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s%d", basename, num); return num; } EXPORT_SYMBOL_GPL(v4l2_device_set_name); void v4l2_device_disconnect(struct v4l2_device *v4l2_dev) { if (v4l2_dev->dev == NULL) return; if (dev_get_drvdata(v4l2_dev->dev) == v4l2_dev) dev_set_drvdata(v4l2_dev->dev, NULL); v4l2_dev->dev = NULL; } EXPORT_SYMBOL_GPL(v4l2_device_disconnect); void v4l2_device_unregister(struct v4l2_device *v4l2_dev) { struct v4l2_subdev *sd, *next; if (v4l2_dev == NULL) return; v4l2_device_disconnect(v4l2_dev); list_for_each_entry_safe(sd, next, &v4l2_dev->subdevs, list) { v4l2_device_unregister_subdev(sd); #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) if (sd->flags & V4L2_SUBDEV_FL_IS_I2C) { struct i2c_client *client = v4l2_get_subdevdata(sd); if (client) i2c_unregister_device(client); continue; } #endif #if defined(CONFIG_SPI) if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) { struct spi_device *spi = v4l2_get_subdevdata(sd); if (spi) spi_unregister_device(spi); continue; } #endif } } EXPORT_SYMBOL_GPL(v4l2_device_unregister); int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, struct v4l2_subdev *sd) { #if defined(CONFIG_MEDIA_CONTROLLER) struct media_entity *entity = &sd->entity; #endif int err; if (v4l2_dev == NULL || sd == NULL || !sd->name[0]) return -EINVAL; WARN_ON(sd->v4l2_dev != NULL); if (!try_module_get(sd->owner)) return -ENODEV; sd->v4l2_dev = v4l2_dev; if (sd->internal_ops && sd->internal_ops->registered) { err = sd->internal_ops->registered(sd); if (err) goto error_module; } err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler); if (err) goto error_unregister; #if defined(CONFIG_MEDIA_CONTROLLER) /* Register the entity. */ if (v4l2_dev->mdev) { err = media_device_register_entity(v4l2_dev->mdev, entity); if (err < 0) goto error_unregister; } #endif #if defined(CONFIG_MACH_DELUXE_J) if (v4l2_dev->subdevs.prev == NULL) return -EINVAL; #endif spin_lock(&v4l2_dev->lock); list_add_tail(&sd->list, &v4l2_dev->subdevs); spin_unlock(&v4l2_dev->lock); return 0; error_unregister: if (sd->internal_ops && sd->internal_ops->unregistered) sd->internal_ops->unregistered(sd); error_module: module_put(sd->owner); sd->v4l2_dev = NULL; return err; } EXPORT_SYMBOL_GPL(v4l2_device_register_subdev); int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) { struct video_device *vdev; struct v4l2_subdev *sd; int err; list_for_each_entry(sd, &v4l2_dev->subdevs, list) { if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE)) continue; vdev = &sd->devnode; strlcpy(vdev->name, sd->name, sizeof(vdev->name)); vdev->v4l2_dev = v4l2_dev; vdev->fops = &v4l2_subdev_fops; vdev->release = video_device_release_empty; err = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1, sd->owner); if (err < 0) return err; #if defined(CONFIG_MEDIA_CONTROLLER) sd->entity.v4l.major = VIDEO_MAJOR; sd->entity.v4l.minor = vdev->minor; #endif } return 0; } EXPORT_SYMBOL_GPL(v4l2_device_register_subdev_nodes); void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) { struct v4l2_device *v4l2_dev; if (sd == NULL || sd->v4l2_dev == NULL) return; v4l2_dev = sd->v4l2_dev; spin_lock(&v4l2_dev->lock); list_del(&sd->list); spin_unlock(&v4l2_dev->lock); if (sd->internal_ops && sd->internal_ops->unregistered) sd->internal_ops->unregistered(sd); sd->v4l2_dev = NULL; #if defined(CONFIG_MEDIA_CONTROLLER) if (v4l2_dev->mdev) media_device_unregister_entity(&sd->entity); #endif video_unregister_device(&sd->devnode); module_put(sd->owner); } EXPORT_SYMBOL_GPL(v4l2_device_unregister_subdev);
/* * This file is part of the coreboot project. * * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org> * Copyright (C) 2013 Vladimir Serbinenko <phcoder@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; version 2 of * the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA */ #define __SIMPLE_DEVICE__ #include <console/console.h> #include <arch/io.h> #include <device/device.h> #include <device/pci.h> #include <delay.h> #include "dock.h" #include "southbridge/intel/i82801ix/i82801ix.h" #include "ec/lenovo/h8/h8.h" #include <ec/acpi/ec.h> #define LPC_DEV PCI_DEV(0, 0x1f, 0) void h8_mainboard_init_dock (void) { if (dock_present()) { printk(BIOS_DEBUG, "dock is connected\n"); dock_connect(); } else printk(BIOS_DEBUG, "dock is not connected\n"); } void dock_connect(void) { u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc; ec_set_bit(0x02, 0); outl(inl(gpiobase + 0x0c) | (1 << 28), gpiobase + 0x0c); } void dock_disconnect(void) { u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc; ec_clr_bit(0x02, 0); outl(inl(gpiobase + 0x0c) & ~(1 << 28), gpiobase + 0x0c); } int dock_present(void) { u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc; u8 st = inb(gpiobase + 0x0c); return ((st >> 2) & 7) != 7; }
/* * This file is part of the coreboot project. * * Copyright (C) 2014 Edward O'Callaghan <eocallaghan@alterapraxis.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SUPERIO_FINTEK_COMMON_ROMSTAGE_H #define SUPERIO_FINTEK_COMMON_ROMSTAGE_H #include <arch/io.h> #include <stdint.h> void fintek_enable_serial(device_t dev, u16 iobase); #endif /* SUPERIO_FINTEK_COMMON_ROMSTAGE_H */
/* $NoKeywords:$ */ /** * @file * * Config Hudson2 SD Controller * * Init SD Controller. * * @xrefitem bom "File Content Label" "Release Content" * @e project: AGESA * @e sub-project: FCH * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $ * */ /* ***************************************************************************** * * Copyright 2008 - 2012 ADVANCED MICRO DEVICES, INC. All Rights Reserved. * * AMD is granting you permission to use this software (the Materials) * pursuant to the terms and conditions of your Software License Agreement * with AMD. This header does *NOT* give you permission to use the Materials * or any rights under AMD's intellectual property. Your use of any portion * of these Materials shall constitute your acceptance of those terms and * conditions. If you do not agree to the terms and conditions of the Software * License Agreement, please do not use any portion of these Materials. * * CONFIDENTIALITY: The Materials and all other information, identified as * confidential and provided to you by AMD shall be kept confidential in * accordance with the terms and conditions of the Software License Agreement. * * LIMITATION OF LIABILITY: THE MATERIALS AND ANY OTHER RELATED INFORMATION * PROVIDED TO YOU BY AMD ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY OF ANY KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF * MERCHANTABILITY, NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE, * OR WARRANTIES ARISING FROM CONDUCT, COURSE OF DEALING, OR USAGE OF TRADE. * IN NO EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER * (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS * INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF AMD'S NEGLIGENCE, * GROSS NEGLIGENCE, THE USE OF OR INABILITY TO USE THE MATERIALS OR ANY OTHER * RELATED INFORMATION PROVIDED TO YOU BY AMD, EVEN IF AMD HAS BEEN ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE * EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, * THE ABOVE LIMITATION MAY NOT APPLY TO YOU. * * AMD does not assume any responsibility for any errors which may appear in * the Materials or any other related information provided to you by AMD, or * result from use of the Materials or any related information. * * You agree that you will not reverse engineer or decompile the Materials. * * NO SUPPORT OBLIGATION: AMD is not obligated to furnish, support, or make any * further information, software, technical information, know-how, or show-how * available to you. Additionally, AMD retains the right to modify the * Materials at any time, without notice, and is not obligated to provide such * modified Materials to you. * * U.S. GOVERNMENT RESTRICTED RIGHTS: The Materials are provided with * "RESTRICTED RIGHTS." Use, duplication, or disclosure by the Government is * subject to the restrictions as set forth in FAR 52.227-14 and * DFAR252.227-7013, et seq., or its successor. Use of the Materials by the * Government constitutes acknowledgement of AMD's proprietary rights in them. * * EXPORT ASSURANCE: You agree and certify that neither the Materials, nor any * direct product thereof will be exported directly or indirectly, into any * country prohibited by the United States Export Administration Act and the * regulations thereunder, without the required authorization from the U.S. * government nor will be used for any purpose prohibited by the same. **************************************************************************** */ #include "FchPlatform.h" #include "Filecode.h" #define FILECODE PROC_FCH_SD_FAMILY_HUDSON2_HUDSON2SDRESETSERVICE_FILECODE
/* * (C) Copyright 2010,2011 * NVIDIA Corporation <www.nvidia.com> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #include <linux/sizes.h> /* LP0 suspend / resume */ #define CONFIG_TEGRA_LP0 #define CONFIG_AES #define CONFIG_TEGRA_PMU #define CONFIG_TPS6586X_POWER #define CONFIG_TEGRA_CLOCK_SCALING #include "tegra20-common.h" /* High-level configuration options */ #define V_PROMPT "Tegra20 (SeaBoard) # " #define CONFIG_TEGRA_BOARD_STRING "NVIDIA Seaboard" /* Board-specific serial config */ #define CONFIG_TEGRA_ENABLE_UARTD #define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTD_BASE /* On Seaboard: GPIO_PI3 = Port I = 8, bit = 3 */ #define CONFIG_UART_DISABLE_GPIO GPIO_PI3 #define CONFIG_MACH_TYPE MACH_TYPE_SEABOARD #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_BOARD_LATE_INIT /* Make sure LCD init is complete */ /* I2C */ #define CONFIG_SYS_I2C_TEGRA #define CONFIG_CMD_I2C /* SD/MMC */ #define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_TEGRA_MMC #define CONFIG_CMD_MMC /* Environment in eMMC, at the end of 2nd "boot sector" */ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE) #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_SYS_MMC_ENV_PART 2 /* USB Host support */ #define CONFIG_USB_MAX_CONTROLLER_COUNT 3 #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_TEGRA #define CONFIG_USB_STORAGE #define CONFIG_CMD_USB /* USB networking support */ #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX /* General networking support */ #define CONFIG_CMD_NET #define CONFIG_CMD_DHCP /* Enable keyboard */ #define CONFIG_TEGRA_KEYBOARD #define CONFIG_KEYBOARD /* USB keyboard */ #define CONFIG_USB_KEYBOARD /* LCD support */ #define CONFIG_LCD #define CONFIG_PWM_TEGRA #define CONFIG_VIDEO_TEGRA #define LCD_BPP LCD_COLOR16 #define CONFIG_SYS_WHITE_ON_BLACK #define CONFIG_CONSOLE_SCROLL_LINES 10 /* NAND support */ #define CONFIG_CMD_NAND #define CONFIG_TEGRA_NAND /* Max number of NAND devices */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 #include "tegra-common-post.h" #endif /* __CONFIG_H */
/* * Atheros AR71xx built-in ethernet mac driver * * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> * * Based on Atheros' AG7100 driver * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include "ag71xx.h" static void ag71xx_phy_link_adjust(struct net_device *dev) { struct ag71xx *ag = netdev_priv(dev); struct phy_device *phydev = ag->phy_dev; unsigned long flags; int status_change = 0; spin_lock_irqsave(&ag->lock, flags); if (phydev->link) { if (ag->duplex != phydev->duplex || ag->speed != phydev->speed) { status_change = 1; } } if (phydev->link != ag->link) status_change = 1; ag->link = phydev->link; ag->duplex = phydev->duplex; ag->speed = phydev->speed; if (status_change) ag71xx_link_adjust(ag); spin_unlock_irqrestore(&ag->lock, flags); } void ag71xx_phy_start(struct ag71xx *ag) { struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); if (ag->phy_dev) { phy_start(ag->phy_dev); } else if (pdata->mii_bus_dev && pdata->switch_data) { ag71xx_ar7240_start(ag); } else { ag->link = 1; ag71xx_link_adjust(ag); } } void ag71xx_phy_stop(struct ag71xx *ag) { struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); unsigned long flags; if (ag->phy_dev) phy_stop(ag->phy_dev); else if (pdata->mii_bus_dev && pdata->switch_data) ag71xx_ar7240_stop(ag); spin_lock_irqsave(&ag->lock, flags); if (ag->link) { ag->link = 0; ag71xx_link_adjust(ag); } spin_unlock_irqrestore(&ag->lock, flags); } static int ag71xx_phy_connect_fixed(struct ag71xx *ag) { struct net_device *dev = ag->dev; struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); int ret = 0; /* use fixed settings */ switch (pdata->speed) { case SPEED_10: case SPEED_100: case SPEED_1000: break; default: netdev_err(dev, "invalid speed specified\n"); ret = -EINVAL; break; } netdev_dbg(dev, "using fixed link parameters\n"); ag->duplex = pdata->duplex; ag->speed = pdata->speed; return ret; } static int ag71xx_phy_connect_multi(struct ag71xx *ag) { struct net_device *dev = ag->dev; struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); struct phy_device *phydev = NULL; int phy_addr; int ret = 0; for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { if (!(pdata->phy_mask & (1 << phy_addr))) continue; if (ag->mii_bus->phy_map[phy_addr] == NULL) continue; DBG("%s: PHY found at %s, uid=%08x\n", dev->name, dev_name(&ag->mii_bus->phy_map[phy_addr]->dev), ag->mii_bus->phy_map[phy_addr]->phy_id); if (phydev == NULL) phydev = ag->mii_bus->phy_map[phy_addr]; } if (!phydev) { netdev_err(dev, "no PHY found with phy_mask=%08x\n", pdata->phy_mask); return -ENODEV; } ag->phy_dev = phy_connect(dev, dev_name(&phydev->dev), &ag71xx_phy_link_adjust, 0, pdata->phy_if_mode); if (IS_ERR(ag->phy_dev)) { netdev_err(dev, "could not connect to PHY at %s\n", dev_name(&phydev->dev)); return PTR_ERR(ag->phy_dev); } /* mask with MAC supported features */ if (pdata->has_gbit) phydev->supported &= PHY_GBIT_FEATURES; else phydev->supported &= PHY_BASIC_FEATURES; phydev->advertising = phydev->supported; netdev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", dev_name(&phydev->dev), phydev->phy_id, phydev->drv->name); ag->link = 0; ag->speed = 0; ag->duplex = -1; return ret; } static int dev_is_class(struct device *dev, void *class) { if (dev->class != NULL && !strcmp(dev->class->name, class)) return 1; return 0; } static struct device *dev_find_class(struct device *parent, char *class) { if (dev_is_class(parent, class)) { get_device(parent); return parent; } return device_find_child(parent, class, dev_is_class); } static struct mii_bus *dev_to_mii_bus(struct device *dev) { struct device *d; d = dev_find_class(dev, "mdio_bus"); if (d != NULL) { struct mii_bus *bus; bus = to_mii_bus(d); put_device(d); return bus; } return NULL; } int __devinit ag71xx_phy_connect(struct ag71xx *ag) { struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); if (pdata->mii_bus_dev == NULL || pdata->mii_bus_dev->bus == NULL ) return ag71xx_phy_connect_fixed(ag); ag->mii_bus = dev_to_mii_bus(pdata->mii_bus_dev); if (ag->mii_bus == NULL) { netdev_err(ag->dev, "unable to find MII bus on device '%s'\n", dev_name(pdata->mii_bus_dev)); return -ENODEV; } /* Reset the mdio bus explicitly */ if (ag->mii_bus->reset) { mutex_lock(&ag->mii_bus->mdio_lock); ag->mii_bus->reset(ag->mii_bus); mutex_unlock(&ag->mii_bus->mdio_lock); } if (pdata->switch_data) return ag71xx_ar7240_init(ag); if (pdata->phy_mask) return ag71xx_phy_connect_multi(ag); return ag71xx_phy_connect_fixed(ag); } void ag71xx_phy_disconnect(struct ag71xx *ag) { struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); if (pdata->switch_data) ag71xx_ar7240_cleanup(ag); else if (ag->phy_dev) phy_disconnect(ag->phy_dev); }
#ifndef _DIRENT_H # include <dirstream.h> # include <dirent/dirent.h> # include <sys/stat.h> # include <stdbool.h> struct scandir_cancel_struct { DIR *dp; void *v; size_t cnt; }; /* Now define the internal interfaces. */ extern DIR *__opendir (__const char *__name); extern DIR *__opendirat (int dfd, __const char *__name) internal_function; extern DIR *__fdopendir (int __fd); extern int __closedir (DIR *__dirp); extern struct dirent *__readdir (DIR *__dirp); extern struct dirent64 *__readdir64 (DIR *__dirp); extern int __readdir_r (DIR *__dirp, struct dirent *__entry, struct dirent **__result); extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry, struct dirent64 **__result); extern int __scandir64 (__const char * __dir, struct dirent64 *** __namelist, int (*__selector) (__const struct dirent64 *), int (*__cmp) (__const struct dirent64 **, __const struct dirent64 **)); extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes) internal_function; extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes) internal_function; extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b) __attribute_pure__; extern int __versionsort64 (const struct dirent64 **a, const struct dirent64 **b) __attribute_pure__; extern DIR *__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp) internal_function; extern void __scandir_cancel_handler (void *arg); libc_hidden_proto (rewinddir) libc_hidden_proto (scandirat) libc_hidden_proto (scandirat64) #endif
/* * COPYRIGHT (c) 2013 Andrey Mozzhuhin * * 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. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <sys/statvfs.h> #include <string.h> #include <fcntl.h> #include "fstest.h" #include "pmacros.h" static void statvfs_validate(struct statvfs *stat) { rtems_test_assert(stat->f_bsize > 0); rtems_test_assert(stat->f_frsize > 0); rtems_test_assert(stat->f_blocks > 0); rtems_test_assert(stat->f_bfree <= stat->f_blocks); rtems_test_assert(stat->f_bavail <= stat->f_blocks); rtems_test_assert(stat->f_ffree <= stat->f_files); rtems_test_assert(stat->f_favail <= stat->f_files); rtems_test_assert(stat->f_namemax > 0); } static void statvfs_test01(void) { struct statvfs statbuf1, statbuf2; int status; int fd; ssize_t n; const char *databuf = "STATVFS"; int datalen = strlen(databuf); const char *filename = __func__; /* * Get current filesystem statistics */ status = statvfs("/", &statbuf1); rtems_test_assert(status == 0); statvfs_validate(&statbuf1); /* * Create one file */ fd = open(filename, O_CREAT | O_WRONLY, 0775); rtems_test_assert(fd >= 0); n = write(fd, databuf, datalen); rtems_test_assert(n == datalen); status = close(fd); rtems_test_assert(status == 0); /* * Get new filesystem statistics */ status = statvfs("/", &statbuf2); rtems_test_assert(status == 0); statvfs_validate(&statbuf2); /* * Compare old and new statistics */ rtems_test_assert(statbuf1.f_bsize == statbuf2.f_bsize); rtems_test_assert(statbuf1.f_frsize == statbuf2.f_frsize); rtems_test_assert(statbuf1.f_blocks == statbuf2.f_blocks); rtems_test_assert(statbuf1.f_bfree >= statbuf2.f_bfree); rtems_test_assert(statbuf1.f_bavail >= statbuf2.f_bavail); rtems_test_assert(statbuf1.f_ffree >= statbuf2.f_ffree); rtems_test_assert(statbuf1.f_favail >= statbuf2.f_favail); rtems_test_assert(statbuf1.f_namemax == statbuf2.f_namemax); } /* * These tests only get time_t value, and test * if they are changed. Thest tests don't check atime */ void test(void) { puts( "\n\n*** STATVFS TEST ***"); statvfs_test01(); puts( "*** END OF TEST STATVFS ***"); }
/* * Copyright (C) 2011 XiaoMi, Inc. * * 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. * */ #include <linux/i2c.h> #include <linux/input.h> #include <linux/module.h> #include "ft5x06_ts.h" static int ft5x06_i2c_recv(struct device *dev, void *buf, int len) { struct i2c_client *client = to_i2c_client(dev); int count = i2c_master_recv(client, buf, len); return count < 0 ? count : 0; } static int ft5x06_i2c_send(struct device *dev, const void *buf, int len) { struct i2c_client *client = to_i2c_client(dev); int count = i2c_master_send(client, buf, len); return count < 0 ? count : 0; } static int ft5x06_i2c_read(struct device *dev, u8 addr, void *buf, u8 len) { struct i2c_client *client = to_i2c_client(dev); int i, count = 0; for (i = 0; i < len; i += count) { count = i2c_smbus_read_i2c_block_data( client, addr + i, len - i, buf + i); if (count < 0) break; } return count < 0 ? count : 0; } static int ft5x06_i2c_write(struct device *dev, u8 addr, const void *buf, u8 len) { struct i2c_client *client = to_i2c_client(dev); int i, error = 0; for (i = 0; i < len; i += I2C_SMBUS_BLOCK_MAX) { /* transfer at most I2C_SMBUS_BLOCK_MAX one time */ error = i2c_smbus_write_i2c_block_data( client, addr + i, len - i, buf + i); if (error) break; } return error; } static const struct ft5x06_bus_ops ft5x06_i2c_bops = { .bustype = BUS_I2C, .recv = ft5x06_i2c_recv, .send = ft5x06_i2c_send, .read = ft5x06_i2c_read, .write = ft5x06_i2c_write, }; #if defined(CONFIG_PM) && !defined(CONFIG_HAS_EARLYSUSPEND) static int ft5x06_i2c_suspend(struct device *dev) { return ft5x06_suspend(dev_get_drvdata(dev)); } static int ft5x06_i2c_resume(struct device *dev) { return ft5x06_resume(dev_get_drvdata(dev)); } static const struct dev_pm_ops ft5x06_i2c_pm_ops = { .suspend = ft5x06_i2c_suspend, .resume = ft5x06_i2c_resume, }; #endif static int __devinit ft5x06_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct ft5x06_data *ft5x06; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { dev_err(&client->dev, "incompatible i2c adapter."); return -ENODEV; } ft5x06 = ft5x06_probe(&client->dev, &ft5x06_i2c_bops); if (IS_ERR(ft5x06)) return PTR_ERR(ft5x06); i2c_set_clientdata(client, ft5x06); return 0; } static int __devexit ft5x06_i2c_remove(struct i2c_client *client) { struct ft5x06_data *ft5x0x = i2c_get_clientdata(client); ft5x06_remove(ft5x0x); return 0; } static const struct i2c_device_id ft5x06_i2c_id[] = { {"ft5x06_i2c", 0}, {/* end list */} }; MODULE_DEVICE_TABLE(i2c, ft5x0x_i2c_id); static struct i2c_driver ft5x06_i2c_driver = { .probe = ft5x06_i2c_probe, .remove = __devexit_p(ft5x06_i2c_remove), .driver = { .name = "ft5x06_i2c", .owner = THIS_MODULE, #if defined(CONFIG_PM) && !defined(CONFIG_HAS_EARLYSUSPEND) .pm = &ft5x06_i2c_pm_ops, #endif }, .id_table = ft5x06_i2c_id, }; static int __init ft5x06_i2c_init(void) { printk(KERN_ERR "ft5x06_i2c_init\n"); return i2c_add_driver(&ft5x06_i2c_driver); } module_init(ft5x06_i2c_init); static void __exit ft5x06_i2c_exit(void) { i2c_del_driver(&ft5x06_i2c_driver); } module_exit(ft5x06_i2c_exit); MODULE_ALIAS("i2c:ft5x06_i2c"); MODULE_AUTHOR("ZhangBo <zhangbo_a@xiaomi.com>"); MODULE_DESCRIPTION("i2c driver for ft5x06 touchscreen"); MODULE_LICENSE("GPL");
/* Copyright 2010-2011 Freescale Semiconductor, Inc. * * 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 Freescale Semiconductor nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * * ALTERNATIVELY, this software may be distributed under the terms of the * GNU General Public License ("GPL") as published by the Free Software * Foundation, either version 2 of that License or (at your option) any * later version. * * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor 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. */ #include <linux/module.h> #include <linux/fsl_bman.h> #include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/uaccess.h> static struct dentry *dfs_root; /* debugfs root directory */ /******************************************************************************* * Query Buffer Pool State ******************************************************************************/ static int query_bp_state_show(struct seq_file *file, void *offset) { int ret; struct bm_pool_state state; int i, j; u32 mask; memset(&state, 0, sizeof(struct bm_pool_state)); ret = bman_query_pools(&state); if (ret) { seq_printf(file, "Error %d\n", ret); return 0; } seq_printf(file, "bp_id free_buffers_avail bp_depleted\n"); for (i = 0; i < 2; i++) { mask = 0x80000000; for (j = 0; j < 32; j++) { seq_printf(file, " %-2u %-3s %-3s\n", (i*32)+j, (state.as.state.__state[i] & mask) ? "no" : "yes", (state.ds.state.__state[i] & mask) ? "yes" : "no"); mask >>= 1; } } return 0; } static int query_bp_state_open(struct inode *inode, struct file *file) { return single_open(file, query_bp_state_show, NULL); } static const struct file_operations query_bp_state_fops = { .owner = THIS_MODULE, .open = query_bp_state_open, .read = seq_read, .release = single_release, }; static int __init bman_debugfs_module_init(void) { int ret = 0; struct dentry *d; dfs_root = debugfs_create_dir("bman", NULL); if (dfs_root == NULL) { ret = -ENOMEM; pr_err("Cannot create bman debugfs dir\n"); goto _return; } d = debugfs_create_file("query_bp_state", S_IRUGO, dfs_root, NULL, &query_bp_state_fops); if (d == NULL) { ret = -ENOMEM; pr_err("Cannot create query_bp_state\n"); goto _return; } return 0; _return: if (dfs_root) debugfs_remove_recursive(dfs_root); return ret; } static void __exit bman_debugfs_module_exit(void) { debugfs_remove_recursive(dfs_root); } module_init(bman_debugfs_module_init); module_exit(bman_debugfs_module_exit); MODULE_LICENSE("Dual BSD/GPL");
/* * Copyright 2016 Facebook, 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. */ #pragma once #include <stdlib.h> #include <folly/Portability.h> extern "C" { #if FOLLY_HAVE_WEAK_SYMBOLS void* mallocx(size_t, int) __attribute__((__weak__)); void* rallocx(void*, size_t, int) __attribute__((__weak__)); size_t xallocx(void*, size_t, size_t, int) __attribute__((__weak__)); size_t sallocx(const void*, int) __attribute__((__weak__)); void dallocx(void*, int) __attribute__((__weak__)); void sdallocx(void*, size_t, int) __attribute__((__weak__)); size_t nallocx(size_t, int) __attribute__((__weak__)); int mallctl(const char*, void*, size_t*, void*, size_t) __attribute__((__weak__)); int mallctlnametomib(const char*, size_t*, size_t*) __attribute__((__weak__)); int mallctlbymib(const size_t*, size_t, void*, size_t*, void*, size_t) __attribute__((__weak__)); #else extern void* (*mallocx)(size_t, int); extern void* (*rallocx)(void*, size_t, int); extern size_t (*xallocx)(void*, size_t, size_t, int); extern size_t (*sallocx)(const void*, int); extern void (*dallocx)(void*, int); extern void (*sdallocx)(void*, size_t, int); extern size_t (*nallocx)(size_t, int); extern int (*mallctl)(const char*, void*, size_t*, void*, size_t); extern int (*mallctlnametomib)(const char*, size_t*, size_t*); extern int (*mallctlbymib)(const size_t*, size_t, void*, size_t*, void*, size_t); #ifdef _MSC_VER // We emulate weak linkage for MSVC. The symbols we're // aliasing to are hiding in MallocImpl.cpp #pragma comment(linker, "/alternatename:mallocx=mallocxWeak") #pragma comment(linker, "/alternatename:rallocx=rallocxWeak") #pragma comment(linker, "/alternatename:xallocx=xallocxWeak") #pragma comment(linker, "/alternatename:sallocx=sallocxWeak") #pragma comment(linker, "/alternatename:dallocx=dallocxWeak") #pragma comment(linker, "/alternatename:sdallocx=sdallocxWeak") #pragma comment(linker, "/alternatename:nallocx=nallocxWeak") #pragma comment(linker, "/alternatename:mallctl=mallctlWeak") #pragma comment(linker, "/alternatename:mallctlnametomib=mallctlnametomibWeak") #pragma comment(linker, "/alternatename:mallctlbymib=mallctlbymibWeak") #endif #endif }
// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2011-2012, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ #ifndef __TZGNAMES_H #define __TZGNAMES_H /** * \file * \brief C API: Time zone generic names classe */ #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #include "unicode/locid.h" #include "unicode/unistr.h" #include "unicode/tzfmt.h" #include "unicode/tznames.h" U_CDECL_BEGIN typedef enum UTimeZoneGenericNameType { UTZGNM_UNKNOWN = 0x00, UTZGNM_LOCATION = 0x01, UTZGNM_LONG = 0x02, UTZGNM_SHORT = 0x04 } UTimeZoneGenericNameType; U_CDECL_END U_NAMESPACE_BEGIN class TimeZone; struct TZGNCoreRef; class U_I18N_API TimeZoneGenericNames : public UMemory { public: virtual ~TimeZoneGenericNames(); static TimeZoneGenericNames* createInstance(const Locale& locale, UErrorCode& status); virtual UBool operator==(const TimeZoneGenericNames& other) const; virtual UBool operator!=(const TimeZoneGenericNames& other) const {return !operator==(other);}; virtual TimeZoneGenericNames* clone() const; UnicodeString& getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type, UDate date, UnicodeString& name) const; UnicodeString& getGenericLocationName(const UnicodeString& tzCanonicalID, UnicodeString& name) const; int32_t findBestMatch(const UnicodeString& text, int32_t start, uint32_t types, UnicodeString& tzID, UTimeZoneFormatTimeType& timeType, UErrorCode& status) const; private: TimeZoneGenericNames(); TZGNCoreRef* fRef; }; U_NAMESPACE_END #endif #endif
/* Copyright (C) 2007,2008 Richard Quirk This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef HtmlDocument_h_seen #define HtmlDocument_h_seen #include "HtmlParser.h" #include "ElementList.h" class Bookmark; /** Parse the HTML tokens after the tokenisation phase. */ class HtmlDocument : public HtmlParser { public: //! Constructor. HtmlDocument(); //! Destructor. ~HtmlDocument(); /** Get the data contents. * @return reference to the data. */ inline const std::string & data() const; /** Get the current amount of data retrieved. * @return amount of data retrieved. */ inline unsigned int dataGot() const; /** Set the amount of data. Used for chunked content that does not set the content-length header. * @param value the new amount of data retrieved (0?) */ inline void setDataGot(unsigned int value); /** Reset the internal state of the parser. */ void reset(); /** Get the root node of the document model. * @return The root node. */ const HtmlElement * rootNode() const; void dumpDOM(); void dumpAF(); void handleEOF(); protected: virtual void handleStartEndTag(const std::string & tag, const AttributeVector & attrs); virtual void handleStartTag(const std::string & tag, const AttributeVector & attrs); virtual void handleEndTag(const std::string & tag); virtual void handleData(unsigned int ucodeChar); virtual void handleBinaryData(const void * data, unsigned int length); private: enum TreeState { INITIAL, ROOT_ELEMENT, MAIN, MAIN_WAITING_TOKEN, TEXTAREA_WAITING_TOKEN, TRAILING_END }; enum InsertionMode { BEFORE_HEAD, IN_HEAD, AFTER_HEAD, IN_BODY, IN_TABLE, IN_CAPTION, IN_COLUMN_GROUP, IN_TABLE_BODY, IN_ROW, IN_CELL, IN_SELECT, AFTER_BODY, IN_FRAMESET, AFTER_FRAMESET }; std::string m_data; unsigned int m_dataGot; TreeState m_state; InsertionMode m_insertionMode; bool m_isFirst; typedef std::vector<HtmlElement*> ElementVector; ElementVector m_openElements; // things are added to the front of the list. ElementList m_activeFormatters; HtmlElement * m_head; HtmlElement * m_form; HtmlElement * m_currentNode; // end tag in main phase. void mainPhase(const std::string & tag); // start tag in main phase. void mainPhase(const std::string & tag, const AttributeVector & attrs); // unicode char in the mainPhase void mainPhase(unsigned int ucodeChar); // BEFORE_HEAD phase, start tag. void beforeHead(const std::string & tag, const AttributeVector & attrs); // end tag. void beforeHead(const std::string & tag); // IN_HEAD phase, start tag. void inHead(const std::string & tag, const AttributeVector & attrs); // end tag void inHead(const std::string & tag); // AFTER_HEAD phase, start tag. void afterHead(const std::string & tag, const AttributeVector & attrs); // end tag void afterHead(const std::string & tag); // IN_BODY phase, start tag. void inBody(const std::string & tag, const AttributeVector & attrs); // end tag void inBody(const std::string & tag); void inBody(unsigned int ucode); void eofInBody(); // IN_SELECT phase, start tag. void inSelect(const std::string & tag, const AttributeVector & attrs); // end tag void inSelect(const std::string & tag); // AFTER_BODY phase, start tag. void afterBody(const std::string & tag, const AttributeVector & attrs); // end tag void afterBody(const std::string & tag); bool inScope(const std::string & element, bool inTableScope=false) const; HtmlElement* activeFormatContains(const std::string & tagName); void removeFromActiveFormat(HtmlElement* element); void removeFromOpenElements(HtmlElement* element); void insertElement(HtmlElement * element); void addActiveFormatter(HtmlElement * element); inline HtmlElement * currentNode() const; void generateImpliedEndTags(const std::string & except=""); bool isFormatting(HtmlElement * node); bool isPhrasing(HtmlElement * node); void reconstructActiveFormatters(); void createBookmark(Bookmark & marker, ElementList::iterator & bookmarkIt) const; void adoptionAgency(const std::string & tag); void startScopeClosedElement(const std::string & tag, const std::string & alternate=""); bool headerInScope() const; void appendTextToCurrentNode(unsigned int ucodeChar); // disable copies HtmlDocument (const HtmlDocument&); const HtmlDocument& operator=(const HtmlDocument&); // debug int m_depth; void walkNode(const HtmlElement * node); }; // inline implementation const std::string & HtmlDocument::data() const { return m_data; } unsigned int HtmlDocument::dataGot() const { return m_dataGot; } void HtmlDocument::setDataGot(unsigned int value) { m_dataGot = value; } inline HtmlElement * HtmlDocument::currentNode() const { return m_openElements.back(); } #endif
#ifndef _NAPALM_SYSTEM__H_ #define _NAPALM_SYSTEM__H_ #include <string> #include <assert.h> #include "util/atomic.hpp" namespace napalm { /* * @class NapalmSystem * @brief System information. */ class NapalmSystem { public: /* * @brief Singleton access. */ static NapalmSystem& instance(); /* * @brief Version info accessors. */ inline int getMajorVersion() const { return m_majorVersion; } inline int getMinorVersion() const { return m_minorVersion; } inline int getPatchVersion() const { return m_patchVersion; } inline const std::string& getVersionString() const { return m_version; } /* * @brief System initialisation. */ void init(); /* * @brief * @returns the total number of bytes held in client memory (ie, on cpu) by napalm. */ inline long getTotalClientBytes() const { return m_totalClientBytes; } /* * @brief * Buffers with length less than this threshold will have their contents printed * when displayed as a string. */ static void count_bytes(long b); protected: NapalmSystem() { init(); } protected: std::string m_version; int m_majorVersion; int m_minorVersion; int m_patchVersion; long m_totalClientBytes; }; /* * @brief Force library initialisation */ static struct _napalm_init { _napalm_init(); } _napalm_init_inst; } #endif /*** Copyright 2008-2012 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios) This file is part of anim-studio-tools. anim-studio-tools 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. anim-studio-tools 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 Lesser General Public License along with anim-studio-tools. If not, see <http://www.gnu.org/licenses/>. ***/
/*===========================================================================* * * * smtserv.h - Windows service wrapper * * * * Copyright (c) 1991-2010 iMatix Corporation * * * * ------------------ GPL Licensed Source Code ------------------ * * iMatix makes this software available under the GNU General * * Public License (GPL) license for open source projects. For * * details of the GPL license please see www.gnu.org or read the * * file license.gpl provided in this package. * * * * 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 in the file 'license.gpl'; if * * not, write to the Free Software Foundation, Inc., 59 Temple * * Place - Suite 330, Boston, MA 02111-1307, USA. * * * * You can also license this software under iMatix's General Terms * * of Business (GTB) for commercial projects. If you have not * * explicitly licensed this software under the iMatix GTB you may * * only use it under the terms of the GNU General Public License. * * * * For more information, send an email to info@imatix.com. * * -------------------------------------------------------------- * *===========================================================================*/ #ifndef SMT_SERVICE_INCLUDED #define SMT_SERVICE_INCLUDED typedef int (SMT_AGENTS_INIT_FCT)(const char *config_filename); typedef int (SMT_AGENTS_TERM_FCT)(void); int service_begin ( int argc, char **argv, SMT_AGENTS_INIT_FCT *init_fct, SMT_AGENTS_TERM_FCT *term_fct, const char *appl_version); #endif /* SMT_SERVICE_INCLUDED */
#ifndef _INT_GL_1_4_H #define _INT_GL_1_4_H #ifdef __cplusplus extern "C" { #endif //__cplusplus #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_LOD_BIAS 0x8501 #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D typedef void (GLE_FUNCPTR * PFNGLBLENDFUNCSEPARATEPROC)(GLenum , GLenum , GLenum , GLenum ); typedef void (GLE_FUNCPTR * PFNGLMULTIDRAWARRAYSPROC)(GLenum , const GLint *, const GLsizei *, GLsizei ); typedef void (GLE_FUNCPTR * PFNGLMULTIDRAWELEMENTSPROC)(GLenum , const GLsizei *, GLenum , const GLvoid* *, GLsizei ); typedef void (GLE_FUNCPTR * PFNGLPOINTPARAMETERFPROC)(GLenum , GLfloat ); typedef void (GLE_FUNCPTR * PFNGLPOINTPARAMETERFVPROC)(GLenum , const GLfloat *); typedef void (GLE_FUNCPTR * PFNGLPOINTPARAMETERIPROC)(GLenum , GLint ); typedef void (GLE_FUNCPTR * PFNGLPOINTPARAMETERIVPROC)(GLenum , const GLint *); extern PFNGLBLENDFUNCSEPARATEPROC __gleBlendFuncSeparate; #define glBlendFuncSeparate __gleBlendFuncSeparate extern PFNGLMULTIDRAWARRAYSPROC __gleMultiDrawArrays; #define glMultiDrawArrays __gleMultiDrawArrays extern PFNGLMULTIDRAWELEMENTSPROC __gleMultiDrawElements; #define glMultiDrawElements __gleMultiDrawElements extern PFNGLPOINTPARAMETERFPROC __glePointParameterf; #define glPointParameterf __glePointParameterf extern PFNGLPOINTPARAMETERFVPROC __glePointParameterfv; #define glPointParameterfv __glePointParameterfv extern PFNGLPOINTPARAMETERIPROC __glePointParameteri; #define glPointParameteri __glePointParameteri extern PFNGLPOINTPARAMETERIVPROC __glePointParameteriv; #define glPointParameteriv __glePointParameteriv #ifdef __cplusplus } #endif //__cplusplus #endif //_INT_GL_1_4_H
/* * ltm.h * * This file is part of Cleanflight. * * Cleanflight 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. * * Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #pragma once struct telemetryConfig_s; void initLtmTelemetry(struct telemetryConfig_s *initialTelemetryConfig); void handleLtmTelemetry(void); void checkLtmTelemetryState(void); void freeLtmTelemetryPort(void); void configureLtmTelemetryPort(void);
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef BUDDYEDITOR_H #define BUDDYEDITOR_H #include "buddyeditor_global.h" #include <connectionedit_p.h> #include <QtCore/QPointer> #include <QtCore/QSet> QT_BEGIN_NAMESPACE class QDesignerFormWindowInterface; class QLabel; namespace qdesigner_internal { class QT_BUDDYEDITOR_EXPORT BuddyEditor : public ConnectionEdit { Q_OBJECT public: BuddyEditor(QDesignerFormWindowInterface *form, QWidget *parent); QDesignerFormWindowInterface *formWindow() const; virtual void setBackground(QWidget *background); virtual void deleteSelected(); public slots: virtual void updateBackground(); virtual void widgetRemoved(QWidget *w); void autoBuddy(); protected: virtual QWidget *widgetAt(const QPoint &pos) const; virtual Connection *createConnection(QWidget *source, QWidget *destination); virtual void endConnection(QWidget *target, const QPoint &pos); virtual void createContextMenu(QMenu &menu); private: QWidget *findBuddy(QLabel *l, const QWidgetList &existingBuddies) const; QPointer<QDesignerFormWindowInterface> m_formWindow; bool m_updating; }; } // namespace qdesigner_internal QT_END_NAMESPACE #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 LINEMATERIALREALSAMPLER_H #define LINEMATERIALREALSAMPLER_H // MOOSE includes #include "LineMaterialSamplerBase.h" // Forward Declarations class LineMaterialRealSampler; template<> InputParameters validParams<LineMaterialRealSampler>(); /** * This class samples Real material properties for the integration points * in all elements that are intersected by a user-defined line. */ class LineMaterialRealSampler : public LineMaterialSamplerBase<Real> { public: /** * Class constructor * Sets up variables for output based on the properties to be output * @param parameters The input parameters */ LineMaterialRealSampler(const InputParameters & parameters); virtual ~LineMaterialRealSampler() {} /** * Reduce the material property to a scalar for output * In this case, the material property is a Real already, so just return it. * @param property The material property * @param curr_point The point corresponding to this material property * @return A scalar value from this material property to be output */ virtual Real getScalarFromProperty(const Real & property, const Point * curr_point); }; #endif
/* The eXtended Keccak Code Package (XKCP) https://github.com/XKCP/XKCP Keccak, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. Implementation by the designers, hereby denoted as "the implementer". For more information, feedback or questions, please refer to the Keccak Team website: https://keccak.team/ To the extent possible under law, the implementer has waived all copyright and related or neighboring rights to the source code in this file. http://creativecommons.org/publicdomain/zero/1.0/ */ #ifndef _KeccakSponge_h_ #define _KeccakSponge_h_ /* For the documentation, please follow the link: */ /* #include "KeccakSponge-documentation.h" */ #include <string.h> #include "align.h" #include "config.h" #define XKCP_DeclareSpongeStructure(prefix, size, alignment) \ ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \ unsigned char state[size]; \ unsigned int rate; \ unsigned int byteIOIndex; \ int squeezing; \ } prefix##_SpongeInstance; #define XKCP_DeclareSpongeFunctions(prefix) \ int prefix##_Sponge(unsigned int rate, unsigned int capacity, const unsigned char *input, size_t inputByteLen, unsigned char suffix, unsigned char *output, size_t outputByteLen); \ int prefix##_SpongeInitialize(prefix##_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity); \ int prefix##_SpongeAbsorb(prefix##_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen); \ int prefix##_SpongeAbsorbLastFewBits(prefix##_SpongeInstance *spongeInstance, unsigned char delimitedData); \ int prefix##_SpongeSqueeze(prefix##_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen); #ifdef XKCP_has_KeccakP200 #include "KeccakP-200-SnP.h" XKCP_DeclareSpongeStructure(KeccakWidth200, KeccakP200_stateSizeInBytes, KeccakP200_stateAlignment) XKCP_DeclareSpongeFunctions(KeccakWidth200) #define XKCP_has_Sponge_Keccak_width200 #endif #ifdef XKCP_has_KeccakP400 #include "KeccakP-400-SnP.h" XKCP_DeclareSpongeStructure(KeccakWidth400, KeccakP400_stateSizeInBytes, KeccakP400_stateAlignment) XKCP_DeclareSpongeFunctions(KeccakWidth400) #define XKCP_has_Sponge_Keccak_width400 #endif #ifdef XKCP_has_KeccakP800 #include "KeccakP-800-SnP.h" XKCP_DeclareSpongeStructure(KeccakWidth800, KeccakP800_stateSizeInBytes, KeccakP800_stateAlignment) XKCP_DeclareSpongeFunctions(KeccakWidth800) #define XKCP_has_Sponge_Keccak_width800 #endif #ifdef XKCP_has_KeccakP1600 #include "KeccakP-1600-SnP.h" XKCP_DeclareSpongeStructure(KeccakWidth1600, KeccakP1600_stateSizeInBytes, KeccakP1600_stateAlignment) XKCP_DeclareSpongeFunctions(KeccakWidth1600) #define XKCP_has_Sponge_Keccak_width1600 #endif #ifdef XKCP_has_KeccakP1600 #include "KeccakP-1600-SnP.h" XKCP_DeclareSpongeStructure(KeccakWidth1600_12rounds, KeccakP1600_stateSizeInBytes, KeccakP1600_stateAlignment) XKCP_DeclareSpongeFunctions(KeccakWidth1600_12rounds) #endif #endif
/* * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 "../AmazonServiceRequestConfig.h" /** * Delete Load Balancer Policy Request */ @interface ElasticLoadBalancingDeleteLoadBalancerPolicyRequest:AmazonServiceRequestConfig { NSString *loadBalancerName; NSString *policyName; } /** * The mnemonic name associated with the LoadBalancer. The name must be * unique within your AWS account. */ @property (nonatomic, retain) NSString *loadBalancerName; /** * The mnemonic name for the policy being deleted. */ @property (nonatomic, retain) NSString *policyName; /** * Default constructor for a new DeleteLoadBalancerPolicyRequest object. Callers should use the * property methods to initialize this object after creating it. */ -(id)init; /** * Constructs a new DeleteLoadBalancerPolicyRequest object. * Callers should use properties to initialize any additional object members. * * @param theLoadBalancerName The mnemonic name associated with the * LoadBalancer. The name must be unique within your AWS account. * @param thePolicyName The mnemonic name for the policy being deleted. */ -(id)initWithLoadBalancerName:(NSString *)theLoadBalancerName andPolicyName:(NSString *)thePolicyName; /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. */ -(NSString *)description; @end
/** * @file * @brief Implements BTM 112 high-level routines. * * @date 15.11.11 * @author Anton Kozlov */ #include <drivers/bluetooth/bluetooth.h> #include <drivers/bluetooth/btm/btm112.h> #include <embox/unit.h> EMBOX_UNIT_INIT(btm112_init); CALLBACK_INIT(nxt_bt_rx_handle_t, bt_rx); typedef int (*string_handler)(int len, void *data); enum state_num { CONNECT_WAIT = 0, LR_WAIT = 1, DISCONNECT_WAIT = 2 }; static const char *stamp[] = { "CONNECT", "\r\n", "DISCONNECT", }; static int irq_hnd_wait_conn(int len, void *data); static int irq_hnd_wait_lrlf(int len, void *data); static int irq_hnd_wait_disconn(int len, void *data); static string_handler str_hnds[] = { irq_hnd_wait_conn, irq_hnd_wait_lrlf, irq_hnd_wait_disconn, }; static int rs_comm = 0; static int rs_pos = 0; static int set_state(int state_num) { rs_comm = state_num; rs_pos = 0; CALLBACK_REG(__bt_rx, str_hnds[state_num]); return 0; } static int general_handler(int cnt, void *data) { uint8_t *buff = (uint8_t *) data; while (cnt--) { if (*buff == stamp[rs_comm][rs_pos]) { rs_pos++; } else { rs_pos = 0; } if (stamp[rs_comm][rs_pos] == 0) { return 1; } buff++; } return 0; } static int irq_hnd_wait_conn(int len, void *data) { if (general_handler(len, data)) { set_state(LR_WAIT); } bluetooth_read(1); return 0; } static int irq_hnd_wait_lrlf(int len, void *data) { if (general_handler(len, data)) { set_state(DISCONNECT_WAIT); //Acknowlege about connect //FIXME CALLBACK(bt_state)(); return 0; } bluetooth_read(1); return 0; } static int irq_hnd_wait_disconn(int len, void *data) { if (general_handler(len, data)) { set_state(CONNECT_WAIT); CALLBACK(bt_state)(); bluetooth_read(1); return 0; } CALLBACK(bt_rx)(len, data); return 0; } static int btm112_init(void) { bluetooth_hw_hard_reset(); CALLBACK_REG(__bt_rx, irq_hnd_wait_conn); bluetooth_read(1); return 0; }
#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdlib.h> #include "Python.h" #include <string.h> static void fail(void) { MessageBoxA(NULL, "Cannot determine location of Reinteract.pyw from EXE name", NULL, MB_OK); exit(1); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { #define BUF_SIZE 1024 char buf[BUF_SIZE]; char *argv[2] = { "Reinteract.exe", "Reinteract.pyw" }; char *dirend; int count = GetModuleFileNameA(NULL, buf, BUF_SIZE); if (count == 0 || count == BUF_SIZE) fail(); /* This will fail in some exotic cases like C:Reinteract.exe */ dirend = buf + count; while (dirend > buf && *(dirend - 1) != '/' && *(dirend - 1) != '\\') dirend--; /* Change to the the EXE directory so that we find our DLL's despite Python * using LOAD_WITH_ALTERED_SEARCH_PATH. Modifying %PATH% would be another * option. Doing it this way also simplifies passing in Reinteract.pyw * as the first argument. */ if (dirend > buf) { *dirend = '\0'; SetCurrentDirectory(buf); } return Py_Main(2, argv); }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "IDEAlert.h" @class NSString; @interface IDEShowTabAlert : IDEAlert { NSString *_tabName; } - (int)alertPropertyListVersion; - (id)init; - (id)initWithPropertyList:(id)arg1; - (id)propertyList; - (void)runForEvent:(id)arg1 inWorkspace:(id)arg2 context:(id)arg3 completionBlock:(id)arg4; @property(retain) NSString *tabName; // @synthesize tabName=_tabName; @end
enum Color { blue = 0, red = 1, yellow = 3 }; int main() { enum Color c = blue; return (int)c; }
/***************************************************************************** Copyright (c) 2014, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function dgeev * Author: Intel Corporation * Generated November 2015 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_dgeev( int matrix_layout, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr ) { lapack_int info = 0; lapack_int lwork = -1; double* work = NULL; double work_query; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgeev", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) { return -5; } #endif /* Query optimal working array(s) size */ info = LAPACKE_dgeev_work( matrix_layout, jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, &work_query, lwork ); if( info != 0 ) { goto exit_level_0; } lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ work = (double*)LAPACKE_malloc( sizeof(double) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_dgeev_work( matrix_layout, jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgeev", info ); } return info; }
/* * This file is part of the FreeStreamer project, * (C)Copyright 2011-2015 Matias Muhonen <mmu@iki.fi> * See the file ''LICENSE'' for using the code. * * https://github.com/muhku/FreeStreamer */ #import <UIKit/UIKit.h> #include "FSFrequencyDomainAnalyzer.h" #define kFSFrequencyPlotViewMaxCount 64 @interface FSFrequencyPlotView : UIView <FSFrequencyDomainAnalyzerDelegate> { float _levels[kFSFrequencyPlotViewMaxCount]; NSUInteger _count; BOOL _drawing; } - (void)frequenceAnalyzer:(FSFrequencyDomainAnalyzer *)analyzer levelsAvailable:(float *)levels count:(NSUInteger)count; - (void)reset; @end
// Copyright 2021 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 ASH_COMPONENTS_PHONEHUB_CAMERA_ROLL_MANAGER_H_ #define ASH_COMPONENTS_PHONEHUB_CAMERA_ROLL_MANAGER_H_ #include "ash/components/phonehub/proto/phonehub_api.pb.h" #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" #include "base/observer_list.h" #include "base/observer_list_types.h" namespace ash { namespace phonehub { class CameraRollItem; // Manages camera roll items sent from the connected Android device. class CameraRollManager { public: class Observer : public base::CheckedObserver { public: ~Observer() override = default; // Notifies observers that camera view needs be refreshed, // the access state of camera roll feature is updated or current camera roll // items has changed. virtual void OnCameraRollViewUiStateUpdated(); // Notifies observers that there was an error in the download process. enum class DownloadErrorType { kGenericError, kInsufficientStorage, kNetworkConnection, }; virtual void OnCameraRollDownloadError( DownloadErrorType error_type, const proto::CameraRollItemMetadata& metadata); }; enum class CameraRollUiState { // Feature is either not supported, or supported and enabled, but haven't // received any items yet SHOULD_HIDE, // Feature is enabled on phone, but can not be used because storage access // permissions have been rejected on the Android device. In this state the // UI is hidden but the settings toggle is shown in a grayed out state. NO_STORAGE_PERMISSION, // We have items that can be displayed ITEMS_VISIBLE, }; CameraRollManager(const CameraRollManager&) = delete; CameraRollManager& operator=(const CameraRollManager&) = delete; virtual ~CameraRollManager(); // Returns the set of current camera roll items in the order in which they // should be displayed const std::vector<CameraRollItem>& current_items() const { return current_items_; } void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); CameraRollUiState ui_state(); // Downloads a full-quality photo or video file from the connected Android // device specified by the |item_metadata| to the Downloads folder. virtual void DownloadItem( const proto::CameraRollItemMetadata& item_metadata) = 0; protected: CameraRollManager(); CameraRollUiState ui_state_ = CameraRollUiState::SHOULD_HIDE; void SetCurrentItems(const std::vector<CameraRollItem>& items); void ClearCurrentItems(); virtual void ComputeAndUpdateUiState() = 0; void NotifyCameraRollViewUiStateUpdated(); void NotifyCameraRollDownloadError( Observer::DownloadErrorType error_type, const proto::CameraRollItemMetadata& metadata); private: std::vector<CameraRollItem> current_items_; base::ObserverList<Observer> observer_list_; }; } // namespace phonehub } // namespace ash #endif // ASH_COMPONENTS_PHONEHUB_CAMERA_ROLL_MANAGER_H_
#include "bli_config.h" #include "bli_system.h" #include "bli_type_defs.h" #include "bli_cblas.h" #ifdef BLIS_ENABLE_CBLAS /* * * cblas_ssyrk.c * This program is a C interface to ssyrk. * Written by Keita Teranishi * 4/8/1998 * */ #include "cblas.h" #include "cblas_f77.h" void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc) { char UL, TR; #ifdef F77_CHAR F77_CHAR F77_TR, F77_UL; #else #define F77_TR &TR #define F77_UL &UL #endif #ifdef F77_INT F77_INT F77_N=N, F77_K=K, F77_lda=lda; F77_INT F77_ldc=ldc; #else #define F77_N N #define F77_K K #define F77_lda lda #define F77_ldc ldc #endif extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; CBLAS_CallFromC = 1; if( Order == CblasColMajor ) { if( Uplo == CblasUpper) UL='U'; else if ( Uplo == CblasLower ) UL='L'; else { cblas_xerbla(2, "cblas_ssyrk", "Illegal Uplo setting, %d\n", Uplo); CBLAS_CallFromC = 0; RowMajorStrg = 0; return; } if( Trans == CblasTrans) TR ='T'; else if ( Trans == CblasConjTrans ) TR='C'; else if ( Trans == CblasNoTrans ) TR='N'; else { cblas_xerbla(3, "cblas_ssyrk", "Illegal Trans setting, %d\n", Trans); CBLAS_CallFromC = 0; RowMajorStrg = 0; return; } #ifdef F77_CHAR F77_UL = C2F_CHAR(&UL); F77_TR = C2F_CHAR(&TR); #endif F77_ssyrk(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, &beta, C, &F77_ldc); } else if (Order == CblasRowMajor) { RowMajorStrg = 1; if( Uplo == CblasUpper) UL='L'; else if ( Uplo == CblasLower ) UL='U'; else { cblas_xerbla(3, "cblas_ssyrk", "Illegal Uplo setting, %d\n", Uplo); CBLAS_CallFromC = 0; RowMajorStrg = 0; return; } if( Trans == CblasTrans) TR ='N'; else if ( Trans == CblasConjTrans ) TR='N'; else if ( Trans == CblasNoTrans ) TR='T'; else { cblas_xerbla(3, "cblas_ssyrk", "Illegal Trans setting, %d\n", Trans); CBLAS_CallFromC = 0; RowMajorStrg = 0; return; } #ifdef F77_CHAR F77_UL = C2F_CHAR(&UL); F77_TR = C2F_CHAR(&TR); #endif F77_ssyrk(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, &beta, C, &F77_ldc); } else cblas_xerbla(1, "cblas_ssyrk", "Illegal Order setting, %d\n", Order); CBLAS_CallFromC = 0; RowMajorStrg = 0; return; } #endif
// Copyright 2016 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 CSSTransformInterpolationType_h #define CSSTransformInterpolationType_h #include "core/animation/CSSInterpolationType.h" namespace blink { class CSSTransformInterpolationType : public CSSInterpolationType { public: CSSTransformInterpolationType(CSSPropertyID property) : CSSInterpolationType(property) { ASSERT(property == CSSPropertyTransform); } InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironment&) const final; InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const InterpolationValue& underlying, ConversionCheckers&) const final; PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&, double interpolationFraction) const final; void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final; private: InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers&) const final; InterpolationValue maybeConvertInitial(const StyleResolverState&, ConversionCheckers&) const final; InterpolationValue maybeConvertInherit(const StyleResolverState&, ConversionCheckers&) const final; InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverState&, ConversionCheckers&) const final; }; } // namespace blink #endif // CSSTransformInterpolationType_h
/* * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would 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 the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_TRANS_PRIV_H__ #define __XFS_TRANS_PRIV_H__ struct xfs_log_item; struct xfs_log_item_desc; struct xfs_mount; struct xfs_trans; struct xfs_ail; struct xfs_log_vec; void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); void xfs_trans_del_item(struct xfs_log_item *); void xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn, int flags); void xfs_trans_unreserve_and_mod_sb(struct xfs_trans *tp); void xfs_trans_committed_bulk(struct xfs_ail *ailp, struct xfs_log_vec *lv, xfs_lsn_t commit_lsn, int aborted); /* * AIL traversal cursor. * * Rather than using a generation number for detecting changes in the ail, use * a cursor that is protected by the ail lock. The aild cursor exists in the * struct xfs_ail, but other traversals can declare it on the stack and link it * to the ail list. * * When an object is deleted from or moved int the AIL, the cursor list is * searched to see if the object is a designated cursor item. If it is, it is * deleted from the cursor so that the next time the cursor is used traversal * will return to the start. * * This means a traversal colliding with a removal will cause a restart of the * list scan, rather than any insertion or deletion anywhere in the list. The * low bit of the item pointer is set if the cursor has been invalidated so * that we can tell the difference between invalidation and reaching the end * of the list to trigger traversal restarts. */ struct xfs_ail_cursor { struct list_head list; struct xfs_log_item *item; }; /* * Private AIL structures. * * Eventually we need to drive the locking in here as well. */ struct xfs_ail { struct xfs_mount *xa_mount; struct task_struct *xa_task; struct list_head xa_ail; xfs_lsn_t xa_target; struct list_head xa_cursors; spinlock_t xa_lock; xfs_lsn_t xa_last_pushed_lsn; int xa_log_flush; }; /* * From xfs_trans_ail.c */ void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, struct xfs_ail_cursor *cur, struct xfs_log_item **log_items, int nr_items, xfs_lsn_t lsn) __releases(ailp->xa_lock); static inline void xfs_trans_ail_update( struct xfs_ail *ailp, struct xfs_log_item *lip, xfs_lsn_t lsn) __releases(ailp->xa_lock) { xfs_trans_ail_update_bulk(ailp, NULL, &lip, 1, lsn); } void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, struct xfs_log_item **log_items, int nr_items) __releases(ailp->xa_lock); static inline void xfs_trans_ail_delete( struct xfs_ail *ailp, xfs_log_item_t *lip) __releases(ailp->xa_lock) { xfs_trans_ail_delete_bulk(ailp, &lip, 1); } void xfs_ail_push(struct xfs_ail *, xfs_lsn_t); void xfs_ail_push_all(struct xfs_ail *); xfs_lsn_t xfs_ail_min_lsn(struct xfs_ail *ailp); void xfs_trans_unlocked_item(struct xfs_ail *, xfs_log_item_t *); struct xfs_log_item * xfs_trans_ail_cursor_first(struct xfs_ail *ailp, struct xfs_ail_cursor *cur, xfs_lsn_t lsn); struct xfs_log_item * xfs_trans_ail_cursor_last(struct xfs_ail *ailp, struct xfs_ail_cursor *cur, xfs_lsn_t lsn); struct xfs_log_item * xfs_trans_ail_cursor_next(struct xfs_ail *ailp, struct xfs_ail_cursor *cur); void xfs_trans_ail_cursor_done(struct xfs_ail *ailp, struct xfs_ail_cursor *cur); #if BITS_PER_LONG != 64 static inline void xfs_trans_ail_copy_lsn( struct xfs_ail *ailp, xfs_lsn_t *dst, xfs_lsn_t *src) { ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ spin_lock(&ailp->xa_lock); *dst = *src; spin_unlock(&ailp->xa_lock); } #else static inline void xfs_trans_ail_copy_lsn( struct xfs_ail *ailp, xfs_lsn_t *dst, xfs_lsn_t *src) { ASSERT(sizeof(xfs_lsn_t) == 8); *dst = *src; } #endif #endif /* __XFS_TRANS_PRIV_H__ */
// Software License Agreement (BSD License) // // Copyright (c) 2010-2014, Deusty, LLC // All rights reserved. // // Redistribution and use of this software 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. // // * Neither the name of Deusty nor the names of its contributors may be used // to endorse or promote products derived from this software without specific // prior written permission of Deusty, LLC. // Disable legacy macros #ifndef DD_LEGACY_MACROS #define DD_LEGACY_MACROS 0 #endif #import "DDLog.h" /** * The constant/variable/method responsible for controlling the current log level. **/ #ifndef LOG_LEVEL_DEF #define LOG_LEVEL_DEF ddLogLevel #endif /** * Whether async should be used by log messages, excluding error messages that are always sent sync. **/ #ifndef LOG_ASYNC_ENABLED #define LOG_ASYNC_ENABLED YES #endif /** * This is the single macro that all other macros below compile into. * This big multiline macro makes all the other macros easier to read. **/ #define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ [DDLog log : isAsynchronous \ level : lvl \ flag : flg \ context : ctx \ file : __FILE__ \ function : fnct \ line : __LINE__ \ tag : atag \ format : frmt \ args : avalist] /** * Define version of the macro that only execute if the log level is above the threshold. * The compiled versions essentially look like this: * * if (logFlagForThisLogMsg & ddLogLevel) { execute log message } * * When LOG_LEVEL_DEF is defined as ddLogLevel. * * As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels. * This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques. * * Note that when compiler optimizations are enabled (as they are for your release builds), * the log messages above your logging threshold will automatically be compiled out. * * (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see * if the 'if' statement would execute, and if not it strips it from the binary.) * * We also define shorthand versions for asynchronous and synchronous logging. **/ #define LOGV_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \ do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0) /** * Ready to use log macros with no context or tag. **/ #define DDLogVError(frmt, ...) LOGV_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) #define DDLogVWarn(frmt, ...) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) #define DDLogVInfo(frmt, ...) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) #define DDLogVDebug(frmt, ...) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) #define DDLogVVerbose(frmt, ...) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-support/simd-sse2.h" #include "../common/n1bv_11.c"
// Copyright (c) 2011-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETFRAME_H #define BITCOIN_QT_WALLETFRAME_H #include <QFrame> #include <QMap> class BitcoinGUI; class ClientModel; class PlatformStyle; class SendCoinsRecipient; class WalletModel; class WalletView; QT_BEGIN_NAMESPACE class QStackedWidget; QT_END_NAMESPACE /** * A container for embedding all wallet-related * controls into BitcoinGUI. The purpose of this class is to allow future * refinements of the wallet controls with minimal need for further * modifications to BitcoinGUI, thus greatly simplifying merges while * reducing the risk of breaking top-level stuff. */ class WalletFrame : public QFrame { Q_OBJECT public: explicit WalletFrame(const PlatformStyle *platformStyle, BitcoinGUI *_gui = nullptr); ~WalletFrame(); void setClientModel(ClientModel *clientModel); bool addWallet(WalletModel *walletModel); void setCurrentWallet(WalletModel* wallet_model); void removeWallet(WalletModel* wallet_model); void removeAllWallets(); bool handlePaymentRequest(const SendCoinsRecipient& recipient); void showOutOfSyncWarning(bool fShow); Q_SIGNALS: /** Notify that the user has requested more information about the out-of-sync warning */ void requestedSyncWarningInfo(); private: QStackedWidget *walletStack; BitcoinGUI *gui; ClientModel *clientModel; QMap<WalletModel*, WalletView*> mapWalletViews; bool bOutOfSync; const PlatformStyle *platformStyle; public: WalletView* currentWalletView() const; WalletModel* currentWalletModel() const; public Q_SLOTS: /** Switch to overview (home) page */ void gotoOverviewPage(); /** Switch to history (transactions) page */ void gotoHistoryPage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to send coins page */ void gotoSendCoinsPage(QString addr = ""); /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ void backupWallet(); /** Change encrypted wallet passphrase */ void changePassphrase(); /** Ask for passphrase to unlock wallet temporarily */ void unlockWallet(); /** Show used sending addresses */ void usedSendingAddresses(); /** Show used receiving addresses */ void usedReceivingAddresses(); /** Pass on signal over requested out-of-sync-warning information */ void outOfSyncWarningClicked(); }; #endif // BITCOIN_QT_WALLETFRAME_H
/* sys/mount.h This file is part of Cygwin. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #ifndef _SYS_MOUNT_H #define _SYS_MOUNT_H #define BLOCK_SIZE 1024 #define BLOCK_SIZE_BITS 10 #ifdef __cplusplus extern "C" { #endif enum { MOUNT_SYMLINK = 0x00001, /* "mount point" is a symlink */ MOUNT_BINARY = 0x00002, /* "binary" format read/writes */ MOUNT_SYSTEM = 0x00008, /* mount point came from system table */ MOUNT_EXEC = 0x00010, /* Any file in the mounted directory gets 'x' bit */ MOUNT_CYGDRIVE = 0x00020, /* mount point refers to cygdrive device mount */ MOUNT_CYGWIN_EXEC = 0x00040, /* file or directory is or contains a cygwin executable */ MOUNT_SPARSE = 0x00080, /* Support automatic sparsifying of files. */ MOUNT_NOTEXEC = 0x00100, /* don't check files for executable magic */ MOUNT_DEVFS = 0x00200, /* /device "filesystem" */ MOUNT_PROC = 0x00400, /* /proc "filesystem" */ MOUNT_RO = 0x01000, /* read-only "filesystem" */ MOUNT_NOACL = 0x02000, /* support reading/writing ACLs */ MOUNT_NOPOSIX = 0x04000, /* Case insensitve path handling */ MOUNT_OVERRIDE = 0x08000, /* Allow overriding of root */ MOUNT_IMMUTABLE = 0x10000, /* Mount point can't be changed */ MOUNT_AUTOMATIC = 0x20000, /* Mount point was added automatically */ MOUNT_DOS = 0x40000, /* convert leading spaces and trailing dots and spaces to private use area */ MOUNT_IHASH = 0x80000, /* Enforce hash values for inode numbers */ MOUNT_BIND = 0x100000, /* Allows bind syntax in fstab file. */ MOUNT_USER_TEMP = 0x200000 /* Mount the user's $TMP. */ }; int mount (const char *, const char *, unsigned __flags); int umount (const char *); int cygwin_umount (const char *__path, unsigned __flags); #ifdef __cplusplus }; #endif #endif /* _SYS_MOUNT_H */
/* This file is part of the KDE project * Copyright (C) 2007 Marijn Kruisselbrink <mkruisselbrink@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 as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef ADDPARTCOMMAND_H #define ADDPARTCOMMAND_H #include <kundo2command.h> namespace MusicCore { class Sheet; class Part; } class MusicShape; class AddPartCommand : public KUndo2Command { public: explicit AddPartCommand(MusicShape* shape); virtual void redo(); virtual void undo(); private: MusicCore::Sheet* m_sheet; MusicCore::Part* m_part; MusicShape* m_shape; }; #endif // ADDPARTCOMMAND_H
#include "nxlib.h" int XMapWindow(Display *dpy, Window w) { GrMapWindow(w); return 1; } int XMapSubwindows(Display *dpy, Window w) { GR_WINDOW_ID parent; GR_WINDOW_ID *child, *cp; int i, nchild; GrQueryTree(w, &parent, &child, &nchild); cp = child; for (i=0; i<nchild; ++i) GrMapWindow(*cp++); free(child); return 1; }
/*************************************************************************** qgssvgannotationdialog.h ------------------------ begin : November, 2012 copyright : (C) 2012 by Marco Hugentobler email : marco dot hugentobler at sourcepole dot ch ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSSVGANNOTATIONDIALOG_H #define QGSSVGANNOTATIONDIALOG_H #include "ui_qgsformannotationdialogbase.h" class QgsSvgAnnotationItem; class QgsAnnotationWidget; class APP_EXPORT QgsSvgAnnotationDialog: public QDialog, private Ui::QgsFormAnnotationDialogBase { Q_OBJECT public: QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsSvgAnnotationDialog(); private slots: void on_mBrowseToolButton_clicked(); void applySettingsToItem(); void deleteItem(); private: QgsSvgAnnotationDialog(); //forbidden QgsSvgAnnotationItem* mItem; QgsAnnotationWidget* mEmbeddedWidget; }; #endif // QGSSVGANNOTATIONDIALOG_H
/* Copyright (C) 2001-2006, William Joseph. All Rights Reserved. This file is part of GtkRadiant. GtkRadiant 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. GtkRadiant 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 GtkRadiant; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef INCLUDED_ARCHIVE_H #define INCLUDED_ARCHIVE_H #include "iarchive.h" class DirectoryArchive: public Archive { private: std::string m_root; public: DirectoryArchive (const std::string& root); ArchiveFile* openFile (const std::string& name); ArchiveTextFile* openTextFile (const std::string& name); bool containsFile (const std::string& name); void forEachFile (VisitorFunc visitor, const std::string& root); }; Archive* OpenDirArchive (const std::string& name); #endif
// // Copyright(C) 2005-2014 Simon Howard // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // #include <stdlib.h> #include <string.h> #include "txt_separator.h" #include "txt_gui.h" #include "txt_io.h" #include "txt_main.h" #include "txt_utf8.h" #include "txt_window.h" static void TXT_SeparatorSizeCalc(TXT_UNCAST_ARG(separator)) { TXT_CAST_ARG(txt_separator_t, separator); if (separator->label != NULL) { // Minimum width is the string length + two spaces for padding separator->widget.w = TXT_UTF8_Strlen(separator->label) + 2; } else { separator->widget.w = 0; } separator->widget.h = 1; } static void TXT_SeparatorDrawer(TXT_UNCAST_ARG(separator)) { TXT_CAST_ARG(txt_separator_t, separator); int x, y; int w; w = separator->widget.w; TXT_GetXY(&x, &y); // Draw separator. Go back one character and draw two extra // to overlap the window borders. TXT_DrawSeparator(x-2, y, w + 4); if (separator->label != NULL) { TXT_GotoXY(x, y); TXT_FGColor(TXT_COLOR_BRIGHT_GREEN); TXT_DrawString(" "); TXT_DrawString(separator->label); TXT_DrawString(" "); } } static void TXT_SeparatorDestructor(TXT_UNCAST_ARG(separator)) { TXT_CAST_ARG(txt_separator_t, separator); free(separator->label); } void TXT_SetSeparatorLabel(txt_separator_t *separator, const char *label) { free(separator->label); if (label != NULL) { separator->label = strdup(label); } else { separator->label = NULL; } } txt_widget_class_t txt_separator_class = { TXT_NeverSelectable, TXT_SeparatorSizeCalc, TXT_SeparatorDrawer, NULL, TXT_SeparatorDestructor, NULL, NULL, }; txt_separator_t *TXT_NewSeparator(const char *label) { txt_separator_t *separator; separator = malloc(sizeof(txt_separator_t)); TXT_InitWidget(separator, &txt_separator_class); separator->label = NULL; TXT_SetSeparatorLabel(separator, label); return separator; }
#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/errno.h> #include <sys/fcntl.h> #include <stdlib.h> #include <stdio.h> #include <strings.h> #include <transaction.h> #include "btree_c_util.h" extern pthread_mutex_t insLock; void rand_insert(thread_data* t_data, BTree* tree, int id, int rand) { int idx, l_buffer_size; char * rand_string; /*rand_string = (char *) malloc(12 * sizeof(char));*/ idx = t_data[id].buffer_idx; l_buffer_size = BUFFER_SIZE; rand_string = &t_data[id].buffer[idx]; t_data[id].buffer_idx += 12; SIMICS_ASSERT(t_data[id].buffer_idx < l_buffer_size); snprintf(rand_string, 12, "%d", rand); key_type_t key = str_to_key(rand_string); insert(tree, id, key, rand_string); } void file_insert(BTree* tree, int id) { key_type_t key; char * string, *test_str; pthread_mutex_lock(&insLock); string = (char*) strtok(NULL, " \n"); pthread_mutex_unlock(&insLock); if(string != NULL){ key = str_to_key(string); insert(tree, id, key, string); } else { printf("NULL string.\n"); } } void load_text(char* file){ struct stat file_stats; text_file_fd = open(file, O_RDONLY); fstat(text_file_fd, &file_stats); off_t size = file_stats.st_size; file_buffer = (char *) malloc(size * sizeof(char)); read(text_file_fd, file_buffer, size); file_string = (char *) strtok(file_buffer, " \n"); } key_type_t str_to_key(char* string){ int i, len; key_type_t h; len = strlen(string); h = 0; for (i = 0; i < len; i++) { h = (31*h + string[i]); } return h; } /* pre-generate random numbers*/ void generate_rands(thread_data* t_data, int num_p){ int i, j; srandom(1000); for(j=0; j<num_p; ++j){ for(i=0; i<NUM_RANDS; ++i){ t_data[j].rand[i] = random(); } } } /* pre-load the tree */ void preload_tree(thread_data* t_data, BTree* tree, int size, int num_p, int use_file){ int i, id; assert(t_data != NULL); for(i=0; i<size; ++i){ id = i%num_p; if(use_file) file_insert(tree, id); else rand_insert(t_data, tree, id, random()); } } thread_data* allocate_thread_data(int num_p){ int i; thread_data* t_data; assert((sizeof(thread_data) % 128) == 0); t_data = (thread_data *) memalign(128, num_p * sizeof(thread_data)); SIMICS_ASSERT(t_data != NULL); bzero(t_data,(num_p * sizeof(thread_data))); for(i=0; i<num_p; ++i){ t_data[i].i_count = 0; t_data[i].buffer_idx = 0; } return t_data; } void think(){ int wait_time; wait_time = random() % 500; hrtime_t start = gethrtime(); while(gethrtime() < start + wait_time); }
// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2007-2008 * Stelian Pop <stelian@popies.net> * Lead Tech Design <www.leadtechdesign.com> * * (C) Copyright 2013 * Bo Shen <voice.shen@atmel.com> */ #include <common.h> #include <cpu_func.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_rstc.h> /* Reset the cpu by telling the reset controller to do so */ void reset_cpu(ulong ignored) { at91_rstc_t *rstc = (at91_rstc_t *)ATMEL_BASE_RSTC; writel(AT91_RSTC_KEY | AT91_RSTC_CR_PROCRST /* Processor Reset */ | AT91_RSTC_CR_PERRST /* Peripheral Reset */ #ifdef CONFIG_AT91RESET_EXTRST | AT91_RSTC_CR_EXTRST /* External Reset (assert nRST pin) */ #endif , &rstc->cr); /* never reached */ do { } while (1); }
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: Rusty.Lynch REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test assertion #11 by verifying that SIGCHLD signals are sent to a parent when their children are continued after being stopped. NOTE: This is only required to work if the XSI options are implemented. * 12/18/02 - Adding in include of sys/time.h per * rodrigc REMOVE-THIS AT attbi DOT com input that it needs * to be included whenever the timeval struct is used. * */ #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/select.h> #include <sys/wait.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include "posixtest.h" #define NUMSTOPS 2 int child_continued = 0; int waiting = 1; void handler(int signo, siginfo_t * info, void *context) { if (info && info->si_code == CLD_CONTINUED) { printf("Child has been stopped\n"); waiting = 0; child_continued++; } } int main(void) { pid_t pid; struct sigaction act; struct timeval tv; act.sa_sigaction = handler; act.sa_flags = SA_SIGINFO; sigemptyset(&act.sa_mask); sigaction(SIGCHLD, &act, 0); if ((pid = fork()) == 0) { /* child */ while (1) { /* wait forever, or until we are interrupted by a signal */ tv.tv_sec = 0; tv.tv_usec = 0; select(0, NULL, NULL, NULL, &tv); } return 0; } else { /* parent */ int s; int i; /* delay to allow child to get into select call */ tv.tv_sec = 1; tv.tv_usec = 0; select(0, NULL, NULL, NULL, &tv); for (i = 0; i < NUMSTOPS; i++) { struct timeval tv; printf("--> Sending SIGSTOP\n"); kill(pid, SIGSTOP); /* Don't let the kernel optimize away queued SIGSTOP/SIGCONT signals. */ tv.tv_sec = 1; tv.tv_usec = 0; select(0, NULL, NULL, NULL, &tv); printf("--> Sending SIGCONT\n"); waiting = 1; kill(pid, SIGCONT); while (waiting) { tv.tv_sec = 1; tv.tv_usec = 0; if (!select(0, NULL, NULL, NULL, &tv)) break; } } /* POSIX specifies default action to be abnormal termination */ kill(pid, SIGHUP); waitpid(pid, &s, 0); } if (child_continued == NUMSTOPS) { printf("Test PASSED\n"); printf ("In the section of the POSIX spec that describes the SA_NOCLDSTOP flag in the sigaction() interface " "it is specified that if the SA_NOCLDSTOP flag is not set in sa_flags, then a SIGCHLD and a SIGCHLD " "signal **MAY** be generated for the calling process whenever any of its stopped child processes are continued. " "Because of that, this test will PASS either way, but note that the signals implementation you are currently " "run this test on DOES choose to send a SIGCHLD signal whenever any of its stopped child processes are " "continued. Again, this is not a bug because of the existence of the word *MAY* in the spec.\n"); return PTS_PASS; } printf("Test PASSED\n"); printf ("In the section of the POSIX spec that describes the SA_NOCLDSTOP flag in the sigaction() interface " "it is specified that if the SA_NOCLDSTOP flag is not set in sa_flags, then a SIGCHLD and a SIGCHLD " "signal **MAY** be generated for the calling process whenever any of its stopped child processes are continued. " "Because of that, this test will PASS either way, but note that the signals implementation you are currently " "run this test on chooses NOT TO send a SIGCHLD signal whenever any of its stopped child processes are " "continued. Again, this is not a bug because of the existence of the word *MAY* in the spec.\n"); return PTS_PASS; }
/* * This file is part of Cleanflight. * * Cleanflight 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. * * Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #include "platform.h" #ifdef USE_PINIO #include "pg/pg_ids.h" #include "pinio.h" #include "drivers/io.h" #ifndef PINIO1_PIN #define PINIO1_PIN NONE #endif #ifndef PINIO2_PIN #define PINIO2_PIN NONE #endif #ifndef PINIO3_PIN #define PINIO3_PIN NONE #endif #ifndef PINIO4_PIN #define PINIO4_PIN NONE #endif PG_REGISTER_WITH_RESET_TEMPLATE(pinioConfig_t, pinioConfig, PG_PINIO_CONFIG, 0); PG_RESET_TEMPLATE(pinioConfig_t, pinioConfig, .ioTag = { IO_TAG(PINIO1_PIN), IO_TAG(PINIO2_PIN), IO_TAG(PINIO3_PIN), IO_TAG(PINIO4_PIN), }, .config = { PINIO_CONFIG_MODE_OUT_PP, PINIO_CONFIG_MODE_OUT_PP, PINIO_CONFIG_MODE_OUT_PP, PINIO_CONFIG_MODE_OUT_PP }, ); #endif
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder #ifndef COMMON_DES_H #define COMMON_DES_H #include "../common/cbasetypes.h" /// One 64-bit block. typedef struct BIT64 { uint8_t b[8]; } BIT64; void des_decrypt_block(BIT64* block); void des_decrypt(unsigned char* data, size_t size); #endif // COMMON_DES_H
/* * This file is part of the libopencm3 project. * * Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au> * * 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/>. */ #ifndef LIBOPENCM3_DESIG_H #define LIBOPENCM3_DESIG_H #include <libopencm3/cm3/common.h> #include <libopencm3/stm32/memorymap.h> /* --- Device Electronic Signature -------------------------------- */ BEGIN_DECLS /** * Read the on board flash size * @return flash size in KB */ uint16_t desig_get_flash_size(void); /** * Read the full 96 bit unique identifier * Note: ST specifies that bits 31..16 are _also_ reserved for future use * @param result pointer to at least 3xuint32_ts (96 bits) */ void desig_get_unique_id(uint32_t *result); /** * Read the full 96 bit unique identifier and return it as a * zero-terminated string * @param string memory region to write the result to * @param string_len the size of string in bytes */ void desig_get_unique_id_as_string(char *string, unsigned int string_len); /** * Generate the same serial number from the unique id registers as * the DFU bootloader. * * This document: http://www.usb.org/developers/docs/devclass_docs/usbmassbulk_10.pdf * says that the serial number has to be at least 12 digits long and that * the last 12 digits need to be unique. It also stipulates that the valid * character set is that of upper-case hexadecimal digits. * The onboard DFU bootloader produces a 12-digit serial based on the * 96-bit unique ID. Show the serial with ```dfu-util -l``` while the * MCU is in DFU mode. * @see https://my.st.com/52d187b7 for the algorithim used. * @param string pointer to store serial in, must be at least 13 bytes */ void desig_get_unique_id_as_dfu(char *string); END_DECLS #endif
#ifndef LZMA_API_INCLUDED #define LZMA_API_INCLUDED #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> //for the getpid(); #ifndef uchar #define uchar unsigned char #endif #define LZMA_DEC_TO_BC(bc, pos, num) \ { \ while (num >= 128) { \ bc[pos++] = (uchar)((num & 127) + 128); \ num = (num >> 7); \ } \ bc[pos++] = (uchar) num; \ } #define LZMA_SIZE_DEC_TO_BC(num,size) \ {uint numtmp=num; \ size=0; \ while (num >= 128) { \ size++; \ num = (num >> 7); \ } \ size++; num=numtmp; \ } #define LZMA_BC_TO_DEC(bc,pos,num) \ { \ register uint _pot, _x; \ _pot=1; \ _x = bc[pos++]; \ num=0; \ while (_x >= 128) { \ num = num + (_x-128)*_pot; \ _x=bc[pos++]; \ _pot<<=7; \ } \ num=num + _x*_pot; \ } /******************************************************************************/ /* Public functions */ /******************************************************************************/ /* initializes a tlzma structure */ int initLzmaStruct(void **lzmadataV); /* frees a tlzma structure */ int freeLzmaStruct(void *lzmadataV); /* Compresses the data with system program *lzmaEncoder* * data is first saved into file "TMP_FILE_TO_COMPRESS_VBYTE", then * lzmaEncoder e <src> <dst> is called and file "TMP_FILE_COMPRESS_LZMA" created. */ int compressDataExt(uchar *data, uint n, char *path2LzmaEncoder); /* Loads the data from file "TMP_FILE_COMPRESS_LZMA" into memory. */ int loadDataExt(uchar **data, uint *readen); /* Given the source stream "inb" containing data compressed with lzmaEncoder, * returns an initialized structure "lzmadata" keeping the compressed data and * the headers (flags, dictSize, uncompressedSize) needed to perform decompression. * @lzmadata structure is not allocated here. */ int createLzmaExt(uchar *inb, uint inn, void *lzmadata); /* Gives the size (in bytes) of a given tlzmaStructure * It counts the fields: properties (5), sizeunc (4) and compdata[] */ uint sizeBytesLzmaStruct(void *lzmadata); /* Serializes the structure tlzma. * Writes its data into @outstream[pos...] * The next @pos (after the output data) is returned. */ uint writeBuffLzmaStruct(uchar *outstream, uint pos, void *lzmadata); /* Deserializes the structure tlzma. * Loads its data (inn bytes) from pointer @inb */ int readBuffLzmaStruct(uchar *inb, uint inn, void *lzmadata); /* Decodes the lzma data stored in the structure tlzma. * Writes extracted data o an output buffer that is also allocated. */ int decodeLzma (void *lzmadata, uchar **outB, uint *outlen); /******************************************************************************/ /* Some private functions */ /******************************************************************************/ /* the size of a file */ unsigned long getfileSize (const char *filename); /* the size of the header (props + lenUncomp-text) in bytes of a lzma compressed file */ uint getHeaderSizeOriginal(); #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2010 Hugues Delorme ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #ifndef COMMITEDITOR_H #define COMMITEDITOR_H #include <vcsbase/vcsbaseclient.h> #include <vcsbase/vcsbasesubmiteditor.h> namespace VcsBase { class SubmitFileModel; } namespace Bazaar { namespace Internal { class BranchInfo; class BazaarCommitWidget; class CommitEditor : public VcsBase::VcsBaseSubmitEditor { Q_OBJECT public: explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent); void setFields(const QString &repositoryRoot, const BranchInfo &branch, const QString &userName, const QString &email, const QList<VcsBase::VcsBaseClient::StatusItem> &repoStatus); const BazaarCommitWidget *commitWidget() const; private: BazaarCommitWidget *commitWidget(); VcsBase::SubmitFileModel *m_fileModel; }; } } #endif // COMMITEDITOR_H
#include <config.h> #include <unistd.h> #include <sys/types.h> #include <fcntl.h> #include "testutils.h" #ifdef WITH_QEMU # include "datatypes.h" # include "internal.h" # include "virstring.h" # include "conf/domain_conf.h" # include "qemu/qemu_domain.h" # include "testutilsqemu.h" # define VIR_FROM_THIS VIR_FROM_QEMU static virQEMUDriver driver; struct testInfo { const char *name; unsigned long long memlock; }; static int testCompareMemLock(const void *data) { const struct testInfo *info = data; g_autoptr(virDomainDef) def = NULL; g_autofree char *xml = NULL; xml = g_strdup_printf("%s/qemumemlockdata/qemumemlock-%s.xml", abs_srcdir, info->name); if (!(def = virDomainDefParseFile(xml, driver.xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE))) { return -1; } return virTestCompareToULL(info->memlock, qemuDomainGetMemLockLimitBytes(def, false)); } # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX" static int mymain(void) { int ret = 0; g_autofree char *fakerootdir = NULL; g_autoptr(virQEMUCaps) qemuCaps = NULL; fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE); if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE); if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; driver.privileged = true; # define DO_TEST(name, memlock) \ do { \ static struct testInfo info = { \ name, memlock \ }; \ if (virTestRun("QEMU MEMLOCK " name, testCompareMemLock, &info) < 0) \ ret = -1; \ } while (0) /* The tests below make sure that the memory locking limit is being * calculated correctly in a number of situations. Each test is * performed both on x86_64/pc and ppc64/pseries in order to account * for some architecture-specific details. * * kvm: simple KMV guest * tcg: simple TCG guest * * hardlimit: guest where <memtune><hard_limit> has been configured * locked: guest where <memoryBacking><locked> has been enabled * hostdev: guest that has some hostdev assigned * * The remaining tests cover different combinations of the above to * ensure settings are prioritized as expected. */ qemuTestSetHostArch(&driver, VIR_ARCH_X86_64); DO_TEST("pc-kvm", 0); DO_TEST("pc-tcg", 0); if (!(qemuCaps = virQEMUCapsNew())) { ret = -1; goto cleanup; } virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI); if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) { ret = -1; goto cleanup; }; DO_TEST("pc-hardlimit", 2147483648); DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); DO_TEST("pc-hostdev", 2147483648); DO_TEST("pc-hardlimit+locked", 2147483648); DO_TEST("pc-hardlimit+hostdev", 2147483648); DO_TEST("pc-hardlimit+locked+hostdev", 2147483648); DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); qemuTestSetHostArch(&driver, VIR_ARCH_PPC64); virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) { ret = -1; goto cleanup; }; DO_TEST("pseries-kvm", 20971520); DO_TEST("pseries-tcg", 0); DO_TEST("pseries-hardlimit", 2147483648); DO_TEST("pseries-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); DO_TEST("pseries-hostdev", 4320133120); DO_TEST("pseries-hardlimit+locked", 2147483648); DO_TEST("pseries-hardlimit+hostdev", 2147483648); DO_TEST("pseries-hardlimit+locked+hostdev", 2147483648); DO_TEST("pseries-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); cleanup: if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); qemuTestDriverFree(&driver); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"), VIR_TEST_MOCK("domaincaps")) #else int main(void) { return EXIT_AM_SKIP; } #endif /* WITH_QEMU */
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef DEPLOYMENTDATA_H #define DEPLOYMENTDATA_H #include "deployablefile.h" #include "projectexplorer_export.h" #include <utils/algorithm.h> #include <QList> #include <QSet> namespace ProjectExplorer { class PROJECTEXPLORER_EXPORT DeploymentData { public: void setFileList(const QList<DeployableFile> &files) { m_files = files; } void addFile(const DeployableFile &file) { for (int i = 0; i < m_files.size(); ++i) { if (m_files.at(i).localFilePath() == file.localFilePath()) { m_files[i] = file; return; } } m_files << file; } void addFile(const QString &localFilePath, const QString &remoteDirectory, DeployableFile::Type type = DeployableFile::TypeNormal) { addFile(DeployableFile(localFilePath, remoteDirectory, type)); } int fileCount() const { return m_files.count(); } DeployableFile fileAt(int index) const { return m_files.at(index); } QList<DeployableFile> allFiles() const { return m_files; } DeployableFile deployableForLocalFile(const QString &localFilePath) const { return Utils::findOrDefault(m_files, [&localFilePath](const DeployableFile &d) { return d.localFilePath().toString() == localFilePath; }); } bool operator==(const DeploymentData &other) const { return m_files.toSet() == other.m_files.toSet(); } private: QList<DeployableFile> m_files; }; inline bool operator!=(const DeploymentData &d1, const DeploymentData &d2) { return !(d1 == d2); } } // namespace ProjectExplorer #endif // DEPLOYMENTDATA_H
/** * * Phantom OS * * Copyright (C) 2005-2013 Dmitry Zavalishin, dz@dz.ru * * ARM raspberry PI (bcm2835) interrupts controller. * **/ #ifndef ARM_RASPBERRY_PI_INERRUPT #define ARM_RASPBERRY_PI_INERRUPT //#warning 0x7e... is remapped on raspberry? //#define BCM2835_INTR_REG_BASE 0x7E00B000 #define BCM2835_INTR_REG_BASE (0x20000000+0xB000) #define BCM2835_INTR_IRQ_PENDING_BASIC (BCM2835_INTR_REG_BASE+0x200) #define BCM2835_INTR_IRQ_PENDING_1 (BCM2835_INTR_REG_BASE+0x204) #define BCM2835_INTR_IRQ_PENDING_2 (BCM2835_INTR_REG_BASE+0x208) #define BCM2835_INTR_IRQ_FIQ (BCM2835_INTR_REG_BASE+0x20C) #define BCM2835_INTR_IRQ_ENABLE_BASIC (BCM2835_INTR_REG_BASE+0x218) #define BCM2835_INTR_IRQ_ENABLE_1 (BCM2835_INTR_REG_BASE+0x210) #define BCM2835_INTR_IRQ_ENABLE_2 (BCM2835_INTR_REG_BASE+0x214) #define BCM2835_INTR_IRQ_DISABLE_BASIC (BCM2835_INTR_REG_BASE+0x224) #define BCM2835_INTR_IRQ_DISABLE_1 (BCM2835_INTR_REG_BASE+0x21C) #define BCM2835_INTR_IRQ_DISABLE_2 (BCM2835_INTR_REG_BASE+0x220) /** * * Interrupt map: * * 0-63 - GPU interrupts * 64 - ARM Timer interrupt * 65 - ARM Mailbox interrupt * 66 - ARM Doorbell 0 interrupt * 67 - ARM Doorbell 1 interrupt * 68 - GPU0 Halted interrupt (Or GPU1) * 69 - GPU1 Halted interrupt * 70 - Illegal access type-1 interrupt * 71 - Illegal access type-0 interrupt * **/ #define BCM2835_GPU_INT_START 0 #define BCM2835_ARM_INT_START 64 #define ARM_INT_TIMER BCM2835_ARM_INT_START+0 #define ARM_INT_MAILBOX BCM2835_ARM_INT_START+1 #define ARM_INT_DOORBELL_0 BCM2835_ARM_INT_START+2 #define ARM_INT_DOORBELL_1 BCM2835_ARM_INT_START+3 #define ARM_INT_GPU_HALT_0 BCM2835_ARM_INT_START+4 #define ARM_INT_GPU_HALT_1 BCM2835_ARM_INT_START+5 #define ARM_INT_ILLEGAL_ACC_1 BCM2835_ARM_INT_START+6 #define ARM_INT_ILLEGAL_ACC_0 BCM2835_ARM_INT_START+7 #endif // ARM_RASPBERRY_PI_INERRUPT
// Copyright 2019 Google // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include "Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h" #include "Crashlytics/Crashlytics/Helpers/FIRCLSFile.h" #include <signal.h> #include <stdbool.h> // per man sigaltstack, MINSIGSTKSZ is the minimum *overhead* needed to support // a signal stack. The actual stack size must be larger. Let's pick the recommended // size. #if CLS_USE_SIGALTSTACK #define CLS_SIGNAL_HANDLER_STACK_SIZE (SIGSTKSZ * 2) #else #define CLS_SIGNAL_HANDLER_STACK_SIZE 0 #endif #if CLS_SIGNAL_SUPPORTED #define FIRCLSSignalCount (7) typedef struct { const char* path; struct sigaction originalActions[FIRCLSSignalCount]; #if CLS_USE_SIGALTSTACK stack_t originalStack; #endif } FIRCLSSignalReadContext; void FIRCLSSignalInitialize(FIRCLSSignalReadContext* roContext); void FIRCLSSignalCheckHandlers(void); void FIRCLSSignalSafeRemoveHandlers(bool includingAbort); bool FIRCLSSignalSafeInstallPreexistingHandlers(FIRCLSSignalReadContext* roContext, const int signal, siginfo_t* info, void* uapVoid); void FIRCLSSignalNameLookup(int number, int code, const char** name, const char** codeName); void FIRCLSSignalEnumerateHandledSignals(void (^block)(int idx, int signal)); #endif
/*** * Excerpted from "Test-Driven Development for Embedded C", * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visit http://www.pragmaticprogrammer.com/titles/jgade for more book information. ***/ #ifndef ALLOCATIONINCFILE_H #define ALLOCATIONINCFILE_H extern char* mallocAllocation(); extern void freeAllocation(void* memory); extern void freeAllocationWithoutMacro(void* memory); #endif
#import <TestLib/lib.h> static int do_stuff() { return kMagicNumber * 2; }
// 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_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_UTIL_H_ #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_UTIL_H_ #include <string> #include "ash/magnifier/magnifier_constants.h" #include "ash/shell_delegate.h" #include "base/basictypes.h" class Browser; namespace content { class WebUI; } namespace chromeos { namespace accessibility { struct AccessibilityStatusEventDetails { AccessibilityStatusEventDetails( bool enabled, ash::AccessibilityNotificationVisibility notify) : enabled(enabled), magnifier_type(ash::kDefaultMagnifierType), notify(notify) {} AccessibilityStatusEventDetails( bool enabled, ash::MagnifierType magnifier_type, ash::AccessibilityNotificationVisibility notify) : enabled(enabled), magnifier_type(magnifier_type), notify(notify) {} bool enabled; ash::MagnifierType magnifier_type; ash::AccessibilityNotificationVisibility notify; }; // Do any accessibility initialization that should happen once on startup. void Initialize(); // Enables or disables spoken feedback. Enabling spoken feedback installs the // ChromeVox component extension. If this is being called in a login/oobe // login screen, pass the WebUI object in login_web_ui so that ChromeVox // can be injected directly into that screen, otherwise it should be NULL. void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui, ash::AccessibilityNotificationVisibility notify); // Enables or disables the high contrast mode for Chrome. void EnableHighContrast(bool enabled); // Enables or disable the virtual keyboard. void EnableVirtualKeyboard(bool enabled); // Toggles whether Chrome OS spoken feedback is on or off. See docs for // EnableSpokenFeedback, above. void ToggleSpokenFeedback(content::WebUI* login_web_ui, ash::AccessibilityNotificationVisibility notify); // Speaks the specified string. void Speak(const std::string& utterance); // Returns true if spoken feedback is enabled, or false if not. bool IsSpokenFeedbackEnabled(); // Returns true if High Contrast is enabled, or false if not. bool IsHighContrastEnabled(); // Returns true if the Virtual Keyboard is enabled, or false if not. bool IsVirtualKeyboardEnabled(); // Speaks the given text if the accessibility pref is already set. void MaybeSpeak(const std::string& utterance); // Shows the accessibility help tab on the browser. void ShowAccessibilityHelp(Browser* browser); } // namespace accessibility } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_UTIL_H_
// Copyright (c) 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 CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_BASE_H_ #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_BASE_H_ #include "base/basictypes.h" class CommandLine; // A base class for platform-specific BrowserProcessPlatformPart // implementations. This class itself should never be used verbatim. class BrowserProcessPlatformPartBase { public: BrowserProcessPlatformPartBase(); virtual ~BrowserProcessPlatformPartBase(); // Called after creating the process singleton or when another chrome // rendez-vous with this one. virtual void PlatformSpecificCommandLineProcessing( const CommandLine& command_line); // Called from BrowserProcessImpl::StartTearDown(). virtual void StartTearDown(); // Called from AttemptExitInternal(). virtual void AttemptExit(); private: DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPartBase); }; #endif // CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_BASE_H_
// Tencent is pleased to support the open source community by making RapidJSON available. // // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. // // Licensed under the MIT License (the "License"); you may not use this file except // in compliance with the License. You may obtain a copy of the License at // // http://opensource.org/licenses/MIT // // 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 RAPIDJSON_INTERNAL_STRFUNC_H_ #define RAPIDJSON_INTERNAL_STRFUNC_H_ #include "../stream.h" RAPIDJSON_NAMESPACE_BEGIN namespace internal { //! Custom strlen() which works on different character types. /*! \tparam Ch Character type (e.g. char, wchar_t, short) \param s Null-terminated input string. \return Number of characters in the string. \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. */ template <typename Ch> inline SizeType StrLen(const Ch* s) { const Ch* p = s; while (*p) ++p; return SizeType(p - s); } //! Returns number of code points in a encoded string. template<typename Encoding> bool CountStringCodePoint(const typename Encoding::Ch* s, SizeType length, SizeType* outCount) { GenericStringStream<Encoding> is(s); const typename Encoding::Ch* end = s + length; SizeType count = 0; while (is.src_ < end) { unsigned codepoint; if (!Encoding::Decode(is, &codepoint)) return false; count++; } *outCount = count; return true; } } // namespace internal RAPIDJSON_NAMESPACE_END #endif // RAPIDJSON_INTERNAL_STRFUNC_H_
#ifndef ISL_REORDERING_H #define ISL_REORDERING_H #include <isl/space.h> /* pos maps original dimensions to new dimensions. * The final space is given by "space". * The number of dimensions (i.e., the range of values) in the result * may be larger than the number of dimensions in the input. * In particular, the possible values of the entries in pos ranges from 0 to * the total dimension of dim - 1, unless isl_reordering_extend * has been called. */ struct isl_reordering { int ref; isl_space *space; unsigned len; int pos[1]; }; typedef struct isl_reordering isl_reordering; isl_ctx *isl_reordering_get_ctx(__isl_keep isl_reordering *r); __isl_keep isl_space *isl_reordering_peek_space(__isl_keep isl_reordering *r); __isl_give isl_space *isl_reordering_get_space(__isl_keep isl_reordering *r); __isl_give isl_reordering *isl_parameter_alignment_reordering( __isl_keep isl_space *alignee, __isl_keep isl_space *aligner); __isl_give isl_reordering *isl_reordering_copy(__isl_keep isl_reordering *exp); __isl_null isl_reordering *isl_reordering_free(__isl_take isl_reordering *exp); __isl_give isl_reordering *isl_reordering_extend_space( __isl_take isl_reordering *exp, __isl_take isl_space *space); __isl_give isl_reordering *isl_reordering_extend(__isl_take isl_reordering *exp, unsigned extra); #endif
// Copyright 2020 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_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_MENU_UTILS_H_ #define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_MENU_UTILS_H_ #include "ui/ozone/public/platform_menu_utils.h" namespace ui { class WaylandConnection; class WaylandMenuUtils : public PlatformMenuUtils { public: explicit WaylandMenuUtils(WaylandConnection* connection); WaylandMenuUtils(const WaylandMenuUtils&) = delete; WaylandMenuUtils& operator=(const WaylandMenuUtils&) = delete; ~WaylandMenuUtils() override; int GetCurrentKeyModifiers() const override; std::string ToDBusKeySym(KeyboardCode code) const override; private: WaylandConnection* const connection_; }; } // namespace ui #endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_MENU_UTILS_H_
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_SUBMITTER_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_SUBMITTER_H_ #include "base/memory/raw_ptr.h" #include "components/autofill/core/common/logging/log_buffer.h" namespace autofill { class LogRouter; // A container for a LogBuffer that submits the buffer to the passed destination // on destruction. // // Use it in the following way: // LogBufferSubmitter(destination) << "Foobar"; // The submitter is destroyed after this statement and "Foobar" is logged. class LogBufferSubmitter { public: LogBufferSubmitter(LogRouter* destination, bool active); ~LogBufferSubmitter(); LogBufferSubmitter(LogBufferSubmitter&& that) noexcept; LogBufferSubmitter& operator=(LogBufferSubmitter&& that); LogBufferSubmitter(LogBufferSubmitter& that) = delete; LogBufferSubmitter& operator=(LogBufferSubmitter& that) = delete; LogBuffer& buffer() { return buffer_; } operator LogBuffer&() { return buffer_; } private: raw_ptr<LogRouter> destination_; LogBuffer buffer_; // If set to false, the destructor does not perform any logging. This is used // for move assignment so that the original copy does not trigger logging. bool destruct_with_logging_ = true; }; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_SUBMITTER_H_
/**************************************************************************** * * Copyright (C) 2017 PX4 Development Team. 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 PX4 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. * ****************************************************************************/ /* * @file drv_pwm_trigger.c * */ #include <px4_platform_common/px4_config.h> #include <nuttx/arch.h> #include <nuttx/irq.h> #include <sys/types.h> #include <stdbool.h> #include <assert.h> #include <debug.h> #include <time.h> #include <queue.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <arch/board/board.h> #include <drivers/drv_pwm_trigger.h> #include <px4_arch/io_timer.h> int up_pwm_trigger_set(unsigned channel, uint16_t value) { return io_timer_set_ccr(channel, value); } int up_pwm_trigger_init(uint32_t channel_mask) { /* Init channels */ for (unsigned channel = 0; channel_mask != 0 && channel < MAX_TIMER_IO_CHANNELS; channel++) { if (channel_mask & (1 << channel)) { // First free any that were not trigger mode before if (-EBUSY == io_timer_is_channel_free(channel)) { io_timer_free_channel(channel); } io_timer_channel_init(channel, IOTimerChanMode_Trigger, NULL, NULL); channel_mask &= ~(1 << channel); } } /* Enable the timers */ up_pwm_trigger_arm(true); return OK; } void up_pwm_trigger_deinit() { /* Disable the timers */ up_pwm_trigger_arm(false); /* Deinit channels */ uint32_t current = io_timer_get_mode_channels(IOTimerChanMode_Trigger); for (unsigned channel = 0; current != 0 && channel < MAX_TIMER_IO_CHANNELS; channel++) { if (current & (1 << channel)) { io_timer_channel_init(channel, IOTimerChanMode_NotUsed, NULL, NULL); current &= ~(1 << channel); } } } void up_pwm_trigger_arm(bool armed) { io_timer_set_enable(armed, IOTimerChanMode_Trigger, IO_TIMER_ALL_MODES_CHANNELS); }
#import <UIKit/UIKit.h> #import "BTUIKPaymentOptionType.h" #import "BTUIKViewUtil.h" /// @class A UIView containing the BTUIKVectorArtView for a BTUIKPaymentOptionType within a light border. @interface BTUIKPaymentOptionCardView : UIView /// The BTUIKPaymentOptionType to display @property (nonatomic) BTUIKPaymentOptionType paymentOptionType; /// Defaults to 4.0 @property (nonatomic) float cornerRadius; /// Inner padding between art and border. Defaults to 3 @property (nonatomic) float innerPadding; /// Stroke width around card border. Defaults to 1 @property (nonatomic) float borderWidth; /// Stroke color around card border. Defaults to #C8C7CC @property (nonatomic, strong) UIColor *borderColor; /// Vector art size, defaults to Regular @property (nonatomic) BTUIKVectorArtSize vectorArtSize; /// Set the highlighted state of the view. /// /// @param highlighted When true, change the border color to the tint color. Otherwise light gray. - (void)setHighlighted:(BOOL)highlighted; /// Use the art dimensions to ensure that the width/height ratio is /// appropriate. /// /// @return A CGSize. Usually CGSizeMake(87.0f, 55.0f) - (CGSize)getArtDimensions; @end
/*************************************************************************/ /* power_iphone.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* 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. */ /*************************************************************************/ #ifndef POWER_IPHONE_H #define POWER_IPHONE_H #include <os/os.h> class PowerIphone { private: int nsecs_left; int percent_left; OS::PowerState power_state; bool UpdatePowerInfo(); public: PowerIphone(); virtual ~PowerIphone(); OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; #endif // POWER_IPHONE_H
/* Copyright (c) 2009 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. */ // // GDataBlogger.h // #import "GDataElements.h" // Blogger #import "GDataThreadingElements.h" #import "GDataBloggerConstants.h" #import "GDataEntryBlog.h" #import "GDataEntryBlogPost.h" #import "GDataEntryBlogComment.h" #import "GDataFeedBlog.h" #import "GDataFeedBlogPost.h" #import "GDataFeedBlogComment.h" #import "GDataServiceGoogleBlogger.h"
// // FKFlickrPhotosetsCommentsDeleteComment.h // FlickrKit // // Generated by FKAPIBuilder. // Copyright (c) 2013 DevedUp Ltd. All rights reserved. http://www.devedup.com // // DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED #import "FKFlickrAPIMethod.h" typedef NS_ENUM(NSInteger, FKFlickrPhotosetsCommentsDeleteCommentError) { FKFlickrPhotosetsCommentsDeleteCommentError_CommentNotFound = 2, /* The comment id passed was not a valid comment id */ FKFlickrPhotosetsCommentsDeleteCommentError_SSLIsRequired = 95, /* SSL is required to access the Flickr API. */ FKFlickrPhotosetsCommentsDeleteCommentError_InvalidSignature = 96, /* The passed signature was invalid. */ FKFlickrPhotosetsCommentsDeleteCommentError_MissingSignature = 97, /* The call required signing but no signature was sent. */ FKFlickrPhotosetsCommentsDeleteCommentError_LoginFailedOrInvalidAuthToken = 98, /* The login details or auth token passed were invalid. */ FKFlickrPhotosetsCommentsDeleteCommentError_UserNotLoggedInOrInsufficientPermissions = 99, /* The method requires user authentication but the user was not logged in, or the authenticated method call did not have the required permissions. */ FKFlickrPhotosetsCommentsDeleteCommentError_InvalidAPIKey = 100, /* The API key passed was not valid or has expired. */ FKFlickrPhotosetsCommentsDeleteCommentError_ServiceCurrentlyUnavailable = 105, /* The requested service is temporarily unavailable. */ FKFlickrPhotosetsCommentsDeleteCommentError_WriteOperationFailed = 106, /* The requested operation failed due to a temporary issue. */ FKFlickrPhotosetsCommentsDeleteCommentError_FormatXXXNotFound = 111, /* The requested response format was not found. */ FKFlickrPhotosetsCommentsDeleteCommentError_MethodXXXNotFound = 112, /* The requested method was not found. */ FKFlickrPhotosetsCommentsDeleteCommentError_InvalidSOAPEnvelope = 114, /* The SOAP envelope send in the request could not be parsed. */ FKFlickrPhotosetsCommentsDeleteCommentError_InvalidXMLRPCMethodCall = 115, /* The XML-RPC request document could not be parsed. */ FKFlickrPhotosetsCommentsDeleteCommentError_BadURLFound = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */ }; /* Delete a photoset comment as the currently authenticated user. */ @interface FKFlickrPhotosetsCommentsDeleteComment : NSObject <FKFlickrAPIMethod> /* The id of the comment to delete from a photoset. */ @property (nonatomic, copy) NSString *comment_id; /* (Required) */ @end
/* ARC target-dependent stuff. Extension data structures. Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of libopcodes. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. It 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. */ /*This header file defines a table of extensions to the ARC processor architecture. These extensions are read from the '.arcextmap' or '.gnu.linkonce.arcextmap.<type>.<N>' sections in the ELF file which is identified by the bfd parameter to the build_ARC_extmap function. These extensions may include: core registers auxiliary registers instructions condition codes Once the table has been constructed, accessor functions may be used to retrieve information from it. The build_ARC_extmap constructor function build_ARC_extmap may be called as many times as required; it will re-initialize the table each time. */ #ifndef ARC_EXTENSIONS_H #define ARC_EXTENSIONS_H #include "opcode/arc.h" #ifdef __cplusplus extern "C" { #endif #define IGNORE_FIRST_OPD 1 /* Define this if we do not want to encode instructions based on the ARCompact Programmer's Reference. */ #define UNMANGLED /* This defines the kinds of extensions which may be read from the ections in the executable files. */ enum ExtOperType { EXT_INSTRUCTION = 0, EXT_CORE_REGISTER = 1, EXT_AUX_REGISTER = 2, EXT_COND_CODE = 3, EXT_INSTRUCTION32 = 4, EXT_AC_INSTRUCTION = 4, EXT_REMOVE_CORE_REG = 5, EXT_LONG_CORE_REGISTER = 6, EXT_AUX_REGISTER_EXTENDED = 7, EXT_INSTRUCTION32_EXTENDED = 8, EXT_CORE_REGISTER_CLASS = 9 }; enum ExtReadWrite { REG_INVALID, REG_READ, REG_WRITE, REG_READWRITE }; /* Macro used when generating the patterns for an extension instruction. */ #define INSERT_XOP(OP, NAME, CODE, MASK, CPU, ARG, FLG) \ do { \ (OP)->name = NAME; \ (OP)->opcode = CODE; \ (OP)->mask = MASK; \ (OP)->cpu = CPU; \ (OP)->insn_class = ARITH; \ (OP)->subclass = NONE; \ memcpy ((OP)->operands, (ARG), MAX_INSN_ARGS); \ memcpy ((OP)->flags, (FLG), MAX_INSN_FLGS); \ (OP++); \ } while (0) /* Typedef to hold the extension instruction definition. */ typedef struct ExtInstruction { /* Name. */ char *name; /* Major opcode. */ char major; /* Minor(sub) opcode. */ char minor; /* Flags, holds the syntax class and modifiers. */ char flags; /* Syntax class. Use by assembler. */ unsigned char syntax; /* Syntax class modifier. Used by assembler. */ unsigned char modsyn; /* Suffix class. Used by assembler. */ unsigned char suffix; /* Pointer to the next extension instruction. */ struct ExtInstruction* next; } extInstruction_t; /* Constructor function. */ extern void build_ARC_extmap (bfd *); /* Accessor functions. */ extern enum ExtReadWrite arcExtMap_coreReadWrite (int); extern const char * arcExtMap_coreRegName (int); extern const char * arcExtMap_auxRegName (long); extern const char * arcExtMap_condCodeName (int); extern const extInstruction_t *arcExtMap_insn (int, unsigned long long); extern struct arc_opcode *arcExtMap_genOpcode (const extInstruction_t *, unsigned arc_target, const char **errmsg); /* Dump function (for debugging). */ extern void dump_ARC_extmap (void); #ifdef __cplusplus } #endif #endif /* ARC_EXTENSIONS_H */
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas at Austin 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 The University of Texas at Austin 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. */ #include "blis.h" #if 0 static gemm_voft vars[4][3] = { // unblocked optimized unblocked blocked { NULL, NULL, bli_trmm_blk_var1 }, { NULL, bli_trmm_xx_ker_var2, bli_trmm_blk_var2 }, { NULL, NULL, bli_trmm_blk_var3 }, { NULL, NULL, NULL }, }; #endif void bli_trmm_int ( obj_t* alpha, obj_t* a, obj_t* b, obj_t* beta, obj_t* c, cntx_t* cntx, cntl_t* cntl, thrinfo_t* thread ) { obj_t a_local; obj_t b_local; obj_t c_local; #if 0 bool_t side, uplo; #endif varnum_t n; impl_t i; gemm_voft f; // Check parameters. if ( bli_error_checking_is_enabled() ) bli_gemm_basic_check( alpha, a, b, beta, c, cntx ); // If C has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; // If A or B has a zero dimension, scale C by beta and return early. if ( bli_obj_has_zero_dim( *a ) || bli_obj_has_zero_dim( *b ) ) { if( bli_thread_am_ochief( thread ) ) bli_scalm( beta, c ); bli_thread_obarrier( thread ); return; } // Alias A and B in case we need to update attached scalars. bli_obj_alias_to( *a, a_local ); bli_obj_alias_to( *b, b_local ); // Alias C in case we need to induce a transposition. bli_obj_alias_to( *c, c_local ); // If we are about to call a leaf-level implementation, and matrix C // still needs a transposition, then we must induce one by swapping the // strides and dimensions. Note that this transposition would normally // be handled explicitly in the packing of C, but if C is not being // packed, this is our last chance to handle the transposition. #if 0 if ( bli_cntl_is_leaf( cntl ) && bli_obj_has_trans( *c ) ) { bli_obj_induce_trans( c_local ); bli_obj_set_onlytrans( BLIS_NO_TRANSPOSE, c_local ); } #endif // If alpha is non-unit, typecast and apply it to the scalar attached // to B. if ( !bli_obj_equals( alpha, &BLIS_ONE ) ) { bli_obj_scalar_apply_scalar( alpha, &b_local ); } // If beta is non-unit, typecast and apply it to the scalar attached // to C. if ( !bli_obj_equals( beta, &BLIS_ONE ) ) { bli_obj_scalar_apply_scalar( beta, &c_local ); } #if 0 // Set two bools: one based on the implied side parameter (the structure // of the root object) and one based on the uplo field of the triangular // matrix's root object (whether that is matrix A or matrix B). if ( bli_obj_root_is_triangular( *a ) ) { side = 0; if ( bli_obj_root_is_lower( *a ) ) uplo = 0; else uplo = 1; } else // if ( bli_obj_root_is_triangular( *b ) ) { side = 1; if ( bli_obj_root_is_lower( *b ) ) uplo = 0; else uplo = 1; } #endif #if 0 // Extract the variant number and implementation type. n = bli_cntl_var_num( cntl ); i = bli_cntl_impl_type( cntl ); // Index into the variant array to extract the correct function pointer. f = vars[n][i]; #endif // Extract the function pointer from the current control tree node. f = bli_cntl_var_func( cntl ); // Invoke the variant. f ( &a_local, &b_local, &c_local, cntx, cntl, thread ); }
/* * tclWinUtil.c -- * * This file contains a collection of utility procedures that * are present in Tcl's Windows core but not in the generic * core. For example, they do file manipulation and process * manipulation. * * Copyright (c) 1994-1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * SCCS: @(#) tclWinUtil.c 1.9 96/01/16 10:31:48 */ #include "tclInt.h" #include "tclPort.h" /* *---------------------------------------------------------------------- * * Tcl_WaitPid -- * * Does the waitpid system call. * * Results: * Returns return value of pid it's waiting for. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_WaitPid(pid, statPtr, options) pid_t pid; int *statPtr; int options; { int flags; DWORD ret; if (options & WNOHANG) { flags = 0; } else { flags = INFINITE; } ret = WaitForSingleObject((HANDLE)pid, flags); if (ret == WAIT_TIMEOUT) { *statPtr = 0; return 0; } else if (ret != WAIT_FAILED) { GetExitCodeProcess((HANDLE)pid, (DWORD*)statPtr); *statPtr = ((*statPtr << 8) & 0xff00); CloseHandle((HANDLE)pid); return pid; } else { errno = ECHILD; return -1; } }
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // // l3dslib.h: header file for loading triangles from a 3DS triangle file // void Load3DSTriangleList (char *filename, triangle_t **pptri, int *numtriangles);
/* * This file contains the definitions for the following real-time clocks: * * + Motorola MC146818A * * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #ifndef __LIBCHIP_MC146818A_h #define __LIBCHIP_MC146818A_h /* * Register addresses within chip */ #define MC146818A_SEC 0x00 /* seconds */ #define MC146818A_SECALRM 0x01 /* seconds alarm */ #define MC146818A_MIN 0x02 /* minutes */ #define MC146818A_MINALRM 0x03 /* minutes alarm */ #define MC146818A_HRS 0x04 /* hours */ #define MC146818A_HRSALRM 0x05 /* hours alarm */ #define MC146818A_WDAY 0x06 /* week day */ #define MC146818A_DAY 0x07 /* day of month */ #define MC146818A_MONTH 0x08 /* month of year */ #define MC146818A_YEAR 0x09 /* month of year */ #define MC146818A_STATUSA 0x0a /* status register A */ #define MC146818ASA_TUP 0x80 /* time update in progress */ #define MC146818ASA_DIVIDER 0x20 /* divider for 32768 crystal */ #define MC146818ASA_1024 0x06 /* divide to 1024 Hz */ #define MC146818A_STATUSB 0x0b /* status register B */ #define MC146818ASB_DST 0x01 /* Daylight Savings Time */ #define MC146818ASB_24HR 0x02 /* 0 = 12 hours, 1 = 24 hours */ #define MC146818ASB_HALT 0x80 /* stop clock updates */ #define MC146818A_STATUSD 0x0d /* status register D */ #define MC146818ASD_PWR 0x80 /* clock lost power */ /* * Driver function table */ extern rtc_fns mc146818a_fns; bool mc146818a_probe( int minor ); /* * Default register access routines */ uint32_t mc146818a_get_register( uint32_t ulCtrlPort, uint8_t ucRegNum ); void mc146818a_set_register( uint32_t ulCtrlPort, uint8_t ucRegNum, uint32_t ucData ); #endif /* end of include file */
/* { dg-do run { target { power10_hw } } } */ /* { dg-do link { target { ! power10_hw } } } */ /* { dg-require-effective-target power10_ok } */ /* { dg-options "-mdejagnu-cpu=power10" } */ #include <altivec.h> extern void abort (void); /* Vector string clear left-most bytes of unsigned char. */ vector signed char clrl (vector signed char arg, int n) { return vec_clrl (arg, n); } int main (int argc, char *argv []) { vector signed char input0 = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 }; vector signed char expected0 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0xd, 0xe, 0xf, 0x11 }; vector signed char expected1 = { 0x0, 0x0, 0x0, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 }; vector signed char expected2 = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 }; if (!vec_all_eq (clrl (input0, 5), expected0)) abort (); if (!vec_all_eq (clrl (input0, 13), expected1)) abort (); if (!vec_all_eq (clrl (input0, 19), expected2)) abort (); }
// Copyright 2013 - Christian Schüller 2013, schuellc@inf.ethz.ch // Interactive Geometry Lab - ETH Zurich #pragma once #ifndef LIM_SOLVER_2D_H #define LIM_SOLVER_2D_H #include "LIMSolver.h" class TriangleMesh; class LIMSolver2D : public LIMSolver { public: virtual ~LIMSolver2D(); void Init(DeformableMesh* object); void Init(TriangleMesh* object); protected: TriangleMesh* mesh; Eigen::Matrix<int,6,Eigen::Dynamic> TriangleVertexIdx; Eigen::Matrix<double,Eigen::Dynamic,1> initialNodes; Eigen::Matrix<double*,1,Eigen::Dynamic> problemHessianCoeffs; Eigen::Matrix<double*,6,Eigen::Dynamic> nonFlipHessianCoeffs; Eigen::Matrix<double*,21,Eigen::Dynamic> denseHessianCoeffs; Eigen::Matrix<double*,1,Eigen::Dynamic> posConstraintsHessianCoeffs; LIMSolver2D(); // abstract functions virtual void debugOutput(std::stringstream& info) = 0; virtual void prepareProblemData(std::vector<int>& hessRowIdx, std::vector<int>& hessColIdx) = 0; virtual double computeFunction(const Eigen::Matrix<double,Eigen::Dynamic,1>& x) = 0; virtual void computeGradient(const Eigen::Matrix<double,Eigen::Dynamic,1>& x, Eigen::Matrix<double,Eigen::Dynamic,1>& grad) = 0; virtual void computeHessian(const Eigen::Matrix<double,Eigen::Dynamic,1>& x, const Eigen::Matrix<double*,Eigen::Dynamic,1>& hess) = 0; private: // implementation of abstract functions of LIMSolver void computeRestPoseFunctionParameters(); // implementation of abstract functions of NMSolver virtual void prepareNMProblemData(); virtual double computeNMFunction(const Eigen::Matrix<double,Eigen::Dynamic,1>& x); virtual void computeNMGradient(const Eigen::Matrix<double,Eigen::Dynamic,1>& x, Eigen::Matrix<double,Eigen::Dynamic,1>& grad); virtual void computeNMHessian(const Eigen::Matrix<double,Eigen::Dynamic,1>& x); }; const int NonFlipHessian2DIdx[6][2] = {{1,2},{0,3},{1,4},{3,4},{0,5},{2,5}}; #endif
/* * kcs.h - Cartridge handling, KCS cart. * * Written by * Andreas Boose <viceteam@t-online.de> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * 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 VICE_KCS_H #define VICE_KCS_H #include <stdio.h> #include "types.h" extern void kcs_freeze(void); extern void kcs_config_init(void); extern void kcs_config_setup(BYTE *rawcart); extern int kcs_bin_attach(const char *filename, BYTE *rawcart); extern int kcs_crt_attach(FILE *fd, BYTE *rawcart); extern void kcs_detach(void); struct snapshot_s; extern int kcs_snapshot_write_module(struct snapshot_s *s); extern int kcs_snapshot_read_module(struct snapshot_s *s); #endif
/* * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License v.2.1. * * You should have received a copy of the GNU Lesser 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 "tools.h" static int _vgmknodes_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle __attribute__((unused))) { if (arg_count(cmd, refresh_ARG) && lv_is_visible(lv)) if (!lv_refresh(cmd, lv)) return_ECMD_FAILED; if (!lv_mknodes(cmd, lv)) return_ECMD_FAILED; return ECMD_PROCESSED; } int vgmknodes(struct cmd_context *cmd, int argc, char **argv) { if (!lv_mknodes(cmd, NULL)) return_ECMD_FAILED; return process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL, &_vgmknodes_single); }
/* { dg-additional-options "-ffast-math" } */ double _Complex __attribute__((noipa)) foo (double _Complex acc, const double _Complex *x, const double _Complex* y, int N) { for (int c = 0; c < N; ++c) acc -= x[c] * y[c]; return acc; } int main() { static const double _Complex y[] = { 1, 2, }; static const double _Complex x[] = { 1, 3, }; double _Complex ref = foo (0, x, y, 2); if (__builtin_creal (ref) != -7.) __builtin_abort (); return 0; }
/* * workqueue.h --- work queue handling for Linux. */ #ifndef _LINUX_WORKQUEUE_H #define _LINUX_WORKQUEUE_H #include <linux/timer.h> #include <linux/linkage.h> #include <linux/bitops.h> #include <asm/atomic.h> struct workqueue_struct; struct work_struct; typedef void (*work_func_t)(struct work_struct *work); /* * The first word is the work queue pointer and the flags rolled into * one */ #define work_data_bits(work) ((unsigned long *)(&(work)->data)) struct work_struct { atomic_long_t data; #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ #define WORK_STRUCT_FLAG_MASK (3UL) #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) struct list_head entry; work_func_t func; }; #define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) struct delayed_work { struct work_struct work; struct timer_list timer; }; struct execute_work { struct work_struct work; }; #define __WORK_INITIALIZER(n, f) { \ .data = WORK_DATA_INIT(), \ .entry = { &(n).entry, &(n).entry }, \ .func = (f), \ } #define __DELAYED_WORK_INITIALIZER(n, f) { \ .work = __WORK_INITIALIZER((n).work, (f)), \ .timer = TIMER_INITIALIZER(NULL, 0, 0), \ } #define DECLARE_WORK(n, f) \ struct work_struct n = __WORK_INITIALIZER(n, f) #define DECLARE_DELAYED_WORK(n, f) \ struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) /* * initialize a work item's function pointer */ #define PREPARE_WORK(_work, _func) \ do { \ (_work)->func = (_func); \ } while (0) #define PREPARE_DELAYED_WORK(_work, _func) \ PREPARE_WORK(&(_work)->work, (_func)) /* * initialize all of a work item in one go * * NOTE! No point in using "atomic_long_set()": useing a direct * assignment of the work data initializer allows the compiler * to generate better code. */ #define INIT_WORK(_work, _func) \ do { \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ INIT_LIST_HEAD(&(_work)->entry); \ PREPARE_WORK((_work), (_func)); \ } while (0) #define INIT_DELAYED_WORK(_work, _func) \ do { \ INIT_WORK(&(_work)->work, (_func)); \ init_timer(&(_work)->timer); \ } while (0) #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ do { \ INIT_WORK(&(_work)->work, (_func)); \ init_timer_deferrable(&(_work)->timer); \ } while (0) /** * work_pending - Find out whether a work item is currently pending * @work: The work item in question */ #define work_pending(work) \ test_bit(WORK_STRUCT_PENDING, work_data_bits(work)) /** * delayed_work_pending - Find out whether a delayable work item is currently * pending * @work: The work item in question */ #define delayed_work_pending(w) \ work_pending(&(w)->work) /** * work_clear_pending - for internal use only, mark a work item as not pending * @work: The work item in question */ #define work_clear_pending(work) \ clear_bit(WORK_STRUCT_PENDING, work_data_bits(work)) extern struct workqueue_struct *__create_workqueue(const char *name, int singlethread, int freezeable); #define create_workqueue(name) __create_workqueue((name), 0, 0) #define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) extern void destroy_workqueue(struct workqueue_struct *wq); extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay)); extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay); extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); extern void flush_scheduled_work(void); extern int FASTCALL(schedule_work(struct work_struct *work)); extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay)); extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay); extern int schedule_on_each_cpu(work_func_t func); extern int current_is_keventd(void); extern int keventd_up(void); extern void init_workqueues(void); int execute_in_process_context(work_func_t fn, struct execute_work *); extern int cancel_work_sync(struct work_struct *work); /* * Kill off a pending schedule_delayed_work(). Note that the work callback * function may still be running on return from cancel_delayed_work(), unless * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or * cancel_work_sync() to wait on it. */ static inline int cancel_delayed_work(struct delayed_work *work) { int ret; ret = del_timer_sync(&work->timer); if (ret) work_clear_pending(&work->work); return ret; } extern int cancel_delayed_work_sync(struct delayed_work *work); /* Obsolete. use cancel_delayed_work_sync() */ static inline void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, struct delayed_work *work) { cancel_delayed_work_sync(work); } /* Obsolete. use cancel_delayed_work_sync() */ static inline void cancel_rearming_delayed_work(struct delayed_work *work) { cancel_delayed_work_sync(work); } #endif