text
stringlengths
2
100k
meta
dict
<script> import mpx from '@mpxjs/core' import apiProxy from '@mpxjs/api-proxy' mpx.use(apiProxy, { usePromise: true }) App({ onLaunch: function () { // todo: env替换 wx.cloud.init({ env: 'blog-demo-46b1v', traceUser: true }) }, globalData: { blog: {} } }) </script> <style> /**app.wxss**/ .container { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; box-sizing: border-box; } </style> <script type="application/json"> { "pages": [ "./pages/index", "./pages/detail", "./pages/list" ], "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "WeChat", "navigationBarTextStyle": "black" }, "tabBar": { "position": "top", "list": [ { "pagePath": "pages/index", "text": "发布" }, { "pagePath": "pages/list", "text": "列表" } ] }, "cloud": true } </script>
{ "pile_set_name": "Github" }
require_relative '../../../spec_helper' require 'uri' describe "URI::Generic#set_password" do it "needs to be reviewed for spec completeness" end
{ "pile_set_name": "Github" }
/** * Implements hook_simpletest_alter(). */ function {{ machine_name }}_simpletest_alter(&$groups) { // An alternative session handler module would not want to run the original // Session HTTPS handling test because it checks the sessions table in the // database. unset($groups['Session']['testHttpsSession']); }
{ "pile_set_name": "Github" }
{% extends "base.html" %} {% block announce %} <div style="display: flex; justify-content: center; align-items: center"> <img style="width: 48px; height: 48px; margin-right: 12px" src="https://microsoft.github.io/electionguard/assets/images/hacktoberfest-icon.svg"/> <a style="font-size: 1rem" href="https://microsoft.github.io/electionguard/Hacktoberfest">Join us for Hacktoberfest 2020 </a> </div> {% endblock %}
{ "pile_set_name": "Github" }
let g:airline#themes#cool#palette = {} " NORMAL let s:N1 = [ '#585858' , '#E4E4E4' , 59 , 188 ] let s:N2 = [ '#E4E4E4' , '#0087AF' , 188 , 31 ] let s:N3 = [ '#EEEEEE' , '#005F87' , 231 , 24] let g:airline#themes#cool#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) "let g:airline#themes#cool#palette.normal_modified = { "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ } " INSERT let s:I1 = [ '#585858' , '#E4E4E4' , 59 , 188 ] let s:I2 = [ '#E4E4E4' , '#47AF00' , 188 , 70 ] let s:I3 = [ '#EEEEEE' , '#2E8700' , 231 , 28 ] let g:airline#themes#cool#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) "let g:airline#themes#cool#palette.insert_modified = { "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ } "let g:airline#themes#cool#palette.insert_paste = { "\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , "\ } " REPLACE let s:R1 = [ '#585858' , '#E4E4E4' , 59 , 188 ] let s:R2 = [ '#E4E4E4' , '#AF5F00' , 188 , 130 ] let s:R3 = [ '#EEEEEE' , '#875300' , 231 , 94 ] let g:airline#themes#cool#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) "let g:airline#themes#cool#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] "let g:airline#themes#cool#palette.replace_modified = g:airline#themes#cool#palette.insert_modified " VISUAL let s:V1 = [ '#585858' , '#E4E4E4' , 59 , 188 ] let s:V2 = [ '#E4E4E4' , '#AF2800' , 188 , 124 ] let s:V3 = [ '#EEEEEE' , '#872800' , 231 , 88 ] let g:airline#themes#cool#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) "let g:airline#themes#cool#palette.visual_modified = { "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ } " INACTIVE let s:IA1 = [ '#585858' , '#E4E4E4' , 59 , 188 , '' ] let s:IA2 = [ '#E4E4E4' , '#466D79' , 188 , 60 , '' ] let s:IA3 = [ '#EEEEEE' , '#324E59' , 231 , 59 , '' ] let g:airline#themes#cool#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) "let g:airline#themes#cool#palette.inactive_modified = { "\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , "\ } let g:airline#themes#cool#palette.accents = { \ 'red': [ '#ff0000' , '' , 196 , '' ] \ } " CTRLP if !get(g:, 'loaded_ctrlp', 0) finish endif let g:airline#themes#cool#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( \ [ '#E4E4E4' , '#00AFA2' , 188 , 37 , '' ], \ [ '#EEEEEE' , '#008787' , 231 , 30 , '' ], \ [ '#585858' , '#E4E4E4' , 59 , 188 , '' ])
{ "pile_set_name": "Github" }
c76100bdc3f4c8e2580bb263accda9ec *tests/data/fate/vsynth2-mjpeg.avi 830154 tests/data/fate/vsynth2-mjpeg.avi 2b8c59c59e33d6ca7c85d31c5eeab7be *tests/data/fate/vsynth2-mjpeg.out.rawvideo stddev: 4.87 PSNR: 34.37 MAXDIFF: 55 bytes: 7603200/ 7603200
{ "pile_set_name": "Github" }
<app-loading [condition]="isLoading"></app-loading> <app-toast [message]="toast.message"></app-toast> <div class="card" *ngIf="!isLoading"> <h4 class="card-header">Registered users ({{users.length}})</h4> <div class="card-body"> <table class="table table-bordered"> <thead class="thead-light"> <tr> <th scope="col">Username</th> <th scope="col">Email</th> <th scope="col">Role</th> <th scope="col">Actions</th> </tr> </thead> <tbody *ngIf="users.length === 0"> <tr> <td colspan="4">There are no registered users.</td> </tr> </tbody> <tbody> <tr *ngFor="let user of users"> <td>{{user.username}}</td> <td>{{user.email}}</td> <td>{{user.role}}</td> <td> <button class="btn btn-sm btn-danger" (click)="deleteUser(user)" [disabled]="auth.currentUser._id === user._id"> <i class="fa fa-trash"></i> Delete </button> </td> </tr> </tbody> </table> </div> </div>
{ "pile_set_name": "Github" }
public enum Result<Value> { case success(Value) case failure(Error) } extension Result: CustomStringConvertible { public var description: String { switch self { case .success(let value): return "Success(\(value))" case .failure(let error): return "Error(\(error))" } } } extension Result { var value: Value? { switch self { case .success(let value): return value case .failure(_): return nil } } var error: Error? { switch self { case .success(_): return nil case .failure(let error): return error } } func valueOrError() throws -> Value { switch self { case .success(let value): return value case .failure(let error): throw error } } }
{ "pile_set_name": "Github" }
package cty import ( "fmt" ) // anyUnknown is a helper to easily check if a set of values contains any // unknowns, for operations that short-circuit to return unknown in that case. func anyUnknown(values ...Value) bool { for _, val := range values { if val.v == unknown { return true } } return false } // typeCheck tests whether all of the given values belong to the given type. // If the given types are a mixture of the given type and the dynamic // pseudo-type then a short-circuit dynamic value is returned. If the given // values are all of the correct type but at least one is unknown then // a short-circuit unknown value is returned. If any other types appear then // an error is returned. Otherwise (finally!) the result is nil, nil. func typeCheck(required Type, ret Type, values ...Value) (shortCircuit *Value, err error) { hasDynamic := false hasUnknown := false for i, val := range values { if val.ty == DynamicPseudoType { hasDynamic = true continue } if !val.Type().Equals(required) { return nil, fmt.Errorf( "type mismatch: want %s but value %d is %s", required.FriendlyName(), i, val.ty.FriendlyName(), ) } if val.v == unknown { hasUnknown = true } } if hasDynamic { return &DynamicVal, nil } if hasUnknown { ret := UnknownVal(ret) return &ret, nil } return nil, nil } // mustTypeCheck is a wrapper around typeCheck that immediately panics if // any error is returned. func mustTypeCheck(required Type, ret Type, values ...Value) *Value { shortCircuit, err := typeCheck(required, ret, values...) if err != nil { panic(err) } return shortCircuit } // shortCircuitForceType takes the return value from mustTypeCheck and // replaces it with an unknown of the given type if the original value was // DynamicVal. // // This is useful for operations that are specified to always return a // particular type, since then a dynamic result can safely be "upgrade" to // a strongly-typed unknown, which then allows subsequent operations to // be actually type-checked. // // It is safe to use this only if the operation in question is defined as // returning either a value of the given type or panicking, since we know // then that subsequent operations won't run if the operation panics. // // If the given short-circuit value is *not* DynamicVal then it must be // of the given type, or this function will panic. func forceShortCircuitType(shortCircuit *Value, ty Type) *Value { if shortCircuit == nil { return nil } if shortCircuit.ty == DynamicPseudoType { ret := UnknownVal(ty) return &ret } if !shortCircuit.ty.Equals(ty) { panic("forceShortCircuitType got value of wrong type") } return shortCircuit }
{ "pile_set_name": "Github" }
OPERATING SYSTEM SPECIFIC MIPS MSA DETECTION -------------------------------------------- Detection of the ability to execute MIPS MSA on an MIPS processor requires operating system support. (The information is not available in user mode.) HOW TO USE THIS --------------- This directory contains C code fragments that can be included in mips/mips_init.c by setting the macro PNG_MIPS_MSA_FILE to the file name in "" or <> at build time. This setting is not recorded in pnglibconf.h and can be changed simply by rebuilding mips/msa_init.o with the required macro definition. For any of this code to be used the MIPS MSA code must be enabled and run time checks must be supported. I.e.: #if PNG_MIPS_MSA_OPT > 0 #ifdef PNG_MIPS_MSA_CHECK_SUPPORTED This is done in a 'configure' build by passing configure the argument: --enable-mips-msa=check Apart from the basic Linux implementation in contrib/mips-msa/linux.c this code is unsupported. That means that it is not even compiled on a regular basis and may be broken in any given minor release. FILE FORMAT ----------- Each file documents its testing status as of the last time it was tested (which may have been a long time ago): STATUS: one of: SUPPORTED: This indicates that the file is included in the regularly performed test builds and bugs are fixed when discovered. COMPILED: This indicates that the code did compile at least once. See the more detailed description for the extent to which the result was successful. TESTED: This means the code was fully compiled into the libpng test programs and these were run at least once. BUG REPORTS: an email address to which to send reports of problems The file is a fragment of C code. It should not define any 'extern' symbols; everything should be static. It must define the function: static int png_have_msa(png_structp png_ptr); That function must return 1 if MIPS MSA instructions are supported, 0 if not. It must not execute png_error unless it detects a bug. A png_error will prevent the reading of the PNG and in the future, writing too. BUG REPORTS ----------- If you mail a bug report for any file that is not SUPPORTED there may only be limited response. Consider fixing it and sending a patch to fix the problem - this is more likely to result in action. CONTRIBUTIONS ------------- You may send contributions of new implementations to [email protected]. Please write code in strict C90 C where possible. Obviously OS dependencies are to be expected. If you submit code you must have the authors permission and it must have a license that is acceptable to the current maintainer; in particular that license must permit modification and redistribution. Please try to make the contribution a single file and give the file a clear and unambiguous name that identifies the target OS. If multiple files really are required put them all in a sub-directory. You must also be prepared to handle bug reports from users of the code, either by joining the png-mng-implement mailing list or by providing an email for the "BUG REPORTS" entry or both. Please make sure that the header of the file contains the STATUS and BUG REPORTS fields as above. Please list the OS requirements as precisely as possible. Ideally you should also list the environment in which the code has been tested and certainly list any environments where you suspect it might not work.
{ "pile_set_name": "Github" }
include_rules = [ "+breakpad/src/client/ios", "+breakpad/src/common", "+components/about_handler", "+components/autofill/core/browser", "+components/autofill/core/common", "+components/autofill/ios/browser", "+components/bookmarks", "+components/browser_sync", "+components/browsing_data/core", "+components/component_updater", "+components/content_settings/core", "+components/cookie_config", "+components/crash/core/browser", "+components/crash/core/common", "+components/dom_distiller/core", "+components/dom_distiller/ios", "+components/favicon/core", "+components/favicon_base", "+components/flags_ui", "+components/gcm_driver", "+components/google/core/browser", "+components/handoff", "+components/history/core/browser", "+components/history/ios/browser", "+components/image_fetcher", "+components/infobars/core", "+components/invalidation", "+components/keyed_service/core", "+components/keyed_service/ios", "+components/language_usage_metrics", "+components/leveldb_proto", "+components/metrics", "+components/ntp_tiles", "+components/user_prefs", "+components/metrics_services_manager", "+components/navigation_metrics", "+components/net_log", "+components/network_session_configurator", "+components/network_time", "+components/ntp_snippets", "+components/ntp_tiles", "+components/omnibox/browser", "+components/open_from_clipboard", "+components/password_manager/core/browser", "+components/password_manager/core/common", "+components/password_manager/sync/browser", "+components/physical_web/data_source", "+components/physical_web/webui", "+components/pref_registry", "+components/prefs", "+components/profile_metrics", "+components/proxy_config", "+components/rappor", "+components/reading_list", "+components/rlz", "+components/search", "+components/search_engines", "+components/search_provider_logos", "+components/security_interstitials", "+components/security_state", "+components/sessions", "+components/signin/core/browser", "+components/signin/core/common", "+components/signin/ios/browser", "+components/ssl_config", "+components/suggestions", "+components/sync", "+components/sync_sessions", "+components/sync_preferences", "+components/task_scheduler_util", "+components/translate/core", "+components/translate/ios", "+components/undo", "+components/update_client", "+components/upload_list", "+components/url_formatter", "+components/variations", "+components/version_info", "+components/version_ui", "+components/web_resource", "+components/webdata_services", "+components/webp_transcode", "+crypto", "+google_apis", "+ios/chrome/common", "+ios/net", "+ios/public/provider/chrome", "+ios/public/provider/components", "+ios/public/provider/web", "+ios/web/public", "+net", "+third_party/brotli", "+third_party/google_toolbox_for_mac", "+ui", # Those depend on //content; exclude them. "-components/metrics/gpu", "-components/sessions/content", # For tests. "+ios/chrome/test", "+ios/public/test", "+ios/testing", # Only parts of skia are compiled on iOS, so we explicitly list the # files that can be included to avoid bringing in more code. "+skia/ext/skia_utils_ios.h", "+third_party/skia/include/core/SkBitmap.h", # Strings and resources. "+components/grit", "+components/strings/grit", "+ios/chrome/grit", ]
{ "pile_set_name": "Github" }
/****************************** Module Header ******************************\ * Module Name: ThreadPool.h * Project: CppWindowsService * Copyright (c) Microsoft Corporation. * * The class was designed by Kenny Kerr. It provides the ability to queue * simple member functions of a class to the Windows thread pool. * * Using the thread pool is simple and feels natural in C++. * * class RenderService * { * public: * * void AsyncRun() * { * CThreadPool::QueueUserWorkItem(&Service::Run, this); * } * * void Run() * { * // Some lengthy operation * } * }; * * Kenny Kerr spends most of his time designing and building distributed * applications for the Microsoft Windows platform. He also has a particular * passion for C++ and security programming. Reach Kenny at * http://weblogs.asp.net/kennykerr/ or visit his Web site: * http://www.kennyandkarin.com/Kenny/. * * This source is subject to the Microsoft Public License. * See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL. * All other rights reserved. * * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. \***************************************************************************/ #pragma once #include <memory> class CThreadPool { public: template <typename T> static void QueueUserWorkItem(void (T::*function)(void), T *object, ULONG flags = WT_EXECUTELONGFUNCTION) { typedef std::pair<void (T::*)(), T *> CallbackType; std::auto_ptr<CallbackType> p(new CallbackType(function, object)); if (::QueueUserWorkItem(ThreadProc<T>, p.get(), flags)) { // The ThreadProc now has the responsibility of deleting the pair. p.release(); } else { throw GetLastError(); } } private: template <typename T> static DWORD WINAPI ThreadProc(PVOID context) { typedef std::pair<void (T::*)(), T *> CallbackType; std::auto_ptr<CallbackType> p(static_cast<CallbackType *>(context)); (p->second->*p->first)(); return 0; } };
{ "pile_set_name": "Github" }
cask "font-hanalei" do version :latest sha256 :no_check # github.com/google/fonts/ was verified as official when first introduced to the cask url "https://github.com/google/fonts/raw/master/ofl/hanalei/Hanalei-Regular.ttf" name "Hanalei" homepage "https://fonts.google.com/specimen/Hanalei" font "Hanalei-Regular.ttf" end
{ "pile_set_name": "Github" }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import "./DisplayPerfRpcImpl"; // just to get the RPC implementation registered import { Config } from "@bentley/bentleyjs-core"; import { IModelJsConfig } from "@bentley/config-loader/lib/IModelJsConfig"; import { IModelHost, IModelHostConfiguration } from "@bentley/imodeljs-backend"; import { IModelReadRpcInterface, IModelTileRpcInterface, SnapshotIModelRpcInterface } from "@bentley/imodeljs-common"; import DisplayPerfRpcInterface from "../common/DisplayPerfRpcInterface"; IModelJsConfig.init(true /* suppress exception */, true /* suppress error message */, Config.App); process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; // (needed temporarily to use self-signed cert to communicate with iModelBank via https) export function getRpcInterfaces() { return [DisplayPerfRpcInterface, IModelTileRpcInterface, SnapshotIModelRpcInterface, IModelReadRpcInterface]; } export async function initializeBackend() { const hostConfig = new IModelHostConfiguration(); await IModelHost.startup(hostConfig); }
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Controller * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ /** @see Zend_Controller_Request_Abstract */ #require_once 'Zend/Controller/Request/Abstract.php'; /** @see Zend_Uri */ #require_once 'Zend/Uri.php'; /** * Zend_Controller_Request_Http * * HTTP request object for use with Zend_Controller family. * * @uses Zend_Controller_Request_Abstract * @package Zend_Controller * @subpackage Request */ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract { /** * Scheme for http * */ const SCHEME_HTTP = 'http'; /** * Scheme for https * */ const SCHEME_HTTPS = 'https'; /** * Allowed parameter sources * @var array */ protected $_paramSources = array('_GET', '_POST'); /** * REQUEST_URI * @var string; */ protected $_requestUri; /** * Base URL of request * @var string */ protected $_baseUrl = null; /** * Base path of request * @var string */ protected $_basePath = null; /** * PATH_INFO * @var string */ protected $_pathInfo = ''; /** * Instance parameters * @var array */ protected $_params = array(); /** * Raw request body * @var string|false */ protected $_rawBody; /** * Alias keys for request parameters * @var array */ protected $_aliases = array(); /** * Constructor * * If a $uri is passed, the object will attempt to populate itself using * that information. * * @param string|Zend_Uri $uri * @return void * @throws Zend_Controller_Request_Exception when invalid URI passed */ public function __construct($uri = null) { if (null !== $uri) { if (!$uri instanceof Zend_Uri) { $uri = Zend_Uri::factory($uri); } if ($uri->valid()) { $path = $uri->getPath(); $query = $uri->getQuery(); if (!empty($query)) { $path .= '?' . $query; } $this->setRequestUri($path); } else { #require_once 'Zend/Controller/Request/Exception.php'; throw new Zend_Controller_Request_Exception('Invalid URI provided to constructor'); } } else { $this->setRequestUri(); } } /** * Access values contained in the superglobals as public members * Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV * * @see http://msdn.microsoft.com/en-us/library/system.web.httprequest.item.aspx * @param string $key * @return mixed */ public function __get($key) { switch (true) { case isset($this->_params[$key]): return $this->_params[$key]; case isset($_GET[$key]): return $_GET[$key]; case isset($_POST[$key]): return $_POST[$key]; case isset($_COOKIE[$key]): return $_COOKIE[$key]; case ($key == 'REQUEST_URI'): return $this->getRequestUri(); case ($key == 'PATH_INFO'): return $this->getPathInfo(); case isset($_SERVER[$key]): return $_SERVER[$key]; case isset($_ENV[$key]): return $_ENV[$key]; default: return null; } } /** * Alias to __get * * @param string $key * @return mixed */ public function get($key) { return $this->__get($key); } /** * Set values * * In order to follow {@link __get()}, which operates on a number of * superglobals, setting values through overloading is not allowed and will * raise an exception. Use setParam() instead. * * @param string $key * @param mixed $value * @return void * @throws Zend_Controller_Request_Exception */ public function __set($key, $value) { #require_once 'Zend/Controller/Request/Exception.php'; throw new Zend_Controller_Request_Exception('Setting values in superglobals not allowed; please use setParam()'); } /** * Alias to __set() * * @param string $key * @param mixed $value * @return void */ public function set($key, $value) { return $this->__set($key, $value); } /** * Check to see if a property is set * * @param string $key * @return boolean */ public function __isset($key) { switch (true) { case isset($this->_params[$key]): return true; case isset($_GET[$key]): return true; case isset($_POST[$key]): return true; case isset($_COOKIE[$key]): return true; case isset($_SERVER[$key]): return true; case isset($_ENV[$key]): return true; default: return false; } } /** * Alias to __isset() * * @param string $key * @return boolean */ public function has($key) { return $this->__isset($key); } /** * Set GET values * * @param string|array $spec * @param null|mixed $value * @return Zend_Controller_Request_Http */ public function setQuery($spec, $value = null) { if ((null === $value) && !is_array($spec)) { #require_once 'Zend/Controller/Exception.php'; throw new Zend_Controller_Exception('Invalid value passed to setQuery(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { foreach ($spec as $key => $value) { $this->setQuery($key, $value); } return $this; } $_GET[(string) $spec] = $value; return $this; } /** * Retrieve a member of the $_GET superglobal * * If no $key is passed, returns the entire $_GET array. * * @todo How to retrieve from nested arrays * @param string $key * @param mixed $default Default value to use if key not found * @return mixed Returns null if key does not exist */ public function getQuery($key = null, $default = null) { if (null === $key) { return $_GET; } return (isset($_GET[$key])) ? $_GET[$key] : $default; } /** * Set POST values * * @param string|array $spec * @param null|mixed $value * @return Zend_Controller_Request_Http */ public function setPost($spec, $value = null) { if ((null === $value) && !is_array($spec)) { #require_once 'Zend/Controller/Exception.php'; throw new Zend_Controller_Exception('Invalid value passed to setPost(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { foreach ($spec as $key => $value) { $this->setPost($key, $value); } return $this; } $_POST[(string) $spec] = $value; return $this; } /** * Retrieve a member of the $_POST superglobal * * If no $key is passed, returns the entire $_POST array. * * @todo How to retrieve from nested arrays * @param string $key * @param mixed $default Default value to use if key not found * @return mixed Returns null if key does not exist */ public function getPost($key = null, $default = null) { if (null === $key) { return $_POST; } return (isset($_POST[$key])) ? $_POST[$key] : $default; } /** * Retrieve a member of the $_COOKIE superglobal * * If no $key is passed, returns the entire $_COOKIE array. * * @todo How to retrieve from nested arrays * @param string $key * @param mixed $default Default value to use if key not found * @return mixed Returns null if key does not exist */ public function getCookie($key = null, $default = null) { if (null === $key) { return $_COOKIE; } return (isset($_COOKIE[$key])) ? $_COOKIE[$key] : $default; } /** * Retrieve a member of the $_SERVER superglobal * * If no $key is passed, returns the entire $_SERVER array. * * @param string $key * @param mixed $default Default value to use if key not found * @return mixed Returns null if key does not exist */ public function getServer($key = null, $default = null) { if (null === $key) { return $_SERVER; } return (isset($_SERVER[$key])) ? $_SERVER[$key] : $default; } /** * Retrieve a member of the $_ENV superglobal * * If no $key is passed, returns the entire $_ENV array. * * @param string $key * @param mixed $default Default value to use if key not found * @return mixed Returns null if key does not exist */ public function getEnv($key = null, $default = null) { if (null === $key) { return $_ENV; } return (isset($_ENV[$key])) ? $_ENV[$key] : $default; } /** * Set the REQUEST_URI on which the instance operates * * If no request URI is passed, uses the value in $_SERVER['REQUEST_URI'], * $_SERVER['HTTP_X_REWRITE_URL'], or $_SERVER['ORIG_PATH_INFO'] + $_SERVER['QUERY_STRING']. * * @param string $requestUri * @return Zend_Controller_Request_Http */ public function setRequestUri($requestUri = null) { if ($requestUri === null) { if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { // IIS with Microsoft Rewrite Module $requestUri = $_SERVER['HTTP_X_ORIGINAL_URL']; } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // IIS with ISAPI_Rewrite $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif ( // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem) isset($_SERVER['IIS_WasUrlRewritten']) && $_SERVER['IIS_WasUrlRewritten'] == '1' && isset($_SERVER['UNENCODED_URL']) && $_SERVER['UNENCODED_URL'] != '' ) { $requestUri = $_SERVER['UNENCODED_URL']; } elseif (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; // Http proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path $schemeAndHttpHost = $this->getScheme() . '://' . $this->getHttpHost(); if (strpos($requestUri, $schemeAndHttpHost) === 0) { $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); } } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI $requestUri = $_SERVER['ORIG_PATH_INFO']; if (!empty($_SERVER['QUERY_STRING'])) { $requestUri .= '?' . $_SERVER['QUERY_STRING']; } } else { return $this; } } elseif (!is_string($requestUri)) { return $this; } else { // Set GET items, if available if (false !== ($pos = strpos($requestUri, '?'))) { // Get key => value pairs and set $_GET $query = substr($requestUri, $pos + 1); parse_str($query, $vars); $this->setQuery($vars); } } $this->_requestUri = $requestUri; return $this; } /** * Returns the REQUEST_URI taking into account * platform differences between Apache and IIS * * @return string */ public function getRequestUri() { if (empty($this->_requestUri)) { $this->setRequestUri(); } return $this->_requestUri; } /** * Set the base URL of the request; i.e., the segment leading to the script name * * E.g.: * - /admin * - /myapp * - /subdir/index.php * * Do not use the full URI when providing the base. The following are * examples of what not to use: * - http://example.com/admin (should be just /admin) * - http://example.com/subdir/index.php (should be just /subdir/index.php) * * If no $baseUrl is provided, attempts to determine the base URL from the * environment, using SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF, and * ORIG_SCRIPT_NAME in its determination. * * @param mixed $baseUrl * @return Zend_Controller_Request_Http */ public function setBaseUrl($baseUrl = null) { if ((null !== $baseUrl) && !is_string($baseUrl)) { return $this; } if ($baseUrl === null) { $filename = (isset($_SERVER['SCRIPT_FILENAME'])) ? basename($_SERVER['SCRIPT_FILENAME']) : ''; if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $filename) { $baseUrl = $_SERVER['SCRIPT_NAME']; } elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $filename) { $baseUrl = $_SERVER['PHP_SELF']; } elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $filename) { $baseUrl = $_SERVER['ORIG_SCRIPT_NAME']; // 1and1 shared hosting compatibility } else { // Backtrack up the script_filename to find the portion matching // php_self $path = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : ''; $file = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : ''; $segs = explode('/', trim($file, '/')); $segs = array_reverse($segs); $index = 0; $last = count($segs); $baseUrl = ''; do { $seg = $segs[$index]; $baseUrl = '/' . $seg . $baseUrl; ++$index; } while (($last > $index) && (false !== ($pos = strpos($path, $baseUrl))) && (0 != $pos)); } // Does the baseUrl have anything in common with the request_uri? $requestUri = $this->getRequestUri(); if (0 === strpos($requestUri, $baseUrl)) { // full $baseUrl matches $this->_baseUrl = $baseUrl; return $this; } if (0 === strpos($requestUri, dirname($baseUrl))) { // directory portion of $baseUrl matches $this->_baseUrl = rtrim(dirname($baseUrl), '/'); return $this; } $truncatedRequestUri = $requestUri; if (($pos = strpos($requestUri, '?')) !== false) { $truncatedRequestUri = substr($requestUri, 0, $pos); } $basename = basename($baseUrl); if (empty($basename) || !strpos($truncatedRequestUri, $basename)) { // no match whatsoever; set it blank $this->_baseUrl = ''; return $this; } // If using mod_rewrite or ISAPI_Rewrite strip the script filename // out of baseUrl. $pos !== 0 makes sure it is not matching a value // from PATH_INFO or QUERY_STRING if ((strlen($requestUri) >= strlen($baseUrl)) && ((false !== ($pos = strpos($requestUri, $baseUrl))) && ($pos !== 0))) { $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); } } $this->_baseUrl = rtrim($baseUrl, '/'); return $this; } /** * Everything in REQUEST_URI before PATH_INFO * <form action="<?=$baseUrl?>/news/submit" method="POST"/> * * @return string */ public function getBaseUrl($raw = false) { if (null === $this->_baseUrl) { $this->setBaseUrl(); } return (($raw == false) ? urldecode($this->_baseUrl) : $this->_baseUrl); } /** * Set the base path for the URL * * @param string|null $basePath * @return Zend_Controller_Request_Http */ public function setBasePath($basePath = null) { if ($basePath === null) { $filename = (isset($_SERVER['SCRIPT_FILENAME'])) ? basename($_SERVER['SCRIPT_FILENAME']) : ''; $baseUrl = $this->getBaseUrl(); if (empty($baseUrl)) { $this->_basePath = ''; return $this; } if (basename($baseUrl) === $filename) { $basePath = dirname($baseUrl); } else { $basePath = $baseUrl; } } if (substr(PHP_OS, 0, 3) === 'WIN') { $basePath = str_replace('\\', '/', $basePath); } $this->_basePath = rtrim($basePath, '/'); return $this; } /** * Everything in REQUEST_URI before PATH_INFO not including the filename * <img src="<?=$basePath?>/images/zend.png"/> * * @return string */ public function getBasePath() { if (null === $this->_basePath) { $this->setBasePath(); } return $this->_basePath; } /** * Set the PATH_INFO string * * @param string|null $pathInfo * @return Zend_Controller_Request_Http */ public function setPathInfo($pathInfo = null) { if ($pathInfo === null) { $baseUrl = $this->getBaseUrl(); // this actually calls setBaseUrl() & setRequestUri() $baseUrlRaw = $this->getBaseUrl(false); $baseUrlEncoded = urlencode($baseUrlRaw); if (null === ($requestUri = $this->getRequestUri())) { return $this; } // Remove the query string from REQUEST_URI if ($pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } if (!empty($baseUrl) || !empty($baseUrlRaw)) { if (strpos($requestUri, $baseUrl) === 0) { $pathInfo = substr($requestUri, strlen($baseUrl)); } elseif (strpos($requestUri, $baseUrlRaw) === 0) { $pathInfo = substr($requestUri, strlen($baseUrlRaw)); } elseif (strpos($requestUri, $baseUrlEncoded) === 0) { $pathInfo = substr($requestUri, strlen($baseUrlEncoded)); } else { $pathInfo = $requestUri; } } else { $pathInfo = $requestUri; } } $this->_pathInfo = (string) $pathInfo; return $this; } /** * Returns everything between the BaseUrl and QueryString. * This value is calculated instead of reading PATH_INFO * directly from $_SERVER due to cross-platform differences. * * @return string */ public function getPathInfo() { if (empty($this->_pathInfo)) { $this->setPathInfo(); } return $this->_pathInfo; } /** * Set allowed parameter sources * * Can be empty array, or contain one or more of '_GET' or '_POST'. * * @param array $paramSoures * @return Zend_Controller_Request_Http */ public function setParamSources(array $paramSources = array()) { $this->_paramSources = $paramSources; return $this; } /** * Get list of allowed parameter sources * * @return array */ public function getParamSources() { return $this->_paramSources; } /** * Set a userland parameter * * Uses $key to set a userland parameter. If $key is an alias, the actual * key will be retrieved and used to set the parameter. * * @param mixed $key * @param mixed $value * @return Zend_Controller_Request_Http */ public function setParam($key, $value) { $key = (null !== ($alias = $this->getAlias($key))) ? $alias : $key; parent::setParam($key, $value); return $this; } /** * Retrieve a parameter * * Retrieves a parameter from the instance. Priority is in the order of * userland parameters (see {@link setParam()}), $_GET, $_POST. If a * parameter matching the $key is not found, null is returned. * * If the $key is an alias, the actual key aliased will be used. * * @param mixed $key * @param mixed $default Default value to use if key not found * @return mixed */ public function getParam($key, $default = null) { $keyName = (null !== ($alias = $this->getAlias($key))) ? $alias : $key; $paramSources = $this->getParamSources(); if (isset($this->_params[$keyName])) { return $this->_params[$keyName]; } elseif (in_array('_GET', $paramSources) && (isset($_GET[$keyName]))) { return $_GET[$keyName]; } elseif (in_array('_POST', $paramSources) && (isset($_POST[$keyName]))) { return $_POST[$keyName]; } return $default; } /** * Retrieve an array of parameters * * Retrieves a merged array of parameters, with precedence of userland * params (see {@link setParam()}), $_GET, $_POST (i.e., values in the * userland params will take precedence over all others). * * @return array */ public function getParams() { $return = $this->_params; $paramSources = $this->getParamSources(); if (in_array('_GET', $paramSources) && isset($_GET) && is_array($_GET) ) { $return += $_GET; } if (in_array('_POST', $paramSources) && isset($_POST) && is_array($_POST) ) { $return += $_POST; } return $return; } /** * Set parameters * * Set one or more parameters. Parameters are set as userland parameters, * using the keys specified in the array. * * @param array $params * @return Zend_Controller_Request_Http */ public function setParams(array $params) { foreach ($params as $key => $value) { $this->setParam($key, $value); } return $this; } /** * Set a key alias * * Set an alias used for key lookups. $name specifies the alias, $target * specifies the actual key to use. * * @param string $name * @param string $target * @return Zend_Controller_Request_Http */ public function setAlias($name, $target) { $this->_aliases[$name] = $target; return $this; } /** * Retrieve an alias * * Retrieve the actual key represented by the alias $name. * * @param string $name * @return string|null Returns null when no alias exists */ public function getAlias($name) { if (isset($this->_aliases[$name])) { return $this->_aliases[$name]; } return null; } /** * Retrieve the list of all aliases * * @return array */ public function getAliases() { return $this->_aliases; } /** * Return the method by which the request was made * * @return string */ public function getMethod() { return $this->getServer('REQUEST_METHOD'); } /** * Was the request made by POST? * * @return boolean */ public function isPost() { if ('POST' == $this->getMethod()) { return true; } return false; } /** * Was the request made by GET? * * @return boolean */ public function isGet() { if ('GET' == $this->getMethod()) { return true; } return false; } /** * Was the request made by PUT? * * @return boolean */ public function isPut() { if ('PUT' == $this->getMethod()) { return true; } return false; } /** * Was the request made by DELETE? * * @return boolean */ public function isDelete() { if ('DELETE' == $this->getMethod()) { return true; } return false; } /** * Was the request made by HEAD? * * @return boolean */ public function isHead() { if ('HEAD' == $this->getMethod()) { return true; } return false; } /** * Was the request made by OPTIONS? * * @return boolean */ public function isOptions() { if ('OPTIONS' == $this->getMethod()) { return true; } return false; } /** * Was the request made by PATCH? * * @return boolean */ public function isPatch() { if ('PATCH' == $this->getMethod()) { return true; } return false; } /** * Is the request a Javascript XMLHttpRequest? * * Should work with Prototype/Script.aculo.us, possibly others. * * @return boolean */ public function isXmlHttpRequest() { return ($this->getHeader('X_REQUESTED_WITH') == 'XMLHttpRequest'); } /** * Is this a Flash request? * * @return boolean */ public function isFlashRequest() { $header = strtolower($this->getHeader('USER_AGENT')); return (strstr($header, ' flash')) ? true : false; } /** * Is https secure request * * @return boolean */ public function isSecure() { return ($this->getScheme() === self::SCHEME_HTTPS); } /** * Return the raw body of the request, if present * * @return string|false Raw body, or false if not present */ public function getRawBody() { if (null === $this->_rawBody) { $body = file_get_contents('php://input'); if (strlen(trim($body)) > 0) { $this->_rawBody = $body; } else { $this->_rawBody = false; } } return $this->_rawBody; } /** * Return the value of the given HTTP header. Pass the header name as the * plain, HTTP-specified header name. Ex.: Ask for 'Accept' to get the * Accept header, 'Accept-Encoding' to get the Accept-Encoding header. * * @param string $header HTTP header name * @return string|false HTTP header value, or false if not found * @throws Zend_Controller_Request_Exception */ public function getHeader($header) { if (empty($header)) { #require_once 'Zend/Controller/Request/Exception.php'; throw new Zend_Controller_Request_Exception('An HTTP header name is required'); } // Try to get it from the $_SERVER array first $temp = strtoupper(str_replace('-', '_', $header)); if (isset($_SERVER['HTTP_' . $temp])) { return $_SERVER['HTTP_' . $temp]; } /* * Try to get it from the $_SERVER array on POST request or CGI environment * @see https://www.ietf.org/rfc/rfc3875 (4.1.2. and 4.1.3.) */ if (isset($_SERVER[$temp]) && in_array($temp, array('CONTENT_TYPE', 'CONTENT_LENGTH')) ) { return $_SERVER[$temp]; } // This seems to be the only way to get the Authorization header on // Apache if (function_exists('apache_request_headers')) { $headers = apache_request_headers(); if (isset($headers[$header])) { return $headers[$header]; } $header = strtolower($header); foreach ($headers as $key => $value) { if (strtolower($key) == $header) { return $value; } } } return false; } /** * Get the request URI scheme * * @return string */ public function getScheme() { return ($this->getServer('HTTPS') == 'on') ? self::SCHEME_HTTPS : self::SCHEME_HTTP; } /** * Get the HTTP host. * * "Host" ":" host [ ":" port ] ; Section 3.2.2 * Note the HTTP Host header is not the same as the URI host. * It includes the port while the URI host doesn't. * * @return string */ public function getHttpHost() { $host = $this->getServer('HTTP_HOST'); if (!empty($host)) { return $host; } $scheme = $this->getScheme(); $name = $this->getServer('SERVER_NAME'); $port = $this->getServer('SERVER_PORT'); if(null === $name) { return ''; } elseif (($scheme == self::SCHEME_HTTP && $port == 80) || ($scheme == self::SCHEME_HTTPS && $port == 443)) { return $name; } else { return $name . ':' . $port; } } /** * Get the client's IP addres * * @param boolean $checkProxy * @return string */ public function getClientIp($checkProxy = true) { if ($checkProxy && $this->getServer('HTTP_CLIENT_IP') != null) { $ip = $this->getServer('HTTP_CLIENT_IP'); } else if ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) { $ip = $this->getServer('HTTP_X_FORWARDED_FOR'); } else { $ip = $this->getServer('REMOTE_ADDR'); } return $ip; } }
{ "pile_set_name": "Github" }
# $FreeBSD$ PORTVERSION= 8.4.0 PKGNAMEPREFIX= arm-none-eabi- GCC_TARGET= arm-none-eabi PLIST= ${.CURDIR}/pkg-plist DISTINFO_FILE= ${.CURDIR}/distinfo COMMENT= GNU Compiler Collection for bare metal arm cross-development # libstdcxx won't build, but we don't need it or multiple float-abi libs. CONFIGURE_ARGS= --disable-libstdcxx \ --disable-multilib MASTERDIR= ${.CURDIR}/../aarch64-none-elf-gcc .include "${MASTERDIR}/Makefile"
{ "pile_set_name": "Github" }
/* * Copyright 2000-2009 JetBrains s.r.o. * * 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. */ package com.intellij.codeInsight.daemon; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; /** * Allows to disable highlighting of certain elements as unused when such elements are not referenced * from the code but are referenced in some other way. For example, * <ul> * <li>from generated code</li> * <li>from outside containers: {@code @javax.servlet.annotation.WebServlet public class MyServlet {}}</li> * <li>from some frameworks: {@code @javax.ejb.EJB private DataStore myInjectedDataStore;}</li> etc * </ul> * @author yole */ public interface ImplicitUsageProvider { ExtensionPointName<ImplicitUsageProvider> EP_NAME = new ExtensionPointName<>("com.intellij.implicitUsageProvider"); /** * @return true if element should not be reported as unused */ boolean isImplicitUsage(@NotNull PsiElement element); /** * @return true if element should not be reported as "assigned but not used" */ boolean isImplicitRead(@NotNull PsiElement element); /** * @return true if element should not be reported as "referenced but never assigned" */ boolean isImplicitWrite(@NotNull PsiElement element); /** * @return true if the given element is implicitly initialized to a non-null value */ default boolean isImplicitlyNotNullInitialized(@NotNull PsiElement element) { return false; } /** * @return true if given element is represents a class (or another data structure declaration depending on language) * which instances may have implicit initialization steps not directly available in the source code * (e.g. Java class initializer is processed via annotation processor and custom steps added) */ default boolean isClassWithCustomizedInitialization(@NotNull PsiElement element) { return false; } }
{ "pile_set_name": "Github" }
<?php use_helper('Form', 'Widgets', 'Decorator') ?> <?php decorate_start('SideTabs', array('active' => 'removelist')) ?> <h2>Remove Flashcards From List</h2> <div class="ajax"> <?php include_partial('RemoveList') ?> </div> <?php decorate_end() ?>
{ "pile_set_name": "Github" }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart'; import { workbenchInstantiationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices'; import { GroupDirection, GroupsOrder, MergeGroupMode, GroupOrientation, GroupChangeKind, EditorsOrder, GroupLocation } from 'vs/workbench/services/group/common/editorGroupsService'; import { Dimension } from 'vs/base/browser/dom'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor'; import { EditorInput, IFileEditorInput, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorExtensions, EditorOptions, CloseDirection } from 'vs/workbench/common/editor'; import { TPromise } from 'vs/base/common/winjs.base'; import { IEditorModel } from 'vs/platform/editor/common/editor'; import { URI } from 'vs/base/common/uri'; import { Registry } from 'vs/platform/registry/common/platform'; import { IEditorRegistry, Extensions, EditorDescriptor } from 'vs/workbench/browser/editor'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; export class TestEditorControl extends BaseEditor { constructor(@ITelemetryService telemetryService: ITelemetryService) { super('MyFileEditorForEditorGroupService', NullTelemetryService, new TestThemeService(), new TestStorageService()); } getId(): string { return 'MyFileEditorForEditorGroupService'; } layout(): void { } createEditor(): any { } } export class TestEditorInput extends EditorInput implements IFileEditorInput { constructor(private resource: URI) { super(); } getTypeId() { return 'testEditorInputForEditorGroupService'; } resolve(): TPromise<IEditorModel> { return null; } matches(other: TestEditorInput): boolean { return other && this.resource.toString() === other.resource.toString() && other instanceof TestEditorInput; } setEncoding(encoding: string) { } getEncoding(): string { return null; } setPreferredEncoding(encoding: string) { } getResource(): URI { return this.resource; } setForceOpenAsBinary(): void { } } suite('Editor groups service', () => { function registerTestEditorInput(): void { interface ISerializedTestEditorInput { resource: string; } class TestEditorInputFactory implements IEditorInputFactory { constructor() { } serialize(editorInput: EditorInput): string { const testEditorInput = <TestEditorInput>editorInput; const testInput: ISerializedTestEditorInput = { resource: testEditorInput.getResource().toString() }; return JSON.stringify(testInput); } deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput { const testInput: ISerializedTestEditorInput = JSON.parse(serializedEditorInput); return new TestEditorInput(URI.parse(testInput.resource)); } } (Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).registerEditorInputFactory('testEditorInputForGroupsService', TestEditorInputFactory); (Registry.as<IEditorRegistry>(Extensions.Editors)).registerEditor(new EditorDescriptor(TestEditorControl, 'MyTestEditorForGroupsService', 'My Test File Editor'), new SyncDescriptor(TestEditorInput)); } registerTestEditorInput(); function createPart(): EditorPart { const instantiationService = workbenchInstantiationService(); const part = instantiationService.createInstance(EditorPart, 'id', false); part.create(document.createElement('div')); part.layout(new Dimension(400, 300)); return part; } test('groups basics', function () { const part = createPart(); let activeGroupChangeCounter = 0; const activeGroupChangeListener = part.onDidActiveGroupChange(() => { activeGroupChangeCounter++; }); let groupAddedCounter = 0; const groupAddedListener = part.onDidAddGroup(() => { groupAddedCounter++; }); let groupRemovedCounter = 0; const groupRemovedListener = part.onDidRemoveGroup(() => { groupRemovedCounter++; }); let groupMovedCounter = 0; const groupMovedListener = part.onDidMoveGroup(() => { groupMovedCounter++; }); let preferredSizeChangeCounter = 0; const preferredSizeChangeListener = part.onDidPreferredSizeChange(() => { preferredSizeChangeCounter++; }); // always a root group const rootGroup = part.groups[0]; assert.equal(part.groups.length, 1); assert.equal(part.count, 1); assert.equal(rootGroup, part.getGroup(rootGroup.id)); assert.ok(part.activeGroup === rootGroup); assert.equal(rootGroup.label, 'Group 1'); let mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 1); assert.equal(mru[0], rootGroup); const rightGroup = part.addGroup(rootGroup, GroupDirection.RIGHT); assert.equal(rightGroup, part.getGroup(rightGroup.id)); assert.equal(groupAddedCounter, 1); assert.equal(part.groups.length, 2); assert.equal(part.count, 2); assert.ok(part.activeGroup === rootGroup); assert.equal(preferredSizeChangeCounter, 1); assert.equal(rootGroup.label, 'Group 1'); assert.equal(rightGroup.label, 'Group 2'); mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 2); assert.equal(mru[0], rootGroup); assert.equal(mru[1], rightGroup); assert.equal(activeGroupChangeCounter, 0); let rootGroupActiveChangeCounter = 0; const rootGroupChangeListener = rootGroup.onDidGroupChange(e => { if (e.kind === GroupChangeKind.GROUP_ACTIVE) { rootGroupActiveChangeCounter++; } }); let rightGroupActiveChangeCounter = 0; const rightGroupChangeListener = rightGroup.onDidGroupChange(e => { if (e.kind === GroupChangeKind.GROUP_ACTIVE) { rightGroupActiveChangeCounter++; } }); part.activateGroup(rightGroup); assert.ok(part.activeGroup === rightGroup); assert.equal(activeGroupChangeCounter, 1); assert.equal(rootGroupActiveChangeCounter, 1); assert.equal(rightGroupActiveChangeCounter, 1); rootGroupChangeListener.dispose(); rightGroupChangeListener.dispose(); mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 2); assert.equal(mru[0], rightGroup); assert.equal(mru[1], rootGroup); const downGroup = part.addGroup(rightGroup, GroupDirection.DOWN); let didDispose = false; downGroup.onWillDispose(() => { didDispose = true; }); assert.equal(groupAddedCounter, 2); assert.equal(part.groups.length, 3); assert.ok(part.activeGroup === rightGroup); assert.ok(!downGroup.activeControl); assert.equal(preferredSizeChangeCounter, 2); assert.equal(rootGroup.label, 'Group 1'); assert.equal(rightGroup.label, 'Group 2'); assert.equal(downGroup.label, 'Group 3'); mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 3); assert.equal(mru[0], rightGroup); assert.equal(mru[1], rootGroup); assert.equal(mru[2], downGroup); const gridOrder = part.getGroups(GroupsOrder.GRID_APPEARANCE); assert.equal(gridOrder.length, 3); assert.equal(gridOrder[0], rootGroup); assert.equal(gridOrder[1], rightGroup); assert.equal(gridOrder[2], downGroup); part.moveGroup(downGroup, rightGroup, GroupDirection.DOWN); assert.equal(groupMovedCounter, 1); assert.equal(preferredSizeChangeCounter, 2); part.removeGroup(downGroup); assert.ok(!part.getGroup(downGroup.id)); assert.equal(didDispose, true); assert.equal(groupRemovedCounter, 1); assert.equal(preferredSizeChangeCounter, 3); assert.equal(part.groups.length, 2); assert.ok(part.activeGroup === rightGroup); assert.equal(rootGroup.label, 'Group 1'); assert.equal(rightGroup.label, 'Group 2'); mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 2); assert.equal(mru[0], rightGroup); assert.equal(mru[1], rootGroup); let rightGroupInstantiator: IInstantiationService; part.activeGroup.invokeWithinContext(accessor => { rightGroupInstantiator = accessor.get(IInstantiationService); }); let rootGroupInstantiator: IInstantiationService; rootGroup.invokeWithinContext(accessor => { rootGroupInstantiator = accessor.get(IInstantiationService); }); assert.ok(rightGroupInstantiator); assert.ok(rootGroupInstantiator); assert.ok(rightGroupInstantiator !== rootGroupInstantiator); part.removeGroup(rightGroup); assert.equal(groupRemovedCounter, 2); assert.equal(part.groups.length, 1); assert.ok(part.activeGroup === rootGroup); mru = part.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru.length, 1); assert.equal(mru[0], rootGroup); part.removeGroup(rootGroup); // cannot remove root group assert.equal(part.groups.length, 1); assert.equal(groupRemovedCounter, 2); assert.ok(part.activeGroup === rootGroup); part.setGroupOrientation(part.orientation === GroupOrientation.HORIZONTAL ? GroupOrientation.VERTICAL : GroupOrientation.HORIZONTAL); assert.equal(preferredSizeChangeCounter, 5); activeGroupChangeListener.dispose(); groupAddedListener.dispose(); groupRemovedListener.dispose(); groupMovedListener.dispose(); preferredSizeChangeListener.dispose(); part.dispose(); }); test('groups labels', function () { const part = createPart(); const rootGroup = part.groups[0]; const rightGroup = part.addGroup(rootGroup, GroupDirection.RIGHT); const downGroup = part.addGroup(rightGroup, GroupDirection.DOWN); let labelChangeCounter = 0; const labelChangeListener = downGroup.onDidGroupChange(e => { if (e.kind === GroupChangeKind.GROUP_LABEL) { labelChangeCounter++; } }); assert.equal(rootGroup.label, 'Group 1'); assert.equal(rightGroup.label, 'Group 2'); assert.equal(downGroup.label, 'Group 3'); part.removeGroup(rightGroup); assert.equal(rootGroup.label, 'Group 1'); assert.equal(downGroup.label, 'Group 2'); assert.equal(labelChangeCounter, 1); labelChangeListener.dispose(); part.dispose(); }); test('copy/merge groups', function () { const part = createPart(); let groupAddedCounter = 0; const groupAddedListener = part.onDidAddGroup(() => { groupAddedCounter++; }); let groupRemovedCounter = 0; const groupRemovedListener = part.onDidRemoveGroup(() => { groupRemovedCounter++; }); const rootGroup = part.groups[0]; let rootGroupDisposed = false; const disposeListener = rootGroup.onWillDispose(() => { rootGroupDisposed = true; }); const input = new TestEditorInput(URI.file('foo/bar')); return rootGroup.openEditor(input, EditorOptions.create({ pinned: true })).then(() => { const rightGroup = part.addGroup(rootGroup, GroupDirection.RIGHT, { activate: true }); const downGroup = part.copyGroup(rootGroup, rightGroup, GroupDirection.DOWN); assert.equal(groupAddedCounter, 2); assert.equal(downGroup.count, 1); assert.ok(downGroup.activeEditor instanceof TestEditorInput); part.mergeGroup(rootGroup, rightGroup, { mode: MergeGroupMode.COPY_EDITORS }); assert.equal(rightGroup.count, 1); assert.ok(rightGroup.activeEditor instanceof TestEditorInput); part.mergeGroup(rootGroup, rightGroup, { mode: MergeGroupMode.MOVE_EDITORS }); assert.equal(rootGroup.count, 0); part.mergeGroup(rootGroup, downGroup); assert.equal(groupRemovedCounter, 1); assert.equal(rootGroupDisposed, true); groupAddedListener.dispose(); groupRemovedListener.dispose(); disposeListener.dispose(); part.dispose(); }); }); test('whenRestored', () => { const part = createPart(); return part.whenRestored.then(() => { assert.ok(true); part.dispose(); }); }); test('options', () => { const part = createPart(); let oldOptions: IEditorPartOptions; let newOptions: IEditorPartOptions; part.onDidEditorPartOptionsChange(event => { oldOptions = event.oldPartOptions; newOptions = event.newPartOptions; }); const currentOptions = part.partOptions; assert.ok(currentOptions); part.enforcePartOptions({ showTabs: false }); assert.equal(part.partOptions.showTabs, false); assert.equal(newOptions.showTabs, false); assert.equal(oldOptions, currentOptions); part.dispose(); }); test('editor basics', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); let editorWillOpenCounter = 0; const editorWillOpenListener = group.onWillOpenEditor(() => { editorWillOpenCounter++; }); let activeEditorChangeCounter = 0; let editorDidOpenCounter = 0; let editorCloseCounter1 = 0; let editorPinCounter = 0; const editorGroupChangeListener = group.onDidGroupChange(e => { if (e.kind === GroupChangeKind.EDITOR_OPEN) { assert.ok(e.editor); editorDidOpenCounter++; } else if (e.kind === GroupChangeKind.EDITOR_ACTIVE) { assert.ok(e.editor); activeEditorChangeCounter++; } else if (e.kind === GroupChangeKind.EDITOR_CLOSE) { assert.ok(e.editor); editorCloseCounter1++; } else if (e.kind === GroupChangeKind.EDITOR_PIN) { assert.ok(e.editor); editorPinCounter++; } }); let editorCloseCounter2 = 0; const editorCloseListener = group.onDidCloseEditor(() => { editorCloseCounter2++; }); let editorWillCloseCounter = 0; const editorWillCloseListener = group.onWillCloseEditor(() => { editorWillCloseCounter++; }); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditor(input, EditorOptions.create({ pinned: true })).then(() => { return group.openEditor(inputInactive, EditorOptions.create({ inactive: true })).then(() => { assert.equal(group.isActive(input), true); assert.equal(group.isActive(inputInactive), false); assert.equal(group.isOpened(input), true); assert.equal(group.isOpened(inputInactive), true); assert.equal(group.isEmpty(), false); assert.equal(group.count, 2); assert.equal(editorWillOpenCounter, 2); assert.equal(editorDidOpenCounter, 2); assert.equal(activeEditorChangeCounter, 1); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); assert.equal(group.getIndexOfEditor(input), 0); assert.equal(group.getIndexOfEditor(inputInactive), 1); assert.equal(group.previewEditor, inputInactive); assert.equal(group.isPinned(inputInactive), false); group.pinEditor(inputInactive); assert.equal(editorPinCounter, 1); assert.equal(group.isPinned(inputInactive), true); assert.ok(!group.previewEditor); assert.equal(group.activeEditor, input); assert.ok(group.activeControl instanceof TestEditorControl); assert.equal(group.editors.length, 2); const mru = group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE); assert.equal(mru[0], input); assert.equal(mru[1], inputInactive); return group.openEditor(inputInactive).then(() => { assert.equal(activeEditorChangeCounter, 2); assert.equal(group.activeEditor, inputInactive); return group.closeEditor(inputInactive).then(() => { assert.equal(activeEditorChangeCounter, 3); assert.equal(editorCloseCounter1, 1); assert.equal(editorCloseCounter2, 1); assert.equal(editorWillCloseCounter, 1); assert.equal(group.activeEditor, input); editorCloseListener.dispose(); editorWillCloseListener.dispose(); editorWillOpenListener.dispose(); editorGroupChangeListener.dispose(); part.dispose(); }); }); }); }); }); test('openEditors / closeEditors', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); return group.closeEditors([input, inputInactive]).then(() => { assert.equal(group.isEmpty(), true); part.dispose(); }); }); }); test('closeEditors (except one)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); const input3 = new TestEditorInput(URI.file('foo/bar3')); return group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]).then(() => { assert.equal(group.count, 3); assert.equal(group.getEditor(0), input1); assert.equal(group.getEditor(1), input2); assert.equal(group.getEditor(2), input3); return group.closeEditors({ except: input2 }).then(() => { assert.equal(group.count, 1); assert.equal(group.getEditor(0), input2); part.dispose(); }); }); }); test('closeEditors (saved only)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); const input3 = new TestEditorInput(URI.file('foo/bar3')); return group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]).then(() => { assert.equal(group.count, 3); assert.equal(group.getEditor(0), input1); assert.equal(group.getEditor(1), input2); assert.equal(group.getEditor(2), input3); return group.closeEditors({ savedOnly: true }).then(() => { assert.equal(group.count, 0); part.dispose(); }); }); }); test('closeEditors (direction: right)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); const input3 = new TestEditorInput(URI.file('foo/bar3')); return group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]).then(() => { assert.equal(group.count, 3); assert.equal(group.getEditor(0), input1); assert.equal(group.getEditor(1), input2); assert.equal(group.getEditor(2), input3); return group.closeEditors({ direction: CloseDirection.RIGHT, except: input2 }).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input1); assert.equal(group.getEditor(1), input2); part.dispose(); }); }); }); test('closeEditors (direction: left)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); const input3 = new TestEditorInput(URI.file('foo/bar3')); return group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]).then(() => { assert.equal(group.count, 3); assert.equal(group.getEditor(0), input1); assert.equal(group.getEditor(1), input2); assert.equal(group.getEditor(2), input3); return group.closeEditors({ direction: CloseDirection.LEFT, except: input2 }).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input2); assert.equal(group.getEditor(1), input3); part.dispose(); }); }); }); test('closeAllEditors', () => { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); return group.closeAllEditors().then(() => { assert.equal(group.isEmpty(), true); part.dispose(); }); }); }); test('moveEditor (same group)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); let editorMoveCounter = 0; const editorGroupChangeListener = group.onDidGroupChange(e => { if (e.kind === GroupChangeKind.EDITOR_MOVE) { assert.ok(e.editor); editorMoveCounter++; } }); return group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); group.moveEditor(inputInactive, group, { index: 0 }); assert.equal(editorMoveCounter, 1); assert.equal(group.getEditor(0), inputInactive); assert.equal(group.getEditor(1), input); editorGroupChangeListener.dispose(); part.dispose(); }); }); test('moveEditor (across groups)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const rightGroup = part.addGroup(group, GroupDirection.RIGHT); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); group.moveEditor(inputInactive, rightGroup, { index: 0 }); assert.equal(group.count, 1); assert.equal(group.getEditor(0), input); assert.equal(rightGroup.count, 1); assert.equal(rightGroup.getEditor(0), inputInactive); part.dispose(); }); }); test('copyEditor (across groups)', function () { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const rightGroup = part.addGroup(group, GroupDirection.RIGHT); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]).then(() => { assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); group.copyEditor(inputInactive, rightGroup, { index: 0 }); assert.equal(group.count, 2); assert.equal(group.getEditor(0), input); assert.equal(group.getEditor(1), inputInactive); assert.equal(rightGroup.count, 1); assert.equal(rightGroup.getEditor(0), inputInactive); part.dispose(); }); }); test('replaceEditors', () => { const part = createPart(); const group = part.activeGroup; assert.equal(group.isEmpty(), true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); return group.openEditor(input).then(() => { assert.equal(group.count, 1); assert.equal(group.getEditor(0), input); return group.replaceEditors([{ editor: input, replacement: inputInactive }]).then(() => { assert.equal(group.count, 1); assert.equal(group.getEditor(0), inputInactive); part.dispose(); }); }); }); test('find neighbour group (left/right)', function () { const part = createPart(); const rootGroup = part.activeGroup; const rightGroup = part.addGroup(rootGroup, GroupDirection.RIGHT); assert.equal(rightGroup, part.findGroup({ direction: GroupDirection.RIGHT }, rootGroup)); assert.equal(rootGroup, part.findGroup({ direction: GroupDirection.LEFT }, rightGroup)); part.dispose(); }); test('find neighbour group (up/down)', function () { const part = createPart(); const rootGroup = part.activeGroup; const downGroup = part.addGroup(rootGroup, GroupDirection.DOWN); assert.equal(downGroup, part.findGroup({ direction: GroupDirection.DOWN }, rootGroup)); assert.equal(rootGroup, part.findGroup({ direction: GroupDirection.UP }, downGroup)); part.dispose(); }); test('find group by location (left/right)', function () { const part = createPart(); const rootGroup = part.activeGroup; const rightGroup = part.addGroup(rootGroup, GroupDirection.RIGHT); const downGroup = part.addGroup(rightGroup, GroupDirection.DOWN); assert.equal(rootGroup, part.findGroup({ location: GroupLocation.FIRST })); assert.equal(downGroup, part.findGroup({ location: GroupLocation.LAST })); assert.equal(rightGroup, part.findGroup({ location: GroupLocation.NEXT }, rootGroup)); assert.equal(rootGroup, part.findGroup({ location: GroupLocation.PREVIOUS }, rightGroup)); assert.equal(downGroup, part.findGroup({ location: GroupLocation.NEXT }, rightGroup)); assert.equal(rightGroup, part.findGroup({ location: GroupLocation.PREVIOUS }, downGroup)); part.dispose(); }); });
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?><!-- ~ ************************************************************************* ~ tab_indicator.xml ~ ************************************************************************** ~ Copyright © 2020 VLC authors and VideoLAN ~ Author: Nicolas POMEPUY ~ This program is free software; you can redistribute it and/or modify ~ it under the terms of the GNU General Public License as published by ~ the Free Software Foundation; either version 2 of the License, or ~ (at your option) any later version. ~ ~ This program is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU General Public License for more details. ~ ~ You should have received a copy of the GNU General Public License ~ along with this program; if not, write to the Free Software ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. ~ *************************************************************************** ~ ~ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="@android:color/white" /> <corners android:topLeftRadius="3dp" android:topRightRadius="3dp" /> <size android:height="3dp" /> </shape> </item> </selector>
{ "pile_set_name": "Github" }
var path = require('path'); var test = require('tap').test; var resolve = require('../'); test('async foo', function (t) { t.plan(9); var dir = __dirname + '/resolver'; resolve('./foo', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/foo.js'); t.equal(pkg, undefined); }); resolve('./foo.js', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/foo.js'); t.equal(pkg, undefined); }); resolve('./foo', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/foo.js'); t.equal(pkg.main, 'resolver'); }); resolve('./foo.js', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/foo.js'); t.equal(pkg.main, 'resolver'); }); resolve('foo', { basedir : dir }, function (err) { t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); }); }); test('bar', function (t) { t.plan(6); var dir = __dirname + '/resolver'; resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/bar/node_modules/foo/index.js'); t.equal(pkg, undefined); }); resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/bar/node_modules/foo/index.js'); t.equal(pkg, undefined); }); resolve('foo', { basedir : dir + '/bar', package: { main: 'bar' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/bar/node_modules/foo/index.js'); t.equal(pkg, undefined); }); }); test('baz', function (t) { t.plan(4); var dir = __dirname + '/resolver'; resolve('./baz', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/baz/quux.js'); t.equal(pkg.main, 'quux.js'); }); resolve('./baz', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/baz/quux.js'); t.equal(pkg.main, 'quux.js'); }); }); test('biz', function (t) { t.plan(24); var dir = __dirname + '/resolver/biz/node_modules'; resolve('./grux', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/grux/index.js'); t.equal(pkg, undefined); }); resolve('./grux', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/grux/index.js'); t.equal(pkg.main, 'biz'); }); resolve('./garply', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/garply/lib/index.js'); t.equal(pkg.main, './lib'); }); resolve('./garply', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/garply/lib/index.js'); t.equal(pkg.main, './lib'); }); resolve('tiv', { basedir : dir + '/grux' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/tiv/index.js'); t.equal(pkg, undefined); }); resolve('tiv', { basedir : dir + '/grux', package: { main: 'grux' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/tiv/index.js'); t.equal(pkg, undefined); }); resolve('tiv', { basedir : dir + '/garply' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/tiv/index.js'); t.equal(pkg, undefined); }); resolve('tiv', { basedir : dir + '/garply', package: { main: './lib' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/tiv/index.js'); t.equal(pkg, undefined); }); resolve('grux', { basedir : dir + '/tiv' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/grux/index.js'); t.equal(pkg, undefined); }); resolve('grux', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/grux/index.js'); t.equal(pkg, undefined); }); resolve('garply', { basedir : dir + '/tiv' }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/garply/lib/index.js'); t.equal(pkg.main, './lib'); }); resolve('garply', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/garply/lib/index.js'); t.equal(pkg.main, './lib'); }); }); test('quux', function (t) { t.plan(2); var dir = __dirname + '/resolver/quux'; resolve('./foo', { basedir : dir, package: { main: 'quux' } }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/foo/index.js'); t.equal(pkg.main, 'quux'); }); }); test('normalize', function (t) { t.plan(2); var dir = __dirname + '/resolver/biz/node_modules/grux'; resolve('../grux', { basedir : dir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/index.js'); t.equal(pkg, undefined); }); }); test('cup', function (t) { t.plan(3); var dir = __dirname + '/resolver'; resolve('./cup', { basedir : dir, extensions : [ '.js', '.coffee' ] }, function (err, res) { if (err) t.fail(err); t.equal(res, dir + '/cup.coffee'); }); resolve('./cup.coffee', { basedir : dir }, function (err, res) { if (err) t.fail(err); t.equal(res, dir + '/cup.coffee'); }); resolve('./cup', { basedir : dir, extensions : [ '.js' ] }, function (err, res) { t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); }); }); test('mug', function (t) { t.plan(3); var dir = __dirname + '/resolver'; resolve('./mug', { basedir : dir }, function (err, res) { if (err) t.fail(err); t.equal(res, dir + '/mug.js'); }); resolve('./mug', { basedir : dir, extensions : [ '.coffee', '.js' ] }, function (err, res) { if (err) t.fail(err); t.equal(res, dir + '/mug.coffee'); }); resolve('./mug', { basedir : dir, extensions : [ '.js', '.coffee' ] }, function (err, res) { t.equal(res, dir + '/mug.js'); }); }); test('other path', function (t) { t.plan(4); var resolverDir = __dirname + '/resolver'; var dir = resolverDir + '/bar'; var otherDir = resolverDir + '/other_path'; resolve('root', { basedir : dir, paths: [otherDir] }, function (err, res) { if (err) t.fail(err); t.equal(res, resolverDir + '/other_path/root.js'); }); resolve('lib/other-lib', { basedir : dir, paths: [otherDir] }, function (err, res) { if (err) t.fail(err); t.equal(res, resolverDir + '/other_path/lib/other-lib.js'); }); resolve('root', { basedir : dir, }, function (err, res) { t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); }); resolve('zzz', { basedir : dir, paths: [otherDir] }, function (err, res) { t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); }); }); test('incorrect main', function (t) { t.plan(1) var resolverDir = __dirname + '/resolver'; var dir = resolverDir + '/incorrect_main'; resolve('./incorrect_main', { basedir : resolverDir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, dir + '/index.js'); }); }); test('without basedir', function (t) { t.plan(1); var dir = __dirname + '/resolver/without_basedir'; var tester = require(dir + '/main.js'); tester(t, function (err, res, pkg){ if (err) { t.fail(err); } else { t.equal(res, dir + '/node_modules/mymodule.js'); } }); }); test('#25: node modules with the same name as node stdlib modules', function (t) { t.plan(1); var resolverDir = __dirname + '/resolver/punycode'; resolve('punycode', { basedir : resolverDir }, function (err, res, pkg) { if (err) t.fail(err); t.equal(res, resolverDir + '/node_modules/punycode/index.js'); }); });
{ "pile_set_name": "Github" }
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:openapi-gen=true // +groupName=settings.k8s.io package v1alpha1 // import "k8s.io/api/settings/v1alpha1"
{ "pile_set_name": "Github" }
0.2701 ASV_1
{ "pile_set_name": "Github" }
// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. // // This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, // either express or implied. See the LICENSE file for specific language governing // rights and limitations of this software. // // If you have any questions regarding licensing, please contact us at // [email protected]. package com.rabbitmq.client.test.server; import java.io.IOException; import org.junit.Test; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.MessageProperties; import com.rabbitmq.client.test.ConfirmBase; import org.junit.Test; public class MessageRecovery extends ConfirmBase { private final static String Q = "recovery-test"; private final static String Q2 = "recovery-test-ha-check"; @Test public void messageRecovery() throws Exception { channel.queueDelete(Q); channel.queueDelete(Q2); channel.confirmSelect(); channel.queueDeclare(Q, true, false, false, null); channel.basicPublish("", Q, false, false, MessageProperties.PERSISTENT_BASIC, "nop".getBytes()); waitForConfirms(); channel.queueDeclare(Q2, false, false, false, null); restart(); // When testing in HA mode the message will be collected from // a promoted slave and will have its redelivered flag // set. But that only happens if there actually *is* a // slave. We test that by passively declaring, and // subsequently deleting, the secondary, non-durable queue, // which only succeeds if the queue survived the restart, // which in turn implies that it must have been a HA queue // with slave(s). // NB: this wont work when running against a single node broker // and running the test individually outside of the HA suite boolean expectDelivered = HATests.HA_TESTS_RUNNING; try { channel.queueDeclarePassive(Q2); channel.queueDelete(Q2); expectDelivered = true; } catch (IOException e) { checkShutdownSignal(AMQP.NOT_FOUND, e); openChannel(); } assertDelivered(Q, 1, expectDelivered); channel.queueDelete(Q); channel.queueDelete(Q2); } }
{ "pile_set_name": "Github" }
/* IOHIDNotification ... I/O Kit HID Notifications Copyright (c) 2009 KennyTM~ <[email protected]> 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 KennyTM~ 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 IOHID_NOTIFICATION_H #define IOHID_NOTIFICATION_H #include <CoreFoundation/CoreFoundation.h> #if __cplusplus extern "C" { #endif typedef void(*IOHIDNotificationCallback)(void* target, void* refcon); typedef struct __IOHIDNotification #if 0 { CFRuntimeBase _base; // 0, 4 IOHIDNotificationCallback clientCallback; // 8 void* clientTarget; // c void* clientRefcon; // 10 IOHIDNotificationCallback ownerCallback; // 14 void* ownerTarget; // 18 void* ownerRefcon; // 1c } #endif * IOHIDNotificationRef; #pragma mark - #pragma mark Creators CFTypeID IOHIDNotificationGetTypeID(); IOHIDNotificationRef IOHIDNotificationCreate(CFAllocatorRef allocator, IOHIDNotificationCallback ownerCallback, void* ownerTarget, void* ownerRefcon, IOHIDNotificationCallback clientCallback, void* clientTarget, void* clientRefcon); #pragma mark - #pragma mark Accessors IOHIDNotificationCallback IOHIDNotificationGetClientCallback(IOHIDNotificationRef notification); void* IOHIDNotificationGetClientTarget(IOHIDNotificationRef notification); void* IOHIDNotificationGetClientRefcon(IOHIDNotificationRef notification); IOHIDNotificationCallback IOHIDNotificationGetOwnerCallback(IOHIDNotificationRef notification); void* IOHIDNotificationGetOwnerTarget(IOHIDNotificationRef notification); void* IOHIDNotificationGetOwnerRefcon(IOHIDNotificationRef notification); #if __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
package compute // Copyright (c) Microsoft and contributors. 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. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) // VirtualMachinesClient is the compute Client type VirtualMachinesClient struct { BaseClient } // NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client. func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} } // Capture captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create // similar VMs. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // parameters - parameters supplied to the Capture Virtual Machine operation. func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (result VirtualMachinesCaptureFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Capture") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("compute.VirtualMachinesClient", "Capture", err.Error()) } req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request") return } result, err = client.CaptureSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", result.Response(), "Failure sending request") return } return } // CapturePreparer prepares the Capture request. func (client VirtualMachinesClient) CapturePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CaptureSender sends the Capture request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) CaptureSender(req *http.Request) (future VirtualMachinesCaptureFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // CaptureResponder handles the response to the Capture request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ConvertToManagedDisks converts virtual machine disks from blob-based to managed disks. Virtual machine must be // stop-deallocated before invoking this operation. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesConvertToManagedDisksFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ConvertToManagedDisks") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.ConvertToManagedDisksPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil, "Failure preparing request") return } result, err = client.ConvertToManagedDisksSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", result.Response(), "Failure sending request") return } return } // ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request. func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (future VirtualMachinesConvertToManagedDisksFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // CreateOrUpdate the operation to create or update a virtual machine. Please note some properties can be set only // during virtual machine creation. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // parameters - parameters supplied to the Create Virtual Machine operation. func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.CreateOrUpdate") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, }}, {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, }}, }}, }}, }}, }}}}}); err != nil { return result, validation.NewError("compute.VirtualMachinesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } return } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } parameters.Resources = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Deallocate shuts down the virtual machine and releases the compute resources. You are not billed for the compute // resources that this virtual machine uses. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Deallocate(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeallocateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Deallocate") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request") return } result, err = client.DeallocateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", result.Response(), "Failure sending request") return } return } // DeallocatePreparer prepares the Deallocate request. func (client VirtualMachinesClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeallocateSender sends the Deallocate request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (future VirtualMachinesDeallocateFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // DeallocateResponder handles the response to the Deallocate request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Delete the operation to delete a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Delete") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.DeletePreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") return } return } // DeletePreparer prepares the Delete request. func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return } // Generalize sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine // before performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in // Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, please // refer to [How to create an image of a virtual machine or // VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Generalize") defer func() { sc := -1 if result.Response != nil { sc = result.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.GeneralizePreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request") return } resp, err := client.GeneralizeSender(req) if err != nil { result.Response = resp err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") return } result, err = client.GeneralizeResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request") } return } // GeneralizePreparer prepares the Generalize request. func (client VirtualMachinesClient) GeneralizePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GeneralizeSender sends the Generalize request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // GeneralizeResponder handles the response to the Generalize request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp return } // Get retrieves information about the model view or the instance view of a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // expand - the expand expression to apply on the operation. func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Get") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if len(string(expand)) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // InstanceView retrieves information about the run-time state of a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineInstanceView, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.InstanceView") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.InstanceViewPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", nil, "Failure preparing request") return } resp, err := client.InstanceViewSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure sending request") return } result, err = client.InstanceViewResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure responding to request") } return } // InstanceViewPreparer prepares the InstanceView request. func (client VirtualMachinesClient) InstanceViewPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // InstanceViewSender sends the InstanceView request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) InstanceViewSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // InstanceViewResponder handles the response to the InstanceView request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) InstanceViewResponder(resp *http.Response) (result VirtualMachineInstanceView, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // List lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to // get the next page of virtual machines. // Parameters: // resourceGroupName - the name of the resource group. func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") defer func() { sc := -1 if result.vmlr.Response.Response != nil { sc = result.vmlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.vmlr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request") return } result.vmlr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. func (client VirtualMachinesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // listNextResults retrieves the next set of results, if any. func (client VirtualMachinesClient) listNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { req, err := lastResults.virtualMachineListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") } return } // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") defer func() { sc := -1 if result.Response().Response.Response != nil { sc = result.page.Response().Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.page, err = client.List(ctx, resourceGroupName) return } // ListAll lists all of the virtual machines in the specified subscription. Use the nextLink property in the response // to get the next page of virtual machines. // Parameters: // statusOnly - statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. func (client VirtualMachinesClient) ListAll(ctx context.Context, statusOnly string) (result VirtualMachineListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAll") defer func() { sc := -1 if result.vmlr.Response.Response != nil { sc = result.vmlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.fn = client.listAllNextResults req, err := client.ListAllPreparer(ctx, statusOnly) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request") return } resp, err := client.ListAllSender(req) if err != nil { result.vmlr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request") return } result.vmlr, err = client.ListAllResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request") } return } // ListAllPreparer prepares the ListAll request. func (client VirtualMachinesClient) ListAllPreparer(ctx context.Context, statusOnly string) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if len(statusOnly) > 0 { queryParameters["statusOnly"] = autorest.Encode("query", statusOnly) } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // ListAllResponder handles the response to the ListAll request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // listAllNextResults retrieves the next set of results, if any. func (client VirtualMachinesClient) listAllNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { req, err := lastResults.virtualMachineListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListAllSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure sending next results request") } result, err = client.ListAllResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure responding to next results request") } return } // ListAllComplete enumerates all values, automatically crossing page boundaries as required. func (client VirtualMachinesClient) ListAllComplete(ctx context.Context, statusOnly string) (result VirtualMachineListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAll") defer func() { sc := -1 if result.Response().Response.Response != nil { sc = result.page.Response().Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.page, err = client.ListAll(ctx, statusOnly) return } // ListAvailableSizes lists all available virtual machine sizes to which the specified virtual machine can be resized. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAvailableSizes") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request") return } resp, err := client.ListAvailableSizesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request") return } result, err = client.ListAvailableSizesResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request") } return } // ListAvailableSizesPreparer prepares the ListAvailableSizes request. func (client VirtualMachinesClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListByLocation gets all the virtual machines under the specified subscription for the specified location. // Parameters: // location - the location for which virtual machines under the subscription are queried. func (client VirtualMachinesClient) ListByLocation(ctx context.Context, location string) (result VirtualMachineListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListByLocation") defer func() { sc := -1 if result.vmlr.Response.Response != nil { sc = result.vmlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } if err := validation.Validate([]validation.Validation{ {TargetValue: location, Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("compute.VirtualMachinesClient", "ListByLocation", err.Error()) } result.fn = client.listByLocationNextResults req, err := client.ListByLocationPreparer(ctx, location) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", nil, "Failure preparing request") return } resp, err := client.ListByLocationSender(req) if err != nil { result.vmlr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure sending request") return } result.vmlr, err = client.ListByLocationResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure responding to request") } return } // ListByLocationPreparer prepares the ListByLocation request. func (client VirtualMachinesClient) ListByLocationPreparer(ctx context.Context, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByLocationSender sends the ListByLocation request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // ListByLocationResponder handles the response to the ListByLocation request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ListByLocationResponder(resp *http.Response) (result VirtualMachineListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // listByLocationNextResults retrieves the next set of results, if any. func (client VirtualMachinesClient) listByLocationNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { req, err := lastResults.virtualMachineListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListByLocationSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure sending next results request") } result, err = client.ListByLocationResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure responding to next results request") } return } // ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. func (client VirtualMachinesClient) ListByLocationComplete(ctx context.Context, location string) (result VirtualMachineListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListByLocation") defer func() { sc := -1 if result.Response().Response.Response != nil { sc = result.page.Response().Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.page, err = client.ListByLocation(ctx, location) return } // PerformMaintenance the operation to perform maintenance on a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesPerformMaintenanceFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.PerformMaintenance") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", nil, "Failure preparing request") return } result, err = client.PerformMaintenanceSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", result.Response(), "Failure sending request") return } return } // PerformMaintenancePreparer prepares the PerformMaintenance request. func (client VirtualMachinesClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // PerformMaintenanceSender sends the PerformMaintenance request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachinesPerformMaintenanceFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // PowerOff the operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same // provisioned resources. You are still charged for this virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates // non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not // specified func (client VirtualMachinesClient) PowerOff(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (result VirtualMachinesPowerOffFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.PowerOff") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMName, skipShutdown) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request") return } result, err = client.PowerOffSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", result.Response(), "Failure sending request") return } return } // PowerOffPreparer prepares the PowerOff request. func (client VirtualMachinesClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if skipShutdown != nil { queryParameters["skipShutdown"] = autorest.Encode("query", *skipShutdown) } else { queryParameters["skipShutdown"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // PowerOffSender sends the PowerOff request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (future VirtualMachinesPowerOffFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // PowerOffResponder handles the response to the PowerOff request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Reapply the operation to reapply a virtual machine's state. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Reapply(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesReapplyFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Reapply") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.ReapplyPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reapply", nil, "Failure preparing request") return } result, err = client.ReapplySender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reapply", result.Response(), "Failure sending request") return } return } // ReapplyPreparer prepares the Reapply request. func (client VirtualMachinesClient) ReapplyPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ReapplySender sends the Reapply request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ReapplySender(req *http.Request) (future VirtualMachinesReapplyFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // ReapplyResponder handles the response to the Reapply request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ReapplyResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Redeploy shuts down the virtual machine, moves it to a new node, and powers it back on. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRedeployFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Redeploy") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.RedeployPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") return } result, err = client.RedeploySender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") return } return } // RedeployPreparer prepares the Redeploy request. func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // RedeploySender sends the Redeploy request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) RedeploySender(req *http.Request) (future VirtualMachinesRedeployFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // RedeployResponder handles the response to the Redeploy request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Reimage reimages the virtual machine which has an ephemeral OS disk back to its initial state. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // parameters - parameters supplied to the Reimage Virtual Machine operation. func (client VirtualMachinesClient) Reimage(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (result VirtualMachinesReimageFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Reimage") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.ReimagePreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", nil, "Failure preparing request") return } result, err = client.ReimageSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", result.Response(), "Failure sending request") return } return } // ReimagePreparer prepares the Reimage request. func (client VirtualMachinesClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", pathParameters), autorest.WithQueryParameters(queryParameters)) if parameters != nil { preparer = autorest.DecoratePreparer(preparer, autorest.WithJSON(parameters)) } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ReimageSender sends the Reimage request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) ReimageSender(req *http.Request) (future VirtualMachinesReimageFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // ReimageResponder handles the response to the Reimage request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Restart the operation to restart a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Restart(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRestartFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Restart") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.RestartPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request") return } result, err = client.RestartSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", result.Response(), "Failure sending request") return } return } // RestartPreparer prepares the Restart request. func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // RestartSender sends the Restart request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) RestartSender(req *http.Request) (future VirtualMachinesRestartFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // RestartResponder handles the response to the Restart request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // RunCommand run command on the VM. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // parameters - parameters supplied to the Run command operation. func (client VirtualMachinesClient) RunCommand(ctx context.Context, resourceGroupName string, VMName string, parameters RunCommandInput) (result VirtualMachinesRunCommandFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.RunCommand") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.CommandID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("compute.VirtualMachinesClient", "RunCommand", err.Error()) } req, err := client.RunCommandPreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RunCommand", nil, "Failure preparing request") return } result, err = client.RunCommandSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RunCommand", result.Response(), "Failure sending request") return } return } // RunCommandPreparer prepares the RunCommand request. func (client VirtualMachinesClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, VMName string, parameters RunCommandInput) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // RunCommandSender sends the RunCommand request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) RunCommandSender(req *http.Request) (future VirtualMachinesRunCommandFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // RunCommandResponder handles the response to the RunCommand request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Start the operation to start a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesStartFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Start") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.StartPreparer(ctx, resourceGroupName, VMName) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request") return } result, err = client.StartSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") return } return } // StartPreparer prepares the Start request. func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // StartSender sends the Start request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // StartResponder handles the response to the Start request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Update the operation to update a virtual machine. // Parameters: // resourceGroupName - the name of the resource group. // VMName - the name of the virtual machine. // parameters - parameters supplied to the Update Virtual Machine operation. func (client VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (result VirtualMachinesUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Update") defer func() { sc := -1 if result.Response() != nil { sc = result.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", nil, "Failure preparing request") return } result, err = client.UpdateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", result.Response(), "Failure sending request") return } return } // UpdatePreparer prepares the Update request. func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), "vmName": autorest.Encode("path", VMName), } const APIVersion = "2019-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) UpdateSender(req *http.Request) (future VirtualMachinesUpdateFuture, err error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response resp, err = autorest.SendWithSender(client, req, sd...) if err != nil { return } future.Future, err = azure.NewFutureFromResponse(resp) return } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result VirtualMachine, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }
{ "pile_set_name": "Github" }
import pytest from pybind11_tests import kwargs_and_defaults as m def test_function_signatures(doc): assert doc(m.kw_func0) == "kw_func0(arg0: int, arg1: int) -> str" assert doc(m.kw_func1) == "kw_func1(x: int, y: int) -> str" assert doc(m.kw_func2) == "kw_func2(x: int = 100, y: int = 200) -> str" assert doc(m.kw_func3) == "kw_func3(data: str = 'Hello world!') -> None" assert doc(m.kw_func4) == "kw_func4(myList: List[int] = [13, 17]) -> str" assert doc(m.kw_func_udl) == "kw_func_udl(x: int, y: int = 300) -> str" assert doc(m.kw_func_udl_z) == "kw_func_udl_z(x: int, y: int = 0) -> str" assert doc(m.args_function) == "args_function(*args) -> tuple" assert doc(m.args_kwargs_function) == "args_kwargs_function(*args, **kwargs) -> tuple" assert doc(m.KWClass.foo0) == \ "foo0(self: m.kwargs_and_defaults.KWClass, arg0: int, arg1: float) -> None" assert doc(m.KWClass.foo1) == \ "foo1(self: m.kwargs_and_defaults.KWClass, x: int, y: float) -> None" def test_named_arguments(msg): assert m.kw_func0(5, 10) == "x=5, y=10" assert m.kw_func1(5, 10) == "x=5, y=10" assert m.kw_func1(5, y=10) == "x=5, y=10" assert m.kw_func1(y=10, x=5) == "x=5, y=10" assert m.kw_func2() == "x=100, y=200" assert m.kw_func2(5) == "x=5, y=200" assert m.kw_func2(x=5) == "x=5, y=200" assert m.kw_func2(y=10) == "x=100, y=10" assert m.kw_func2(5, 10) == "x=5, y=10" assert m.kw_func2(x=5, y=10) == "x=5, y=10" with pytest.raises(TypeError) as excinfo: # noinspection PyArgumentList m.kw_func2(x=5, y=10, z=12) assert excinfo.match( r'(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$))' + '{3}$') assert m.kw_func4() == "{13 17}" assert m.kw_func4(myList=[1, 2, 3]) == "{1 2 3}" assert m.kw_func_udl(x=5, y=10) == "x=5, y=10" assert m.kw_func_udl_z(x=5) == "x=5, y=0" def test_arg_and_kwargs(): args = 'arg1_value', 'arg2_value', 3 assert m.args_function(*args) == args args = 'a1', 'a2' kwargs = dict(arg3='a3', arg4=4) assert m.args_kwargs_function(*args, **kwargs) == (args, kwargs) def test_mixed_args_and_kwargs(msg): mpa = m.mixed_plus_args mpk = m.mixed_plus_kwargs mpak = m.mixed_plus_args_kwargs mpakd = m.mixed_plus_args_kwargs_defaults assert mpa(1, 2.5, 4, 99.5, None) == (1, 2.5, (4, 99.5, None)) assert mpa(1, 2.5) == (1, 2.5, ()) with pytest.raises(TypeError) as excinfo: assert mpa(1) assert msg(excinfo.value) == """ mixed_plus_args(): incompatible function arguments. The following argument types are supported: 1. (arg0: int, arg1: float, *args) -> tuple Invoked with: 1 """ # noqa: E501 line too long with pytest.raises(TypeError) as excinfo: assert mpa() assert msg(excinfo.value) == """ mixed_plus_args(): incompatible function arguments. The following argument types are supported: 1. (arg0: int, arg1: float, *args) -> tuple Invoked with: """ # noqa: E501 line too long assert mpk(-2, 3.5, pi=3.14159, e=2.71828) == (-2, 3.5, {'e': 2.71828, 'pi': 3.14159}) assert mpak(7, 7.7, 7.77, 7.777, 7.7777, minusseven=-7) == ( 7, 7.7, (7.77, 7.777, 7.7777), {'minusseven': -7}) assert mpakd() == (1, 3.14159, (), {}) assert mpakd(3) == (3, 3.14159, (), {}) assert mpakd(j=2.71828) == (1, 2.71828, (), {}) assert mpakd(k=42) == (1, 3.14159, (), {'k': 42}) assert mpakd(1, 1, 2, 3, 5, 8, then=13, followedby=21) == ( 1, 1, (2, 3, 5, 8), {'then': 13, 'followedby': 21}) # Arguments specified both positionally and via kwargs should fail: with pytest.raises(TypeError) as excinfo: assert mpakd(1, i=1) assert msg(excinfo.value) == """ mixed_plus_args_kwargs_defaults(): incompatible function arguments. The following argument types are supported: 1. (i: int = 1, j: float = 3.14159, *args, **kwargs) -> tuple Invoked with: 1; kwargs: i=1 """ # noqa: E501 line too long with pytest.raises(TypeError) as excinfo: assert mpakd(1, 2, j=1) assert msg(excinfo.value) == """ mixed_plus_args_kwargs_defaults(): incompatible function arguments. The following argument types are supported: 1. (i: int = 1, j: float = 3.14159, *args, **kwargs) -> tuple Invoked with: 1, 2; kwargs: j=1 """ # noqa: E501 line too long def test_args_refcount(): """Issue/PR #1216 - py::args elements get double-inc_ref()ed when combined with regular arguments""" refcount = m.arg_refcount_h myval = 54321 expected = refcount(myval) assert m.arg_refcount_h(myval) == expected assert m.arg_refcount_o(myval) == expected + 1 assert m.arg_refcount_h(myval) == expected assert refcount(myval) == expected assert m.mixed_plus_args(1, 2.0, "a", myval) == (1, 2.0, ("a", myval)) assert refcount(myval) == expected assert m.mixed_plus_kwargs(3, 4.0, a=1, b=myval) == (3, 4.0, {"a": 1, "b": myval}) assert refcount(myval) == expected assert m.args_function(-1, myval) == (-1, myval) assert refcount(myval) == expected assert m.mixed_plus_args_kwargs(5, 6.0, myval, a=myval) == (5, 6.0, (myval,), {"a": myval}) assert refcount(myval) == expected assert m.args_kwargs_function(7, 8, myval, a=1, b=myval) == \ ((7, 8, myval), {"a": 1, "b": myval}) assert refcount(myval) == expected exp3 = refcount(myval, myval, myval) assert m.args_refcount(myval, myval, myval) == (exp3, exp3, exp3) assert refcount(myval) == expected # This function takes the first arg as a `py::object` and the rest as a `py::args`. Unlike the # previous case, when we have both positional and `py::args` we need to construct a new tuple # for the `py::args`; in the previous case, we could simply inc_ref and pass on Python's input # tuple without having to inc_ref the individual elements, but here we can't, hence the extra # refs. assert m.mixed_args_refcount(myval, myval, myval) == (exp3 + 3, exp3 + 3, exp3 + 3)
{ "pile_set_name": "Github" }
/* * [The "BSD license"] * Copyright (c) 2011 Terence Parr * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.stringtemplate.v4.misc; import java.util.*; /** A hash table that maps a key to a list of elements not just a single. */ public class MultiMap<K, V> extends LinkedHashMap<K, List<V>> { public void map(K key, V value) { List<V> elementsForKey = get(key); if ( elementsForKey==null ) { elementsForKey = new ArrayList<V>(); super.put(key, elementsForKey); } elementsForKey.add(value); } }
{ "pile_set_name": "Github" }
#!/bin/sh # Clean build directories rm -rf linux mkdir -p linux # Change to build directory and compile application cd .. make -j4 # Copy and build the application bundle cd deploy cp -r qgroundcontrol linux/. cp -r ../audio linux/. # FIXME Create debian packet echo -e '\n QGroundControl Debian packet is now ready for publishing\n'
{ "pile_set_name": "Github" }
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef THRIFT_FATAL_CONTAINER_TRAITS_H_ #define THRIFT_FATAL_CONTAINER_TRAITS_H_ 1 #include <deque> #include <map> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <thrift/lib/cpp2/reflection/reflection.h> namespace apache { namespace thrift { template <typename C, typename T, typename A> struct thrift_string_traits<std::basic_string<C, T, A>> : thrift_string_traits_std<std::basic_string<C, T, A>> {}; template <typename T, typename A> struct thrift_list_traits<std::deque<T, A>> : thrift_list_traits_std<std::deque<T, A>> {}; template <typename T, typename A> struct thrift_list_traits<std::vector<T, A>> : thrift_list_traits_std<std::vector<T, A>> {}; template <typename K, typename C, typename A> struct thrift_set_traits<std::set<K, C, A>> : thrift_set_traits_std<std::set<K, C, A>> {}; template <typename K, typename H, typename E, typename A> struct thrift_set_traits<std::unordered_set<K, H, E, A>> : thrift_set_traits_std<std::unordered_set<K, H, E, A>> {}; template <typename K, typename T, typename C, typename A> struct thrift_map_traits<std::map<K, T, C, A>> : thrift_map_traits_std<std::map<K, T, C, A>> {}; template <typename K, typename T, typename H, typename E, typename A> struct thrift_map_traits<std::unordered_map<K, T, H, E, A>> : thrift_map_traits_std<std::unordered_map<K, T, H, E, A>> {}; } // namespace thrift } // namespace apache #endif // THRIFT_FATAL_CONTAINER_TRAITS_H_
{ "pile_set_name": "Github" }
/* =========================================================== * bootstrap-tooltip.js v2.2.2 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== * Copyright 2012 Twitter, 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. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* TOOLTIP PUBLIC CLASS DEFINITION * =============================== */ var Tooltip = function (element, options) { this.init('tooltip', element, options) } Tooltip.prototype = { constructor: Tooltip , init: function (type, element, options) { var eventIn , eventOut this.type = type this.$element = $(element) this.options = this.getOptions(options) this.enabled = true if (this.options.trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (this.options.trigger != 'manual') { eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } , getOptions: function (options) { options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay , hide: options.delay } } return options } , enter: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (!self.options.delay || !self.options.delay.show) return self.show() clearTimeout(this.timeout) self.hoverState = 'in' this.timeout = setTimeout(function() { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } , leave: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() self.hoverState = 'out' this.timeout = setTimeout(function() { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } , show: function () { var $tip , inside , pos , actualWidth , actualHeight , placement , tp if (this.hasContent() && this.enabled) { $tip = this.tip() this.setContent() if (this.options.animation) { $tip.addClass('fade') } placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement inside = /in/.test(placement) $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .insertAfter(this.$element) pos = this.getPosition(inside) actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight switch (inside ? placement.split(' ')[1] : placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'top': tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'left': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} break case 'right': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} break } $tip .offset(tp) .addClass(placement) .addClass('in') } } , setContent: function () { var $tip = this.tip() , title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } , hide: function () { var that = this , $tip = this.tip() $tip.removeClass('in') function removeWithAnimation() { var timeout = setTimeout(function () { $tip.off($.support.transition.end).detach() }, 500) $tip.one($.support.transition.end, function () { clearTimeout(timeout) $tip.detach() }) } $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.detach() return this } , fixTitle: function () { var $e = this.$element if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') } } , hasContent: function () { return this.getTitle() } , getPosition: function (inside) { return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { width: this.$element[0].offsetWidth , height: this.$element[0].offsetHeight }) } , getTitle: function () { var title , $e = this.$element , o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } , tip: function () { return this.$tip = this.$tip || $(this.options.template) } , validate: function () { if (!this.$element[0].parentNode) { this.hide() this.$element = null this.options = null } } , enable: function () { this.enabled = true } , disable: function () { this.enabled = false } , toggleEnabled: function () { this.enabled = !this.enabled } , toggle: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) self[self.tip().hasClass('in') ? 'hide' : 'show']() } , destroy: function () { this.hide().$element.off('.' + this.type).removeData(this.type) } } /* TOOLTIP PLUGIN DEFINITION * ========================= */ var old = $.fn.tooltip $.fn.tooltip = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tooltip') , options = typeof option == 'object' && option if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.Constructor = Tooltip $.fn.tooltip.defaults = { animation: true , placement: 'top' , selector: false , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , trigger: 'hover' , title: '' , delay: 0 , html: false } /* TOOLTIP NO CONFLICT * =================== */ $.fn.tooltip.noConflict = function () { $.fn.tooltip = old return this } }(window.jQuery);
{ "pile_set_name": "Github" }
package com.ruoyi.activiti.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Id; import javax.persistence.Transient; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import tk.mybatis.mapper.annotation.KeySql; /** * 请假对象 act_leave * * @author ruoyi * @date 2020-01-07 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) public class BizLeave implements Serializable { // private static final long serialVersionUID = 7171474850069379927L; /** 主键 */ @Id @KeySql(useGeneratedKeys = true) private Long id; /** 标题 */ @Excel(name = "标题") private String title; /** 描述 */ @Excel(name = "描述") private String description; /** 开始时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startDate; /** 结束时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endDate; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** 时长 */ @Excel(name = "时长") private Double duration; /** 请假类型 */ @Excel(name = "请假类型") private Integer type; /** 删除标记 */ private Boolean delFlag; @Transient private String procDefId; @Transient private String procName; }
{ "pile_set_name": "Github" }
/* Copyright (C) 2011-2013 Doubango Telecom <http://www.doubango.org> * * This file is part of Open Source Doubango Framework. * * DOUBANGO 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. * * DOUBANGO 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 DOUBANGO. */ #ifndef PLUGIN_DSHOW_DSFRAMERATEFILTER_H #define PLUGIN_DSHOW_DSFRAMERATEFILTER_H #include "plugin_dshow_config.h" #include <streams.h> #include <math.h> class DSFrameRateFilter : public CTransInPlaceFilter { public: DSFrameRateFilter(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); ~DSFrameRateFilter(void); public: HRESULT Transform(IMediaSample *pSample); HRESULT CheckInputType(const CMediaType* mtIn); public: /** * \def SetFps * \brief fps1 define source . */ HRESULT SetFps(int inputFps, int outputFps); static CUnknown *WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); DECLARE_IUNKNOWN; /*STDMETHODIMP_(ULONG) NonDelegatingRelease() { if(InterlockedDecrement(&m_cRef) == 0) { delete this; return 0; } return m_cRef; }*/ private: int m_progress; int m_inputFps, m_outputFps; bool m_bProcessFrame; REFERENCE_TIME m_rtFrameLength; // UNITS/fps LONGLONG m_iFrameNumber; }; #endif ////DSFrameRateFilter_H
{ "pile_set_name": "Github" }
#include "aquila/global.h" #include "aquila/source/generator/SineGenerator.h" #include "aquila/transform/FftFactory.h" #include "aquila/tools/TextPlot.h" #include <algorithm> #include <functional> #include <memory> int main() { // input signal parameters const std::size_t SIZE = 64; const Aquila::FrequencyType sampleFreq = 2000; const Aquila::FrequencyType f1 = 96, f2 = 813; const Aquila::FrequencyType f_lp = 500; Aquila::SineGenerator sineGenerator1(sampleFreq); sineGenerator1.setAmplitude(32).setFrequency(f1).generate(SIZE); Aquila::SineGenerator sineGenerator2(sampleFreq); sineGenerator2.setAmplitude(8).setFrequency(f2).setPhase(0.75).generate(SIZE); auto sum = sineGenerator1 + sineGenerator2; Aquila::TextPlot plt("Signal waveform before filtration"); plt.plot(sum); // calculate the FFT auto fft = Aquila::FftFactory::getFft(SIZE); Aquila::SpectrumType spectrum = fft->fft(sum.toArray()); plt.setTitle("Signal spectrum before filtration"); plt.plotSpectrum(spectrum); // generate a low-pass filter spectrum Aquila::SpectrumType filterSpectrum(SIZE); for (std::size_t i = 0; i < SIZE; ++i) { if (i < (SIZE * f_lp / sampleFreq)) { // passband filterSpectrum[i] = 1.0; } else { // stopband filterSpectrum[i] = 0.0; } } plt.setTitle("Filter spectrum"); plt.plotSpectrum(filterSpectrum); // the following call does the multiplication of two spectra // (which is complementary to convolution in time domain) std::transform( std::begin(spectrum), std::end(spectrum), std::begin(filterSpectrum), std::begin(spectrum), [] (Aquila::ComplexType x, Aquila::ComplexType y) { return x * y; } ); plt.setTitle("Signal spectrum after filtration"); plt.plotSpectrum(spectrum); // Inverse FFT moves us back to time domain double x1[SIZE]; fft->ifft(spectrum, x1); plt.setTitle("Signal waveform after filtration"); plt.plot(x1, SIZE); return 0; }
{ "pile_set_name": "Github" }
class ProvidersController < ApplicationController def index @providers = Provider.order('id DESC').paginate( page: params[:page], per_page: 10 ) @new_provider = Provider.new @new_provider.enabled = true respond_to do |format| format.html # index.html.erb format.xml { render xml: @providers } end end def new @provider = Provider.new @provider.enabled = true @provider.port = 4569 respond_to do |format| format.html # new.html.erb format.xml { render xml: @provider } end end def edit @provider = Provider.find(params[:id]) @provider.pass = "********" end def create @provider = Provider.new(provider_params) @provider.enabled = true respond_to do |format| if @provider.save flash[:notice] = 'Provider was successfully created.' format.html { redirect_to providers_path } format.xml { render xml: @provider, status: :created, location: providers_path } else format.html { render action: "new" } format.xml { render xml: @provider.errors, status: :unprocessable_entity } end end end def update @provider = Provider.find(params[:id]) # Dont set the password if its the placeholder if params[:provider] and params[:provider][:pass] and params[:provider][:pass] == "********" params[:provider].delete(:pass) end respond_to do |format| if @provider.update_attributes(provider_params) flash[:notice] = 'Provider was successfully updated.' format.html { redirect_to providers_path } format.xml { head :ok } else format.html { render action: "edit" } format.xml { render xml: @provider.errors, status: :unprocessable_entity } end end end def destroy @provider = Provider.find(params[:id]) @provider.destroy respond_to do |format| format.html { redirect_to providers_path } format.xml { head :ok } end end private def provider_params params.require(:provider).permit(:name, :host, :port, :user, :pass, :lines) end end
{ "pile_set_name": "Github" }
import("//llvm/lib/DebugInfo/PDB/enable_dia.gni") static_library("PDB") { output_name = "LLVMDebugInfoPDB" deps = [ "//llvm/include/llvm/Config:config", "//llvm/lib/DebugInfo/CodeView", "//llvm/lib/DebugInfo/MSF", "//llvm/lib/Object", "//llvm/lib/Support", ] sources = [ "GenericError.cpp", "IPDBSourceFile.cpp", "Native/DbiModuleDescriptor.cpp", "Native/DbiModuleDescriptorBuilder.cpp", "Native/DbiModuleList.cpp", "Native/DbiStream.cpp", "Native/DbiStreamBuilder.cpp", "Native/EnumTables.cpp", "Native/GSIStreamBuilder.cpp", "Native/GlobalsStream.cpp", "Native/Hash.cpp", "Native/HashTable.cpp", "Native/InfoStream.cpp", "Native/InfoStreamBuilder.cpp", "Native/ModuleDebugStream.cpp", "Native/NamedStreamMap.cpp", "Native/NativeCompilandSymbol.cpp", "Native/NativeEnumGlobals.cpp", "Native/NativeEnumModules.cpp", "Native/NativeEnumTypes.cpp", "Native/NativeExeSymbol.cpp", "Native/NativeRawSymbol.cpp", "Native/NativeSession.cpp", "Native/NativeSymbolEnumerator.cpp", "Native/NativeTypeArray.cpp", "Native/NativeTypeBuiltin.cpp", "Native/NativeTypeEnum.cpp", "Native/NativeTypeFunctionSig.cpp", "Native/NativeTypePointer.cpp", "Native/NativeTypeTypedef.cpp", "Native/NativeTypeUDT.cpp", "Native/NativeTypeVTShape.cpp", "Native/PDBFile.cpp", "Native/PDBFileBuilder.cpp", "Native/PDBStringTable.cpp", "Native/PDBStringTableBuilder.cpp", "Native/PublicsStream.cpp", "Native/RawError.cpp", "Native/SymbolCache.cpp", "Native/SymbolStream.cpp", "Native/TpiHashing.cpp", "Native/TpiStream.cpp", "Native/TpiStreamBuilder.cpp", "PDB.cpp", "PDBContext.cpp", "PDBExtras.cpp", "PDBInterfaceAnchors.cpp", "PDBSymDumper.cpp", "PDBSymbol.cpp", "PDBSymbolAnnotation.cpp", "PDBSymbolBlock.cpp", "PDBSymbolCompiland.cpp", "PDBSymbolCompilandDetails.cpp", "PDBSymbolCompilandEnv.cpp", "PDBSymbolCustom.cpp", "PDBSymbolData.cpp", "PDBSymbolExe.cpp", "PDBSymbolFunc.cpp", "PDBSymbolFuncDebugEnd.cpp", "PDBSymbolFuncDebugStart.cpp", "PDBSymbolLabel.cpp", "PDBSymbolPublicSymbol.cpp", "PDBSymbolThunk.cpp", "PDBSymbolTypeArray.cpp", "PDBSymbolTypeBaseClass.cpp", "PDBSymbolTypeBuiltin.cpp", "PDBSymbolTypeCustom.cpp", "PDBSymbolTypeDimension.cpp", "PDBSymbolTypeEnum.cpp", "PDBSymbolTypeFriend.cpp", "PDBSymbolTypeFunctionArg.cpp", "PDBSymbolTypeFunctionSig.cpp", "PDBSymbolTypeManaged.cpp", "PDBSymbolTypePointer.cpp", "PDBSymbolTypeTypedef.cpp", "PDBSymbolTypeUDT.cpp", "PDBSymbolTypeVTable.cpp", "PDBSymbolTypeVTableShape.cpp", "PDBSymbolUnknown.cpp", "PDBSymbolUsingNamespace.cpp", "UDTLayout.cpp", ] if (llvm_enable_dia_sdk) { sources += [ "DIA/DIADataStream.cpp", "DIA/DIAEnumDebugStreams.cpp", "DIA/DIAEnumFrameData.cpp", "DIA/DIAEnumInjectedSources.cpp", "DIA/DIAEnumLineNumbers.cpp", "DIA/DIAEnumSectionContribs.cpp", "DIA/DIAEnumSourceFiles.cpp", "DIA/DIAEnumSymbols.cpp", "DIA/DIAEnumTables.cpp", "DIA/DIAError.cpp", "DIA/DIAFrameData.cpp", "DIA/DIAInjectedSource.cpp", "DIA/DIALineNumber.cpp", "DIA/DIARawSymbol.cpp", "DIA/DIASectionContrib.cpp", "DIA/DIASession.cpp", "DIA/DIASourceFile.cpp", "DIA/DIATable.cpp", ] # FIXME: Link against the right diaguids.lib too. } }
{ "pile_set_name": "Github" }
-j '{"locations":[{"lat":40.051899,"lon":-76.310738,"street":"West Liberty Street"},{"lat":39.997940,"lon":-76.290092,"street":"Willow Street Pike"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":40.047470,"lon":-76.362312,"street":"Noll Drive"},{"lat":40.038639,"lon":-76.363983,"street":"Millersville Road"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":40.201832,"lon":-76.724411,"street":"Vine Street"},{"lat":40.190720,"lon":-76.685013,"street":"Harrisburg Pike"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":39.004292,"lon":-77.428757,"street":"Davis Drive"},{"lat":39.007160,"lon":-77.444572,"street":"VA 625"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":39.005711,"lon":-77.429443,"street":"Atlantic Boulevard"},{"lat":39.004910,"lon":-77.436028,"street":"VA 625"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":39.005901,"lon":-77.443108,"street":"Pacific Boulevard"},{"lat":39.004761,"lon":-77.429962,"street":"West Church Road"}],"costing":"auto","directions_options":{"units":"miles"}}' -j '{"locations":[{"lat":38.895370,"lon":-77.192207,"street":"Chestnut Street"},{"lat":38.893311,"lon":-77.188271,"street":"West Broad Street"}],"costing":"auto","directions_options":{"units":"miles"}}'
{ "pile_set_name": "Github" }
int GetExitCode (int iFlag_Code) { if(iFlag_Code==OK) { return OK; } else if(iFlag_Code==WARNING) { return WARNING; } else { return_ERREUR; } return 0; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> </Filter> <Filter Include="Header Files"> <UniqueIdentifier>{28b6220e-d087-4f48-bd69-ffe0ac5bcc7a}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\tests\stress.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\tests\testlib.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\tests\libusb_testlib.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
## Licensed to Cloudera, Inc. under one ## or more contributor license agreements. See the NOTICE file ## distributed with this work for additional information ## regarding copyright ownership. Cloudera, Inc. 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. <%! from django.utils.translation import ugettext as _ from desktop.auth.backend import is_admin, is_hue_admin from desktop.conf import ENABLE_ORGANIZATIONS, ENABLE_CONNECTORS from desktop.views import commonheader, commonfooter from useradmin.hue_password_policy import is_password_policy_enabled, get_password_hint from useradmin.views import is_user_locked_out %> <%namespace name="layout" file="layout.mako" /> % if not is_embeddable: ${ commonheader(_('Users'), "useradmin", user, request) | n,unicode } % endif ${ layout.menubar(section='users') } <div id="editUserComponents" class="useradmin container-fluid"> <div class="card card-small title"> <h1 class="card-heading simple"> ${ _('User %(username)s') % dict(username=username) if username else _('Create user') } % if ENABLE_ORGANIZATIONS.get(): @ ${ user.organization } % endif </h1> <br/> <form id="editForm" method="POST" class="form form-horizontal" autocomplete="off"> ${ csrf_token(request) | n,unicode } <div id="properties" class="section"> <ul class="nav nav-tabs" style="margin-bottom: 0"> <li class="active"> <a href="javascript:void(0)" class="step" data-step="step1">${ _('Step 1: Credentials') } % if not username: ${ _('(required)') } % endif </a> </li> <li><a href="javascript:void(0)" class="step" data-step="step2">${ is_admin(user) and _('Step 2: Profile and Groups') or _('Step 2: Profile') }</a> </li> % if is_admin(user): <li><a href="javascript:void(0)" class="step" data-step="step3">${ _('Step 3: Advanced') }</a></li> % endif </ul> <div class="steps"> <div id="step1" class="stepDetails"> % if ENABLE_ORGANIZATIONS.get(): ${ layout.render_field(form["email"], extra_attrs={'validate':'true'}) } % else: ${ layout.render_field(form["username"], extra_attrs={'validate':'true'}) } % endif % if "password1" in form.fields: % if username and "password_old" in form.fields: ${ layout.render_field(form["password_old"], extra_attrs=username is None and {'validate':'true'} or {}) } % endif ${ layout.render_field(form["password1"], extra_attrs=username is None and {'validate':'true'} or {}) } % if is_password_policy_enabled(): <div class="password_rule" style="margin-left:180px; width:500px;"> <p>${ get_password_hint() }</p> </div> % endif ${layout.render_field(form["password2"], extra_attrs=username is None and {'validate':'true'} or {})} % endif % if not ENABLE_CONNECTORS.get(): ${ layout.render_field(form["ensure_home_directory"]) } % endif </div> <div id="step2" class="stepDetails hide"> % if "first_name" in form.fields: ${layout.render_field(form["first_name"])} ${layout.render_field(form["last_name"])} % endif % if ENABLE_ORGANIZATIONS.get(): ${layout.render_field(form["organization"])} % else: ${layout.render_field(form["email"])} % endif % if request.user.username == username: ${layout.render_field(form["language"])} % endif % if is_admin(user): ${layout.render_field(form["groups"])} % endif </div> % if is_admin(user): <div id="step3" class="stepDetails hide"> ${ layout.render_field(form["is_active"]) } % if is_hue_admin(user): ${ 'is_superuser' in form.fields and layout.render_field(form["is_superuser"]) } % endif % if is_user_locked_out(username): ${ layout.render_field(form["unlock_account"]) } % endif </div> % endif </div> <div class="form-actions"> <a class="backBtn btn disabled">${ _('Back') }</a> <a class="nextBtn btn btn-primary disable-feedback">${ _('Next') }</a> % if is_embeddable: <input type="hidden" value="true" name="is_embeddable" /> % endif % if username: <input type="submit" class="btn btn-primary disable-feedback" value="${_('Update user')}"/> % else: <input type="submit" class="btn btn-primary disable-feedback" value="${_('Add user')}"/> % endif </div> </form> </div> </div> <script type="text/javascript"> $(document).ready(function(){ var $editUserComponents = $('#editUserComponents'); $editUserComponents.find("#id_groups").jHueSelector({ selectAllLabel: "${_('Select all')}", searchPlaceholder: "${_('Search')}", noChoicesFound: "${_('No groups found.')} <a href='${url('useradmin.views.edit_group')}'>${_('Create a new group now')} &raquo;</a>", width:618, height:240 }); % if is_embeddable: $editUserComponents.find('#editForm').attr('action', window.location.pathname.substr((window.HUE_BASE_URL + '/hue').length).replace(/\/$/, '')); $editUserComponents.find('#editForm').ajaxForm({ dataType: 'json', success: function(data) { if (data && data.status == -1) { renderUseradminErrors(data.errors); } else if (data && data.url) { huePubSub.publish('open.link', data.url); $.jHueNotify.info("${ _('User information updated correctly') }"); } } }); % endif var currentStep = "step1"; function showStep(step) { currentStep = step; if (step != "step1") { $editUserComponents.find(".backBtn").removeClass("disabled"); } else { $editUserComponents.find(".backBtn").addClass("disabled"); } if (step != $editUserComponents.find(".stepDetails:last").attr("id")) { $editUserComponents.find(".nextBtn").removeClass("disabled"); } else { $editUserComponents.find(".nextBtn").addClass("disabled"); } $editUserComponents.find("a.step").parent().removeClass("active"); $editUserComponents.find("a.step[data-step=" + step + "]").parent().addClass("active"); $editUserComponents.find(".stepDetails").hide(); $editUserComponents.find("#" + step).show(); } function validateStep(step) { var proceed = true; $editUserComponents.find("#" + step).find("[validate=true]").each(function () { if ($(this).val().trim() == "") { proceed = false; router(step); $(this).parents(".control-group").addClass("error"); $(this).parent().find(".help-inline").remove(); $(this).after("<span class=\"help-inline\"><strong>${ _('This field is required.') }</strong></span>"); } }); return proceed; } function router(step) { switch (step) { case 'step1': showStep('step1'); break; case 'step2': if (validateStep('step1')){ showStep('step2'); } break; case 'step3': if (validateStep('step1') && validateStep('step2')){ showStep('step3'); } break; } } $editUserComponents.find(".step").on('click', function () { router($(this).data('step')); }); $editUserComponents.find(".backBtn").click(function () { var nextStep = (currentStep.substr(4) * 1 - 1); if (nextStep >= 1) { router('step' + nextStep); } }); $editUserComponents.find(".nextBtn").click(function () { var nextStep = (currentStep.substr(4) * 1 + 1); if (nextStep <= $(".step").length) { router('step' + nextStep); } }); $editUserComponents.find("[validate=true]").change(function () { $(this).parents(".control-group").removeClass("error"); $(this).parent().find(".help-inline").remove(); }); % if not is_embeddable: $editUserComponents.find("#editForm").on("submit", function(){ if (validateStep("step1") && validateStep("step2")) { return true; } return false; }) % endif }); </script> ${layout.commons()} %if not is_embeddable: ${ commonfooter(None, messages) | n,unicode } %endif
{ "pile_set_name": "Github" }
#ifndef PRICE_TRIGGER_H #define PRICE_TRIGGER_H #include <cfloat> #include <QString> class PriceTrigger { public: bool direction; double triggerPrice; PriceTrigger(){} virtual ~PriceTrigger(){} virtual bool getDirection() const { return direction; } virtual double getTriggerPrice() const { return triggerPrice; } virtual bool checkTrigger(double price) const { return getDirection() ? getTriggerPrice() < price : getTriggerPrice() > price; } virtual QString toString() = 0; }; class EnterSignal : public PriceTrigger { public: double cancelPrice; EnterSignal(bool direction, double triggerPrice, double cancelPrice) : cancelPrice(cancelPrice) { this->direction = direction; this->triggerPrice = triggerPrice; } // Construct unconditional enter signal EnterSignal(bool direction) : EnterSignal((direction), (direction ? DBL_MAX : -DBL_MAX), (direction ? -DBL_MAX : DBL_MAX)) { } QString toString() { QString ret = "EnterSignal "; ret += getDirection() ? "Up: " : "Down: "; ret += QString("Trigger=%1;Cancel=%2").arg(triggerPrice).arg(cancelPrice); return ret; } }; #endif // PRICE_TRIGGER_H
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- this file is autogenerated, do not edit! --> <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> <chapter id="counters.ims_qos"> <title> Counters for ims_qos</title> <section id="ims_qos.active_registration_rx_sessions"> <title>ims_qos.active_registration_rx_sessions</title> <para> number of currently active registration Rx sessions. </para> <para> </para> </section> <section id="ims_qos.registration_aar_avg_response_time"> <title>ims_qos.registration_aar_avg_response_time</title> <para> avg response time for registration AARs. </para> <para> </para> </section> <section id="ims_qos.registration_aar_timeouts"> <title>ims_qos.registration_aar_timeouts</title> <para> total number of registration AAR timeouts. </para> <para> </para> </section> <section id="ims_qos.failed_registration_aars"> <title>ims_qos.failed_registration_aars</title> <para> total number of failed registration AARs. </para> <para> </para> </section> <section id="ims_qos.registration_aars"> <title>ims_qos.registration_aars</title> <para> total number of registration AARs. </para> <para> </para> </section> <section id="ims_qos.asrs"> <title>ims_qos.asrs</title> <para> total number of registration ASRs. </para> <para> </para> </section> <section id="ims_qos.successful_registration_aars"> <title>ims_qos.successful_registration_aars</title> <para> total number of successful registration AARs. </para> <para> </para> </section> <section id="ims_qos.registration_aar_response_time"> <title>ims_qos.registration_aar_response_time</title> <para> total number of seconds waiting for registration AAR responses. </para> <para> </para> </section> <section id="ims_qos.registration_aar_replies_received"> <title>ims_qos.registration_aar_replies_received</title> <para> total number of registration AAR replies received. </para> <para> </para> </section> <section id="ims_qos.active_media_rx_sessions"> <title>ims_qos.active_media_rx_sessions</title> <para> number of currently active media Rx sessions. </para> <para> </para> </section> <section id="ims_qos.media_rx_sessions"> <title>ims_qos.media_rx_sessions</title> <para> Total number of media Rx sessions. </para> <para> </para> </section> <section id="ims_qos.media_aar_avg_response_time"> <title>ims_qos.media_aar_avg_response_time</title> <para> avg response time for media AARs. </para> <para> </para> </section> <section id="ims_qos.media_aar_timeouts"> <title>ims_qos.media_aar_timeouts</title> <para> total number of media AAR timeouts. </para> <para> </para> </section> <section id="ims_qos.failed_media_aars"> <title>ims_qos.failed_media_aars</title> <para> total number of failed media AARs. </para> <para> </para> </section> <section id="ims_qos.media_aars"> <title>ims_qos.media_aars</title> <para> total number of media AARs. </para> <para> </para> </section> <section id="ims_qos.successful_media_aars"> <title>ims_qos.successful_media_aars</title> <para> total number of successful media AARs. </para> <para> </para> </section> <section id="ims_qos.media_aar_response_time"> <title>ims_qos.media_aar_response_time</title> <para> total number of seconds waiting for media AAR responses. </para> <para> </para> </section> <section id="ims_qos.media_aar_replies_received"> <title>ims_qos.media_aar_replies_received</title> <para> total number of media AAR replies received. </para> <para> </para> </section> </chapter>
{ "pile_set_name": "Github" }
<Workspace Version="0.8.1.1693" X="30" Y="359.604320640866" zoom="1.39450686641698" Name="UV.ByXY" ID="299c468e-2730-42d1-86a8-9d887b854a41" Description="Creates UVs from the XY components of point coordinates" Category="Clockwork.Geometry.UV.Create"> <NamespaceResolutionMap> <ClassMap partialName="UV" resolvedName="Autodesk.DesignScript.Geometry.UV" assemblyName="ProtoGeometry.dll" /> <ClassMap partialName="Autodesk.Point" resolvedName="Autodesk.DesignScript.Geometry.Point" assemblyName="ProtoGeometry.dll" /> </NamespaceResolutionMap> <Elements> <Dynamo.Nodes.CodeBlockNodeModel guid="1b82734d-d186-4de6-b6a8-bf571adb38c9" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="315" y="4.21833333333333" isVisible="true" isUpstreamVisible="true" lacing="Disabled" CodeText="UV.ByCoordinates(seq.X,seq.Y);" ShouldFocus="false" /> <Dynamo.Nodes.Symbol guid="db64d030-88cd-4f7e-b904-a7f50e67e125" type="Dynamo.Nodes.Symbol" nickname="Input" x="0" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled"> <Symbol value="point : Autodesk.Point" /> </Dynamo.Nodes.Symbol> <Dynamo.Nodes.Output guid="487cb3e1-ad6a-4ed7-81f3-bb8ae34570c4" type="Dynamo.Nodes.Output" nickname="Output" x="732" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled"> <Symbol value="uv" /> </Dynamo.Nodes.Output> </Elements> <Connectors> <Dynamo.Models.ConnectorModel start="1b82734d-d186-4de6-b6a8-bf571adb38c9" start_index="0" end="487cb3e1-ad6a-4ed7-81f3-bb8ae34570c4" end_index="0" portType="0" /> <Dynamo.Models.ConnectorModel start="db64d030-88cd-4f7e-b904-a7f50e67e125" start_index="0" end="1b82734d-d186-4de6-b6a8-bf571adb38c9" end_index="0" portType="0" /> </Connectors> <Notes /> <Annotations /> </Workspace>
{ "pile_set_name": "Github" }
// // ADS1299Managerdue.h // Part of the Arduino DUE Library for the ADS1299 Shield // Created by Chip Audette, Ported by Joel Murphy Fall 2013 // #ifndef ____ADS1299Managerdue__ #define ____ADS1299Managerdue__ #include <ADS1299due.h> //Pick which version of OpenBCI you have #define OPENBCI_V1 (1) //Sept 2013 #define OPENBCI_V2 (2) //Oct 24, 2013 #define OPENBCI_NCHAN (8) // number of EEG channels /* Arduino Uno - Pin Assignments // SCK = 13 // MISO [DOUT] = 12 // MOSI [DIN] = 11 CS = 10; RESET = 9; DRDY = 8; */ #define PIN_DRDY (8) #define PIN_RST (9) #define PIN_CS (10) //#define SCK_MHZ (4) //gainCode choices #define ADS_GAIN01 (0b00000000) #define ADS_GAIN02 (0b00010000) #define ADS_GAIN04 (0b00100000) #define ADS_GAIN06 (0b00110000) #define ADS_GAIN08 (0b01000000) #define ADS_GAIN12 (0b01010000) #define ADS_GAIN24 (0b01100000) //inputCode choices #define ADSINPUT_NORMAL (0b00000000) #define ADSINPUT_SHORTED (0b00000001) #define ADSINPUT_TESTSIG (0b00000101) //test signal choices...ADS1299 datasheet page 41 #define ADSTESTSIG_AMP_1X (0b00000000) #define ADSTESTSIG_AMP_2X (0b00000100) #define ADSTESTSIG_PULSE_SLOW (0b00000000) #define ADSTESTSIG_PULSE_FAST (0b00000001) #define ADSTESTSIG_DCSIG (0b00000011) #define ADSTESTSIG_NOCHANGE (0b11111111) //binary communication codes for each packet #define PCKT_START 0xA0 #define PCKT_END 0xC0 class ADS1299Managerdue : public ADS1299due { public: void initialize(void); //initialize the ADS1299 controller. Call once. Assumes OpenBCI_V2 void initialize(int version); //initialize the ADS1299 controller. Call once. Set which version of OpenBCI you're using. void setVersionOpenBCI(int version); //Set which version of OpenBCI you're using. void reset(void); //reset all the ADS1299's settings. Call however you'd like void activateChannel(int N, byte gainCode,byte inputCode); //setup the channel 1-8 void deactivateChannel(int N); //disable given channel 1-8 void configureInternalTestSignal(byte amplitudeCode, byte freqCode); void start(void); void stop(void); int isDataAvailable(void); void printChannelDataAsText(int N, long int sampleNumber); void writeChannelDataAsBinary(int N, long int sampleNumber); void writeChannelDataAsOpenEEG_P2(long int sampleNumber); void writeChannelDataAsOpenEEG_P2(long int sampleNumber, boolean useSyntheticData); void printAllRegisters(void); void setSRB1(boolean desired_state); private: boolean use_neg_inputs; boolean use_SRB2[OPENBCI_NCHAN]; boolean use_SRB1(void); }; #endif
{ "pile_set_name": "Github" }
use neptune::poseidon::Poseidon; use paired::bls12_381::Fr; use storage_proofs_core::hasher::types::{POSEIDON_CONSTANTS_11, POSEIDON_CONSTANTS_2}; /// Hash all elements in the given column. pub fn hash_single_column(column: &[Fr]) -> Fr { match column.len() { 2 => { let mut hasher = Poseidon::new_with_preimage(column, &*POSEIDON_CONSTANTS_2); hasher.hash() } 11 => { let mut hasher = Poseidon::new_with_preimage(column, &*POSEIDON_CONSTANTS_11); hasher.hash() } _ => panic!("unsupported column size: {}", column.len()), } }
{ "pile_set_name": "Github" }
polygon 1 1.605389E+01 3.928150E+01 1.605587E+01 3.928177E+01 1.606370E+01 3.928309E+01 1.606833E+01 3.928376E+01 1.606888E+01 3.928382E+01 1.606920E+01 3.928377E+01 1.606944E+01 3.928362E+01 1.606976E+01 3.928355E+01 1.607100E+01 3.928329E+01 1.607172E+01 3.928333E+01 1.607291E+01 3.928341E+01 1.607355E+01 3.928347E+01 1.607547E+01 3.928379E+01 1.608520E+01 3.928577E+01 1.609086E+01 3.928740E+01 1.609264E+01 3.928810E+01 1.609362E+01 3.928851E+01 1.611585E+01 3.929691E+01 1.612937E+01 3.929519E+01 1.613143E+01 3.929435E+01 1.613156E+01 3.929398E+01 1.613159E+01 3.929286E+01 1.613159E+01 3.929251E+01 1.613157E+01 3.929224E+01 1.613119E+01 3.928674E+01 1.613116E+01 3.928649E+01 1.613110E+01 3.928609E+01 1.613063E+01 3.928453E+01 1.613041E+01 3.928407E+01 1.613017E+01 3.928377E+01 1.612998E+01 3.928349E+01 1.612977E+01 3.928312E+01 1.612796E+01 3.927888E+01 1.612728E+01 3.927707E+01 1.612645E+01 3.927439E+01 1.612748E+01 3.927418E+01 1.612960E+01 3.927150E+01 1.612914E+01 3.927152E+01 1.612824E+01 3.927130E+01 1.611807E+01 3.926836E+01 1.611764E+01 3.926815E+01 1.611662E+01 3.926728E+01 1.611618E+01 3.926682E+01 1.611584E+01 3.926640E+01 1.611558E+01 3.926584E+01 1.611488E+01 3.926481E+01 1.611456E+01 3.926438E+01 1.611413E+01 3.926402E+01 1.611375E+01 3.926376E+01 1.611347E+01 3.926361E+01 1.611305E+01 3.926339E+01 1.611276E+01 3.926329E+01 1.611212E+01 3.926316E+01 1.610559E+01 3.926185E+01 1.610040E+01 3.926154E+01 1.609804E+01 3.926148E+01 1.609468E+01 3.926142E+01 1.609395E+01 3.926148E+01 1.609283E+01 3.926190E+01 1.609098E+01 3.926265E+01 1.608224E+01 3.926130E+01 1.607656E+01 3.925934E+01 1.606972E+01 3.925828E+01 1.606919E+01 3.925824E+01 1.606858E+01 3.925822E+01 1.606642E+01 3.925831E+01 1.605608E+01 3.925974E+01 1.605389E+01 3.928150E+01 END END
{ "pile_set_name": "Github" }
<!doctype html> <html lang="ja"> <head> {% include head.html %} </head> <body> <!--[if lt IE 8]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <main role="main"> {% include navigation.html %} <div class="container doc-container"> {{ content }} </div> {% include footer.html %} </main> {% include javascripts.html %} </body> </html>
{ "pile_set_name": "Github" }
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Controller\Adminhtml\Invoice; use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; class View extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View implements HttpGetActionInterface { }
{ "pile_set_name": "Github" }
.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "TEXTQL" "1" "December 2015" "" "" . .SH "NAME" \fBtextql\fR \- execute queries on structured text . .SH "SYNOPSIS" \fBtextql\fR [\fI\-save\-to path\fR] [\fI\-output\-file path\fR] [\fI\-output\-dlm delimter\fR] [\fI\-output\-header\fR] [\fI\-header\fR] [\fI\-dlm delimter\fR] [\fI\-source path\fR] [\fI\-sql sql_statements\fR] [\fI\-quiet\fR] [\fIpath\fR\.\.\.] . .br \fBtextql\fR \fI\-console\fR \fIpath\fR\.\.\. . .br . .SH "DESCRIPTION" \fBtextql\fR executes given statements in SQL on structured texts and returns the result\. SQL statements accepted by \fBtextql\fR are ANSI SQL compatible, and are executed against the data in the order provided\. No transformations are applied to the text files but are instead applied to a temporary view of the data\. Statements that insert data or modify the existing data will only have their effects visible in the output\. . .P The argument list of the end is expected to be a list of paths which may or may not be specific files\. Each path is traversed for files that are then loaded as part of the database that \fBtextql\fR creates internally, and files are loaded without traversal\. Paths provided are not recursed\. . .P Each statement is then executed against \fBtextql\fR\'s internal database and the result, if any, is printed\. \fBINSERT\fR, \fBUPDATE\fR, \fBDELETE\fR or other side effecting statements do not effect the text files given as input, but instead modify the database internal to \fBtextql\fR\. Their result may be viewed via the output, presisting the database as is with \fB\-save\-to\fR or in a SQLite REPL with \fB\-\-console\fR . .P With no arguements, \fBtextql\fR will print a brief overview of it\'s usage\. . .SH "FILES" Structured text accepted by textql is any text file in a tabular format where each row of the table is on a single line, and each column is a section of the line delimited by a single character which is consistent throughout the file\. A common structured text format is CSV (RFC4180)\. . .SH "OPTIONS" . .TP \fB\-console\fR After all statements are run, open SQLite3 REPL with this data . .TP \fB\-dlm string\fR Input delimiter character between fields \-dlm=tab for tab, \-dlm=0x## to specify a character code in hex (default ",") . .TP \fB\-header\fR Treat input files as having the first row as a header row . .TP \fB\-output\-dlm string\fR Output delimiter character between fields \-output\-dlm=tab for tab, \-dlm=0x## to specify a character code in hex (default ",") . .TP \fB\-output\-file file\fR Filename to write output to, if empty no output is written (default "stdout") . .TP \fB\-output\-header\fR Display column names in output . .TP \fB\-quiet\fR Surpress logging . .TP \fB\-pretty\fR Pretty print output . .TP \fB\-save\-to file\fR SQLite3 db is left on disk at this file . .TP \fB\-sql string\fR SQL Statement(s) to run on the data . .TP \fB\-version\fR Print version and exit . .SH "COPYRIGHT" textql is Copyright (C) 2015, 2016 Paul Bergeron \fIhttp://pauldbergeron\.com/\fR
{ "pile_set_name": "Github" }
{ "compilerOptions": { "module": "commonjs", "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es6", "sourceMap": true, "outDir": "./dist", "baseUrl": "./" }, "exclude": ["node_modules"] }
{ "pile_set_name": "Github" }
/* * Copyright 2014 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ // Borrowed from Chromium's src/base/numerics/safe_conversions_impl.h. #ifndef RTC_BASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_ #define RTC_BASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_ #include <limits> namespace rtc { namespace internal { enum DstSign { DST_UNSIGNED, DST_SIGNED }; enum SrcSign { SRC_UNSIGNED, SRC_SIGNED }; enum DstRange { OVERLAPS_RANGE, CONTAINS_RANGE }; // Helper templates to statically determine if our destination type can contain // all values represented by the source type. template <typename Dst, typename Src, DstSign IsDstSigned = std::numeric_limits<Dst>::is_signed ? DST_SIGNED : DST_UNSIGNED, SrcSign IsSrcSigned = std::numeric_limits<Src>::is_signed ? SRC_SIGNED : SRC_UNSIGNED> struct StaticRangeCheck {}; template <typename Dst, typename Src> struct StaticRangeCheck<Dst, Src, DST_SIGNED, SRC_SIGNED> { typedef std::numeric_limits<Dst> DstLimits; typedef std::numeric_limits<Src> SrcLimits; // Compare based on max_exponent, which we must compute for integrals. static const size_t kDstMaxExponent = DstLimits::is_iec559 ? DstLimits::max_exponent : (sizeof(Dst) * 8 - 1); static const size_t kSrcMaxExponent = SrcLimits::is_iec559 ? SrcLimits::max_exponent : (sizeof(Src) * 8 - 1); static const DstRange value = kDstMaxExponent >= kSrcMaxExponent ? CONTAINS_RANGE : OVERLAPS_RANGE; }; template <typename Dst, typename Src> struct StaticRangeCheck<Dst, Src, DST_UNSIGNED, SRC_UNSIGNED> { static const DstRange value = sizeof(Dst) >= sizeof(Src) ? CONTAINS_RANGE : OVERLAPS_RANGE; }; template <typename Dst, typename Src> struct StaticRangeCheck<Dst, Src, DST_SIGNED, SRC_UNSIGNED> { typedef std::numeric_limits<Dst> DstLimits; typedef std::numeric_limits<Src> SrcLimits; // Compare based on max_exponent, which we must compute for integrals. static const size_t kDstMaxExponent = DstLimits::is_iec559 ? DstLimits::max_exponent : (sizeof(Dst) * 8 - 1); static const size_t kSrcMaxExponent = sizeof(Src) * 8; static const DstRange value = kDstMaxExponent >= kSrcMaxExponent ? CONTAINS_RANGE : OVERLAPS_RANGE; }; template <typename Dst, typename Src> struct StaticRangeCheck<Dst, Src, DST_UNSIGNED, SRC_SIGNED> { static const DstRange value = OVERLAPS_RANGE; }; enum RangeCheckResult { TYPE_VALID = 0, // Value can be represented by the destination type. TYPE_UNDERFLOW = 1, // Value would overflow. TYPE_OVERFLOW = 2, // Value would underflow. TYPE_INVALID = 3 // Source value is invalid (i.e. NaN). }; // This macro creates a RangeCheckResult from an upper and lower bound // check by taking advantage of the fact that only NaN can be out of range in // both directions at once. #define BASE_NUMERIC_RANGE_CHECK_RESULT(is_in_upper_bound, is_in_lower_bound) \ RangeCheckResult(((is_in_upper_bound) ? 0 : TYPE_OVERFLOW) | \ ((is_in_lower_bound) ? 0 : TYPE_UNDERFLOW)) template <typename Dst, typename Src, DstSign IsDstSigned = std::numeric_limits<Dst>::is_signed ? DST_SIGNED : DST_UNSIGNED, SrcSign IsSrcSigned = std::numeric_limits<Src>::is_signed ? SRC_SIGNED : SRC_UNSIGNED, DstRange IsSrcRangeContained = StaticRangeCheck<Dst, Src>::value> struct RangeCheckImpl {}; // The following templates are for ranges that must be verified at runtime. We // split it into checks based on signedness to avoid confusing casts and // compiler warnings on signed an unsigned comparisons. // Dst range always contains the result: nothing to check. template <typename Dst, typename Src, DstSign IsDstSigned, SrcSign IsSrcSigned> struct RangeCheckImpl<Dst, Src, IsDstSigned, IsSrcSigned, CONTAINS_RANGE> { static RangeCheckResult Check(Src value) { return TYPE_VALID; } }; // Signed to signed narrowing. template <typename Dst, typename Src> struct RangeCheckImpl<Dst, Src, DST_SIGNED, SRC_SIGNED, OVERLAPS_RANGE> { static RangeCheckResult Check(Src value) { typedef std::numeric_limits<Dst> DstLimits; return DstLimits::is_iec559 ? BASE_NUMERIC_RANGE_CHECK_RESULT( value <= static_cast<Src>(DstLimits::max()), value >= static_cast<Src>(DstLimits::max() * -1)) : BASE_NUMERIC_RANGE_CHECK_RESULT( value <= static_cast<Src>(DstLimits::max()), value >= static_cast<Src>(DstLimits::min())); } }; // Unsigned to unsigned narrowing. template <typename Dst, typename Src> struct RangeCheckImpl<Dst, Src, DST_UNSIGNED, SRC_UNSIGNED, OVERLAPS_RANGE> { static RangeCheckResult Check(Src value) { typedef std::numeric_limits<Dst> DstLimits; return BASE_NUMERIC_RANGE_CHECK_RESULT( value <= static_cast<Src>(DstLimits::max()), true); } }; // Unsigned to signed. template <typename Dst, typename Src> struct RangeCheckImpl<Dst, Src, DST_SIGNED, SRC_UNSIGNED, OVERLAPS_RANGE> { static RangeCheckResult Check(Src value) { typedef std::numeric_limits<Dst> DstLimits; return sizeof(Dst) > sizeof(Src) ? TYPE_VALID : BASE_NUMERIC_RANGE_CHECK_RESULT( value <= static_cast<Src>(DstLimits::max()), true); } }; // Signed to unsigned. template <typename Dst, typename Src> struct RangeCheckImpl<Dst, Src, DST_UNSIGNED, SRC_SIGNED, OVERLAPS_RANGE> { static RangeCheckResult Check(Src value) { typedef std::numeric_limits<Dst> DstLimits; typedef std::numeric_limits<Src> SrcLimits; // Compare based on max_exponent, which we must compute for integrals. static const size_t kDstMaxExponent = sizeof(Dst) * 8; static const size_t kSrcMaxExponent = SrcLimits::is_iec559 ? SrcLimits::max_exponent : (sizeof(Src) * 8 - 1); return (kDstMaxExponent >= kSrcMaxExponent) ? BASE_NUMERIC_RANGE_CHECK_RESULT(true, value >= static_cast<Src>(0)) : BASE_NUMERIC_RANGE_CHECK_RESULT( value <= static_cast<Src>(DstLimits::max()), value >= static_cast<Src>(0)); } }; template <typename Dst, typename Src> inline RangeCheckResult RangeCheck(Src value) { static_assert(std::numeric_limits<Src>::is_specialized, "argument must be numeric"); static_assert(std::numeric_limits<Dst>::is_specialized, "result must be numeric"); return RangeCheckImpl<Dst, Src>::Check(value); } } // namespace internal } // namespace rtc #endif // RTC_BASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
{ "pile_set_name": "Github" }
/* SDLMain.m - main entry point for our Cocoa-ized SDL app Initial Version: Darrell Walisser <[email protected]> Non-NIB-Code & other changes: Max Horn <[email protected]> Feel free to customize this file to suit your needs */ #import "SDL.h" #import "SDLMain.h" #import <sys/param.h> /* for MAXPATHLEN */ #import <unistd.h> /* For some reaon, Apple removed setAppleMenu from the headers in 10.4, but the method still is there and works. To avoid warnings, we declare it ourselves here. */ @interface NSApplication(SDL_Missing_Methods) - (void)setAppleMenu:(NSMenu *)menu; @end /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 /* Use this flag to determine whether we use CPS (docking) or not */ #define SDL_USE_CPS 1 #ifdef SDL_USE_CPS /* Portions of CPS.h */ typedef struct CPSProcessSerNum { UInt32 lo; UInt32 hi; } CPSProcessSerNum; extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); #endif /* SDL_USE_CPS */ static int gArgc; static char **gArgv; static BOOL gFinderLaunch; static BOOL gCalledAppMainline = FALSE; static NSString *getApplicationName(void) { NSDictionary *dict; NSString *appName = 0; /* Determine the application name */ dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); if (dict) appName = [dict objectForKey: @"CFBundleName"]; if (![appName length]) appName = [[NSProcessInfo processInfo] processName]; return appName; } #if SDL_USE_NIB_FILE /* A helper category for NSString */ @interface NSString (ReplaceSubString) - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; @end #endif @interface SDLApplication : NSApplication @end @implementation SDLApplication /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end /* The main class of the application, the application's delegate */ @implementation SDLMain /* Set the working directory to the .app's parent directory */ - (void) setupWorkingDirectory:(BOOL)shouldChdir { if (shouldChdir) { char parentdir[MAXPATHLEN]; CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ } CFRelease(url); CFRelease(url2); } } #if SDL_USE_NIB_FILE /* Fix menu to contain the real app name instead of "SDL App" */ - (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName { NSRange aRange; NSEnumerator *enumerator; NSMenuItem *menuItem; aRange = [[aMenu title] rangeOfString:@"SDL App"]; if (aRange.length != 0) [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; enumerator = [[aMenu itemArray] objectEnumerator]; while ((menuItem = [enumerator nextObject])) { aRange = [[menuItem title] rangeOfString:@"SDL App"]; if (aRange.length != 0) [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; if ([menuItem hasSubmenu]) [self fixMenu:[menuItem submenu] withAppName:appName]; } [ aMenu sizeToFit ]; } #else static void setApplicationMenu(void) { /* warning: this code is very odd */ NSMenu *appleMenu; NSMenuItem *menuItem; NSString *title; NSString *appName; appName = getApplicationName(); appleMenu = [[NSMenu alloc] initWithTitle:@""]; /* Add menu items */ title = [@"About " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appleMenu addItem:[NSMenuItem separatorItem]]; title = [@"Hide " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; [appleMenu addItem:[NSMenuItem separatorItem]]; title = [@"Quit " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; [menuItem setSubmenu:appleMenu]; [[NSApp mainMenu] addItem:menuItem]; /* Tell the application object that this is now the application menu */ [NSApp setAppleMenu:appleMenu]; /* Finally give up our references to the objects */ [appleMenu release]; [menuItem release]; } /* Create a window menu */ static void setupWindowMenu(void) { NSMenu *windowMenu; NSMenuItem *windowMenuItem; NSMenuItem *menuItem; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; /* "Minimize" item */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItem:menuItem]; [menuItem release]; /* Put menu into the menubar */ windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [windowMenuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:windowMenuItem]; /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; /* Finally give up our references to the objects */ [windowMenu release]; [windowMenuItem release]; } /* Replacement for NSApplicationMain */ static void CustomApplicationMain (int argc, char **argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; SDLMain *sdlMain; /* Ensure the application object is initialised */ [SDLApplication sharedApplication]; #ifdef SDL_USE_CPS { CPSProcessSerNum PSN; /* Tell the dock about us */ if (!CPSGetCurrentProcess(&PSN)) if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) if (!CPSSetFrontProcess(&PSN)) [SDLApplication sharedApplication]; } #endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; setApplicationMenu(); setupWindowMenu(); /* Create SDLMain and make it the app delegate */ sdlMain = [[SDLMain alloc] init]; [NSApp setDelegate:sdlMain]; /* Start the main event loop */ [NSApp run]; [sdlMain release]; [pool release]; } #endif /* * Catch document open requests...this lets us notice files when the app * was launched by double-clicking a document, or when a document was * dragged/dropped on the app's icon. You need to have a * CFBundleDocumentsType section in your Info.plist to get this message, * apparently. * * Files are added to gArgv, so to the app, they'll look like command line * arguments. Previously, apps launched from the finder had nothing but * an argv[0]. * * This message may be received multiple times to open several docs on launch. * * This message is ignored once the app's mainline has been called. */ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { const char *temparg; size_t arglen; char *arg; char **newargv; if (!gFinderLaunch) /* MacOS is passing command line args. */ return FALSE; if (gCalledAppMainline) /* app has started, ignore this document. */ return FALSE; temparg = [filename UTF8String]; arglen = SDL_strlen(temparg) + 1; arg = (char *) SDL_malloc(arglen); if (arg == NULL) return FALSE; newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); if (newargv == NULL) { SDL_free(arg); return FALSE; } gArgv = newargv; SDL_strlcpy(arg, temparg, arglen); gArgv[gArgc++] = arg; gArgv[gArgc] = NULL; return TRUE; } /* Called when the internal event loop has just started running */ - (void) applicationDidFinishLaunching: (NSNotification *) note { int status; /* Set the working directory to the .app's parent directory */ [self setupWorkingDirectory:gFinderLaunch]; #if SDL_USE_NIB_FILE /* Set the main menu to contain the real app name instead of "SDL App" */ [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; #endif /* Hand off to main application code */ gCalledAppMainline = TRUE; status = SDL_main (gArgc, gArgv); /* We're done, thank you for playing */ exit(status); } @end @implementation NSString (ReplaceSubString) - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString { unsigned int bufferSize; unsigned int selfLen = [self length]; unsigned int aStringLen = [aString length]; unichar *buffer; NSRange localRange; NSString *result; bufferSize = selfLen + aStringLen - aRange.length; buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); /* Get first part into buffer */ localRange.location = 0; localRange.length = aRange.location; [self getCharacters:buffer range:localRange]; /* Get middle part into buffer */ localRange.location = 0; localRange.length = aStringLen; [aString getCharacters:(buffer+aRange.location) range:localRange]; /* Get last part into buffer */ localRange.location = aRange.location + aRange.length; localRange.length = selfLen - localRange.location; [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; /* Build output string */ result = [NSString stringWithCharacters:buffer length:bufferSize]; NSDeallocateMemoryPages(buffer, bufferSize); return result; } @end #ifdef main # undef main #endif /* Main entry point to executable - should *not* be SDL_main! */ int main (int argc, char **argv) { /* Copy the arguments into a global variable */ /* This is passed if we are launched by double-clicking */ if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { gArgv = (char **) SDL_malloc(sizeof (char *) * 2); gArgv[0] = argv[0]; gArgv[1] = NULL; gArgc = 1; gFinderLaunch = YES; } else { int i; gArgc = argc; gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); for (i = 0; i <= argc; i++) gArgv[i] = argv[i]; gFinderLaunch = NO; } #if SDL_USE_NIB_FILE [SDLApplication poseAsClass:[NSApplication class]]; NSApplicationMain (argc, argv); #else CustomApplicationMain (argc, argv); #endif return 0; }
{ "pile_set_name": "Github" }
; RUN: llc < %s -march=ppc64 define i64 @__fixtfdi(ppc_fp128 %a) nounwind { entry: br i1 false, label %bb, label %bb8 bb: ; preds = %entry %tmp5 = fsub ppc_fp128 0xM80000000000000000000000000000000, %a ; <ppc_fp128> [#uses=1] %tmp6 = tail call i64 @__fixunstfdi( ppc_fp128 %tmp5 ) nounwind ; <i64> [#uses=0] ret i64 0 bb8: ; preds = %entry ret i64 0 } declare i64 @__fixunstfdi(ppc_fp128)
{ "pile_set_name": "Github" }
--- layout: post title: SpringMvc初始化HandlerAdapters(五) no-post-nav: true category: arch tags: [arch] description: springMvc初始化HandlerAdapters --- ## 从onRefresh入手 ```java protected void onRefresh(ApplicationContext context) { initStrategies(context); } ``` ```java protected void initStrategies(ApplicationContext context) { initMultipartResolver(context); initLocaleResolver(context); initThemeResolver(context); initHandlerMappings(context); initHandlerAdapters(context); initHandlerExceptionResolvers(context); initRequestToViewNameTranslator(context); initViewResolvers(context); initFlashMapManager(context); } ``` `initHandlerAdapters`在`initStrategies`方法中被调用。 ```java private void initHandlerAdapters(ApplicationContext context) { this.handlerAdapters = getDefaultStrategies(context, HandlerAdapter.class); } ``` 和`handlerMapping`的处理方式类似,都是从`DispatcherServlet.properties`文件中加载要处理的类型。 ```properties org.springframework.web.servlet.HandlerAdapter=org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,\ org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,\ org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter ``` 从配置文件中发现有三个adapter供给我们处理。 下面对每个类是否有`afterPropertiesSet`方法回调。 * HttpRequestHandlerAdapter 没有 * SimpleControllerHandlerAdapter 没有 * RequestMappingHandlerAdapter 有 所以只有`RequestMappingHandlerAdapter`回调了`afterPropertiesSet`方法。 ```java public void afterPropertiesSet() { // Do this first, it may add ResponseBody advice beans initControllerAdviceCache(); if (this.argumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultArgumentResolvers(); this.argumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.initBinderArgumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultInitBinderArgumentResolvers(); this.initBinderArgumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.returnValueHandlers == null) { List<HandlerMethodReturnValueHandler> handlers = getDefaultReturnValueHandlers(); this.returnValueHandlers = new HandlerMethodReturnValueHandlerComposite().addHandlers(handlers); } } ``` 这里只是填充了`argumentResolvers`、`initBinderArgumentResolvers`和`returnValueHandlers`,这些参数都是对参数和返回值的处理集合,后续文章会做详情介绍。
{ "pile_set_name": "Github" }
from picklable_itertools import iter_, chain from fuel.datasets import Dataset class TextFile(Dataset): r"""Reads text files and numberizes them given a dictionary. Parameters ---------- files : list of str The names of the files in order which they should be read. Each file is expected to have a sentence per line. dictionary : str or dict Either the path to a Pickled dictionary mapping tokens to integers, or the dictionary itself. At the very least this dictionary must map the unknown word-token to an integer. bos_token : str or None, optional The beginning-of-sentence (BOS) token in the dictionary that denotes the beginning of a sentence. Is ``<S>`` by default. If passed ``None`` no beginning of sentence markers will be added. eos_token : str or None, optional The end-of-sentence (EOS) token is ``</S>`` by default, see ``bos_taken``. unk_token : str, optional The token in the dictionary to fall back on when a token could not be found in the dictionary. level : 'word' or 'character', optional If 'word' the dictionary is expected to contain full words. The sentences in the text file will be split at the spaces, and each word replaced with its number as given by the dictionary, resulting in each example being a single list of numbers. If 'character' the dictionary is expected to contain single letters as keys. A single example will be a list of character numbers, starting with the first non-whitespace character and finishing with the last one. preprocess : function, optional A function which takes a sentence (string) as an input and returns a modified string. For example ``str.lower`` in order to lowercase the sentence before numberizing. Examples -------- >>> with open('sentences.txt', 'w') as f: ... _ = f.write("This is a sentence\n") ... _ = f.write("This another one") >>> dictionary = {'<UNK>': 0, '</S>': 1, 'this': 2, 'a': 3, 'one': 4} >>> def lower(s): ... return s.lower() >>> text_data = TextFile(files=['sentences.txt'], ... dictionary=dictionary, bos_token=None, ... preprocess=lower) >>> from fuel.streams import DataStream >>> for data in DataStream(text_data).get_epoch_iterator(): ... print(data) ([2, 0, 3, 0, 1],) ([2, 0, 4, 1],) .. doctest:: :hide: >>> import os >>> os.remove('sentences.txt') """ provides_sources = ('features',) example_iteration_scheme = None def __init__(self, files, dictionary, bos_token='<S>', eos_token='</S>', unk_token='<UNK>', level='word', preprocess=None): self.files = files self.dictionary = dictionary if bos_token is not None and bos_token not in dictionary: raise ValueError self.bos_token = bos_token if eos_token is not None and eos_token not in dictionary: raise ValueError self.eos_token = eos_token if unk_token not in dictionary: raise ValueError self.unk_token = unk_token if level not in ('word', 'character'): raise ValueError self.level = level self.preprocess = preprocess super(TextFile, self).__init__() def open(self): return chain(*[iter_(open(f)) for f in self.files]) def get_data(self, state=None, request=None): if request is not None: raise ValueError sentence = next(state) if self.preprocess is not None: sentence = self.preprocess(sentence) data = [self.dictionary[self.bos_token]] if self.bos_token else [] if self.level == 'word': data.extend(self.dictionary.get(word, self.dictionary[self.unk_token]) for word in sentence.split()) else: data.extend(self.dictionary.get(char, self.dictionary[self.unk_token]) for char in sentence.strip()) if self.eos_token: data.append(self.dictionary[self.eos_token]) return (data,)
{ "pile_set_name": "Github" }
package tech.tablesaw.plotly.api; import tech.tablesaw.api.Table; import tech.tablesaw.plotly.components.Figure; import tech.tablesaw.plotly.traces.BarTrace.Orientation; public class ParetoPlot extends BarPlot { public static Figure showHorizontal( String title, Table table, String groupColName, String numberColName) { return create( Orientation.HORIZONTAL, title, table.sortDescendingOn(numberColName), groupColName, numberColName); } public static Figure createVertical( String title, Table table, String groupColName, String numberColName) { return create( Orientation.VERTICAL, title, table.sortDescendingOn(numberColName), groupColName, numberColName); } public static Figure create( String title, Table table, String groupColName, String numberColName) { return createVertical( title, table.sortDescendingOn(numberColName), groupColName, numberColName); } }
{ "pile_set_name": "Github" }
/** * lodash 3.1.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var getNative = require('lodash._getnative'), isArguments = require('lodash.isarguments'), isArray = require('lodash.isarray'); /** Used to detect unsigned integer values. */ var reIsUint = /^\d+$/; /** Used for native method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /* Native method references for those with the same name as other `lodash` methods. */ var nativeKeys = getNative(Object, 'keys'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Checks if `value` is array-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. */ function isArrayLike(value) { return value != null && isLength(getLength(value)); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function shimKeys(object) { var props = keysIn(object), propsLength = props.length, length = propsLength && object.length; var allowIndexes = !!length && isLength(length) && (isArray(object) || isArguments(object)); var index = -1, result = []; while (++index < propsLength) { var key = props[index]; if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { result.push(key); } } return result; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { var Ctor = object == null ? undefined : object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; }; /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { if (object == null) { return []; } if (!isObject(object)) { object = Object(object); } var length = object.length; length = (length && isLength(length) && (isArray(object) || isArguments(object)) && length) || 0; var Ctor = object.constructor, index = -1, isProto = typeof Ctor == 'function' && Ctor.prototype === object, result = Array(length), skipIndexes = length > 0; while (++index < length) { result[index] = (index + ''); } for (var key in object) { if (!(skipIndexes && isIndex(key, length)) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } module.exports = keys;
{ "pile_set_name": "Github" }
// A static drawing of a Neural Network // Daniel Shiffman <http://www.shiffman.net> // Nature of Code class Neuron { // Neuron has a location PVector location; // Neuron has a list of connections ArrayList<Connection> connections; Neuron(float x, float y) { location = new PVector(x, y); connections = new ArrayList<Connection>(); } // Add a Connection void addConnection(Connection c) { connections.add(c); } // Draw Neuron as a circle void display() { stroke(0); strokeWeight(1); fill(0); ellipse(location.x, location.y, 16, 16); // Draw all its connections for (Connection c : connections) { c.display(); } } }
{ "pile_set_name": "Github" }
/* * Sonatype Nexus (TM) Open Source Version * Copyright (c) 2008-present Sonatype, Inc. * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. * * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. * * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the * Eclipse Foundation. All other trademarks are the property of their respective owners. */ /*global Ext, NX*/ /** * The foundation class for new drilldowns. Extend this. * * @since 3.0 */ Ext.define('NX.view.drilldown.Drilldown', { extend: 'Ext.container.Container', alias: 'widget.nx-drilldown', itemId: 'nx-drilldown', requires: [ 'NX.Icons' ], // List of masters to use (xtype objects) masters: null, // List of actions to use in the detail view nxActions: null, items: [], scrollable: 'vertical', layout: { type: 'vbox', align: 'stretch', pack: 'start' }, /** * @override */ initComponent: function() { var me = this; me.on('beforerender', me.loadDrilldown); me.callParent(); }, /** * @private * Initialize the items array of this component */ loadDrilldown: function(me) { var items = [], views; // Normalize the list of masters. Clone the list to avoid memory leaks. if (!me.masters) { views = []; } else if (!Ext.isArray(me.masters)) { views = [Ext.clone(me.masters)]; } else { views = Ext.Array.clone(me.masters); } if (!me.skipDetail) { if (me.detail) { // Use a custom detail panel views.push(me.detail); } else { // Use the default tab panel views.push( { xtype: 'nx-drilldown-details', header: false, plain: true, layout: { type: 'vbox', align: 'stretch', pack: 'start' }, tabs: Ext.clone(me.tabs), nxActions: Ext.isArray(me.nxActions) ? Ext.Array.clone(me.nxActions) : me.nxActions } ); } } // Stack all panels onto the items array for (var i = 0; i < views.length; ++i) { items.push(me.createDrilldownItem(i, views[i], undefined)); } // Add components to the container me.add({ xtype: 'container', itemId: 'drilldown-container', height: '100%', layout: { type: 'card', animate: true }, items: items }); }, /** * @private * Create a new drilldown item */ createDrilldownItem: function(index, browsePanel, createPanel) { return { xtype: 'nx-drilldown-item', itemClass: this.iconCls || NX.Icons.cls(this.iconName) + (index === 0 ? '-x32' : '-x16'), items: [ { xtype: 'container', layout: 'fit', itemId: 'browse' + index, items: browsePanel }, { xtype: 'container', layout: 'fit', itemId: 'create' + index, items: createPanel }, { type: 'container', layout: 'fit', itemId: 'nothin' + index } ] }; } });
{ "pile_set_name": "Github" }
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; import type {TurboModule} from '../../TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { +open: (options: Object) => Promise<Object>; } export default (TurboModuleRegistry.getEnforcing<Spec>( 'DatePickerAndroid', ): Spec);
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- // // This test includes Date.toString output. Don't use a baseline. // var echo = WScript.Echo; WScript.LoadScriptFile("adddata.js"); var x = WScript.LoadScriptFile("adddata.js", "samethread"); function addcross(a1, a2) { for (var i=0; i<a1.length; ++i) { for (var j=0; j<a2.length; ++j) { echo("a["+i+"](" + a1[i] +") + a["+j+"]("+a2[j]+") = " + (a1[i] + a2[j])); } } } echo("==== self var + crosscontext var ===="); addcross(this.all, x.all); echo(); echo("==== crosscontext var + self var ===="); addcross(x.all, this.all);
{ "pile_set_name": "Github" }
/* * 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. */ #ifndef __CUM_SUM_H #define __CUM_SUM_H #pragma once using uint = unsigned int; #include <cuda_runtime.h> /** * Do a cumulative summation over all columns of a matrix * @param g_idata input data stored in device memory (of size n) * @param g_odata output/temporary array stored in device memory (of size n) * @param g_tdata temporary accumulated block offsets * @param rows number of rows in input matrix * @param cols number of columns in input matrix * @param block_height number of rows processed per block */ /** * Cumulative sum instantiation for double */ extern "C" __global__ void cumulative_sum_up_sweep_d(double *g_idata, double* g_tdata, uint rows, uint cols, uint block_height) { SumOp<double> op; cumulative_scan_up_sweep<SumOp<double>, double>(g_idata, g_tdata, rows, cols, block_height, op); } /** * Cumulative sum instantiation for double */ extern "C" __global__ void cumulative_sum_up_sweep_f(float *g_idata, float* g_tdata, uint rows, uint cols, uint block_height) { SumOp<float> op; cumulative_scan_up_sweep<SumOp<float>, float>(g_idata, g_tdata, rows, cols, block_height, op); } /** * Cumulative sum instantiation for double */ extern "C" __global__ void cumulative_sum_down_sweep_d(double *g_idata, double *g_odata, double* g_tdata, uint rows, uint cols, uint block_height) { SumOp<double> op; cumulative_scan_down_sweep<SumOp<double>, SumNeutralElement<double>, double>(g_idata, g_odata, g_tdata, rows, cols, block_height, op); } /** * Cumulative sum instantiation for float */ extern "C" __global__ void cumulative_sum_down_sweep_f(float *g_idata, float *g_odata, float* g_tdata, uint rows, uint cols, uint block_height) { SumOp<float> op; cumulative_scan_down_sweep<SumOp<float>, SumNeutralElement<float>, float>(g_idata, g_odata, g_tdata, rows, cols, block_height, op); } #endif // __CUM_SUM_H
{ "pile_set_name": "Github" }
// // ____ _ __ _ _____ // / ___\ /_\ /\/\ /\ /\ /__\ /_\ \_ \ // \ \ //_\\ / \ / / \ \ / \// //_\\ / /\/ // /\_\ \ / _ \ / /\/\ \ \ \_/ / / _ \ / _ \ /\/ /_ // \____/ \_/ \_/ \/ \/ \___/ \/ \_/ \_/ \_/ \____/ // // Copyright Samurai development team and other contributors // // http://www.samurai-framework.com // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "Samurai.h" #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) #import "Samurai_CSSNumber.h" #pragma mark - #undef cssPx #define cssPx( n ) [SamuraiCSSNumberPx px:n] #pragma mark - @interface SamuraiCSSObject(NumberPx) - (BOOL)isPx; @end #pragma mark - @interface SamuraiCSSNumberPx : SamuraiCSSNumber + (instancetype)px:(CGFloat)value; @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
{ "pile_set_name": "Github" }
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ZIPFILE_ZIPFILE_H #define _ZIPFILE_ZIPFILE_H #include <stddef.h> #ifdef __cplusplus extern "C" { #endif typedef void* zipfile_t; typedef void* zipentry_t; // Provide a buffer. Returns NULL on failure. zipfile_t init_zipfile(const void* data, size_t size); // Release the zipfile resources. void release_zipfile(zipfile_t file); // Get a named entry object. Returns NULL if it doesn't exist // or if we won't be able to decompress it. The zipentry_t is // freed by release_zipfile() zipentry_t lookup_zipentry(zipfile_t file, const char* entryName); // Return the size of the entry. size_t get_zipentry_size(zipentry_t entry); // return the filename of this entry, you own the memory returned char* get_zipentry_name(zipentry_t entry); // The buffer must be 1.001 times the buffer size returned // by get_zipentry_size. Returns nonzero on failure. int decompress_zipentry(zipentry_t entry, void* buf, int bufsize); // iterate through the entries in the zip file. pass a pointer to // a void* initialized to NULL to start. Returns NULL when done zipentry_t iterate_zipfile(zipfile_t file, void** cookie); #ifdef __cplusplus } // extern "C" #endif #endif // _ZIPFILE_ZIPFILE_H
{ "pile_set_name": "Github" }
--TEST-- Bug #60455: stream_get_line and 1-line with maxlen size followed by 0-length read with EOL indication --FILE-- <?php class TestStream { private $s = 0; function stream_open($path, $mode, $options, &$opened_path) { return true; } function stream_read($count) { if ($this->s++ == 0) return "a\n"; return ""; } function stream_eof() { return $this->s >= 2; } } stream_wrapper_register("test", "TestStream"); $f = fopen("test://", "r"); while (!feof($f)) { $line = stream_get_line($f, 2, "\n"); var_dump($line); } --EXPECT-- string(1) "a" bool(false)
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US"> <!-- Generated with https://github.com/citation-style-language/utilities/tree/master/generate_dependent_styles/data/apa --> <info> <title>Journal of Individual Differences</title> <id>http://www.zotero.org/styles/journal-of-individual-differences</id> <link href="http://www.zotero.org/styles/journal-of-individual-differences" rel="self"/> <link href="http://www.zotero.org/styles/apa" rel="independent-parent"/> <link href="http://content.apa.org/journals/jid" rel="documentation"/> <category citation-format="author-date"/> <category field="psychology"/> <issn>1614-0001</issn> <eissn>2151-2299</eissn> <updated>2014-06-10T12:00:00+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> </style>
{ "pile_set_name": "Github" }
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.samplealloymvc.service.persistence; import aQute.bnd.annotation.ProviderType; import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil; import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.service.ServiceContext; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.ReferenceRegistry; import com.liferay.samplealloymvc.model.SAMTodoItem; import java.util.List; /** * The persistence utility for the s a m todo item service. This utility wraps {@link com.liferay.samplealloymvc.service.persistence.impl.SAMTodoItemPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class. * * <p> * Caching information and settings can be found in <code>portal.properties</code> * </p> * * @author Brian Wing Shun Chan * @see SAMTodoItemPersistence * @see com.liferay.samplealloymvc.service.persistence.impl.SAMTodoItemPersistenceImpl * @generated */ @ProviderType public class SAMTodoItemUtil { /* * NOTE FOR DEVELOPERS: * * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. */ /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#clearCache() */ public static void clearCache() { getPersistence().clearCache(); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#clearCache(com.liferay.portal.kernel.model.BaseModel) */ public static void clearCache(SAMTodoItem samTodoItem) { getPersistence().clearCache(samTodoItem); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) */ public static long countWithDynamicQuery(DynamicQuery dynamicQuery) { return getPersistence().countWithDynamicQuery(dynamicQuery); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) */ public static List<SAMTodoItem> findWithDynamicQuery( DynamicQuery dynamicQuery) { return getPersistence().findWithDynamicQuery(dynamicQuery); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) */ public static List<SAMTodoItem> findWithDynamicQuery( DynamicQuery dynamicQuery, int start, int end) { return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) */ public static List<SAMTodoItem> findWithDynamicQuery( DynamicQuery dynamicQuery, int start, int end, OrderByComparator<SAMTodoItem> orderByComparator) { return getPersistence() .findWithDynamicQuery(dynamicQuery, start, end, orderByComparator); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#update(com.liferay.portal.kernel.model.BaseModel) */ public static SAMTodoItem update(SAMTodoItem samTodoItem) { return getPersistence().update(samTodoItem); } /** * @see com.liferay.portal.kernel.service.persistence.BasePersistence#update(com.liferay.portal.kernel.model.BaseModel, ServiceContext) */ public static SAMTodoItem update(SAMTodoItem samTodoItem, ServiceContext serviceContext) { return getPersistence().update(samTodoItem, serviceContext); } /** * Caches the s a m todo item in the entity cache if it is enabled. * * @param samTodoItem the s a m todo item */ public static void cacheResult(SAMTodoItem samTodoItem) { getPersistence().cacheResult(samTodoItem); } /** * Caches the s a m todo items in the entity cache if it is enabled. * * @param samTodoItems the s a m todo items */ public static void cacheResult(List<SAMTodoItem> samTodoItems) { getPersistence().cacheResult(samTodoItems); } /** * Creates a new s a m todo item with the primary key. Does not add the s a m todo item to the database. * * @param samTodoItemId the primary key for the new s a m todo item * @return the new s a m todo item */ public static SAMTodoItem create(long samTodoItemId) { return getPersistence().create(samTodoItemId); } /** * Removes the s a m todo item with the primary key from the database. Also notifies the appropriate model listeners. * * @param samTodoItemId the primary key of the s a m todo item * @return the s a m todo item that was removed * @throws NoSuchTodoItemException if a s a m todo item with the primary key could not be found */ public static SAMTodoItem remove(long samTodoItemId) throws com.liferay.samplealloymvc.exception.NoSuchTodoItemException { return getPersistence().remove(samTodoItemId); } public static SAMTodoItem updateImpl(SAMTodoItem samTodoItem) { return getPersistence().updateImpl(samTodoItem); } /** * Returns the s a m todo item with the primary key or throws a {@link NoSuchTodoItemException} if it could not be found. * * @param samTodoItemId the primary key of the s a m todo item * @return the s a m todo item * @throws NoSuchTodoItemException if a s a m todo item with the primary key could not be found */ public static SAMTodoItem findByPrimaryKey(long samTodoItemId) throws com.liferay.samplealloymvc.exception.NoSuchTodoItemException { return getPersistence().findByPrimaryKey(samTodoItemId); } /** * Returns the s a m todo item with the primary key or returns <code>null</code> if it could not be found. * * @param samTodoItemId the primary key of the s a m todo item * @return the s a m todo item, or <code>null</code> if a s a m todo item with the primary key could not be found */ public static SAMTodoItem fetchByPrimaryKey(long samTodoItemId) { return getPersistence().fetchByPrimaryKey(samTodoItemId); } public static java.util.Map<java.io.Serializable, SAMTodoItem> fetchByPrimaryKeys( java.util.Set<java.io.Serializable> primaryKeys) { return getPersistence().fetchByPrimaryKeys(primaryKeys); } /** * Returns all the s a m todo items. * * @return the s a m todo items */ public static List<SAMTodoItem> findAll() { return getPersistence().findAll(); } /** * Returns a range of all the s a m todo items. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link SAMTodoItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of s a m todo items * @param end the upper bound of the range of s a m todo items (not inclusive) * @return the range of s a m todo items */ public static List<SAMTodoItem> findAll(int start, int end) { return getPersistence().findAll(start, end); } /** * Returns an ordered range of all the s a m todo items. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link SAMTodoItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of s a m todo items * @param end the upper bound of the range of s a m todo items (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of s a m todo items */ public static List<SAMTodoItem> findAll(int start, int end, OrderByComparator<SAMTodoItem> orderByComparator) { return getPersistence().findAll(start, end, orderByComparator); } /** * Returns an ordered range of all the s a m todo items. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link SAMTodoItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of s a m todo items * @param end the upper bound of the range of s a m todo items (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of s a m todo items */ public static List<SAMTodoItem> findAll(int start, int end, OrderByComparator<SAMTodoItem> orderByComparator, boolean retrieveFromCache) { return getPersistence() .findAll(start, end, orderByComparator, retrieveFromCache); } /** * Removes all the s a m todo items from the database. */ public static void removeAll() { getPersistence().removeAll(); } /** * Returns the number of s a m todo items. * * @return the number of s a m todo items */ public static int countAll() { return getPersistence().countAll(); } public static SAMTodoItemPersistence getPersistence() { if (_persistence == null) { _persistence = (SAMTodoItemPersistence)PortletBeanLocatorUtil.locate(com.liferay.samplealloymvc.service.ClpSerializer.getServletContextName(), SAMTodoItemPersistence.class.getName()); ReferenceRegistry.registerReference(SAMTodoItemUtil.class, "_persistence"); } return _persistence; } private static SAMTodoItemPersistence _persistence; }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ package sun.jvm.hotspot.debugger; /** This class implements an LRU page-level cache of configurable page size and number of pages. It is configured with a PageFetcher which enables it to transparently satisfy requests which span multiple pages when one or more of those pages is not in the cache. It is generic enough to be sharable among debugger implementations. */ import sun.jvm.hotspot.utilities.*; public class PageCache { /** The pageSize must be a power of two and implicitly specifies the alignment of pages. numPages specifies how many pages should be cached. */ public PageCache(long pageSize, long maxNumPages, PageFetcher fetcher) { checkPageInfo(pageSize, maxNumPages); this.pageSize = pageSize; this.maxNumPages = maxNumPages; this.fetcher = fetcher; addressToPageMap = new LongHashMap(); enabled = true; } /** This handles fetches which span multiple pages by virtue of the presence of the PageFetcher. Throws UnmappedAddressException if a page on which data was requested was unmapped. This can not really handle numBytes > 32 bits. */ public synchronized byte[] getData(long startAddress, long numBytes) throws UnmappedAddressException { byte[] data = new byte[(int) numBytes]; long numRead = 0; while (numBytes > 0) { long pageBaseAddress = startAddress & pageMask; // Look up this page Page page = checkPage(getPage(pageBaseAddress), startAddress); // Figure out how many bytes to read from this page long pageOffset = startAddress - pageBaseAddress; long numBytesFromPage = Math.min(pageSize - pageOffset, numBytes); // Read them starting at the appropriate offset in the // destination buffer page.getDataAsBytes(startAddress, numBytesFromPage, data, numRead); // Increment offsets numRead += numBytesFromPage; numBytes -= numBytesFromPage; startAddress += numBytesFromPage; } return data; } public synchronized boolean getBoolean(long address) { return (getByte(address) != 0); } public synchronized byte getByte(long address) { return checkPage(getPage(address & pageMask), address).getByte(address); } public synchronized short getShort(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getShort(address, bigEndian); } public synchronized char getChar(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getChar(address, bigEndian); } public synchronized int getInt(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getInt(address, bigEndian); } public synchronized long getLong(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getLong(address, bigEndian); } public synchronized float getFloat(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getFloat(address, bigEndian); } public synchronized double getDouble(long address, boolean bigEndian) { return checkPage(getPage(address & pageMask), address).getDouble(address, bigEndian); } /** A mechanism for clearing cached data covering the given region */ public synchronized void clear(long startAddress, long numBytes) { long pageBaseAddress = startAddress & pageMask; long endAddress = startAddress + numBytes; while (pageBaseAddress < endAddress) { flushPage(pageBaseAddress); pageBaseAddress += pageSize; } } /** A mechanism for clearing out the cache is necessary to handle detaching and reattaching */ public synchronized void clear() { // Should probably break next/prev links in list as well addressToPageMap.clear(); lruList = null; numPages = 0; } /** Disables the page cache; no further pages will be added to the cache and all existing pages will be flushed. Call this when the target process has been resumed. */ public synchronized void disable() { enabled = false; clear(); } /** Enables the page cache; fetched pages will be added to the cache. Call this when the target process has been suspended. */ public synchronized void enable() { enabled = true; } //-------------------------------------------------------------------------------- // Internals only below this point // // This is implemented with two data structures: a hash table for // fast lookup by a page's base address and a circular doubly-linked // list for implementing LRU behavior. private boolean enabled; private long pageSize; private long maxNumPages; private long pageMask; private long numPages; private PageFetcher fetcher; private LongHashMap addressToPageMap; // Map<long, Page> private Page lruList; // Most recently fetched page, or null /** Page fetcher plus LRU functionality */ private Page getPage(long pageBaseAddress) { // Check head of LRU list first to avoid hash table lookup and // extra list work if possible if (lruList != null) { if (lruList.getBaseAddress() == pageBaseAddress) { // Hit. Return it. return lruList; } } // Long key = new Long(pageBaseAddress); long key = pageBaseAddress; Page page = (Page) addressToPageMap.get(key); if (page == null) { // System.err.println("** Cache miss at address 0x" + Long.toHexString(pageBaseAddress) + " **"); // Fetch new page page = fetcher.fetchPage(pageBaseAddress, pageSize); if (enabled) { // Add to cache, evicting last element if necessary addressToPageMap.put(key, page); if (Assert.ASSERTS_ENABLED) { Assert.that(page == (Page) addressToPageMap.get(pageBaseAddress), "must have found page in cache!"); } addPageToList(page); // See whether eviction of oldest is necessary if (numPages == maxNumPages) { Page evictedPage = lruList.getPrev(); // System.err.println("-> Evicting page at 0x" + Long.toHexString(evictedPage.getBaseAddress()) + // "; " + countPages() + " pages left (expect " + numPages + ")"); removePageFromList(evictedPage); addressToPageMap.remove(evictedPage.getBaseAddress()); } else { ++numPages; } } } else { // Page already in cache, move to front of list removePageFromList(page); addPageToList(page); } return page; } private Page checkPage(Page page, long startAddress) { if (!page.isMapped()) { throw new UnmappedAddressException(startAddress); } return page; } private int countPages() { Page page = lruList; int num = 0; if (page == null) { return num; } do { ++num; page = page.getNext(); } while (page != lruList); return num; } private void flushPage(long pageBaseAddress) { long key = pageBaseAddress; Page page = (Page) addressToPageMap.remove(key); if (page != null) { removePageFromList(page); } } // Adds given page to head of list private void addPageToList(Page page) { if (lruList == null) { lruList = page; page.setNext(page); page.setPrev(page); } else { // Add to front of list page.setNext(lruList); page.setPrev(lruList.getPrev()); lruList.getPrev().setNext(page); lruList.setPrev(page); lruList = page; } } // Removes given page from list private void removePageFromList(Page page) { if (page.getNext() == page) { lruList = null; } else { if (lruList == page) { lruList = page.getNext(); } page.getPrev().setNext(page.getNext()); page.getNext().setPrev(page.getPrev()); } page.setPrev(null); page.setNext(null); } /** Ensure that page size fits within 32 bits and is a power of two, and that maxNumPages > 0 */ private void checkPageInfo(long pageSize, long maxNumPages) { if ((pageSize <= 0) || maxNumPages <= 0) { throw new IllegalArgumentException("pageSize and maxNumPages must both be greater than zero"); } long tmpPageSize = pageSize >>> 32; if (tmpPageSize != 0) { throw new IllegalArgumentException("pageSize " + pageSize + " too big (must fit within 32 bits)"); } int numNonZeroBits = 0; for (int i = 0; i < 32; ++i) { if ((pageSize & 1L) != 0) { ++numNonZeroBits; if ((numNonZeroBits > 1) || (i == 0)) { throw new IllegalArgumentException("pageSize " + pageSize + " must be a power of two"); } } pageSize >>>= 1; if (numNonZeroBits == 0) { pageMask = (pageMask << 1) | 1L; } } pageMask = ~pageMask; } }
{ "pile_set_name": "Github" }
module Weibo class OAuth extend Forwardable def_delegators :access_token, :get, :post, :put, :delete attr_reader :ctoken, :csecret, :consumer_options def initialize(ctoken, csecret, options={}) @ctoken, @csecret, @consumer_options = ctoken, csecret, options if options[:sign_in] @consumer_options[:authorize_path] = '/oauth/authorize' end end def consumer @consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => 'http://api.t.sina.com.cn'}.merge(consumer_options)) end def set_callback_url(url) clear_request_token request_token(:oauth_callback => url) end # Note: If using oauth with a web app, be sure to provide :oauth_callback. # Options: # :oauth_callback => String, url that twitter should redirect to def request_token(options={}) @request_token ||= consumer.get_request_token(options) end # For web apps use params[:oauth_verifier], for desktop apps, # use the verifier is the pin that twitter gives users. def authorize_from_request(rtoken, rsecret, verifier_or_pin) request_token = ::OAuth::RequestToken.new(consumer, rtoken, rsecret) access_token = request_token.get_access_token(:oauth_verifier => verifier_or_pin) @atoken, @asecret = access_token.token, access_token.secret end def access_token @access_token ||= ::OAuth::AccessToken.new(consumer, @atoken, @asecret) end def authorize_from_access(atoken, asecret) @atoken, @asecret = atoken, asecret end private def clear_request_token @request_token = nil end end end
{ "pile_set_name": "Github" }
#include "ylog.h" #include "command.h" #include "protocol.h" #include "database.h" /* Process a START command. */ yerr_t command_start(tcp_thread_t *thread, ybool_t sync, ybool_t compress, ybool_t serialized, ydynabin_t *buff) { YLOG_ADD(YLOG_DEBUG, "START command"); // rollback previous transaction if (thread->transaction != NULL) database_transaction_rollback(thread->transaction); // open transaction thread->transaction = database_transaction_start(thread->finedb->database, YTRUE); if (thread->transaction == NULL) goto error; CONNECTION_SEND_OK(thread); return (YENOERR); error: YLOG_ADD(YLOG_WARN, "START error"); CONNECTION_SEND_ERROR(thread, RESP_ERR_TRANSACTION); return (YEACCESS); } /* Process a STOP command. */ yerr_t command_stop(tcp_thread_t *thread, ybool_t sync, ybool_t compress, ybool_t serialized, ydynabin_t *buff) { YLOG_ADD(YLOG_DEBUG, "STOP command"); // check running transaction if (thread->transaction == NULL) goto error; // rollback transaction database_transaction_rollback(thread->transaction); thread->transaction = NULL; CONNECTION_SEND_OK(thread); return (YENOERR); error: YLOG_ADD(YLOG_WARN, "STOP error"); CONNECTION_SEND_ERROR(thread, RESP_ERR_TRANSACTION); return (YEACCESS); }
{ "pile_set_name": "Github" }
## 1. Create universe If you have a previously running local universe, destroy it using the following. ```sh $ kubectl delete -f yugabyte-statefulset.yaml ``` Start a new local cluster - by default, this will create a 3 node universe with a replication factor of 3. ```sh $ kubectl apply -f yugabyte-statefulset.yaml ``` Check the Kubernetes dashboard to see the 3 yb-tserver and 3 yb-master pods representing the 3 nodes of the cluster. ```sh $ minikube dashboard ``` ![Kubernetes Dashboard](/images/ce/kubernetes-dashboard.png) ## 2. Check cluster status with Admin UI In order to do this, we would need to access the UI on port 7000 exposed by any of the pods in the `yb-master` service (one of `yb-master-0`, `yb-master-1` or `yb-master-2`). In order to do so, we find the URL for the yb-master-ui LoadBalancer service. ```sh $ minikube service yb-master-ui --url ``` ``` http://192.168.99.100:31283 ``` Now, you can view the [yb-master-0 Admin UI](../../admin/yb-master/#admin-ui) is available at the above URL. ## 3. Add node and observe linear scale out Add a node to the universe. ```sh $ kubectl scale statefulset yb-tserver --replicas=4 ``` Now we should have 4 nodes. Refresh the <a href='http://localhost:7000/tablet-servers' target="_blank">tablet-servers</a> page to see the stats update. YugabyteDB automatically updates application clients to use the newly added node for serving queries. This scaling out of client queries is completely transparent to the application logic, allowing the application to scale linearly for both reads and writes. You can also observe the newly added node using the following command. ```sh $ kubectl get pods ``` ``` NAME READY STATUS RESTARTS AGE yb-master-0 1/1 Running 0 5m yb-master-1 1/1 Running 0 5m yb-master-2 1/1 Running 0 5m yb-tserver-0 1/1 Running 1 5m yb-tserver-1 1/1 Running 1 5m yb-tserver-2 1/1 Running 0 5m yb-tserver-3 1/1 Running 0 4m ``` ## 4. Scale back down to 3 nodes The cluster can now be scaled back to only 3 nodes. ```sh $ kubectl scale statefulset yb-tserver --replicas=3 ``` ```sh $ kubectl get pods ``` ``` NAME READY STATUS RESTARTS AGE yb-master-0 1/1 Running 0 6m yb-master-1 1/1 Running 0 6m yb-master-2 1/1 Running 0 6m yb-tserver-0 1/1 Running 1 6m yb-tserver-1 1/1 Running 1 6m yb-tserver-2 1/1 Running 0 6m yb-tserver-3 1/1 Terminating 0 5m ``` ## 5. Clean up (optional) Optionally, you can shutdown the local cluster created in Step 1. ```sh $ kubectl delete -f yugabyte-statefulset.yaml ``` Further, to destroy the persistent volume claims (**you will lose all the data if you do this**), run: ```sh kubectl delete pvc -l app=yb-master kubectl delete pvc -l app=yb-tserver ```
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: f76ef802b8b940c46a31f9027f2b0158 timeCreated: 1484172732 licenseType: Store NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// https://github.com/shelljs/shelljs require('shelljs/global') env.NODE_ENV = 'production' var package = require('../package'); var path = require('path') var config = require('../config') var ora = require('ora') var webpack = require('webpack') var webpackConfig = require('./webpack.doc.conf') console.log( ' Tip:\n' + ' Built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' ) var spinner = ora('building for production...') spinner.start() var assetsPath = path.join(config.doc.assetsRoot, config.doc.assetsSubDirectory) rm('-rf', assetsPath) mkdir('-p', assetsPath) cp('-R', 'static/*', assetsPath) touch(config.doc.assetsRoot + '/.nojekyll') webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') })
{ "pile_set_name": "Github" }
using System; namespace TrackableEntities.TemplateWizard { internal static class Constants { public static class ProjectTemplates { public const string TrackableWebApi = "TrackableWebApi"; public const string TrackableWcfService = "TrackableWcfService"; } public static class ReadMeFiles { public const string TrackableWcf= "TrackableWcf.ReadMe.txt"; public const string TrackableWebApi = "TrackableWebApi.ReadMe.txt"; } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ #pragma once #include <folly/io/async/AsyncSocketException.h> #include <quic/client/handshake/ClientHandshake.h> #include <quic/client/handshake/ClientHandshakeFactory.h> #include <quic/congestion_control/QuicCubic.h> #include <quic/flowcontrol/QuicFlowController.h> #include <quic/handshake/TransportParameters.h> #include <quic/state/QuicStateFunctions.h> #include <quic/state/StateData.h> namespace quic { struct CachedServerTransportParameters; struct QuicClientConnectionState : public QuicConnectionStateBase { ~QuicClientConnectionState() override = default; // The stateless reset token sent by the server. folly::Optional<StatelessResetToken> statelessResetToken; // The retry token sent by the server. std::string retryToken; // Initial destination connection id. folly::Optional<ConnectionId> initialDestinationConnectionId; std::shared_ptr<ClientHandshakeFactory> handshakeFactory; ClientHandshake* clientHandshakeLayer; folly::Optional<TimePoint> lastCloseSentTime; // Save the server transport params here so that client can access the value // when it wants to write the values to psk cache // TODO Save TicketTransportParams here instead of in QuicClientTransport bool serverInitialParamsSet_{false}; uint64_t peerAdvertisedInitialMaxData{0}; uint64_t peerAdvertisedInitialMaxStreamDataBidiLocal{0}; uint64_t peerAdvertisedInitialMaxStreamDataBidiRemote{0}; uint64_t peerAdvertisedInitialMaxStreamDataUni{0}; uint64_t peerAdvertisedInitialMaxStreamsBidi{0}; uint64_t peerAdvertisedInitialMaxStreamsUni{0}; // Packet number in which client initial was sent. Receipt of data on the // crypto stream from the server can implicitly ack the client initial packet. // TODO: use this to get rid of the data in the crypto stream. // folly::Optional<PacketNum> clientInitialPacketNum; explicit QuicClientConnectionState( std::shared_ptr<ClientHandshakeFactory> handshakeFactoryIn) : QuicConnectionStateBase(QuicNodeType::Client), handshakeFactory(std::move(handshakeFactoryIn)) { cryptoState = std::make_unique<QuicCryptoState>(); congestionController = std::make_unique<Cubic>(*this); // TODO: this is wrong, it should be the handshake finish time. But i need // a relatively sane time now to make the timestamps all sane. connectionTime = Clock::now(); originalVersion = QuicVersion::MVFST; DCHECK(handshakeFactory); auto tmpClientHandshake = handshakeFactory->makeClientHandshake(this); clientHandshakeLayer = tmpClientHandshake.get(); handshakeLayer = std::move(tmpClientHandshake); // We shouldn't normally need to set this until we're starting the // transport, however writing unit tests is much easier if we set this here. updateFlowControlStateWithSettings(flowControlState, transportSettings); streamManager = std::make_unique<QuicStreamManager>( *this, this->nodeType, transportSettings); transportSettings.selfActiveConnectionIdLimit = kDefaultActiveConnectionIdLimit; } }; /** * Undos the clients state to be the original state of the client. */ std::unique_ptr<QuicClientConnectionState> undoAllClientStateForRetry( std::unique_ptr<QuicClientConnectionState> conn); void processServerInitialParams( QuicClientConnectionState& conn, ServerTransportParameters serverParams, PacketNum packetNum); void cacheServerInitialParams( QuicClientConnectionState& conn, uint64_t peerAdvertisedInitialMaxData, uint64_t peerAdvertisedInitialMaxStreamDataBidiLocal, uint64_t peerAdvertisedInitialMaxStreamDataBidiRemote, uint64_t peerAdvertisedInitialMaxStreamDataUni, uint64_t peerAdvertisedInitialMaxStreamsBidi, uint64_t peerAdvertisedInitialMaxStreamUni); CachedServerTransportParameters getServerCachedTransportParameters( const QuicClientConnectionState& conn); void updateTransportParamsFromCachedEarlyParams( QuicClientConnectionState& conn, const CachedServerTransportParameters& transportParams); } // namespace quic
{ "pile_set_name": "Github" }
var chai = require('chai'); var sinon = require('sinon'); var sinonChai = require('sinon-chai'); var should = chai.should(); chai.use(sinonChai); require('jsdom-global')(); var $ = require('jquery'); require('../../src/js/jquery.orgchart'); describe('orgchart -- integration tests', function () { document.body.innerHTML = '<div id="chart-container"></div>'; var $container = $('#chart-container'), ds = { 'id': 'n1', 'name': 'Lao Lao', 'children': [ { 'id': 'n2', 'name': 'Bo Miao' }, { 'id': 'n3', 'name': 'Su Miao' } ] }, fragment = '<div class="orgchart"><table><tr><td colspan="4"><div id="n1" class="node">' + '<div class="title"><i class="oci oci-leader symbol"></i>Lao Lao</div><i class="edge verticalEdge bottomEdge oci"></i></div>' + '</td></tr><tr class="lines"><td colspan="4"><div class="downLine"></div></td></tr>' + '<tr class="lines"><td class="rightLine"></td><td class="leftLine topLine"></td>' + '<td class="rightLine topLine"></td><td class="leftLine"></td></tr><tr class="nodes"><td colspan="2"><table><tr><td>' + '<div id="n2" data-parent="n1" class="node"><div class="title">Bo Miao</div><i class="edge verticalEdge topEdge oci"></i>' + '<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i></div></td></tr></table></td>' + '<td colspan="2"><table><tr><td><div id="n3" data-parent="n1" class="node"><div class="title">Su Miao</div>' + '<i class="edge verticalEdge topEdge oci"></i><i class="edge horizontalEdge rightEdge oci"></i>' + '<i class="edge horizontalEdge leftEdge oci"></i></div></td></tr></table></td></tr></table></div>', oc = {}; afterEach(function () { $container.empty(); }); describe('init()', function () { it('initialize chart with json datasource', function () { oc = $container.orgchart({ 'data': ds }); $container.html().should.equal(fragment); }); it('initialize chart with <ul> datasource', function () { var $ul = $( '<ul id="ul-data">' + '<li data-id="n1">Lao Lao' + '<ul>' + '<li data-id="n2">Bo Miao</li>' + '<li data-id="n3">Su Miao</li>' + '</ul>' + '</li>' + '</ul>' ); $('body').append($ul); oc = $container.orgchart({ 'data': $('#ul-data') }); $container.html().should.equal(fragment); $ul.remove(); }); it('initialize chart with the given visible level', function () { oc = $container.orgchart({ 'data': ds, 'visibleLevel': 1 }); oc.$chart.find('tr').eq(0).is('.hidden').should.be.false; oc.$chart.find('tr').eq(1).is('.hidden').should.be.true; oc.$chart.find('tr').eq(2).is('.hidden').should.be.true; oc.$chart.find('tr').eq(3).is('.hidden').should.be.true; }); it('initialize chart with the given vertical level', function () { var fragment = '<tr class="verticalNodes">' + '<td>' + '<ul>' + '<li><div id="n2" data-parent="n1" class="node"><div class="title">Bo Miao</div></div></li>' + '<li><div id="n3" data-parent="n1" class="node"><div class="title">Su Miao</div></div></li>' + '</ul>'+ '</td>'+ '</tr>'; oc = $container.orgchart({ 'data': ds, 'verticalLevel': 2 }); oc.$chart.find('tr').eq(1).prop('outerHTML').should.equal(fragment); }); context('initialize chart with various combinations of "visibleLevel" and "verticalLevel" ', function () { var ds = { 'name': 'Lao Lao', 'children': [ { 'name': 'Bo Miao' }, { 'name': 'Su Miao', 'children': [ { 'name': 'Tie Hua' }, { 'name': 'Hei Hei' } ] } ] }; it('verticalLevel=2 and visibleLevel=1', function () { var fragment = '<div class="orgchart"><table><tr><td colspan="4"><div class="node"><div class="title"><i class="oci oci-leader symbol"></i>Lao Lao</div>' + '<i class="edge verticalEdge bottomEdge oci"></i></div></td></tr><tr class="verticalNodes hidden"><td><ul><li><div class="node slide-up">' + '<div class="title">Bo Miao</div></div></li><li><div class="node slide-up"><div class="title">Su Miao</div>' + '<i class="toggleBtn oci oci-plus-square"></i></div><ul class="hidden"><li><div class="node slide-up"><div class="title">Tie Hua</div></div></li>' + '<li><div class="node slide-up"><div class="title">Hei Hei</div></div></li></ul></li></ul></td></tr></table></div>'; oc = $container.orgchart({ 'data': ds, 'verticalLevel': 2, 'visibleLevel': 1 }); $container.html().should.equal(fragment); }); it('verticalLevel=2 and visibleLevel=2', function () { var fragment = '<div class="orgchart"><table><tr><td colspan="4"><div class="node"><div class="title"><i class="oci oci-leader symbol"></i>Lao Lao</div>' + '<i class="edge verticalEdge bottomEdge oci"></i></div></td></tr><tr class="verticalNodes"><td><ul><li><div class="node">' + '<div class="title">Bo Miao</div></div></li><li><div class="node"><div class="title">Su Miao</div><i class="toggleBtn oci oci-plus-square"></i></div>' + '<ul class="hidden"><li><div class="node slide-up"><div class="title">Tie Hua</div></div></li><li><div class="node slide-up">' + '<div class="title">Hei Hei</div></div></li></ul></li></ul></td></tr></table></div>'; oc = $container.orgchart({ 'data': ds, 'verticalLevel': 2, 'visibleLevel': 2 }); $container.html().should.equal(fragment); }); it('verticalLevel=2 and visibleLevel=3', function () { var fragment = '<div class="orgchart"><table><tr><td colspan="4"><div class="node"><div class="title"><i class="oci oci-leader symbol"></i>Lao Lao</div>' + '<i class="edge verticalEdge bottomEdge oci"></i></div></td></tr><tr class="verticalNodes"><td><ul><li><div class="node">' + '<div class="title">Bo Miao</div></div></li><li><div class="node"><div class="title">Su Miao</div><i class="toggleBtn oci oci-minus-square"></i></div>' + '<ul><li><div class="node"><div class="title">Tie Hua</div></div></li><li><div class="node"><div class="title">Hei Hei</div></div>' + '</li></ul></li></ul></td></tr></table></div>'; oc = $container.orgchart({ 'data': ds, 'verticalLevel': 2, 'visibleLevel': 3 }); $container.html().should.equal(fragment); }); }); it('initCompleted should be invoked immediately after construting one node', function () { var spy = sinon.spy(); oc = $container.orgchart({ 'data': ds, 'createNode': spy }); spy.should.have.been.callCount(3); spy.should.have.been.calledWithMatch($('#n1'),{ 'id': 'n1', 'name': 'Lao Lao' }); spy.should.have.been.calledWithMatch($('#n2'),{ 'id': 'n2', 'name': 'Bo Miao' }); spy.should.have.been.calledWithMatch($('#n3'),{ 'id': 'n3', 'name': 'Su Miao' }); // spy.should.always.have.been.calledOn(oc); }); it('initialize chart with default className', function () { oc = $container.orgchart({ 'data': ds, 'chartClass': 'demo' }); oc.$chart.is('.demo').should.be.true; }); it('initialize chart with export button', function () { oc = $container.orgchart({ 'data': ds, 'exportButton': true }); $container.children('button').prop('outerHTML').should.equal('<button class="oc-export-btn">Export</button>'); }); it('initialize chart with "bottom to top" direction', function () { oc = $container.orgchart({ 'data': ds, 'direction': 'b2t' }); oc.$chart.is('.b2t').should.be.true; }); it('reinitialize chart with drggable feature', function () { oc = $container.orgchart({ 'data': ds }); var spy = sinon.spy(oc, 'bindDragDrop'); oc.init({ 'draggable': true }); spy.should.have.been.callCount(3); spy.should.have.been.calledWith($('#n1')); spy.should.have.been.calledWithMatch($('#n2')); spy.should.have.been.calledWithMatch($('#n3')); }); it('reinitialize chart with pan feature', function () { oc = $container.orgchart({ 'data': ds }); var spy = sinon.spy(oc, 'bindPan'); oc.init({ 'pan': true }); spy.should.have.been.callCount(1); }); it('reinitialize chart with zoom feature', function () { oc = $container.orgchart({ 'data': ds }); var spy = sinon.spy(oc, 'bindZoom'); oc.init({ 'zoom': true }); spy.should.have.been.callCount(1); }); }); });
{ "pile_set_name": "Github" }
# Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # Common code for parsing --trace-gc-nvp output. # from __future__ import with_statement import re def split_nvp(s): t = {} for (name, value) in re.findall(r"([._\w]+)=([-\w]+(?:\.[0-9]+)?)", s): try: t[name] = float(value) except ValueError: t[name] = value return t def parse_gc_trace(input): trace = [] with open(input) as f: for line in f: info = split_nvp(line) if info and 'pause' in info and info['pause'] > 0: info['i'] = len(trace) trace.append(info) return trace
{ "pile_set_name": "Github" }
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://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 https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include <debugger/debuggerengine.h> #include <qmldebug/qdebugmessageclient.h> #include <qmldebug/qmloutputparser.h> #include <qmljs/qmljsdocument.h> namespace Debugger { namespace Internal { class QmlEnginePrivate; class QmlInspectorAgent; class QmlEngine : public DebuggerEngine { Q_OBJECT public: QmlEngine(); ~QmlEngine() override; void logServiceStateChange(const QString &service, float version, QmlDebug::QmlDebugClient::State newState); void logServiceActivity(const QString &service, const QString &logMessage); void expressionEvaluated(quint32 queryId, const QVariant &result); QString toFileInProject(const QUrl &fileUrl); private: void disconnected(); void errorMessageBoxFinished(int result); void updateCurrentContext(); void tryToConnect(); void beginConnection(); void handleLauncherStarted(); void connectionEstablished(); void connectionStartupFailed(); void appStartupFailed(const QString &errorMessage); void appMessage(const QString &msg, Utils::OutputFormat); void setState(DebuggerState state, bool forced) override; void gotoLocation(const Internal::Location &location) override; bool canDisplayTooltip() const override { return false; } void resetLocation() override; void executeStepOver(bool) override; void executeStepIn(bool) override; void executeStepOut() override; void setupEngine() override; void runEngine() override; void shutdownInferior() override; void shutdownEngine() override; bool canHandleToolTip(const DebuggerToolTipContext &) const override; void continueInferior() override; void interruptInferior() override; void executeRunToLine(const ContextData &data) override; void executeRunToFunction(const QString &functionName) override; void executeJumpToLine(const ContextData &data) override; void activateFrame(int index) override; void selectThread(const Thread &thread) override; bool acceptsBreakpoint(const BreakpointParameters &bp) const final; void insertBreakpoint(const Breakpoint &bp) final; void removeBreakpoint(const Breakpoint &bp) final; void updateBreakpoint(const Breakpoint &bp) final; void assignValueInDebugger(WatchItem *item, const QString &expr, const QVariant &value) override; void loadSymbols(const QString &moduleName) override; void loadAllSymbols() override; void requestModuleSymbols(const QString &moduleName) override; void reloadModules() override; void reloadRegisters() override {} void reloadSourceFiles() override; void reloadFullStack() override {} void updateAll() override; void updateItem(const QString &iname) override; void expandItem(const QString &iname) override; void selectWatchData(const QString &iname) override; void executeDebuggerCommand(const QString &command) override; bool companionPreventsActions() const override; bool hasCapability(unsigned) const override; void quitDebugger() override; void doUpdateLocals(const UpdateParameters &params) override; Core::Context languageContext() const override; void closeConnection(); void startApplicationLauncher(); void stopApplicationLauncher(); void connectionFailed(); void checkConnectionState(); void showConnectionStateMessage(const QString &message); bool isConnected() const; private: friend class QmlEnginePrivate; friend class QmlInspectorAgent; QmlEnginePrivate *d; }; } // namespace Internal } // namespace Debugger
{ "pile_set_name": "Github" }
""" Large part of this code is based on another piece of code, so we include the disclaimer beneath """ """ Copyright (C) 2012 Bo Zhu http://about.bozhu.me 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. """ def xor(a, b): return ''.join(chr(ord(ac) ^ ord(bc)) for ac, bc in zip(a, b)) Sbox = ( 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16, ) InvSbox = ( 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D, ) xtime = lambda a: (((a << 1) ^ 0x1B) & 0xFF) if (a & 0x80) else (a << 1) Rcon = ( 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39, ) def text2matrix(text): matrix = [] for i in range(16): byte = ord(text[i]) if i % 4 == 0: matrix.append([byte]) else: matrix[i / 4].append(byte) return matrix def matrix2text(matrix): text = '' for i in range(4): for j in range(4): text = text + chr(matrix[i][j]) return text class AES: def init(self, master_key=None): if master_key: self.change_key(master_key) def change_key(self, master_key): self.round_keys = text2matrix(master_key) for i in range(4, 4 * 11): self.round_keys.append([]) if i % 4 == 0: byte = self.round_keys[i - 4][0] \ ^ Sbox[self.round_keys[i - 1][1]] \ ^ Rcon[i / 4] self.round_keys[i].append(byte) for j in range(1, 4): byte = self.round_keys[i - 4][j] \ ^ Sbox[self.round_keys[i - 1][(j + 1) % 4]] self.round_keys[i].append(byte) else: for j in range(4): byte = self.round_keys[i - 4][j] \ ^ self.round_keys[i - 1][j] self.round_keys[i].append(byte) def encrypt(self, plaintext): self.plain_state = text2matrix(plaintext) self.add_round_key(self.plain_state, self.round_keys[:4]) for i in range(1, 10): self.round_encrypt(self.plain_state, self.round_keys[4 * i: 4 * (i + 1)]) self.sub_bytes(self.plain_state) self.shift_rows(self.plain_state) self.add_round_key(self.plain_state, self.round_keys[40:]) return matrix2text(self.plain_state) def decrypt(self, ciphertext): self.cipher_state = text2matrix(ciphertext) self.add_round_key(self.cipher_state, self.round_keys[40:]) self.inv_shift_rows(self.cipher_state) self.inv_sub_bytes(self.cipher_state) for i in range(9, 0, -1): self.round_decrypt(self.cipher_state, self.round_keys[4 * i: 4 * (i + 1)]) self.add_round_key(self.cipher_state, self.round_keys[:4]) return matrix2text(self.cipher_state) def add_round_key(self, s, k): for i in range(4): for j in range(4): s[i][j] ^= k[i][j] def sr_encrypt(self, plaintext, key): state_matrix = text2matrix(plaintext) key_matrix = text2matrix(key) self.round_encrypt(state_matrix, key_matrix) return matrix2text(state_matrix) def round_encrypt(self, state_matrix, key_matrix): self.sub_bytes(state_matrix) self.shift_rows(state_matrix) self.mix_columns(state_matrix) self.add_round_key(state_matrix, key_matrix) def sr_decryptlast(self, plaintext, key): state_matrix = text2matrix(plaintext) key_matrix = text2matrix(key) self.add_round_key(state_matrix, key_matrix) self.inv_shift_rows(state_matrix) self.inv_sub_bytes(state_matrix) return matrix2text(state_matrix) def sr_decrypt(self, plaintext, key): state_matrix = text2matrix(plaintext) key_matrix = text2matrix(key) self.round_decrypt(state_matrix, key_matrix) return matrix2text(state_matrix) def round_decrypt(self, state_matrix, key_matrix): self.add_round_key(state_matrix, key_matrix) self.inv_mix_columns(state_matrix) self.inv_shift_rows(state_matrix) self.inv_sub_bytes(state_matrix) def sub_bytes(self, s): for i in range(4): for j in range(4): s[i][j] = Sbox[s[i][j]] def x_sub_bytes(self, s): s = text2matrix(s) self.sub_bytes(s) return matrix2text(s) def x_mix_columns(self, s): s = text2matrix(s) self.mix_columns(s) return matrix2text(s) def x_inv_sub_bytes(self, s): s = text2matrix(s) self.inv_sub_bytes(s) return matrix2text(s) def x_inv_mix_columns(self, s): s = text2matrix(s) self.inv_mix_columns(s) return matrix2text(s) def x_inv_shift_rows(self, s): s = text2matrix(s) self.inv_shift_rows(s) return matrix2text(s) def x_shift_rows(self, s): s = text2matrix(s) self.shift_rows(s) return matrix2text(s) def inv_sub_bytes(self, s): for i in range(4): for j in range(4): s[i][j] = InvSbox[s[i][j]] def shift_rows(self, s): s[0][1], s[1][1], s[2][1], s[3][1] = s[1][1], s[2][1], s[3][1], s[0][1] s[0][2], s[1][2], s[2][2], s[3][2] = s[2][2], s[3][2], s[0][2], s[1][2] s[0][3], s[1][3], s[2][3], s[3][3] = s[3][3], s[0][3], s[1][3], s[2][3] def inv_shift_rows(self, s): s[0][1], s[1][1], s[2][1], s[3][1] = s[3][1], s[0][1], s[1][1], s[2][1] s[0][2], s[1][2], s[2][2], s[3][2] = s[2][2], s[3][2], s[0][2], s[1][2] s[0][3], s[1][3], s[2][3], s[3][3] = s[1][3], s[2][3], s[3][3], s[0][3] def mix_single_column(self, a): # please see Sec 4.1.2 in The Design of Rijndael t = a[0] ^ a[1] ^ a[2] ^ a[3] u = a[0] a[0] ^= t ^ xtime(a[0] ^ a[1]) a[1] ^= t ^ xtime(a[1] ^ a[2]) a[2] ^= t ^ xtime(a[2] ^ a[3]) a[3] ^= t ^ xtime(a[3] ^ u) def mix_columns(self, s): for i in range(4): self.mix_single_column(s[i]) def inv_mix_columns(self, s): # see Sec 4.1.3 in The Design of Rijndael for i in range(4): u = xtime(xtime(s[i][0] ^ s[i][2])) v = xtime(xtime(s[i][1] ^ s[i][3])) s[i][0] ^= u s[i][1] ^= v s[i][2] ^= u s[i][3] ^= v self.mix_columns(s)
{ "pile_set_name": "Github" }
///////////////////////////////////////////////////////////////////////////// // Name: misc.h // Purpose: Miscellaneous utilities for OGL // Author: Julian Smart // Modified by: // Created: 12/07/98 // RCS-ID: $Id: misc.h,v 1.1 2007/03/28 15:15:47 frm Exp $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _OGL_MISC_H_ #define _OGL_MISC_H_ // List to use when copying objects; may need to associate elements of new objects // with elements of old objects, e.g. when copying constraint.s extern wxList oglObjectCopyMapping; /* * TEXT FORMATTING FUNCTIONS * */ // Centres the given list of wxShapeTextLine strings in the given box // (changing the positions in situ). Doesn't actually draw into the DC. WXDLLIMPEXP_OGL void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos, double width, double height, int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); // Given a string, returns a list of strings that fit within the given // width of box. Height is ignored. WXDLLIMPEXP_OGL wxStringList* oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode = 0); // Centres the list of wxShapeTextLine strings, doesn't clip. // Doesn't actually draw into the DC. WXDLLIMPEXP_OGL void oglCentreTextNoClipping(wxDC& dc, wxList *text_list, double m_xpos, double m_ypos, double width, double height); // Gets the maximum width and height of the given list of wxShapeTextLines. WXDLLIMPEXP_OGL void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, double m_xpos, double m_ypos, double width, double height, double *actual_width, double *actual_height); // Actually draw the preformatted list of wxShapeTextLines. WXDLLIMPEXP_OGL void oglDrawFormattedText(wxDC& context, wxList *text_list, double m_xpos, double m_ypos, double width, double height, int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); // Give it a list of points, finds the centre. WXDLLIMPEXP_OGL void oglFindPolylineCentroid(wxList *points, double *x, double *y); WXDLLIMPEXP_OGL void oglCheckLineIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double *ratio1, double *ratio2); WXDLLIMPEXP_OGL void oglFindEndForPolyline(double n, double xvec[], double yvec[], double x1, double y1, double x2, double y2, double *x3, double *y3); WXDLLIMPEXP_OGL void oglFindEndForBox(double width, double height, double x1, double y1, // Centre of box (possibly) double x2, double y2, // other end of line double *x3, double *y3); // End on box edge WXDLLIMPEXP_OGL void oglFindEndForCircle(double radius, double x1, double y1, // Centre of circle double x2, double y2, // Other end of line double *x3, double *y3); WXDLLIMPEXP_OGL void oglGetArrowPoints(double x1, double y1, double x2, double y2, double length, double width, double *tip_x, double *tip_y, double *side1_x, double *side1_y, double *side2_x, double *side2_y); /* * Given an ellipse and endpoints of a line, returns the point at which * the line touches the ellipse in values x4, y4. * This function assumes that the centre of the ellipse is at x1, y1, and the * ellipse has a width of a1 and a height of b1. It also assumes you are * wanting to draw an arc FROM point x2, y2 TOWARDS point x3, y3. * This function calculates the x,y coordinates of the intersection point of * the arc with the ellipse. * Author: Ian Harrison */ WXDLLIMPEXP_OGL void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3, double *x4, double *y4); WXDLLIMPEXP_OGL bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001); extern wxFont* g_oglNormalFont; extern wxPen* g_oglBlackPen; extern wxPen* g_oglWhiteBackgroundPen; extern wxPen* g_oglTransparentPen; extern wxBrush* g_oglWhiteBackgroundBrush; extern wxPen* g_oglBlackForegroundPen; WXDLLIMPEXP_OGL wxFont* oglMatchFont(int point_size); WXDLLIMPEXP_OGL wxString oglColourToHex(const wxColour& colour); WXDLLIMPEXP_OGL wxColour oglHexToColour(const wxString& hex); WXDLLIMPEXP_OGL void oglDecToHex(unsigned int dec, char *buf); WXDLLIMPEXP_OGL unsigned int oglHexToDec(char* buf); #endif // _OGL_MISC_H_
{ "pile_set_name": "Github" }
[{}] => [$1] [{}] => [constructor] [{}] => [super();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<synthetic: ctor_js>" [{}] => [$create__] [{}] => [$1.$clinit();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<synthetic: ctor_create>" [{}] => [let $instance = new $1();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<synthetic: ctor_create>" [{}] => [$instance.$ctor__com_google_j2cl_transpiler_readable_nobridgemethods_CharSet_1__();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<synthetic: ctor_create>" [{}] => [return $instance;] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<synthetic: ctor_create>" [{}] => [$ctor__com_google_j2cl_transpiler_readable_nobridgemethods_CharSet_1__] [{}] => [this.$ctor__com_google_j2cl_transpiler_readable_nobridgemethods_TreeMap__();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<init>" [{}] => [$clinit] [{}] => [$1.$clinit = () =>{};] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<clinit>" [{}] => [$1.$loadModules();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<clinit>" [{}] => [TreeMap.$clinit();] "com.google.j2cl.transpiler.readable.nobridgemethods.CharSet$1.<clinit>"
{ "pile_set_name": "Github" }
using System; using System.Drawing.Printing; using System.IO; using System.Reflection; namespace BartenderHelper { /// <summary> /// 获取标签模板的完整路径 /// </summary> public class ConfigLoad { /// <summary> /// 获取标签模板的完整路径 /// </summary> /// <param name="sLabelName">文件名,带后缀,如果不传则默认为"BC_DEFAULT.btw"</param> /// <returns>返回标签的完整路径</returns> public static string GetLabelNameFull(string sLabelName) { //获取当前程序集的路径 string sPathFolder = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); string sLabel = string.Empty; if (string.IsNullOrEmpty(sLabelName) && sLabelName.Substring(sLabelName.LastIndexOf(".") + 1) != "btw") { sLabel = sPathFolder + "\\" + "BC_DEFAULT.btw"; } else { sLabel = (sPathFolder + "\\" + sLabelName); } if (string.IsNullOrEmpty(sLabel)) throw new Exception("LabelName is null"); if (!File.Exists(sLabel)) throw new Exception("LabelName not exists : " + sLabel); return sLabel; } /// <summary> /// 获取默认打印机名称 /// </summary> /// <returns></returns> public static string GetDefaultPrinterName() { PrintDocument fPrintDoc = new PrintDocument(); return fPrintDoc.PrinterSettings.PrinterName; } /// <summary> /// 获取本地打印机列表 /// </summary> /// <returns></returns> public static string[] GetLocalPrinterList() { string[] ListPrinter = new string[PrinterSettings.InstalledPrinters.Count]; //获取当前打印机 for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++) { ListPrinter[i] = (PrinterSettings.InstalledPrinters[i].ToString()); } return ListPrinter; } } }
{ "pile_set_name": "Github" }
<div class="modal-header"> <h3>Error Loading Exploration</h3> </div> <div class="modal-body"> <p> Sorry! The following changes will be lost. It appears that your draft was overwritten by changes on another machine. </p> <p ng-show="hasLostChanges"> The lost changes are displayed below. You may want to copy and paste these changes before discarding them. </p> <changes-in-human-readable-form lost-changes="lostChanges"> </changes-in-human-readable-form> </div> <div class="modal-footer"> <button class="btn btn-secondary" ng-click="cancel()">Close</button> </div>
{ "pile_set_name": "Github" }
module Wukong module Streamer # # Bin and order a partitioned subset of keys # # For each record, appends a # # * numbering, from 0..(n-1). Each element gets a distinct numbering based on # the order seen at the reducer; elements with identical keys might have # different numbering on different runs. # # * rank, a number within 1..n giving the "place" of each value. Each element # receives a successive (and thus unique) numbering, but all elements with # the same key share the same rank. The first element for a given rank has # # (rank == numbering + 1) # # * bin, a number assigning keys by rank into a smaller number of groups. You # must supply command line arguments # # --bins=[number] --total_count=[number] # # giving the number of groups and predicting in advance the total number of # records. (Or override the bin assignment method to use your own damn # strategy). # # If your data looked (in order) as follows, and 4 bins were requested: # # data: 1 1 1 2.3 7 69 79 79 80 81 81 # numbering: 0 1 2 3 4 5 6 7 8 9 10 # rank: 1 1 1 4 5 6 7 7 9 10 10 # 4-bin: 1 1 1 2 2 3 3 3 4 4 4 # # If instead 100 bins were requested, # # data: 1 1 1 2.3 7 69 79 79 80 81 81 # numbering: 0 1 2 3 4 5 6 7 8 9 10 # rank: 1 1 1 4 5 6 7 7 9 10 10 # 100-bin: 1 1 1 28 37 46 55 55 73 82 91 # # Note most of the bins are empty, and that the # # -------------------------------------------------------------------------- # # Note that in this implementation each reducer numbers its own subset of # elements from 1..total_count. If you want to number your whole dataset, # you'll have to set @:reduce_tasks => 1@ in your Script's # Script#default_options. # # You might feel a bit better about yourself if you can bin several fields # (or subsets) at once. The :partition_fields option to Wukong::Script # (which requests a KeyFieldBasedPartitioner) can be used to route different # subsets to (possibly) distinct reducers. # # See the [examples/rank_and_bin_fields.rb] example script for an # implementation of this. (And note the thing you have to do in case one # reducer sees multiple partitions). # # It would surely be best to use a total sort and supply each reducer with the # initial rank of its run. # class RankAndBinReducer < Wukong::Streamer::Base attr_accessor :bin_size def initialize options super options configure_bins! options reset_order_params! end # =========================================================================== # # Order parameters (numbering, bin and rank) # # # Key used to assign ranking -- elements with identical keys have identical # rank. # def get_key *args args.first end def reset_order_params! @last_key = nil @numbering = 0 @rank = 1 end # # The ranking is the "place" of each value: each element receives a # successive (and thus unique) numbering, but all elements with the same key # share the same rank. The first element for a given rank has # # (rank == numbering + 1) # def get_rank key if @last_key != key @rank = @numbering + 1 @last_key = key end @rank end # # Set the bin from the current rank # elements with identical keys land in identical bins. # def get_bin rank ((rank-0.5) / bin_size ).floor + 1 end # # Return the numbering, rank and bin for the given key # def get_order_params key numbering = @numbering # use un-incremented value rank = get_rank key bin = get_bin rank @numbering += 1 [numbering, rank, bin] end def configure_bins! options case when options[:bins] total_count = options[:total_count].to_f bins = options[:bins].to_i unless total_count && (total_count != 0) then raise "To set the bin (%ile) size using --bins, we need to know the total count in advance. Please supply the total_count option." end self.bin_size = (total_count / bins) # $stderr.puts "Splitting %s records into %s bins of size %f. First element gets bin %d, last gets bin %d, median gets bin %d/%d" % # [total_count, bins, bin_size, get_bin(1), get_bin(total_count), get_bin(((total_count+1)/2.0).floor), get_bin(((total_count+1)/2.0).ceil)] else raise "Please specify a number of --bins= and a --total_count= or your own strategy to bin the ranked items." end end def process *fields numbering, rank, bin = get_order_params(get_key(*fields)) yield fields.to_flat + [numbering, rank, bin] end end end end
{ "pile_set_name": "Github" }
T1 f() { int x; x = 42; T3 y; y = 3.14; x = y; return x; }
{ "pile_set_name": "Github" }
/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: random psychoacoustics (not including preecho) last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $ ********************************************************************/ #ifndef _V_PSY_H_ #define _V_PSY_H_ #include "smallft.h" #include "backends.h" #include "envelope.h" #ifndef EHMER_MAX #define EHMER_MAX 56 #endif /* psychoacoustic setup ********************************************/ #define P_BANDS 17 /* 62Hz to 16kHz */ #define P_LEVELS 8 /* 30dB to 100dB */ #define P_LEVEL_0 30. /* 30 dB */ #define P_NOISECURVES 3 #define NOISE_COMPAND_LEVELS 40 typedef struct vorbis_info_psy{ int blockflag; float ath_adjatt; float ath_maxatt; float tone_masteratt[P_NOISECURVES]; float tone_centerboost; float tone_decay; float tone_abs_limit; float toneatt[P_BANDS]; int noisemaskp; float noisemaxsupp; float noisewindowlo; float noisewindowhi; int noisewindowlomin; int noisewindowhimin; int noisewindowfixed; float noiseoff[P_NOISECURVES][P_BANDS]; float noisecompand[NOISE_COMPAND_LEVELS]; float max_curve_dB; int normal_p; int normal_start; int normal_partition; double normal_thresh; } vorbis_info_psy; typedef struct{ int eighth_octave_lines; /* for block long/short tuning; encode only */ float preecho_thresh[VE_BANDS]; float postecho_thresh[VE_BANDS]; float stretch_penalty; float preecho_minenergy; float ampmax_att_per_sec; /* channel coupling config */ int coupling_pkHz[PACKETBLOBS]; int coupling_pointlimit[2][PACKETBLOBS]; int coupling_prepointamp[PACKETBLOBS]; int coupling_postpointamp[PACKETBLOBS]; int sliding_lowpass[2][PACKETBLOBS]; } vorbis_info_psy_global; typedef struct { float ampmax; int channels; vorbis_info_psy_global *gi; int coupling_pointlimit[2][P_NOISECURVES]; } vorbis_look_psy_global; typedef struct { int n; struct vorbis_info_psy *vi; float ***tonecurves; float **noiseoffset; float *ath; long *octave; /* in n.ocshift format */ long *bark; long firstoc; long shiftoc; int eighth_octave_lines; /* power of two, please */ int total_octave_lines; long rate; /* cache it */ float m_val; /* Masking compensation value */ } vorbis_look_psy; extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, vorbis_info_psy_global *gi,int n,long rate); extern void _vp_psy_clear(vorbis_look_psy *p); extern void *_vi_psy_dup(void *source); extern void _vi_psy_free(vorbis_info_psy *i); extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); extern void _vp_noisemask(vorbis_look_psy *p, float *logmdct, float *logmask); extern void _vp_tonemask(vorbis_look_psy *p, float *logfft, float *logmask, float global_specmax, float local_specmax); extern void _vp_offset_and_mix(vorbis_look_psy *p, float *noise, float *tone, int offset_select, float *logmask, float *mdct, float *logmdct); extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); extern void _vp_couple_quantize_normalize(int blobno, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct, int **iwork, int *nonzero, int sliding_lowpass, int ch); #endif
{ "pile_set_name": "Github" }
import defaultRouterMap from "@/router/defaultMap"; import asyncRouterMap from "@/router/asyncMap"; import staticRouterMap from "@/router/staticMap"; const permission = { state: { //全部路由,首页使用 homeRouters: [ ...defaultRouterMap.concat(asyncRouterMap).concat(staticRouterMap) ], routers: defaultRouterMap, //总路由 staticRouters: staticRouterMap, //静态路由 addRouters: [] //新增路由 }, mutations: { ["SET_ROUTERS"]: (state, routers) => { state.addRouters = routers; state.routers = defaultRouterMap.concat(routers); } }, actions: { /** * 根据规则生成路由的访问控制列表 * @param {*} param0 * @param {*} data */ ["GenerateRoutes"]({ commit }, data) { return new Promise(resolve => { const roles = data.roles; let accessedRouters = []; for (let i = 0; i < asyncRouterMap.length; i++) { if (~roles.indexOf(asyncRouterMap[i].path + "/index")) { accessedRouters.push(asyncRouterMap[i]); } } commit("SET_ROUTERS", accessedRouters); resolve(); }); } } }; export default permission;
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]> This file is part of Amaze File Manager. Amaze File Manager 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/>. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true"> <color android:color="#EEEEEE" /> </item> <item android:state_pressed="true"> <color android:color="#EEEEEE" /> </item> <item android:state_activated="true"> <color android:color="#EEEEEE" /> </item> <!--<item> <color android:color="#FFFFFF" /> </item>--> </selector>
{ "pile_set_name": "Github" }
body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: black; } :root { --primary-color-transparent: hsla(196, 78%, 61%, 0.1); } .loader { --loader-width: 4em; --loader-stroke-color: var(--primary-color); --loader-stroke: 2px; --loader-border: 2px; --loader-border-color: var(--primary-color-transparent); position: relative; width: var(--loader-width); height: var(--loader-width); box-shadow: inset 0 0 0 var(--loader-border) var(--loader-border-color); border-radius: 50%; &::before { position: absolute; content: ""; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; box-shadow: inset 0 0 0 var(--loader-stroke) var(--loader-stroke-color); clip-path: inset(0 50% 0 0); mask: linear-gradient(black, transparent); animation: spin 1s linear infinite; } } @keyframes spin { to { transform: rotate(1turn); } }
{ "pile_set_name": "Github" }
#!/bin/sh ################################################################################## # # # universalJavaApplicationStub # # # # # # A shellscript JavaApplicationStub for Java Apps on Mac OS X # # that works with both Apple's and Oracle's plist format. # # # # Inspired by Ian Roberts stackoverflow answer # # at http://stackoverflow.com/a/17546508/1128689 # # # # # # @author Tobias Fischer # # @url https://github.com/tofi86/universalJavaApplicationStub # # @date 2015-05-15 # # @version 0.9.0 # # # # # ################################################################################## # # # # # The MIT License (MIT) # # # # Copyright (c) 2015 Tobias Fischer # # # # 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. # # # ################################################################################## # # resolve symlinks ##################### PRG=$0 while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null` if expr "$link" : '^/' 2> /dev/null >/dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done # set the directory abspath of the current shell script PROGDIR=`dirname "$PRG"` # # set files and folders ############################################ # the absolute path of the app package cd "$PROGDIR"/../../ AppPackageFolder=`pwd` # the base path of the app package cd .. AppPackageRoot=`pwd` # set Apple's Java folder AppleJavaFolder="${AppPackageFolder}"/Contents/Resources/Java # set Apple's Resources folder AppleResourcesFolder="${AppPackageFolder}"/Contents/Resources # set Oracle's Java folder OracleJavaFolder="${AppPackageFolder}"/Contents/Java # set Oracle's Resources folder OracleResourcesFolder="${AppPackageFolder}"/Contents/Resources # set path to Info.plist in bundle InfoPlistFile="${AppPackageFolder}"/Contents/Info.plist # set the default JVM Version to a null string JVMVersion="" # # read Info.plist and extract JVM options ############################################ # read the program name from CFBundleName CFBundleName=`/usr/libexec/PlistBuddy -c "print :CFBundleName" "${InfoPlistFile}"` # read the icon file name CFBundleIconFile=`/usr/libexec/PlistBuddy -c "print :CFBundleIconFile" "${InfoPlistFile}"` # check Info.plist for Apple style Java keys -> if key :Java is present, parse in apple mode /usr/libexec/PlistBuddy -c "print :Java" "${InfoPlistFile}" > /dev/null 2>&1 exitcode=$? JavaKey=":Java" # if no :Java key is present, check Info.plist for universalJavaApplication style JavaX keys -> if key :JavaX is present, parse in apple mode if [ $exitcode -ne 0 ]; then /usr/libexec/PlistBuddy -c "print :JavaX" "${InfoPlistFile}" > /dev/null 2>&1 exitcode=$? JavaKey=":JavaX" fi # read Info.plist in Apple style if exit code returns 0 (true, :Java key is present) if [ $exitcode -eq 0 ]; then # set Java and Resources folder JavaFolder="${AppleJavaFolder}" ResourcesFolder="${AppleResourcesFolder}" APP_PACKAGE="${AppPackageFolder}" JAVAROOT="${AppleJavaFolder}" USER_HOME="$HOME" # read the Java WorkingDirectory JVMWorkDir=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:WorkingDirectory" "${InfoPlistFile}" 2> /dev/null | xargs` # set Working Directory based upon Plist info if [[ ! -z ${JVMWorkDir} ]]; then WorkingDirectory="${JVMWorkDir}" else # AppPackageRoot is the standard WorkingDirectory when the script is started WorkingDirectory="${AppPackageRoot}" fi # expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME WorkingDirectory=`eval "echo ${WorkingDirectory}"` # read the MainClass name JVMMainClass=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:MainClass" "${InfoPlistFile}" 2> /dev/null` # read the JVM Options JVMOptions=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:Properties" "${InfoPlistFile}" 2> /dev/null | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs` # read StartOnMainThread JVMStartOnMainThread=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:StartOnMainThread" "${InfoPlistFile}" 2> /dev/null` if [ "${JVMStartOnMainThread}" == "true" ]; then echo ${JVMStartOnMainThread} > ~/Desktop/test.txt JVMOptions+=" -XstartOnFirstThread" fi # read the ClassPath in either Array or String style JVMClassPath_RAW=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:ClassPath" "${InfoPlistFile}" 2> /dev/null` if [[ $JVMClassPath_RAW == *Array* ]] ; then JVMClassPath=.`/usr/libexec/PlistBuddy -c "print ${JavaKey}:ClassPath" "${InfoPlistFile}" 2> /dev/null | grep " " | sed 's/^ */:/g' | tr -d '\n' | xargs` else JVMClassPath=${JVMClassPath_RAW} fi # expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME JVMClassPath=`eval "echo ${JVMClassPath}"` # read the JVM Default Options JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:VMOptions" "${InfoPlistFile}" 2> /dev/null | xargs` # read the JVM Arguments JVMArguments=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:Arguments" "${InfoPlistFile}" 2> /dev/null | xargs` # read the Java version we want to find JVMVersion=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:JVMVersion" "${InfoPlistFile}" 2> /dev/null | xargs` # read Info.plist in Oracle style else # set Working Directory and Java and Resources folder JavaFolder="${OracleJavaFolder}" ResourcesFolder="${OracleResourcesFolder}" WorkingDirectory="${OracleJavaFolder}" APP_ROOT="${AppPackageFolder}" # read the MainClass name JVMMainClass=`/usr/libexec/PlistBuddy -c "print :JVMMainClassName" "${InfoPlistFile}" 2> /dev/null` # read the JVM Options JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" "${InfoPlistFile}" 2> /dev/null | grep " -" | tr -d '\n' | sed 's/ */ /g' | xargs` # replace occurances of $APP_ROOT with it's content JVMOptions=`eval "echo ${JVMOptions}"` JVMClassPath="${JavaFolder}/*" # read the JVM Default Options JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" "${InfoPlistFile}" 2> /dev/null | grep -o "\-.*" | tr -d '\n' | xargs` # read the JVM Arguments JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" "${InfoPlistFile}" 2> /dev/null | tr -d '\n' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs` # replace occurances of $APP_ROOT with it's content JVMArguments=`eval "echo ${JVMArguments}"` fi # # find installed Java versions ################################# # first check system variable "$JAVA_HOME" if [ -n "$JAVA_HOME" ] ; then JAVACMD="$JAVA_HOME/bin/java" # check for specified JVMversion in "/usr/libexec/java_home" symlinks elif [ ! -z ${JVMVersion} ] && [ -x /usr/libexec/java_home ] && /usr/libexec/java_home -F; then if /usr/libexec/java_home -F -v ${JVMVersion}; then JAVACMD="`/usr/libexec/java_home -F -v ${JVMVersion} 2> /dev/null`/bin/java" else # display error message with applescript osascript -e "tell application \"System Events\" to display dialog \"ERROR launching '${CFBundleName}'\n\nNo suitable Java version found on your system!\nThis program requires Java ${JVMVersion}\nMake sure you install the required Java version.\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)" # exit with error exit 3 fi # otherwise check "/usr/libexec/java_home" symlinks elif [ -x /usr/libexec/java_home ] && /usr/libexec/java_home -F; then JAVACMD="`/usr/libexec/java_home 2> /dev/null`/bin/java" # otherwise check Java standard symlink (old Apple Java) elif [ -h /Library/Java/Home ]; then JAVACMD="/Library/Java/Home/bin/java" # fallback: public JRE plugin (Oracle Java) else JAVACMD="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" fi # fallback fallback: /usr/bin/java # but this would prompt to install deprecated Apple Java 6 # # execute JAVA commandline and do some pre-checks #################################################### # display error message if MainClassName is empty if [ -z ${JVMMainClass} ]; then # display error message with applescript osascript -e "tell application \"System Events\" to display dialog \"ERROR launching '${CFBundleName}'!\n\n'MainClass' isn't specified!\nJava application cannot be started!\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)" # exit with error exit 2 # check whether $JAVACMD is a file and executable elif [ -f "$JAVACMD" ] && [ -x "$JAVACMD" ] ; then # enable drag&drop to the dock icon export CFProcessPath="$0" # change to Working Directory based upon Apple/Oracle Plist info cd "${WorkingDirectory}" # execute Java and set # - classpath # - dock icon # - application name # - JVM options # - JVM default options # - main class # - JVM arguments exec "$JAVACMD" \ -cp "${JVMClassPath}" \ -Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \ -Xdock:name="${CFBundleName}" \ ${JVMOptions:+$JVMOptions }\ ${JVMDefaultOptions:+$JVMDefaultOptions }\ ${JVMMainClass}\ ${JVMArguments:+ $JVMArguments} else # display error message with applescript osascript -e "tell application \"System Events\" to display dialog \"ERROR launching '${CFBundleName}'!\n\nYou need to have JAVA installed on your Mac!\nVisit http://java.com for more information...\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)" # and open java.com open http://java.com # exit with error exit 1 fi
{ "pile_set_name": "Github" }
Ubpa_DownloadFile( https://ubpa.github.io/USTC_CG_Data/Homeworks/08_Shader/models/spot_triangulated_good.obj ${CMAKE_CURRENT_SOURCE_DIR}/spot_triangulated_good.obj SHA256 6B24ADB11D65CF3658FA76BC1D589525E51AB997E442859EAC7CA3211B8E0357 )
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); namespace PhpAT\Statement\Event; use PHPAT\EventDispatcher\EventInterface; class StatementNotValidEvent implements EventInterface { /** * @var string */ private $message; public function __construct(string $message) { $this->message = $message; } public function getMessage(): string { return $this->message; } }
{ "pile_set_name": "Github" }
@ stdcall XInputEnable(long) xinput1_3.XInputEnable @ stdcall XInputGetCapabilities(long long ptr) xinput1_3.XInputGetCapabilities @ stdcall XInputGetDSoundAudioDeviceGuids(long ptr ptr) xinput1_3.XInputGetDSoundAudioDeviceGuids @ stdcall XInputSetState(long ptr) xinput1_3.XInputSetState @ stdcall XInputGetState(long ptr) xinput1_3.XInputGetState
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 374286797d58ba049a2818db719d1562 NativeFormatImporter: externalObjects: {} mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/* * GPIO driver for Analog Devices ADP5520 MFD PMICs * * Copyright 2009 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/mfd/adp5520.h> #include <linux/gpio.h> struct adp5520_gpio { struct device *master; struct gpio_chip gpio_chip; unsigned char lut[ADP5520_MAXGPIOS]; unsigned long output; }; static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off) { struct adp5520_gpio *dev; uint8_t reg_val; dev = container_of(chip, struct adp5520_gpio, gpio_chip); /* * There are dedicated registers for GPIO IN/OUT. * Make sure we return the right value, even when configured as output */ if (test_bit(off, &dev->output)) adp5520_read(dev->master, GPIO_OUT, &reg_val); else adp5520_read(dev->master, GPIO_IN, &reg_val); return !!(reg_val & dev->lut[off]); } static void adp5520_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { struct adp5520_gpio *dev; dev = container_of(chip, struct adp5520_gpio, gpio_chip); if (val) adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); else adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); } static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) { struct adp5520_gpio *dev; dev = container_of(chip, struct adp5520_gpio, gpio_chip); clear_bit(off, &dev->output); return adp5520_clr_bits(dev->master, GPIO_CFG_2, dev->lut[off]); } static int adp5520_gpio_direction_output(struct gpio_chip *chip, unsigned off, int val) { struct adp5520_gpio *dev; int ret = 0; dev = container_of(chip, struct adp5520_gpio, gpio_chip); set_bit(off, &dev->output); if (val) ret |= adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); else ret |= adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); ret |= adp5520_set_bits(dev->master, GPIO_CFG_2, dev->lut[off]); return ret; } static int __devinit adp5520_gpio_probe(struct platform_device *pdev) { struct adp5520_gpio_platfrom_data *pdata = pdev->dev.platform_data; struct adp5520_gpio *dev; struct gpio_chip *gc; int ret, i, gpios; unsigned char ctl_mask = 0; if (pdata == NULL) { dev_err(&pdev->dev, "missing platform data\n"); return -ENODEV; } if (pdev->id != ID_ADP5520) { dev_err(&pdev->dev, "only ADP5520 supports GPIO\n"); return -ENODEV; } dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { dev_err(&pdev->dev, "failed to alloc memory\n"); return -ENOMEM; } dev->master = pdev->dev.parent; for (gpios = 0, i = 0; i < ADP5520_MAXGPIOS; i++) if (pdata->gpio_en_mask & (1 << i)) dev->lut[gpios++] = 1 << i; if (gpios < 1) { ret = -EINVAL; goto err; } gc = &dev->gpio_chip; gc->direction_input = adp5520_gpio_direction_input; gc->direction_output = adp5520_gpio_direction_output; gc->get = adp5520_gpio_get_value; gc->set = adp5520_gpio_set_value; gc->can_sleep = 1; gc->base = pdata->gpio_start; gc->ngpio = gpios; gc->label = pdev->name; gc->owner = THIS_MODULE; ret = adp5520_clr_bits(dev->master, GPIO_CFG_1, pdata->gpio_en_mask); if (pdata->gpio_en_mask & GPIO_C3) ctl_mask |= C3_MODE; if (pdata->gpio_en_mask & GPIO_R3) ctl_mask |= R3_MODE; if (ctl_mask) ret = adp5520_set_bits(dev->master, LED_CONTROL, ctl_mask); ret |= adp5520_set_bits(dev->master, GPIO_PULLUP, pdata->gpio_pullup_mask); if (ret) { dev_err(&pdev->dev, "failed to write\n"); goto err; } ret = gpiochip_add(&dev->gpio_chip); if (ret) goto err; platform_set_drvdata(pdev, dev); return 0; err: kfree(dev); return ret; } static int __devexit adp5520_gpio_remove(struct platform_device *pdev) { struct adp5520_gpio *dev; int ret; dev = platform_get_drvdata(pdev); ret = gpiochip_remove(&dev->gpio_chip); if (ret) { dev_err(&pdev->dev, "%s failed, %d\n", "gpiochip_remove()", ret); return ret; } kfree(dev); return 0; } static struct platform_driver adp5520_gpio_driver = { .driver = { .name = "adp5520-gpio", .owner = THIS_MODULE, }, .probe = adp5520_gpio_probe, .remove = __devexit_p(adp5520_gpio_remove), }; static int __init adp5520_gpio_init(void) { return platform_driver_register(&adp5520_gpio_driver); } module_init(adp5520_gpio_init); static void __exit adp5520_gpio_exit(void) { platform_driver_unregister(&adp5520_gpio_driver); } module_exit(adp5520_gpio_exit); MODULE_AUTHOR("Michael Hennerich <[email protected]>"); MODULE_DESCRIPTION("GPIO ADP5520 Driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:adp5520-gpio");
{ "pile_set_name": "Github" }
using System; namespace PcapDotNet.Packets.Http { /// <summary> /// RFC 2616. /// Represents an HTTP layer. /// </summary> public abstract class HttpLayer : SimpleLayer, IEquatable<HttpLayer> { /// <summary> /// True iff the message is a request and iff the message is not a response. /// </summary> public abstract bool IsRequest { get; } /// <summary> /// True iff the message is a response and iff the message is not a request. /// </summary> public bool IsResponse { get { return !IsRequest; } } /// <summary> /// The version of this HTTP message. /// </summary> public HttpVersion Version { get; set; } /// <summary> /// The header of the HTTP message. /// </summary> public HttpHeader Header { get; set; } /// <summary> /// Message Body. /// </summary> public Datagram Body { get; set; } /// <summary> /// The number of bytes this layer will take. /// </summary> public sealed override int Length { get { return FirstLineLength + (Header == null ? 0 : Header.BytesLength) + (Body == null ? 0 : Body.Length); } } /// <summary> /// Two HTTP layers are equal iff they have the same version, header and body. /// Extended by specific HTTP layers types for more checks. /// </summary> public sealed override bool Equals(Layer other) { return Equals(other as HttpLayer); } /// <summary> /// Two HTTP layers are equal iff they have the same version, header and body. /// Extended by specific HTTP layers types for more checks. /// </summary> public virtual bool Equals(HttpLayer other) { return other != null && (ReferenceEquals(Version, other.Version) || Version.Equals(other.Version)) && (ReferenceEquals(Header, other.Header) || Header.Equals(other.Header)) && (ReferenceEquals(Body, other.Body) || Body.Equals(other.Body)); } /// <summary> /// Writes the HTTP layer to the buffer. /// </summary> /// <param name="buffer">The buffer to write the layer to.</param> /// <param name="offset">The offset in the buffer to start writing the layer at.</param> protected sealed override void Write(byte[] buffer, int offset) { WriteFirstLine(buffer, ref offset); if (Header != null) Header.Write(buffer, ref offset); if (Body != null) buffer.Write(offset, Body); } internal abstract int FirstLineLength { get; } internal abstract void WriteFirstLine(byte[] buffer, ref int offset); } }
{ "pile_set_name": "Github" }
<?php namespace Alchemy\Tests\Phrasea\Core\Provider; /** * @group functional * @group legacy */ class ACLServiceProviderTest extends ServiceProviderTestCase { public function provideServiceDescription() { return [ [ 'Alchemy\Phrasea\Core\Provider\ACLServiceProvider', 'acl.basket', 'Alchemy\\Phrasea\\ACL\\BasketACL', ], ]; } }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <!-- 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. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.stanbol</groupId> <artifactId>stanbol-parent</artifactId> <version>7-SNAPSHOT</version> <relativePath>../../../parent</relativePath> </parent> <groupId>org.apache.stanbol</groupId> <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId> <version>1.0.1-SNAPSHOT</version> <packaging>bundle</packaging> <name>Apache Stanbol Commons Namespace Prefix Provider for Stanbol Default Mappings</name> <description> Provides Namespace Prefix Mappings as defined by the Stanbol NamespaceEnums before the introduction of the Namespace Prefix Service (STANBOL-824). </description> <scm> <connection> scm:svn:http://svn.apache.org/repos/asf/stanbol/trunk/commons/namespaceprefix/stanbolprovider </connection> <developerConnection> scm:svn:https://svn.apache.org/repos/asf/stanbol/trunk/commons/namespaceprefix/stanbolprovider </developerConnection> <url>http://stanbol.apache.org/</url> </scm> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-scr-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Import-Package> org.apache.stanbol.commons.namespaceprefix; provide:=true; version="[0.11,1.1)", org.apache.stanbol.commons.namespaceprefix.mappings, * </Import-Package> <Export-Package> org.apache.stanbol.commons.namespaceprefix.mappings;version=${project.version} </Export-Package> <Private-Package> org.apache.stanbol.commons.namespaceprefix.provider.stanbol </Private-Package> </instructions> </configuration> </plugin> <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <configuration> <excludeSubProjects>false</excludeSubProjects> <excludes> <exclude>src/license/THIRD-PARTY.properties</exclude> <!-- Apache License 2.0 --> <exclude>src/test/resources/testnamespaceprefix.mappings</exclude> <exclude>src/main/resources/META-INF/services/org.apache.stanbol.commons.namespaceprefix.NamespacePrefixProvider</exclude> </excludes> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.stanbol</groupId> <artifactId>org.apache.stanbol.commons.namespaceprefix.service</artifactId> <version>1.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> </dependency> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.compendium</artifactId> </dependency> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.scr.annotations</artifactId> </dependency> <!-- testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <!-- used for debug level logging during tests --> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
{ "pile_set_name": "Github" }
require('../../modules/es6.symbol'); module.exports = require('../../modules/_core').Symbol.keyFor;
{ "pile_set_name": "Github" }
/* Simple DirectMedia Layer Copyright (C) 1997-2016 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_egl.h * * This is a simple file to encapsulate the EGL API headers. */ #ifndef _MSC_VER #include <EGL/egl.h> #include <EGL/eglext.h> #else /* _MSC_VER */ /* EGL headers for Visual Studio */ #ifndef __khrplatform_h_ #define __khrplatform_h_ /* ** Copyright (c) 2008-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are 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 Materials. ** ** THE MATERIALS ARE 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 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* Khronos platform-specific types and definitions. * * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. * Please submit changes by sending them to the public Khronos Bugzilla * (http://khronos.org/bugzilla) by filing a bug against product * "Khronos (general)" component "Registry". * * A predefined template which fills in some of the bug fields can be * reached using http://tinyurl.com/khrplatform-h-bugreport, but you * must create a Bugzilla login first. * * * See the Implementer's Guidelines for information about where this file * should be located on your system and for more details of its use: * http://www.khronos.org/registry/implementers_guide.pdf * * This file should be included as * #include <KHR/khrplatform.h> * by Khronos client API header files that use its types and defines. * * The types in khrplatform.h should only be used to define API-specific types. * * Types defined in khrplatform.h: * khronos_int8_t signed 8 bit * khronos_uint8_t unsigned 8 bit * khronos_int16_t signed 16 bit * khronos_uint16_t unsigned 16 bit * khronos_int32_t signed 32 bit * khronos_uint32_t unsigned 32 bit * khronos_int64_t signed 64 bit * khronos_uint64_t unsigned 64 bit * khronos_intptr_t signed same number of bits as a pointer * khronos_uintptr_t unsigned same number of bits as a pointer * khronos_ssize_t signed size * khronos_usize_t unsigned size * khronos_float_t signed 32 bit floating point * khronos_time_ns_t unsigned 64 bit time in nanoseconds * khronos_utime_nanoseconds_t unsigned time interval or absolute time in * nanoseconds * khronos_stime_nanoseconds_t signed time interval in nanoseconds * khronos_boolean_enum_t enumerated boolean type. This should * only be used as a base type when a client API's boolean type is * an enum. Client APIs which use an integer or other type for * booleans cannot use this as the base type for their boolean. * * Tokens defined in khrplatform.h: * * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. * * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. * * Calling convention macros defined in this file: * KHRONOS_APICALL * KHRONOS_APIENTRY * KHRONOS_APIATTRIBUTES * * These may be used in function prototypes as: * * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( * int arg1, * int arg2) KHRONOS_APIATTRIBUTES; */ /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ #if defined(_WIN32) && !defined(__SCITECH_SNAP__) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C #else # define KHRONOS_APICALL #endif /*------------------------------------------------------------------------- * Definition of KHRONOS_APIENTRY *------------------------------------------------------------------------- * This follows the return type of the function and precedes the function * name in the function prototype. */ #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else # define KHRONOS_APIENTRY #endif /*------------------------------------------------------------------------- * Definition of KHRONOS_APIATTRIBUTES *------------------------------------------------------------------------- * This follows the closing parenthesis of the function prototype arguments. */ #if defined (__ARMCC_2__) #define KHRONOS_APIATTRIBUTES __softfp #else #define KHRONOS_APIATTRIBUTES #endif /*------------------------------------------------------------------------- * basic type definitions *-----------------------------------------------------------------------*/ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) /* * Using <stdint.h> */ #include <stdint.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(__VMS ) || defined(__sgi) /* * Using <inttypes.h> */ #include <inttypes.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(_WIN32) && !defined(__SCITECH_SNAP__) /* * Win32 */ typedef __int32 khronos_int32_t; typedef unsigned __int32 khronos_uint32_t; typedef __int64 khronos_int64_t; typedef unsigned __int64 khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(__sun__) || defined(__digital__) /* * Sun or Digital */ typedef int khronos_int32_t; typedef unsigned int khronos_uint32_t; #if defined(__arch64__) || defined(_LP64) typedef long int khronos_int64_t; typedef unsigned long int khronos_uint64_t; #else typedef long long int khronos_int64_t; typedef unsigned long long int khronos_uint64_t; #endif /* __arch64__ */ #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif 0 /* * Hypothetical platform with no float or int64 support */ typedef int khronos_int32_t; typedef unsigned int khronos_uint32_t; #define KHRONOS_SUPPORT_INT64 0 #define KHRONOS_SUPPORT_FLOAT 0 #else /* * Generic fallback */ #include <stdint.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #endif /* * Types that are (so far) the same on all platforms */ typedef signed char khronos_int8_t; typedef unsigned char khronos_uint8_t; typedef signed short int khronos_int16_t; typedef unsigned short int khronos_uint16_t; /* * Types that differ between LLP64 and LP64 architectures - in LLP64, * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ #ifdef _WIN64 typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; typedef signed long long int khronos_ssize_t; typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif #if KHRONOS_SUPPORT_FLOAT /* * Float type */ typedef float khronos_float_t; #endif #if KHRONOS_SUPPORT_INT64 /* Time types * * These types can be used to represent a time interval in nanoseconds or * an absolute Unadjusted System Time. Unadjusted System Time is the number * of nanoseconds since some arbitrary system event (e.g. since the last * time the system booted). The Unadjusted System Time is an unsigned * 64 bit value that wraps back to 0 every 584 years. Time intervals * may be either signed or unsigned. */ typedef khronos_uint64_t khronos_utime_nanoseconds_t; typedef khronos_int64_t khronos_stime_nanoseconds_t; #endif /* * Dummy value used to pad enum types to 32 bits. */ #ifndef KHRONOS_MAX_ENUM #define KHRONOS_MAX_ENUM 0x7FFFFFFF #endif /* * Enumerated boolean type * * Values other than zero should be considered to be true. Therefore * comparisons should not be made against KHRONOS_TRUE. */ typedef enum { KHRONOS_FALSE = 0, KHRONOS_TRUE = 1, KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM } khronos_boolean_enum_t; #endif /* __khrplatform_h_ */ #ifndef __eglplatform_h_ #define __eglplatform_h_ /* ** Copyright (c) 2007-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are 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 Materials. ** ** THE MATERIALS ARE 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 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* Platform-specific types and definitions for egl.h * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that * they can be included in future versions of this file. Please submit changes * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) * by filing a bug against product "EGL" component "Registry". */ /*#include <KHR/khrplatform.h>*/ /* Macros used in EGL function prototype declarations. * * EGL functions should be prototyped as: * * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); * * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h */ #ifndef EGLAPI #define EGLAPI KHRONOS_APICALL #endif #ifndef EGLAPIENTRY #define EGLAPIENTRY KHRONOS_APIENTRY #endif #define EGLAPIENTRYP EGLAPIENTRY* /* The types NativeDisplayType, NativeWindowType, and NativePixmapType * are aliases of window-system-dependent types, such as X Display * or * Windows Device Context. They must be defined in platform-specific * code below. The EGL-prefixed versions of Native*Type are the same * types, renamed in EGL 1.3 so all types in the API start with "EGL". * * Khronos STRONGLY RECOMMENDS that you use the default definitions * provided below, since these changes affect both binary and source * portability of applications using EGL running on different EGL * implementations. */ #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #include <windows.h> #if __WINRT__ #include <Unknwn.h> typedef IUnknown * EGLNativeWindowType; typedef IUnknown * EGLNativePixmapType; typedef IUnknown * EGLNativeDisplayType; #else typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; #endif #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ typedef int EGLNativeDisplayType; typedef void *EGLNativeWindowType; typedef void *EGLNativePixmapType; #elif defined(WL_EGL_PLATFORM) typedef struct wl_display *EGLNativeDisplayType; typedef struct wl_egl_pixmap *EGLNativePixmapType; typedef struct wl_egl_window *EGLNativeWindowType; #elif defined(__GBM__) typedef struct gbm_device *EGLNativeDisplayType; typedef struct gbm_bo *EGLNativePixmapType; typedef void *EGLNativeWindowType; #elif defined(__ANDROID__) /* Android */ struct ANativeWindow; struct egl_native_pixmap_t; typedef struct ANativeWindow *EGLNativeWindowType; typedef struct egl_native_pixmap_t *EGLNativePixmapType; typedef void *EGLNativeDisplayType; #elif defined(MIR_EGL_PLATFORM) #include <mir_toolkit/mir_client_library.h> typedef MirEGLNativeDisplayType EGLNativeDisplayType; typedef void *EGLNativePixmapType; typedef MirEGLNativeWindowType EGLNativeWindowType; #elif defined(__unix__) #ifdef MESA_EGL_NO_X11_HEADERS typedef void *EGLNativeDisplayType; typedef khronos_uintptr_t EGLNativePixmapType; typedef khronos_uintptr_t EGLNativeWindowType; #else /* X11 (tentative) */ #include <X11/Xlib.h> #include <X11/Xutil.h> typedef Display *EGLNativeDisplayType; typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; #endif /* MESA_EGL_NO_X11_HEADERS */ #else #error "Platform not recognized" #endif /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ typedef EGLNativeDisplayType NativeDisplayType; typedef EGLNativePixmapType NativePixmapType; typedef EGLNativeWindowType NativeWindowType; /* Define EGLint. This must be a signed integral type large enough to contain * all legal attribute names and values passed into and out of EGL, whether * their type is boolean, bitmask, enumerant (symbolic constant), integer, * handle, or other. While in general a 32-bit integer will suffice, if * handles are 64 bit types, then EGLint should be defined as a signed 64-bit * integer type. */ typedef khronos_int32_t EGLint; #endif /* __eglplatform_h */ #ifndef __egl_h_ #define __egl_h_ 1 #ifdef __cplusplus extern "C" { #endif /* ** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are 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 Materials. ** ** THE MATERIALS ARE 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 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** ** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ */ /*#include <EGL/eglplatform.h>*/ /* Generated on date 20150623 */ /* Generated C header for: * API: egl * Versions considered: .* * Versions emitted: .* * Default extensions included: None * Additional extensions included: _nomatch_^ * Extensions removed: _nomatch_^ */ #ifndef EGL_VERSION_1_0 #define EGL_VERSION_1_0 1 typedef unsigned int EGLBoolean; typedef void *EGLDisplay; typedef void *EGLConfig; typedef void *EGLSurface; typedef void *EGLContext; typedef void (*__eglMustCastToProperFunctionPointerType)(void); #define EGL_ALPHA_SIZE 0x3021 #define EGL_BAD_ACCESS 0x3002 #define EGL_BAD_ALLOC 0x3003 #define EGL_BAD_ATTRIBUTE 0x3004 #define EGL_BAD_CONFIG 0x3005 #define EGL_BAD_CONTEXT 0x3006 #define EGL_BAD_CURRENT_SURFACE 0x3007 #define EGL_BAD_DISPLAY 0x3008 #define EGL_BAD_MATCH 0x3009 #define EGL_BAD_NATIVE_PIXMAP 0x300A #define EGL_BAD_NATIVE_WINDOW 0x300B #define EGL_BAD_PARAMETER 0x300C #define EGL_BAD_SURFACE 0x300D #define EGL_BLUE_SIZE 0x3022 #define EGL_BUFFER_SIZE 0x3020 #define EGL_CONFIG_CAVEAT 0x3027 #define EGL_CONFIG_ID 0x3028 #define EGL_CORE_NATIVE_ENGINE 0x305B #define EGL_DEPTH_SIZE 0x3025 #define EGL_DONT_CARE ((EGLint)-1) #define EGL_DRAW 0x3059 #define EGL_EXTENSIONS 0x3055 #define EGL_FALSE 0 #define EGL_GREEN_SIZE 0x3023 #define EGL_HEIGHT 0x3056 #define EGL_LARGEST_PBUFFER 0x3058 #define EGL_LEVEL 0x3029 #define EGL_MAX_PBUFFER_HEIGHT 0x302A #define EGL_MAX_PBUFFER_PIXELS 0x302B #define EGL_MAX_PBUFFER_WIDTH 0x302C #define EGL_NATIVE_RENDERABLE 0x302D #define EGL_NATIVE_VISUAL_ID 0x302E #define EGL_NATIVE_VISUAL_TYPE 0x302F #define EGL_NONE 0x3038 #define EGL_NON_CONFORMANT_CONFIG 0x3051 #define EGL_NOT_INITIALIZED 0x3001 #define EGL_NO_CONTEXT ((EGLContext)0) #define EGL_NO_DISPLAY ((EGLDisplay)0) #define EGL_NO_SURFACE ((EGLSurface)0) #define EGL_PBUFFER_BIT 0x0001 #define EGL_PIXMAP_BIT 0x0002 #define EGL_READ 0x305A #define EGL_RED_SIZE 0x3024 #define EGL_SAMPLES 0x3031 #define EGL_SAMPLE_BUFFERS 0x3032 #define EGL_SLOW_CONFIG 0x3050 #define EGL_STENCIL_SIZE 0x3026 #define EGL_SUCCESS 0x3000 #define EGL_SURFACE_TYPE 0x3033 #define EGL_TRANSPARENT_BLUE_VALUE 0x3035 #define EGL_TRANSPARENT_GREEN_VALUE 0x3036 #define EGL_TRANSPARENT_RED_VALUE 0x3037 #define EGL_TRANSPARENT_RGB 0x3052 #define EGL_TRANSPARENT_TYPE 0x3034 #define EGL_TRUE 1 #define EGL_VENDOR 0x3053 #define EGL_VERSION 0x3054 #define EGL_WIDTH 0x3057 #define EGL_WINDOW_BIT 0x0004 EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); EGLAPI EGLint EGLAPIENTRY eglGetError (void); EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); #endif /* EGL_VERSION_1_0 */ #ifndef EGL_VERSION_1_1 #define EGL_VERSION_1_1 1 #define EGL_BACK_BUFFER 0x3084 #define EGL_BIND_TO_TEXTURE_RGB 0x3039 #define EGL_BIND_TO_TEXTURE_RGBA 0x303A #define EGL_CONTEXT_LOST 0x300E #define EGL_MIN_SWAP_INTERVAL 0x303B #define EGL_MAX_SWAP_INTERVAL 0x303C #define EGL_MIPMAP_TEXTURE 0x3082 #define EGL_MIPMAP_LEVEL 0x3083 #define EGL_NO_TEXTURE 0x305C #define EGL_TEXTURE_2D 0x305F #define EGL_TEXTURE_FORMAT 0x3080 #define EGL_TEXTURE_RGB 0x305D #define EGL_TEXTURE_RGBA 0x305E #define EGL_TEXTURE_TARGET 0x3081 EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); #endif /* EGL_VERSION_1_1 */ #ifndef EGL_VERSION_1_2 #define EGL_VERSION_1_2 1 typedef unsigned int EGLenum; typedef void *EGLClientBuffer; #define EGL_ALPHA_FORMAT 0x3088 #define EGL_ALPHA_FORMAT_NONPRE 0x308B #define EGL_ALPHA_FORMAT_PRE 0x308C #define EGL_ALPHA_MASK_SIZE 0x303E #define EGL_BUFFER_PRESERVED 0x3094 #define EGL_BUFFER_DESTROYED 0x3095 #define EGL_CLIENT_APIS 0x308D #define EGL_COLORSPACE 0x3087 #define EGL_COLORSPACE_sRGB 0x3089 #define EGL_COLORSPACE_LINEAR 0x308A #define EGL_COLOR_BUFFER_TYPE 0x303F #define EGL_CONTEXT_CLIENT_TYPE 0x3097 #define EGL_DISPLAY_SCALING 10000 #define EGL_HORIZONTAL_RESOLUTION 0x3090 #define EGL_LUMINANCE_BUFFER 0x308F #define EGL_LUMINANCE_SIZE 0x303D #define EGL_OPENGL_ES_BIT 0x0001 #define EGL_OPENVG_BIT 0x0002 #define EGL_OPENGL_ES_API 0x30A0 #define EGL_OPENVG_API 0x30A1 #define EGL_OPENVG_IMAGE 0x3096 #define EGL_PIXEL_ASPECT_RATIO 0x3092 #define EGL_RENDERABLE_TYPE 0x3040 #define EGL_RENDER_BUFFER 0x3086 #define EGL_RGB_BUFFER 0x308E #define EGL_SINGLE_BUFFER 0x3085 #define EGL_SWAP_BEHAVIOR 0x3093 #define EGL_UNKNOWN ((EGLint)-1) #define EGL_VERTICAL_RESOLUTION 0x3091 EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); #endif /* EGL_VERSION_1_2 */ #ifndef EGL_VERSION_1_3 #define EGL_VERSION_1_3 1 #define EGL_CONFORMANT 0x3042 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_MATCH_NATIVE_PIXMAP 0x3041 #define EGL_OPENGL_ES2_BIT 0x0004 #define EGL_VG_ALPHA_FORMAT 0x3088 #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B #define EGL_VG_ALPHA_FORMAT_PRE 0x308C #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 #define EGL_VG_COLORSPACE 0x3087 #define EGL_VG_COLORSPACE_sRGB 0x3089 #define EGL_VG_COLORSPACE_LINEAR 0x308A #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 #endif /* EGL_VERSION_1_3 */ #ifndef EGL_VERSION_1_4 #define EGL_VERSION_1_4 1 #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 #define EGL_MULTISAMPLE_RESOLVE 0x3099 #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B #define EGL_OPENGL_API 0x30A2 #define EGL_OPENGL_BIT 0x0008 #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); #endif /* EGL_VERSION_1_4 */ #ifndef EGL_VERSION_1_5 #define EGL_VERSION_1_5 1 typedef void *EGLSync; typedef intptr_t EGLAttrib; typedef khronos_utime_nanoseconds_t EGLTime; typedef void *EGLImage; #define EGL_CONTEXT_MAJOR_VERSION 0x3098 #define EGL_CONTEXT_MINOR_VERSION 0x30FB #define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD #define EGL_NO_RESET_NOTIFICATION 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET 0x31BF #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 #define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 #define EGL_OPENGL_ES3_BIT 0x00000040 #define EGL_CL_EVENT_HANDLE 0x309C #define EGL_SYNC_CL_EVENT 0x30FE #define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 #define EGL_SYNC_TYPE 0x30F7 #define EGL_SYNC_STATUS 0x30F1 #define EGL_SYNC_CONDITION 0x30F8 #define EGL_SIGNALED 0x30F2 #define EGL_UNSIGNALED 0x30F3 #define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 #define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull #define EGL_TIMEOUT_EXPIRED 0x30F5 #define EGL_CONDITION_SATISFIED 0x30F6 #define EGL_NO_SYNC ((EGLSync)0) #define EGL_SYNC_FENCE 0x30F9 #define EGL_GL_COLORSPACE 0x309D #define EGL_GL_COLORSPACE_SRGB 0x3089 #define EGL_GL_COLORSPACE_LINEAR 0x308A #define EGL_GL_RENDERBUFFER 0x30B9 #define EGL_GL_TEXTURE_2D 0x30B1 #define EGL_GL_TEXTURE_LEVEL 0x30BC #define EGL_GL_TEXTURE_3D 0x30B2 #define EGL_GL_TEXTURE_ZOFFSET 0x30BD #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 #define EGL_IMAGE_PRESERVED 0x30D2 #define EGL_NO_IMAGE ((EGLImage)0) EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); #endif /* EGL_VERSION_1_5 */ #ifdef __cplusplus } #endif #endif /* __egl_h_ */ #ifndef __eglext_h_ #define __eglext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* ** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are 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 Materials. ** ** THE MATERIALS ARE 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 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** ** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ */ /*#include <EGL/eglplatform.h>*/ #define EGL_EGLEXT_VERSION 20150623 /* Generated C header for: * API: egl * Versions considered: .* * Versions emitted: _nomatch_^ * Default extensions included: egl * Additional extensions included: _nomatch_^ * Extensions removed: _nomatch_^ */ #ifndef EGL_KHR_cl_event #define EGL_KHR_cl_event 1 #define EGL_CL_EVENT_HANDLE_KHR 0x309C #define EGL_SYNC_CL_EVENT_KHR 0x30FE #define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF #endif /* EGL_KHR_cl_event */ #ifndef EGL_KHR_cl_event2 #define EGL_KHR_cl_event2 1 typedef void *EGLSyncKHR; typedef intptr_t EGLAttribKHR; typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); #endif #endif /* EGL_KHR_cl_event2 */ #ifndef EGL_KHR_client_get_all_proc_addresses #define EGL_KHR_client_get_all_proc_addresses 1 #endif /* EGL_KHR_client_get_all_proc_addresses */ #ifndef EGL_KHR_config_attribs #define EGL_KHR_config_attribs 1 #define EGL_CONFORMANT_KHR 0x3042 #define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 #define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 #endif /* EGL_KHR_config_attribs */ #ifndef EGL_KHR_create_context #define EGL_KHR_create_context 1 #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB #define EGL_CONTEXT_FLAGS_KHR 0x30FC #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD #define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 #define EGL_OPENGL_ES3_BIT_KHR 0x00000040 #endif /* EGL_KHR_create_context */ #ifndef EGL_KHR_create_context_no_error #define EGL_KHR_create_context_no_error 1 #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 #endif /* EGL_KHR_create_context_no_error */ #ifndef EGL_KHR_fence_sync #define EGL_KHR_fence_sync 1 typedef khronos_utime_nanoseconds_t EGLTimeKHR; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 #define EGL_SYNC_CONDITION_KHR 0x30F8 #define EGL_SYNC_FENCE_KHR 0x30F9 typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_fence_sync */ #ifndef EGL_KHR_get_all_proc_addresses #define EGL_KHR_get_all_proc_addresses 1 #endif /* EGL_KHR_get_all_proc_addresses */ #ifndef EGL_KHR_gl_colorspace #define EGL_KHR_gl_colorspace 1 #define EGL_GL_COLORSPACE_KHR 0x309D #define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 #define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A #endif /* EGL_KHR_gl_colorspace */ #ifndef EGL_KHR_gl_renderbuffer_image #define EGL_KHR_gl_renderbuffer_image 1 #define EGL_GL_RENDERBUFFER_KHR 0x30B9 #endif /* EGL_KHR_gl_renderbuffer_image */ #ifndef EGL_KHR_gl_texture_2D_image #define EGL_KHR_gl_texture_2D_image 1 #define EGL_GL_TEXTURE_2D_KHR 0x30B1 #define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC #endif /* EGL_KHR_gl_texture_2D_image */ #ifndef EGL_KHR_gl_texture_3D_image #define EGL_KHR_gl_texture_3D_image 1 #define EGL_GL_TEXTURE_3D_KHR 0x30B2 #define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD #endif /* EGL_KHR_gl_texture_3D_image */ #ifndef EGL_KHR_gl_texture_cubemap_image #define EGL_KHR_gl_texture_cubemap_image 1 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 #endif /* EGL_KHR_gl_texture_cubemap_image */ #ifndef EGL_KHR_image #define EGL_KHR_image 1 typedef void *EGLImageKHR; #define EGL_NATIVE_PIXMAP_KHR 0x30B0 #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); #endif #endif /* EGL_KHR_image */ #ifndef EGL_KHR_image_base #define EGL_KHR_image_base 1 #define EGL_IMAGE_PRESERVED_KHR 0x30D2 #endif /* EGL_KHR_image_base */ #ifndef EGL_KHR_image_pixmap #define EGL_KHR_image_pixmap 1 #endif /* EGL_KHR_image_pixmap */ #ifndef EGL_KHR_lock_surface #define EGL_KHR_lock_surface 1 #define EGL_READ_SURFACE_BIT_KHR 0x0001 #define EGL_WRITE_SURFACE_BIT_KHR 0x0002 #define EGL_LOCK_SURFACE_BIT_KHR 0x0080 #define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 #define EGL_MATCH_FORMAT_KHR 0x3043 #define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 #define EGL_FORMAT_RGB_565_KHR 0x30C1 #define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 #define EGL_FORMAT_RGBA_8888_KHR 0x30C3 #define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 #define EGL_LOCK_USAGE_HINT_KHR 0x30C5 #define EGL_BITMAP_POINTER_KHR 0x30C6 #define EGL_BITMAP_PITCH_KHR 0x30C7 #define EGL_BITMAP_ORIGIN_KHR 0x30C8 #define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 #define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA #define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB #define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC #define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD #define EGL_LOWER_LEFT_KHR 0x30CE #define EGL_UPPER_LEFT_KHR 0x30CF typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); #endif #endif /* EGL_KHR_lock_surface */ #ifndef EGL_KHR_lock_surface2 #define EGL_KHR_lock_surface2 1 #define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 #endif /* EGL_KHR_lock_surface2 */ #ifndef EGL_KHR_lock_surface3 #define EGL_KHR_lock_surface3 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); #endif #endif /* EGL_KHR_lock_surface3 */ #ifndef EGL_KHR_partial_update #define EGL_KHR_partial_update 1 #define EGL_BUFFER_AGE_KHR 0x313D typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_KHR_partial_update */ #ifndef EGL_KHR_platform_android #define EGL_KHR_platform_android 1 #define EGL_PLATFORM_ANDROID_KHR 0x3141 #endif /* EGL_KHR_platform_android */ #ifndef EGL_KHR_platform_gbm #define EGL_KHR_platform_gbm 1 #define EGL_PLATFORM_GBM_KHR 0x31D7 #endif /* EGL_KHR_platform_gbm */ #ifndef EGL_KHR_platform_wayland #define EGL_KHR_platform_wayland 1 #define EGL_PLATFORM_WAYLAND_KHR 0x31D8 #endif /* EGL_KHR_platform_wayland */ #ifndef EGL_KHR_platform_x11 #define EGL_KHR_platform_x11 1 #define EGL_PLATFORM_X11_KHR 0x31D5 #define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 #endif /* EGL_KHR_platform_x11 */ #ifndef EGL_KHR_reusable_sync #define EGL_KHR_reusable_sync 1 #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_STATUS_KHR 0x30F1 #define EGL_SIGNALED_KHR 0x30F2 #define EGL_UNSIGNALED_KHR 0x30F3 #define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 #define EGL_CONDITION_SATISFIED_KHR 0x30F6 #define EGL_SYNC_TYPE_KHR 0x30F7 #define EGL_SYNC_REUSABLE_KHR 0x30FA #define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 #define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull #define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_reusable_sync */ #ifndef EGL_KHR_stream #define EGL_KHR_stream 1 typedef void *EGLStreamKHR; typedef khronos_uint64_t EGLuint64KHR; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) #define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 #define EGL_PRODUCER_FRAME_KHR 0x3212 #define EGL_CONSUMER_FRAME_KHR 0x3213 #define EGL_STREAM_STATE_KHR 0x3214 #define EGL_STREAM_STATE_CREATED_KHR 0x3215 #define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 #define EGL_STREAM_STATE_EMPTY_KHR 0x3217 #define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 #define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 #define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A #define EGL_BAD_STREAM_KHR 0x321B #define EGL_BAD_STATE_KHR 0x321C typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_stream */ #ifndef EGL_KHR_stream_consumer_gltexture #define EGL_KHR_stream_consumer_gltexture 1 #ifdef EGL_KHR_stream #define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_consumer_gltexture */ #ifndef EGL_KHR_stream_cross_process_fd #define EGL_KHR_stream_cross_process_fd 1 typedef int EGLNativeFileDescriptorKHR; #ifdef EGL_KHR_stream #define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_cross_process_fd */ #ifndef EGL_KHR_stream_fifo #define EGL_KHR_stream_fifo 1 #ifdef EGL_KHR_stream #define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC #define EGL_STREAM_TIME_NOW_KHR 0x31FD #define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE #define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_fifo */ #ifndef EGL_KHR_stream_producer_aldatalocator #define EGL_KHR_stream_producer_aldatalocator 1 #ifdef EGL_KHR_stream #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_producer_aldatalocator */ #ifndef EGL_KHR_stream_producer_eglsurface #define EGL_KHR_stream_producer_eglsurface 1 #ifdef EGL_KHR_stream #define EGL_STREAM_BIT_KHR 0x0800 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_producer_eglsurface */ #ifndef EGL_KHR_surfaceless_context #define EGL_KHR_surfaceless_context 1 #endif /* EGL_KHR_surfaceless_context */ #ifndef EGL_KHR_swap_buffers_with_damage #define EGL_KHR_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_KHR_swap_buffers_with_damage */ #ifndef EGL_KHR_vg_parent_image #define EGL_KHR_vg_parent_image 1 #define EGL_VG_PARENT_IMAGE_KHR 0x30BA #endif /* EGL_KHR_vg_parent_image */ #ifndef EGL_KHR_wait_sync #define EGL_KHR_wait_sync 1 typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #endif #endif /* EGL_KHR_wait_sync */ #ifndef EGL_ANDROID_blob_cache #define EGL_ANDROID_blob_cache 1 typedef khronos_ssize_t EGLsizeiANDROID; typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #endif #endif /* EGL_ANDROID_blob_cache */ #ifndef EGL_ANDROID_framebuffer_target #define EGL_ANDROID_framebuffer_target 1 #define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 #endif /* EGL_ANDROID_framebuffer_target */ #ifndef EGL_ANDROID_image_native_buffer #define EGL_ANDROID_image_native_buffer 1 #define EGL_NATIVE_BUFFER_ANDROID 0x3140 #endif /* EGL_ANDROID_image_native_buffer */ #ifndef EGL_ANDROID_native_fence_sync #define EGL_ANDROID_native_fence_sync 1 #define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 #define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 #define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 #define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); #endif #endif /* EGL_ANDROID_native_fence_sync */ #ifndef EGL_ANDROID_recordable #define EGL_ANDROID_recordable 1 #define EGL_RECORDABLE_ANDROID 0x3142 #endif /* EGL_ANDROID_recordable */ #ifndef EGL_ANGLE_d3d_share_handle_client_buffer #define EGL_ANGLE_d3d_share_handle_client_buffer 1 #define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 #endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ #ifndef EGL_ANGLE_device_d3d #define EGL_ANGLE_device_d3d 1 #define EGL_D3D9_DEVICE_ANGLE 0x33A0 #define EGL_D3D11_DEVICE_ANGLE 0x33A1 #endif /* EGL_ANGLE_device_d3d */ #ifndef EGL_ANGLE_query_surface_pointer #define EGL_ANGLE_query_surface_pointer 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); #endif #endif /* EGL_ANGLE_query_surface_pointer */ #ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle #define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 #endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ #ifndef EGL_ANGLE_window_fixed_size #define EGL_ANGLE_window_fixed_size 1 #define EGL_FIXED_SIZE_ANGLE 0x3201 #endif /* EGL_ANGLE_window_fixed_size */ #ifndef EGL_ARM_pixmap_multisample_discard #define EGL_ARM_pixmap_multisample_discard 1 #define EGL_DISCARD_SAMPLES_ARM 0x3286 #endif /* EGL_ARM_pixmap_multisample_discard */ #ifndef EGL_EXT_buffer_age #define EGL_EXT_buffer_age 1 #define EGL_BUFFER_AGE_EXT 0x313D #endif /* EGL_EXT_buffer_age */ #ifndef EGL_EXT_client_extensions #define EGL_EXT_client_extensions 1 #endif /* EGL_EXT_client_extensions */ #ifndef EGL_EXT_create_context_robustness #define EGL_EXT_create_context_robustness 1 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 #define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF #endif /* EGL_EXT_create_context_robustness */ #ifndef EGL_EXT_device_base #define EGL_EXT_device_base 1 typedef void *EGLDeviceEXT; #define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) #define EGL_BAD_DEVICE_EXT 0x322B #define EGL_DEVICE_EXT 0x322C typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); #endif #endif /* EGL_EXT_device_base */ #ifndef EGL_EXT_device_drm #define EGL_EXT_device_drm 1 #define EGL_DRM_DEVICE_FILE_EXT 0x3233 #endif /* EGL_EXT_device_drm */ #ifndef EGL_EXT_device_enumeration #define EGL_EXT_device_enumeration 1 #endif /* EGL_EXT_device_enumeration */ #ifndef EGL_EXT_device_openwf #define EGL_EXT_device_openwf 1 #define EGL_OPENWF_DEVICE_ID_EXT 0x3237 #endif /* EGL_EXT_device_openwf */ #ifndef EGL_EXT_device_query #define EGL_EXT_device_query 1 #endif /* EGL_EXT_device_query */ #ifndef EGL_EXT_image_dma_buf_import #define EGL_EXT_image_dma_buf_import 1 #define EGL_LINUX_DMA_BUF_EXT 0x3270 #define EGL_LINUX_DRM_FOURCC_EXT 0x3271 #define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 #define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 #define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 #define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 #define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 #define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 #define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 #define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 #define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A #define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B #define EGL_SAMPLE_RANGE_HINT_EXT 0x327C #define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D #define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E #define EGL_ITU_REC601_EXT 0x327F #define EGL_ITU_REC709_EXT 0x3280 #define EGL_ITU_REC2020_EXT 0x3281 #define EGL_YUV_FULL_RANGE_EXT 0x3282 #define EGL_YUV_NARROW_RANGE_EXT 0x3283 #define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 #define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 #endif /* EGL_EXT_image_dma_buf_import */ #ifndef EGL_EXT_multiview_window #define EGL_EXT_multiview_window 1 #define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 #endif /* EGL_EXT_multiview_window */ #ifndef EGL_EXT_output_base #define EGL_EXT_output_base 1 typedef void *EGLOutputLayerEXT; typedef void *EGLOutputPortEXT; #define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0) #define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0) #define EGL_BAD_OUTPUT_LAYER_EXT 0x322D #define EGL_BAD_OUTPUT_PORT_EXT 0x322E #define EGL_SWAP_INTERVAL_EXT 0x322F typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); #endif #endif /* EGL_EXT_output_base */ #ifndef EGL_EXT_output_drm #define EGL_EXT_output_drm 1 #define EGL_DRM_CRTC_EXT 0x3234 #define EGL_DRM_PLANE_EXT 0x3235 #define EGL_DRM_CONNECTOR_EXT 0x3236 #endif /* EGL_EXT_output_drm */ #ifndef EGL_EXT_output_openwf #define EGL_EXT_output_openwf 1 #define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 #define EGL_OPENWF_PORT_ID_EXT 0x3239 #endif /* EGL_EXT_output_openwf */ #ifndef EGL_EXT_platform_base #define EGL_EXT_platform_base 1 typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); #endif #endif /* EGL_EXT_platform_base */ #ifndef EGL_EXT_platform_device #define EGL_EXT_platform_device 1 #define EGL_PLATFORM_DEVICE_EXT 0x313F #endif /* EGL_EXT_platform_device */ #ifndef EGL_EXT_platform_wayland #define EGL_EXT_platform_wayland 1 #define EGL_PLATFORM_WAYLAND_EXT 0x31D8 #endif /* EGL_EXT_platform_wayland */ #ifndef EGL_EXT_platform_x11 #define EGL_EXT_platform_x11 1 #define EGL_PLATFORM_X11_EXT 0x31D5 #define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 #endif /* EGL_EXT_platform_x11 */ #ifndef EGL_EXT_protected_surface #define EGL_EXT_protected_surface 1 #define EGL_PROTECTED_CONTENT_EXT 0x32C0 #endif /* EGL_EXT_protected_surface */ #ifndef EGL_EXT_stream_consumer_egloutput #define EGL_EXT_stream_consumer_egloutput 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); #endif #endif /* EGL_EXT_stream_consumer_egloutput */ #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_EXT_swap_buffers_with_damage */ #ifndef EGL_EXT_yuv_surface #define EGL_EXT_yuv_surface 1 #define EGL_YUV_ORDER_EXT 0x3301 #define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 #define EGL_YUV_SUBSAMPLE_EXT 0x3312 #define EGL_YUV_DEPTH_RANGE_EXT 0x3317 #define EGL_YUV_CSC_STANDARD_EXT 0x330A #define EGL_YUV_PLANE_BPP_EXT 0x331A #define EGL_YUV_BUFFER_EXT 0x3300 #define EGL_YUV_ORDER_YUV_EXT 0x3302 #define EGL_YUV_ORDER_YVU_EXT 0x3303 #define EGL_YUV_ORDER_YUYV_EXT 0x3304 #define EGL_YUV_ORDER_UYVY_EXT 0x3305 #define EGL_YUV_ORDER_YVYU_EXT 0x3306 #define EGL_YUV_ORDER_VYUY_EXT 0x3307 #define EGL_YUV_ORDER_AYUV_EXT 0x3308 #define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 #define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 #define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 #define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 #define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 #define EGL_YUV_CSC_STANDARD_601_EXT 0x330B #define EGL_YUV_CSC_STANDARD_709_EXT 0x330C #define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D #define EGL_YUV_PLANE_BPP_0_EXT 0x331B #define EGL_YUV_PLANE_BPP_8_EXT 0x331C #define EGL_YUV_PLANE_BPP_10_EXT 0x331D #endif /* EGL_EXT_yuv_surface */ #ifndef EGL_HI_clientpixmap #define EGL_HI_clientpixmap 1 struct EGLClientPixmapHI { void *pData; EGLint iWidth; EGLint iHeight; EGLint iStride; }; #define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); #endif #endif /* EGL_HI_clientpixmap */ #ifndef EGL_HI_colorformats #define EGL_HI_colorformats 1 #define EGL_COLOR_FORMAT_HI 0x8F70 #define EGL_COLOR_RGB_HI 0x8F71 #define EGL_COLOR_RGBA_HI 0x8F72 #define EGL_COLOR_ARGB_HI 0x8F73 #endif /* EGL_HI_colorformats */ #ifndef EGL_IMG_context_priority #define EGL_IMG_context_priority 1 #define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 #define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 #define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 #define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 #endif /* EGL_IMG_context_priority */ #ifndef EGL_MESA_drm_image #define EGL_MESA_drm_image 1 #define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 #define EGL_DRM_BUFFER_USE_MESA 0x31D1 #define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 #define EGL_DRM_BUFFER_MESA 0x31D3 #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 #define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); #endif #endif /* EGL_MESA_drm_image */ #ifndef EGL_MESA_image_dma_buf_export #define EGL_MESA_image_dma_buf_export 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); #endif #endif /* EGL_MESA_image_dma_buf_export */ #ifndef EGL_MESA_platform_gbm #define EGL_MESA_platform_gbm 1 #define EGL_PLATFORM_GBM_MESA 0x31D7 #endif /* EGL_MESA_platform_gbm */ #ifndef EGL_NOK_swap_region #define EGL_NOK_swap_region 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #endif #endif /* EGL_NOK_swap_region */ #ifndef EGL_NOK_swap_region2 #define EGL_NOK_swap_region2 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #endif #endif /* EGL_NOK_swap_region2 */ #ifndef EGL_NOK_texture_from_pixmap #define EGL_NOK_texture_from_pixmap 1 #define EGL_Y_INVERTED_NOK 0x307F #endif /* EGL_NOK_texture_from_pixmap */ #ifndef EGL_NV_3dvision_surface #define EGL_NV_3dvision_surface 1 #define EGL_AUTO_STEREO_NV 0x3136 #endif /* EGL_NV_3dvision_surface */ #ifndef EGL_NV_coverage_sample #define EGL_NV_coverage_sample 1 #define EGL_COVERAGE_BUFFERS_NV 0x30E0 #define EGL_COVERAGE_SAMPLES_NV 0x30E1 #endif /* EGL_NV_coverage_sample */ #ifndef EGL_NV_coverage_sample_resolve #define EGL_NV_coverage_sample_resolve 1 #define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 #define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 #define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 #endif /* EGL_NV_coverage_sample_resolve */ #ifndef EGL_NV_cuda_event #define EGL_NV_cuda_event 1 #define EGL_CUDA_EVENT_HANDLE_NV 0x323B #define EGL_SYNC_CUDA_EVENT_NV 0x323C #define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D #endif /* EGL_NV_cuda_event */ #ifndef EGL_NV_depth_nonlinear #define EGL_NV_depth_nonlinear 1 #define EGL_DEPTH_ENCODING_NV 0x30E2 #define EGL_DEPTH_ENCODING_NONE_NV 0 #define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 #endif /* EGL_NV_depth_nonlinear */ #ifndef EGL_NV_device_cuda #define EGL_NV_device_cuda 1 #define EGL_CUDA_DEVICE_NV 0x323A #endif /* EGL_NV_device_cuda */ #ifndef EGL_NV_native_query #define EGL_NV_native_query 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); #endif #endif /* EGL_NV_native_query */ #ifndef EGL_NV_post_convert_rounding #define EGL_NV_post_convert_rounding 1 #endif /* EGL_NV_post_convert_rounding */ #ifndef EGL_NV_post_sub_buffer #define EGL_NV_post_sub_buffer 1 #define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #endif #endif /* EGL_NV_post_sub_buffer */ #ifndef EGL_NV_stream_sync #define EGL_NV_stream_sync 1 #define EGL_SYNC_NEW_FRAME_NV 0x321F typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); #endif #endif /* EGL_NV_stream_sync */ #ifndef EGL_NV_sync #define EGL_NV_sync 1 typedef void *EGLSyncNV; typedef khronos_utime_nanoseconds_t EGLTimeNV; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 #define EGL_SYNC_STATUS_NV 0x30E7 #define EGL_SIGNALED_NV 0x30E8 #define EGL_UNSIGNALED_NV 0x30E9 #define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 #define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull #define EGL_ALREADY_SIGNALED_NV 0x30EA #define EGL_TIMEOUT_EXPIRED_NV 0x30EB #define EGL_CONDITION_SATISFIED_NV 0x30EC #define EGL_SYNC_TYPE_NV 0x30ED #define EGL_SYNC_CONDITION_NV 0x30EE #define EGL_SYNC_FENCE_NV 0x30EF #define EGL_NO_SYNC_NV ((EGLSyncNV)0) typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_NV_sync */ #ifndef EGL_NV_system_time #define EGL_NV_system_time 1 typedef khronos_utime_nanoseconds_t EGLuint64NV; #ifdef KHRONOS_SUPPORT_INT64 typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_NV_system_time */ #ifndef EGL_TIZEN_image_native_buffer #define EGL_TIZEN_image_native_buffer 1 #define EGL_NATIVE_BUFFER_TIZEN 0x32A0 #endif /* EGL_TIZEN_image_native_buffer */ #ifndef EGL_TIZEN_image_native_surface #define EGL_TIZEN_image_native_surface 1 #define EGL_NATIVE_SURFACE_TIZEN 0x32A1 #endif /* EGL_TIZEN_image_native_surface */ #ifdef __cplusplus } #endif #endif /* __eglext_h_ */ #endif /* _MSC_VER */
{ "pile_set_name": "Github" }