answer
stringlengths
15
1.25M
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_65) on Sun Mar 29 01:32:41 JST 2015 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class twitter4j.StatusAdapter (twitter4j-stream 4.0.3 API)</title> <meta name="date" content="2015-03-29"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class twitter4j.StatusAdapter (twitter4j-stream 4.0.3 API)"; } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../twitter4j/package-summary.html">Package</a></li> <li><a href="../../twitter4j/StatusAdapter.html" title="class in twitter4j">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?twitter4j/class-use/StatusAdapter.html" target="_top">Frames</a></li> <li><a href="StatusAdapter.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <h2 title="Uses of Class twitter4j.StatusAdapter" class="title">Uses of Class<br>twitter4j.StatusAdapter</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="twitter4j"> </a> <h3>Uses of <a href="../../twitter4j/StatusAdapter.html" title="class in twitter4j">StatusAdapter</a> in <a href="../../twitter4j/package-summary.html">twitter4j</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../twitter4j/StatusAdapter.html" title="class in twitter4j">StatusAdapter</a> in <a href="../../twitter4j/package-summary.html">twitter4j</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../twitter4j/UserStreamAdapter.html" title="class in twitter4j">UserStreamAdapter</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../../twitter4j/package-summary.html">Package</a></li> <li><a href="../../twitter4j/StatusAdapter.html" title="class in twitter4j">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?twitter4j/class-use/StatusAdapter.html" target="_top">Frames</a></li> <li><a href="StatusAdapter.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip-navbar_bottom"> </a></div> <p class="legalCopy"><small>Copyright & </body> </html>
package com.salesforce.androidsdk.smartstore.store; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.salesforce.androidsdk.smartstore.store.SmartStore.Type; /** * Simple class to represent index spec */ public class IndexSpec { public final String path; public final Type type; public final String columnName; public IndexSpec(String path, Type type) { this.path = path; this.type = type; this.columnName = null; // undefined } public IndexSpec(String path, Type type, String columnName) { this.path = path; this.type = type; this.columnName = columnName; } @Override public int hashCode() { int result = 17; result = 31 * result + path.hashCode(); result = 31 * result + type.hashCode(); if (columnName != null) result = 31 * result + columnName.hashCode(); return result; } @Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof IndexSpec)) return false; IndexSpec rhs = (IndexSpec) obj; boolean result = true; result = result && path.equals(rhs.path); result = result && type.equals(rhs.type); if (columnName == null) result = result && (columnName == rhs.columnName); else result = result && columnName.equals(rhs.columnName); return result; } /** * @return path | type */ public String getPathType() { return path + "|" + type; } /** * @return JSONObject for this IndexSpec * @throws JSONException */ public JSONObject toJSON() throws JSONException { JSONObject json = new JSONObject(); json.put("path", path); json.put("type", type); json.put("columnName", columnName); return json; } /** * @param indexSpecs * @return JSONArray for the array of IndexSpec's * @throws JSONException */ public static JSONArray toJSON(IndexSpec[] indexSpecs) throws JSONException { JSONArray json = new JSONArray(); for(IndexSpec indexSpec : indexSpecs) { json.put(indexSpec.toJSON()); } return json; } /** * @param jsonArray * @return IndexSpec[] from a JSONArray * @throws JSONException */ public static IndexSpec[] fromJSON(JSONArray jsonArray) throws JSONException { List<IndexSpec> list = new ArrayList<IndexSpec>(); for(int i=0; i<jsonArray.length(); i++) { list.add(IndexSpec.fromJSON(jsonArray.getJSONObject(i))); } return list.toArray(new IndexSpec[0]); } /** * Return IndexSpec given JSONObject * @param json * @return * @throws JSONException */ public static IndexSpec fromJSON(JSONObject json) throws JSONException { return new IndexSpec(json.getString("path"), Type.valueOf(json.getString("type")), json.optString("columnName")); } /** * @param indexSpecs * @return map index spec path to index spec */ public static Map<String, IndexSpec> mapForIndexSpecs(IndexSpec[] indexSpecs) { Map<String, IndexSpec> map = new HashMap<String, IndexSpec>(); for (IndexSpec indexSpec : indexSpecs) { map.put(indexSpec.path, indexSpec); } return map; } /** * @param indexSpecs * @return true if at least one of the indexSpec is of type full_text */ public static boolean hasFTS(IndexSpec[] indexSpecs) { for (IndexSpec indexSpec : indexSpecs) { if (indexSpec.type == Type.full_text) { return true; } } return false; } }
id: admin-api-tenants title: Managing Tenants sidebar_label: "Tenants" original_id: admin-api-tenants import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; > **Important** > > This page only shows **some frequently used operations**. > > - For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](https://pulsar.apache.org/tools/pulsar-admin/). > > - For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc. > > - For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](https://pulsar.apache.org/api/admin/). Tenants, like namespaces, can be managed using the [admin API](admin-api-overview). There are currently two configurable aspects of tenants: * Admin roles * Allowed clusters ## Tenant resources List You can list all of the tenants associated with an [instance](<API key>.md#instance). <Tabs defaultValue="pulsar-admin" values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"JAVA","value":"JAVA"}]}> <TabItem value="pulsar-admin"> Use the [`list`](<API key>.md#tenants-list) subcommand. shell $ pulsar-admin tenants list my-tenant-1 my-tenant-2 </TabItem> <TabItem value="REST API"> {@inject: endpoint|GET|/admin/v2/tenants|operation/getTenants?version=@pulsar:version_number@} </TabItem> <TabItem value="JAVA"> java admin.tenants().getTenants(); </TabItem> </Tabs> Create You can create a new tenant. <Tabs defaultValue="pulsar-admin" values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"JAVA","value":"JAVA"}]}> <TabItem value="pulsar-admin"> Use the [`create`](<API key>.md#tenants-create) subcommand: shell $ pulsar-admin tenants create my-tenant When creating a tenant, you can assign admin roles using the `-r`/`--admin-roles` flag. You can specify multiple roles as a comma-separated list. Here are some examples: shell $ pulsar-admin tenants create my-tenant \ --admin-roles role1,role2,role3 $ pulsar-admin tenants create my-tenant \ -r role1 </TabItem> <TabItem value="REST API"> {@inject: endpoint|POST|/admin/v2/tenants/:tenant|operation/createTenant?version=@pulsar:version_number@} </TabItem> <TabItem value="JAVA"> java admin.tenants().createTenant(tenantName, tenantInfo); </TabItem> </Tabs> Get configuration You can fetch the [configuration](<API key>) for an existing tenant at any time. <Tabs defaultValue="pulsar-admin" values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"JAVA","value":"JAVA"}]}> <TabItem value="pulsar-admin"> Use the [`get`](<API key>.md#tenants-get) subcommand and specify the name of the tenant. Here's an example: shell $ pulsar-admin tenants get my-tenant { "adminRoles": [ "admin1", "admin2" ], "allowedClusters": [ "cl1", "cl2" ] } </TabItem> <TabItem value="REST API"> {@inject: endpoint|GET|/admin/v2/tenants/:cluster|operation/getTenant?version=@pulsar:version_number@} </TabItem> <TabItem value="JAVA"> java admin.tenants().getTenantInfo(tenantName); </TabItem> </Tabs> Delete Tenants can be deleted from a Pulsar [instance](<API key>.md#instance). <Tabs defaultValue="pulsar-admin" values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"JAVA","value":"JAVA"}]}> <TabItem value="pulsar-admin"> Use the [`delete`](<API key>.md#tenants-delete) subcommand and specify the name of the tenant. shell $ pulsar-admin tenants delete my-tenant </TabItem> <TabItem value="REST API"> {@inject: endpoint|DELETE|/admin/v2/tenants/:cluster|operation/deleteTenant?version=@pulsar:version_number@} </TabItem> <TabItem value="JAVA"> java admin.Tenants().deleteTenant(tenantName); </TabItem> </Tabs> Update You can update a tenant's configuration. <Tabs defaultValue="pulsar-admin" values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"JAVA","value":"JAVA"}]}> <TabItem value="pulsar-admin"> Use the [`update`](<API key>.md#tenants-update) subcommand. shell $ pulsar-admin tenants update my-tenant </TabItem> <TabItem value="REST API"> {@inject: endpoint|DELETE|/admin/v2/tenants/:cluster|operation/updateTenant?version=@pulsar:version_number@} </TabItem> <TabItem value="JAVA"> java admin.tenants().updateTenant(tenantName, tenantInfo); </TabItem> </Tabs>
#!/bin/sh # $log:$ V_DATABASE=${DATABASE:-"tpcds"} # name of the database to be create V_DBMS=${DBMS:-"db2"} # dbms flavor to use # must match xx_setup.sh file name V_DATA_DIR=${DATA_DIR:-"/data"} # flat file directory if [ ! -f ${V_DBMS}_setup.sh ] then echo "Cannot find setup file for DBMS: ${V_DBMS}_setup.sh" exit 1 fi . ${V_DBMS}_setup.sh connect_to $V_DATABASE cd temp_build if [ -f FAILED ] then exit fi if [ -z "$1" ] then <API key> tpcds_ri.sql else run_query $V_DATABASE tpcds_ri.sql <API key> tpcds_ri.sql fi
$(function(){ <API key> = "/static/WebSocketMain.swf"; WEB_SOCKET_DEBUG = true; var socket = io.connect(); socket.on('connect', function(){ console.log('connected'); }); $(window).bind("beforeunload", function() { socket.disconnect(); }); var User = Backbone.Model.extend({ urlRoot: '/user', }); var Topic = Backbone.Model.extend({ urlRoot: '/topic', }); var Message = Backbone.Model.extend({ urlRoot: '/message', sync: function(method, model, options) { if (method === 'create') { socket.emit('message', model.attributes); $('#comment').val(''); } else { return Backbone.sync(method, model, options); }; }, }); var Topics = Backbone.Collection.extend({ url: '/topic', model: Topic, }); var Messages = Backbone.Collection.extend({ url: '/message', model: Message, }); var topics = new Topics; var TopicView = Backbone.View.extend({ tagName: "div class='column'", templ: _.template($('#topic-template').html()), render: function() { $(this.el).html(this.templ(this.model.toJSON())); return this; }, }); var messages = new Messages; var MessageView = Backbone.View.extend({ tagName: "div class='comment'", templ: _.template($('#message-template').html()), render: function() { $(this.el).html(this.templ(this.model.toJSON())); return this; }, }); var AppView = Backbone.View.extend({ el: "#main", topic_list: $("#topic_list"), topic_section: $("#topic_section"), message_section: $("#message_section"), message_list: $("#message_list"), message_head: $("#message_head"), events: { 'click .submit': 'saveMessage', 'click .submit_topic': 'saveTopic', 'keypress #comment': 'saveMessageEvent', }, initialize: function() { _.bindAll(this, 'addTopic', 'addMessage'); topics.bind('add', this.addTopic); // topicmessage collection this.message_pool = {}; this.socket = null; this.message_list_div = document.getElementById('message_list'); }, addTopic: function(topic) { var view = new TopicView({model: topic}); this.topic_list.append(view.render().el); }, addMessage: function(message) { var view = new MessageView({model: message}); this.message_list.append(view.render().el); self.message_list.scrollTop(self.message_list_div.scrollHeight); }, saveMessageEvent: function(evt) { if (evt.keyCode == 13) { this.saveMessage(evt); } }, saveMessage: function(evt) { var comment_box = $('#comment') var content = comment_box.val(); if (content == '') { alert(''); return false; } var topic_id = comment_box.attr('topic_id'); var message = new Message({ content: content, topic_id: topic_id, }); var messages = this.message_pool[topic_id]; message.save(); // sync }, saveTopic: function(evt) { var topic_title = $('#topic_title'); if (topic_title.val() == '') { alert(''); return false } var topic = new Topic({ title: topic_title.val(), }); self = this; topic.save(null, { success: function(model, response, options){ topics.add(response); topic_title.val(''); }, error: function(model, resp, options) { alert(resp.responseText); } }); }, showTopic: function(){ topics.fetch(); this.topic_section.show(); this.message_section.hide(); this.message_list.html(''); this.goOut() }, goOut: function(){ socket.emit('go_out'); socket.removeAllListeners('message'); }, initMessage: function(topic_id) { var messages = new Messages; messages.bind('add', this.addMessage); this.message_pool[topic_id] = messages; }, showMessage: function(topic_id) { this.initMessage(topic_id); this.message_section.show(); this.topic_section.hide(); this.showMessageHead(topic_id); $('#comment').attr('topic_id', topic_id); var messages = this.message_pool[topic_id]; socket.emit('topic', topic_id); // messagemessages socket.on('message', function(response) { messages.add(response); }); messages.fetch({ data: {topic_id: topic_id}, success: function(resp) { self.message_list.scrollTop(self.message_list_div.scrollHeight) }, error: function(model, resp, options) { alert(resp.responseText); } }); }, showMessageHead: function(topic_id) { var topic = new Topic({id: topic_id}); self = this; topic.fetch({ success: function(resp, model, options){ self.message_head.html(model.title); }, error: function(model, resp, options) { alert(resp.responseText); } }); }, }); var LoginView = Backbone.View.extend({ el: "#login", wrapper: $('#wrapper'), events: { 'keypress #login_pwd': 'loginEvent', 'click .login_submit': 'login', 'keypress #reg_pwd_repeat': 'registeEvent', 'click .registe_submit': 'registe', }, hide: function() { this.wrapper.hide(); }, show: function() { this.wrapper.show(); }, loginEvent: function(evt) { if (evt.keyCode == 13) { this.login(evt); } }, login: function(evt){ var username_input = $('#login_username'); var pwd_input = $('#login_pwd'); var u = new User({ username: username_input.val(), password: pwd_input.val(), }); u.save(null, { url: '/login', success: function(model, resp, options){ g_user = resp; // index appRouter.navigate('index', {trigger: true}); }, error: function(model, resp, options) { alert(resp.responseText); } }); }, registeEvent: function(evt) { if (evt.keyCode == 13) { this.registe(evt); } }, registe: function(evt){ var reg_username_input = $('#reg_username'); var reg_pwd_input = $('#reg_pwd'); var <API key> = $('#reg_pwd_repeat'); var u = new User({ username: reg_username_input.val(), password: reg_pwd_input.val(), password_repeat: <API key>.val(), }); u.save(null, { success: function(model, resp, options){ g_user = resp; // index appRouter.navigate('index', {trigger: true}); }, error: function(model, resp, options) { alert(resp.responseText); } }); }, }); var UserView = Backbone.View.extend({ el: "#user_info", username: $('#username'), show: function(username) { this.username.html(username); this.$el.show(); }, }); var AppRouter = Backbone.Router.extend({ routes: { "login": "login", "index": "index", "topic/:id" : "topic", }, initialize: function(){ this.appView = new AppView(); this.loginView = new LoginView(); this.userView = new UserView(); this.indexFlag = false; }, login: function(){ this.loginView.show(); }, index: function(){ if (g_user && g_user.id != undefined) { this.appView.showTopic(); this.userView.show(g_user.username); this.loginView.hide(); this.indexFlag = true; } }, topic: function(topic_id) { if (g_user && g_user.id != undefined) { this.appView.showMessage(topic_id); this.userView.show(g_user.username); this.loginView.hide(); this.indexFlag = true; } }, }); var appRouter = new AppRouter(); var g_user = new User; g_user.fetch({ success: function(model, resp, options){ g_user = resp; Backbone.history.start({pustState: true}); if(g_user === null || g_user.id === undefined) { appRouter.navigate('login', {trigger: true}); } else if (appRouter.indexFlag == false){ appRouter.navigate('index', {trigger: true}); } }, error: function(model, resp, options) { alert(resp.responseText); } }); });
<?php namespace metastore; /** * Autogenerated by Thrift Compiler (0.14.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ use Thrift\Base\TBase; use Thrift\Type\TType; use Thrift\Type\TMessageType; use Thrift\Exception\TException; use Thrift\Exception\TProtocolException; use Thrift\Protocol\TProtocol; use Thrift\Protocol\<API key>; use Thrift\Exception\<API key>; class <API key> { static public $isValidate = false; static public $_TSPEC = array( 1 => array( 'var' => 'request', 'isRequired' => false, 'type' => TType::STRUCT, 'class' => '\metastore\WMCreatePoolRequest', ), ); /** * @var \metastore\WMCreatePoolRequest */ public $request = null; public function __construct($vals = null) { if (is_array($vals)) { if (isset($vals['request'])) { $this->request = $vals['request']; } } } public function getName() { return '<API key>'; } public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 1: if ($ftype == TType::STRUCT) { $this->request = new \metastore\WMCreatePoolRequest(); $xfer += $this->request->read($input); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; } public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('<API key>'); if ($this->request !== null) { if (!is_object($this->request)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('request', TType::STRUCT, 1); $xfer += $this->request->write($output); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; } }
/** * \file cyip_crypto.h * * \brief * CRYPTO IP definitions * * \note * Generator version: 1.3.0.1146 * Database revision: rev#1050929 * ******************************************************************************** * \copyright * Copyright 2016-2018, Cypress Semiconductor Corporation. All rights reserved. * <API key>: Apache-2.0 *******************************************************************************/ #ifndef _CYIP_CRYPTO_H_ #define _CYIP_CRYPTO_H_ #include "cyip_headers.h" #define CRYPTO_SECTION_SIZE 0x00010000UL /** * \brief Cryptography component (CRYPTO) */ typedef struct { __IOM uint32_t CTL; /*!< 0x00000000 Control */ __IM uint32_t STATUS; /*!< 0x00000004 Status */ __IOM uint32_t RAM_PWRUP_DELAY; /*!< 0x00000008 Power up delay used for SRAM power domain */ __IM uint32_t RESERVED[5]; __IM uint32_t ERROR_STATUS0; /*!< 0x00000020 Error status 0 */ __IOM uint32_t ERROR_STATUS1; /*!< 0x00000024 Error status 1 */ __IM uint32_t RESERVED1[6]; __IOM uint32_t INSTR_FF_CTL; /*!< 0x00000040 Instruction FIFO control */ __IM uint32_t INSTR_FF_STATUS; /*!< 0x00000044 Instruction FIFO status */ __OM uint32_t INSTR_FF_WR; /*!< 0x00000048 Instruction FIFO write */ __IM uint32_t RESERVED2[13]; __IM uint32_t RF_DATA[16]; /*!< 0x00000080 Register-file */ __IM uint32_t RESERVED3[16]; __IOM uint32_t AES_CTL; /*!< 0x00000100 AES control */ __IM uint32_t RESERVED4[31]; __IM uint32_t STR_RESULT; /*!< 0x00000180 String result */ __IM uint32_t RESERVED5[31]; __IOM uint32_t PR_LFSR_CTL0; /*!< 0x00000200 Pseudo random LFSR control 0 */ __IOM uint32_t PR_LFSR_CTL1; /*!< 0x00000204 Pseudo random LFSR control 1 */ __IOM uint32_t PR_LFSR_CTL2; /*!< 0x00000208 Pseudo random LFSR control 2 */ __IM uint32_t RESERVED6; __IOM uint32_t PR_RESULT; /*!< 0x00000210 Pseudo random result */ __IM uint32_t RESERVED7[27]; __IOM uint32_t TR_CTL0; /*!< 0x00000280 True random control 0 */ __IOM uint32_t TR_CTL1; /*!< 0x00000284 True random control 1 */ __IOM uint32_t TR_RESULT; /*!< 0x00000288 True random result */ __IM uint32_t RESERVED8[5]; __IOM uint32_t TR_GARO_CTL; /*!< 0x000002A0 True random GARO control */ __IOM uint32_t TR_FIRO_CTL; /*!< 0x000002A4 True random FIRO control */ __IM uint32_t RESERVED9[6]; __IOM uint32_t TR_MON_CTL; /*!< 0x000002C0 True random monitor control */ __IM uint32_t RESERVED10; __IOM uint32_t TR_MON_CMD; /*!< 0x000002C8 True random monitor command */ __IM uint32_t RESERVED11; __IOM uint32_t TR_MON_RC_CTL; /*!< 0x000002D0 True random monitor RC control */ __IM uint32_t RESERVED12; __IM uint32_t TR_MON_RC_STATUS0; /*!< 0x000002D8 True random monitor RC status 0 */ __IM uint32_t TR_MON_RC_STATUS1; /*!< 0x000002DC True random monitor RC status 1 */ __IOM uint32_t TR_MON_AP_CTL; /*!< 0x000002E0 True random monitor AP control */ __IM uint32_t RESERVED13; __IM uint32_t TR_MON_AP_STATUS0; /*!< 0x000002E8 True random monitor AP status 0 */ __IM uint32_t TR_MON_AP_STATUS1; /*!< 0x000002EC True random monitor AP status 1 */ __IM uint32_t RESERVED14[4]; __IOM uint32_t SHA_CTL; /*!< 0x00000300 SHA control */ __IM uint32_t RESERVED15[63]; __IOM uint32_t CRC_CTL; /*!< 0x00000400 CRC control */ __IM uint32_t RESERVED16[3]; __IOM uint32_t CRC_DATA_CTL; /*!< 0x00000410 CRC data control */ __IM uint32_t RESERVED17[3]; __IOM uint32_t CRC_POL_CTL; /*!< 0x00000420 CRC polynomial control */ __IM uint32_t RESERVED18[3]; __IOM uint32_t CRC_LFSR_CTL; /*!< 0x00000430 CRC LFSR control */ __IM uint32_t RESERVED19[3]; __IOM uint32_t CRC_REM_CTL; /*!< 0x00000440 CRC remainder control */ __IM uint32_t RESERVED20; __IM uint32_t CRC_REM_RESULT; /*!< 0x00000448 CRC remainder result */ __IM uint32_t RESERVED21[13]; __IOM uint32_t VU_CTL0; /*!< 0x00000480 Vector unit control 0 */ __IOM uint32_t VU_CTL1; /*!< 0x00000484 Vector unit control 1 */ __IM uint32_t RESERVED22[2]; __IM uint32_t VU_STATUS; /*!< 0x00000490 Vector unit status */ __IM uint32_t RESERVED23[203]; __IOM uint32_t INTR; /*!< 0x000007C0 Interrupt register */ __IOM uint32_t INTR_SET; /*!< 0x000007C4 Interrupt set register */ __IOM uint32_t INTR_MASK; /*!< 0x000007C8 Interrupt mask register */ __IM uint32_t INTR_MASKED; /*!< 0x000007CC Interrupt masked register */ __IM uint32_t RESERVED24[3596]; __IOM uint32_t MEM_BUFF[4096]; /*!< 0x00004000 Memory buffer */ } CRYPTO_V1_Type; /*!< Size = 32768 (0x8000) */ /* CRYPTO.CTL */ #define <API key> 0UL #define <API key> 0x3UL #define <API key> 31UL #define <API key> 0x80000000UL /* CRYPTO.STATUS */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 5UL #define <API key> 0x20UL #define <API key> 6UL #define <API key> 0x40UL #define <API key> 7UL #define <API key> 0x80UL #define <API key> 31UL #define <API key> 0x80000000UL /* CRYPTO.RAM_PWRUP_DELAY */ #define <API key> 0UL #define <API key> 0x3FFUL /* CRYPTO.ERROR_STATUS0 */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.ERROR_STATUS1 */ #define <API key> 0UL #define <API key> 0xFFFFFFUL #define <API key> 24UL #define <API key> 0x7000000UL #define <API key> 31UL #define <API key> 0x80000000UL /* CRYPTO.INSTR_FF_CTL */ #define <API key> 0UL #define <API key> 0x7UL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 17UL #define <API key> 0x20000UL /* CRYPTO.INSTR_FF_STATUS */ #define <API key> 0UL #define <API key> 0xFUL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 31UL #define <API key> 0x80000000UL /* CRYPTO.INSTR_FF_WR */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.RF_DATA */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.AES_CTL */ #define <API key> 0UL #define <API key> 0x3UL /* CRYPTO.STR_RESULT */ #define <API key> 0UL #define <API key> 0x1UL /* CRYPTO.PR_LFSR_CTL0 */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.PR_LFSR_CTL1 */ #define <API key> 0UL #define <API key> 0x7FFFFFFFUL /* CRYPTO.PR_LFSR_CTL2 */ #define <API key> 0UL #define <API key> 0x1FFFFFFFUL /* CRYPTO.PR_RESULT */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.TR_CTL0 */ #define <API key> 0UL #define <API key> 0xFFUL #define <API key> 8UL #define <API key> 0xFF00UL #define <API key> 16UL #define <API key> 0xFF0000UL #define <API key> 24UL #define <API key> 0x1000000UL #define <API key> 28UL #define <API key> 0x10000000UL #define <API key> 29UL #define <API key> 0x20000000UL /* CRYPTO.TR_CTL1 */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 5UL #define <API key> 0x20UL /* CRYPTO.TR_RESULT */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.TR_GARO_CTL */ #define <API key> 0UL #define <API key> 0x7FFFFFFFUL /* CRYPTO.TR_FIRO_CTL */ #define <API key> 0UL #define <API key> 0x7FFFFFFFUL /* CRYPTO.TR_MON_CTL */ #define <API key> 0UL #define <API key> 0x3UL /* CRYPTO.TR_MON_CMD */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL /* CRYPTO.TR_MON_RC_CTL */ #define <API key> 0UL #define <API key> 0xFFUL /* CRYPTO.TR_MON_RC_STATUS0 */ #define <API key> 0UL #define <API key> 0x1UL /* CRYPTO.TR_MON_RC_STATUS1 */ #define <API key> 0UL #define <API key> 0xFFUL /* CRYPTO.TR_MON_AP_CTL */ #define <API key> 0UL #define <API key> 0xFFFFUL #define <API key> 16UL #define <API key> 0xFFFF0000UL /* CRYPTO.TR_MON_AP_STATUS0 */ #define <API key> 0UL #define <API key> 0x1UL /* CRYPTO.TR_MON_AP_STATUS1 */ #define <API key> 0UL #define <API key> 0xFFFFUL #define <API key> 16UL #define <API key> 0xFFFF0000UL /* CRYPTO.SHA_CTL */ #define <API key> 0UL #define <API key> 0x7UL /* CRYPTO.CRC_CTL */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 8UL #define <API key> 0x100UL /* CRYPTO.CRC_DATA_CTL */ #define <API key> 0UL #define <API key> 0xFFUL /* CRYPTO.CRC_POL_CTL */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.CRC_LFSR_CTL */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.CRC_REM_CTL */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.CRC_REM_RESULT */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL /* CRYPTO.VU_CTL0 */ #define <API key> 0UL #define <API key> 0x1UL /* CRYPTO.VU_CTL1 */ #define <API key> 14UL #define <API key> 0xFFFFC000UL /* CRYPTO.VU_STATUS */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL /* CRYPTO.INTR */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 17UL #define <API key> 0x20000UL #define <API key> 18UL #define <API key> 0x40000UL #define <API key> 19UL #define <API key> 0x80000UL #define <API key> 20UL #define <API key> 0x100000UL /* CRYPTO.INTR_SET */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 17UL #define <API key> 0x20000UL #define <API key> 18UL #define <API key> 0x40000UL #define <API key> 19UL #define <API key> 0x80000UL #define <API key> 20UL #define <API key> 0x100000UL /* CRYPTO.INTR_MASK */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 17UL #define <API key> 0x20000UL #define <API key> 18UL #define <API key> 0x40000UL #define <API key> 19UL #define <API key> 0x80000UL #define <API key> 20UL #define <API key> 0x100000UL /* CRYPTO.INTR_MASKED */ #define <API key> 0UL #define <API key> 0x1UL #define <API key> 1UL #define <API key> 0x2UL #define <API key> 2UL #define <API key> 0x4UL #define <API key> 3UL #define <API key> 0x8UL #define <API key> 4UL #define <API key> 0x10UL #define <API key> 16UL #define <API key> 0x10000UL #define <API key> 17UL #define <API key> 0x20000UL #define <API key> 18UL #define <API key> 0x40000UL #define <API key> 19UL #define <API key> 0x80000UL #define <API key> 20UL #define <API key> 0x100000UL /* CRYPTO.MEM_BUFF */ #define <API key> 0UL #define <API key> 0xFFFFFFFFUL #endif /* _CYIP_CRYPTO_H_ */ /* [] END OF FILE */
package com.vaadin.tests.elements.abstracttextfield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.AbstractField; import com.vaadin.ui.AbstractMultiSelect; import com.vaadin.ui.<API key>; import com.vaadin.ui.CheckBox; import com.vaadin.ui.CheckBoxGroup; import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField; import com.vaadin.ui.ListSelect; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.PasswordField; import com.vaadin.ui.RadioButtonGroup; import com.vaadin.ui.RichTextArea; import com.vaadin.ui.Slider; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.TwinColSelect; public class <API key> extends AbstractTestUI { private AbstractField<?>[] fields = { new TextArea(), new TextField(), new DateField(), new PasswordField(), new CheckBox(), new RichTextArea(), new Slider() }; private AbstractMultiSelect<?>[] multiSelects = { new ListSelect(), new CheckBoxGroup(), new TwinColSelect() }; private <API key><?>[] singleSelects = { new ComboBox(), new NativeSelect(), new RadioButtonGroup() }; @Override protected void setup(VaadinRequest request) { for (AbstractField field : fields) { field.setReadOnly(true); addComponent(field); } for (AbstractMultiSelect multiSelect : multiSelects) { multiSelect.setReadOnly(true); addComponent(multiSelect); } for (<API key> singleSelect : singleSelects) { singleSelect.setReadOnly(true); addComponent(singleSelect); } } @Override protected String getTestDescription() { return "When vaadin element is set ReadOnly, setValue() method should raise an exception"; } @Override protected Integer getTicketNumber() { return 14068; } }
// UriSection.cs // Authors: // Gonzalo Paniagua Javier (gonzalo@novell.com) // 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, // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // included in all copies or substantial portions of the Software. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // 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. #if CONFIGURATION_DEP using System.Configuration; namespace System.Configuration { public sealed class UriSection : <API key> { #region Fields static <API key> properties; static <API key> idn_prop; static <API key> iriParsing_prop; #endregion // Fields #region Constructors static UriSection () { idn_prop = new <API key> ("idn", typeof (IdnElement), null); iriParsing_prop = new <API key> ( "iriParsing", typeof (IriParsingElement), null); properties = new <API key> (); properties.Add (idn_prop); properties.Add (iriParsing_prop); } public UriSection () { } #endregion // Constructors #region Properties [<API key> ("idn")] public IdnElement Idn { get { return (IdnElement) base [idn_prop]; } } [<API key> ("iriParsing")] public IriParsingElement IriParsing { get { return (IriParsingElement) base [iriParsing_prop]; } } protected override <API key> Properties { get { return properties; } } #endregion // Properties } } #endif
package org.batfish.datamodel.vendor_family.juniper; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.annotations.VisibleForTesting; import java.io.Serializable; import java.util.Collections; import java.util.SortedMap; import java.util.TreeMap; import org.batfish.datamodel.Aaa<API key>; import org.batfish.datamodel.<API key>; import org.batfish.datamodel.Line; public class JuniperFamily implements Serializable { private static final String PROP_LINES = "lines"; private static final String PROP_ROOT_<API key> = "root<API key>; private static final String PROP_SYSTEM_<API key> = "<API key>"; private static final String <API key> = "tacplusServers"; @VisibleForTesting public static final String CONSOLE_LINE_NAME = "console"; @VisibleForTesting public static final String AUXILIARY_LINE_NAME = "auxiliary"; private SortedMap<String, Line> _lines; private String _root<API key>; private Aaa<API key> <API key>; private SortedMap<String, TacplusServer> _tacplusServers; public JuniperFamily() { _lines = new TreeMap<>(); _tacplusServers = new TreeMap<>(); <API key> = // default authentication order is just password authentication new Aaa<API key>( Collections.singletonList(<API key>.PASSWORD), true); // Juniper has by default the console and aux lines enabled Line console = new Line(CONSOLE_LINE_NAME); console.setAaa<API key>(<API key>); _lines.put(CONSOLE_LINE_NAME, console); Line aux = new Line(AUXILIARY_LINE_NAME); aux.setAaa<API key>(<API key>); _lines.put(AUXILIARY_LINE_NAME, aux); } @JsonProperty(PROP_LINES) public SortedMap<String, Line> getLines() { return _lines; } @JsonProperty(PROP_ROOT_<API key>) public String getRoot<API key>() { return _root<API key>; } @JsonProperty(PROP_SYSTEM_<API key>) public Aaa<API key> <API key>() { return <API key>; } @JsonProperty(<API key>) public SortedMap<String, TacplusServer> getTacplusServers() { return _tacplusServers; } @JsonProperty(PROP_LINES) public void setLines(SortedMap<String, Line> lines) { _lines = lines; } @JsonProperty(PROP_ROOT_<API key>) public void setRoot<API key>(String root<API key>) { _root<API key> = root<API key>; } @JsonProperty(PROP_SYSTEM_<API key>) public void <API key>(Aaa<API key> authenticationOrder) { <API key> = authenticationOrder; } @JsonProperty(<API key>) public void setTacplusServers(SortedMap<String, TacplusServer> tacplusServers) { _tacplusServers = tacplusServers; } }
package client import ( "runtime" "text/template" "time" "github.com/docker/docker/api" "github.com/docker/docker/api/types" Cli "github.com/docker/docker/cli" "github.com/docker/docker/dockerversion" flag "github.com/docker/docker/pkg/mflag" "github.com/docker/docker/utils" ) var versionTemplate = `Client: Version: {{.Client.Version}} API version: {{.Client.APIVersion}} Go version: {{.Client.GoVersion}} Git commit: {{.Client.GitCommit}} Built: {{.Client.BuildTime}} OS/Arch: {{.Client.Os}}/{{.Client.Arch}}{{if .Client.Experimental}} Experimental: {{.Client.Experimental}}{{end}}{{if .ServerOK}} Server: Version: {{.Server.Version}} API version: {{.Server.APIVersion}} Go version: {{.Server.GoVersion}} Git commit: {{.Server.GitCommit}} Built: {{.Server.BuildTime}} OS/Arch: {{.Server.Os}}/{{.Server.Arch}}{{if .Server.Experimental}} Experimental: {{.Server.Experimental}}{{end}}{{end}}` // CmdVersion shows Docker version information. // Available version information is shown for: client Docker version, client API version, client Go version, client Git commit, client OS/Arch, server Docker version, server API version, server Go version, server Git commit, and server OS/Arch. // Usage: docker version func (cli *DockerCli) CmdVersion(args ...string) (err error) { cmd := Cli.Subcmd("version", nil, Cli.DockerCommands["version"].Description, true) tmplStr := cmd.String([]string{"f", "#format", "-format"}, "", "Format the output using the given go template") cmd.Require(flag.Exact, 0) cmd.ParseFlags(args, true) templateFormat := versionTemplate if *tmplStr != "" { templateFormat = *tmplStr } var tmpl *template.Template if tmpl, err = template.New("").Funcs(funcMap).Parse(templateFormat); err != nil { return Cli.StatusError{StatusCode: 64, Status: "Template parsing error: " + err.Error()} } vd := types.VersionResponse{ Client: &types.Version{ Version: dockerversion.Version, APIVersion: api.Version, GoVersion: runtime.Version(), GitCommit: dockerversion.GitCommit, BuildTime: dockerversion.BuildTime, Os: runtime.GOOS, Arch: runtime.GOARCH, Experimental: utils.ExperimentalBuild(), }, } serverVersion, err := cli.client.ServerVersion() if err == nil { vd.Server = &serverVersion } // first we need to make BuildTime more human friendly t, errTime := time.Parse(time.RFC3339Nano, vd.Client.BuildTime) if errTime == nil { vd.Client.BuildTime = t.Format(time.ANSIC) } if vd.ServerOK() { t, errTime = time.Parse(time.RFC3339Nano, vd.Server.BuildTime) if errTime == nil { vd.Server.BuildTime = t.Format(time.ANSIC) } } if err2 := tmpl.Execute(cli.out, vd); err2 != nil && err == nil { err = err2 } cli.out.Write([]byte{'\n'}) return err }
"format cjs"; observableProto.sequenceEqual = function (second, comparer) { var first = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var donel = false, doner = false, ql = [], qr = []; var subscription1 = first.subscribe(function (x) { var equal, v; if (qr.length > 0) { v = qr.shift(); try { equal = comparer(v, x); } catch (e) { o.onError(e); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (doner) { o.onNext(false); o.onCompleted(); } else { ql.push(x); } }, function(e) { o.onError(e); }, function () { donel = true; if (ql.length === 0) { if (qr.length > 0) { o.onNext(false); o.onCompleted(); } else if (doner) { o.onNext(true); o.onCompleted(); } } }); (isArrayLike(second) || isIterable(second)) && (second = observableFrom(second)); isPromise(second) && (second = <API key>(second)); var subscription2 = second.subscribe(function (x) { var equal; if (ql.length > 0) { var v = ql.shift(); try { equal = comparer(v, x); } catch (exception) { o.onError(exception); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (donel) { o.onNext(false); o.onCompleted(); } else { qr.push(x); } }, function(e) { o.onError(e); }, function () { doner = true; if (qr.length === 0) { if (ql.length > 0) { o.onNext(false); o.onCompleted(); } else if (donel) { o.onNext(true); o.onCompleted(); } } }); return new CompositeDisposable(subscription1, subscription2); }, first); };
/** * Entries which are stored in data containers. This package contains different implementations of * entries based on the information needed to store an entry. Certain entries need more information - such as timestamps * and lifespans, if they are used - than others, and the appropriate implementation is selected dynamically. This * helps minimize Infinispan's memory requirements without storing unnecessary metadata. */ package org.infinispan.container.entries;
from django.conf.urls import url from admin.nodes import views app_name = 'admin' urlpatterns = [ url(r'^$', views.NodeFormView.as_view(), name='search'), url(r'^flagged_spam$', views.NodeFlaggedSpamList.as_view(), name='flagged-spam'), url(r'^known_spam$', views.NodeKnownSpamList.as_view(), name='known-spam'), url(r'^known_ham$', views.NodeKnownHamList.as_view(), name='known-ham'), url(r'^(?P<guid>[a-z0-9]+)/$', views.NodeView.as_view(), name='node'), url(r'^(?P<guid>[a-z0-9]+)/logs/$', views.AdminNodeLogView.as_view(), name='node-logs'), url(r'^registration_list/$', views.<API key>.as_view(), name='registrations'), url(r'^<API key>/$', views.<API key>.as_view(), name='stuck-registrations'), url(r'^(?P<guid>[a-z0-9]+)/update_embargo/$', views.<API key>.as_view(), name='update_embargo'), url(r'^(?P<guid>[a-z0-9]+)/remove/$', views.NodeDeleteView.as_view(), name='remove'), url(r'^(?P<guid>[a-z0-9]+)/restore/$', views.NodeDeleteView.as_view(), name='restore'), url(r'^(?P<guid>[a-z0-9]+)/confirm_spam/$', views.NodeConfirmSpamView.as_view(), name='confirm-spam'), url(r'^(?P<guid>[a-z0-9]+)/confirm_ham/$', views.NodeConfirmHamView.as_view(), name='confirm-ham'), url(r'^(?P<guid>[a-z0-9]+)/reindex_share_node/$', views.NodeReindexShare.as_view(), name='reindex-share-node'), url(r'^(?P<guid>[a-z0-9]+)/<API key>/$', views.NodeReindexElastic.as_view(), name='<API key>'), url(r'^(?P<guid>[a-z0-9]+)/<API key>/$', views.<API key>.as_view(), name='<API key>'), url(r'^(?P<guid>[a-z0-9]+)/<API key>/$', views.<API key>.as_view(), name='<API key>'), url(r'^(?P<guid>[a-z0-9]+)/remove_user/(?P<user_id>[a-z0-9]+)/$', views.<API key>.as_view(), name='remove_user'), ]
package org.asteriskjava.pbx.agi; import static org.junit.Assert.assertTrue; import org.asteriskjava.pbx.agi.RateLimiter; import org.junit.Test; public class RateLimiterTest { @Test public void test() throws <API key> { long now = System.currentTimeMillis(); RateLimiter limiter = new RateLimiter(3); for (int i = 0; i < 15; i++) { limiter.acquire(); System.out.println(System.currentTimeMillis()); Thread.sleep(100); } // this should have taken around 5 seconds assertTrue(System.currentTimeMillis() - now > 4000L); } }
#include <cassert> #include <chrono> #include <memory> #include <mutex> #include <sstream> #include <string> #include <thread> #include <vector> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/histogram.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <gtest/gtest.h> #include "src/core/lib/profiling/timers.h" #include "src/proto/grpc/testing/services.grpc.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/interarrival.h" #include "test/cpp/qps/usage_timer.h" namespace grpc { namespace testing { static std::unique_ptr<BenchmarkService::Stub> <API key>( std::shared_ptr<Channel> ch) { return BenchmarkService::NewStub(ch); } class SynchronousClient : public ClientImpl<BenchmarkService::Stub, SimpleRequest> { public: SynchronousClient(const ClientConfig& config) : ClientImpl<BenchmarkService::Stub, SimpleRequest>( config, <API key>) { num_threads_ = config.<API key>() * config.client_channels(); responses_.resize(num_threads_); SetupLoadTest(config, num_threads_); } virtual ~SynchronousClient(){}; protected: void WaitToIssue(int thread_idx) { if (!closed_loop_) { gpr_sleep_until(NextIssueTime(thread_idx)); } } size_t num_threads_; std::vector<SimpleResponse> responses_; }; class <API key> GRPC_FINAL : public SynchronousClient { public: <API key>(const ClientConfig& config) : SynchronousClient(config) { StartThreads(num_threads_); } ~<API key>() { EndThreads(); } bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { WaitToIssue(thread_idx); auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = UsageTimer::Now(); GPR_TIMER_SCOPE("<API key>::ThreadFunc", 0); grpc::ClientContext context; grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); histogram->Add((UsageTimer::Now() - start) * 1e9); return s.ok(); } }; class <API key> GRPC_FINAL : public SynchronousClient { public: <API key>(const ClientConfig& config) : SynchronousClient(config) { context_ = new grpc::ClientContext[num_threads_]; stream_ = new std::unique_ptr< grpc::ClientReaderWriter<SimpleRequest, SimpleResponse>>[num_threads_]; for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); } StartThreads(num_threads_); } ~<API key>() { EndThreads(); for (auto stream = &stream_[0]; stream != &stream_[num_threads_]; stream++) { if (*stream) { (*stream)->WritesDone(); EXPECT_TRUE((*stream)->Finish().ok()); } } delete[] stream_; delete[] context_; } bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { WaitToIssue(thread_idx); GPR_TIMER_SCOPE("<API key>::ThreadFunc", 0); double start = UsageTimer::Now(); if (stream_[thread_idx]->Write(request_) && stream_[thread_idx]->Read(&responses_[thread_idx])) { histogram->Add((UsageTimer::Now() - start) * 1e9); return true; } return false; } private: // These are both conceptually std::vector but cannot be for old compilers // that expect contained classes to support copy constructors grpc::ClientContext* context_; std::unique_ptr<grpc::ClientReaderWriter<SimpleRequest, SimpleResponse>>* stream_; }; std::unique_ptr<Client> <API key>( const ClientConfig& config) { return std::unique_ptr<Client>(new <API key>(config)); } std::unique_ptr<Client> <API key>( const ClientConfig& config) { return std::unique_ptr<Client>(new <API key>(config)); } } // namespace testing } // namespace grpc
#ifndef <API key> #define <API key> #include <string.h> namespace webrtc { class FIRFilter; // Creates a filter with the given coefficients. All initial state values will // be zeros. // The length of the chunks fed to the filter should never be greater than // |max_input_length|. This is needed because, when vectorizing it is // necessary to concatenate the input after the state, and resizing this array // dynamically is expensive. FIRFilter* CreateFirFilter(const float* coefficients, size_t coefficients_length, size_t max_input_length); } // namespace webrtc #endif // <API key>
function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /> <meta name="description" content="Star burst overlapping billboards." /> <meta name="<API key>" content="Showcases" /> <title>Cesium Demo</title> <script type="text/javascript" src="../Sandcastle-header.js"></script> <script type="text/javascript" src="../../../Build/CesiumUnminified/Cesium.js" nomodule ></script> <script type="module" src="../load-cesium-es6.js"></script> </head> <body class="sandcastle-loading" <API key>="bucket-requirejs.html" > <style> @import url(../templates/bucket.css); </style> <div id="cesiumContainer" class="fullSize"></div> <div id="loadingOverlay"><h1>Loading...</h1></div> <div id="toolbar"> <div id="zoomButtons"></div> </div> <script id="<API key>"> function startup(Cesium) { "use strict"; //Sandcastle_Begin var viewer = new Cesium.Viewer("cesiumContainer", { selectionIndicator: false, }); // Add labels clustered at the same location var numBillboards = 30; for (var i = 0; i < numBillboards; ++i) { var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883); viewer.entities.add({ position: position, billboard: { image: "../images/facility.gif", scale: 2.5, }, label: { text: "Label" + i, show: false, }, }); } var scene = viewer.scene; var camera = scene.camera; var handler = new Cesium.<API key>(scene.canvas); handler.setInputAction(function (movement) { // Star burst on left mouse click. starBurst(movement.position); }, Cesium.<API key>.LEFT_CLICK); handler.setInputAction(function (movement) { // Remove the star burst when the mouse exits the circle or show the label of the billboard the mouse is hovering over. updateStarBurst(movement.endPosition); }, Cesium.<API key>.MOUSE_MOVE); camera.moveStart.addEventListener(function () { // Reset the star burst on camera move because the lines from the center // because the line end points rely on the screen space positions of the billboards. undoStarBurst(); }); // State saved across mouse click and move events var starBurstState = { enabled: false, pickedEntities: undefined, billboardEyeOffsets: undefined, labelEyeOffsets: undefined, linePrimitive: undefined, radius: undefined, center: undefined, pixelPadding: 10.0, angleStart: 0.0, angleEnd: Cesium.Math.PI, maxDimension: undefined, }; function offsetBillboard( entity, entityPosition, angle, magnitude, lines, billboardEyeOffsets, labelEyeOffsets ) { var x = magnitude * Math.cos(angle); var y = magnitude * Math.sin(angle); var offset = new Cesium.Cartesian2(x, y); var drawingBufferWidth = scene.drawingBufferWidth; var drawingBufferHeight = scene.drawingBufferHeight; var pixelRatio = scene.pixelRatio; var diff = Cesium.Cartesian3.subtract( entityPosition, camera.positionWC, new Cesium.Cartesian3() ); var distance = Cesium.Cartesian3.dot(camera.directionWC, diff); var dimensions = camera.frustum.getPixelDimensions( drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, new Cesium.Cartesian2() ); Cesium.Cartesian2.multiplyByScalar( offset, Cesium.Cartesian2.maximumComponent(dimensions), offset ); var labelOffset; var billboardOffset = entity.billboard.eyeOffset; var eyeOffset = new Cesium.Cartesian3(offset.x, offset.y, 0.0); entity.billboard.eyeOffset = eyeOffset; if (Cesium.defined(entity.label)) { labelOffset = entity.label.eyeOffset; entity.label.eyeOffset = new Cesium.Cartesian3( offset.x, offset.y, -10.0 ); } var endPoint = Cesium.Matrix4.multiplyByPoint( camera.viewMatrix, entityPosition, new Cesium.Cartesian3() ); Cesium.Cartesian3.add(eyeOffset, endPoint, endPoint); Cesium.Matrix4.multiplyByPoint( camera.inverseViewMatrix, endPoint, endPoint ); lines.push(endPoint); billboardEyeOffsets.push(billboardOffset); labelEyeOffsets.push(labelOffset); } function starBurst(mousePosition) { if (Cesium.defined(starBurstState.pickedEntities)) { return; } var pickedObjects = scene.drillPick(mousePosition); if (!Cesium.defined(pickedObjects) || pickedObjects.length < 2) { return; } var billboardEntities = []; var length = pickedObjects.length; var i; for (i = 0; i < length; ++i) { var pickedObject = pickedObjects[i]; if (pickedObject.primitive instanceof Cesium.Billboard) { billboardEntities.push(pickedObject); } } if (billboardEntities.length === 0) { return; } var pickedEntities = (starBurstState.pickedEntities = []); var billboardEyeOffsets = (starBurstState.billboardEyeOffsets = []); var labelEyeOffsets = (starBurstState.labelEyeOffsets = []); var lines = []; starBurstState.maxDimension = Number.NEGATIVE_INFINITY; var angleStart = starBurstState.angleStart; var angleEnd = starBurstState.angleEnd; var angle = angleStart; var angleIncrease; var magnitude; var magIncrease; var maxDimension; // Drill pick gets all of the entities under the mouse pointer. // Find the billboards and set their pixel offsets in a circle pattern. length = billboardEntities.length; i = 0; while (i < length) { var object = billboardEntities[i]; if (pickedEntities.length === 0) { starBurstState.center = Cesium.Cartesian3.clone( object.primitive.position ); } if (!Cesium.defined(angleIncrease)) { var width = object.primitive.width; var height = object.primitive.height; maxDimension = Math.max(width, height) * object.primitive.scale + starBurstState.pixelPadding; magnitude = maxDimension + maxDimension * 0.5; magIncrease = magnitude; angleIncrease = maxDimension / magnitude; } offsetBillboard( object.id, object.primitive.position, angle, magnitude, lines, billboardEyeOffsets, labelEyeOffsets ); pickedEntities.push(object); var reflectedAngle = angleEnd - angle; if ( i + 1 < length && reflectedAngle - angleIncrease * 0.5 > angle + angleIncrease * 0.5 ) { object = billboardEntities[++i]; offsetBillboard( object.id, object.primitive.position, reflectedAngle, magnitude, lines, billboardEyeOffsets, labelEyeOffsets ); pickedEntities.push(object); } angle += angleIncrease; if ( reflectedAngle - angleIncrease * 0.5 < angle + angleIncrease * 0.5 ) { magnitude += magIncrease; angle = angleStart; angleIncrease = maxDimension / magnitude; } ++i; } // Add lines from the pick center out to the translated billboard. var instances = []; length = lines.length; for (i = 0; i < length; ++i) { var pickedEntity = pickedEntities[i]; starBurstState.maxDimension = Math.max( pickedEntity.primitive.width, pickedEntity.primitive.height, starBurstState.maxDimension ); instances.push( new Cesium.GeometryInstance({ geometry: new Cesium.<API key>({ positions: [starBurstState.center, lines[i]], arcType: Cesium.ArcType.NONE, granularity: Cesium.Math.PI_OVER_FOUR, }), attributes: { color: Cesium.<API key>.fromColor( Cesium.Color.WHITE ), }, }) ); } starBurstState.linePrimitive = scene.primitives.add( new Cesium.Primitive({ geometryInstances: instances, appearance: new Cesium.<API key>({ flat: true, translucent: false, }), asynchronous: false, }) ); viewer.selectedEntity = undefined; starBurstState.radius = magnitude + magIncrease; } function updateStarBurst(mousePosition) { if (!Cesium.defined(starBurstState.pickedEntities)) { return; } if (!starBurstState.enabled) { // For some reason we get a mousemove event on click, so // do not show a label on the first event. starBurstState.enabled = true; return; } // Remove the star burst if the mouse exits the screen space circle. // If the mouse is inside the circle, show the label of the billboard the mouse is hovering over. var screenPosition = Cesium.SceneTransforms.<API key>( scene, starBurstState.center ); var fromCenter = Cesium.Cartesian2.subtract( mousePosition, screenPosition, new Cesium.Cartesian2() ); var radius = starBurstState.radius; if ( Cesium.Cartesian2.magnitudeSquared(fromCenter) > radius * radius || fromCenter.y > 3.0 * (starBurstState.maxDimension + starBurstState.pixelPadding) ) { undoStarBurst(); } else { showLabels(mousePosition); } } function undoStarBurst() { var pickedEntities = starBurstState.pickedEntities; if (!Cesium.defined(pickedEntities)) { return; } var billboardEyeOffsets = starBurstState.billboardEyeOffsets; var labelEyeOffsets = starBurstState.labelEyeOffsets; // Reset billboard and label pixel offsets. // Hide overlapping labels. for (var i = 0; i < pickedEntities.length; ++i) { var entity = pickedEntities[i].id; entity.billboard.eyeOffset = billboardEyeOffsets[i]; if (Cesium.defined(entity.label)) { entity.label.eyeOffset = labelEyeOffsets[i]; entity.label.show = false; } } // Remove lines from the scene. // Free resources and reset state. scene.primitives.remove(starBurstState.linePrimitive); starBurstState.linePrimitive = undefined; starBurstState.pickedEntities = undefined; starBurstState.billboardEyeOffsets = undefined; starBurstState.labelEyeOffsets = undefined; starBurstState.radius = undefined; starBurstState.enabled = false; } var currentObject; function showLabels(mousePosition) { var pickedObjects = scene.drillPick(mousePosition); var pickedObject; if (Cesium.defined(pickedObjects)) { var length = pickedObjects.length; for (var i = 0; i < length; ++i) { if (pickedObjects[i].primitive instanceof Cesium.Billboard) { pickedObject = pickedObjects[i]; break; } } } if (pickedObject !== currentObject) { if ( Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id.label) ) { if (Cesium.defined(currentObject)) { currentObject.id.label.show = false; } currentObject = pickedObject; pickedObject.id.label.show = true; } else if (Cesium.defined(currentObject)) { currentObject.id.label.show = false; currentObject = undefined; } } } //Sandcastle_End Sandcastle.finishedLoading(); } if (typeof Cesium !== "undefined") { window.startupCalled = true; startup(Cesium); } </script> </body> </html>
var Datatable = function () { var tableOptions; // main options var dataTable; // datatable object var table; // actual table jquery object var tableContainer; // actual table container object var tableWrapper; // actual table wrapper jquery object var tableInitialized = false; var ajaxParams = {}; // set filter mode var <API key> = function() { var selected = $('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).size(); var text = tableOptions.dataTable.oLanguage.sGroupActions; if (selected > 0) { $('.table-group-actions > span', tableWrapper).text(text.replace("_TOTAL_", selected)); } else { $('.table-group-actions > span', tableWrapper).text(""); } } return { //main function to initiate the module init: function (options) { if (!$().dataTable) { return; } var the = this; // default settings options = $.extend(true, { src: "", // actual table filterApplyAction: "filter", filterCancelAction: "filter_cancel", <API key>: true, dataTable: { "sDom" : "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r><'table-scrollable't><'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>r>>", // datatable layout "aLengthMenu": [ // set available records per page [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ], "iDisplayLength": 10, // default records per page "oLanguage": { // language settings "sProcessing": '<img src="' + Metronic.getGlobalImgPath() + '<API key>.gif"/><span>&nbsp;&nbsp;Loading...</span>', "sLengthMenu": "<span class='seperator'>|</span>View _MENU_ records", "sInfo": "<span class='seperator'>|</span>Found total _TOTAL_ records", "sInfoEmpty": "No records found to show", "sGroupActions": "_TOTAL_ records selected: ", "<API key>": "Could not complete request. Please check your internet connection", "sEmptyTable": "No data available in table", "sZeroRecords": "No matching records found", "oPaginate": { "sPrevious": "Prev", "sNext": "Next", "sPage": "Page", "sPageOf": "of" } }, "aoColumnDefs" : [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column) 'bSortable' : false, 'aTargets' : [ 0 ] }], "bAutoWidth": false, // disable fixed width and enable fluid table "bSortCellsTop": true, // make sortable only the first row in thead "sPaginationType": "bootstrap_extended", // pagination type(bootstrap, <API key> or bootstrap_extended) "bProcessing": true, // enable/disable display message box on record load "bServerSide": true, // enable/disable server side ajax loading "sAjaxSource": "", // define ajax source URL "sServerMethod": "POST", // handle ajax request "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) { oSettings.jqXHR = $.ajax( { "dataType": 'json', "type": "POST", "url": sSource, "data": aoData, "success": function(res, textStatus, jqXHR) { if (res.sMessage) { Metronic.alert({type: (res.sStatus == 'OK' ? 'success' : 'danger'), icon: (res.sStatus == 'OK' ? 'check' : 'warning'), message: res.sMessage, container: tableWrapper, place: 'prepend'}); } if (res.sStatus) { if (tableOptions.<API key>) { $('.<API key>', tableWrapper).val(""); } } if ($('.group-checkable', table).size() === 1) { $('.group-checkable', table).attr("checked", false); $.uniform.update($('.group-checkable', table)); } if (tableOptions.onSuccess) { tableOptions.onSuccess.call(undefined, the); } fnCallback(res, textStatus, jqXHR); }, "error": function() { if (tableOptions.onError) { tableOptions.onError.call(undefined, the); } Metronic.alert({type: 'danger', icon: 'warning', message: tableOptions.dataTable.oLanguage.<API key>, container: tableWrapper, place: 'prepend'}); $('.<API key>', tableWrapper).remove(); } } ); }, // pass additional parameter "fnServerParams": function ( aoData ) { //here can be added an external ajax request parameters. $.each(ajaxParams, function( key, value ) { aoData.push({"name" : key, "value": value}); }); }, "fnDrawCallback": function( oSettings ) { // run some code on table redraw if (tableInitialized === false) { // check if table has been initialized tableInitialized = true; // set table initialized table.show(); // display table } Metronic.initUniform($('input[type="checkbox"]', table)); // reinitialize uniform checkboxes on each table reload <API key>(); // reset selected records indicator } } }, options); tableOptions = options; // create table's jquery object table = $(options.src); tableContainer = table.parents(".table-container"); // apply the special class that used to restyle the default datatable $.fn.dataTableExt.oStdClasses.sWrapper = $.fn.dataTableExt.oStdClasses.sWrapper + " <API key>"; // initialize a datatable dataTable = table.dataTable(options.dataTable); tableWrapper = table.parents('.dataTables_wrapper'); // modify table per page dropdown input by appliying some classes $('.dataTables_length select', tableWrapper).addClass("form-control input-xsmall input-sm"); // build table group actions panel if ($('.<API key>', tableContainer).size() === 1) { $('.table-group-actions', tableWrapper).html($('.<API key>', tableContainer).html()); // place the panel inside the wrapper $('.<API key>', tableContainer).remove(); // remove the template container } // handle group checkboxes check/uncheck $('.group-checkable', table).change(function () { var set = $('tbody > tr > td:nth-child(1) input[type="checkbox"]', table); var checked = $(this).is(":checked"); $(set).each(function () { $(this).attr("checked", checked); }); $.uniform.update(set); <API key>(); }); // handle row's checkbox click table.on('change', 'tbody > tr > td:nth-child(1) input[type="checkbox"]', function(){ <API key>(); }); // handle filter submit button click table.on('click', '.filter-submit', function(e){ e.preventDefault(); the.setAjaxParam("sAction", tableOptions.filterApplyAction); // get all typeable inputs $('textarea.form-filter, select.form-filter, input.form-filter:not([type="radio"],[type="checkbox"])', table).each(function(){ the.setAjaxParam($(this).attr("name"), $(this).val()); }); // get all checkable inputs $('input.form-filter[type="checkbox"]:checked, input.form-filter[type="radio"]:checked', table).each(function(){ the.setAjaxParam($(this).attr("name"), $(this).val()); }); dataTable.fnDraw(); }); // handle filter cancel button click table.on('click', '.filter-cancel', function(e){ e.preventDefault(); $('textarea.form-filter, select.form-filter, input.form-filter', table).each(function(){ $(this).val(""); }); $('input.form-filter[type="checkbox"]', table).each(function(){ $(this).attr("checked", false); }); the.clearAjaxParams(); the.setAjaxParam("sAction", tableOptions.filterCancelAction); dataTable.fnDraw(); }); }, <API key>: function() { return $('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).size(); }, getSelectedRows: function() { var rows = []; $('tbody > tr > td:nth-child(1) input[type="checkbox"]:checked', table).each(function(){ rows.push({name: $(this).attr("name"), value: $(this).val()}); }); return rows; }, addAjaxParam: function(name, value) { ajaxParams[name] = value; }, setAjaxParam: function(name, value) { ajaxParams[name] = value; }, clearAjaxParams: function(name, value) { ajaxParams = []; }, getDataTable: function() { return dataTable; }, getTableWrapper: function() { return tableWrapper; }, gettableContainer: function() { return tableContainer; }, getTable: function() { return table; } }; };
"""Support for the Foobot indoor air quality monitor.""" import asyncio from datetime import timedelta import logging import aiohttp from foobot_async import FoobotClient import voluptuous as vol from homeassistant.const import ( ATTR_TEMPERATURE, ATTR_TIME, CONF_TOKEN, CONF_USERNAME, TEMP_CELSIUS, ) from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers.aiohttp_client import <API key> import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import PLATFORM_SCHEMA from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) ATTR_HUMIDITY = "humidity" ATTR_PM2_5 = "PM2.5" ATTR_CARBON_DIOXIDE = "CO2" <API key> = "VOC" ATTR_FOOBOT_INDEX = "index" SENSOR_TYPES = { "time": [ATTR_TIME, "s"], "pm": [ATTR_PM2_5, "µg/m3", "mdi:cloud"], "tmp": [ATTR_TEMPERATURE, TEMP_CELSIUS, "mdi:thermometer"], "hum": [ATTR_HUMIDITY, "%", "mdi:water-percent"], "co2": [ATTR_CARBON_DIOXIDE, "ppm", "mdi:periodic-table-co2"], "voc": [<API key>, "ppb", "mdi:cloud"], "allpollu": [ATTR_FOOBOT_INDEX, "%", "mdi:percent"], } SCAN_INTERVAL = timedelta(minutes=10) PARALLEL_UPDATES = 1 TIMEOUT = 10 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( {vol.Required(CONF_TOKEN): cv.string, vol.Required(CONF_USERNAME): cv.string} ) async def <API key>(hass, config, async_add_entities, discovery_info=None): """Set up the devices associated with the account.""" token = config.get(CONF_TOKEN) username = config.get(CONF_USERNAME) client = FoobotClient( token, username, <API key>(hass), timeout=TIMEOUT ) dev = [] try: devices = await client.get_devices() _LOGGER.debug("The following devices were found: %s", devices) for device in devices: foobot_data = FoobotData(client, device["uuid"]) for sensor_type in SENSOR_TYPES: if sensor_type == "time": continue foobot_sensor = FoobotSensor(foobot_data, device, sensor_type) dev.append(foobot_sensor) except ( aiohttp.client_exceptions.<API key>, asyncio.TimeoutError, FoobotClient.TooManyRequests, FoobotClient.InternalError, ): _LOGGER.exception("Failed to connect to foobot servers.") raise PlatformNotReady except FoobotClient.ClientError: _LOGGER.error("Failed to fetch data from foobot servers.") return async_add_entities(dev, True) class FoobotSensor(Entity): """Implementation of a Foobot sensor.""" def __init__(self, data, device, sensor_type): """Initialize the sensor.""" self._uuid = device["uuid"] self.foobot_data = data self._name = "Foobot {} {}".format(device["name"], SENSOR_TYPES[sensor_type][0]) self.type = sensor_type self.<API key> = SENSOR_TYPES[sensor_type][1] @property def name(self): """Return the name of the sensor.""" return self._name @property def icon(self): """Icon to use in the frontend.""" return SENSOR_TYPES[self.type][2] @property def state(self): """Return the state of the device.""" try: data = self.foobot_data.data[self.type] except (KeyError, TypeError): data = None return data @property def unique_id(self): """Return the unique id of this entity.""" return f"{self._uuid}_{self.type}" @property def unit_of_measurement(self): """Return the unit of measurement of this entity.""" return self.<API key> async def async_update(self): """Get the latest data.""" await self.foobot_data.async_update() class FoobotData(Entity): """Get data from Foobot API.""" def __init__(self, client, uuid): """Initialize the data object.""" self._client = client self._uuid = uuid self.data = {} @Throttle(SCAN_INTERVAL) async def async_update(self): """Get the data from Foobot API.""" interval = SCAN_INTERVAL.total_seconds() try: response = await self._client.get_last_data( self._uuid, interval, interval + 1 ) except ( aiohttp.client_exceptions.<API key>, asyncio.TimeoutError, self._client.TooManyRequests, self._client.InternalError, ): _LOGGER.debug("Couldn't fetch data") return False _LOGGER.debug("The data response is: %s", response) self.data = {k: round(v, 1) for k, v in response[0].items()} return True
#include "src/parsing/rewriter.h" #include "src/ast/ast.h" #include "src/ast/scopes.h" #include "src/parsing/parse-info.h" #include "src/parsing/parser.h" namespace v8 { namespace internal { class Processor final : public AstVisitor<Processor> { public: Processor(Isolate* isolate, DeclarationScope* closure_scope, Variable* result, AstValueFactory* ast_value_factory) : result_(result), result_assigned_(false), replacement_(nullptr), is_set_(false), breakable_(false), zone_(ast_value_factory->zone()), closure_scope_(closure_scope), factory_(ast_value_factory) { DCHECK_EQ(closure_scope, closure_scope->GetClosureScope()); <API key>(isolate); } Processor(Parser* parser, DeclarationScope* closure_scope, Variable* result, AstValueFactory* ast_value_factory) : result_(result), result_assigned_(false), replacement_(nullptr), is_set_(false), breakable_(false), zone_(ast_value_factory->zone()), closure_scope_(closure_scope), factory_(ast_value_factory) { DCHECK_EQ(closure_scope, closure_scope->GetClosureScope()); <API key>(parser->stack_limit()); } void Process(ZoneList<Statement*>* statements); bool result_assigned() const { return result_assigned_; } Zone* zone() { return zone_; } DeclarationScope* closure_scope() { return closure_scope_; } AstNodeFactory* factory() { return &factory_; } // Returns ".result = value" Expression* SetResult(Expression* value) { result_assigned_ = true; VariableProxy* result_proxy = factory()->NewVariableProxy(result_); return factory()->NewAssignment(Token::ASSIGN, result_proxy, value, kNoSourcePosition); } // Inserts '.result = undefined' in front of the given statement. Statement* <API key>(Statement* s); private: Variable* result_; // We are not tracking result usage via the result_'s use // counts (we leave the accurate computation to the // usage analyzer). Instead we simple remember if // there was ever an assignment to result_. bool result_assigned_; // When visiting a node, we "return" a replacement for that node in // [replacement_]. In many cases this will just be the original node. Statement* replacement_; // To avoid storing to .result all the time, we eliminate some of // the stores by keeping track of whether or not we're sure .result // will be overwritten anyway. This is a bit more tricky than what I // was hoping for. bool is_set_; bool breakable_; class BreakableScope final { public: explicit BreakableScope(Processor* processor, bool breakable = true) : processor_(processor), previous_(processor->breakable_) { processor->breakable_ = processor->breakable_ || breakable; } ~BreakableScope() { processor_->breakable_ = previous_; } private: Processor* processor_; bool previous_; }; Zone* zone_; DeclarationScope* closure_scope_; AstNodeFactory factory_; // Node visitors. #define DEF_VISIT(type) void Visit##type(type* node); AST_NODE_LIST(DEF_VISIT) #undef DEF_VISIT void <API key>(IterationStatement* stmt); <API key>(); }; Statement* Processor::<API key>(Statement* s) { Expression* result_proxy = factory()->NewVariableProxy(result_); Expression* undef = factory()->NewUndefinedLiteral(kNoSourcePosition); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, result_proxy, undef, kNoSourcePosition); Block* b = factory()->NewBlock(NULL, 2, false, kNoSourcePosition); b->statements()->Add( factory()-><API key>(assignment, kNoSourcePosition), zone()); b->statements()->Add(s, zone()); return b; } void Processor::Process(ZoneList<Statement*>* statements) { // If we're in a breakable scope (named block, iteration, or switch), we walk // all statements. The last value producing statement before the break needs // to assign to .result. If we're not in a breakable scope, only the last // value producing statement in the block assigns to .result, so we can stop // early. for (int i = statements->length() - 1; i >= 0 && (breakable_ || !is_set_); --i) { Visit(statements->at(i)); statements->Set(i, replacement_); } } void Processor::VisitBlock(Block* node) { // An initializer block is the rewritten form of a variable declaration // with initialization expressions. The initializer block contains the // list of assignments corresponding to the initialization expressions. // While unclear from the spec (ECMA-262, 3rd., 12.2), the value of // a variable declaration with initialization expression is 'undefined' // with some JS VMs: For instance, using smjs, print(eval('var x = 7')) // returns 'undefined'. To obtain the same behavior with v8, we need // to prevent rewriting in that case. if (!node-><API key>()) { BreakableScope scope(this, node->labels() != nullptr); Process(node->statements()); } replacement_ = node; } void Processor::<API key>(ExpressionStatement* node) { // Rewrite : <x>; -> .result = <x>; if (!is_set_) { node->set_expression(SetResult(node->expression())); is_set_ = true; } replacement_ = node; } void Processor::VisitIfStatement(IfStatement* node) { // Rewrite both branches. bool set_after = is_set_; Visit(node->then_statement()); node->set_then_statement(replacement_); bool set_in_then = is_set_; is_set_ = set_after; Visit(node->else_statement()); node->set_else_statement(replacement_); replacement_ = set_in_then && is_set_ ? node : <API key>(node); is_set_ = true; } void Processor::<API key>(IterationStatement* node) { // The statement may have to produce a value, so always assign undefined // before. // TODO(verwaest): Omit it if we know that there's no break/continue leaving // it early. DCHECK(breakable_ || !is_set_); BreakableScope scope(this); Visit(node->body()); node->set_body(replacement_); replacement_ = <API key>(node); is_set_ = true; } void Processor::<API key>(DoWhileStatement* node) { <API key>(node); } void Processor::VisitWhileStatement(WhileStatement* node) { <API key>(node); } void Processor::VisitForStatement(ForStatement* node) { <API key>(node); } void Processor::VisitForInStatement(ForInStatement* node) { <API key>(node); } void Processor::VisitForOfStatement(ForOfStatement* node) { <API key>(node); } void Processor::<API key>(TryCatchStatement* node) { // Rewrite both try and catch block. bool set_after = is_set_; Visit(node->try_block()); node->set_try_block(static_cast<Block*>(replacement_)); bool set_in_try = is_set_; is_set_ = set_after; Visit(node->catch_block()); node->set_catch_block(static_cast<Block*>(replacement_)); replacement_ = is_set_ && set_in_try ? node : <API key>(node); is_set_ = true; } void Processor::<API key>(TryFinallyStatement* node) { // Only rewrite finally if it could contain 'break' or 'continue'. Always // rewrite try. if (breakable_) { // Only set result before a 'break' or 'continue'. is_set_ = true; Visit(node->finally_block()); node->set_finally_block(replacement_->AsBlock()); // Save .result value at the beginning of the finally block and restore it // at the end again: ".backup = .result; ...; .result = .backup" // This is necessary because the finally block does not normally contribute // to the completion value. CHECK_NOT_NULL(closure_scope()); Variable* backup = closure_scope()->NewTemporary( factory()->ast_value_factory()->dot_result_string()); Expression* backup_proxy = factory()->NewVariableProxy(backup); Expression* result_proxy = factory()->NewVariableProxy(result_); Expression* save = factory()->NewAssignment( Token::ASSIGN, backup_proxy, result_proxy, kNoSourcePosition); Expression* restore = factory()->NewAssignment( Token::ASSIGN, result_proxy, backup_proxy, kNoSourcePosition); node->finally_block()->statements()->InsertAt( 0, factory()-><API key>(save, kNoSourcePosition), zone()); node->finally_block()->statements()->Add( factory()-><API key>(restore, kNoSourcePosition), zone()); } Visit(node->try_block()); node->set_try_block(replacement_->AsBlock()); replacement_ = is_set_ ? node : <API key>(node); is_set_ = true; } void Processor::<API key>(SwitchStatement* node) { // The statement may have to produce a value, so always assign undefined // before. // TODO(verwaest): Omit it if we know that there's no break/continue leaving // it early. DCHECK(breakable_ || !is_set_); BreakableScope scope(this); // Rewrite statements in all case clauses. ZoneList<CaseClause*>* clauses = node->cases(); for (int i = clauses->length() - 1; i >= 0; --i) { CaseClause* clause = clauses->at(i); Process(clause->statements()); } replacement_ = <API key>(node); is_set_ = true; } void Processor::<API key>(ContinueStatement* node) { is_set_ = false; replacement_ = node; } void Processor::VisitBreakStatement(BreakStatement* node) { is_set_ = false; replacement_ = node; } void Processor::VisitWithStatement(WithStatement* node) { Visit(node->statement()); node->set_statement(replacement_); replacement_ = is_set_ ? node : <API key>(node); is_set_ = true; } void Processor::<API key>( <API key>* node) { Visit(node->statement()); node->set_statement(replacement_); replacement_ = node; } void Processor::VisitEmptyStatement(EmptyStatement* node) { replacement_ = node; } void Processor::<API key>(ReturnStatement* node) { is_set_ = true; replacement_ = node; } void Processor::<API key>(DebuggerStatement* node) { replacement_ = node; } // Expressions are never visited. #define DEF_VISIT(type) \ void Processor::Visit##type(type* expr) { UNREACHABLE(); } <API key>(DEF_VISIT) #undef DEF_VISIT // Declarations are never visited. #define DEF_VISIT(type) \ void Processor::Visit##type(type* expr) { UNREACHABLE(); } <API key>(DEF_VISIT) #undef DEF_VISIT // Assumes code has been parsed. Mutates the AST, so the AST should not // continue to be used in the case of failure. bool Rewriter::Rewrite(ParseInfo* info) { FunctionLiteral* function = info->literal(); DCHECK_NOT_NULL(function); Scope* scope = function->scope(); DCHECK_NOT_NULL(scope); if (!scope->is_script_scope() && !scope->is_eval_scope()) return true; DeclarationScope* closure_scope = scope->GetClosureScope(); ZoneList<Statement*>* body = function->body(); if (!body->is_empty()) { Variable* result = closure_scope->NewTemporary( info->ast_value_factory()->dot_result_string()); // The name string must be internalized at this point. info->ast_value_factory()->Internalize(info->isolate()); DCHECK(!result->name().is_null()); Processor processor(info->isolate(), closure_scope, result, info->ast_value_factory()); processor.Process(body); // Internalize any values created during rewriting. info->ast_value_factory()->Internalize(info->isolate()); if (processor.HasStackOverflow()) return false; if (processor.result_assigned()) { int pos = kNoSourcePosition; VariableProxy* result_proxy = processor.factory()->NewVariableProxy(result, pos); Statement* result_statement = processor.factory()->NewReturnStatement(result_proxy, pos); body->Add(result_statement, info->zone()); } } return true; } bool Rewriter::Rewrite(Parser* parser, DeclarationScope* closure_scope, DoExpression* expr, AstValueFactory* factory) { Block* block = expr->block(); DCHECK_EQ(closure_scope, closure_scope->GetClosureScope()); DCHECK(block->scope() == nullptr || block->scope()->GetClosureScope() == closure_scope); ZoneList<Statement*>* body = block->statements(); VariableProxy* result = expr->result(); Variable* result_var = result->var(); if (!body->is_empty()) { Processor processor(parser, closure_scope, result_var, factory); processor.Process(body); if (processor.HasStackOverflow()) return false; if (!processor.result_assigned()) { AstNodeFactory* node_factory = processor.factory(); Expression* undef = node_factory->NewUndefinedLiteral(kNoSourcePosition); Statement* completion = node_factory-><API key>( processor.SetResult(undef), expr->position()); body->Add(completion, factory->zone()); } } return true; } } // namespace internal } // namespace v8
<!doctype html><html lang=en><head><title>Redirecting&mldr;</title><link rel=canonical href=/v1.5/zh/news/releases/1.0.x/announcing-1.0.8/><meta name=robots content="noindex"><meta charset=utf-8><meta http-equiv=refresh content="0; url=/v1.5/zh/news/releases/1.0.x/announcing-1.0.8/"></head><body><h1>Redirecting&mldr;</h1><a href=/v1.5/zh/news/releases/1.0.x/announcing-1.0.8/>Click here if you are not redirected.</a></body></html>
// RUN: %clang_cc1 -verify -std=c++2a -fsyntax-only -triple <API key>.14.0 %s // RUN: %clang_cc1 -verify -std=c++2a -fsyntax-only -triple <API key>.14.0 %s -fno-signed-char // RUN: %clang_cc1 -verify -std=c++2a -fsyntax-only -triple <API key> %s #if __BYTE_ORDER__ == <API key> # define LITTLE_END 1 #elif __BYTE_ORDER__ == <API key> # define LITTLE_END 0 #else # error "huh?" #endif template <class T, class V> struct is_same { static constexpr bool value = false; }; template <class T> struct is_same<T, T> { static constexpr bool value = true; }; static_assert(sizeof(int) == 4); static_assert(sizeof(long long) == 8); template <class To, class From> constexpr To bit_cast(const From &from) { static_assert(sizeof(To) == sizeof(From)); // expected-note@+9 {{cannot be represented in type 'bool'}} #ifdef __x86_64 // expected-note@+7 {{or 'std::byte'; '__int128' is invalid}} #endif #ifdef __CHAR_UNSIGNED__ // expected-note@+4 2 {{indeterminate value can only initialize an object of type 'unsigned char', 'char', or 'std::byte'; 'signed char' is invalid}} #else // expected-note@+2 2 {{indeterminate value can only initialize an object of type 'unsigned char' or 'std::byte'; 'signed char' is invalid}} #endif return __builtin_bit_cast(To, from); } template <class Intermediate, class Init> constexpr bool round_trip(const Init &init) { return bit_cast<Init>(bit_cast<Intermediate>(init)) == init; } void test_int() { static_assert(round_trip<unsigned>((int)-1)); static_assert(round_trip<unsigned>((int)0x12345678)); static_assert(round_trip<unsigned>((int)0x87654321)); static_assert(round_trip<unsigned>((int)0x0C05FEFE)); } void test_array() { constexpr unsigned char input[] = {0xCA, 0xFE, 0xBA, 0xBE}; constexpr unsigned expected = LITTLE_END ? 0xBEBAFECA : 0xCAFEBABE; static_assert(bit_cast<unsigned>(input) == expected); } void test_record() { struct int_splicer { unsigned x; unsigned y; constexpr bool operator==(const int_splicer &other) const { return other.x == x && other.y == y; } }; constexpr int_splicer splice{0x0C05FEFE, 0xCAFEBABE}; static_assert(bit_cast<unsigned long long>(splice) == (LITTLE_END ? 0xCAFEBABE0C05FEFE : 0x0C05FEFECAFEBABE)); static_assert(bit_cast<int_splicer>(0xCAFEBABE0C05FEFE).x == (LITTLE_END ? 0x0C05FEFE : 0xCAFEBABE)); static_assert(round_trip<unsigned long long>(splice)); static_assert(round_trip<long long>(splice)); struct base2 { }; struct base3 { unsigned z; }; struct bases : int_splicer, base2, base3 { unsigned doublez; }; struct tuple4 { unsigned x, y, z, doublez; constexpr bool operator==(tuple4 const &other) const { return x == other.x && y == other.y && z == other.z && doublez == other.doublez; } }; constexpr bases b = {{1, 2}, {}, {3}, 4}; constexpr tuple4 t4 = bit_cast<tuple4>(b); static_assert(t4 == tuple4{1, 2, 3, 4}); static_assert(round_trip<tuple4>(b)); } void <API key>() { struct pad { signed char x; int y; }; struct no_pad { signed char x; signed char p1, p2, p3; int y; }; static_assert(sizeof(pad) == sizeof(no_pad)); constexpr pad pir{4, 4}; // expected-error@+2 {{constexpr variable 'piw' must be initialized by a constant expression}} // expected-note@+1 {{in call to 'bit_cast(pir)'}} constexpr int piw = bit_cast<no_pad>(pir).x; // expected-error@+2 {{constexpr variable 'bad' must be initialized by a constant expression}} // expected-note@+1 {{in call to 'bit_cast(pir)'}} constexpr no_pad bad = bit_cast<no_pad>(pir); constexpr pad fine = bit_cast<pad>(no_pad{1, 2, 3, 4, 5}); static_assert(fine.x == 1 && fine.y == 5); } void no_bitfields() { // FIXME! struct S { unsigned char x : 8; }; struct G { unsigned char x : 8; }; constexpr S s{0}; // expected-error@+2 {{constexpr variable 'g' must be initialized by a constant expression}} // expected-note@+1 {{constexpr bit_cast involving bit-field is not yet supported}} constexpr G g = __builtin_bit_cast(G, s); } void array_members() { struct S { int ar[3]; constexpr bool operator==(const S &rhs) { return ar[0] == rhs.ar[0] && ar[1] == rhs.ar[1] && ar[2] == rhs.ar[2]; } }; struct G { int a, b, c; constexpr bool operator==(const G &rhs) { return a == rhs.a && b == rhs.b && c == rhs.c; } }; constexpr S s{{1, 2, 3}}; constexpr G g = bit_cast<G>(s); static_assert(g.a == 1 && g.b == 2 && g.c == 3); static_assert(round_trip<G>(s)); static_assert(round_trip<S>(g)); } void bad_types() { union X { int x; }; struct G { int g; }; // expected-error@+2 {{constexpr variable 'g' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a union type is not allowed in a constant expression}} constexpr G g = __builtin_bit_cast(G, X{0}); // expected-error@+2 {{constexpr variable 'x' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast to a union type is not allowed in a constant expression}} constexpr X x = __builtin_bit_cast(X, G{0}); struct has_pointer { // expected-note@+1 2 {{invalid type 'int *' is a member of 'has_pointer'}} int *ptr; }; // expected-error@+2 {{constexpr variable 'ptr' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a pointer type is not allowed in a constant expression}} constexpr unsigned long ptr = __builtin_bit_cast(unsigned long, has_pointer{0}); // expected-error@+2 {{constexpr variable 'hptr' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast to a pointer type is not allowed in a constant expression}} constexpr has_pointer hptr = __builtin_bit_cast(has_pointer, 0ul); } void backtrace() { struct A { // expected-note@+1 {{invalid type 'int *' is a member of 'A'}} int *ptr; }; struct B { // expected-note@+1 {{invalid type 'A [10]' is a member of 'B'}} A as[10]; }; // expected-note@+1 {{invalid type 'B' is a base of 'C'}} struct C : B { }; struct E { unsigned long ar[10]; }; // expected-error@+2 {{constexpr variable 'e' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a pointer type is not allowed in a constant expression}} constexpr E e = __builtin_bit_cast(E, C{}); } void test_array_fill() { constexpr unsigned char a[4] = {1, 2}; constexpr unsigned int i = bit_cast<unsigned int>(a); static_assert(i == (LITTLE_END ? 0x00000201 : 0x01020000)); } typedef decltype(nullptr) nullptr_t; #ifdef __CHAR_UNSIGNED__ // expected-note@+5 {{indeterminate value can only initialize an object of type 'unsigned char', 'char', or 'std::byte'; 'unsigned long' is invalid}} #else // expected-note@+3 {{indeterminate value can only initialize an object of type 'unsigned char' or 'std::byte'; 'unsigned long' is invalid}} #endif // expected-error@+1 {{constexpr variable 'test_from_nullptr' must be initialized by a constant expression}} constexpr unsigned long test_from_nullptr = __builtin_bit_cast(unsigned long, nullptr); constexpr int <API key> = (__builtin_bit_cast(unsigned char[8], nullptr), 0); constexpr int test_to_nullptr() { nullptr_t npt = __builtin_bit_cast(nullptr_t, 0ul); struct indet_mem { unsigned char data[sizeof(void *)]; }; indet_mem im = __builtin_bit_cast(indet_mem, nullptr); nullptr_t npt2 = __builtin_bit_cast(nullptr_t, im); return 0; } constexpr int ttn = test_to_nullptr(); // expected-warning@+2 {{returning reference to local temporary object}} // expected-note@+1 {{temporary created here}} constexpr const long &returns_local() { return 0L; } // expected-error@+2 {{constexpr variable 'test_nullptr_bad' must be initialized by a constant expression}} // expected-note@+1 {{read of temporary whose lifetime has ended}} constexpr nullptr_t test_nullptr_bad = __builtin_bit_cast(nullptr_t, returns_local()); constexpr int test_indeterminate(bool read_indet) { struct pad { char a; int b; }; struct no_pad { char a; unsigned char p1, p2, p3; int b; }; pad p{1, 2}; no_pad np = bit_cast<no_pad>(p); int tmp = np.a + np.b; unsigned char& indet_ref = np.p1; if (read_indet) { // expected-note@+1 {{read of uninitialized object is not allowed in a constant expression}} tmp = indet_ref; } indet_ref = 0; return 0; } constexpr int <API key> = test_indeterminate(false); // expected-error@+2 {{constexpr variable '<API key>' must be initialized by a constant expression}} // expected-note@+1 {{in call to 'test_indeterminate(true)'}} constexpr int <API key> = test_indeterminate(true); struct ref_mem { const int &rm; }; constexpr int global_int = 0; // expected-error@+2 {{constexpr variable 'run_ref_mem' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a type with a reference member is not allowed in a constant expression}} constexpr unsigned long run_ref_mem = __builtin_bit_cast( unsigned long, ref_mem{global_int}); union u { int im; }; // expected-error@+2 {{constexpr variable 'run_u' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a union type is not allowed in a constant expression}} constexpr int run_u = __builtin_bit_cast(int, u{32}); struct vol_mem { volatile int x; }; // expected-error@+2 {{constexpr variable 'run_vol_mem' must be initialized by a constant expression}} // expected-note@+1 {{non-literal type 'vol_mem' cannot be used in a constant expression}} constexpr int run_vol_mem = __builtin_bit_cast(int, vol_mem{43}); struct mem_ptr { int vol_mem::*x; // expected-note{{invalid type 'int vol_mem::*' is a member of 'mem_ptr'}} }; // expected-error@+2 {{constexpr variable 'run_mem_ptr' must be initialized by a constant expression}} // expected-note@+1 {{bit_cast from a member pointer type is not allowed in a constant expression}} constexpr int run_mem_ptr = __builtin_bit_cast(unsigned long, mem_ptr{nullptr}); struct A { char c; /* char padding : 8; */ short s; }; struct B { unsigned char x[4]; }; constexpr B one() { A a = {1, 2}; return bit_cast<B>(a); } constexpr char good_one = one().x[0] + one().x[2] + one().x[3]; // expected-error@+2 {{constexpr variable 'bad_one' must be initialized by a constant expression}} // expected-note@+1 {{read of uninitialized object is not allowed in a constant expression}} constexpr char bad_one = one().x[1]; constexpr A two() { B b = one(); // b.x[1] is indeterminate. b.x[0] = 'a'; b.x[2] = 1; b.x[3] = 2; return bit_cast<A>(b); } constexpr short good_two = two().c + two().s; namespace std { enum byte : unsigned char {}; } enum my_byte : unsigned char {}; struct pad { char a; int b; }; constexpr int ok_byte = (__builtin_bit_cast(std::byte[8], pad{1, 2}), 0); constexpr int ok_uchar = (__builtin_bit_cast(unsigned char[8], pad{1, 2}), 0); #ifdef __CHAR_UNSIGNED__ // expected-note@+5 {{indeterminate value can only initialize an object of type 'unsigned char', 'char', or 'std::byte'; 'my_byte' is invalid}}}} #else // expected-note@+3 {{indeterminate value can only initialize an object of type 'unsigned char' or 'std::byte'; 'my_byte' is invalid}} #endif // expected-error@+1 {{constexpr variable 'bad_my_byte' must be initialized by a constant expression}} constexpr int bad_my_byte = (__builtin_bit_cast(my_byte[8], pad{1, 2}), 0); #ifndef __CHAR_UNSIGNED__ // expected-error@+3 {{constexpr variable 'bad_char' must be initialized by a constant expression}} // expected-note@+2 {{indeterminate value can only initialize an object of type 'unsigned char' or 'std::byte'; 'char' is invalid}} #endif constexpr int bad_char = (__builtin_bit_cast(char[8], pad{1, 2}), 0); struct pad_buffer { unsigned char data[sizeof(pad)]; }; constexpr bool test_pad_buffer() { pad x = {1, 2}; pad_buffer y = __builtin_bit_cast(pad_buffer, x); pad z = __builtin_bit_cast(pad, y); return x.a == z.a && x.b == z.b; } static_assert(test_pad_buffer()); constexpr unsigned char identity1a = 42; constexpr unsigned char identity1b = __builtin_bit_cast(unsigned char, identity1a); static_assert(identity1b == 42); struct IdentityInStruct { unsigned char n; }; constexpr IdentityInStruct identity2a = {42}; constexpr unsigned char identity2b = __builtin_bit_cast(unsigned char, identity2a.n); union IdentityInUnion { unsigned char n; }; constexpr IdentityInUnion identity3a = {42}; constexpr unsigned char identity3b = __builtin_bit_cast(unsigned char, identity3a.n); namespace test_bool { constexpr bool test_bad_bool = bit_cast<bool>('A'); // expected-error {{must be initialized by a constant expression}} expected-note{{in call}} static_assert(round_trip<signed char>(true), ""); static_assert(round_trip<unsigned char>(false), ""); static_assert(round_trip<bool>(false), ""); static_assert(round_trip<bool>((char)0), ""); static_assert(round_trip<bool>((char)1), ""); } namespace test_long_double { #ifdef __x86_64 constexpr __int128_t test_cast_to_int128 = bit_cast<__int128_t>((long double)0); // expected-error{{must be initialized by a constant expression}} expected-note{{in call}} constexpr long double ld = 3.1425926539; struct bytes { unsigned char d[16]; }; static_assert(round_trip<bytes>(ld), ""); static_assert(round_trip<long double>(10.0L)); constexpr bool f(bool read_uninit) { bytes b = bit_cast<bytes>(ld); unsigned char ld_bytes[10] = { 0x0, 0x48, 0x9f, 0x49, 0xf0, 0x3c, 0x20, 0xc9, 0x0, 0x40, }; for (int i = 0; i != 10; ++i) if (ld_bytes[i] != b.d[i]) return false; if (read_uninit && b.d[10]) // expected-note{{read of uninitialized object is not allowed in a constant expression}} return false; return true; } static_assert(f(/*read_uninit=*/false), ""); static_assert(f(/*read_uninit=*/true), ""); // expected-error{{static_assert expression is not an integral constant expression}} expected-note{{in call to 'f(true)'}} constexpr bytes ld539 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0x86, 0x8, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; constexpr long double <API key> = 539.0; static_assert(bit_cast<long double>(ld539) == <API key>, ""); #else static_assert(round_trip<__int128_t>(34.0L)); #endif }
<!-- HTML header for doxygen 1.8.8--> <!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.9.1"/> <title>DMA Friends: Member List</title> <!--<link href="../../tabs.css" rel="stylesheet" type="text/css"/>--> <!--<script type="text/javascript" src="../../jquery.js"></script>--> <script type="text/javascript" src="../../dynsections.js"></script> <link href="bootstrap3/css/bootstrap.min.css" rel="stylesheet"> <script src="bootstrap3/js/jquery-2.1.1.min.js"></script> <script src="bootstrap3/js/bootstrap.min.js"></script> <script type="text/javascript" src="doxy-boot.js"></script> <link href="../../search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../search/searchdata.js"></script> <script type="text/javascript" src="../../search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="../../doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">DMA Friends &#160;<span id="projectnumber">2.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.9.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="../../index.html"><span>Main&#160;Page</span></a></li> <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="../../namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="../../annotated.html"><span>Classes</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="../../search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="../../annotated.html"><span>Class&#160;List</span></a></li> <li><a href="../../classes.html"><span>Class&#160;Index</span></a></li> <li><a href="../../hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="../../functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="../../d2/d01/namespaceDMA.html">DMA</a></li><li class="navelem"><b>Friends</b></li><li class="navelem"><b>Api</b></li><li class="navelem"><a class="el" href="../../d7/d53/<API key>.html">ActivityResource</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">DMA\Friends\Api\ActivityResource Member List</div> </div> </div><!--header <div class="contents"> <p>This is the complete list of members for <a class="el" href="../../d7/d53/<API key>.html">DMA\Friends\Api\ActivityResource</a>, including all inherited members.</p> <table class="directory"> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>$model</b> (defined in <a class="el" href="../../d7/d53/<API key>.html">DMA\Friends\Api\ActivityResource</a>)</td><td class="entry"><a class="el" href="../../d7/d53/<API key>.html">DMA\Friends\Api\ActivityResource</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>$pageSize</b> (defined in <a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a>)</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>$transformer</b> (defined in <a class="el" href="../../d7/d53/<API key>.html">DMA\Friends\Api\ActivityResource</a>)</td><td class="entry"><a class="el" href="../../d7/d53/<API key>.html">DMA\Friends\Api\ActivityResource</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">create</a>()</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">destroy</a>($id)</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">edit</a>($id)</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">index</a>()</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">show</a>($id)</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">store</a>()</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../d9/dda/<API key>.html#<API key>">update</a>($id)</td><td class="entry"><a class="el" href="../../d9/dda/<API key>.html">DMA\Friends\Api\BaseResource</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- HTML footer for doxygen 1.8.8--> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Feb 12 2015 13:36:13 for DMA Friends by & <img class="footer" src="../../doxygen.png" alt="doxygen"/> </a> 1.8.9.1 </small></address> </body> </html>
/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service1.h" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service1.tcc" namespace test_cpp2 { namespace cpp_reflection { }} // test_cpp2::cpp_reflection namespace apache { namespace thrift { }} // apache::thrift
#!/usr/bin/env ruby # This example demonstrates creating a server image with the Rackpace Open Cloud require 'rubygems' #required for Ruby 1.8.x require 'fog' def get_user_input(prompt) print "#{prompt}: " gets.chomp end def select_server(servers) abort "\nThere are not any servers available to image in the Chicago region. Try running create_server.rb\n\n" if servers.empty? puts "\nSelect Server To Image:\n\n" servers.each_with_index do |server, i| puts "\t #{i}. #{server.name} [#{server.public_ip_address}]" end selected_str = get_user_input "\nEnter Server Number" servers[selected_str.to_i] end # Use username defined in ~/.fog file, if absent prompt for username. def rackspace_username Fog.credentials[:rackspace_username] || get_user_input("Enter Rackspace Username") end # Use api key defined in ~/.fog file, if absent prompt for api key def rackspace_api_key Fog.credentials[:rackspace_api_key] || get_user_input("Enter Rackspace API key") end # create Next Generation Cloud Server service service = Fog::Compute.new({ :provider => 'rackspace', :rackspace_username => rackspace_username, :rackspace_api_key => rackspace_api_key, :version => :v2, # Use Next Gen Cloud Servers :rackspace_region => :ord #Use Chicago Region }) # retrieve list of servers servers = service.servers # prompt user for server server = select_server(servers) # prompt user for image name image_name = get_user_input "Enter Image Name" # creates image for server server.create_image image_name puts "\nImage #{image_name} is being created for server #{server.name}.\n\n" puts "To delete the image please execute the delete_image.rb script\n\n"
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_31) on Thu Jan 31 02:04:59 UTC 2013 --> <TITLE> org.apache.hadoop.streaming.io (Hadoop 1.1.2 API) </TITLE> <META NAME="date" CONTENT="2013-01-31"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../../../../../org/apache/hadoop/streaming/io/package-summary.html" target="classFrame">org.apache.hadoop.streaming.io</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Classes</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="IdentifierResolver.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">IdentifierResolver</A> <BR> <A HREF="InputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">InputWriter</A> <BR> <A HREF="OutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">OutputReader</A> <BR> <A HREF="RawBytesInputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">RawBytesInputWriter</A> <BR> <A HREF="<API key>.html" title="class in org.apache.hadoop.streaming.io" target="classFrame"><API key></A> <BR> <A HREF="TextInputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TextInputWriter</A> <BR> <A HREF="TextOutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TextOutputReader</A> <BR> <A HREF="<API key>.html" title="class in org.apache.hadoop.streaming.io" target="classFrame"><API key></A> <BR> <A HREF="<API key>.html" title="class in org.apache.hadoop.streaming.io" target="classFrame"><API key></A></FONT></TD> </TR> </TABLE> </BODY> </HTML>
package com.siyeh.ig.logging; import com.intellij.codeInspection.<API key>; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.ui.ListTable; import com.intellij.codeInspection.ui.<API key>; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.<API key>; import com.intellij.openapi.util.<API key>; import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; import com.intellij.util.xmlb.Accessor; import com.intellij.util.xmlb.<API key>; import com.intellij.util.xmlb.XmlSerializer; import com.siyeh.<API key>; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.<API key>; import com.siyeh.ig.<API key>; import com.siyeh.ig.PsiReplacementUtil; import com.siyeh.ig.psiutils.ClassUtils; import com.siyeh.ig.psiutils.CommentTracker; import com.siyeh.ig.ui.UiUtils; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class <API key> extends BaseInspection { @NonNls private static final String <API key> = // Log4J 1 "org.apache.log4j.Logger," + // SLF4J "org.slf4j.LoggerFactory," + // Apache Commons Logging "org.apache.commons.logging.LogFactory," + // Java Util Logging "java.util.logging.Logger," + // Log4J 2 "org.apache.logging.log4j.LogManager"; @NonNls private static final String <API key> = //Log4J 1 "getLogger," + // SLF4J "getLogger," + // Apache Commons Logging "getLog," + // Java Util Logging "getLogger," + // Log4J 2 "getLogger"; protected final List<String> <API key> = new ArrayList<>(); protected final List<String> <API key> = new ArrayList<>(); @SuppressWarnings("PublicField") public String loggerClassName = <API key>; @SuppressWarnings("PublicField") public @NonNls String <API key> = <API key>; { parseString(loggerClassName, <API key>); parseString(<API key>, <API key>); } @Override public JComponent createOptionsPanel() { final ListTable table = new ListTable( new <API key>(Arrays.asList(<API key>, <API key>), <API key>.message("logger.factory.class.name"), <API key>.message("logger.factory.method.name"))); final String title = <API key>.message("logger.initialized.with.foreign.options.title"); return UiUtils.<API key>(table, title); } @Override @NotNull protected String buildErrorString(Object... infos) { return <API key>.message("logger.initialized.with.foreign.class.problem.descriptor"); } @Override @Nullable protected <API key> buildFix(Object... infos) { return new <API key>((String)infos[0]); } @Override public <API key> buildVisitor() { return new <API key>(); } @Override public void readSettings(@NotNull Element element) throws <API key> { super.readSettings(element); parseString(loggerClassName, <API key>); parseString(<API key>, <API key>); if (<API key>.size() != <API key>.size() || <API key>.isEmpty()) { parseString(<API key>, <API key>); parseString(<API key>, <API key>); } } @Override public void writeSettings(@NotNull Element element) throws <API key> { loggerClassName = formatString(<API key>); <API key> = formatString(<API key>); if (<API key>.equals(<API key>) && loggerClassName.equals(<API key>)) { // to prevent changing inspection profile with new default, which is mistakenly always written because of bug in serialization below. <API key> = "getLogger," + "getLogger," + "getLog," + "getLogger"; // these broken settings are restored correctly in readSettings() } XmlSerializer.serializeInto(this, element, new <API key>() { @Override protected boolean accepts(@NotNull Accessor accessor, @NotNull Object bean, @Nullable Object beanValue) { final @NonNls String factoryName = accessor.getName(); if ("loggerClassName".equals(factoryName) && <API key>.equals(beanValue)) { return false; } if ("<API key>".equals(factoryName) && <API key>.equals(beanValue)) { return false; } return true; } }); } private static final class <API key> extends <API key> { private final String newClassName; private <API key>(String newClassName) { this.newClassName = newClassName; } @Override @NotNull public String getName() { return <API key>.message("fix.replace.with.x", newClassName+".class"); } @NotNull @Override public String getFamilyName() { return <API key>.message("logger.initialized.with.foreign.class.fix.family.name"); } @Override protected void doFix(Project project, ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); if (!(element instanceof <API key>)) { return; } final <API key> <API key> = (<API key>)element; PsiReplacementUtil.replaceExpression(<API key>, newClassName + ".class", new CommentTracker()); } } private class <API key> extends <API key> { @Override public void <API key>(<API key> expression) { super.<API key>(expression); PsiElement parent = expression.getParent(); if (parent instanceof <API key>) { final <API key> referenceExpression = (<API key>)parent; if (!expression.equals(referenceExpression.<API key>())) { return; } @NonNls final String name = referenceExpression.getReferenceName(); if (!"getName".equals(name)) { return; } final PsiElement grandParent = referenceExpression.getParent(); if (!(grandParent instanceof <API key>)) { return; } final <API key> <API key> = (<API key>)grandParent; final PsiExpressionList list = <API key>.getArgumentList(); if (!list.isEmpty()) { return; } parent = <API key>.getParent(); } if (!(parent instanceof PsiExpressionList)) { return; } final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof <API key>)) { return; } final <API key> <API key> = (<API key>)grandParent; final PsiExpressionList argumentList = <API key>.getArgumentList(); final PsiExpression[] expressions = argumentList.getExpressions(); if (expressions.length != 1) { return; } PsiClass containingClass = ClassUtils.getContainingClass(expression); while (containingClass instanceof PsiAnonymousClass) { containingClass = ClassUtils.getContainingClass(containingClass); } if (containingClass == null) { return; } final String containingClassName = containingClass.getName(); if (containingClassName == null) { return; } final PsiMethod method = <API key>.resolveMethod(); if (method == null) { return; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return; } final String className = aClass.getQualifiedName(); final int index = <API key>.indexOf(className); if (index < 0) { return; } final <API key> methodExpression = <API key>.getMethodExpression(); final String referenceName = methodExpression.getReferenceName(); final String <API key> = <API key>.get(index); if (!<API key>.equals(referenceName)) { return; } final PsiTypeElement operand = expression.getOperand(); final PsiClass initializerClass = PsiUtil.<API key>(operand.getType()); if (initializerClass == null) { return; } if (containingClass.equals(initializerClass)) { return; } registerError(expression, containingClassName); } } }
Ext.data.ArrayReader=Ext.extend(Ext.data.JsonReader,{readRecords:function(c){var b=this.meta?this.meta.id:null;var h=this.recordType,q=h.prototype.fields;var e=[];var s=c;for(var m=0;m<s.length;m++){var d=s[m];var u={};var a=((b||b===0)&&d[b]!==undefined&&d[b]!==""?d[b]:null);for(var l=0,w=q.length;l<w;l++){var r=q.items[l];var g=r.mapping!==undefined&&r.mapping!==null?r.mapping:l;var t=d[g]!==undefined?d[g]:r.defaultValue;t=r.convert(t,d);u[r.name]=t}var p=new h(u,a);p.json=d;e[e.length]=p}return{records:e,totalRecords:e.length}}});
package com.intellij.java.psi.formatter.java; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.util.TextRange; import com.intellij.psi.codeStyle.<API key>; import com.intellij.util.<API key>; import static com.intellij.formatting.FormatterTestUtils.Action.<API key>; /** * Is intended to hold specific java formatting tests for alignment settings ( * {@code Project Settings - Code Style - Alignment and Braces}). * * @author Denis Zhdanov */ public class <API key> extends <API key> { public void <API key>() { // Inspired by IDEA-30369 getSettings().<API key> = true; getSettings().<API key> = <API key>.WRAP_AS_NEEDED; getSettings().getRootSettings().getIndentOptions(JavaFileType.INSTANCE).<API key> = 8; doTest(); } public void <API key>() { // Inspired by IDEA-79806 getSettings().<API key> = true; doMethodTest( "Holder.INSTANCE\n" + " .foo();", "Holder.INSTANCE\n" + " .foo();" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest("AAAAA.b()\n" + ".c() // comment after line\n" + ".d()\n" + ".e();", "AAAAA.b()\n" + " .c() // comment after line\n" + " .d()\n" + " .e();"); } public void <API key>() { getSettings().<API key> = true; doTextTest("class X {\n" + " public void test() {\n" + " AAAAAA.b()\n" + ".c()\n" + ".d()\n" + " /* simple block comment */\n" + ".e();\n" + " }\n" + "}", "class X {\n" + " public void test() {\n" + " AAAAAA.b()\n" + " .c()\n" + " .d()\n" + " /* simple block comment */\n" + " .e();\n" + " }\n" + "}"); } public void <API key>() { getSettings().<API key> = 1; getSettings().getRootSettings().getIndentOptions(JavaFileType.INSTANCE).INDENT_SIZE = 4; // Inspired by IDEA-53942 doTextTest( "public class Test {\n" + " @Override\n" + "// @XmlElement(name = \"Document\", required = true, type = DocumentType.class)\n" + " @XmlTransient\n" + " void foo() {\n" + "}\n" + "}", "public class Test {\n" + "\n" + " @Override\n" + "// @XmlElement(name = \"Document\", required = true, type = DocumentType.class)\n" + " @XmlTransient\n" + " void foo() {\n" + " }\n" + "}" ); } public void testTernaryOperator() { // Inspired by IDEADEV-13018 getSettings().<API key> = true; doMethodTest("int i = a ? x\n" + ": y;", "int i = a ? x\n" + " : y;"); } public void <API key>() throws <API key> { // Inspired by IDEADEV-20144. getSettings().<API key> = true; getSettings().getRootSettings().getIndentOptions(JavaFileType.INSTANCE).SMART_TABS = true; getSettings().getRootSettings().getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = true; doTextTest("class Foo {\n" + " void foo() {\n" + " bar(new Object[] {\n" + " \"hello1\",\n" + " \"hello2\", add(\"hello3\",\n" + " \"world\")\n" + "});" + " }}", "class Foo {\n" + "\tvoid foo() {\n" + "\t\tbar(new Object[]{\n" + "\t\t\t\t\"hello1\",\n" + "\t\t\t\t\"hello2\", add(\"hello3\",\n" + "\t\t\t\t \"world\")\n" + "\t\t});\n" + "\t}\n" + "}"); } public void <API key>() throws <API key> { // Inspired by IDEADEV-16136 getSettings().<API key> = <API key>.WRAP_ALWAYS; getSettings().<API key> = true; doTextTest( "@SuppressWarnings({\"<API key>\", \"<API key>\", \"<API key>\"})\n" + "public class Some {\n" + "}", "@SuppressWarnings({\"<API key>\",\n" + " \"<API key>\",\n" + " \"<API key>\"})\n" + "public class Some {\n" + "}"); } public void testMethodBrackets() { // Inspired by IDEA-53013 getSettings().<API key> = true; getSettings().<API key> = false; getSettings().<API key> = true; getSettings().<API key> = true; getSettings().<API key> = true; getSettings().<API key> = true; doClassTest( "public void foo(int i,\n" + " int j) {\n" + "}\n" + "\n" + " public void bar() {\n" + " foo(1,\n" + " 2);\n" + " }", "public void foo(int i,\n" + " int j\n" + " ) {\n" + "}\n" + "\n" + "public void bar() {\n" + " foo(1,\n" + " 2\n" + " );\n" + "}" ); // Inspired by IDEA-55306 getSettings().<API key> = false; getSettings().<API key> = false; String method = "executeCommand(new Command<Boolean>() {\n" + " public Boolean run() throws ExecutionException {\n" + " return doInterrupt();\n" + " }\n" + "});"; doMethodTest(method, method); } public void <API key>() { // Inspired by IDEA-55147 getSettings().<API key> = true; getSettings().<API key> = <API key>.DO_NOT_WRAP; getSettings().<API key> = <API key>.DO_NOT_WRAP; doTextTest( "public class FormattingTest {\n" + "\n" + " int start = 1;\n" + " double end = 2;\n" + "\n" + " int i2 = 1;\n" + " double dd2,\n" + " dd3 = 2;\n" + "\n" + " // asd\n" + " char ccc3 = 'a';\n" + " double ddd31, ddd32 = 1;\n" + "\n" + " private\n" + " final String s4 = \"\";\n" + " private\n" + " transient int i4 = 1;\n" + "\n" + " private final String s5 = \"xxx\";\n" + " private transient int iiii5 = 1;\n" + " /*sdf*/\n" + " @MyAnnotation(value = 1, text = 2) float f5 = 1;\n" + "}", "public class FormattingTest {\n" + "\n" + " int start = 1;\n" + " double end = 2;\n" + "\n" + " int i2 = 1;\n" + " double dd2,\n" + " dd3 = 2;\n" + "\n" + " // asd\n" + " char ccc3 = 'a';\n" + " double ddd31, ddd32 = 1;\n" + "\n" + " private\n" + " final String s4 = \"\";\n" + " private\n" + " transient int i4 = 1;\n" + "\n" + " private final String s5 = \"xxx\";\n" + " private transient int iiii5 = 1;\n" + " /*sdf*/\n" + " @MyAnnotation(value = 1, text = 2) float f5 = 1;\n" + "}" ); } public void <API key>() { // Inspired by IDEA-56242 getSettings().<API key> = true; getIndentOptions().USE_TAB_CHARACTER = true; doTextTest( "public class Test {\n" + "\tprivate Long field2 = null;\n" + "\tprivate final Object field1 = null;\n" + "\tprivate int i = 1;\n" + "}", "public class Test {\n" + "\tprivate Long field2 = null;\n" + "\tprivate final Object field1 = null;\n" + "\tprivate int i = 1;\n" + "}" ); } public void <API key>() { getSettings().<API key> = false; doTextTest( "public class Test {\n" + "private Long field2 = null;\n" + "private final Object field1 = null;\n" + "private int i = 1;\n" + "}", "public class Test {\n" + " private Long field2 = null;\n" + " private final Object field1 = null;\n" + " private int i = 1;\n" + "}" ); } public void <API key>() { // Inspired by IDEA-60237 getSettings().<API key> = true; doTextTest( "public class Test {\n" + " @Id\n" + " private final String name;\n" + " @Column(length = 2 * 1024 * 1024 /* 2 MB */)\n" + " private String value;\n" + " private boolean required;\n" + " private String unsetValue;\n" + "}", "public class Test {\n" + " @Id\n" + " private final String name;\n" + " @Column(length = 2 * 1024 * 1024 /* 2 MB */)\n" + " private String value;\n" + " private boolean required;\n" + " private String unsetValue;\n" + "}" ); } public void <API key>() { // Inspired by IDEA-63820 getSettings().<API key> = true; doClassTest( "public void test()\n" + " throws Exception {}", "public void test()\n" + "throws Exception {\n" + "}" ); getSettings().<API key> = false; doClassTest( "public void test()\n" + " throws Exception {}", "public void test()\n" + " throws Exception {\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = true; doMethodTest("try (MyResource r1 = null;\n" + "MyResource r2 = null) { }", "try (MyResource r1 = null;\n" + " MyResource r2 = null) { }"); getSettings().<API key> = false; doMethodTest("try (MyResource r1 = null;\n" + "MyResource r2 = null) { }", "try (MyResource r1 = null;\n" + " MyResource r2 = null) { }"); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = <API key>.WRAP_ALWAYS; doMethodTest( "a.current.current.current.getThis().getThis().getThis();", "a.current.current.current.getThis()\n" + " .getThis()\n" + " .getThis();" ); doMethodTest( "a.current.current.current.getThis().getThis().getThis().current.getThis().getThis().getThis().getThis();", "a.current.current.current.getThis()\n" + " .getThis()\n" + " .getThis().current.getThis()\n" + " .getThis()\n" + " .getThis()\n" + " .getThis();" ); String onlyMethodCalls = "getThis().getThis().getThis();"; String formatedMethodCalls = "getThis().getThis()\n" + " .getThis();"; doMethodTest(onlyMethodCalls, formatedMethodCalls); } public void <API key>() { getSettings().<API key> = false; getSettings().<API key> = <API key>.WRAP_ALWAYS; doMethodTest( "a.current.current.current.getThis().getThis().getThis();", "a.current.current.current.getThis()\n" + " .getThis()\n" + " .getThis();" ); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = <API key>.WRAP_ON_EVERY_ITEM; // it's equal to "Chop down if long" getSettings().RIGHT_MARGIN = 50; String before = "a.current.current.getThis().getThis().getThis().getThis().getThis();"; doMethodTest( before, "a.current.current.getThis()\n" + " .getThis()\n" + " .getThis()\n" + " .getThis()\n" + " .getThis();" ); getSettings().RIGHT_MARGIN = 80; doMethodTest(before, before); } public void <API key>() { getSettings().<API key> = false; getSettings().<API key> = <API key>.WRAP_AS_NEEDED; getSettings().RIGHT_MARGIN = 50; String before = "a.current.current.getThis().getThis().getThis().getThis();"; doMethodTest( before, "a.current.current.getThis().getThis()\n" + " .getThis().getThis();" ); getSettings().<API key> = true; doMethodTest( before, "a.current.current.getThis().getThis()\n" + " .getThis().getThis();" ); getSettings().RIGHT_MARGIN = 75; doMethodTest(before, before); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "test(call1(),\n" + " call2(),\n" + " call3());\n", "test(call1(),\n" + " call2(),\n" + " call3());\n" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "int a = 2;\n" + "String myString = \"my string\"", "int a = 2;\n" + "String myString = \"my string\"" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( " String s;\n" + " int a = 2;\n" + "s = \"abs\";\n" + "long stamp = 12;", "String s;\n" + "int a = 2;\n" + "s = \"abs\";\n" + "long stamp = 12;" ); } public void <API key>() { getSettings().<API key> = true; doClassTest( "char a = '2';\n" + "int aaaaa = 3;\n" + "String b;", "char a = '2';\n" + "int aaaaa = 3;\n" + "String b;"); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "char a = '2';\n" + "int aaaaa = 3;\n" + "String b;", "char a = '2';\n" + "int aaaaa = 3;\n" + "String b;"); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "int a = 2;\n" + "\n" + "String myString = \"my string\"", "int a = 2;\n" + "\n" + "String myString = \"my string\"" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "int a = 2;\n" + "System.out.println(\"hi!\")\n" + "String myString = \"my string\"", "int a = 2;\n" + "System.out.println(\"hi!\")\n" + "String myString = \"my string\"" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( " int a, b = 2;\n" + "String myString = \"my string\"", "int a, b = 2;\n" + "String myString = \"my string\"" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "int a = 12;\n" + " Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};", "int a = 12;\n" + "Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};" ); doMethodTest( " Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};\n" + "int c = 12;", "Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};\n" + "int c = 12;" ); doMethodTest( " int ac = 99;\n" + "Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};\n" + "int c = 12;", "int ac = 99;\n" + "Runnable runnable = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(\"AAA!\");\n" + " }\n" + "};\n" + "int c = 12;" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "int\n" + " i = 0;\n" + "int[] a = new int[]{1, 2, 0x0052, 0x0053, 0x0054};\n" + "int var1 = 1;\n" + "int var2 = 2;", "int\n" + " i = 0;\n" + "int[] a = new int[]{1, 2, 0x0052, 0x0053, 0x0054};\n" + "int var1 = 1;\n" + "int var2 = 2;" ); } public void testAlign_InMethod() { getSettings().<API key> = true; doClassTest( "public void run() {\n" + "\n" + " int a = 2;\n" + " String superString = \"\";\n" + "\n" + " test(call1(), call2(), call3());\n" + " }", "public void run() {\n" + "\n" + " int a = 2;\n" + " String superString = \"\";\n" + "\n" + " test(call1(), call2(), call3());\n" + "}" ); doClassTest( "public void run() {\n" + "\n" + " test(call1(), call2(), call3());\n" + "\n" + " int a = 2;\n" + " String superString = \"\";\n" + "}", "public void run() {\n" + "\n" + " test(call1(), call2(), call3());\n" + "\n" + " int a = 2;\n" + " String superString = \"\";\n" + "}"); } public void <API key>() { myLineRange = new TextRange(2, 2); getSettings().<API key> = true; doTextTest( <API key>, "public class Test {\n" + "\n" + " public void fooooo(String foo,\n" + " String booo,\n" + " String kakadoo) {\n" + "\n" + " }\n" + "\n" + "}", "public class Test {\n" + "\n" + " public void fooooo(String foo,\n" + " String booo,\n" + " String kakadoo) {\n" + "\n" + " }\n" + "\n" + "}" ); } public void <API key>() { myLineRange = new TextRange(2, 2); getSettings().<API key> = true; doTextTest( <API key>, "public class Test {\n" + " public int i = 1;\n" + " public String iiiiiiiiii = 2;\n" + "}", "public class Test {\n" + " public int i = 1;\n" + " public String iiiiiiiiii = 2;\n" + "}" ); } public void <API key>() { myLineRange = new TextRange(3, 3); getSettings().<API key> = true; doTextTest( <API key>, "public class Test {\n" + " public void test() {\n" + " int s = 2;\n" + " String sssss = 3;\n" + " }\n" + "}", "public class Test {\n" + " public void test() {\n" + " int s = 2;\n" + " String sssss = 3;\n" + " }\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "if (a > 2) {\n" + "int a=2;\n" + "String name=\"Yarik\";\n" + "}\n", "if (a > 2) {\n" + " int a = 2;\n" + " String name = \"Yarik\";\n" + "}\n" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( " for (int i = 0; i < 10; i++) {\n" + " int a=2;\n" + " String name=\"Xa\";\n" + " }\n", "for (int i = 0; i < 10; i++) {\n" + " int a = 2;\n" + " String name = \"Xa\";\n" + "}\n" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( " try {\n" + " int x = getX();\n" + " String name = \"Ha\";\n" + " }\n" + " catch (IOException exception) {\n" + " int y = 12;\n" + " String test = \"Test\";\n" + " }\n" + " finally {\n" + " int z = 12;\n" + " String zzzz = \"pnmhd\";\n" + " }\n", "try {\n" + " int x = getX();\n" + " String name = \"Ha\";\n" + "} catch (IOException exception) {\n" + " int y = 12;\n" + " String test = \"Test\";\n" + "} finally {\n" + " int z = 12;\n" + " String zzzz = \"pnmhd\";\n" + "}\n" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( " System.out.println(\"AAAA\");\n" + " int a = 2;\n" + " \n" + " {\n" + " int x=2;\n" + " String name=3;\n" + " }\n", "System.out.println(\"AAAA\");\n" + "int a = 2;\n" + "\n" + "{\n" + " int x = 2;\n" + " String name = 3;\n" + "}\n" ); } public void <API key>() { getSettings().<API key> = true; doMethodTest( "<API key>.from(getActivity())\n" + " // Mark the ListView as pullable\n" + " .<API key>(eventsListView)\n" + " // Set the OnRefreshListener\n" + " .listener(this)\n" + " // Use the AbsListView delegate for <API key>\n" + " .useViewDelegate(<API key>.class, new AbsListViewDelegate())\n" + " // Finally commit the setup to our PullToRefreshLayout\n" + " .setup(<API key>);", "<API key>.from(getActivity())\n" + " // Mark the ListView as pullable\n" + " .<API key>(eventsListView)\n" + " // Set the OnRefreshListener\n" + " .listener(this)\n" + " // Use the AbsListView delegate for <API key>\n" + " .useViewDelegate(<API key>.class, new AbsListViewDelegate())\n" + " // Finally commit the setup to our PullToRefreshLayout\n" + " .setup(<API key>);" ); } public void <API key>() { getSettings().<API key> = true; doClassTest( "public String returnWithBuilder2() {\n" + " return MoreObjects\n" + " .toStringHelper(this)\n" + " .add(\"value\", value)\n" + " // comment\n" + " .toString();\n" + " }", "public String returnWithBuilder2() {\n" + " return MoreObjects\n" + " .toStringHelper(this)\n" + " .add(\"value\", value)\n" + " // comment\n" + " .toString();\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = true; doTextTest( "public class Test {\n" + "\n" + " public void <API key>() { System.out.println(\"AAA\"); }\n" + "\n" + " public void testCounterMounter() { System.out.println(\"XXXX\"); }\n" + "\n" + "}", "public class Test {\n" + "\n" + " public void <API key>() { System.out.println(\"AAA\"); }\n" + "\n" + " public void testCounterMounter() { System.out.println(\"XXXX\"); }\n" + "\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; doTextTest( "public class Test {\n" + " void foo(int a, int xyz) {\n" + " a = 9999;\n" + " xyz = 1;\n" + " }\n" + "}", "public class Test {\n" + " void foo(int a, int xyz) {\n" + " a = 9999;\n" + " xyz = 1;\n" + " }\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = true; doTextTest( "public class Test {\n" + " void foo(int a, int xyz) {\n" + " a = 9999;\n" + " xyz = a = \n" + " a = 12;\n" + " }\n" + "}", "public class Test {\n" + " void foo(int a, int xyz) {\n" + " a = 9999;\n" + " xyz = a =\n" + " a = 12;\n" + " }\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; getSettings().<API key> = true; getSettings().<API key> = true; doTextTest( "public class Test {\n" + " void foo(int a, int xyz, int bc) {\n" + " bc = 9999;\n" + " a = 9999;\n" + " int basdf = 1234;\n" + " int as = 3;\n" + " xyz = a = \n" + " a = 12;\n" + " }\n" + "}", "public class Test {\n" + " void foo(int a, int xyz, int bc) {\n" + " bc = 9999;\n" + " a = 9999;\n" + " int basdf = 1234;\n" + " int as = 3;\n" + " xyz = a =\n" + " a = 12;\n" + " }\n" + "}" ); } public void <API key>() { getSettings().<API key> = true; doTextTest( "public class Test {\n" + " void foo(A a, int xyz) {\n" + " a.bar = 9999;\n" + " xyz = 1;\n" + " }\n" + "}", "public class Test {\n" + " void foo(A a, int xyz) {\n" + " a.bar = 9999;\n" + " xyz = 1;\n" + " }\n" + "}" ); } public void <API key>() { getJavaSettings().<API key> = true; doTextTest( "public class Test {\n" + " void foo() {\n" + " String block = \"\"\"\n" + " text\n" + " block\n" + " \"\"\";\n" + " }\n" + "}", "public class Test {\n" + " void foo() {\n" + " String block = \"\"\"\n" + " text\n" + " block\n" + " \"\"\";\n" + " }\n" + "}" ); } @SuppressWarnings("unused") public void _testIdea199677() { getSettings().<API key> = true; getSettings().<API key> = 2; getSettings().<API key> = true; getSettings().<API key> = true; doTextTest( "public class Main {\n" + "\n" + " public static void main(String[] args) {\n" + " int one = 1;\n" + " int a_million_dollars = 1000000;\n" + "\n" + " doSomething(one, a_million_dollars);\n" + " }\n" + "\n" + " private static void doSomething(int one, int two) {\n" + " }\n" + "\n" + "}", "public class Main {\n" + "\n" + " public static void main(String[] args) {\n" + " int one = 1;\n" + " int a_million_dollars = 1000000;\n" + "\n" + " doSomething(\n" + " one,\n" + " a_million_dollars\n" + " );\n" + " }\n" + "\n" + " private static void doSomething(int one, int two) {\n" + " }\n" + "\n" + "}" ); } }
#pragma once #include "indexer/index.hpp" #include "geometry/point2d.hpp" #include "geometry/rect2d.hpp" #include "geometry/tree4d.hpp" #include "std/set.hpp" class Index; namespace search { struct LocalityItem { m2::RectD m_rect; string m_name; uint32_t m_population; typedef uint32_t ID; ID m_id; LocalityItem(m2::RectD const & rect, uint32_t population, ID id, string const & name); m2::RectD const & GetLimitRect() const { return m_rect; } }; class LocalityFinder { struct Cache { m4::Tree<LocalityItem> m_tree; set<LocalityItem::ID> m_loaded; mutable uint32_t m_usage; m2::RectD m_rect; Cache() : m_usage(0) {} void Clear(); void GetLocality(m2::PointD const & pt, string & name) const; }; public: LocalityFinder(Index const * pIndex); void SetLanguage(int8_t lang) { if (m_lang != lang) { ClearCacheAll(); m_lang = lang; } } void SetViewportByIndex(m2::RectD const & viewport, size_t idx); Set new viewport for the reserved slot only if it's no a part of the previous one. void <API key>(m2::RectD const & viewport); Check for localities in pre-cached viewports only. void <API key>(m2::PointD const & pt, string & name) const; Check for localities in all Index and make new cache if needed. void <API key>(m2::PointD const & pt, string & name); void ClearCacheAll(); void ClearCache(size_t idx); protected: void CorrectMinimalRect(m2::RectD & rect) const; void RecreateCache(Cache & cache, m2::RectD rect) const; private: friend class DoLoader; Index const * m_pIndex; enum { MAX_VIEWPORT_COUNT = 3 }; Cache m_cache[MAX_VIEWPORT_COUNT]; int8_t m_lang; }; } // namespace search
println!("11. Creating and storing CREDENTAIL DEFINITION using anoncreds as Trust Anchor, for the given Schema"); let config_json = r#"{ "support_revocation": false }"#; let tag = r#"TAG1"#; let (_cred_def_id, _cred_def_json) = anoncreds::<API key>(wallet_handle, &trustee_did, &schema_json, tag, None, config_json).wait().unwrap(); // CLEAN UP println!("12. Close and delete wallet"); indy::wallet::close_wallet(wallet_handle).wait().unwrap(); indy::wallet::delete_wallet(&config, USEFUL_CREDENTIALS).wait().unwrap(); println!("13. Close pool and delete pool ledger config"); pool::close_pool_ledger(pool_handle).wait().unwrap(); pool::delete_pool_ledger(&pool_name).wait().unwrap();
class ErrorsController < <API key> def error_404 respond_to do |format| format.html { render template: 'errors/error_404', layout: 'layouts/application', status: 404 } format.all { render nothing: true, status: 404 } end end def error_500 end end
<?php namespace Bake\Test\TestCase\Shell\Task; use Bake\Shell\Task\BakeTemplateTask; use Bake\Test\TestCase\TestCase; use Cake\Core\Plugin; use Cake\ORM\TableRegistry; use Cake\View\Helper; /** * ControllerTaskTest class * */ class ControllerTaskTest extends TestCase { /** * fixtures * * @var array */ public $fixtures = [ 'plugin.bake.bake_articles', 'plugin.bake.<API key>', 'plugin.bake.bake_comments', 'plugin.bake.bake_tags' ]; /** * setUp method * * @return void */ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Controller' . DS; $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); $this->Task = $this->getMock( 'Bake\Shell\Task\ControllerTask', ['in', 'out', 'err', 'hr', 'createFile', '_stop'], [$io] ); $this->Task->name = 'Controller'; $this->Task->connection = 'test'; $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->Model = $this->getMock( 'Bake\Shell\Task\ModelTask', ['in', 'out', 'err', 'createFile', '_stop'], [$io] ); $this->Task->Test = $this->getMock( 'Bake\Shell\Task\TestTask', [], [$io] ); TableRegistry::get('BakeArticles', [ 'className' => __NAMESPACE__ . '\BakeArticlesTable' ]); } /** * tearDown method * * @return void */ public function tearDown() { unset($this->Task); TableRegistry::clear(); parent::tearDown(); Plugin::unload('ControllerTest'); } /** * test ListAll * * @return void */ public function testListAll() { $result = $this->Task->listAll(); $this->assertContains('bake_articles', $result); $this->assertContains('<API key>', $result); $this->assertContains('bake_comments', $result); $this->assertContains('bake_tags', $result); } /** * test component generation * * @return void */ public function testGetComponents() { $result = $this->Task->getComponents(); $this->assertSame([], $result); $this->Task->params['components'] = ' , Security, , Csrf'; $result = $this->Task->getComponents(); $this->assertSame(['Security', 'Csrf'], $result); } /** * test helper generation * * @return void */ public function testGetHelpers() { $result = $this->Task->getHelpers(); $this->assertSame([], $result); $this->Task->params['helpers'] = ' , Session , , Number'; $result = $this->Task->getHelpers(); $this->assertSame(['Session', 'Number'], $result); } /** * test bake with various component name variants * * @return void */ public function testBakeComponents() { $this->Task->expects($this->any()) ->method('createFile') ->will($this->returnValue(true)); $this->Task->params['no-actions'] = true; $this->Task->params['components'] = 'Csrf, Auth, Company/TestBakeThree.Something,' . ' TestBake.Other, Apple, NonExistent'; $result = $this->Task->bake('BakeArticles'); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } /** * test the bake method * * @return void */ public function testBakeNoActions() { $this->Task->expects($this->any()) ->method('createFile') ->will($this->returnValue(true)); $this->Task->params['no-actions'] = true; $this->Task->params['helpers'] = 'Html,Time'; $this->Task->params['components'] = 'Csrf, Auth'; $result = $this->Task->bake('BakeArticles'); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } /** * test bake with actions. * * @return void */ public function testBakeActions() { $this->Task->params['helpers'] = 'Html,Time'; $this->Task->params['components'] = 'Csrf, Auth'; $filename = APP . 'Controller/<API key>.php'; $this->Task->expects($this->at(1)) ->method('createFile') ->with( $this->_normalizePath($filename), $this->stringContains('class <API key>') ); $result = $this->Task->bake('BakeArticles'); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } /** * test bake actions prefixed. * * @return void */ public function testBakePrefixed() { $this->Task->params['prefix'] = 'admin'; $filename = $this->_normalizePath(APP . 'Controller/Admin/<API key>.php'); $this->Task->expects($this->at(1)) ->method('createFile') ->with($filename, $this->anything()); $this->Task->Test->expects($this->at(0)) ->method('bake') ->with('Controller', 'Admin\BakeArticles'); $result = $this->Task->bake('BakeArticles'); $this->assertTextContains('namespace App\Controller\Admin;', $result); $this->assertTextContains('use App\Controller\AppController;', $result); } /** * test bake() with a -plugin param * * @return void */ public function testBakeWithPlugin() { $this->Task->plugin = 'ControllerTest'; Plugin::load('ControllerTest', ['path' => APP . 'Plugin/ControllerTest/']); $path = APP . 'Plugin/ControllerTest/src/Controller/<API key>.php'; $this->Task->expects($this->at(1)) ->method('createFile') ->with($this->_normalizePath($path)) ->will($this->returnValue(true)); $result = $this->Task->bake('BakeArticles'); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } /** * * test that bakeActions is creating the correct controller Code. (Using sessions) * * @return void */ public function <API key>() { $result = $this->Task->bake('BakeArticles'); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } /** * test baking a test * * @return void */ public function testBakeTest() { $this->Task->plugin = 'ControllerTest'; $this->Task->connection = 'test'; $this->Task->Test->expects($this->once()) ->method('bake') ->with('Controller', 'BakeArticles'); $this->Task->bakeTest('BakeArticles'); $this->assertEquals($this->Task->plugin, $this->Task->Test->plugin); $this->assertEquals($this->Task->connection, $this->Task->Test->connection); } /** * test baking a test * * @return void */ public function <API key>() { $this->Task->plugin = 'ControllerTest'; $this->Task->connection = 'test'; $this->Task->params['no-test'] = true; $this->Task->Test->expects($this->never()) ->method('bake'); $this->Task->bakeTest('BakeArticles'); } /** * Test execute no args. * * @return void */ public function testMainNoArgs() { $this->Task->expects($this->never()) ->method('createFile'); $this->Task->expects($this->at(0)) ->method('out') ->with($this->stringContains('Possible controllers based on your current database')); $this->Task->main(); } /** * test that execute runs all when the first arg == all * * @return void */ public function testMainIntoAll() { $this->Task->connection = 'test'; $this->Task->params = ['helpers' => 'Time,Text']; $this->Task->Test->expects($this->atLeastOnce()) ->method('bake'); $filename = $this->_normalizePath(APP . 'Controller/<API key>.php'); $this->Task->expects($this->at(1)) ->method('createFile') ->with($filename, $this->logicalAnd( $this->stringContains('class <API key>'), $this->stringContains("\$helpers = ['Time', 'Text']") )) ->will($this->returnValue(true)); $this->Task->all(); } /** * data provider for <API key> * * @return void */ public static function nameVariations() { return [ ['BakeArticles'], ['bake_articles'] ]; } /** * test that both plural and singular forms work for controller baking. * * @dataProvider nameVariations * @return void */ public function <API key>($name) { $this->Task->connection = 'test'; $filename = $this->_normalizePath(APP . 'Controller/<API key>.php'); $this->Task->expects($this->once()) ->method('createFile') ->with($filename, $this->stringContains('public function index()')); $this->Task->main($name); } /** * test main with plugin.name * * @return void */ public function <API key>() { $this->Task->connection = 'test'; Plugin::load('ControllerTest', ['path' => APP . 'Plugin/ControllerTest/']); $path = APP . 'Plugin/ControllerTest/src/Controller/<API key>.php'; $this->Task->expects($this->at(1)) ->method('createFile') ->with( $this->_normalizePath($path), $this->stringContains('<API key> extends AppController') )->will($this->returnValue(true)); $this->Task->main('ControllerTest.BakeArticles'); } }
// std imports use std::mem; // external imports use num::traits::Num; // local imports use algebra::structure::MagmaBase; use super::eo_traits::{ERO, ECO}; use matrix::view::MatrixView; use matrix::traits::{Shape, MatrixBuffer, Strided}; Implementation of Elementary row operations. impl<'a, T:MagmaBase + Num> ERO<T> for MatrixView<'a, T> { Row scaling by a factor and adding to another row. r_i = r_i + k * r_j The j-th row can be outside the view also. This is the row relative to the start of the view. #[inline] fn ero_scale_add(&mut self, i : usize, j : isize, scale : T )-> &mut MatrixView<'a, T> { debug_assert! (i < self.num_rows()); let m = self.matrix(); // Compute j-th row in m (by doing offset) let j = j + (self.start_row() as isize); debug_assert! (j >= 0); let j = j as usize; debug_assert!(j < m.num_rows()); let ptr = m.as_ptr(); // I am allowing modification of the underlying buffer let ptr : *mut T = unsafe { mem::transmute(ptr) }; let sc = self.start_col(); // Compute initial offsets let mut offset_a = self.cell_to_offset(i, 0); let mut offset_b = m.cell_to_offset(j, sc); let stride_a = self.stride() as isize; let stride_b = m.stride() as isize; for _ in 0..self.num_cols(){ unsafe { let va = *ptr.offset(offset_a); let vb = *ptr.offset(offset_b); *ptr.offset(offset_a) = va + scale * vb; } // Update offsets offset_a += stride_a; offset_b += stride_b; } self } } Implementation of Elementary column operations. impl<'a, T:MagmaBase + Num> ECO<T> for MatrixView<'a, T> { Column scaling by a factor and adding to another column. c_i = c_i + k * c_j The j-th column can be outside the view also. This is the column relative to the start of the view. #[inline] fn eco_scale_add(&mut self, i : usize, j : isize, scale : T )-> &mut MatrixView<'a, T> { debug_assert! (i < self.num_cols()); let m = self.matrix(); // Compute j-th column in m (by doing offset) let j = j + (self.start_col() as isize); debug_assert! (j >= 0); let j = j as usize; debug_assert!(j < m.num_cols()); let ptr = m.as_ptr(); // I am allowing modification of the underlying buffer let ptr : *mut T = unsafe { mem::transmute(ptr) }; let sr = self.start_row(); // Compute initial offsets let mut offset_a = self.cell_to_offset(0, i); let mut offset_b = m.cell_to_offset(sr, j); for _ in 0..self.num_rows(){ unsafe { let va = *ptr.offset(offset_a); let vb = *ptr.offset(offset_b); *ptr.offset(offset_a) = va + scale * vb; } // Update offsets offset_a += 1; offset_b += 1; } self } } #[cfg(test)] mod test{ //use super::*; } #[cfg(test)] mod bench{ //extern crate test; //use self::test::Bencher; //use super::*; }
#include <stdlib.h> int main(void) { int a = 1; int b = 1; switch (a) { case 1 : b = 3; break; case 2 : b = 5; break; } return (0); }
// -*- mode: java; c-basic-offset: 2; -*- package com.google.appinventor.server; import com.google.appinventor.server.storage.StorageIo; import com.google.appinventor.server.storage.<API key>; import com.google.appinventor.server.storage.Un<API key>; import com.google.appinventor.shared.rpc.project.Project; import com.google.appinventor.shared.rpc.project.ProjectSourceZip; import com.google.appinventor.shared.rpc.project.RawFile; import com.google.appinventor.shared.rpc.project.TextFile; import com.google.appinventor.shared.storage.StorageUtil; import com.google.common.io.ByteStreams; import java.io.<API key>; import java.io.<API key>; import java.io.<API key>; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * Tests for {@link FileExporterImpl}. * */ public class <API key> extends <API key> { private static final String USER_ID = "1"; // The following represent a fake project, containing both source and // output files, for the purpose of testing. private static final String FAKE_PROJECT_TYPE = "FakeProjectType"; private static final String PROJECT_NAME = "Project1"; private static final String FORM1_NAME = "Screen1"; private static final String <API key> = "com.yourdomain." + FORM1_NAME; private static final String FORM1_CONTENT = "Form A\nEnd Form"; private static final String IMAGE1_NAME = "Image.jpg"; private static final byte[] IMAGE_CONTENT = { (byte) 0, (byte) 1, (byte) 32, (byte) 255}; private static final String TARGET1_NAME = "Project1.apk"; private static final String <API key> = "build/target1/" + TARGET1_NAME; private static final byte[] TARGET1_CONTENT = "pk1".getBytes(); private static final String TARGET2_NAME = "Project2.pak"; private static final String <API key> = "build/target2/" + TARGET2_NAME; private static final byte[] TARGET2_CONTENT = "pk2".getBytes(); private static final String SETTINGS = ""; private static final String HISTORY = "1:History"; private StorageIo storageIo; private FileExporterImpl exporter; private long projectId; @Override protected void setUp() throws Exception { super.setUp(); storageIo = <API key>.INSTANCE; exporter = new FileExporterImpl(); Project project = new Project(PROJECT_NAME); project.setProjectType(FAKE_PROJECT_TYPE); project.setProjectHistory(HISTORY); project.addTextFile(new TextFile(<API key>, "")); projectId = storageIo.createProject(USER_ID, project, SETTINGS); storageIo.uploadFile(projectId, <API key>, USER_ID, FORM1_CONTENT, StorageUtil.DEFAULT_CHARSET); storageIo.<API key>(USER_ID, projectId, false, IMAGE1_NAME); storageIo.uploadRawFile(projectId, IMAGE1_NAME, USER_ID, true, IMAGE_CONTENT); storageIo.<API key>(USER_ID, projectId, <API key>); storageIo.uploadRawFile(projectId, <API key>, USER_ID, true, TARGET1_CONTENT); storageIo.<API key>(USER_ID, projectId, <API key>); storageIo.uploadRawFile(projectId, <API key>, USER_ID, true, TARGET2_CONTENT); } private Map<String, byte[]> <API key>(ProjectSourceZip project) throws IOException { ZipInputStream zis = new ZipInputStream(new <API key>(project.getContent())); Map<String, byte[]> content = new HashMap<String, byte[]>(); ZipEntry zipEntry; while ((zipEntry = zis.getNextEntry()) != null) { <API key> baos = new <API key>(); ByteStreams.copy(zis, baos); content.put(zipEntry.getName(), baos.toByteArray()); } assertEquals(content.size(), project.getFileCount()); assertTrue(content.containsKey(<API key>)); assertTrue(content.containsKey(IMAGE1_NAME)); assertFalse(content.containsKey(TARGET1_NAME)); assertEquals(FORM1_CONTENT, new String(content.get(<API key>), StorageUtil.DEFAULT_CHARSET)); assertTrue(Arrays.equals(IMAGE_CONTENT, content.get(IMAGE1_NAME))); return content; } public void <API key>() throws IOException { ProjectSourceZip project = exporter.<API key>(USER_ID, projectId, false, false, null); Map<String, byte[]> content = <API key>(project); assertEquals(2, content.size()); /* Do not expect remix history when <API key> parameter is false * as in the publish case. */ assertFalse(content.containsKey(FileExporter.<API key>)); } // TODO(user): Add test with properly formatted history public void <API key>() throws IOException { ProjectSourceZip project = exporter.<API key>(USER_ID, projectId, true, false, null); Map<String, byte[]> content = <API key>(project); assertEquals(3, content.size()); // Expect the remix file to be in assertTrue(content.containsKey(FileExporter.<API key>)); assertEquals(HISTORY, new String(content.get(FileExporter.<API key>), StorageUtil.DEFAULT_CHARSET)); } public void <API key>() throws IOException { try { exporter.<API key>(USER_ID, projectId + 1, false, false, null); fail(); } catch (Exception e) { assertTrue(e instanceof <API key> || e.getCause() instanceof <API key>); } } public void <API key>() throws IOException { RawFile file = exporter.<API key>(USER_ID, projectId, "target1"); assertEquals(TARGET1_NAME, file.getFileName()); assertTrue(Arrays.equals(TARGET1_CONTENT, file.getContent())); } public void <API key>() throws IOException { try { exporter.<API key>(USER_ID, projectId, "target3"); fail(); } catch (<API key> e) { // expected } } public void testExportFile() throws IOException { RawFile file = exporter.exportFile(USER_ID, projectId, <API key>); assertEquals(<API key>, file.getFileName()); assertEquals(FORM1_CONTENT, new String(file.getContent(), StorageUtil.DEFAULT_CHARSET)); } public void <API key>() throws IOException { final String nonExistingFileName = <API key> + "1"; try { exporter.exportFile(USER_ID, projectId, nonExistingFileName); fail(); } catch (RuntimeException e) { // expected // note that FileExporter throws an explicit RuntimeException } } // TODO(user): Add test of <API key>(). }
/* jslint maxlen:80, es6:true, white:true */ /* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, maxstatements:3, maxcomplexity:2 */ /* eslint strict: 1, max-statements: 1 */ /* global module */ ;(function () { // eslint-disable-line no-extra-semi 'use strict'; /** * Indicates if `Symbol.toStringTag`exists and is the correct type. * `true`, if it exists and is the correct type, otherwise `false`. * * @type boolean */ module.exports = require('<API key>') && typeof Symbol.toStringTag === 'symbol'; }());
#pragma once #include <Register/Utility.hpp> namespace Kvasir { //Serial Peripheral Interface namespace Spi1Mcr{ ///<Module Configuration Register using Addr = Register::Address<0x4002d000,0x02e000fe,0x00000000,unsigned>; Halt enum class HaltVal { v0=0x00000000, ///<Start transfers. v1=0x00000001, ///<Stop transfers. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,HaltVal> halt{}; namespace HaltValC{ constexpr Register::FieldValue<decltype(halt)::Type,HaltVal::v0> v0{}; constexpr Register::FieldValue<decltype(halt)::Type,HaltVal::v1> v1{}; } Sample Point enum class SmplptVal { v00=0x00000000, ///<0 protocol clock cycles between SCK edge and SIN sample v01=0x00000001, ///<1 protocol clock cycle between SCK edge and SIN sample v10=0x00000002, ///<2 protocol clock cycles between SCK edge and SIN sample }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,SmplptVal> smplPt{}; namespace SmplptValC{ constexpr Register::FieldValue<decltype(smplPt)::Type,SmplptVal::v00> v00{}; constexpr Register::FieldValue<decltype(smplPt)::Type,SmplptVal::v01> v01{}; constexpr Register::FieldValue<decltype(smplPt)::Type,SmplptVal::v10> v10{}; } CLR_RXF enum class ClrrxfVal { v0=0x00000000, ///<Do not clear the RX FIFO counter. v1=0x00000001, ///<Clear the RX FIFO counter. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::<API key>::normal>,ClrrxfVal> clrRxf{}; namespace ClrrxfValC{ constexpr Register::FieldValue<decltype(clrRxf)::Type,ClrrxfVal::v0> v0{}; constexpr Register::FieldValue<decltype(clrRxf)::Type,ClrrxfVal::v1> v1{}; } Clear TX FIFO enum class ClrtxfVal { v0=0x00000000, ///<Do not clear the TX FIFO counter. v1=0x00000001, ///<Clear the TX FIFO counter. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::<API key>::normal>,ClrtxfVal> clrTxf{}; namespace ClrtxfValC{ constexpr Register::FieldValue<decltype(clrTxf)::Type,ClrtxfVal::v0> v0{}; constexpr Register::FieldValue<decltype(clrTxf)::Type,ClrtxfVal::v1> v1{}; } Disable Receive FIFO enum class DisrxfVal { v0=0x00000000, ///<RX FIFO is enabled. v1=0x00000001, ///<RX FIFO is disabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,DisrxfVal> disRxf{}; namespace DisrxfValC{ constexpr Register::FieldValue<decltype(disRxf)::Type,DisrxfVal::v0> v0{}; constexpr Register::FieldValue<decltype(disRxf)::Type,DisrxfVal::v1> v1{}; } Disable Transmit FIFO enum class DistxfVal { v0=0x00000000, ///<TX FIFO is enabled. v1=0x00000001, ///<TX FIFO is disabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,DistxfVal> disTxf{}; namespace DistxfValC{ constexpr Register::FieldValue<decltype(disTxf)::Type,DistxfVal::v0> v0{}; constexpr Register::FieldValue<decltype(disTxf)::Type,DistxfVal::v1> v1{}; } Module Disable enum class MdisVal { v0=0x00000000, ///<Enables the module clocks. v1=0x00000001, ///<Allows external logic to disable the module clocks. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,MdisVal> mdis{}; namespace MdisValC{ constexpr Register::FieldValue<decltype(mdis)::Type,MdisVal::v0> v0{}; constexpr Register::FieldValue<decltype(mdis)::Type,MdisVal::v1> v1{}; } Doze Enable enum class DozeVal { v0=0x00000000, ///<Doze mode has no effect on the module. v1=0x00000001, ///<Doze mode disables the module. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,DozeVal> doze{}; namespace DozeValC{ constexpr Register::FieldValue<decltype(doze)::Type,DozeVal::v0> v0{}; constexpr Register::FieldValue<decltype(doze)::Type,DozeVal::v1> v1{}; } Peripheral Chip Select x Inactive State constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,16),Register::ReadWriteAccess,unsigned> pcsis{}; Receive FIFO Overflow Overwrite Enable enum class RooeVal { v0=0x00000000, ///<Incoming data is ignored. v1=0x00000001, ///<Incoming data is shifted into the shift register. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,RooeVal> rooe{}; namespace RooeValC{ constexpr Register::FieldValue<decltype(rooe)::Type,RooeVal::v0> v0{}; constexpr Register::FieldValue<decltype(rooe)::Type,RooeVal::v1> v1{}; } Modified Timing Format Enable enum class MtfeVal { v0=0x00000000, ///<Modified SPI transfer format disabled. v1=0x00000001, ///<Modified SPI transfer format enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,MtfeVal> mtfe{}; namespace MtfeValC{ constexpr Register::FieldValue<decltype(mtfe)::Type,MtfeVal::v0> v0{}; constexpr Register::FieldValue<decltype(mtfe)::Type,MtfeVal::v1> v1{}; } Freeze enum class FrzVal { v0=0x00000000, ///<Do not halt serial transfers in Debug mode. v1=0x00000001, ///<Halt serial transfers in Debug mode. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,FrzVal> frz{}; namespace FrzValC{ constexpr Register::FieldValue<decltype(frz)::Type,FrzVal::v0> v0{}; constexpr Register::FieldValue<decltype(frz)::Type,FrzVal::v1> v1{}; } SPI Configuration. enum class DconfVal { v00=0x00000000, ///<SPI }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,DconfVal> dconf{}; namespace DconfValC{ constexpr Register::FieldValue<decltype(dconf)::Type,DconfVal::v00> v00{}; } Continuous SCK Enable enum class ContsckeVal { v0=0x00000000, ///<Continuous SCK disabled. v1=0x00000001, ///<Continuous SCK enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,ContsckeVal> contScke{}; namespace ContsckeValC{ constexpr Register::FieldValue<decltype(contScke)::Type,ContsckeVal::v0> v0{}; constexpr Register::FieldValue<decltype(contScke)::Type,ContsckeVal::v1> v1{}; } Master/Slave Mode Select enum class MstrVal { v0=0x00000000, ///<Enables Slave mode v1=0x00000001, ///<Enables Master mode }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,MstrVal> mstr{}; namespace MstrValC{ constexpr Register::FieldValue<decltype(mstr)::Type,MstrVal::v0> v0{}; constexpr Register::FieldValue<decltype(mstr)::Type,MstrVal::v1> v1{}; } } namespace Spi1Tcr{ ///<Transfer Count Register using Addr = Register::Address<0x4002d008,0x0000ffff,0x00000000,unsigned>; SPI Transfer Counter constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::ReadWriteAccess,unsigned> spiTcnt{}; } namespace Spi1CtarSlave{ ///<Clock and Transfer Attributes Register (In Slave Mode) using Addr = Register::Address<0x4002d00c,0x01ffffff,0x00000000,unsigned>; Clock Phase enum class CphaVal { v0=0x00000000, ///<Data is captured on the leading edge of SCK and changed on the following edge. v1=0x00000001, ///<Data is changed on the leading edge of SCK and captured on the following edge. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,CphaVal> cpha{}; namespace CphaValC{ constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v1> v1{}; } Clock Polarity enum class CpolVal { v0=0x00000000, ///<The inactive state value of SCK is low. v1=0x00000001, ///<The inactive state value of SCK is high. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,CpolVal> cpol{}; namespace CpolValC{ constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v1> v1{}; } Frame Size constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,27),Register::ReadWriteAccess,unsigned> fmsz{}; } namespace Spi1Sr{ ///<Status Register using Addr = Register::Address<0x4002d02c,0x25f50000,0x00000000,unsigned>; Pop Next Pointer constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> popnxtptr{}; RX FIFO Counter constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,4),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxctr{}; Transmit Next Pointer constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,8),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txnxtptr{}; TX FIFO Counter constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,12),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txctr{}; Receive FIFO Drain Flag enum class RfdfVal { v0=0x00000000, ///<RX FIFO is empty. v1=0x00000001, ///<RX FIFO is not empty. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,RfdfVal> rfdf{}; namespace RfdfValC{ constexpr Register::FieldValue<decltype(rfdf)::Type,RfdfVal::v0> v0{}; constexpr Register::FieldValue<decltype(rfdf)::Type,RfdfVal::v1> v1{}; } Receive FIFO Overflow Flag enum class RfofVal { v0=0x00000000, ///<No Rx FIFO overflow. v1=0x00000001, ///<Rx FIFO overflow has occurred. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,RfofVal> rfof{}; namespace RfofValC{ constexpr Register::FieldValue<decltype(rfof)::Type,RfofVal::v0> v0{}; constexpr Register::FieldValue<decltype(rfof)::Type,RfofVal::v1> v1{}; } Transmit FIFO Fill Flag enum class TfffVal { v0=0x00000000, ///<TX FIFO is full. v1=0x00000001, ///<TX FIFO is not full. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,TfffVal> tfff{}; namespace TfffValC{ constexpr Register::FieldValue<decltype(tfff)::Type,TfffVal::v0> v0{}; constexpr Register::FieldValue<decltype(tfff)::Type,TfffVal::v1> v1{}; } Transmit FIFO Underflow Flag enum class TfufVal { v0=0x00000000, ///<No TX FIFO underflow. v1=0x00000001, ///<TX FIFO underflow has occurred. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,TfufVal> tfuf{}; namespace TfufValC{ constexpr Register::FieldValue<decltype(tfuf)::Type,TfufVal::v0> v0{}; constexpr Register::FieldValue<decltype(tfuf)::Type,TfufVal::v1> v1{}; } End of Queue Flag enum class EoqfVal { v0=0x00000000, ///<EOQ is not set in the executing command. v1=0x00000001, ///<EOQ is set in the executing SPI command. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,EoqfVal> eoqf{}; namespace EoqfValC{ constexpr Register::FieldValue<decltype(eoqf)::Type,EoqfVal::v0> v0{}; constexpr Register::FieldValue<decltype(eoqf)::Type,EoqfVal::v1> v1{}; } TX and RX Status enum class TxrxsVal { v0=0x00000000, ///<Transmit and receive operations are disabled (The module is in Stopped state). v1=0x00000001, ///<Transmit and receive operations are enabled (The module is in Running state). }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,TxrxsVal> txrxs{}; namespace TxrxsValC{ constexpr Register::FieldValue<decltype(txrxs)::Type,TxrxsVal::v0> v0{}; constexpr Register::FieldValue<decltype(txrxs)::Type,TxrxsVal::v1> v1{}; } Transfer Complete Flag enum class TcfVal { v0=0x00000000, ///<Transfer not complete. v1=0x00000001, ///<Transfer complete. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,TcfVal> tcf{}; namespace TcfValC{ constexpr Register::FieldValue<decltype(tcf)::Type,TcfVal::v0> v0{}; constexpr Register::FieldValue<decltype(tcf)::Type,TcfVal::v1> v1{}; } } namespace Spi1Rser{ ///<DMA/Interrupt Request Select and Enable Register using Addr = Register::Address<0x4002d030,0x64f4ffff,0x00000000,unsigned>; Receive FIFO Drain DMA or Interrupt Request Select enum class RfdfdirsVal { v0=0x00000000, ///<Interrupt request. v1=0x00000001, ///<DMA request. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,RfdfdirsVal> rfdfDirs{}; namespace RfdfdirsValC{ constexpr Register::FieldValue<decltype(rfdfDirs)::Type,RfdfdirsVal::v0> v0{}; constexpr Register::FieldValue<decltype(rfdfDirs)::Type,RfdfdirsVal::v1> v1{}; } Receive FIFO Drain Request Enable enum class RfdfreVal { v0=0x00000000, ///<RFDF interrupt or DMA requests are disabled. v1=0x00000001, ///<RFDF interrupt or DMA requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,RfdfreVal> rfdfRe{}; namespace RfdfreValC{ constexpr Register::FieldValue<decltype(rfdfRe)::Type,RfdfreVal::v0> v0{}; constexpr Register::FieldValue<decltype(rfdfRe)::Type,RfdfreVal::v1> v1{}; } Receive FIFO Overflow Request Enable enum class RfofreVal { v0=0x00000000, ///<RFOF interrupt requests are disabled. v1=0x00000001, ///<RFOF interrupt requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,RfofreVal> rfofRe{}; namespace RfofreValC{ constexpr Register::FieldValue<decltype(rfofRe)::Type,RfofreVal::v0> v0{}; constexpr Register::FieldValue<decltype(rfofRe)::Type,RfofreVal::v1> v1{}; } Transmit FIFO Fill DMA or Interrupt Request Select enum class TfffdirsVal { v0=0x00000000, ///<TFFF flag generates interrupt requests. v1=0x00000001, ///<TFFF flag generates DMA requests. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,TfffdirsVal> tfffDirs{}; namespace TfffdirsValC{ constexpr Register::FieldValue<decltype(tfffDirs)::Type,TfffdirsVal::v0> v0{}; constexpr Register::FieldValue<decltype(tfffDirs)::Type,TfffdirsVal::v1> v1{}; } Transmit FIFO Fill Request Enable enum class TfffreVal { v0=0x00000000, ///<TFFF interrupts or DMA requests are disabled. v1=0x00000001, ///<TFFF interrupts or DMA requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,TfffreVal> tfffRe{}; namespace TfffreValC{ constexpr Register::FieldValue<decltype(tfffRe)::Type,TfffreVal::v0> v0{}; constexpr Register::FieldValue<decltype(tfffRe)::Type,TfffreVal::v1> v1{}; } Transmit FIFO Underflow Request Enable enum class TfufreVal { v0=0x00000000, ///<TFUF interrupt requests are disabled. v1=0x00000001, ///<TFUF interrupt requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,TfufreVal> tfufRe{}; namespace TfufreValC{ constexpr Register::FieldValue<decltype(tfufRe)::Type,TfufreVal::v0> v0{}; constexpr Register::FieldValue<decltype(tfufRe)::Type,TfufreVal::v1> v1{}; } Finished Request Enable enum class EoqfreVal { v0=0x00000000, ///<EOQF interrupt requests are disabled. v1=0x00000001, ///<EOQF interrupt requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,EoqfreVal> eoqfRe{}; namespace EoqfreValC{ constexpr Register::FieldValue<decltype(eoqfRe)::Type,EoqfreVal::v0> v0{}; constexpr Register::FieldValue<decltype(eoqfRe)::Type,EoqfreVal::v1> v1{}; } Transmission Complete Request Enable enum class TcfreVal { v0=0x00000000, ///<TCF interrupt requests are disabled. v1=0x00000001, ///<TCF interrupt requests are enabled. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,TcfreVal> tcfRe{}; namespace TcfreValC{ constexpr Register::FieldValue<decltype(tcfRe)::Type,TcfreVal::v0> v0{}; constexpr Register::FieldValue<decltype(tcfRe)::Type,TcfreVal::v1> v1{}; } } namespace Spi1Pushr{ ///<PUSH TX FIFO Register In Master Mode using Addr = Register::Address<0x4002d034,0x03e00000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> txdata{}; no description available constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,16),Register::ReadWriteAccess,unsigned> pcs{}; Clear Transfer Counter enum class CtcntVal { v0=0x00000000, ///<Do not clear the TCR[TCNT] field. v1=0x00000001, ///<Clear the TCR[TCNT] field. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,CtcntVal> ctcnt{}; namespace CtcntValC{ constexpr Register::FieldValue<decltype(ctcnt)::Type,CtcntVal::v0> v0{}; constexpr Register::FieldValue<decltype(ctcnt)::Type,CtcntVal::v1> v1{}; } End Of Queue enum class EoqVal { v0=0x00000000, ///<The SPI data is not the last data to transfer. v1=0x00000001, ///<The SPI data is the last data to transfer. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,EoqVal> eoq{}; namespace EoqValC{ constexpr Register::FieldValue<decltype(eoq)::Type,EoqVal::v0> v0{}; constexpr Register::FieldValue<decltype(eoq)::Type,EoqVal::v1> v1{}; } Clock and Transfer Attributes Select constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,28),Register::ReadWriteAccess,unsigned> ctas{}; Continuous Peripheral Chip Select Enable enum class ContVal { v0=0x00000000, ///<Return PCSn signals to their inactive state between transfers. v1=0x00000001, ///<Keep PCSn signals asserted between transfers. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,ContVal> cont{}; namespace ContValC{ constexpr Register::FieldValue<decltype(cont)::Type,ContVal::v0> v0{}; constexpr Register::FieldValue<decltype(cont)::Type,ContVal::v1> v1{}; } } namespace Spi1PushrSlave{ ///<PUSH TX FIFO Register In Slave Mode using Addr = Register::Address<0x4002d034,0x00000000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::ReadWriteAccess,unsigned> txdata{}; } namespace Spi1Popr{ ///<POP RX FIFO Register using Addr = Register::Address<0x4002d038,0x00000000,0x00000000,unsigned>; Received Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxdata{}; } namespace Spi1Ctar0{ ///<Clock and Transfer Attributes Register (In Master Mode) using Addr = Register::Address<0x4002d00c,0x00000000,0x00000000,unsigned>; Baud Rate Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> br{}; Delay After Transfer Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,4),Register::ReadWriteAccess,unsigned> dt{}; After SCK Delay Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,8),Register::ReadWriteAccess,unsigned> asc{}; PCS to SCK Delay Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,12),Register::ReadWriteAccess,unsigned> cssck{}; Baud Rate Prescaler enum class PbrVal { v00=0x00000000, ///<Baud Rate Prescaler value is 2. v01=0x00000001, ///<Baud Rate Prescaler value is 3. v10=0x00000002, ///<Baud Rate Prescaler value is 5. v11=0x00000003, ///<Baud Rate Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,16),Register::ReadWriteAccess,PbrVal> pbr{}; namespace PbrValC{ constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v00> v00{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v01> v01{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v10> v10{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v11> v11{}; } Delay after Transfer Prescaler enum class PdtVal { v00=0x00000000, ///<Delay after Transfer Prescaler value is 1. v01=0x00000001, ///<Delay after Transfer Prescaler value is 3. v10=0x00000002, ///<Delay after Transfer Prescaler value is 5. v11=0x00000003, ///<Delay after Transfer Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,18),Register::ReadWriteAccess,PdtVal> pdt{}; namespace PdtValC{ constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v00> v00{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v01> v01{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v10> v10{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v11> v11{}; } After SCK Delay Prescaler enum class PascVal { v00=0x00000000, ///<Delay after Transfer Prescaler value is 1. v01=0x00000001, ///<Delay after Transfer Prescaler value is 3. v10=0x00000002, ///<Delay after Transfer Prescaler value is 5. v11=0x00000003, ///<Delay after Transfer Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,20),Register::ReadWriteAccess,PascVal> pasc{}; namespace PascValC{ constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v00> v00{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v01> v01{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v10> v10{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v11> v11{}; } PCS to SCK Delay Prescaler enum class PcssckVal { v00=0x00000000, ///<PCS to SCK Prescaler value is 1. v01=0x00000001, ///<PCS to SCK Prescaler value is 3. v10=0x00000002, ///<PCS to SCK Prescaler value is 5. v11=0x00000003, ///<PCS to SCK Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,22),Register::ReadWriteAccess,PcssckVal> pcssck{}; namespace PcssckValC{ constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v00> v00{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v01> v01{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v10> v10{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v11> v11{}; } LSB First enum class LsbfeVal { v0=0x00000000, ///<Data is transferred MSB first. v1=0x00000001, ///<Data is transferred LSB first. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,LsbfeVal> lsbfe{}; namespace LsbfeValC{ constexpr Register::FieldValue<decltype(lsbfe)::Type,LsbfeVal::v0> v0{}; constexpr Register::FieldValue<decltype(lsbfe)::Type,LsbfeVal::v1> v1{}; } Clock Phase enum class CphaVal { v0=0x00000000, ///<Data is captured on the leading edge of SCK and changed on the following edge. v1=0x00000001, ///<Data is changed on the leading edge of SCK and captured on the following edge. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,CphaVal> cpha{}; namespace CphaValC{ constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v1> v1{}; } Clock Polarity enum class CpolVal { v0=0x00000000, ///<The inactive state value of SCK is low. v1=0x00000001, ///<The inactive state value of SCK is high. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,CpolVal> cpol{}; namespace CpolValC{ constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v1> v1{}; } Frame Size constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,27),Register::ReadWriteAccess,unsigned> fmsz{}; Double Baud Rate enum class DbrVal { v0=0x00000000, ///<The baud rate is computed normally with a 50/50 duty cycle. v1=0x00000001, ///<The baud rate is doubled with the duty cycle depending on the Baud Rate Prescaler. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,DbrVal> dbr{}; namespace DbrValC{ constexpr Register::FieldValue<decltype(dbr)::Type,DbrVal::v0> v0{}; constexpr Register::FieldValue<decltype(dbr)::Type,DbrVal::v1> v1{}; } } namespace Spi1Ctar1{ ///<Clock and Transfer Attributes Register (In Master Mode) using Addr = Register::Address<0x4002d010,0x00000000,0x00000000,unsigned>; Baud Rate Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> br{}; Delay After Transfer Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,4),Register::ReadWriteAccess,unsigned> dt{}; After SCK Delay Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,8),Register::ReadWriteAccess,unsigned> asc{}; PCS to SCK Delay Scaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,12),Register::ReadWriteAccess,unsigned> cssck{}; Baud Rate Prescaler enum class PbrVal { v00=0x00000000, ///<Baud Rate Prescaler value is 2. v01=0x00000001, ///<Baud Rate Prescaler value is 3. v10=0x00000002, ///<Baud Rate Prescaler value is 5. v11=0x00000003, ///<Baud Rate Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,16),Register::ReadWriteAccess,PbrVal> pbr{}; namespace PbrValC{ constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v00> v00{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v01> v01{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v10> v10{}; constexpr Register::FieldValue<decltype(pbr)::Type,PbrVal::v11> v11{}; } Delay after Transfer Prescaler enum class PdtVal { v00=0x00000000, ///<Delay after Transfer Prescaler value is 1. v01=0x00000001, ///<Delay after Transfer Prescaler value is 3. v10=0x00000002, ///<Delay after Transfer Prescaler value is 5. v11=0x00000003, ///<Delay after Transfer Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,18),Register::ReadWriteAccess,PdtVal> pdt{}; namespace PdtValC{ constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v00> v00{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v01> v01{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v10> v10{}; constexpr Register::FieldValue<decltype(pdt)::Type,PdtVal::v11> v11{}; } After SCK Delay Prescaler enum class PascVal { v00=0x00000000, ///<Delay after Transfer Prescaler value is 1. v01=0x00000001, ///<Delay after Transfer Prescaler value is 3. v10=0x00000002, ///<Delay after Transfer Prescaler value is 5. v11=0x00000003, ///<Delay after Transfer Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,20),Register::ReadWriteAccess,PascVal> pasc{}; namespace PascValC{ constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v00> v00{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v01> v01{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v10> v10{}; constexpr Register::FieldValue<decltype(pasc)::Type,PascVal::v11> v11{}; } PCS to SCK Delay Prescaler enum class PcssckVal { v00=0x00000000, ///<PCS to SCK Prescaler value is 1. v01=0x00000001, ///<PCS to SCK Prescaler value is 3. v10=0x00000002, ///<PCS to SCK Prescaler value is 5. v11=0x00000003, ///<PCS to SCK Prescaler value is 7. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,22),Register::ReadWriteAccess,PcssckVal> pcssck{}; namespace PcssckValC{ constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v00> v00{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v01> v01{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v10> v10{}; constexpr Register::FieldValue<decltype(pcssck)::Type,PcssckVal::v11> v11{}; } LSB First enum class LsbfeVal { v0=0x00000000, ///<Data is transferred MSB first. v1=0x00000001, ///<Data is transferred LSB first. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,LsbfeVal> lsbfe{}; namespace LsbfeValC{ constexpr Register::FieldValue<decltype(lsbfe)::Type,LsbfeVal::v0> v0{}; constexpr Register::FieldValue<decltype(lsbfe)::Type,LsbfeVal::v1> v1{}; } Clock Phase enum class CphaVal { v0=0x00000000, ///<Data is captured on the leading edge of SCK and changed on the following edge. v1=0x00000001, ///<Data is changed on the leading edge of SCK and captured on the following edge. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,CphaVal> cpha{}; namespace CphaValC{ constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpha)::Type,CphaVal::v1> v1{}; } Clock Polarity enum class CpolVal { v0=0x00000000, ///<The inactive state value of SCK is low. v1=0x00000001, ///<The inactive state value of SCK is high. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,CpolVal> cpol{}; namespace CpolValC{ constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v0> v0{}; constexpr Register::FieldValue<decltype(cpol)::Type,CpolVal::v1> v1{}; } Frame Size constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,27),Register::ReadWriteAccess,unsigned> fmsz{}; Double Baud Rate enum class DbrVal { v0=0x00000000, ///<The baud rate is computed normally with a 50/50 duty cycle. v1=0x00000001, ///<The baud rate is doubled with the duty cycle depending on the Baud Rate Prescaler. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,DbrVal> dbr{}; namespace DbrValC{ constexpr Register::FieldValue<decltype(dbr)::Type,DbrVal::v0> v0{}; constexpr Register::FieldValue<decltype(dbr)::Type,DbrVal::v1> v1{}; } } namespace Spi1Txfr0{ ///<Transmit FIFO Registers using Addr = Register::Address<0x4002d03c,0x00000000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txdata{}; Transmit Command or Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txcmdTxdata{}; } namespace Spi1Txfr1{ ///<Transmit FIFO Registers using Addr = Register::Address<0x4002d040,0x00000000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txdata{}; Transmit Command or Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txcmdTxdata{}; } namespace Spi1Txfr2{ ///<Transmit FIFO Registers using Addr = Register::Address<0x4002d044,0x00000000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txdata{}; Transmit Command or Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txcmdTxdata{}; } namespace Spi1Txfr3{ ///<Transmit FIFO Registers using Addr = Register::Address<0x4002d048,0x00000000,0x00000000,unsigned>; Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txdata{}; Transmit Command or Transmit Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> txcmdTxdata{}; } namespace Spi1Rxfr0{ ///<Receive FIFO Registers using Addr = Register::Address<0x4002d07c,0x00000000,0x00000000,unsigned>; Receive Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxdata{}; } namespace Spi1Rxfr1{ ///<Receive FIFO Registers using Addr = Register::Address<0x4002d080,0x00000000,0x00000000,unsigned>; Receive Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxdata{}; } namespace Spi1Rxfr2{ ///<Receive FIFO Registers using Addr = Register::Address<0x4002d084,0x00000000,0x00000000,unsigned>; Receive Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxdata{}; } namespace Spi1Rxfr3{ ///<Receive FIFO Registers using Addr = Register::Address<0x4002d088,0x00000000,0x00000000,unsigned>; Receive Data constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::<API key>::normal>,unsigned> rxdata{}; } }
// +build go1.10,codegen package api import ( "encoding/json" "testing" ) func buildAPI() *API { a := &API{} stringShape := &Shape{ API: a, ShapeName: "string", Type: "string", } stringShapeRef := &ShapeRef{ API: a, ShapeName: "string", Shape: stringShape, } intShape := &Shape{ API: a, ShapeName: "int", Type: "int", } intShapeRef := &ShapeRef{ API: a, ShapeName: "int", Shape: intShape, } nestedComplexShape := &Shape{ API: a, ShapeName: "NestedComplexShape", MemberRefs: map[string]*ShapeRef{ "NestedField": stringShapeRef, }, Type: "structure", } <API key> := &ShapeRef{ API: a, ShapeName: "NestedComplexShape", Shape: nestedComplexShape, } nestedListShape := &Shape{ API: a, ShapeName: "NestedListShape", MemberRef: *<API key>, Type: "list", } nestedListShapeRef := &ShapeRef{ API: a, ShapeName: "NestedListShape", Shape: nestedListShape, } complexShape := &Shape{ API: a, ShapeName: "ComplexShape", MemberRefs: map[string]*ShapeRef{ "Field": stringShapeRef, "List": nestedListShapeRef, }, Type: "structure", } complexShapeRef := &ShapeRef{ API: a, ShapeName: "ComplexShape", Shape: complexShape, } listShape := &Shape{ API: a, ShapeName: "ListShape", MemberRef: *complexShapeRef, Type: "list", } listShapeRef := &ShapeRef{ API: a, ShapeName: "ListShape", Shape: listShape, } listsShape := &Shape{ API: a, ShapeName: "ListsShape", MemberRef: *listShapeRef, Type: "list", } listsShapeRef := &ShapeRef{ API: a, ShapeName: "ListsShape", Shape: listsShape, } input := &Shape{ API: a, ShapeName: "FooInput", MemberRefs: map[string]*ShapeRef{ "BarShape": stringShapeRef, "ComplexField": complexShapeRef, "ListField": listShapeRef, "ListsField": listsShapeRef, }, Type: "structure", } output := &Shape{ API: a, ShapeName: "FooOutput", MemberRefs: map[string]*ShapeRef{ "BazShape": intShapeRef, "ComplexField": complexShapeRef, "ListField": listShapeRef, "ListsField": listsShapeRef, }, Type: "structure", } inputRef := ShapeRef{ API: a, ShapeName: "FooInput", Shape: input, } outputRef := ShapeRef{ API: a, ShapeName: "FooOutput", Shape: output, } operations := map[string]*Operation{ "Foo": { API: a, Name: "Foo", ExportedName: "Foo", InputRef: inputRef, OutputRef: outputRef, }, } a.Operations = operations a.Shapes = map[string]*Shape{ "FooInput": input, "FooOutput": output, "string": stringShape, "int": intShape, "NestedComplexShape": nestedComplexShape, "NestedListShape": nestedListShape, "ComplexShape": complexShape, "ListShape": listShape, "ListsShape": listsShape, } a.Metadata = Metadata{ ServiceAbbreviation: "FooService", } a.BaseImportPath = "github.com/aws/aws-sdk-go/service/" a.Setup() return a } func <API key>(t *testing.T) { example := ` { "version": "1.0", "examples": { "Foo": [ { "input": { "BarShape": "Hello world", "ComplexField": { "Field": "bar", "List": [ { "NestedField": "qux" } ] }, "ListField": [ { "Field": "baz" } ], "ListsField": [ [ { "Field": "baz" } ] ] }, "output": { "BazShape": 1 }, "comments": { "input": { }, "output": { } }, "description": "Foo bar baz qux", "title": "I pity the foo" } ] } } ` a := buildAPI() def := &ExamplesDefinition{} err := json.Unmarshal([]byte(example), def) if err != nil { t.Error(err) } def.API = a def.setup() expected := ` import ( "fmt" "strings" "time" "` + SDKImportRoot + `/aws" "` + SDKImportRoot + `/aws/awserr" "` + SDKImportRoot + `/aws/session" "` + SDKImportRoot + `/service/fooservice" ) var _ time.Duration var _ strings.Reader var _ aws.Config func parseTime(layout, value string) *time.Time { t, err := time.Parse(layout, value) if err != nil { panic(err) } return &t } // I pity the foo // Foo bar baz qux func <API key>() { svc := fooservice.New(session.New()) input := &fooservice.FooInput{ BarShape: aws.String("Hello world"), ComplexField: &fooservice.ComplexShape{ Field: aws.String("bar"), List: []*fooservice.NestedComplexShape{ { NestedField: aws.String("qux"), }, }, }, ListField: []*fooservice.ComplexShape{ { Field: aws.String("baz"), }, }, ListsField: [][]*fooservice.ComplexShape{ { { Field: aws.String("baz"), }, }, }, } result, err := svc.Foo(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { default: fmt.Println(aerr.Error()) } } else { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) } return } fmt.Println(result) } ` if expected != a.ExamplesGoCode() { t.Errorf("Expected:\n%s\nReceived:\n%s\n", expected, a.ExamplesGoCode()) } } func TestBuildShape(t *testing.T) { a := buildAPI() cases := []struct { defs map[string]interface{} expected string }{ { defs: map[string]interface{}{ "barShape": "Hello World", }, expected: "BarShape: aws.String(\"Hello World\"),\n", }, { defs: map[string]interface{}{ "BarShape": "Hello World", }, expected: "BarShape: aws.String(\"Hello World\"),\n", }, } for _, c := range cases { ref := a.Operations["Foo"].InputRef shapeStr := <API key>{}.BuildShape(&ref, c.defs, false) if c.expected != shapeStr { t.Errorf("Expected:\n%s\nReceived:\n%s", c.expected, shapeStr) } } }
id: version-2.6.0-admin-api-brokers title: Managing Brokers sidebar_label: Brokers original_id: admin-api-brokers Pulsar brokers consist of two components: 1. An HTTP server exposing a {@inject: rest:REST:/} interface administration and [topic](<API key>.md#topic) lookup. 2. A dispatcher that handles all Pulsar [message](<API key>.md#message) transfers. [Brokers](<API key>.md#broker) can be managed via: * The [`brokers`](<API key>.md#brokers) command of the [`pulsar-admin`](<API key>.md) tool * The `/admin/v2/brokers` endpoint of the admin {@inject: rest:REST:/} API * The `brokers` method of the {@inject: javadoc:PulsarAdmin:/admin/org/apache/pulsar/client/admin/PulsarAdmin.html} object in the [Java API](<API key>.md) In addition to being configurable when you start them up, brokers can also be [dynamically configured](#<API key>). > See the [Configuration](<API key>.md#broker) page for a full listing of broker-specific configuration parameters. ## Brokers resources List active brokers Fetch all available active brokers that are serving traffic. # pulsar-admin shell $ pulsar-admin brokers list use broker1.use.org.com:8080 ### REST {@inject: endpoint|GET|/admin/v2/brokers/:cluster|operation/getActiveBrokers?version=[[pulsar:version_number]]} ### Java java admin.brokers().getActiveBrokers(clusterName) # list of namespaces owned by a given broker It finds all namespaces which are owned and served by a given broker. ### CLI shell $ pulsar-admin brokers namespaces use \ --url broker1.use.org.com:8080 json { "my-property/use/my-ns/<API key>": { "broker_assignment": "shared", "is_controlled": false, "is_active": true } } ### REST {@inject: endpoint|GET|/admin/v2/brokers/:cluster/:broker/ownedNamespaces|operation/getOwnedNamespaes?version=[[pulsar:version_number]]} ### Java java admin.brokers().getOwnedNamespaces(cluster,brokerUrl); Dynamic broker configuration One way to configure a Pulsar [broker](<API key>.md#broker) is to supply a [configuration](<API key>.md#broker) when the broker is [started up](reference-cli-tools.md#pulsar-broker). But since all broker configuration in Pulsar is stored in ZooKeeper, configuration values can also be dynamically updated *while the broker is running*. When you update broker configuration dynamically, ZooKeeper will notify the broker of the change and the broker will then override any existing configuration values. * The [`brokers`](<API key>.md#brokers) command for the [`pulsar-admin`](<API key>.md) tool has a variety of subcommands that enable you to manipulate a broker's configuration dynamically, enabling you to [update config values](#<API key>) and more. * In the Pulsar admin {@inject: rest:REST:/} API, dynamic configuration is managed through the `/admin/v2/brokers/configuration` endpoint. Update dynamic configuration # pulsar-admin The [`<API key>`](<API key>.md#<API key>) subcommand will update existing configuration. It takes two arguments: the name of the parameter and the new value using the `config` and `value` flag respectively. Here's an example for the [`<API key>`](<API key>.md#<API key>) parameter: shell $ pulsar-admin brokers <API key> --config <API key> --value 100 # REST API {@inject: endpoint|POST|/admin/v2/brokers/configuration/:configName/:configValue|operation/<API key>?version=[[pulsar:version_number]]} # Java java admin.brokers().<API key>(configName, configValue); List updated values Fetch a list of all potentially updatable configuration parameters. # pulsar-admin shell $ pulsar-admin brokers list-dynamic-config <API key> # REST API {@inject: endpoint|GET|/admin/v2/brokers/configuration|operation/<API key>?version=[[pulsar:version_number]]} # Java java admin.brokers().<API key>(); List all Fetch a list of all parameters that have been dynamically updated. # pulsar-admin shell $ pulsar-admin brokers <API key> <API key>:100 # REST API {@inject: endpoint|GET|/admin/v2/brokers/configuration/values|operation/<API key>?version=[[pulsar:version_number]]} # Java java admin.brokers().<API key>();
#ifndef <API key> #define <API key> #ifndef _ASMLANGUAGE /* * Multiboot (version 1) boot information structure. * * Only fields/values of interest to Zephyr are enumerated: at * present, that means only those pertaining to the framebuffer. */ struct multiboot_info { uint32_t flags; uint32_t mem_lower; uint32_t mem_upper; uint32_t unused0[8]; uint32_t mmap_length; uint32_t mmap_addr; uint32_t unused1[9]; uint32_t fb_addr_lo; uint32_t fb_addr_hi; uint32_t fb_pitch; uint32_t fb_width; uint32_t fb_height; uint8_t fb_bpp; uint8_t fb_type; uint8_t fb_color_info[6]; }; extern struct multiboot_info multiboot_info; extern void z_multiboot_init(struct multiboot_info *info_pa); /* * the mmap_addr field points to a series of entries of the following form. */ struct multiboot_mmap { uint32_t size; uint64_t base; uint64_t length; uint32_t type; } __packed; #endif /* _ASMLANGUAGE */ /* * Possible values for multiboot_mmap.type field. * Other values should be assumed to be unusable ranges. */ #define MULTIBOOT_MMAP_RAM 1 /* available RAM */ #define MULTIBOOT_MMAP_ACPI 3 /* reserved for ACPI */ #define MULTIBOOT_MMAP_NVS 4 /* ACPI non-volatile */ #define <API key> 5 /* defective RAM module */ /* * Magic numbers: the kernel multiboot header (see crt0.S) begins with * <API key> to signal to the booter that it supports * multiboot. On kernel entry, EAX is set to MULTIBOOT_EAX_MAGIC to * signal that the boot loader is multiboot compliant. */ #define <API key> 0x1BADB002 #define MULTIBOOT_EAX_MAGIC 0x2BADB002 /* * Typically, we put no flags in the multiboot header, as it exists solely * to reassure the loader that we're a valid binary. The exception to this * is when we want the loader to configure the framebuffer for us. */ #define <API key> BIT(1) /* want mem_/mmap_* info */ #define <API key> BIT(2) /* want fb_* info */ #ifdef <API key> #define <API key> \ (<API key> | <API key>) #else #define <API key> <API key> #endif /* The flags in the boot info structure tell us which fields are valid. */ #define <API key> (1 << 0) /* mem_* valid */ #define <API key> (1 << 6) /* mmap_* valid */ #define <API key> (1 << 12) /* fb_* valid */ /* The only fb_type we support is RGB. No text modes and no color palettes. */ #define <API key> 1 #endif /* <API key> */
package org.elasticsearch.xpack.core.ml.datafeed; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.<API key>; import java.io.IOException; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; public class <API key> extends <API key><<API key>> { @Override protected <API key> createTestInstance(){ return <API key>(100); } @Override protected Writeable.Reader<<API key>> instanceReader() { return <API key>::new; } @Override protected <API key> doParseInstance(XContentParser parser) { return <API key>.STRICT_PARSER.apply(parser, null); } public void testConstructor() { expectThrows(<API key>.class, () -> new <API key>(true, TimeValue.MINUS_ONE)); expectThrows(<API key>.class, () -> new <API key>(true, TimeValue.timeValueHours(25))); } public void <API key>() { <API key> <API key> = <API key>.<API key>(TimeValue.timeValueHours(5)); assertThat(<API key>.isEnabled(), equalTo(true)); assertThat(<API key>.getCheckWindow(), equalTo(TimeValue.timeValueHours(5))); } public void <API key>() { <API key> <API key> = <API key>.<API key>(); assertThat(<API key>.isEnabled(), equalTo(false)); assertThat(<API key>.getCheckWindow(), equalTo(null)); } public void <API key>() { <API key> <API key> = <API key>.<API key>(); assertThat(<API key>.isEnabled(), equalTo(true)); assertThat(<API key>.getCheckWindow(), is(nullValue())); } public static <API key> <API key>(long bucketSpanMillis) { boolean enabled = randomBoolean(); TimeValue timeWindow = null; if (enabled || randomBoolean()) { // time span is required to be at least 1 millis, so we use a custom method to generate a time value here timeWindow = new TimeValue(randomLongBetween(bucketSpanMillis,bucketSpanMillis*2)); } return new <API key>(enabled, timeWindow); } @Override protected <API key> mutateInstance(<API key> instance) throws IOException { boolean enabled = instance.isEnabled(); TimeValue timeWindow = instance.getCheckWindow(); switch (between(0, 1)) { case 0: enabled = enabled == false; if (randomBoolean()) { timeWindow = TimeValue.timeValueMillis(randomLongBetween(1, 1000)); } else { timeWindow = null; } break; case 1: if (timeWindow == null) { timeWindow = TimeValue.timeValueMillis(randomLongBetween(1, 1000)); } else { timeWindow = new TimeValue(timeWindow.getMillis() + between(10, 100)); } enabled = true; break; default: throw new AssertionError("Illegal randomisation branch"); } return new <API key>(enabled, timeWindow); } }
namespace RakNet { using System; using System.Runtime.InteropServices; public class <API key> : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; internal <API key>(IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new HandleRef(this, cPtr); } internal static HandleRef getCPtr(<API key> obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; } ~<API key>() { Dispose(); } public virtual void Dispose() { lock(this) { if (swigCPtr.Handle != IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; RakNetPINVOKE.<API key>(swigCPtr); } swigCPtr = new HandleRef(null, IntPtr.Zero); } GC.SuppressFinalize(this); } } public <API key>() : this(RakNetPINVOKE.<API key>(), true) { } public virtual void ShowFailure(string message) { RakNetPINVOKE.<API key>(swigCPtr, message); } public virtual void ShowDiagnostic(string message) { RakNetPINVOKE.<API key>(swigCPtr, message); } } }
class ArgpStandalone < Formula desc "Standalone version of arguments parsing functions from GLIBC" homepage "https: url "https: sha256 "<SHA256-like>" livecheck do url :homepage regex(/href=.*?argp-standalone[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do cellar :any_skip_relocation rebuild 1 sha256 "<SHA256-like>" => :catalina sha256 "<SHA256-like>" => :mojave sha256 "<SHA256-like>" => :high_sierra sha256 "<SHA256-like>" => :sierra sha256 "<SHA256-like>" => :el_capitan sha256 "<SHA256-like>" => :yosemite sha256 "<SHA256-like>" => :mavericks end # This patch fixes compilation with Clang. patch :p0 do url "https://raw.githubusercontent.com/Homebrew/formula-patches/b5f0ad3/argp-standalone/<API key>.h" sha256 "<SHA256-like>" end def install system "./configure", "--prefix=#{prefix}" system "make", "install" lib.install "libargp.a" include.install "argp.h" end test do (testpath/"test.c").write <<~EOS #include <stdio.h> #include <argp.h> int main(int argc, char ** argv) { return argp_parse(0, argc, argv, 0, 0, 0); } EOS system ENV.cc, "test.c", "-L#{lib}", "-largp", "-o", "test" system "./test" end end
var counter = 0; <! counter += 1; <!--the comment extends to these characters counter += 1; counter += 1;<!--the comment extends to these characters counter += 1; var x = 0; x = -1 <!--x; // Because this test concerns the interpretation of non-executable character // sequences within ECMAScript source code, special care must be taken to // ensure that executable code is evaluated as expected. // Express the intended behavior by intentionally throwing an error; this // guarantees that test runners will only consider the test "passing" if // executable sequences are correctly interpreted as such. if (counter === 4 && x === -1) { throw new Test262Error(); }
class SwaggerCodegenAT2 < Formula desc "Generate clients, server stubs, and docs from an OpenAPI spec" homepage "https://swagger.io/swagger-codegen/" url "https://github.com/swagger-api/swagger-codegen/archive/v2.4.12.tar.gz" sha256 "<SHA256-like>" bottle do cellar :any_skip_relocation sha256 "<SHA256-like>" => :catalina sha256 "<SHA256-like>" => :mojave sha256 "<SHA256-like>" => :high_sierra end keg_only :versioned_formula depends_on "maven" => :build depends_on :java => "1.8" def install # Need to set JAVA_HOME manually since maven overrides 1.8 with 1.7+ cmd = Language::Java.java_home_cmd("1.8") ENV["JAVA_HOME"] = Utils.popen_read(cmd).chomp system "mvn", "clean", "package" libexec.install "modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" bin.write_jar_script libexec/"swagger-codegen-cli.jar", "swagger-codegen" end test do (testpath/"minimal.yaml").write <<~EOS swagger: '2.0' info: version: 0.0.0 title: Simple API paths: /: get: responses: 200: description: OK EOS system "#{bin}/swagger-codegen", "generate", "-i", "minimal.yaml", "-l", "html2" assert_includes File.read(testpath/"index.html"), "<h1>Simple API</h1>" end end
<API key>(function(TA) { assert( compareArray( new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0), [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); assert( compareArray( new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0), [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2), [2n, 3n, 4n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); assert( compareArray( new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2), [3n, 4n, 5n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); });
// -*- mode: C++ -*- // This file is part of `csmith', a random generator of C programs. // modification, are permitted provided that the following conditions are met: // documentation and/or other materials provided with the distribution. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #ifndef STATEMENT_BREAK_H #define STATEMENT_BREAK_H #include <ostream> #include "Statement.h" class Expression; class Block; class CGContext; class StatementBreak : public Statement { public: // Factory method. static StatementBreak *make_random(CGContext &cg_context); StatementBreak(Block* parent, const Expression &test, const Block& b); StatementBreak(const StatementBreak &sc); virtual ~StatementBreak(void); virtual bool must_jump(void) const; virtual void get_blocks(std::vector<const Block*>& /* blks */) const {}; virtual void get_exprs(std::vector<const Expression*>& exps) const {exps.push_back(&test);} virtual bool visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) const; virtual void Output(std::ostream &out, FactMgr* fm, int indent = 0) const; const Expression &test; const Block& loop_blk; }; #endif // STATEMENT_BREAK_H // Local Variables: // c-basic-offset: 4 // tab-width: 4 // End: // End of file.
class Travis < Formula desc "Command-line client for Travis CI" homepage "https://github.com/travis-ci/travis.rb/" url "https://github.com/travis-ci/travis.rb/archive/v1.8.9.tar.gz" sha256 "<SHA256-like>" revision 3 bottle do sha256 "<SHA256-like>" => :mojave sha256 "<SHA256-like>" => :high_sierra sha256 "<SHA256-like>" => :sierra end depends_on "ruby" if MacOS.version <= :sierra resource "addressable" do url "https://rubygems.org/gems/addressable-2.4.0.gem" sha256 "<SHA256-like>" end resource "backports" do url "https://rubygems.org/gems/backports-3.11.3.gem" sha256 "<SHA256-like>" end resource "ethon" do url "https://rubygems.org/gems/ethon-0.11.0.gem" sha256 "<SHA256-like>" end resource "faraday" do url "https://rubygems.org/gems/faraday-0.15.2.gem" sha256 "<SHA256-like>" end resource "faraday_middleware" do url "https://rubygems.org/gems/<API key>.12.2.gem" sha256 "<SHA256-like>" end resource "ffi" do url "https://rubygems.org/gems/ffi-1.9.25.gem" sha256 "<SHA256-like>" end resource "gh" do url "https://rubygems.org/gems/gh-0.15.1.gem" sha256 "<SHA256-like>" end resource "highline" do url "https://rubygems.org/gems/highline-1.7.10.gem" sha256 "<SHA256-like>" end if MacOS.version <= :sierra resource "json" do url "https://rubygems.org/gems/json-2.1.0.gem" sha256 "<SHA256-like>" end end resource "launchy" do url "https://rubygems.org/gems/launchy-2.4.3.gem" sha256 "<SHA256-like>" end resource "multi_json" do url "https://rubygems.org/gems/multi_json-1.13.1.gem" sha256 "<SHA256-like>" end resource "multipart-post" do url "https://rubygems.org/gems/multipart-post-2.0.0.gem" sha256 "<SHA256-like>" end resource "net-http-persistent" do url "https://rubygems.org/gems/<API key>.9.4.gem" sha256 "<SHA256-like>" end resource "net-http-pipeline" do url "https://rubygems.org/gems/net-http-pipeline-1.0.1.gem" sha256 "<SHA256-like>" end resource "pusher-client" do url "https://rubygems.org/gems/pusher-client-0.6.2.gem" sha256 "<SHA256-like>" end resource "typhoeus" do url "https://rubygems.org/gems/typhoeus-0.8.0.gem" sha256 "<SHA256-like>" end resource "websocket" do url "https://rubygems.org/gems/websocket-1.2.8.gem" sha256 "<SHA256-like>" end def install ENV["GEM_HOME"] = libexec resources.each do |r| r.<API key>(r.fetch) system "gem", "install", r.cached_download, "--ignore-dependencies", "--no-document", "--install-dir", libexec end system "gem", "build", "travis.gemspec" system "gem", "install", "--ignore-dependencies", "travis-#{version}.gem" bin.install libexec/"bin/travis" bin.<API key>(libexec/"bin", :GEM_HOME => ENV["GEM_HOME"]) end test do (testpath/".travis.yml").write <<~EOS language: ruby sudo: true matrix: include: - os: osx rvm: system EOS output = shell_output("#{bin}/travis lint #{testpath}/.travis.yml") assert_match "valid", output output = shell_output("#{bin}/travis init 2>&1", 1) assert_match "Can't figure out GitHub repo name", output end end
cask 'eclipse-installer' do version :latest sha256 :no_check url 'http://eclipse.org/downloads/download.php?file=/oomph/products/eclipse-inst-mac64.tar.gz&r=1' name 'Eclipse Installer' homepage 'http://eclipse.org/' license :eclipse app 'Eclipse Installer.app' depends_on :macos => '>= :leopard' depends_on :arch => :x86_64 caveats <<-EOS.undent #{token} requires Java. You can install the latest version with brew cask install java EOS end
# Sample code from Programing Ruby, page 18 line = 'abc' line.gsub(/Perl|Python/, 'Ruby')
var obj = {}; Object.defineProperty(obj, "property", { configurable: new Boolean(true) }); var beforeDeleted = obj.hasOwnProperty("property"); delete obj.property; var afterDeleted = obj.hasOwnProperty("property"); assert.sameValue(beforeDeleted, true, 'beforeDeleted'); assert.sameValue(afterDeleted, false, 'afterDeleted');
cask :v1 => 'jenkins' do version '1.639' sha256 '<SHA256-like>' url "http://mirrors.jenkins-ci.org/osx/jenkins-#{version}.pkg" name 'Jenkins' homepage 'https://jenkins-ci.org/' license :mit pkg "jenkins-#{version}.pkg" binary '/Library/Application Support/Jenkins/jenkins-runner.sh', :target => 'jenkins-runner' uninstall :script => '/Library/Application Support/Jenkins/Uninstall.command', :pkgutil => 'org.jenkins-ci.*pkg', :launchctl => 'org.jenkins-ci' zap :delete => '/Library/Preferences/org.jenkins-ci.plist' conflicts_with :formula => %w{ jenkins homebrew/versions/jenkins-lts }, :cask => 'caskroom/versions/jenkins-lts' caveats <<-EOS.undent #{token} requires Java. You can install the latest version with brew cask install java You can change the launch parameters for #{token} using "defaults", as described in https://wiki.jenkins-ci.org/display/JENKINS/Thanks+for+using+OSX+Installer Alternatively, you can directly run #{token} with custom parameters, eg java -jar /Applications/Jenkins/jenkins.war -XX:PermSize=$MIN_PERM_GEN --httpPort=$HTTP_PORT For more options, see https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins EOS end
# !!! DO NOT PLACE HEADER GUARDS HERE !!! include(hunter_add_version) include(hunter_cacheable) include(hunter_download) include(hunter_pick_scheme) hunter_add_version( PACKAGE_NAME drm VERSION "2.4.67" URL "https://dri.freedesktop.org/libdrm/libdrm-2.4.67.tar.bz2" SHA1 <SHA1-like> ) hunter_pick_scheme(DEFAULT drm) hunter_cacheable(drm) hunter_download( PACKAGE_NAME drm <API key> "lib/libdrm.la" "lib/libdrm_amdgpu.la" "lib/libdrm_nouveau.la" "lib/libdrm_radeon.la" "lib/libkms.la" "lib/pkgconfig/libdrm.pc" "lib/pkgconfig/libdrm_amdgpu.pc" "lib/pkgconfig/libdrm_intel.pc" "lib/pkgconfig/libdrm_nouveau.pc" "lib/pkgconfig/libdrm_radeon.pc" "lib/pkgconfig/libkms.pc" )
var obj = { "1e-7": 1 }; var desc = Object.<API key>(obj, 1e-7); assert.sameValue(desc.value, 1, 'desc.value');
#include <boot/stage2.h> #include <boot/shared/openfirmware.h> #include <kernel/kernel.h> #include <arch/cpu.h> #include <libc/string.h> #include "stage2_priv.h" static unsigned int primary_hash(unsigned int vsid, unsigned int vaddr); static unsigned int secondary_hash(unsigned int primary_hash); static struct ppc_pteg *ptable = 0; static int ptable_size = 0; static unsigned int ptable_hash_mask = 0; static unsigned long total_ram_size = 0; static void print_pte(struct ppc_pte *e); static bool does_intersect(unsigned long base1, unsigned long len1, unsigned long base2, unsigned long len2) { unsigned long end1 = base1 + len1; unsigned long end2 = base2 + len2; if(base2 >= base1 && base2 <= end1) return true; // base2 is inside first range if(end2 >= base1 && end2 <= end1) return true; // end of second range inside first range if(base1 >= base2 && base1 <= end2) return true; // base1 is inside second range if(end1 >= base2 && end1 <= end2) return true; // end of first range inside second range return false; } static void <API key>(kernel_args *ka) { int handle; unsigned int i; struct mem_region { unsigned long pa; int len; } mem_regions[32]; unsigned int mem_regions_len = 0; // get the physical memory map of the system handle = of_finddevice("/chosen"); of_getprop(handle, "memory", &handle, sizeof(handle)); handle = <API key>(handle); memset(mem_regions, 0, sizeof(mem_regions)); mem_regions_len = of_getprop(handle, "reg", mem_regions, sizeof(mem_regions)); mem_regions_len /= sizeof(struct mem_region); printf("num mem regions %d\n", mem_regions_len); // copy these regions over to the kernel args structure ka->num_phys_mem_ranges = 0; for(i=0; i<mem_regions_len; i++) { if(mem_regions[i].len > 0) { total_ram_size += mem_regions[i].len; if(ka->num_phys_mem_ranges > 0) { if(mem_regions[i].pa == ka->phys_mem_range[ka-><API key>].start + ka->phys_mem_range[ka-><API key>].size) { // this range just extends the old one ka->phys_mem_range[ka-><API key>].size += mem_regions[i].len; continue; } } ka->phys_mem_range[ka->num_phys_mem_ranges].start = mem_regions[i].pa; ka->phys_mem_range[ka->num_phys_mem_ranges].size = mem_regions[i].len; ka->num_phys_mem_ranges++; if(ka->num_phys_mem_ranges == <API key>) { printf("too many physical memory maps, increase <API key>\n"); for(;;); } } } printf("num phys mem regions %d\n", ka->num_phys_mem_ranges); for(i=0; i<ka->num_phys_mem_ranges; i++) { printf(" phys map %d: pa 0x%lx, len 0x%lx\n", i, ka->phys_mem_range[i].start, ka->phys_mem_range[i].size); } } static bool is_in_phys_mem(kernel_args *ka, unsigned long addr) { unsigned int i; for(i = 0; i < ka->num_phys_mem_ranges; i++) { if(does_intersect(ka->phys_mem_range[i].start, ka->phys_mem_range[i].size, addr, 0)) return true; } return false; } static void <API key>(kernel_args *ka, unsigned long base, unsigned long len) { unsigned int i; unsigned long start; base = ROUNDOWN(base, PAGE_SIZE); len = ROUNDUP(len, PAGE_SIZE); start = base; while(start < base + len){ // cycle through the list of physical runs of used pages, // seeing if start will intersect one of them for(i = 0; i < ka-><API key>; i++) { if(start == ka->phys_alloc_range[i].start + ka->phys_alloc_range[i].size) { // it will extend it ka->phys_alloc_range[i].size += PAGE_SIZE; goto next_page; } if(start + PAGE_SIZE == ka->phys_alloc_range[i].start) { // it will prepend it ka->phys_alloc_range[i].start = start; ka->phys_alloc_range[i].size += PAGE_SIZE; goto next_page; } if(does_intersect(ka->phys_alloc_range[i].start, ka->phys_alloc_range[i].size, start, PAGE_SIZE)) { // it's off in the middle of this range, skip it goto next_page; } } // didn't find it in one of the existing ranges, must need to start a new one if(ka-><API key> >= <API key>) { printf("<API key>: <API key> (%d) too small\n", <API key>); for(;;); } // create a new allocated range ka->phys_alloc_range[ka-><API key>].start = start; ka->phys_alloc_range[ka-><API key>].size = PAGE_SIZE; ka-><API key>++; next_page: start += PAGE_SIZE; } } static void <API key>(kernel_args *ka) { int handle; unsigned int i; struct translation_map { unsigned long va; int len; unsigned long pa; int mode; } memmap[64]; unsigned int translation_map_len = 0; printf("looking for current translations...\n"); ka-><API key> = 0; // get the current translation map of the system, // to find how much memory was mapped to load the stage1 and bootdir handle = of_finddevice("/chosen"); of_getprop(handle, "mmu", &handle, sizeof(handle)); handle = <API key>(handle); memset(memmap, 0, sizeof(memmap)); translation_map_len = of_getprop(handle, "translations", memmap, sizeof(memmap)); translation_map_len /= sizeof(struct translation_map); printf("found %d translations\n", translation_map_len); for(i=0; i<translation_map_len; i++) { printf("package loaded at pa 0x%lx va 0x%lx, len 0x%x\n", memmap[i].pa, memmap[i].va, memmap[i].len); if(is_in_phys_mem(ka, memmap[i].va)) { // we found the translation that covers the loaded package. Save this. <API key>(ka, memmap[i].pa, memmap[i].len); } } for(i=0; i<ka-><API key>; i++) { printf("phys alloc map %d: pa 0x%lx, len 0x%lx\n", i, ka->phys_alloc_range[i].start, ka->phys_alloc_range[i].size); } } static void <API key>(kernel_args *ka, unsigned long base, unsigned long len) { unsigned int i; unsigned long start; base = ROUNDOWN(base, PAGE_SIZE); len = ROUNDUP(len, PAGE_SIZE); start = base; while(start < base + len) { // cycle through the list of virtual runs of used pages, // seeing if start will intersect one of them for(i = 0; i < ka-><API key>; i++) { if(start == ka->virt_alloc_range[i].start + ka->virt_alloc_range[i].size) { // it will extend it ka->virt_alloc_range[i].size += PAGE_SIZE; goto next_page; } if(start + PAGE_SIZE == ka->virt_alloc_range[i].start) { // it will prepend it ka->virt_alloc_range[i].start = start; ka->virt_alloc_range[i].size += PAGE_SIZE; goto next_page; } if(does_intersect(ka->virt_alloc_range[i].start, ka->virt_alloc_range[i].size, start, PAGE_SIZE)) { // it's off in the middle of this range, skip it goto next_page; } } // didn't find it in one of the existing ranges, must need to start a new one if(ka-><API key> >= <API key>) { printf("<API key>: <API key> (%d) too small\n", <API key>); for(;;); } // create a new allocated range ka->virt_alloc_range[ka-><API key>].start = start; ka->virt_alloc_range[ka-><API key>].size = PAGE_SIZE; ka-><API key>++; next_page: start += PAGE_SIZE; } } unsigned long mmu_allocate_page(kernel_args *ka) { unsigned long page; if(ka-><API key> == 0) { // no physical allocated ranges, start one page = ka->phys_mem_range[0].start; <API key>(ka, page, PAGE_SIZE); return page; } // allocate from the first allocated physical range page = ka->phys_alloc_range[0].start + ka->phys_alloc_range[0].size; ka->phys_alloc_range[0].size += PAGE_SIZE; // XXX check for validity better return page; } static void tlbia() { unsigned long i; asm volatile("sync"); for(i=0; i< 0x40000; i += 0x1000) { asm volatile("tlbie %0" :: "r" (i)); asm volatile("eieio"); asm volatile("sync"); } asm volatile("tlbsync"); asm volatile("sync"); } #define CACHELINE 32 void syncicache(void *address, int len) { int l, off; char *p; off = (unsigned int)address & (CACHELINE - 1); len += off; l = len; p = (char *)address - off; do { asm volatile ("dcbst 0,%0" :: "r"(p)); p += CACHELINE; } while((l -= CACHELINE) > 0); asm volatile ("sync"); p = (char *)address - off; do { asm volatile ("icbi 0,%0" :: "r"(p)); p += CACHELINE; } while((len -= CACHELINE) > 0); asm volatile ("sync"); asm volatile ("isync"); } int s2_mmu_init(kernel_args *ka) { unsigned int ibats[8]; unsigned int dbats[8]; unsigned long top_ram = 0; int i; ka-><API key> = 0; // figure out where physical memory is and what is being used <API key>(ka); <API key>(ka); #if 0 // find the largest address of physical memory, but with a max of 256 MB, // so it'll be within our 256 MB BAT window for(i=0; i<ka->num_phys_mem_ranges; i++) { if(ka->phys_mem_range[i].start + ka->phys_mem_range[i].size > top_ram) { if(ka->phys_mem_range[i].start + ka->phys_mem_range[i].size > 256*1024*1024) { if(ka->phys_mem_range[i].start < 256*1024*1024) { top_ram = 256*1024*1024; break; } } top_ram = ka->phys_mem_range[i].start + ka->phys_mem_range[i].size; } } printf("top of ram (but under 256MB) is 0x%x\n", top_ram); #endif // figure the size of the new pagetable, as recommended by Motorola if(total_ram_size <= 8*1024*1024) { ptable_size = 64*1024; } else if(total_ram_size <= 16*1024*1024) { ptable_size = 128*1024; } else if(total_ram_size <= 32*1024*1024) { ptable_size = 256*1024; } else if(total_ram_size <= 64*1024*1024) { ptable_size = 512*1024; } else if(total_ram_size <= 128*1024*1024) { ptable_size = 1024*1024; } else if(total_ram_size <= 256*1024*1024) { ptable_size = 2*1024*1024; } else if(total_ram_size <= 512*1024*1024) { ptable_size = 4*1024*1024; } else if(total_ram_size <= 1024*1024*1024) { ptable_size = 8*1024*1024; } else if(total_ram_size <= 2*1024*1024*1024UL) { ptable_size = 16*1024*1024; } else { ptable_size = 32*1024*1024; } // look at the old page table printf("old page table at 0x%x, size 0x%x\n", (addr_t)getsdr1() & 0xffff0000, (((addr_t)getsdr1() & 0x1ff) + 1) << 16); // figure out where to put the page table printf("allocating a page table using claim\n"); ptable_hash_mask = (ptable_size >> 6) - 1; ptable = (struct ppc_pteg *)of_claim(0, ptable_size, ptable_size); printf("ptable at pa 0x%x, size 0x%x\n", ptable, ptable_size); printf("mask = 0x%x\n", ptable_hash_mask); // mark it used <API key>(ka, (unsigned long)ptable, ptable_size); // save it's new location in the kernel args ka->arch_args.page_table.start = (unsigned long)ptable; ka->arch_args.page_table.size = ptable_size; ka->arch_args.page_table_mask = ptable_hash_mask; #if 0 { struct ppc_pteg *old_ptable; int j; printf("sdr1 = 0x%x\n", getsdr1()); old_ptable = (struct ppc_pteg *)((unsigned int)getsdr1() & 0xffff0000); printf("old_ptable %p\n", old_ptable); for(i=0; i< (64*1024) >> 6 ; i++) { for(j=0; j< 8; j++) if(old_ptable[i].pte[j].v && old_ptable[i].pte[j].vsid == 0) print_pte(&old_ptable[i].pte[j]); } } #endif unsigned int sp; asm volatile("mr %0,1" : "=r"(sp)); printf("sp = 0x%x\n", sp); /* set up the new BATs */ getibats(ibats); getdbats(dbats); for(i=0; i<8; i++) { ibats[i] = 0; dbats[i] = 0; } // identity map the first 256MB of RAM dbats[0] = ibats[0] = BATU_LEN_256M | BATU_VS; dbats[1] = ibats[1] = BATL_CI | BATL_PP_RW; // XXX fix dbats[2] = ibats[2] = 0x80000000 | BATU_LEN_256M | BATU_VS; dbats[3] = ibats[3] = 0x80000000 | BATL_CI | BATL_PP_RW; dbats[4] = ibats[4] = 0x90000000 | BATU_LEN_256M | BATU_VS; dbats[5] = ibats[5] = 0x90000000 | BATL_CI | BATL_PP_RW; dbats[6] = ibats[6] = 0xf0000000 | BATU_LEN_256M | BATU_VS; dbats[7] = ibats[7] = 0xf0000000 | BATL_CI | BATL_PP_RW; #if 0 // map the framebuffer using a BAT to 256MB { unsigned int framebuffer_phys = ka->fb.mapping.start & ~((16*1024*1024) - 1); dbats[2] = ibats[2] = 0x10000000 | BATU_LEN_16M | BATU_VS; dbats[3] = ibats[3] = framebuffer_phys | BATL_CI | BATL_PP_RW; printf("remapping framebuffer at pa 0x%x to va 0x%x using BAT\n", ka->fb.mapping.start, 0x10000000 + ka->fb.mapping.start - framebuffer_phys); <API key>(ka, 0x10000000 + ka->fb.mapping.start - framebuffer_phys); } #endif setibats(ibats); setdbats(dbats); tlbia(); printf("unsetting the old page table\n"); setsdr1(0); tlbia(); printf("memsetting new pagetable\n"); memset(ptable, 0, ptable_size); printf("done\n"); printf("setting up the 16 segment registers\n"); // set up the segment registers for(i=0; i<16; i++) { setsr(i * 0x10000000, i); } printf("done, setting sdr1\n"); setsdr1(((unsigned int)ptable & 0xffff0000) | (ptable_hash_mask >> 10)); tlbia(); printf("sdr1 = 0x%x\n", getsdr1()); #if 0 mmu_map_page(0x96008000, 0x96008000); mmu_map_page(0x96009000, 0x96009000); mmu_map_page(0x9600a000, 0x9600a000); mmu_map_page(0x96008000, 0x30000000); printf("testing...\n"); printf("hello\n"); printf("%d\n", *(int *)0x30000000); printf("%d\n", *(int *)0x96008000); *(int *)0x30000000 = 0x99; printf("%d\n", *(int *)0x30000000); printf("%d\n", *(int *)0x96008000); printf("hello2\n"); #endif printf("done\n"); return 0; } int <API key>(kernel_args *ka) { unsigned long i; unsigned long new_ptable; // find a new spot to allocate the page table // XXX make better new_ptable = ka->virt_alloc_range[0].start + ka->virt_alloc_range[0].size; for(i = 0; i < ptable_size; i += PAGE_SIZE) { mmu_map_page(ka, ka->arch_args.page_table.start + i, new_ptable + i, true); } ka->arch_args.page_table_virt.start = new_ptable; ka->arch_args.page_table_virt.size = ka->arch_args.page_table.size; } int <API key>(kernel_args *ka) { unsigned int ibat[8]; unsigned int dbat[8]; // zero out the 2nd bat entry, used to map the framebuffer getibats(ibat); getdbats(dbat); ibat[2] = ibat[3] = dbat[2] = dbat[3] = 0; setibats(ibat); setdbats(dbat); return NO_ERROR; } static void print_pte(struct ppc_pte *e) { printf("entry %p: ", e); printf("v %d ", e->v); if(e->v) { printf("vsid 0x%x ", e->vsid); printf("hash %d ", e->hash); printf("api 0x%x ", e->api); printf("ppn 0x%x ", e->ppn); printf("r %d ", e->r); printf("c %d ", e->c); printf("wimg 0x%x ", e->wimg); printf("pp 0x%x ", e->pp); } printf("\n"); } void mmu_map_page(kernel_args *ka, unsigned long pa, unsigned long va, bool cached) { unsigned int hash; struct ppc_pteg *pteg; int i; unsigned int vsid; // mark it used if this is in the kernel area if(va >= KERNEL_BASE) { <API key>(ka, va, PAGE_SIZE); } // lookup the vsid based off the va vsid = getsr(va) & 0xffffff; // printf("mmu_map_page: vsid %d, pa 0x%x, va 0x%x\n", vsid, pa, va); hash = primary_hash(vsid, va); // printf("hash = 0x%x\n", hash); pteg = &ptable[hash]; // printf("pteg @ 0x%x\n", pteg); // search for the first free slot for this pte for(i=0; i<8; i++) { // printf("trying pteg[%i]\n", i); if(pteg->pte[i].v == 0) { // upper word pteg->pte[i].ppn = pa / PAGE_SIZE; pteg->pte[i].unused = 0; pteg->pte[i].r = 0; pteg->pte[i].c = 0; pteg->pte[i].wimg = cached ? 0 : (1 << 3); pteg->pte[i].unused1 = 0; pteg->pte[i].pp = 0x2; asm volatile("eieio"); // lower word pteg->pte[i].vsid = vsid; pteg->pte[i].hash = 0; // primary pteg->pte[i].api = (va >> 22) & 0x3f; pteg->pte[i].v = 1; tlbia(); // printf("set pteg to "); // print_pte(&pteg->pte[i]); // printf("set pteg to 0x%x 0x%x\n", *((int *)&pteg->pte[i]), *(((int *)&pteg->pte[i])+1)); return; } } } static unsigned int primary_hash(unsigned int vsid, unsigned int vaddr) { unsigned int page_index; vsid &= 0x7ffff; page_index = (vaddr >> 12) & 0xffff; return (vsid ^ page_index) & ptable_hash_mask; } static unsigned int secondary_hash(unsigned int primary_hash) { return ~primary_hash; }
#ifndef <API key> #define <API key> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> #include <boost/range/iterator_range.hpp> namespace pdalboost { enum range_return_value { // (*) indicates the most common values return_found, // only the found resulting iterator (*) return_next, // next(found) iterator return_prior, // prior(found) iterator return_begin_found, // [begin, found) range (*) return_begin_next, // [begin, next(found)) range return_begin_prior, // [begin, prior(found)) range return_found_end, // [found, end) range (*) return_next_end, // [next(found), end) range return_prior_end, // [prior(found), end) range return_begin_end // [begin, end) range }; template< class SinglePassRange, range_return_value > struct range_return { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(found, pdalboost::end(rng)); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_found > { typedef <API key> range_iterator<SinglePassRange>::type type; static type pack(type found, SinglePassRange&) { return found; } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_next > { typedef <API key> range_iterator<SinglePassRange>::type type; static type pack(type found, SinglePassRange& rng) { return found == pdalboost::end(rng) ? found : pdalboost::next(found); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_prior > { typedef <API key> range_iterator<BidirectionalRange>::type type; static type pack(type found, BidirectionalRange& rng) { return found == pdalboost::begin(rng) ? found : pdalboost::prior(found); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_found > { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(pdalboost::begin(rng), found); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_next > { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type( pdalboost::begin(rng), found == pdalboost::end(rng) ? found : pdalboost::next(found) ); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_begin_prior > { typedef pdalboost::iterator_range< <API key> range_iterator<BidirectionalRange>::type > type; static type pack(<API key> range_iterator<BidirectionalRange>::type found, BidirectionalRange& rng) { return type( pdalboost::begin(rng), found == pdalboost::begin(rng) ? found : pdalboost::prior(found) ); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_found_end > { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(found, pdalboost::end(rng)); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_next_end > { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type( found == pdalboost::end(rng) ? found : pdalboost::next(found), pdalboost::end(rng) ); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_prior_end > { typedef pdalboost::iterator_range< <API key> range_iterator<BidirectionalRange>::type > type; static type pack(<API key> range_iterator<BidirectionalRange>::type found, BidirectionalRange& rng) { return type( found == pdalboost::begin(rng) ? found : pdalboost::prior(found), pdalboost::end(rng) ); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_end > { typedef pdalboost::iterator_range< <API key> range_iterator<SinglePassRange>::type > type; static type pack(<API key> range_iterator<SinglePassRange>::type, SinglePassRange& rng) { return type(pdalboost::begin(rng), pdalboost::end(rng)); } }; } #endif // include guard
#include "webkit/media/<API key>.h" #include "media/base/audio_renderer_sink.h" #include "media/base/media_log.h" namespace webkit_media { <API key>::<API key>( const scoped_refptr<media::AudioRendererSink>& audio_renderer_sink, const scoped_refptr<media::GpuVideoDecoder::Factories>& gpu_factories, const scoped_refptr<media::MediaLog>& media_log) : <API key>(audio_renderer_sink), gpu_factories_(gpu_factories), media_log_(media_log) { DCHECK(media_log_); } <API key>::~<API key>() {} } // namespace webkit_media
from .. utils import TranspileTestCase, <API key> class PrintTests(TranspileTestCase): def test_fileobj(self): self.assertCodeExecution(""" class FileLikeObject: def __init__(self): self.buffer = '' def write(self, content): self.buffer = self.buffer + (content * 2) out = FileLikeObject() print('hello', 'world', file=out) print('goodbye', 'world', file=out) print() """) def test_sep(self): self.assertCodeExecution(""" print('hello world', 'goodbye world', sep='-') print() """) def test_end(self): self.assertCodeExecution(""" print('hello world', 'goodbye world', end='-') print() """) def test_flush(self): self.assertCodeExecution(""" print('hello world', 'goodbye world', flush=True) print() """) def test_combined(self): self.assertCodeExecution(""" class FileLikeObject: def __init__(self): self.buffer = '' def write(self, content): self.buffer = self.buffer + (content * 2) def flush(self): self.buffer = self.buffer + '<<<' out = FileLikeObject() print('hello', 'world', sep='*', end='-', file=out, flush=True) print('goodbye', 'world', file=out, sep='-', end='*') print() """) class <API key>(<API key>, TranspileTestCase): functions = ["print"] not_implemented = [ 'test_class', 'test_frozenset', 'test_slice', ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Forms :: submit input : float alongside inline content</title> <style type="text/css"> form * { font-family: Ahem; font-size: 1em; line-height: 1em; } fieldset, div { color: #3366CC; background-color: red; padding: 0; margin: 0; border: none; width: 22em; } input, span { color: black; padding: 0; margin: 0; border: none; width: 1em; height: 1em; float: left; } h4 {clear: both;} </style> </head> <body> <form action=""> <fieldset> <input type="submit" value="x">xxxxxxxxxx<input type="submit" value="x">xxxxxxxxxx </fieldset> <div> <input type="submit" value="x">xxxxxxxxxx<input type="submit" value="x">xxxxxxxxxx </div> <div> <span>x</span>xxxxxxxxxx<span>x</span>xxxxxxxxxx </div> </form> <h4>Ahem font required for this test</h4> <p>you should see an unbroken black and blue bar with no red</p> </body> </html>
/** * @file * This file includes k32w061 compile-time configuration constants * for OpenThread. */ #ifndef <API key> #define <API key> /** * @def <API key> * * The emsk platform provides an otPlatLog() function. */ #ifndef <API key> /* allow command line override */ #define <API key> <API key> #endif /** * @def <API key> * * The platform-specific string to insert into the OpenThread version string. * */ #define <API key> "K32W061" /** * @def <API key> * * The base address of settings. * */ #define <API key> 0 /** * @def <API key> * * The page size of settings. * */ #define <API key> 0x200 /** * @def <API key> * * The page number of settings. * */ #define <API key> 64 /** * @def <API key> * * The number of source address table entries. * */ #define <API key> 128 /** * @def <API key> * * Define to 1 if you want to enable software retransmission logic. * */ /* TODO */ /** * @def <API key> * * Define to 1 if you want to enable software CSMA-CA backoff logic. * */ /* TODO */ /** * @def <API key> * * Define to 1 to enable NCP UART support. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 if you want to use K32W061 Flash implementation. * */ #define <API key> 0 /** * @def <API key> * * The size of NCP message buffer in bytes. * */ #define <API key> 1024 /** * @def <API key> * * The size of heap buffer when DTLS is enabled. * */ #ifndef <API key> #define <API key> (2048 * sizeof(void *)) #endif /** * @def <API key> * * Define to 1 to enable the CoAP API. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable Joiner support. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable Commissioner support. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable UDP forward support. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable the Border Router service. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable the DHCP CLIENT service. * */ #define <API key> 1 /** * @def <API key> * * Define to 1 to enable the DHCP SERVER service. * */ #define <API key> 1 /** * @def <API key> * * Define as 1 to enable the time synchronization service feature. * */ #ifndef <API key> #define <API key> 0 #endif /** * @def <API key> * * Define as 1 to enable the diag feature. * */ #ifndef <API key> #define <API key> 0 #endif #endif // <API key>
<html> <head> <title>GB18030 lead 823191</title> <meta http-equiv='content-type' content='text/html;charset=GB18030'> <link rel='stylesheet' href='tests.css'> </head> <body> <table> <caption>Four-byte lead 823191</caption> <tr><th colspan=2>GB18030<th colspan=3>Unicode <tr><td>=82319130<td> ‚1‘0 <td>U+3A37<td>&#14903;<td class=u>to wipe; to cleanse, (interchangeable &amp;#232;) difficult; distress; harship <tr><td>=82319131<td> ‚1‘1 <td>U+3A38<td>&#14904;<td class=u>to hit; to strike; to beat <tr><td>=82319132<td> ‚1‘2 <td>U+3A39<td>&#14905;<td class=u>to crack; to break; to rip open, to split or divide up, to hang up; to suspend, to sweep clean; to eliminate <tr><td>=82319133<td> ‚1‘3 <td>U+3A3A<td>&#14906;<td class=u>to ornament; to polish; to decorate, (same as &amp;#230;) to feel; to touch with hands; to hold, to search (in one's pocket, etc.) <tr><td>=82319134<td> ‚1‘4 <td>U+3A3B<td>&#14907;<td class=u>to cut; to kill; to behead, gradually; little by little; by degrees, to lift; to raise, to strike; to beat, to throw; to pitch; to deliver <tr><td>=82319135<td> ‚1‘5 <td>U+3A3C<td>&#14908;<td class=u>(non-classical form of U+63A0 &amp;#230;) to take by force, to throw aside <tr><td>=82319136<td> ‚1‘6 <td>U+3A3D<td>&#14909;<td class=u>to cut or rip open <tr><td>=82319137<td> ‚1‘7 <td>U+3A3E<td>&#14910;<td class=u>a type; a model; a mode; a style <tr><td>=82319138<td> ‚1‘8 <td>U+3A3F<td>&#14911;<td class=u>(a variant of &amp;#230;) to receive, as communications from a subordinate, to rely on, to lean on, evidence; proof, according to; whereas <tr><td>=82319139<td> ‚1‘9 <td>U+3A40<td>&#14912;<td class=u>(a variant of &amp;#230;) to receive, as communications from a subordinate, to rely on, to lean on, evidence; proof, according to; whereas </table> <p><a href='charset/GB18030.html'>Return</a></p> </body> </html>
<!doctype html> <title>textarea resize | negative resize</title> <style> textarea { width: 100px; height: 100px; } </style> <p>There should be a textarea below, with a resize handle visible in the bottom right corner.</p> <textarea></textarea> <script src="resize.js"></script> <script> window.onload = function() { resize_textarea(200, 200, function(){ resize_textarea(-100, -100); }); } </script>
static av_always_inline int RENAME(encode_line)(FFV1Context *s, int w, TYPE *sample[3], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_index = s->run_index; int run_count = 0; int run_mode = 0; if (s->ac != AC_GOLOMB_RICE) { if (c->bytestream_end - c->bytestream < w * 35) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } else { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } if (s->slice_coding_mode == 1) { for (x = 0; x < w; x++) { int i; int v = sample[0][x]; for (i = bits-1; i>=0; i uint8_t state = 128; put_rac(c, &state, (v>>i) & 1); } } return 0; } for (x = 0; x < w; x++) { int diff, context; context = RENAME(get_context)(p, sample[0] + x, sample[1] + x, sample[2] + x); diff = sample[0][x] - RENAME(predict)(sample[0] + x, sample[1] + x); if (context < 0) { context = -context; diff = -diff; } diff = fold(diff, bits); if (s->ac != AC_GOLOMB_RICE) { if (s->flags & AV_CODEC_FLAG_PASS1) { put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][context]); } else { put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL); } } else { if (context == 0) run_mode = 1; if (run_mode) { if (diff) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count); if (run_index) run_index run_count = 0; run_mode = 0; if (diff > 0) diff } else { run_count++; } } ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, (int)put_bits_count(&s->pb)); if (run_mode == 0) put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); } } if (run_mode) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } if (run_count) put_bits(&s->pb, 1, 1); } s->run_index = run_index; return 0; } static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[4], int w, int h, const int stride[4]) { int x, y, p, i; const int ring_size = s->context_model ? 3 : 2; TYPE *sample[4][3]; int lbd = s->bits_per_raw_sample <= 8; int packed = !src[1]; int bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8; int offset = 1 << bits; int transparency = s->transparency; int packed_size = (3 + transparency)*2; s->run_index = 0; memset(RENAME(s->sample_buffer), 0, ring_size * MAX_PLANES * (w + 6) * sizeof(*RENAME(s->sample_buffer))); for (y = 0; y < h; y++) { for (i = 0; i < ring_size; i++) for (p = 0; p < MAX_PLANES; p++) sample[p][i]= RENAME(s->sample_buffer) + p*ring_size*(w+6) + ((h+i-y)%ring_size)*(w+6) + 3; for (x = 0; x < w; x++) { int b, g, r, av_uninit(a); if (lbd) { unsigned v = *((const uint32_t*)(src[0] + x*4 + stride[0]*y)); b = v & 0xFF; g = (v >> 8) & 0xFF; r = (v >> 16) & 0xFF; a = v >> 24; } else if (packed) { const uint16_t *p = ((const uint16_t*)(src[0] + x*packed_size + stride[0]*y)); r = p[0]; g = p[1]; b = p[2]; if (transparency) a = p[3]; } else if (sizeof(TYPE) == 4 || transparency) { g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y)); if (transparency) a = *((const uint16_t *)(src[3] + x*2 + stride[3]*y)); } else { b = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); g = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y)); } if (s->slice_coding_mode != 1) { b -= g; r -= g; g += (b * s->slice_rct_by_coef + r * s->slice_rct_ry_coef) >> 2; b += offset; r += offset; } sample[0][0][x] = g; sample[1][0][x] = b; sample[2][0][x] = r; sample[3][0][x] = a; } for (p = 0; p < 3 + transparency; p++) { int ret; sample[p][0][-1] = sample[p][1][0 ]; sample[p][1][ w] = sample[p][1][w-1]; if (lbd && s->slice_coding_mode == 0) ret = RENAME(encode_line)(s, w, sample[p], (p + 1) / 2, 9); else ret = RENAME(encode_line)(s, w, sample[p], (p + 1) / 2, bits + (s->slice_coding_mode != 1)); if (ret < 0) return ret; } } return 0; }
// Use of this source code is governed by a BSD-style package runtime import "unsafe" // The calls to nop are to keep these functions from being inlined. // If they are inlined we have no guarantee that later rewrites of the // code by optimizers will preserve the relative order of memory accesses. //go:nosplit func atomicload(ptr *uint32) uint32 { nop() return *ptr } //go:nosplit func atomicloadp(ptr unsafe.Pointer) unsafe.Pointer { nop() return *(*unsafe.Pointer)(ptr) } //go:nosplit func xadd64(ptr *uint64, delta int64) uint64 { for { old := *ptr if cas64(ptr, old, old+uint64(delta)) { return old + uint64(delta) } } } //go:nosplit func xchg64(ptr *uint64, new uint64) uint64 { for { old := *ptr if cas64(ptr, old, new) { return old } } } //go:noescape func xadd(ptr *uint32, delta int32) uint32 //go:noescape func xchg(ptr *uint32, new uint32) uint32 // NO go:noescape annotation; see atomic_pointer.go. func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer //go:noescape func xchguintptr(ptr *uintptr, new uintptr) uintptr //go:noescape func atomicload64(ptr *uint64) uint64 //go:noescape func atomicor8(ptr *uint8, val uint8) //go:noescape func cas64(ptr *uint64, old, new uint64) bool //go:noescape func atomicstore(ptr *uint32, val uint32) //go:noescape func atomicstore64(ptr *uint64, val uint64) // NO go:noescape annotation; see atomic_pointer.go. func atomicstorep1(ptr unsafe.Pointer, val unsafe.Pointer)
(function(window, undefined){ var Array = window['Array'], EventTarget = window['EventTarget'], mapapi = window['mapapi'], gridPoint = mapapi['gridPoint'], bounds = mapapi['bounds'], ctype_digit = mapapi['utils']['ctype_digit'] ; if(mapapi == undefined){ throw 'mapapi.js is not loaded.'; }else if(EventTarget == undefined){ throw 'EventTarget is not loaded'; } function extend(a,b){ a.prototype = new b; a.prototype['constructor'] = a; } function shape(options){ EventTarget['call'](this); this['opts'] = {}; for(var i in this['defaultOpts']){ this['opts'][i] = this['defaultOpts'][i]; } if(options != undefined){ this['options'](options); } } extend(shape, EventTarget); shape.prototype['defaultOpts'] = {'fillStyle':'rgba(255,255,255,0.5)', 'strokeStyle':'rgb(255,255,255)', 'lineWidth':0}; shape.prototype['options'] = function(options){ options = options || {}; for(var i in options){ this['opts'] = options[i]; } } shape.prototype['withinShape'] = function(pos){ if(pos instanceof gridPoint){ return true; } return false; } shape.prototype['coords'] = function(value){ if(value != undefined){ this['options']({'coords':value}); } var coords = this['opts']['coords'] ; return coords != undefined ? coords : []; } shape.prototype['clickable'] = function(value){ if(value != undefined){ this['options']({'clickable':!!value}); } var clickable = this['opts']['clickable']; ; return clickable != undefined ? clickable : false; } shape.prototype['strokeStyle'] = function(value){ if(typeof value == 'string'){ this['options']({'strokeStyle':value}); } return this['opts']['strokeStyle']; } shape.prototype['lineWidth'] = function(value){ if(typeof value == 'number'){ this['options']({'lineWidth':Math.max(0,value)}); } return Math.max(0, this['opts']['lineWidth']); } shape.prototype['intersects'] = function(value){ if(value instanceof bounds && this['bounds'] instanceof bounds){ return this['bounds']['intersects'](value); } return false; } mapapi['shape'] = shape; function shapeManager(){ Array['call'](this); } extend(shapeManager, Array); shapeManager.prototype['push'] = function(){ for(var i=0;i<arguments['length'];++i){ if(!(arguments[i] instanceof shape)){ throw 'Arguments of mapapi.shapeManager::push() should be instances of mapapi.shape'; } } Array.prototype['push']['apply'](this, arguments); } shapeManager.prototype['intersects'] = function(value){ if(value instanceof bounds){ var shpmngr = new this['constructor'] ; for(var i=0;i<this['length'];++i){ if(this[i]['intersects'](value)){ shpmngr['push'](this[i]); } } return shpmngr; }else{ throw 'Intersection argument must be an instance of mapapi.bounds'; } } shapeManager.prototype['click'] = function(value){ var value = gridPoint['fuzzy'](value), ret ; for(var i=0;i<this['length'];++i){ if(this[i]['clickable']() && this[i]['withinShape'](value)){ ret = this[i]['fire']('click',{'pos':value}); if(ret != undefined && ret == false){ break; } } } } mapapi['shapeManager'] = shapeManager; function poly(options){ shape['call'](this, options); } extend(poly, shape); poly.prototype['options'] = function(options){ var options = options || {}, coords = options['coords'], fillStyle = options['fillStyle'], strokeStyle = options['strokeStyle'], lineWidth = options['lineWidth'] ; if(options['coords'] != undefined){ if(coords instanceof Array){ for(var i=0;i<coords['length'];++i){ coords[i] = gridPoint['fuzzy'](coords[i]); } var swx = coords[0]['x'], swy = coords[0]['y'], nex = coords[0]['x'], ney = coords[0]['y'] ; for(var i=1;i<coords['length'];++i){ swx = (coords[i]['x'] < swx) ? coords[i]['x'] : swx; swy = (coords[i]['y'] < swy) ? coords[i]['y'] : swy; nex = (coords[i]['x'] > nex) ? coords[i]['x'] : nex; ney = (coords[i]['y'] > ney) ? coords[i]['y'] : ney; } this['bounds'] = new bounds(new gridPoint(swx, swy), new gridPoint(nex, ney)); this['opts']['coords'] = coords; this['fire']('changedcoords'); }else{ throw 'coords must be array'; } } if(typeof fillStyle == 'string'){ var diff = this['opts']['fillStyle'] != fillStyle; this['opts']['fillStyle'] = fillStyle; if(diff){ this['fire']('changedfillstyle'); } } if(typeof strokeStyle == 'string'){ var diff = this['opts']['strokeStyle'] != strokeStyle; this['opts']['strokeStyle'] = strokeStyle; if(diff){ this['fire']('changedstrokestyle'); } } if(typeof lineWidth == 'number'){ var diff = this['opts']['lineWidth'] != Math.max(0,lineWidth); this['opts']['lineWidth'] = Math.max(0,lineWidth); if(diff){ this['fire']('changedlinewidth'); } } if(options['clickable'] != undefined){ this['opts']['clickable'] = !!options['clickable']; } } poly.prototype['fillStyle'] = function(value){ if(value != undefined){ this['options']({'fillStyle':value}); } return this['opts']['fillStyle']; } shape['polygon'] = poly; function rectangle(options){ poly['call'](this, options); } extend(rectangle, poly); rectangle.prototype['options'] = function(options){ var options = options || {}, coords = options['coords'] ; if(coords != undefined){ if(coords instanceof Array){ if(coords['length'] == 2){ for(var i=0;i<coords['length'];++i){ coords[i] = gridPoint['fuzzy'](coords[i]); } var sw = coords[0], ne = coords[1], foo,bar ; if(ne['y'] > sw['y']){ foo = new gridPoint(ne['x'], sw['y']); bar = new gridPoint(sw['x'], ne['y']); ne = foo; sw = bar; } if(sw['x'] > ne['x']){ foo = new gridPoint(ne['x'], sw['y']); bar = new gridPoint(sw['x'], ne['y']); sw = foo; ne = bar; } options['coords'] = [sw, ne]; }else{ throw 'When supplying mapapi.shape.rectangle::options with an Array for the coordinates, there should only be two entries'; } }else{ throw 'something other than array was given to mapapi.shape.rectangle::options'; } } poly.prototype['options']['call'](this, options); } rectangle.prototype['withinShape'] = function(value){ if(value == undefined){ throw 'Must specify an instance of mapapi.gridPoint'; }else if(!(this['bounds'] instanceof bounds)){ throw 'Coordinates not set'; } value = gridPoint['fuzzy'](value); return this['bounds']['isWithin'](value); } shape['rectangle'] = rectangle; function square(options){ rectangle['call'](this, options); } extend(square, rectangle); square.prototype['options'] = function(options){ options = options || {}; var coords = options['coords'] ; if(coords instanceof Array && coords['length'] <= 2){ var sw = coords[0], ne = coords[1] ; if(Math.abs(ne['x'] - sw['x']) != Math.abs(ne['y'] - sw['y'])){ throw 'coordinates should form a square'; } } rectangle.prototype['options']['call'](this, options); } shape['square'] = square; function line(options){ shape['call'](this, options); } extend(line, shape); line.prototype['defaultOpts'] = {'strokeStyle':'rgb(255,255,255)', 'lineWidth':1}; line.prototype['options'] = function(options){ var options = options || {}, coords = options['coords'], strokeStyle = options['strokeStyle'], lineWidth = options['lineWidth'] ; if(options['coords'] != undefined){ if(coords instanceof Array){ if(coords['length'] >= 2){ for(var i=0;i<coords['length'];++i){ coords[i] = gridPoint['fuzzy'](coords[i]); } this['opts']['coords'] = coords; this['fire']('changedcoords'); }else{ throw 'mapapi.shape.line requires two or more coordinates'; } }else{ throw 'mapapi.shape.line requires coordinates be passed as an array'; } } if(typeof strokeStyle == 'string'){ var diff = this['opts']['strokeStyle'] != strokeStyle; this['opts']['strokeStyle'] = strokeStyle; if(diff){ this['fire']('changedstrokestyle'); } } if(ctype_digit(lineWidth)){ lineWidth = Math.max(0,lineWidth * 1); var diff = this['opts']['lineWidth'] != lineWidth; this['opts']['lineWidth'] = lineWidth; if(diff){ this['fire']('changedlinewidth'); } } if(options['clickable'] != undefined){ this['opts']['clickable'] = !!options['clickable']; } } line.prototype['intersects'] = function(value){ if(value instanceof bounds){ var coords = this['coords']() ; for(var i=0;i<coords['length'];++i){ if(value['isWithin'](coords[i])){ return true; } } } return false; } shape['line'] = line; function circle(options){ shape['call'](this, options); } extend(circle, shape); circle.prototype['options'] = function(options){ var opts = this['opts'], options = options || {}, coords = options['coords'], radius = options['radius'], strokeStyle = options['strokeStyle'], lineWidth = options['lineWidth'], diffPos=false,diffRadius=false,diff ; if(coords != undefined){ coords[0] = gridPoint['fuzzy'](coords[0]); diffPos = opts['coords'] == undefined || !pos['equals'](opts['coords'][0]); opts['coords'] = [coords[0]]; } if(radius != undefined){ if(typeof radius != 'number'){ throw 'radius should be specified as a number'; }else if(radius <= 0){ throw 'radius should be greater than zero'; } diffRadius = radius != opts['radius']; opts['radius'] = radius; } if(diffPos || diffRadius){ this['fire']('changedcoords'); } if(typeof fillStyle == 'string'){ var diff = this['opts']['fillStyle'] != fillStyle; this['opts']['fillStyle'] = fillStyle; if(diff){ this['fire']('changedfillstyle'); } } if(typeof strokeStyle == 'string'){ var diff = this['opts']['strokeStyle'] != strokeStyle; this['opts']['strokeStyle'] = strokeStyle; if(diff){ this['fire']('changedstrokestyle'); } } if(typeof lineWidth == 'number'){ var diff = this['opts']['lineWidth'] != Math.max(0,lineWidth); this['opts']['lineWidth'] = Math.max(0,lineWidth); if(diff){ this['fire']('changedlinewidth'); } } if(options['clickable'] != undefined){ this['opts']['clickable'] = !!options['clickable']; } } circle.prototype['radius'] = function(value){ if(value != undefined){ this['options']({'radius':value}); } return this['opts']['radius']; } circle.prototype['fillStyle'] = function(value){ if(value != undefined){ this['options']({'fillStyle':value}); } return this['opts']['fillStyle']; } circle.prototype['withinShape'] = function(pos){ pos = gridPoint['fuzzy'](pos); return (this['coords']()[0] instanceof gridPoint && typeof this['radius']() == 'number') && (this['coords']()[0]['distance'](pos) <= this['radius']()); } circle.prototype['intersects'] = function(value){ if(value instanceof bounds && this['coords']()[0] instanceof gridPoint){ if(value['isWithin'](this['coords']()[0])){ return true; }else if(typeof this['radius']() == 'number'){ var sw = value['sw'], ne = value['ne'], distanceTests = [sw,ne,{'x':sw['x'], 'y':ne['y']}, {'x':ne['x'], 'y':sw['y']}] ; for(var i=0;i<distanceTests.length;++i){ if(this['withinShape'](distanceTests[i])){ return true; } } } } return false; } shape['circle'] = circle; })(window);
{% extends "customer/baseaccountpage.html" %} {% load i18n %} {% block extra_breadcrumbs %} <li> <a href="{% url 'customer:notifications-inbox' %}">{% trans 'Notifications inbox' %}</a> <span class="divider">/</span> </li> {% endblock %} {% block tabcontent %} <table class="table table-striped table-bordered"> {% if notification.sender %} <tr> <th>{% trans 'Sender' %}</th> <td>{{ notification.sender }}</td> </tr> {% endif %} <tr> <th>{% trans 'Date sent' %}</th> <td>{{ notification.date_sent }}</td> </tr> {% if notification.body %} <tr> <th>{% trans 'Subject' %}</th> <td>{{ notification.subject|safe }}</td> </tr> <tr> <th>{% trans 'Body' %}</th> <td>{{ notification.body }}</td> </tr> {% else %} <tr> <th>{% trans 'Message' %}</th> <th>{{ notification.subject|safe }}</th> </tr> {% endif %} </table> <div class="form-actions"><a href="{% url 'customer:notifications-inbox' %}" class="btn">{% trans 'Return to notifications inbox' %}</a></div> {% endblock tabcontent %}
#ifndef <API key> #define <API key> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/strings/string16.h" #include "content/common/content_export.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "v8/include/v8.h" namespace blink { class WebFormElement; class WebFrame; class WebNode; class WebString; struct WebURLError; } namespace content { class RendererPpapiHost; class RenderFrame; class RenderFrameImpl; // Base class for objects that want to filter incoming IPCs, and also get // notified of changes to the frame. class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, public IPC::Sender { public: // By default, observers will be deleted when the RenderFrame goes away. If // they want to outlive it, they can override this function. virtual void OnDestruct(); // Called when a Pepper plugin is created. virtual void <API key>(RendererPpapiHost* host) {} // Called when a load is explicitly stopped by the user or browser. virtual void OnStop() {} // Called when the RenderFrame visiblity is changed. virtual void WasHidden() {} virtual void WasShown() {} // Called when associated widget is about to close. virtual void WidgetWillClose() {} // These match the Blink API notifications virtual void <API key>() {} virtual void <API key>() {} virtual void <API key>(bool is_new_navigation, bool <API key>) {} virtual void <API key>() {} virtual void <API key>(const blink::WebURLError& error) {} virtual void DidFinishLoad() {} virtual void <API key>() {} virtual void <API key>(v8::Local<v8::Context> context, int extension_group, int world_id) {} virtual void <API key>(v8::Local<v8::Context> context, int world_id) {} virtual void <API key>() {} virtual void DidChangeManifest() {} virtual void <API key>() {} virtual void WillSendSubmitEvent(const blink::WebFormElement& form) {} virtual void WillSubmitForm(const blink::WebFormElement& form) {} virtual void DidMatchCSS( const blink::WebVector<blink::WebString>& <API key>, const blink::WebVector<blink::WebString>& <API key>) {} // Called before FrameWillClose, when this frame has been detached from the // view, but has not been closed yet. This *will* be called when parent frames // are closing. Since the frame is already detached from the DOM at this time // it should not be inspected. virtual void FrameDetached() {} // Called when the frame will soon be closed. This is the last opportunity to // send messages to the host (e.g., for clean-up, shutdown, etc.). This is // *not* called on child frames when parent frames are being closed. virtual void FrameWillClose() {} // Called when we receive a console message from Blink for which we requested // extra details (like the stack trace). |message| is the error message, // |source| is the Blink-reported source of the error (either external or // internal), and |stack_trace| is the stack trace of the error in a // human-readable format (each frame is formatted as // "\n at function_name (source:line_number:column_number)"). virtual void <API key>(const base::string16& message, const base::string16& source, const base::string16& stack_trace, int32 line_number, int32 severity_level) {} // Called when a compositor frame has committed. virtual void <API key>() {} // Called when the focused node has changed to |node|. virtual void FocusedNodeChanged(const blink::WebNode& node) {} // IPC::Listener implementation. bool OnMessageReceived(const IPC::Message& message) override; // IPC::Sender implementation. bool Send(IPC::Message* message) override; RenderFrame* render_frame() const; int routing_id() const { return routing_id_; } protected: explicit RenderFrameObserver(RenderFrame* render_frame); ~RenderFrameObserver() override; private: friend class RenderFrameImpl; // This is called by the RenderFrame when it's going away so that this object // can null out its pointer. void RenderFrameGone(); RenderFrame* render_frame_; // The routing ID of the associated RenderFrame. int routing_id_; <API key>(RenderFrameObserver); }; } // namespace content #endif // <API key>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Forms :: text input : float</title> <style type="text/css"> form * { font-family: Ahem; font-size: 1em; line-height: 1em; } fieldset, div { background-color: red; padding: 0; margin: 1em; border: none; width: 2em; height: 1em; } input, span { font-size: 1em; line-height: 1em; color: lime; padding: 0; margin: 0; border: none; width: 1em; height: 1em; float: left; } </style> </head> <body> <form action=""> <fieldset> <input type="text" value="x"> <input type="text" value="x"> </fieldset> <div> <input type="text" value="x"> <input type="text" value="x"> </div> <div> <span>x</span> <span>x</span> </div> </form> <h4>Ahem font required for this test</h4> <p>you should see three identical, green rectangles, and no red</p> </body> </html>
<html> <head> <script> function log(str) { var li = document.createElement("li"); li.appendChild(document.createTextNode(str)); var console = document.getElementById("console"); console.appendChild(li); } function assertEqual(message, actual, expected) { if (actual != expected) log("\n" + message + ": Failure, actual: " + actual + "; expected: " + expected); else log("\n" + message + ": Success"); } function runTests() { if (window.testRunner) { testRunner.dumpAsText(); } assertEqual("stringify", JSON.stringify(window.location), '{"ancestorOrigins":{},"origin":"http: } </script> </head> <body onload="runTests();"> <p> Tests that Location interface is [Unforgeable], thus JSON.stringify() works well for Location objects. </p> <ul id="console" dir=ltr></ul> </body> </html>
using System; using FluentNHibernate.Conventions; using FluentNHibernate.Conventions.AcceptanceCriteria; using FluentNHibernate.Conventions.Instances; using FluentNHibernate.Conventions.Inspections; using FluentNHibernate.Mapping; using NUnit.Framework; namespace FluentNHibernate.Testing.<API key> { [TestFixture] public class AddingTypeTests { private <API key> finder; [SetUp] public void CreateFinder() { finder = new <API key>(); } [Test] public void <API key>() { var ex = Catch.Exception(() => finder.Add<<API key>>()); ex.ShouldBeNull(); } [Test] public void <API key>() { var ex = Catch.Exception(() => finder.Add<<API key>>()); ex.ShouldBeNull(); } [Test] public void <API key>() { var ex = Catch.Exception(() => finder.Add<<API key>>()); ex.ShouldBeOfType<<API key>>(); ex.ShouldNotBeNull(); } [Test] public void <API key>() { var ex = Catch.Exception(() => finder.Add<<API key>>()); ex.ShouldBeOfType<<API key>>(); ex.ShouldNotBeNull(); } [Test] public void <API key>() { var ex = Catch.Exception(() => finder.AddAssembly(typeof(<API key>).Assembly)); ex.ShouldBeNull(); } } public class <API key> : IClassConvention { public <API key>() { } public void Apply(IClassInstance instance) {} } public class <API key> : IClassConvention { public <API key>(IConventionFinder conventionFinder) { } public void Apply(IClassInstance instance) {} } public class <API key> : IClassConvention { public <API key>(int someParameter) { } public void Apply(IClassInstance instance) {} } }
'use strict'; import type {Node} from 'React'; import {ActivityIndicator, StyleSheet, View} from 'react-native'; import React, {Component} from 'react'; type State = {|animating: boolean|}; type Props = $ReadOnly<{||}>; type Timer = TimeoutID; class <API key> extends Component<Props, State> { _timer: Timer; constructor(props: Props) { super(props); this.state = { animating: true, }; } componentDidMount() { this.setToggleTimeout(); } <API key>() { clearTimeout(this._timer); } setToggleTimeout() { this._timer = setTimeout(() => { this.setState({animating: !this.state.animating}); this.setToggleTimeout(); }, 2000); } render(): Node { return ( <ActivityIndicator animating={this.state.animating} style={[styles.centering, {height: 80}]} size="large" /> ); } } const styles = StyleSheet.create({ centering: { alignItems: 'center', justifyContent: 'center', padding: 8, }, gray: { backgroundColor: '#cccccc', }, horizontal: { flexDirection: 'row', justifyContent: 'space-around', padding: 8, }, }); exports.displayName = (undefined: ?string); exports.category = 'UI'; exports.framework = 'React'; exports.title = 'ActivityIndicator'; exports.documentationURL = 'https://reactnative.dev/docs/activityindicator'; exports.description = 'Animated loading indicators.'; exports.examples = [ { title: 'Default (small, white)', render(): Node { return ( <ActivityIndicator style={[styles.centering, styles.gray]} color="white" /> ); }, }, { title: 'Gray', render(): Node { return ( <View> <ActivityIndicator style={[styles.centering]} /> <ActivityIndicator style={[styles.centering, styles.gray]} /> </View> ); }, }, { title: 'Custom colors', render(): Node { return ( <View style={styles.horizontal}> <ActivityIndicator color="#0000ff" /> <ActivityIndicator color="#aa00aa" /> <ActivityIndicator color="#aa3300" /> <ActivityIndicator color="#00aa00" /> </View> ); }, }, { title: 'Large', render(): Node { return ( <ActivityIndicator style={[styles.centering, styles.gray]} size="large" color="white" /> ); }, }, { title: 'Large, custom colors', render(): Node { return ( <View style={styles.horizontal}> <ActivityIndicator size="large" color="#0000ff" /> <ActivityIndicator size="large" color="#aa00aa" /> <ActivityIndicator size="large" color="#aa3300" /> <ActivityIndicator size="large" color="#00aa00" /> </View> ); }, }, { title: 'Start/stop', render(): Node { return <<API key> />; }, }, { title: 'Custom size', render(): Node { return ( <ActivityIndicator style={[styles.centering, {transform: [{scale: 1.5}]}]} size="large" /> ); }, }, { platform: 'android', title: 'Custom size (size: 75)', render(): Node { return <ActivityIndicator style={styles.centering} size={75} />; }, }, ];
for astTuple in Query.input.tuples('ast'): if type(astTuple.ast) is Field: modifiers = astTuple.ast.modifiers nonFinalPublic = modifiers.isSet(Modifier.ModifierFlag.Public) and not modifiers.isSet(Modifier.ModifierFlag.Final) if not nonFinalPublic: Query.input.remove(astTuple) Query.result = Query.input
""" This module contains some assorted functions used in tests """ from __future__ import absolute_import import os from importlib import import_module from twisted.trial.unittest import SkipTest from scrapy.exceptions import NotConfigured from scrapy.utils.boto import is_botocore def assert_aws_environ(): """Asserts the current environment is suitable for running AWS testsi. Raises SkipTest with the reason if it's not. """ skip_if_no_boto() if 'AWS_ACCESS_KEY_ID' not in os.environ: raise SkipTest("AWS keys not found") def assert_gcs_environ(): if 'GCS_PROJECT_ID' not in os.environ: raise SkipTest("GCS_PROJECT_ID not found") def skip_if_no_boto(): try: is_botocore() except NotConfigured as e: raise SkipTest(e) def <API key>(bucket, path, with_key=False): """ Get content from s3 key, and delete key afterwards. """ if is_botocore(): import botocore.session session = botocore.session.get_session() client = session.create_client('s3') key = client.get_object(Bucket=bucket, Key=path) content = key['Body'].read() client.delete_object(Bucket=bucket, Key=path) else: import boto # assuming boto=2.2.2 bucket = boto.connect_s3().get_bucket(bucket, validate=False) key = bucket.get_key(path) content = key.<API key>() bucket.delete_key(path) return (content, key) if with_key else content def <API key>(bucket, path): from google.cloud import storage client = storage.Client(project=os.environ.get('GCS_PROJECT_ID')) bucket = client.get_bucket(bucket) blob = bucket.get_blob(path) content = blob.download_as_string() bucket.delete_blob(path) return content, blob def get_crawler(spidercls=None, settings_dict=None): """Return an unconfigured Crawler object. If settings_dict is given, it will be used to populate the crawler settings with a project level priority. """ from scrapy.crawler import CrawlerRunner from scrapy.spiders import Spider runner = CrawlerRunner(settings_dict) return runner.create_crawler(spidercls or Spider) def get_pythonpath(): """Return a PYTHONPATH suitable to use in processes so that they find this installation of Scrapy""" scrapy_path = import_module('scrapy').__path__[0] return os.path.dirname(scrapy_path) + os.pathsep + os.environ.get('PYTHONPATH', '') def get_testenv(): """Return a OS environment dict suitable to fork processes that need to import this installation of Scrapy, instead of a system installed one. """ env = os.environ.copy() env['PYTHONPATH'] = get_pythonpath() return env def assert_samelines(testcase, text1, text2, msg=None): """Asserts text1 and text2 have the same lines, ignoring differences in line endings between platforms """ testcase.assertEqual(text1.splitlines(), text2.splitlines(), msg)
#include "rf-core/api/mailbox.h" #include "rf-core/api/common_cmd.h" #include "rf-core/api/prop_cmd.h" /* Overrides for <API key> */ uint32_t overrides[] = { /* override_synth.xml */ HW32_ARRAY_OVERRIDE(0x6088, 1), (uint32_t)0x0000001A, <API key>(0, 61, 0xF, 0xD), HW32_ARRAY_OVERRIDE(0x4038, 1), (uint32_t)0x0000003A, HW_REG_OVERRIDE(0x4020, 0x7F00), HW_REG_OVERRIDE(0x4064, 0x0040), (uint32_t)0x684A3, (uint32_t)0xC0040141, (uint32_t)0x0533B107, (uint32_t)0xA480583, (uint32_t)0x7AB80603, ADI_REG_OVERRIDE(1, 4, 0x1F), <API key>(1, 7, 0x4, 0x4), HW_REG_OVERRIDE(0x6084, 0x35F1), (uint32_t)0x00038883, (uint32_t)0x00FB88A3, /* TX power override */ ADI_REG_OVERRIDE(0, 12, 0xF9), /* Overrides for CRC16 functionality */ (uint32_t)0x943, (uint32_t)0x963, (uint32_t)0xFFFFFFFF, }; /* <API key> */ <API key> <API key> = { .commandNo = 0x3807, .status = 0x0000, .pNextOp = 0, .startTime = 0x00000000, .startTrigger.triggerType = 0x0, .startTrigger.bEnaCmd = 0x0, .startTrigger.triggerNo = 0x0, .startTrigger.pastTrig = 0x0, .condition.rule = 0x1, .condition.nSkip = 0x0, .modulation.modType = 0x1, .modulation.deviation = 0x64, .symbolRate.preScale = 0xf, .symbolRate.rateWord = 0x8000, .rxBw = 0x24, .preamConf.nPreamBytes = 0x3, .preamConf.preamMode = 0x0, .formatConf.nSwBits = 0x18, .formatConf.bBitReversal = 0x0, .formatConf.bMsbFirst = 0x1, .formatConf.fecMode = 0x0, /* 7: .4g mode with dynamic whitening and CRC choice */ .formatConf.whitenMode = 0x7, .config.frontEndMode = 0x0, /* Differential mode */ .config.biasMode = 0x1, /* External bias*/ .config.bNoFsPowerUp = 0x0, .txPower = 0x00, /* Driver sets correct value */ .pRegOverride = overrides, .intFreq = 0x8000, .centerFreq = 868, .loDivider = 0x05, }; /* CMD_FS */ rfc_CMD_FS_t <API key> = { .commandNo = 0x0803, .status = 0x0000, .pNextOp = 0, .startTime = 0x00000000, .startTrigger.triggerType = 0x0, .startTrigger.bEnaCmd = 0x0, .startTrigger.triggerNo = 0x0, .startTrigger.pastTrig = 0x0, .condition.rule = 0x1, .condition.nSkip = 0x0, .frequency = 868, .fractFreq = 0x0000, .synthConf.bTxMode = 0x0, .synthConf.refFreq = 0x0, .__dummy0 = 0x00, .midPrecal = 0x00, .ktPrecal = 0x00, .tdcPrecal = 0x0000, }; /* CMD_PROP_TX_ADV */ <API key> <API key> = { .commandNo = 0x3803, .status = 0x0000, .pNextOp = 0, .startTime = 0x00000000, .startTrigger.triggerType = 0x0, .startTrigger.bEnaCmd = 0x0, .startTrigger.triggerNo = 0x0, .startTrigger.pastTrig = 0x0, .condition.rule = 0x1, .condition.nSkip = 0x0, .pktConf.bFsOff = 0x0, .pktConf.bUseCrc = 0x1, .pktConf.bCrcIncSw = 0x0, /* .4g mode */ .pktConf.bCrcIncHdr = 0x0, /* .4g mode */ .numHdrBits = 0x10 /* 16: .4g mode */, .pktLen = 0x0000, .startConf.bExtTxTrig = 0x0, .startConf.inputMode = 0x0, .startConf.source = 0x0, .preTrigger.triggerType = TRIG_REL_START, .preTrigger.bEnaCmd = 0x0, .preTrigger.triggerNo = 0x0, .preTrigger.pastTrig = 0x1, .preTime = 0x00000000, .syncWord = 0x0055904e, .pPkt = 0, }; /* CMD_PROP_RX_ADV */ <API key> <API key> = { .commandNo = 0x3804, .status = 0x0000, .pNextOp = 0, .startTime = 0x00000000, .startTrigger.triggerType = 0x0, .startTrigger.bEnaCmd = 0x0, .startTrigger.triggerNo = 0x0, .startTrigger.pastTrig = 0x0, .condition.rule = 0x1, .condition.nSkip = 0x0, .pktConf.bFsOff = 0x0, .pktConf.bRepeatOk = 0x1, .pktConf.bRepeatNok = 0x1, .pktConf.bUseCrc = 0x1, .pktConf.bCrcIncSw = 0x0, /* .4g mode */ .pktConf.bCrcIncHdr = 0x0, /* .4g mode */ .pktConf.endType = 0x0, .pktConf.filterOp = 0x1, .rxConf.bAutoFlushIgnored = 0x1, .rxConf.bAutoFlushCrcErr = 0x1, .rxConf.bIncludeHdr = 0x0, .rxConf.bIncludeCrc = 0x0, .rxConf.bAppendRssi = 0x1, .rxConf.bAppendTimestamp = 0x0, .rxConf.bAppendStatus = 0x1, .syncWord0 = 0x0055904e, .syncWord1 = 0x00000000, .maxPktLen = 0x0000, /* To be populated by the driver. */ .hdrConf.numHdrBits = 0x10, /* 16: .4g mode */ .hdrConf.lenPos = 0x0, /* .4g mode */ .hdrConf.numLenBits = 0x0B, /* 11 = 0x0B .4g mode */ .addrConf.addrType = 0x0, .addrConf.addrSize = 0x0, .addrConf.addrPos = 0x0, .addrConf.numAddr = 0x0, .lenOffset = -4, /* .4g mode */ .endTrigger.triggerType = TRIG_NEVER, .endTrigger.bEnaCmd = 0x0, .endTrigger.triggerNo = 0x0, .endTrigger.pastTrig = 0x0, .endTime = 0x00000000, .pAddr = 0, .pQueue = 0, .pOutput = 0, };
'use strict'; const UIManager = require('UIManager'); const <API key> = require('<API key>'); /** * Capture an image of the screen, window or an individual view. The image * will be stored in a temporary file that will only exist for as long as the * app is running. * * The `view` argument can be the literal string `window` if you want to * capture the entire window, or it can be a reference to a specific * React Native component. * * The `options` argument may include: * - width/height (number) - the width and height of the image to capture. * - format (string) - either 'png' or 'jpeg'. Defaults to 'png'. * - quality (number) - the quality when using jpeg. 0.0 - 1.0 (default). * * Returns a Promise. * @platform ios */ function takeSnapshot( view?: 'window' | React$Element<any> | number, options?: { width?: number, height?: number, format?: 'png' | 'jpeg', quality?: number, }, ): Promise<any> { if (typeof view !== 'number' && view !== 'window') { view = <API key>(view) || 'window'; } // Call the hidden '__takeSnapshot' method; the main one throws an error to // prevent accidental <API key> usage. return UIManager.__takeSnapshot(view, options); } module.exports = takeSnapshot;
<html> <head> <title>GB18030 lead 8136C8</title> <meta http-equiv='content-type' content='text/html;charset=GB18030'> <link rel='stylesheet' href='tests.css'> </head> <body> <table> <caption>Four-byte lead 8136C8</caption> <tr><th colspan=2>GB18030<th colspan=3>Unicode <tr><td>=8136C830<td> 6È0 <td>U+21A0<td>&#8608;<td class=u>RIGHTWARDS TWO HEADED ARROW <tr><td>=8136C831<td> 6È1 <td>U+21A1<td>&#8609;<td class=u>DOWNWARDS TWO HEADED ARROW <tr><td>=8136C832<td> 6È2 <td>U+21A2<td>&#8610;<td class=u>LEFTWARDS ARROW WITH TAIL <tr><td>=8136C833<td> 6È3 <td>U+21A3<td>&#8611;<td class=u>RIGHTWARDS ARROW WITH TAIL <tr><td>=8136C834<td> 6È4 <td>U+21A4<td>&#8612;<td class=u>LEFTWARDS ARROW FROM BAR <tr><td>=8136C835<td> 6È5 <td>U+21A5<td>&#8613;<td class=u>UPWARDS ARROW FROM BAR <tr><td>=8136C836<td> 6È6 <td>U+21A6<td>&#8614;<td class=u>RIGHTWARDS ARROW FROM BAR <tr><td>=8136C837<td> 6È7 <td>U+21A7<td>&#8615;<td class=u>DOWNWARDS ARROW FROM BAR <tr><td>=8136C838<td> 6È8 <td>U+21A8<td>&#8616;<td class=u>UP DOWN ARROW WITH BASE <tr><td>=8136C839<td> 6È9 <td>U+21A9<td>&#8617;<td class=u>LEFTWARDS ARROW WITH HOOK </table> <p><a href='charset/GB18030.html'>Return</a></p> </body> </html>
(function($, window, document) { var pluginName = 'fatNav', defaults = {}; function Plugin(options) { this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } $.extend(Plugin.prototype, { init: function() { var self = this; var $nav = this.$nav = $('.fat-nav'); var $hamburger = this.$hamburger = $('<a href="javascript:void(0)" class="hamburger"><div class="hamburger__icon"></div></a>'); this._bodyOverflow = $('body').css('overflow'); // Hack to prevent mobile safari scrolling the whole body when nav is open if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) { $nav.children().css({ 'height': '110%', 'transform': 'translateY(-5%)' }); } $('body').append($hamburger); $().add($hamburger).add($nav.find('a')).on('click', function(e) { self.toggleNav(); }); }, toggleNav: function() { var self = this; this.$nav.fadeToggle(400); self.toggleBodyOverflow(); $().add(this.$hamburger).add(this.$nav).toggleClass('active'); }, toggleBodyOverflow: function() { var self = this; var $body = $('body'); $body.toggleClass('no-scroll'); var isNavOpen = $body.hasClass('no-scroll'); // $body.width($body.width()); $body.css('overflow', isNavOpen ? 'hidden' : self._bodyOverflow); } }); if (typeof $[pluginName] === 'undefined') { $[pluginName] = function(options) { return new Plugin(this, options); }; } }(jQuery, window, document));
#include "core/loader/ThreadableLoader.h" #include "core/dom/Document.h" #include "core/dom/ExecutionContext.h" #include "core/loader/<API key>.h" #include "core/loader/<API key>.h" #include "core/loader/<API key>.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" namespace blink { PassOwnPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, <API key>* client, const <API key>& options, const <API key>& <API key>) { ASSERT(client); if (context.isWorkerGlobalScope()) { return <API key>::create(toWorkerGlobalScope(context), client, options, <API key>); } return <API key>::create(toDocument(context), client, options, <API key>); } void ThreadableLoader::<API key>(ExecutionContext& context, const ResourceRequest& request, <API key>& client, const <API key>& options, const <API key>& <API key>) { if (context.isWorkerGlobalScope()) { <API key>::<API key>(toWorkerGlobalScope(context), request, client, options, <API key>); return; } <API key>::<API key>(toDocument(context), request, client, options, <API key>); } } // namespace blink
// package metadata file for Meteor.js 'use strict'; var packageName = 'gromo:jquery.scrollbar'; var where = 'client'; // where to install: 'client' or 'server'. For both, pass nothing. Package.describe({ name: packageName, version: '0.2.10', // Brief, one-line summary of the package. summary: 'Cross-browser CSS customizable scrollbar with advanced features.', // URL to the Git repository containing the source code for this package. git: 'git@github.com:gromo/jquery.scrollbar.git' }); Package.onUse(function (api) { api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']); api.use('jquery', where); api.addFiles(['jquery.scrollbar.js', 'jquery.scrollbar.css'], where); }); Package.onTest(function (api) { api.use([packageName, 'sanjo:jasmine'], where); api.use(['webapp','tinytest'], where); api.addFiles('meteor/tests.js', where); // testing specific files });
Prism.languages.j={comment:{pattern:/\bNB\..*/,greedy:!0},string:{pattern:/'(?:''|[^'\r\n])*'/,greedy:!0},keyword:/\b(?:(?:CR|LF|adverb|conjunction|def|define|dyad|monad|noun|verb)\b|(?:assert|break|case|catch[dt]?|continue|do|else|elseif|end|fcase|for|for_\w+|goto_\w+|if|label_\w+|return|select|throw|try|while|whilst)\.)/,verb:{pattern:/(?!\^:|;\.|[=!][.:])(?:\{(?:\.|::?)?|p(?:\.\.?|:)|[=!\]]|[<>+*\-%$|,#][.:]?|[?^]\.?|[;\[]:?|[~}"i][.:]|[ACeEIjLor]\.|(?:[_\/\\qsux]|_?\d):)/,alias:"keyword"},number:/\b_?(?:(?!\d:)\d+(?:\.\d+)?(?:(?:ad|ar|[ejpx])_?\d+(?:\.\d+)?)*(?:b_?[\da-z]+(?:\.[\da-z]+)?)?|_\b(?!\.))/,adverb:{pattern:/[~}]|[\/\\]\.?|[bfM]\.|t[.:]/,alias:"builtin"},operator:/[=a][.:]|_\./,conjunction:{pattern:/&(?:\.:?|:)?|[.:@][.:]?|[!D][.:]|[;dHT]\.|`:?|[\^LS]:|"/,alias:"variable"},punctuation:/[()]/};
(function ($) { $.fn.zclip = function (params) { if (typeof params == "object" && !params.length) { var settings = $.extend({ path: 'ZeroClipboard.swf', copy: null, beforeCopy: null, afterCopy: null, clickAfter: true, setHandCursor: true, setCSSEffects: true }, params); return this.each(function () { var o = $(this); if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) { ZeroClipboard.setMoviePath(settings.path); var clip = new ZeroClipboard.Client(); if($.isFunction(settings.copy)){ o.bind('zClip_copy',settings.copy); } if($.isFunction(settings.beforeCopy)){ o.bind('zClip_beforeCopy',settings.beforeCopy); } if($.isFunction(settings.afterCopy)){ o.bind('zClip_afterCopy',settings.afterCopy); } clip.setHandCursor(settings.setHandCursor); clip.setCSSEffects(settings.setCSSEffects); clip.addEventListener('mouseOver', function (client) { o.trigger('mouseenter'); }); clip.addEventListener('mouseOut', function (client) { o.trigger('mouseleave'); }); clip.addEventListener('mouseDown', function (client) { o.trigger('mousedown'); if(!$.isFunction(settings.copy)){ clip.setText(settings.copy); } else { clip.setText(o.triggerHandler('zClip_copy')); } if ($.isFunction(settings.beforeCopy)) { o.trigger('zClip_beforeCopy'); } }); clip.addEventListener('complete', function (client, text) { if ($.isFunction(settings.afterCopy)) { o.trigger('zClip_afterCopy'); } else { if (text.length > 500) { text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)"; } o.removeClass('hover'); alert("Copied text to clipboard:\n\n " + text); } if (settings.clickAfter) { o.trigger('click'); } }); clip.glue(o[0], o.parent()[0]); $(window).bind('load resize',function(){clip.reposition();}); } }); } else if (typeof params == "string") { return this.each(function () { var o = $(this); params = params.toLowerCase(); var zclipId = o.data('zclipId'); var clipElm = $('#' + zclipId + '.zclip'); if (params == "remove") { clipElm.remove(); o.removeClass('active hover'); } else if (params == "hide") { clipElm.hide(); o.removeClass('active hover'); } else if (params == "show") { clipElm.show(); } }); } } })(jQuery); // ZeroClipboard // Simple Set Clipboard System var ZeroClipboard = { version: "1.0.7", clients: {}, // registered upload clients on page, indexed by id moviePath: 'ZeroClipboard.swf', // URL to movie nextId: 1, // ID of next movie $: function (thingy) { // simple DOM lookup utility function if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); if (!thingy.addClass) { // extend element with a few useful methods thingy.hide = function () { this.style.display = 'none'; }; thingy.show = function () { this.style.display = ''; }; thingy.addClass = function (name) { this.removeClass(name); this.className += ' ' + name; }; thingy.removeClass = function (name) { var classes = this.className.split(/\s+/); var idx = -1; for (var k = 0; k < classes.length; k++) { if (classes[k] == name) { idx = k; k = classes.length; } } if (idx > -1) { classes.splice(idx, 1); this.className = classes.join(' '); } return this; }; thingy.hasClass = function (name) { return !!this.className.match(new RegExp("\\s*" + name + "\\s*")); }; } return thingy; }, setMoviePath: function (path) { // set path to ZeroClipboard.swf this.moviePath = path; }, dispatch: function (id, eventName, args) { // receive event from flash movie, send to client var client = this.clients[id]; if (client) { client.receiveEvent(eventName, args); } }, register: function (id, client) { // register new client to receive events this.clients[id] = client; }, <API key>: function (obj, stopObj) { // get absolute coordinates for dom element var info = { left: 0, top: 0, width: obj.width ? obj.width : obj.offsetWidth, height: obj.height ? obj.height : obj.offsetHeight }; if (obj && (obj != stopObj)) { info.left += obj.offsetLeft; info.top += obj.offsetTop; } return info; }, Client: function (elem) { // constructor for new simple upload client this.handlers = {}; // unique ID this.id = ZeroClipboard.nextId++; this.movieId = 'ZeroClipboardMovie_' + this.id; // register client with singleton to receive flash events ZeroClipboard.register(this.id, this); // create movie if (elem) this.glue(elem); } }; ZeroClipboard.Client.prototype = { id: 0, // unique ID for us ready: false, // whether movie is ready to receive events or not movie: null, // reference to movie object clipText: '', // text to copy to clipboard handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor cssEffects: true, // enable CSS mouse effects on dom container handlers: null, // user event handlers glue: function (elem, appendElem, stylesToAdd) { // glue to DOM element // elem can be ID or actual DOM element object this.domElement = ZeroClipboard.$(elem); // float just above object, or zIndex 99 if dom element isn't set var zIndex = 99; if (this.domElement.style.zIndex) { zIndex = parseInt(this.domElement.style.zIndex, 10) + 1; } if (typeof(appendElem) == 'string') { appendElem = ZeroClipboard.$(appendElem); } else if (typeof(appendElem) == 'undefined') { appendElem = document.<API key>('body')[0]; } // find X/Y position of domElement var box = ZeroClipboard.<API key>(this.domElement, appendElem); // create floating DIV above element this.div = document.createElement('div'); this.div.className = "zclip"; this.div.id = "zclip-" + this.movieId; $(this.domElement).data('zclipId', 'zclip-' + this.movieId); var style = this.div.style; style.position = 'absolute'; style.left = '' + box.left + 'px'; style.top = '' + box.top + 'px'; style.width = '' + box.width + 'px'; style.height = '' + box.height + 'px'; style.zIndex = zIndex; if (typeof(stylesToAdd) == 'object') { for (addedStyle in stylesToAdd) { style[addedStyle] = stylesToAdd[addedStyle]; } } // style.backgroundColor = '#f00'; // debug appendElem.appendChild(this.div); this.div.innerHTML = this.getHTML(box.width, box.height); }, getHTML: function (width, height) { // return HTML for movie var html = ''; var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height; if (navigator.userAgent.match(/MSIE/)) { // IE gets an OBJECT tag var protocol = location.href.match(/^https/i) ? 'https: html += '<object classid="clsid:<API key>" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>'; } else { // all other browsers get an EMBED tag html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor=" } return html; }, hide: function () { // temporarily hide floater offscreen if (this.div) { this.div.style.left = '-2000px'; } }, show: function () { // show ourselves after a call to hide() this.reposition(); }, destroy: function () { // destroy control and floater if (this.domElement && this.div) { this.hide(); this.div.innerHTML = ''; var body = document.<API key>('body')[0]; try { body.removeChild(this.div); } catch (e) {; } this.domElement = null; this.div = null; } }, reposition: function (elem) { // reposition our floating div, optionally to new container // warning: container CANNOT change size, only position if (elem) { this.domElement = ZeroClipboard.$(elem); if (!this.domElement) this.hide(); } if (this.domElement && this.div) { var box = ZeroClipboard.<API key>(this.domElement); var style = this.div.style; style.left = '' + box.left + 'px'; style.top = '' + box.top + 'px'; } }, setText: function (newText) { // set text to be copied to clipboard this.clipText = newText; if (this.ready) { this.movie.setText(newText); } }, addEventListener: function (eventName, func) { // add user event listener for event // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel eventName = eventName.toString().toLowerCase().replace(/^on/, ''); if (!this.handlers[eventName]) { this.handlers[eventName] = []; } this.handlers[eventName].push(func); }, setHandCursor: function (enabled) { // enable hand cursor (true), or default arrow cursor (false) this.handCursorEnabled = enabled; if (this.ready) { this.movie.setHandCursor(enabled); } }, setCSSEffects: function (enabled) { // enable or disable CSS effects on DOM container this.cssEffects = !! enabled; }, receiveEvent: function (eventName, args) { // receive event from flash eventName = eventName.toString().toLowerCase().replace(/^on/, ''); // special behavior for certain events switch (eventName) { case 'load': // movie claims it is ready, but in IE this isn't always the case... // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function this.movie = document.getElementById(this.movieId); if (!this.movie) { var self = this; setTimeout(function () { self.receiveEvent('load', null); }, 1); return; } // firefox on pc needs a "kick" in order to set these in certain cases if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { var self = this; setTimeout(function () { self.receiveEvent('load', null); }, 100); this.ready = true; return; } this.ready = true; try { this.movie.setText(this.clipText); } catch (e) {} try { this.movie.setHandCursor(this.handCursorEnabled); } catch (e) {} break; case 'mouseover': if (this.domElement && this.cssEffects) { this.domElement.addClass('hover'); if (this.recoverActive) { this.domElement.addClass('active'); } } break; case 'mouseout': if (this.domElement && this.cssEffects) { this.recoverActive = false; if (this.domElement.hasClass('active')) { this.domElement.removeClass('active'); this.recoverActive = true; } this.domElement.removeClass('hover'); } break; case 'mousedown': if (this.domElement && this.cssEffects) { this.domElement.addClass('active'); } break; case 'mouseup': if (this.domElement && this.cssEffects) { this.domElement.removeClass('active'); this.recoverActive = false; } break; } // switch eventName if (this.handlers[eventName]) { for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { var func = this.handlers[eventName][idx]; if (typeof(func) == 'function') { // actual function reference func(this, args); } else if ((typeof(func) == 'object') && (func.length == 2)) { // PHP style object + method, i.e. [myObject, 'myMethod'] func[0][func[1]](this, args); } else if (typeof(func) == 'string') { // name of function window[func](this, args); } } // foreach event handler defined } // user defined handler for event } };
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using OrchardCore.Environment.Shell.Descriptor.Models; namespace OrchardCore.Environment.Shell.Descriptor.Settings { <summary> Implements <see cref="<API key>"/> by returning a single tenant with a specified set of features. This class can be registered as a singleton as its state never changes. </summary> public class <API key> : <API key> { private readonly IEnumerable<ShellFeature> _shellFeatures; private ShellDescriptor _shellDescriptor; public <API key>(IEnumerable<ShellFeature> shellFeatures) { _shellFeatures = shellFeatures; } public Task<ShellDescriptor> <API key>() { if (_shellDescriptor == null) { _shellDescriptor = new ShellDescriptor { Features = _shellFeatures.Distinct().ToList() }; } return Task.FromResult(_shellDescriptor); } public Task <API key>(int priorSerialNumber, IEnumerable<ShellFeature> enabledFeatures, IEnumerable<ShellParameter> parameters) { return Task.CompletedTask; } } }
// mksyscall.pl -l32 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT package syscall import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { _p0 = unsafe.Pointer(&mib[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path1) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(path2) if err != nil { return } _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { Syscall(SYS_EXIT, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int32(r0) usec = int32(r1) if e1 != 0 { err = errnoErr(e1) } return }
<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>U+2500-U+257F: Box Drawing</title> <link rel="next" href="2580.html"> <link rel="prev" href="2460.html"> <link rel="contents" href="./"> </head> <body> <table> <caption>Box Drawing</caption> <tr><th> <th>0<th>1<th>2<th>3<th>4<th>5<th>6<th>7<th>8<th>9<th>A<th>B<th>C<th>D<th>E<th>F <tr><th>2500<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2510<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2520<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2530<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2540<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2550<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2560<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr><th>2570<td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> </table> </body> </html>
package org.chocosolver.solver.thread; /** * Slave born to be mastered and work in parallel * * @author Jean-Guillaume Fages */ public abstract class <API key><P extends <API key>> { /** * Create a slave born to be mastered and work in parallel * * @param master master solver * @param id slave unique name */ public <API key>(P master, int id) { this.master = master; this.id = id; } /** * Creates a new thread to work in parallel */ public void workInParallel() { Thread t = new Thread() { @Override public void run() { work(); master.wishGranted(); } }; t.start(); } /** * do something */ public abstract void work(); }
<!DOCTYPE html> <title>drag &amp; drop - event sequence for draggable elements</title> <script type="text/javascript" src="/resources/testharness.js"></script> <style type="text/css"> /* use margins instead of padding to make sure the body begins at the top of the page */ html, body { margin: 0; } body { padding: 116px 8px 8px; } #testhere div { height: 100px; width: 100px; position: absolute; top: 8px; } #orange { background-color: orange; left: 8px; } #fuchsia { background-color: fuchsia; left: 158px; } #yellow { background-color: yellow; left: 308px; } #blue { background-color: navy; left: 458px; } </style> <script> setup(function () {},{explicit_done:true,timeout:30000}); window.onload = function () { var orange = document.querySelector('#orange') var fuchsia = document.querySelector('#fuchsia') var yellow = document.querySelector('#yellow') var blue = document.querySelector('#blue') var body = document.body; var events = new Array orange.ondragstart = function (e) { events.push('orange.ondragstart'); e.dataTransfer.effectAllowed = 'copy'; e.dataTransfer.setData('Text', 'foo'); }; orange.ondrag = function () { events.push('orange.ondrag'); }; orange.ondragenter = function () { events.push('orange.ondragenter'); }; orange.ondragover = function () { events.push('orange.ondragover'); }; orange.ondragleave = function () { events.push('orange.ondragleave'); }; orange.ondrop = function () { events.push('orange.ondrop'); return false; }; orange.ondragend = function () { events.push('orange.ondragend'); }; orange.onmousedown = function () { events.push('orange.onmousedown'); }; orange.onmouseup = function () { events.push('orange.onmouseup'); }; /* Events for the fuchsia box */ fuchsia.ondragstart = function () { events.push('pink.ondragstart'); }; fuchsia.ondrag = function () { events.push('pink.ondrag'); }; fuchsia.ondragenter = function () { events.push('pink.ondragenter'); }; fuchsia.ondragover = function () { events.push('pink.ondragover'); }; fuchsia.ondragleave = function () { events.push('pink.ondragleave'); }; fuchsia.ondrop = function () { events.push('pink.ondrop'); return false; }; fuchsia.ondragend = function () { events.push('pink.ondragend'); }; fuchsia.onmousedown = function () { events.push('pink.onmousedown'); }; fuchsia.onmouseup = function () { events.push('pink.onmouseup'); }; /* Events for the fuchsia box */ yellow.ondragstart = function () { events.push('yellow.ondragstart'); }; yellow.ondrag = function () { events.push('yellow.ondrag'); }; yellow.ondragenter = function () { events.push('yellow.ondragenter'); return false; }; yellow.ondragover = function () { events.push('yellow.ondragover'); return false; }; yellow.ondragleave = function () { events.push('yellow.ondragleave'); }; yellow.ondrop = function () { events.push('yellow.ondrop'); return false; }; yellow.ondragend = function () { events.push('yellow.ondragend'); }; yellow.onmousedown = function () { events.push('yellow.onmousedown'); }; yellow.onmouseup = function () { events.push('yellow.onmouseup'); }; /* Events for the blue box (droppable) */ blue.ondragstart = function () { events.push('blue.ondragstart'); }; blue.ondrag = function () { events.push('blue.ondrag'); }; blue.ondragenter = function () { events.push('blue.ondragenter'); return false; }; blue.ondragover = function () { events.push('blue.ondragover'); return false; }; blue.ondragleave = function () { events.push('blue.ondragleave'); }; blue.ondrop = function () { events.push('blue.ondrop'); return false; }; blue.ondragend = function () { events.push('blue.ondragend'); }; blue.onmousedown = function () { events.push('blue.onmousedown'); }; blue.onmouseup = function () { events.push('blue.onmouseup'); }; /* Events for the page body */ body.ondragstart = function (e) { events.push( ( e.target == body ) ? 'body.ondragstart': 'bubble.ondragstart' ); }; body.ondrag = function (e) { events.push( ( e.target == body ) ? 'body.ondrag': 'bubble.ondrag' ); }; body.ondragenter = function (e) { events.push( ( e.target == body ) ? 'body.ondragenter': 'bubble.ondragenter' ); }; body.ondragover = function (e) { events.push( ( e.target == body ) ? 'body.ondragover': 'bubble.ondragover' ); }; body.ondragleave = function (e) { events.push( ( e.target == body ) ? 'body.ondragleave': 'bubble.ondragleave' ); }; body.ondrop = function (e) { events.push( ( e.target == body ) ? 'body.ondrop': 'bubble.ondrop' ); }; body.ondragend = function (e) { events.push( ( e.target == body ) ? 'body.ondragend': 'bubble.ondragend' ); setTimeout(finish,100); }; body.onmousedown = function (e) { events.push( ( e.target == body ) ? 'body.onmousedown': 'bubble.onmousedown' ); }; body.onmouseup = function (e) { events.push( ( e.target == body ) ? 'body.onmouseup': 'bubble.onmouseup' ); }; function finish(e) { var i, evindex; events = events.join('-'); /* Normalise; reduce repeating event sequences to only 2 occurrences. This makes the final event sequence predictable, no matter how many times the drag->dragover sequences repeat. Two occurrances are kept in each case to allow testing to make sure the sequence really is repeating. */ //spec compliant - div dragenter is not cancelled, so body dragenter fires and body becomes current target //repeats while drag is over orange or fuchsia or the body events = events.replace(/(-orange\.ondrag-bubble\.ondrag-body\.ondragover){3,}/g,'$1$1'); //repeats while dragging over yellow events = events.replace(/(-orange\.ondrag-bubble\.ondrag-yellow\.ondragover-bubble\.ondragover){3,}/g,'$1$1'); //repeats while dragging over blue events = events.replace(/(-orange\.ondrag-bubble\.ondrag-blue\.ondragover-bubble\.ondragover){3,}/g,'$1$1'); //non-spec-compliant repeats while dragging over orange events = events.replace(/(-orange\.ondrag-bubble\.ondrag-orange\.ondragover-bubble\.ondragover){3,}/g,'$1$1'); //non-spec-compliant repeats while dragging over fuchsia events = events.replace(/(-orange\.ondrag-bubble\.ondrag-pink\.ondragover-bubble\.ondragover){3,}/g,'$1$1'); events = events.split(/-/g); test(function () { assert_equals( events.length, 74 ); }, "Normalised number of events"); test(function () { assert_equals(events.join(','), 'orange.onmousedown,'+ //mouse down 'bubble.onmousedown,'+ 'orange.ondragstart,'+ //dragging begins 'bubble.ondragstart,'+ 'orange.ondrag,'+ //mouse is over orange 'bubble.ondrag,'+ 'orange.ondragenter,'+ //not cancelled 'bubble.ondragenter,'+ 'body.ondragenter,'+ //so body becomes current target, and the event fires there as well 'body.ondragover,'+ 'orange.ondrag,'+ //start repeating (some over orange, some over body) 'bubble.ondrag,'+ 'body.ondragover,'+ 'orange.ondrag,'+ //...twice to make sure it actually repeats 'bubble.ondrag,'+ 'body.ondragover,'+ //end repeating 'orange.ondrag,'+ //mouse moves over pink 'bubble.ondrag,'+ 'pink.ondragenter,'+ //not cancelled 'bubble.ondragenter,'+ 'body.ondragover,'+ //so body becomes current target, but since it was already the target, dragenter does not need to fire again 'orange.ondrag,'+ //start repeating (some over pink, some over body) 'bubble.ondrag,'+ 'body.ondragover,'+ 'orange.ondrag,'+ //...twice to make sure it actually repeats 'bubble.ondrag,'+ 'body.ondragover,'+ //end repeating 'orange.ondrag,'+ //mouse moves over yellow 'bubble.ondrag,'+ 'yellow.ondragenter,'+ 'bubble.ondragenter,'+ 'body.ondragleave,'+ 'yellow.ondragover,'+ 'bubble.ondragover,'+ 'orange.ondrag,'+ //start repeating (over yellow) 'bubble.ondrag,'+ 'yellow.ondragover,'+ 'bubble.ondragover,'+ 'orange.ondrag,'+ //...twice to make sure it actually repeats 'bubble.ondrag,'+ 'yellow.ondragover,'+ 'bubble.ondragover,'+ //end repeating 'orange.ondrag,'+ //mouse moves over body 'bubble.ondrag,'+ 'body.ondragenter,'+ //not cancelled 'body.ondragenter,'+ //so it fires again and sets body as current target 'yellow.ondragleave,'+ 'bubble.ondragleave,'+ 'body.ondragover,'+ 'orange.ondrag,'+ //start repeating (over body) 'bubble.ondrag,'+ 'body.ondragover,'+ 'orange.ondrag,'+ //...twice to make sure it actually repeats 'bubble.ondrag,'+ 'body.ondragover,'+ //end repeating 'orange.ondrag,'+ //mouse moves over blue 'bubble.ondrag,'+ 'blue.ondragenter,'+ 'bubble.ondragenter,'+ 'body.ondragleave,'+ 'blue.ondragover,'+ 'bubble.ondragover,'+ 'orange.ondrag,'+ //start repeating (over blue) 'bubble.ondrag,'+ 'blue.ondragover,'+ 'bubble.ondragover,'+ 'orange.ondrag,'+ //...twice to make sure it actually repeats 'bubble.ondrag,'+ 'blue.ondragover,'+ 'bubble.ondragover,'+ //end repeating 'blue.ondrop,'+ //release 'bubble.ondrop,'+ 'orange.ondragend,'+ 'bubble.ondragend' ); }, 'Overall sequence'); /* ondragstart */ test(function () { assert_true( events.indexOf('orange.ondragstart') != -1 ); }, "orange.ondragstart should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'orange.ondragstart') return e; }).length, 1); }, "orange.ondragstart should fire 1 time"); test(function () { assert_equals( events[2], 'orange.ondragstart' ); }, "orange.ondragstart should be event handler test(function () { assert_equals( events.indexOf('pink.ondragstart'), -1 ); }, "pink.ondragstart should not fire"); test(function () { assert_equals( events.indexOf('yellow.ondragstart'), -1 ); }, "yellow.ondragstart should not fire"); test(function () { assert_equals( events.indexOf('blue.ondragstart'), -1 ); }, "blue.ondragstart should not fire"); test(function () { assert_equals( events.indexOf('body.ondragstart'), -1 ); }, "ondragstart should not fire at the body"); test(function () { assert_true( events.indexOf('bubble.ondragstart') != -1 ); }, "ondragstart should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondragstart') return e; }).length, 1); }, "ondragstart should only bubble to body 1 time"); test(function () { assert_equals( events[3], 'bubble.ondragstart' ); }, "ondragstart should bubble to body as event handler /* ondrag */ test(function () { assert_true( events.indexOf('orange.ondrag') != -1 ); }, "orange.ondrag should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'orange.ondrag') return e; }).length, 15); }, "orange.ondrag should fire 15 times"); for( var i = 0, evindex = [4,10,13,16,21,24,27,34,38,42,49,52,55,62,66]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'orange.ondrag' ); }, "orange.ondrag should be event handler #"+(evindex[i]+1)); } test(function () { assert_equals( events.indexOf('pink.ondrag'), -1 ); }, "pink.ondrag should not fire"); test(function () { assert_equals( events.indexOf('yellow.ondrag'), -1 ); }, "yellow.ondrag should not fire"); test(function () { assert_equals( events.indexOf('blue.ondrag'), -1 ); }, "blue.ondrag should not fire"); test(function () { assert_equals( events.indexOf('body.ondrag'), -1 ); }, "ondrag should not fire at the body"); test(function () { assert_true( events.indexOf('bubble.ondrag') != -1 ); }, "ondrag should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondrag') return e; }).length, 15); }, "ondrag should bubble to body 15 times"); for( var i = 0, evindex = [5,11,14,17,22,25,28,35,39,43,50,53,56,63,67]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'bubble.ondrag' ); }, "ondrag should bubble to body as event handler #"+(evindex[i]+1)); } /* ondragenter */ test(function () { assert_true( events.indexOf('orange.ondragenter') != -1 ); }, "orange.ondragenter should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'orange.ondragenter') return e; }).length, 1); }, "orange.ondragenter should fire 1 time"); test(function () { assert_equals( events[6], 'orange.ondragenter' ); }, "orange.ondragenter should be event handler test(function () { assert_true( events.indexOf('pink.ondragenter') != -1 ); }, "pink.ondragenter should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'pink.ondragenter') return e; }).length, 1); }, "pink.ondragenter should fire 1 time"); test(function () { assert_equals( events[18], 'pink.ondragenter' ); }, "pink.ondragenter should be event handler test(function () { assert_true( events.indexOf('yellow.ondragenter') != -1 ); }, "yellow.ondragenter should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'yellow.ondragenter') return e; }).length, 1); }, "yellow.ondragenter should fire 1 time"); test(function () { assert_equals( events[29], 'yellow.ondragenter' ); }, "yellow.ondragenter should be event handler test(function () { assert_true( events.indexOf('blue.ondragenter') != -1 ); }, "blue.ondragenter should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'blue.ondragenter') return e; }).length, 1); }, "blue.ondragenter should fire 1 time"); test(function () { assert_equals( events[57], 'blue.ondragenter' ); }, "blue.ondragenter should be event handler test(function () { assert_true( events.indexOf('body.ondragenter') != -1 ); }, "ondragenter should fire at body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'body.ondragenter') return e; }).length, 3); }, "ondragenter should fire at body 2 times"); for( var i = 0, evindex = [8,44,45]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'body.ondragenter' ); }, "ondragenter should fire at body as event handler #"+(evindex[i]+1)); } test(function () { assert_true( events.indexOf('bubble.ondragenter') != -1 ); }, "ondragenter should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondragenter') return e; }).length, 4); }, "ondragenter should bubble to body 4 times"); for( var i = 0, evindex = [7,19,30,58]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'bubble.ondragenter' ); }, "ondragenter should bubble to body as event handler #"+(evindex[i]+1)); } /* ondragover */ test(function () { assert_equals( events.indexOf('orange.ondragover'), -1 ); }, "orange.ondragover should not fire"); test(function () { assert_equals( events.indexOf('pink.ondragover'), -1 ); }, "pink.ondragover should not fire"); test(function () { assert_true( events.indexOf('yellow.ondragover') != -1 ); }, "yellow.ondragover should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'yellow.ondragover') return e; }).length, 3); }, "yellow.ondragover should fire 3 times"); for( var i = 0, evindex = [32,36,40]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'yellow.ondragover' ); }, "yellow.ondragover should be event handler #"+(evindex[i]+1)); } test(function () { assert_true( events.indexOf('blue.ondragover') != -1 ); }, "blue.ondragover should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'blue.ondragover') return e; }).length, 3); }, "blue.ondragover should fire 9 times"); for( var i = 0, evindex = [60,64,68]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'blue.ondragover' ); }, "blue.ondragover should be event handler #"+(evindex[i]+1)); } test(function () { assert_true( events.indexOf('body.ondragover') != -1 ); }, "ondragover should fire at body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'body.ondragover') return e; }).length, 9); }, "ondragover should fire at body 2 times"); for( var i = 0, evindex = [9,12,15,20,23,26,48,51,54]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'body.ondragover' ); }, "ondragover should fire at body as event handler #"+(evindex[i]+1)); } test(function () { assert_true( events.indexOf('bubble.ondragover') != -1 ); }, "ondragover should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondragover') return e; }).length, 6); }, "ondragover should bubble to body 6 times"); for( var i = 0, evindex = [33,37,41,61,65,69]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'bubble.ondragover' ); }, "ondragover should bubble to body as event handler #"+(evindex[i]+1)); } /* ondragleave */ test(function () { assert_equals( events.indexOf('orange.ondragleave'), -1 ); }, "orange.ondragleave should not fire"); test(function () { assert_equals( events.indexOf('pink.ondragleave'), -1 ); }, "pink.ondragleave should not fire"); test(function () { assert_true( events.indexOf('yellow.ondragleave') != -1 ); }, "yellow.ondragleave should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'yellow.ondragleave') return e; }).length, 1); }, "yellow.ondragleave should fire 1 time"); test(function () { assert_equals( events[46], 'yellow.ondragleave' ); }, "yellow.ondragleave should be event handler test(function () { assert_equals( events.indexOf('blue.ondragleave'), -1 ); }, "blue.ondragleave should not fire"); test(function () { assert_true( events.indexOf('body.ondragleave') != -1 ); }, "ondragleave should fire at body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'body.ondragleave') return e; }).length, 2); }, "ondragleave should fire at body 2 times"); for( var i = 0, evindex = [31,59]; i < evindex.length; i++ ) { test(function () { assert_equals( events[evindex[i]], 'body.ondragleave' ); }, "ondragleave should fire at body as event handler #"+(evindex[i]+1)); } test(function () { assert_true( events.indexOf('bubble.ondragleave') != -1 ); }, "ondragleave should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondragleave') return e; }).length, 1); }, "ondragleave should bubble to body 1 time"); test(function () { assert_equals( events[47], 'bubble.ondragleave' ); }, "ondragleave should bubble to body as event handler /* ondrop */ test(function () { assert_equals( events.indexOf('orange.ondrop'), -1 ); }, "orange.ondrop should not fire"); test(function () { assert_equals( events.indexOf('pink.ondrop'), -1 ); }, "pink.ondrop should not fire"); test(function () { assert_equals( events.indexOf('yellow.ondrop'), -1 ); }, "yellow.ondrop should not fire"); test(function () { assert_true( events.indexOf('blue.ondrop') != -1 ); }, "blue.ondrop should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'blue.ondrop') return e; }).length, 1); }, "blue.ondrop should fire 1 time"); test(function () { assert_equals( events[70], 'blue.ondrop' ); }, "blue.ondrop should be event handler test(function () { assert_equals( events.indexOf('body.ondrop'), -1 ); }, "ondrop should not fire at body"); test(function () { assert_true( events.indexOf('bubble.ondrop') != -1 ); }, "ondrop should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondrop') return e; }).length, 1); }, "ondrop should bubble to body 1 time"); test(function () { assert_equals( events[71], 'bubble.ondrop' ); }, "ondrop should bubble to body as event handler /* ondragend */ test(function () { assert_true( events.indexOf('orange.ondragend') != -1 ); }, "orange.ondragend should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'orange.ondragend') return e; }).length, 1); }, "orange.ondragend should fire 1 time"); test(function () { assert_equals( events[72], 'orange.ondragend' ); }, "orange.ondragend should be event handler test(function () { assert_equals( events.indexOf('pink.ondragend'), -1 ); }, "pink.ondragend should not fire"); test(function () { assert_equals( events.indexOf('yellow.ondragend'), -1 ); }, "yellow.ondragend should not fire"); test(function () { assert_equals( events.indexOf('blue.ondragend'), -1 ); }, "blue.ondragend should not fire"); test(function () { assert_equals( events.indexOf('body.ondragend'), -1 ); }, "ondragend should not fire at body"); test(function () { assert_true( events.indexOf('bubble.ondragend') != -1 ); }, "ondragend should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.ondragend') return e; }).length, 1); }, "ondragend should bubble to body 1 time"); test(function () { assert_equals( events[73], 'bubble.ondragend' ); }, "ondragend should bubble to body as event handler /* onmousedown */ test(function () { assert_true( events.indexOf('orange.onmousedown') != -1 ); }, "orange.onmousedown should fire"); test(function () { assert_equals( events.filter(function (e) { if (e == 'orange.onmousedown') return e; }).length, 1); }, "orange.onmousedown should fire 1 time"); test(function () { assert_equals( events[0], 'orange.onmousedown' ); }, "orange.onmousedown should be event handler test(function () { assert_equals( events.indexOf('pink.onmousedown'), -1 ); }, "pink.onmousedown should not fire"); test(function () { assert_equals( events.indexOf('yellow.onmousedown'), -1 ); }, "yellow.onmousedown should not fire"); test(function () { assert_equals( events.indexOf('blue.onmousedown'), -1 ); }, "blue.onmousedown should not fire"); test(function () { assert_equals( events.indexOf('body.onmousedown'), -1 ); }, "onmousedown should not fire at body"); test(function () { assert_true( events.indexOf('bubble.onmousedown') != -1 ); }, "onmousedown should bubble to body"); test(function () { assert_equals( events.filter(function (e) { if (e == 'bubble.onmousedown') return e; }).length, 1); }, "onmousedown should bubble to body 1 time"); test(function () { assert_equals( events[1], 'bubble.onmousedown' ); }, "onmousedown should bubble to body as event handler /* onmouseup */ test(function () { assert_equals( events.indexOf('orange.onmouseup'), -1 ); }, "orange.onmouseup should not fire"); test(function () { assert_equals( events.indexOf('pink.onmouseup'), -1 ); }, "pink.onmouseup should not fire"); test(function () { assert_equals( events.indexOf('yellow.onmouseup'), -1 ); }, "yellow.onmouseup should not fire"); test(function () { assert_equals( events.indexOf('blue.onmouseup'), -1 ); }, "blue.onmouseup should not fire"); test(function () { assert_equals( events.indexOf('body.onmouseup'), -1 ); }, "onmouseup should not fire at body"); test(function () { assert_equals( events.indexOf('bubble.onmouseup'), -1 ); }, "onmouseup should not bubble to body"); done(); } }; </script> <div id="testhere"> <div draggable='true' id='orange'></div> <div id='fuchsia'></div> <div id='yellow'></div> <div id='blue'></div> </div> <p>If you have already clicked on this page, reload it.</p> <p>Use your pointing device to slowly drag the orange square over the pink square then the yellow square, then the blue square, and release it over the blue square (make sure the mouse remains over each square for at least 1 second, and over the gaps between squares for at least 1 second). Fail if no new text appears below.</p> <div id="log"></div>
import json import mock from sentry.plugins.helpers import get_option, set_option from sentry.testutils import TestCase from sentry.models import set_sentry_version, Option from sentry.tasks.check_update import check_update, PYPI_URL class CheckUpdateTest(TestCase): OLD = '5.0.0' CURRENT = '5.5.0-DEV' NEW = '1000000000.5.1' KEY = 'sentry:latest_version' def <API key>(self): with mock.patch('sentry.tasks.check_update.fetch_url_content') as fetch: fetch.return_value = ( None, None, json.dumps({'info': {'version': self.NEW}}) ) check_update() # latest_version > current_version fetch.<API key>(PYPI_URL) self.assertEqual(get_option(key=self.KEY), self.NEW) def <API key>(self): with mock.patch('sentry.tasks.check_update.fetch_url_content') as fetch: fetch.return_value = (None, None, '') check_update() # latest_version == current_version fetch.<API key>(PYPI_URL) self.assertEqual(get_option(key=self.KEY), None) def <API key>(self): set_sentry_version(latest=self.NEW) self.assertEqual(get_option(key=self.KEY), self.NEW) def <API key>(self): set_option(self.KEY, self.OLD) with mock.patch('sentry.get_version') as get_version: get_version.return_value = self.CURRENT set_sentry_version(latest=self.NEW) self.assertEqual(Option.objects.get_value(key=self.KEY), self.NEW) def <API key>(self): set_option(self.KEY, self.NEW) with mock.patch('sentry.get_version') as get_version: get_version.return_value = self.CURRENT set_sentry_version(latest=self.OLD) self.assertEqual(Option.objects.get_value(key=self.KEY), self.NEW)
#include "chrome/renderer/<API key>.h" #include "base/test/histogram_tester.h" #include "chrome/test/base/<API key>.h" #include "components/translate/content/common/translate_messages.h" #include "components/translate/content/renderer/translate_helper.h" #include "components/translate/core/common/translate_constants.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_view.h" #include "third_party/WebKit/public/web/WebView.h" // Constants for UMA statistic collection. static const char <API key>[] = "Translate.CaptureText"; class <API key> : public <API key> {}; TEST_F(<API key>, <API key>) { base::HistogramTester histogram_tester; LoadHTML( "<!DOCTYPE html><body>" "This is a main document" "<iframe srcdoc=\"This a document in an iframe.\">" "</body>"); view_->GetWebView()-><API key>(); const IPC::Message* message = render_thread_->sink().<API key>( <API key>::ID); ASSERT_NE(static_cast<IPC::Message*>(NULL), message); <API key>::Param params; <API key>::Read(message, &params); EXPECT_TRUE(base::get<1>(params)) << "Page should be translatable."; // Should have 2 samples: one for preliminary capture, one for final capture. // If there are more, then subframes are being captured more than once. histogram_tester.ExpectTotalCount(<API key>, 2); }
var clientid = '<API key>'; if (/^#access_token=/.test(location.hash)) { location.assign('/Home/index?auto=1&ss=0' + '&cors=1' + '&client_id=' + clientid+ '&origins=https://webdir.online.lync.com/autodiscover/autodiscoverservice.svc/root'); } $('.loginForm').submit(function (event) { event.preventDefault(); if (location.hash == '') { location.assign('https://login.windows.net/common/oauth2/authorize?response_type=token' + '&client_id=' + clientid+ '&redirect_uri=http://healthcarenocc.azurewebsites.net/' + '&resource=https://webdir.online.lync.com'); } });
<?php $this->title = 'Update Country Detail: ' . ' ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'Countries', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update'; ?> <div class="countries-update"> <?= $this->render('_form', [ 'model' => $model, ]) ?> </div>
#include "FLA_f2c.h" /* Table of constant values */ static integer c__1 = 1; static integer c_n1 = -1; static integer c__3 = 3; static integer c__2 = 2; static integer c__65 = 65; static doublereal c_b25 = -1.; static doublereal c_b26 = 1.; /* > \brief \b DGEHRD */ /* Online html documentation available at */ /* > \htmlonly */ /* > Download DGEHRD + dependencies */ /* > [TGZ]</a> */ /* > [ZIP]</a> */ /* > [TXT]</a> */ /* > \endhtmlonly */ /* Definition: */ /* SUBROUTINE DGEHRD( N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO ) */ /* .. Scalar Arguments .. */ /* INTEGER IHI, ILO, INFO, LDA, LWORK, N */ /* .. Array Arguments .. */ /* DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * ) */ /* > \par Purpose: */ /* > \verbatim */ /* > DGEHRD reduces a real general matrix A to upper Hessenberg form H by */ /* > an orthogonal similarity transformation: Q**T * A * Q = H . */ /* > \endverbatim */ /* Arguments: */ /* > \param[in] N */ /* > \verbatim */ /* > N is INTEGER */ /* > The order of the matrix A. N >= 0. */ /* > \endverbatim */ /* > \param[in] ILO */ /* > \verbatim */ /* > ILO is INTEGER */ /* > \endverbatim */ /* > \param[in] IHI */ /* > \verbatim */ /* > IHI is INTEGER */ /* > It is assumed that A is already upper triangular in rows */ /* > and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally */ /* > set by a previous call to DGEBAL; otherwise they should be */ /* > set to 1 and N respectively. See Further Details. */ /* > 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. */ /* > \endverbatim */ /* > \param[in,out] A */ /* > \verbatim */ /* > A is DOUBLE PRECISION array, dimension (LDA,N) */ /* > On entry, the N-by-N general matrix to be reduced. */ /* > On exit, the upper triangle and the first subdiagonal of A */ /* > are overwritten with the upper Hessenberg matrix H, and the */ /* > elements below the first subdiagonal, with the array TAU, */ /* > represent the orthogonal matrix Q as a product of elementary */ /* > reflectors. See Further Details. */ /* > \endverbatim */ /* > \param[in] LDA */ /* > \verbatim */ /* > LDA is INTEGER */ /* > The leading dimension of the array A. LDA >= max(1,N). */ /* > \endverbatim */ /* > \param[out] TAU */ /* > \verbatim */ /* > TAU is DOUBLE PRECISION array, dimension (N-1) */ /* > The scalar factors of the elementary reflectors (see Further */ /* > Details). Elements 1:ILO-1 and IHI:N-1 of TAU are set to */ /* > zero. */ /* > \endverbatim */ /* > \param[out] WORK */ /* > \verbatim */ /* > WORK is DOUBLE PRECISION array, dimension (LWORK) */ /* > On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */ /* > \endverbatim */ /* > \param[in] LWORK */ /* > \verbatim */ /* > LWORK is INTEGER */ /* > The length of the array WORK. LWORK >= max(1,N). */ /* > For optimum performance LWORK >= N*NB, where NB is the */ /* > optimal blocksize. */ /* > If LWORK = -1, then a workspace query is assumed; the routine */ /* > only calculates the optimal size of the WORK array, returns */ /* > this value as the first entry of the WORK array, and no error */ /* > message related to LWORK is issued by XERBLA. */ /* > \endverbatim */ /* > \param[out] INFO */ /* > \verbatim */ /* > INFO is INTEGER */ /* > = 0: successful exit */ /* > \endverbatim */ /* Authors: */ /* > \author Univ. of Tennessee */ /* > \author Univ. of California Berkeley */ /* > \author Univ. of Colorado Denver */ /* > \author NAG Ltd. */ /* > \date November 2011 */ /* > \ingroup <API key> */ /* > \par Further Details: */ /* > \verbatim */ /* > The matrix Q is represented as a product of (ihi-ilo) elementary */ /* > reflectors */ /* > Q = H(ilo) H(ilo+1) . . . H(ihi-1). */ /* > Each H(i) has the form */ /* > H(i) = I - tau * v * v**T */ /* > where tau is a real scalar, and v is a real vector with */ /* > v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on */ /* > exit in A(i+2:ihi,i), and tau in TAU(i). */ /* > The contents of A are illustrated by the following example, with */ /* > n = 7, ilo = 2 and ihi = 6: */ /* > on entry, on exit, */ /* > ( a a a a a a a ) ( a a h h h h a ) */ /* > ( a a a a a a ) ( a h h h h a ) */ /* > ( a a a a a a ) ( h h h h h h ) */ /* > ( a a a a a a ) ( v2 h h h h h ) */ /* > ( a a a a a a ) ( v2 v3 h h h h ) */ /* > ( a a a a a a ) ( v2 v3 v4 h h h ) */ /* > ( a ) ( a ) */ /* > where a denotes an element of the original matrix A, h denotes a */ /* > modified element of the upper Hessenberg matrix H, and vi denotes an */ /* > element of the vector defining H(i). */ /* > This file is a slight modification of LAPACK-3.0's DGEHRD */ /* > subroutine incorporating improvements proposed by Quintana-Orti and */ /* > Van de Geijn (2006). (See DLAHR2.) */ /* > \endverbatim */ /* Subroutine */ int dgehrd_(integer *n, integer *ilo, integer *ihi, doublereal *a, integer *lda, doublereal *tau, doublereal *work, integer *lwork, integer *info) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2, i__3, i__4; /* Local variables */ integer i__, j; doublereal t[4160] /* was [65][64] */ ; integer ib; doublereal ei; integer nb, nh, nx, iws; extern /* Subroutine */ int dgemm_(char *, char *, integer *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, integer *); integer nbmin, iinfo; extern /* Subroutine */ int dtrmm_(char *, char *, char *, char *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *), daxpy_( integer *, doublereal *, doublereal *, integer *, doublereal *, integer *), dgehd2_(integer *, integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, integer *), dlahr2_( integer *, integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *), dlarfb_(char *, char *, char *, char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *), xerbla_(char *, integer *); extern integer ilaenv_(integer *, char *, char *, integer *, integer *, integer *, integer *); integer ldwork, lwkopt; logical lquery; /* -- LAPACK computational routine (version 3.4.0) -- */ /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ /* November 2011 */ /* .. Scalar Arguments .. */ /* .. Array Arguments .. */ /* .. Parameters .. */ /* .. Local Scalars .. */ /* .. Local Arrays .. */ /* .. External Subroutines .. */ /* .. Intrinsic Functions .. */ /* .. External Functions .. */ /* .. Executable Statements .. */ /* Test the input parameters */ /* Parameter adjustments */ a_dim1 = *lda; a_offset = 1 + a_dim1; a -= a_offset; --tau; --work; /* Function Body */ *info = 0; /* Computing MIN */ i__1 = 64; i__2 = ilaenv_(&c__1, "DGEHRD", " ", n, ilo, ihi, &c_n1); // , expr subst nb = min(i__1,i__2); lwkopt = *n * nb; work[1] = (doublereal) lwkopt; lquery = *lwork == -1; if (*n < 0) { *info = -1; } else if (*ilo < 1 || *ilo > max(1,*n)) { *info = -2; } else if (*ihi < min(*ilo,*n) || *ihi > *n) { *info = -3; } else if (*lda < max(1,*n)) { *info = -5; } else if (*lwork < max(1,*n) && ! lquery) { *info = -8; } if (*info != 0) { i__1 = -(*info); xerbla_("DGEHRD", &i__1); return 0; } else if (lquery) { return 0; } /* Set elements 1:ILO-1 and IHI:N-1 of TAU to zero */ i__1 = *ilo - 1; for (i__ = 1; i__ <= i__1; ++i__) { tau[i__] = 0.; /* L10: */ } i__1 = *n - 1; for (i__ = max(1,*ihi); i__ <= i__1; ++i__) { tau[i__] = 0.; /* L20: */ } /* Quick return if possible */ nh = *ihi - *ilo + 1; if (nh <= 1) { work[1] = 1.; return 0; } /* Determine the block size */ /* Computing MIN */ i__1 = 64; i__2 = ilaenv_(&c__1, "DGEHRD", " ", n, ilo, ihi, &c_n1); // , expr subst nb = min(i__1,i__2); nbmin = 2; iws = 1; if (nb > 1 && nb < nh) { /* Determine when to cross over from blocked to unblocked code */ /* (last block is always handled by unblocked code) */ /* Computing MAX */ i__1 = nb; i__2 = ilaenv_(&c__3, "DGEHRD", " ", n, ilo, ihi, &c_n1); // , expr subst nx = max(i__1,i__2); if (nx < nh) { /* Determine if workspace is large enough for blocked code */ iws = *n * nb; if (*lwork < iws) { /* Not enough workspace to use optimal NB: determine the */ /* minimum value of NB, and reduce NB or force use of */ /* unblocked code */ /* Computing MAX */ i__1 = 2; i__2 = ilaenv_(&c__2, "DGEHRD", " ", n, ilo, ihi, & c_n1); // , expr subst nbmin = max(i__1,i__2); if (*lwork >= *n * nbmin) { nb = *lwork / *n; } else { nb = 1; } } } } ldwork = *n; if (nb < nbmin || nb >= nh) { /* Use unblocked code below */ i__ = *ilo; } else { /* Use blocked code */ i__1 = *ihi - 1 - nx; i__2 = nb; for (i__ = *ilo; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { /* Computing MIN */ i__3 = nb; i__4 = *ihi - i__; // , expr subst ib = min(i__3,i__4); /* Reduce columns i:i+ib-1 to Hessenberg form, returning the */ /* matrices V and T of the block reflector H = I - V*T*V**T */ /* which performs the reduction, and also the matrix Y = A*V*T */ dlahr2_(ihi, &i__, &ib, &a[i__ * a_dim1 + 1], lda, &tau[i__], t, & c__65, &work[1], &ldwork); /* Apply the block reflector H to A(1:ihi,i+ib:ihi) from the */ /* right, computing A := A - Y * V**T. V(i+ib,ib-1) must be set */ /* to 1 */ ei = a[i__ + ib + (i__ + ib - 1) * a_dim1]; a[i__ + ib + (i__ + ib - 1) * a_dim1] = 1.; i__3 = *ihi - i__ - ib + 1; dgemm_("No transpose", "Transpose", ihi, &i__3, &ib, &c_b25, & work[1], &ldwork, &a[i__ + ib + i__ * a_dim1], lda, & c_b26, &a[(i__ + ib) * a_dim1 + 1], lda); a[i__ + ib + (i__ + ib - 1) * a_dim1] = ei; /* Apply the block reflector H to A(1:i,i+1:i+ib-1) from the */ /* right */ i__3 = ib - 1; dtrmm_("Right", "Lower", "Transpose", "Unit", &i__, &i__3, &c_b26, &a[i__ + 1 + i__ * a_dim1], lda, &work[1], &ldwork); i__3 = ib - 2; for (j = 0; j <= i__3; ++j) { daxpy_(&i__, &c_b25, &work[ldwork * j + 1], &c__1, &a[(i__ + j + 1) * a_dim1 + 1], &c__1); /* L30: */ } /* Apply the block reflector H to A(i+1:ihi,i+ib:n) from the */ /* left */ i__3 = *ihi - i__; i__4 = *n - i__ - ib + 1; dlarfb_("Left", "Transpose", "Forward", "Columnwise", &i__3, & i__4, &ib, &a[i__ + 1 + i__ * a_dim1], lda, t, &c__65, &a[ i__ + 1 + (i__ + ib) * a_dim1], lda, &work[1], &ldwork); /* L40: */ } } /* Use unblocked code to reduce the rest of the matrix */ dgehd2_(n, &i__, ihi, &a[a_offset], lda, &tau[1], &work[1], &iinfo); work[1] = (doublereal) iws; return 0; /* End of DGEHRD */ } /* dgehrd_ */
package org.buildmlearn.toolkit.flashcardtemplate.data; import org.w3c.dom.Document; import org.xml.sax.SAXException; import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.<API key>; import javax.xml.parsers.<API key>; /** * @brief Contains xml data utils for flash card template's simulator. */ public class DataUtils { public static String[] readTitleAuthor() { String result[] = new String[2]; <API key> dbf = <API key>.newInstance(); dbf.setValidating(false); DocumentBuilder db; Document doc; try { File fXmlFile = new File(org.buildmlearn.toolkit.flashcardtemplate.Constants.XMLFileName); db = dbf.newDocumentBuilder(); doc = db.parse(fXmlFile); doc.normalize(); result[0] = doc.<API key>("title").item(0).getChildNodes() .item(0).getNodeValue(); result[1] = doc.<API key>("name").item(0).getChildNodes() .item(0).getNodeValue(); } catch (<API key> | SAXException | IOException e) { e.printStackTrace(); } return result; } }
var vows = require('vows'), assert = require('assert'), path = require('path'), fs = require('fs'), exec = require('child_process').exec, base = path.join(__dirname, 'assets/badmodule/'), buildBase = path.join(base, 'build'), srcBase = path.join(base, 'src/foo'), rimraf = require('rimraf'); var tests = { 'clean build': { topic: function() { rimraf(path.join(buildBase, 'foo'), this.callback); }, 'should not have build dir and': { topic: function() { var self = this; fs.stat(path.join(buildBase, 'foo'), function(err) { self.callback(null, err); }); }, 'should not have build/foo': function(foo, err) { assert.isNotNull(err); assert.equal(err.code, 'ENOENT'); }, 'should build foo and': { topic: function() { var self = this, child; process.chdir(path.resolve(base, srcBase)); child = exec('../../../../../bin/shifter --no-global-config', function (error, stdout, stderr) { self.callback(null, { error: error, stderr: stderr }); }); }, 'should fail with an error code 1': function (topic) { assert.equal(topic.error.code, 1); }, 'should fail with an error message': function(topic) { assert.isNotNull(topic.stderr); } } } } }; vows.describe('building badmodule with UglifyJS via command line').addBatch(tests).export(module);
#ifndef <API key> #define <API key> #include "base/gtest_prod_util.h" #include "skia/ext/image_operations.h" #include "ui/base/ui_export.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/shadow_value.h" namespace gfx { class ImageSkia; class Rect; class Size; class UI_EXPORT ImageSkiaOperations { public: // Create an image that is a blend of two others. The alpha argument // specifies the opacity of the second imag. The provided image must // use the kARGB_8888_Config config and be of equal dimensions. static ImageSkia CreateBlendedImage(const ImageSkia& first, const ImageSkia& second, double alpha); // Creates an image that is the original image with opacity set to |alpha|. static ImageSkia <API key>(const ImageSkia& image, double alpha); // Creates new image by painting first and second image respectively. // The second image is centered in respect to the first image. static ImageSkia <API key>(const ImageSkia& first, const ImageSkia& second); // Create an image that is the original image masked out by the mask defined // in the alpha image. The images must use the kARGB_8888_Config config and // be of equal dimensions. static ImageSkia CreateMaskedImage(const ImageSkia& first, const ImageSkia& alpha); // Create an image that is cropped from another image. This is special // because it tiles the original image, so your coordinates can extend // outside the bounds of the original image. static ImageSkia CreateTiledImage(const ImageSkia& image, int src_x, int src_y, int dst_w, int dst_h); // Shift an image's HSL values. The shift values are in the range of 0-1, // with the option to specify -1 for 'no change'. The shift values are // defined as: // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map // to 0 and 360 on the hue color wheel (red). // hsl_shift[1] (saturation): A saturation shift for the image, with the // following key values: // 0 = remove all color. // 0.5 = leave unchanged. // 1 = fully saturate the image. // hsl_shift[2] (lightness): A lightness shift for the image, with the // following key values: // 0 = remove all lightness (make all pixels black). // 0.5 = leave unchanged. // 1 = full lightness (make all pixels white). static ImageSkia <API key>(const gfx::ImageSkia& image, const color_utils::HSL& hsl_shift); // Creates a button background image by compositing the color and image // together, then applying the mask. This is a highly specialized composite // operation that is the equivalent of drawing a background in |color|, // tiling |image| over the top, and then masking the result out with |mask|. // The images must use kARGB_8888_Config config. static ImageSkia <API key>(SkColor color, const gfx::ImageSkia& image, const gfx::ImageSkia& mask); // Returns an image which is a subset of |image| with bounds |subset_bounds|. // The |image| cannot use kA1_Config config. static ImageSkia ExtractSubset(const gfx::ImageSkia& image, const gfx::Rect& subset_bounds); // Creates an image by resizing |source| to given |target_dip_size|. static ImageSkia CreateResizedImage(const ImageSkia& source, skia::ImageOperations::ResizeMethod methd, const Size& target_dip_size); // Creates an image with drop shadow defined in |shadows| for |source|. static ImageSkia <API key>(const ImageSkia& source, const ShadowValues& shadows); private: ImageSkiaOperations(); // Class for scoping only. }; } // namespace gfx #endif // <API key>
use std::ops::Mul; use num::One; use structs::mat; use traits::operations::{Inv, Transpose}; use traits::geometry::{Translate, Rotate, Transform, AbsoluteRotate}; impl One for mat::Identity { #[inline] fn one() -> mat::Identity { mat::Identity::new() } } impl Inv for mat::Identity { fn inv(&self) -> Option<mat::Identity> { Some(mat::Identity::new()) } fn inv_mut(&mut self) -> bool { true } } impl<T: Clone> Mul<T> for mat::Identity { type Output = T; #[inline] fn mul(self, other: T) -> T { other } } impl Transpose for mat::Identity { #[inline] fn transpose(&self) -> mat::Identity { mat::Identity::new() } #[inline] fn transpose_mut(&mut self) { } } impl<V: Clone> Translate<V> for mat::Identity { #[inline] fn translate(&self, v: &V) -> V { v.clone() } #[inline] fn inv_translate(&self, v: &V) -> V { v.clone() } } impl<V: Clone> Rotate<V> for mat::Identity { #[inline] fn rotate(&self, v: &V) -> V { v.clone() } #[inline] fn inv_rotate(&self, v: &V) -> V { v.clone() } } impl<V: Clone> AbsoluteRotate<V> for mat::Identity { #[inline] fn absolute_rotate(&self, v: &V) -> V { v.clone() } } impl<V: Clone> Transform<V> for mat::Identity { #[inline] fn transform(&self, v: &V) -> V { v.clone() } #[inline] fn inv_transform(&self, v: &V) -> V { v.clone() } }
// testAPI.cpp : Defines the entry point for the console application. // NOTES: // 1. MediaFile library and testAPI.cpp must be built in DEBUG mode for testing. #include <iostream> #include <stdio.h> #include <assert.h> #ifdef WIN32 #include <windows.h> #include <tchar.h> #endif #include "common_types.h" #include "trace.h" #include "<API key>.h" #include "media_file.h" #include "file_player.h" #include "file_recorder.h" bool notify = false, playing = false, recording = false; // callback class for FileModule class <API key> : public FileCallback { public: virtual void PlayNotification( const WebRtc_Word32 id, const WebRtc_UWord32 durationMs ) { printf("\tReceived PlayNotification from module %ld, durationMs = %ld\n", id, durationMs); notify = true; }; virtual void RecordNotification( const WebRtc_Word32 id, const WebRtc_UWord32 durationMs ) { printf("\tReceived RecordNotification from module %ld, durationMs = %ld\n", id, durationMs); notify = true; }; virtual void PlayFileEnded(const WebRtc_Word32 id) { printf("\tReceived PlayFileEnded notification from module %ld.\n", id); playing = false; }; virtual void RecordFileEnded(const WebRtc_Word32 id) { printf("\tReceived RecordFileEnded notification from module %ld.\n", id); recording = false; } }; // main test app #ifdef WIN32 int _tmain(int argc, _TCHAR* argv[]) #else int main(int /*argc*/, char** /*argv*/) #endif { Trace::CreateTrace(); Trace::SetTraceFile("testTrace.txt"); Trace::<API key>("testTraceDebug.txt"); int playId = 1; int recordId = 2; printf("Welcome to test of FilePlayer and FileRecorder\n"); // avi test case 1 // todo PW we need more AVI tests Mp4 { FilePlayer& filePlayer(*FilePlayer::CreateFilePlayer(1, webrtc::kFileFormatAviFile)); FileRecorder& fileRecorder(*FileRecorder::CreateFileRecorder(1, webrtc::kFileFormatAviFile)); const char* KFileName = "./<API key>.avi"; printf("\tReading from an avi file and writing the information to another \n"); printf("\tin the same format (I420 CIF 30fps) \n"); printf("\t\t check file named %s\n", KFileName); assert(filePlayer.<API key>( "../../../MediaFile/main/test/files/<API key>.avi", false, false) == 0); // init codecs webrtc::VideoCodec videoCodec; webrtc::VideoCodec recVideoCodec; webrtc::CodecInst audioCodec; assert(filePlayer.VideoCodec( videoCodec ) == 0); assert(filePlayer.AudioCodec( audioCodec) == 0); recVideoCodec = videoCodec; assert( fileRecorder.<API key>(KFileName, audioCodec, recVideoCodec) == 0); assert(fileRecorder.IsRecording()); webrtc::I420VideoFrame videoFrame; videoFrame.CreateEmptyFrame(videoCodec.width, videoCodec.height, videoCodec.width, (videoCodec.width + 1) / 2, (videoCodec.width + 1) / 2); int frameCount = 0; bool audioNotDone = true; bool videoNotDone = true; AudioFrame audioFrame; while( audioNotDone || videoNotDone) { if(filePlayer.<API key>() <= 0) { if(filePlayer.GetVideoFromFile( videoFrame) != 0) { // no more video frames break; } frameCount++; videoNotDone = !videoFrame.IsZeroSize(); videoFrame.SetRenderTime(TickTime::<API key>()); if( videoNotDone) { assert(fileRecorder.RecordVideoToFile(videoFrame) == 0); ::Sleep(10); } } WebRtc_UWord32 <API key>; if( 0 != filePlayer.<API key>( audioFrame.data_, <API key>, audioCodec.plfreq)) { audioNotDone = false; } else { audioFrame.sample_rate_hz_ = filePlayer.Frequency(); audioFrame.<API key> = (WebRtc_UWord16)<API key>; fileRecorder.RecordAudioToFile(audioFrame, &TickTime::Now()); } } ::Sleep(100); assert(fileRecorder.StopRecording() == 0); assert( !fileRecorder.IsRecording()); assert(frameCount == 135); printf("\tGenerated %s\n\n", KFileName); } // avi test case 2 { FilePlayer& filePlayer(*FilePlayer::CreateFilePlayer(2, webrtc::kFileFormatAviFile)); FileRecorder& fileRecorder(*FileRecorder::CreateFileRecorder(2, webrtc::kFileFormatAviFile)); const char* KFileName = "./<API key>.avi"; printf("\tWriting information to a avi file and check the written file by \n"); printf("\treopening it and control codec information.\n"); printf("\t\t check file named %s all frames should be light green.\n", KFileName); // init codecs webrtc::VideoCodec videoCodec; webrtc::CodecInst audioCodec; memset(&videoCodec, 0, sizeof(videoCodec)); const char* KVideoCodecName = "I420"; strcpy(videoCodec.plName, KVideoCodecName); videoCodec.plType = 124; videoCodec.maxFramerate = 20; videoCodec.height = 288; videoCodec.width = 352; const char* KAudioCodecName = "PCMU"; strcpy(audioCodec.plname, KAudioCodecName); audioCodec.pltype = 0; audioCodec.plfreq = 8000; audioCodec.pacsize = 80; audioCodec.channels = 1; audioCodec.rate = 64000; assert( fileRecorder.<API key>( KFileName, audioCodec, videoCodec) == 0); assert(fileRecorder.IsRecording()); const WebRtc_UWord32 KVideoWriteSize = static_cast< WebRtc_UWord32>( (videoCodec.width * videoCodec.height * 3) / 2); webrtc::VideoFrame videoFrame; // 10 ms AudioFrame audioFrame; audioFrame.<API key> = audioCodec.plfreq/100; memset(audioFrame.data_, 0, 2*audioFrame.<API key>); audioFrame.sample_rate_hz_ = 8000; // prepare the video frame int half_width = (videoCodec.width + 1) / 2; int half_height = (videoCodec.height + 1) / 2; videoFrame.CreateEmptyFrame(videoCodec.width, videoCodec.height, videoCodec.width, half_width, half_width); memset(videoFrame.buffer(kYPlane), 127, videoCodec.width * videoCodec.height); memset(videoFrame.buffer(kUPlane), 0, half_width * half_height); memset(videoFrame.buffer(kVPlane), 0, half_width * half_height); // write avi file, with 20 video frames const int KWriteNumFrames = 20; int writeFrameCount = 0; while(writeFrameCount < KWriteNumFrames) { // add a video frame assert(fileRecorder.RecordVideoToFile(videoFrame) == 0); // add 50 ms of audio for(int i=0; i<5; i++) { assert( fileRecorder.RecordAudioToFile(audioFrame) == 0); }// for i writeFrameCount++; } ::Sleep(10); // enough tim eto write the queued data to the file assert(writeFrameCount == 20); assert(fileRecorder.StopRecording() == 0); assert( ! fileRecorder.IsRecording()); assert(filePlayer.<API key>(KFileName,false, false) == 0); assert(filePlayer.IsPlayingFile( )); // compare codecs read from file to the ones used when writing the file webrtc::VideoCodec readVideoCodec; assert(filePlayer.VideoCodec( readVideoCodec ) == 0); assert(strcmp(readVideoCodec.plName, videoCodec.plName) == 0); assert(readVideoCodec.width == videoCodec.width); assert(readVideoCodec.height == videoCodec.height); assert(readVideoCodec.maxFramerate == videoCodec.maxFramerate); webrtc::CodecInst readAudioCodec; assert(filePlayer.AudioCodec( readAudioCodec) == 0); assert(strcmp(readAudioCodec.plname, audioCodec.plname) == 0); assert(readAudioCodec.pltype == audioCodec.pltype); assert(readAudioCodec.plfreq == audioCodec.plfreq); assert(readAudioCodec.pacsize == audioCodec.pacsize); assert(readAudioCodec.channels == audioCodec.channels); assert(readAudioCodec.rate == audioCodec.rate); assert(filePlayer.StopPlayingFile() == 0); assert( ! filePlayer.IsPlayingFile()); printf("\tGenerated %s\n\n", KFileName); } // avi test case 3 { FilePlayer& filePlayer(*FilePlayer::CreateFilePlayer(2, webrtc::kFileFormatAviFile)); FileRecorder& fileRecorder(*FileRecorder::CreateFileRecorder(3, webrtc::kFileFormatAviFile)); printf("\tReading from an avi file and writing the information to another \n"); printf("\tin a different format (H.263 CIF 30fps) \n"); printf("\t\t check file named <API key>.avi\n"); assert(filePlayer.<API key>( "../../../MediaFile/main/test/files/<API key>.avi", false, false) == 0); // init codecs webrtc::VideoCodec videoCodec; webrtc::VideoCodec recVideoCodec; webrtc::CodecInst audioCodec; assert(filePlayer.VideoCodec( videoCodec ) == 0); assert(filePlayer.AudioCodec( audioCodec) == 0); recVideoCodec = videoCodec; memcpy(recVideoCodec.plName, "H263",5); recVideoCodec.startBitrate = 1000; recVideoCodec.codecSpecific.H263.quality = 1; recVideoCodec.plType = 34; recVideoCodec.codecType = webrtc::kVideoCodecH263; assert( fileRecorder.<API key>( "./<API key>.avi", audioCodec, recVideoCodec) == 0); assert(fileRecorder.IsRecording()); webrtc::I420VideoFrame videoFrame; videoFrame.CreateEmptyFrame(videoCodec.width, videoCodec.height, videoCodec.width, half_width,half_width); int videoFrameCount = 0; int audioFrameCount = 0; bool audioNotDone = true; bool videoNotDone = true; AudioFrame audioFrame; while( audioNotDone || videoNotDone) { if(filePlayer.<API key>() <= 0) { if(filePlayer.GetVideoFromFile(videoFrame) != 0) { break; } videoFrameCount++; videoNotDone = !videoFrame.IsZeroSize(); if( videoNotDone) { assert(fileRecorder.RecordVideoToFile(videoFrame) == 0); } } WebRtc_UWord32 <API key>; if( 0 != filePlayer.<API key>( audioFrame.data_, <API key>, audioCodec.plfreq)) { audioNotDone = false; } else { ::Sleep(5); audioFrame.sample_rate_hz_ = filePlayer.Frequency(); audioFrame.<API key> = (WebRtc_UWord16)<API key>; assert(0 == fileRecorder.RecordAudioToFile(audioFrame)); audioFrameCount++; } } assert(videoFrameCount == 135); assert(audioFrameCount == 446); // we will start & stop with a video frame assert(fileRecorder.StopRecording() == 0); assert( !fileRecorder.IsRecording()); printf("\tGenerated ./<API key>.avi\n\n"); } printf("\nTEST completed.\n"); Trace::ReturnTrace(); return 0; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Forms :: textarea : padding</title> <style type="text/css"> form * { font-family: Ahem; font-size: 1em; line-height: 1em; } fieldset, form>div { padding: 0; margin: 10px; border: none; } textarea, div div { color: black; background: lime; padding: 2em; margin: 0; border: none; width: 1em; height: 1em; overflow: hidden; resize: none; } </style> </head> <body> <h4>Ahem font required for this test</h4> <p>there should be two identical patterns below</p> <form action=""> <fieldset> <textarea rows="" cols="">x</textarea> </fieldset> <div> <div>x</div> </div> </form> </body> </html>